Skip to content

Commit

Permalink
Add support for a --endpoint, -e parameter to allow usage of the non …
Browse files Browse the repository at this point in the history
…default endpoint in a region (#28)

Co-authored-by: David Bennington <david.bennington@thetalake.com>
  • Loading branch information
Spiral90210 and Spiral90210 authored Jul 4, 2021
1 parent c535aa1 commit 0581e57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Flags:
-s, --source=SOURCE The source queue name to move messages from.
-d, --destination=DESTINATION The destination queue name to move messages to.
-r, --region="us-west-2" The AWS region for source and destination queues.
-e, --endpoint="https://..." Use a specific endpoint in an AWS region. For more information see https://docs.aws.amazon.com/general/latest/gr/sqs-service.html
-p, --profile="" Use a specific profile from AWS credentials file.
-l, --limit=0 Limits total number of messages moved. No limit is set by default.
-b, --batch=10 The maximum number of messages to move at a time.
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var (
sourceQueue = kingpin.Flag("source", "The source queue name to move messages from.").Short('s').Required().String()
destinationQueue = kingpin.Flag("destination", "The destination queue name to move messages to.").Short('d').Required().String()
region = kingpin.Flag("region", "The AWS region for source and destination queues.").Short('r').Default("").String()
endpoint = kingpin.Flag("endpoint", "Use a specific endpoint in an AWS region.").Short('e').Default("").String()
profile = kingpin.Flag("profile", "Use a specific profile from AWS credentials file.").Short('p').String()
limit = kingpin.Flag("limit", "Limits total number of messages moved. No limit is set by default.").Short('l').Default("0").Int()
maxBatchSize = kingpin.Flag("batch", "The maximum number of messages to move at a time").Short('b').Default("10").Int64()
Expand All @@ -54,9 +55,12 @@ func main() {
}

if region != nil {
options.Config = aws.Config{Region: aws.String(*region)}
options.Config.Region = aws.String(*region)
}

// Our default "" value uses the AWS auto generated value
options.Config.Endpoint = aws.String(*endpoint)

sess, err := session.NewSessionWithOptions(options)

if err != nil {
Expand Down

0 comments on commit 0581e57

Please sign in to comment.