Skip to content

Commit

Permalink
[Go] Publish messages to topics and queues workflow in Go. (awsdocs#6090
Browse files Browse the repository at this point in the history
)

Publish messages to topics and queues workflow in Go.
Also updates lint all and test all scripts to handle non-module folders
and to include workflows in linting and testing.
  • Loading branch information
Laren-AWS authored Feb 13, 2024
1 parent b532be1 commit 38154ca
Show file tree
Hide file tree
Showing 26 changed files with 1,926 additions and 8 deletions.
70 changes: 70 additions & 0 deletions .doc_gen/metadata/sns_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ sns_Hello:
excerpts:
- snippet_tags:
- TopicsAndQueues.dotnetv3.HelloSNS
Go:
versions:
- sdk_version: 2
github: gov2/sns
excerpts:
- description:
snippet_tags:
- gov2.sns.Hello
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -230,6 +238,14 @@ sns_ListTopics:
excerpts:
- snippet_tags:
- sns.cpp.list_topics.code
Go:
versions:
- sdk_version: 2
github: gov2/sns
excerpts:
- description:
snippet_tags:
- gov2.sns.Hello
PHP:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -522,6 +538,15 @@ sns_Publish_WithAttribute:
- cpp.example_code.cross-service.topics_and_queues.sns_client
- cpp.example_code.cross-service.topics_and_queues.publish_message_with_attributes
- cpp.example_code.cross-service.topics_and_queues.publish_message_with_attributes2
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topic_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sns.SnsActions.struct
- gov2.sns.Publish
JavaScript:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -661,6 +686,15 @@ sns_CreateTopic:
excerpts:
- snippet_tags:
- sns.cpp.create_topic.code
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topic_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sns.SnsActions.struct
- gov2.sns.CreateTopic
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -753,6 +787,15 @@ sns_DeleteTopic:
excerpts:
- snippet_tags:
- sns.cpp.delete_topic.code
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topic_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sns.SnsActions.struct
- gov2.sns.DeleteTopic
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -857,6 +900,15 @@ sns_Publish:
excerpts:
- snippet_tags:
- sns.cpp.publish_to_topic.code
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topic_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sns.SnsActions.struct
- gov2.sns.Publish
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -1345,6 +1397,15 @@ sns_Subscribe_Queue:
- cpp.example_code.cross-service.topics_and_queues.sns_client
- cpp.example_code.cross-service.topics_and_queues.subscribe_queue1
- cpp.example_code.cross-service.topics_and_queues.subscribe_queue2
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topic_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sns.SnsActions.struct
- gov2.sns.Subscribe
JavaScript:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -1381,6 +1442,15 @@ sns_Subscribe_Filtered:
- cpp.example_code.cross-service.topics_and_queues.sns_client
- cpp.example_code.cross-service.topics_and_queues.subscribe_queue_with_filter
- cpp.example_code.cross-service.topics_and_queues.subscribe_queue_with_filter2
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topic_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sns.SnsActions.struct
- gov2.sns.Subscribe
JavaScript:
versions:
- sdk_version: 3
Expand Down
84 changes: 84 additions & 0 deletions .doc_gen/metadata/sqs_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ sqs_Hello:
- description: Code for the hello_sqs.cpp source file.
snippet_tags:
- cpp.example_code.sqs.hello_sqs
Go:
versions:
- sdk_version: 2
github: gov2/sqs
excerpts:
- description:
snippet_tags:
- gov2.sqs.Hello
JavaScript:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -70,6 +78,15 @@ sqs_CreateQueue:
- description: Create an &SQS; queue and send a message to it.
snippet_tags:
- SQS.dotnetv3.CreateSendExample
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topics_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sqs.SqsActions.struct
- gov2.sqs.CreateQueue
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -228,6 +245,14 @@ sqs_ListQueues:
synopsis: list &SQS; queues.
category:
languages:
Go:
versions:
- sdk_version: 2
github: gov2/sqs
excerpts:
- description:
snippet_tags:
- gov2.sqs.Hello
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -325,6 +350,15 @@ sqs_DeleteQueue:

snippet_tags:
- TopicsAndQueues.dotnetv3.DeleteQueue
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topics_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sqs.SqsActions.struct
- gov2.sqs.DeleteQueue
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -548,6 +582,15 @@ sqs_ReceiveMessage:
- description: Receive a message from an &SQS; queue, and then delete the message.
snippet_tags:
- SQS.dotnetv3.ReceiveDeleteExample
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topics_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sqs.SqsActions.struct
- gov2.sqs.ReceiveMessage
Kotlin:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -720,6 +763,15 @@ sqs_DeleteMessageBatch:
- description:
snippet_tags:
- TopicsAndQueues.dotnetv3.DeleteMessageBatch
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topics_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sqs.SqsActions.struct
- gov2.sqs.DeleteMessageBatch
Python:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -830,6 +882,15 @@ sqs_GetQueueAttributes:
- cpp.example_code.cross-service.topics_and_queues.GetQueueAttributes1
- cpp.example_code.cross-service.topics_and_queues.GetQueueAttributes2
- cpp.example_code.cross-service.topics_and_queues.GetQueueAttributes3
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topics_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sqs.SqsActions.struct
- gov2.sqs.GetQueueAttributes
JavaScript:
versions:
- sdk_version: 3
Expand Down Expand Up @@ -917,6 +978,15 @@ sqs_SetQueueAttributes:
- description: Set the policy attribute of a queue for a topic.
snippet_tags:
- TopicsAndQueues.dotnetv3.SetQueueAttributes
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topics_and_queues
excerpts:
- description:
snippet_tags:
- gov2.sqs.SqsActions.struct
- gov2.sqs.SetQueueAttributes
C++:
versions:
- sdk_version: 1
Expand Down Expand Up @@ -1001,6 +1071,20 @@ sqs_Scenario_TopicsAndQueues:
snippet_tags:
- cpp.example_code.cross-service.topics_and_queues.config
- cpp.example_code.cross-service.topics_and_queues.messaging_with_topics_and_queues
Go:
versions:
- sdk_version: 2
github: gov2/workflows/topics_and_queues
excerpts:
- description: Run an interactive scenario at a command prompt.
snippet_tags:
- gov2.workflows.TopicsAndQueues
- description: Define a struct that wraps &SNS; actions used in this example.
snippet_tags:
- gov2.sns.SnsActions.complete
- description: Define a struct that wraps &SQS; actions used in this example.
snippet_tags:
- gov2.sqs.SqsActions.complete
JavaScript:
versions:
- sdk_version: 3
Expand Down
2 changes: 1 addition & 1 deletion gov2/dynamodb/scenarios/scenario_partiql_batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (scenTest *PartiQLBatchScenarioTest) SetupDataAndStubs() []testtools.Stub {
nil, aws.Int32(pageSize), nil, projectedMovies[0:pageSize], aws.String(pageToken), nil))
stubList = append(stubList, stubs.StubExecuteStatement(
fmt.Sprintf("SELECT title, info.rating FROM \"%v\"", scenTest.TableName),
nil, aws.Int32(pageSize), aws.String(pageToken), projectedMovies[pageSize:len(projectedMovies)], nil, nil))
nil, aws.Int32(pageSize), aws.String(pageToken), projectedMovies[pageSize:], nil, nil))
stubList = append(stubList, stubs.StubBatchExecuteStatement(deleteStatements, getDelParamList, nil, nil))
stubList = append(stubList, stubs.StubDeleteTable(scenTest.TableName, nil))

Expand Down
9 changes: 6 additions & 3 deletions gov2/lint_all_go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ function runCommand() {
do
echo Linting "$d"...
(cd "$d" || exit
golangci-lint run
ret_code=$?
if [ $ret_code != 0 ]; then exit $ret_code; else echo success; fi)
if [ -f go.mod ]; then
golangci-lint run
ret_code=$?
if [ $ret_code != 0 ]; then exit $ret_code; else echo success; fi
fi)
done
}

runCommand
(cd workflows && runCommand)
13 changes: 9 additions & 4 deletions gov2/run_all_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ function runCommand() {
kind='unit'
fi
echo "Running $kind tests..."
for d in /gov2/*/ ; do
/bin/bash -c "(cd '$d' && go test -tags='$1' -timeout=60m ./...)"
done
for d in /"$2"/*/
do
(cd "$d" || exit
if [ -f go.mod ]; then
/bin/bash -c "(go test -tags='$1' -timeout=60m ./...)"
fi)
done
}

runCommand "$1"
runCommand "$1" "gov2"
runCommand "$1" "gov2/workflows"
Loading

0 comments on commit 38154ca

Please sign in to comment.