summaryrefslogtreecommitdiff
path: root/plugins/localstack/localstack.plugin.zsh
blob: 080b14a54e1fbc296f646d110cfaa86065aa7897 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)"
}