Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .doc_gen/metadata/sqs_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,15 @@ sqs_Scenario_TopicsAndQueues:
excerpts:
- snippet_tags:
- sns.kotlin.workflow.main
Swift:
versions:
- sdk_version: 1
github: swift/example_code/sqs/scenario
sdkguide:
excerpts:
- description:
snippet_tags:
- swift.sqs.scenario.main
services:
sns: {CreateTopic, Subscribe, Publish, Unsubscribe, DeleteTopic}
sqs: {CreateQueue, GetQueueAttributes, SetQueueAttributes, ReceiveMessage, DeleteMessageBatch, DeleteQueue}
Expand Down
5 changes: 1 addition & 4 deletions swift/example_code/s3/ListBuckets-Simple/Sources/entry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import AWSClientRuntime
import AWSS3
import Foundation

// snippet-end:[s3.swift.intro.imports]

// snippet-start:[s3.swift.intro.getbucketnames]
Expand Down Expand Up @@ -56,11 +55,10 @@ func getBucketNames() async throws -> [String] {
}
}
}

// snippet-end:[s3.swift.intro.getbucketnames]

// snippet-start:[s3.swift.intro.main]
/// The program's asynchronous entry point.
// snippet-start:[s3.swift.intro.main]
@main
struct Main {
static func main() async {
Expand All @@ -78,5 +76,4 @@ struct Main {
}
}
}

// snippet-end:[s3.swift.intro.main]
23 changes: 23 additions & 0 deletions swift/example_code/sns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ Code excerpts that show you how to call individual service functions.
- [Subscribe](SubscribeEmail/Sources/entry.swift#L31)
- [Unsubscribe](Unsubscribe/Sources/entry.swift#L29)

### Scenarios

Code examples that show you how to accomplish a specific task by calling multiple
functions within the same service.

- [Publish messages to queues](../sqs/scenario/Sources/entry.swift)


<!--custom.examples.start-->
<!--custom.examples.end-->
Expand Down Expand Up @@ -74,6 +81,22 @@ This example shows you how to get started using Amazon SNS.



#### Publish messages to queues

This example shows you how to do the following:

- Create topic (FIFO or non-FIFO).
- Subscribe several queues to the topic with an option to apply a filter.
- Publish messages to the topic.
- Poll the queues for messages received.

<!--custom.scenario_prereqs.sqs_Scenario_TopicsAndQueues.start-->
<!--custom.scenario_prereqs.sqs_Scenario_TopicsAndQueues.end-->


<!--custom.scenarios.sqs_Scenario_TopicsAndQueues.start-->
<!--custom.scenarios.sqs_Scenario_TopicsAndQueues.end-->

### Tests

⚠ Running tests might result in charges to your AWS account.
Expand Down
23 changes: 23 additions & 0 deletions swift/example_code/sqs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ Code excerpts that show you how to call individual service functions.
- [ReceiveMessage](ReceiveMessage/Sources/entry.swift#L31)
- [SetQueueAttributes](SetQueueAttributes/Sources/entry.swift#L32)

### Scenarios

Code examples that show you how to accomplish a specific task by calling multiple
functions within the same service.

- [Publish messages to queues](scenario/Sources/entry.swift)


<!--custom.examples.start-->
<!--custom.examples.end-->
Expand Down Expand Up @@ -75,6 +82,22 @@ This example shows you how to get started using Amazon SQS.



#### Publish messages to queues

This example shows you how to do the following:

- Create topic (FIFO or non-FIFO).
- Subscribe several queues to the topic with an option to apply a filter.
- Publish messages to the topic.
- Poll the queues for messages received.

<!--custom.scenario_prereqs.sqs_Scenario_TopicsAndQueues.start-->
<!--custom.scenario_prereqs.sqs_Scenario_TopicsAndQueues.end-->


<!--custom.scenarios.sqs_Scenario_TopicsAndQueues.start-->
<!--custom.scenarios.sqs_Scenario_TopicsAndQueues.end-->

### Tests

⚠ Running tests might result in charges to your AWS account.
Expand Down
41 changes: 41 additions & 0 deletions swift/example_code/sqs/scenario/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// swift-tools-version: 5.9
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//
// The swift-tools-version declares the minimum version of Swift required to
// build this package.

import PackageDescription

let package = Package(
name: "queue-scenario",
// Let Xcode know the minimum Apple platforms supported.
platforms: [
.macOS(.v13),
.iOS(.v15)
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(
url: "https://github.com/awslabs/aws-sdk-swift",
from: "1.0.0"),
.package(
url: "https://github.com/apple/swift-argument-parser.git",
branch: "main"
)
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products
// from dependencies.
.executableTarget(
name: "queue-scenario",
dependencies: [
.product(name: "AWSSNS", package: "aws-sdk-swift"),
.product(name: "AWSSQS", package: "aws-sdk-swift"),
.product(name: "ArgumentParser", package: "swift-argument-parser")
],
path: "Sources")

]
)
Loading
Loading