Skip to content

Commit 60409db

Browse files
committed
Add scenario and readme
1 parent cd3ca5a commit 60409db

File tree

5 files changed

+1001
-0
lines changed

5 files changed

+1001
-0
lines changed

.doc_gen/metadata/support_metadata.yaml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ support_Hello:
4848
- description:
4949
snippet_tags:
5050
- python.example_code.support.Hello
51+
Swift:
52+
versions:
53+
- sdk_version: 1
54+
github: swift/example_code/support
55+
excerpts:
56+
- description: The <filename>Package.swift</filename> file.
57+
snippet_tags:
58+
- swift.support.hello.package
59+
- description: The <filename>entry.swift</filename> file.
60+
snippet_tags:
61+
- swift.support.hello
5162
services:
5263
support: {DescribeServices}
5364
support_AddAttachmentsToSet:
@@ -97,6 +108,15 @@ support_AddAttachmentsToSet:
97108
snippet_tags:
98109
- python.example_code.support.SupportWrapper_decl
99110
- python.example_code.support.AddAttachmentToSet
111+
Swift:
112+
versions:
113+
- sdk_version: 1
114+
github: swift/example_code/ec2
115+
excerpts:
116+
- description:
117+
snippet_tags:
118+
- swift.support.import
119+
- swift.support.AddAttachmentsToSet
100120
services:
101121
support: {AddAttachmentsToSet}
102122
support_AddCommunicationToCase:
@@ -146,6 +166,15 @@ support_AddCommunicationToCase:
146166
snippet_tags:
147167
- python.example_code.support.SupportWrapper_decl
148168
- python.example_code.support.AddCommunicationToCase
169+
Swift:
170+
versions:
171+
- sdk_version: 1
172+
github: swift/example_code/ec2
173+
excerpts:
174+
- description:
175+
snippet_tags:
176+
- swift.support.import
177+
- swift.support.AddCommunicationToCase
149178
services:
150179
support: {AddCommunicationToCase}
151180
support_CreateCase:
@@ -195,6 +224,15 @@ support_CreateCase:
195224
snippet_tags:
196225
- python.example_code.support.SupportWrapper_decl
197226
- python.example_code.support.CreateCase
227+
Swift:
228+
versions:
229+
- sdk_version: 1
230+
github: swift/example_code/ec2
231+
excerpts:
232+
- description:
233+
snippet_tags:
234+
- swift.support.import
235+
- swift.support.CreateCase
198236
services:
199237
support: {CreateCase}
200238
support_DescribeAttachment:
@@ -244,6 +282,15 @@ support_DescribeAttachment:
244282
snippet_tags:
245283
- python.example_code.support.SupportWrapper_decl
246284
- python.example_code.support.DescribeAttachment
285+
Swift:
286+
versions:
287+
- sdk_version: 1
288+
github: swift/example_code/ec2
289+
excerpts:
290+
- description:
291+
snippet_tags:
292+
- swift.support.import
293+
- swift.support.DescribeAttachment
247294
services:
248295
support: {DescribeAttachment}
249296
support_DescribeCases:
@@ -293,6 +340,15 @@ support_DescribeCases:
293340
snippet_tags:
294341
- python.example_code.support.SupportWrapper_decl
295342
- python.example_code.support.DescribeCases
343+
Swift:
344+
versions:
345+
- sdk_version: 1
346+
github: swift/example_code/ec2
347+
excerpts:
348+
- description:
349+
snippet_tags:
350+
- swift.support.import
351+
- swift.support.DescribeCases
296352
services:
297353
support: {DescribeCases}
298354
support_DescribeCommunications:
@@ -342,6 +398,15 @@ support_DescribeCommunications:
342398
snippet_tags:
343399
- python.example_code.support.SupportWrapper_decl
344400
- python.example_code.support.DescribeCommunications
401+
Swift:
402+
versions:
403+
- sdk_version: 1
404+
github: swift/example_code/ec2
405+
excerpts:
406+
- description:
407+
snippet_tags:
408+
- swift.support.import
409+
- swift.support.DescribeCommunications
345410
services:
346411
support: {DescribeCommunications}
347412
support_DescribeServices:
@@ -382,6 +447,15 @@ support_DescribeServices:
382447
snippet_tags:
383448
- python.example_code.support.SupportWrapper_decl
384449
- python.example_code.support.DescribeServices
450+
Swift:
451+
versions:
452+
- sdk_version: 1
453+
github: swift/example_code/ec2
454+
excerpts:
455+
- description:
456+
snippet_tags:
457+
- swift.support.import
458+
- swift.support.DescribeServices
385459
services:
386460
support: {DescribeServices}
387461
support_DescribeSeverityLevels:
@@ -430,6 +504,15 @@ support_DescribeSeverityLevels:
430504
snippet_tags:
431505
- python.example_code.support.SupportWrapper_decl
432506
- python.example_code.support.DescribeSeverityLevels
507+
Swift:
508+
versions:
509+
- sdk_version: 1
510+
github: swift/example_code/ec2
511+
excerpts:
512+
- description:
513+
snippet_tags:
514+
- swift.support.import
515+
- swift.support.DescribeSeverityLevels
433516
services:
434517
support: {DescribeSeverityLevels}
435518
support_ResolveCase:
@@ -479,6 +562,15 @@ support_ResolveCase:
479562
snippet_tags:
480563
- python.example_code.support.SupportWrapper_decl
481564
- python.example_code.support.ResolveCase
565+
Swift:
566+
versions:
567+
- sdk_version: 1
568+
github: swift/example_code/ec2
569+
excerpts:
570+
- description:
571+
snippet_tags:
572+
- swift.support.import
573+
- swift.support.ResolveCase
482574
services:
483575
support: {ResolveCase}
484576
support_Scenario_GetStartedSupportCases:
@@ -543,6 +635,20 @@ support_Scenario_GetStartedSupportCases:
543635
- description: Define a class that wraps support client actions.
544636
snippet_tags:
545637
- python.example_code.support.SupportWrapper_full
638+
Swift:
639+
versions:
640+
- sdk_version: 1
641+
github: swift/example_code/support
642+
excerpts:
643+
- description: The <filename>Package.swift</filename> file.
644+
snippet_tags:
645+
- swift.support.scenario.package
646+
- description: The <filename>entry.swift</filename> file.
647+
snippet_tags:
648+
- swift.support.scenario.entry
649+
- description: The <filename>Scenario.swift</filename> file.
650+
snippet_tags:
651+
- swift.support.scenario.scenario
546652
services:
547653
support: {AddAttachmentsToSet, AddCommunicationToCase, CreateCase, DescribeAttachment, DescribeCases, DescribeCommunications,
548654
DescribeServices, DescribeSeverityLevels, ResolveCase}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Support code examples for the SDK for Swift
2+
3+
## Overview
4+
5+
Shows how to use the AWS SDK for Swift to work with AWS Support.
6+
7+
<!--custom.overview.start-->
8+
<!--custom.overview.end-->
9+
10+
_Support provides support for users of Amazon Web Services._
11+
12+
## ⚠ Important
13+
14+
* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/).
15+
* Running the tests might result in charges to your AWS account.
16+
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
17+
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).
18+
19+
<!--custom.important.start-->
20+
<!--custom.important.end-->
21+
22+
## Code examples
23+
24+
### Prerequisites
25+
26+
For prerequisites, see the [README](../../README.md#Prerequisites) in the `swift` folder.
27+
28+
29+
<!--custom.prerequisites.start-->
30+
<!--custom.prerequisites.end-->
31+
32+
### Get started
33+
34+
- [Hello Support](hello/Package.swift#L8) (`DescribeServices`)
35+
36+
37+
### Basics
38+
39+
Code examples that show you how to perform the essential operations within a service.
40+
41+
- [Learn the basics](scenario/Package.swift)
42+
43+
44+
### Single actions
45+
46+
Code excerpts that show you how to call individual service functions.
47+
48+
- [AddAttachmentsToSet](scenario/Sources/Scenario.swift#L456)
49+
- [AddCommunicationToCase](scenario/Sources/Scenario.swift#L505)
50+
- [CreateCase](scenario/Sources/Scenario.swift#L354)
51+
- [DescribeAttachment](scenario/Sources/Scenario.swift#L593)
52+
- [DescribeCases](scenario/Sources/Scenario.swift#L403)
53+
- [DescribeCommunications](scenario/Sources/Scenario.swift#L555)
54+
- [DescribeServices](scenario/Sources/Scenario.swift#L279)
55+
- [DescribeSeverityLevels](scenario/Sources/Scenario.swift#L315)
56+
- [ResolveCase](scenario/Sources/Scenario.swift#L633)
57+
58+
59+
<!--custom.examples.start-->
60+
<!--custom.examples.end-->
61+
62+
## Run the examples
63+
64+
### Instructions
65+
66+
To build any of these examples from a terminal window, navigate into its
67+
directory, then use the following command:
68+
69+
```
70+
$ swift build
71+
```
72+
73+
To build one of these examples in Xcode, navigate to the example's directory
74+
(such as the `ListUsers` directory, to build that example). Then type `xed.`
75+
to open the example directory in Xcode. You can then use standard Xcode build
76+
and run commands.
77+
78+
<!--custom.instructions.start-->
79+
<!--custom.instructions.end-->
80+
81+
#### Hello Support
82+
83+
This example shows you how to get started using Support.
84+
85+
86+
#### Learn the basics
87+
88+
This example shows you how to do the following:
89+
90+
- Get and display available services and severity levels for cases.
91+
- Create a support case using a selected service, category, and severity level.
92+
- Get and display a list of open cases for the current day.
93+
- Add an attachment set and a communication to the new case.
94+
- Describe the new attachment and communication for the case.
95+
- Resolve the case.
96+
- Get and display a list of resolved cases for the current day.
97+
98+
<!--custom.basic_prereqs.support_Scenario_GetStartedSupportCases.start-->
99+
<!--custom.basic_prereqs.support_Scenario_GetStartedSupportCases.end-->
100+
101+
102+
<!--custom.basics.support_Scenario_GetStartedSupportCases.start-->
103+
<!--custom.basics.support_Scenario_GetStartedSupportCases.end-->
104+
105+
106+
### Tests
107+
108+
⚠ Running tests might result in charges to your AWS account.
109+
110+
111+
To find instructions for running these tests, see the [README](../../README.md#Tests)
112+
in the `swift` folder.
113+
114+
115+
116+
<!--custom.tests.start-->
117+
<!--custom.tests.end-->
118+
119+
## Additional resources
120+
121+
- [Support User Guide](https://docs.aws.amazon.com/awssupport/latest/user/getting-started.html)
122+
- [Support API Reference](https://docs.aws.amazon.com/awssupport/latest/APIReference/welcome.html)
123+
- [SDK for Swift Support reference](https://sdk.amazonaws.com/swift/api/awssupport/latest/documentation/awssupport)
124+
125+
<!--custom.resources.start-->
126+
<!--custom.resources.end-->
127+
128+
---
129+
130+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
131+
132+
SPDX-License-Identifier: Apache-2.0
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// swift-tools-version: 5.9
2+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
// SPDX-License-Identifier: Apache-2.0
4+
//
5+
// (swift-tools-version has two lines here because it needs to be the first
6+
// line in the file, but it should also appear in the snippet below)
7+
//
8+
// snippet-start:[swift.support.scenario.package]
9+
// swift-tools-version: 5.9
10+
//
11+
// The swift-tools-version declares the minimum version of Swift required to
12+
// build this package.
13+
14+
import PackageDescription
15+
16+
let package = Package(
17+
name: "hello-support",
18+
// Let Xcode know the minimum Apple platforms supported.
19+
platforms: [
20+
.macOS(.v13),
21+
.iOS(.v15)
22+
],
23+
dependencies: [
24+
// Dependencies declare other packages that this package depends on.
25+
.package(
26+
url: "https://github.com/awslabs/aws-sdk-swift",
27+
from: "1.0.0"),
28+
.package(
29+
url: "https://github.com/apple/swift-argument-parser.git",
30+
branch: "main"
31+
)
32+
],
33+
targets: [
34+
// Targets are the basic building blocks of a package, defining a module or a test suite.
35+
// Targets can depend on other targets in this package and products
36+
// from dependencies.
37+
.executableTarget(
38+
name: "hello-support",
39+
dependencies: [
40+
.product(name: "AWSSupport", package: "aws-sdk-swift"),
41+
.product(name: "ArgumentParser", package: "swift-argument-parser")
42+
],
43+
path: "Sources")
44+
45+
]
46+
)
47+
// snippet-end:[swift.support.scenario.package]

0 commit comments

Comments
 (0)