mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 07:43:31 +01:00
feat(localstack): add plugin (#12595)
This commit is contained in:
parent
e50dd3417c
commit
2acfe1aa0e
24
plugins/localstack/README.md
Normal file
24
plugins/localstack/README.md
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# Localstack plugin #
|
||||||
|
|
||||||
|
CLI support for LOCALSTACK interaction
|
||||||
|
|
||||||
|
## Description ##
|
||||||
|
To use it, add `localstack` to the plugins array in your zshrc file:
|
||||||
|
|
||||||
|
```zsh
|
||||||
|
plugins=(... localstack)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage ##
|
||||||
|
|
||||||
|
This plugin supplies one command, `lsk`, through which all its features are exposed.
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
| Command | Description |
|
||||||
|
| :------------ | :-------------------------------------------------------------------- |
|
||||||
|
| `lsk sqs-send <queue> <message.json>` | sends a given message in sqs to a given queue |
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
![staging](sqs-send-result.png)
|
37
plugins/localstack/localstack.plugin.zsh
Normal file
37
plugins/localstack/localstack.plugin.zsh
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# CLI support for LOCALSTACK interaction
|
||||||
|
#
|
||||||
|
# See README.md for details
|
||||||
|
lsk() {
|
||||||
|
case $1 in
|
||||||
|
sqs-send)
|
||||||
|
shift
|
||||||
|
sqs-send "$@"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Command not found: $1"
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Send SQS function
|
||||||
|
#
|
||||||
|
# This function sends a given message in sqs to a given queue, when used Localstack
|
||||||
|
#
|
||||||
|
# Use:
|
||||||
|
# sqs-send <queue> <message>
|
||||||
|
#
|
||||||
|
# Parameters
|
||||||
|
# <queue> A given queue
|
||||||
|
# <message> A content of message em json archive
|
||||||
|
#
|
||||||
|
# Example
|
||||||
|
# sqs-send user user.json
|
||||||
|
sqs-send(){
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Use: sqs-send <queue> <payload>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -X POST "http://localhost:4566/000000000000/$1" -d "Action=SendMessage" -d "MessageBody=$(cat $2)"
|
||||||
|
}
|
BIN
plugins/localstack/sqs-send-result.png
Normal file
BIN
plugins/localstack/sqs-send-result.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
Loading…
Reference in New Issue
Block a user