Skip to content
Open
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
106 changes: 106 additions & 0 deletions .doc_gen/metadata/support_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ support_Hello:
- description:
snippet_tags:
- python.example_code.support.Hello
Swift:
versions:
- sdk_version: 1
github: swift/example_code/support
excerpts:
- description: The <filename>Package.swift</filename> file.
snippet_tags:
- swift.support.hello.package
- description: The <filename>entry.swift</filename> file.
snippet_tags:
- swift.support.hello
services:
support: {DescribeServices}
support_AddAttachmentsToSet:
Expand Down Expand Up @@ -97,6 +108,15 @@ support_AddAttachmentsToSet:
snippet_tags:
- python.example_code.support.SupportWrapper_decl
- python.example_code.support.AddAttachmentToSet
Swift:
versions:
- sdk_version: 1
github: swift/example_code/ec2
excerpts:
- description:
snippet_tags:
- swift.support.import
- swift.support.AddAttachmentsToSet
services:
support: {AddAttachmentsToSet}
support_AddCommunicationToCase:
Expand Down Expand Up @@ -146,6 +166,15 @@ support_AddCommunicationToCase:
snippet_tags:
- python.example_code.support.SupportWrapper_decl
- python.example_code.support.AddCommunicationToCase
Swift:
versions:
- sdk_version: 1
github: swift/example_code/ec2
excerpts:
- description:
snippet_tags:
- swift.support.import
- swift.support.AddCommunicationToCase
services:
support: {AddCommunicationToCase}
support_CreateCase:
Expand Down Expand Up @@ -195,6 +224,15 @@ support_CreateCase:
snippet_tags:
- python.example_code.support.SupportWrapper_decl
- python.example_code.support.CreateCase
Swift:
versions:
- sdk_version: 1
github: swift/example_code/ec2
excerpts:
- description:
snippet_tags:
- swift.support.import
- swift.support.CreateCase
services:
support: {CreateCase}
support_DescribeAttachment:
Expand Down Expand Up @@ -244,6 +282,15 @@ support_DescribeAttachment:
snippet_tags:
- python.example_code.support.SupportWrapper_decl
- python.example_code.support.DescribeAttachment
Swift:
versions:
- sdk_version: 1
github: swift/example_code/ec2
excerpts:
- description:
snippet_tags:
- swift.support.import
- swift.support.DescribeAttachment
services:
support: {DescribeAttachment}
support_DescribeCases:
Expand Down Expand Up @@ -293,6 +340,15 @@ support_DescribeCases:
snippet_tags:
- python.example_code.support.SupportWrapper_decl
- python.example_code.support.DescribeCases
Swift:
versions:
- sdk_version: 1
github: swift/example_code/ec2
excerpts:
- description:
snippet_tags:
- swift.support.import
- swift.support.DescribeCases
services:
support: {DescribeCases}
support_DescribeCommunications:
Expand Down Expand Up @@ -342,6 +398,15 @@ support_DescribeCommunications:
snippet_tags:
- python.example_code.support.SupportWrapper_decl
- python.example_code.support.DescribeCommunications
Swift:
versions:
- sdk_version: 1
github: swift/example_code/ec2
excerpts:
- description:
snippet_tags:
- swift.support.import
- swift.support.DescribeCommunications
services:
support: {DescribeCommunications}
support_DescribeServices:
Expand Down Expand Up @@ -382,6 +447,15 @@ support_DescribeServices:
snippet_tags:
- python.example_code.support.SupportWrapper_decl
- python.example_code.support.DescribeServices
Swift:
versions:
- sdk_version: 1
github: swift/example_code/ec2
excerpts:
- description:
snippet_tags:
- swift.support.import
- swift.support.DescribeServices
services:
support: {DescribeServices}
support_DescribeSeverityLevels:
Expand Down Expand Up @@ -430,6 +504,15 @@ support_DescribeSeverityLevels:
snippet_tags:
- python.example_code.support.SupportWrapper_decl
- python.example_code.support.DescribeSeverityLevels
Swift:
versions:
- sdk_version: 1
github: swift/example_code/ec2
excerpts:
- description:
snippet_tags:
- swift.support.import
- swift.support.DescribeSeverityLevels
services:
support: {DescribeSeverityLevels}
support_ResolveCase:
Expand Down Expand Up @@ -479,6 +562,15 @@ support_ResolveCase:
snippet_tags:
- python.example_code.support.SupportWrapper_decl
- python.example_code.support.ResolveCase
Swift:
versions:
- sdk_version: 1
github: swift/example_code/ec2
excerpts:
- description:
snippet_tags:
- swift.support.import
- swift.support.ResolveCase
services:
support: {ResolveCase}
support_Scenario_GetStartedSupportCases:
Expand Down Expand Up @@ -543,6 +635,20 @@ support_Scenario_GetStartedSupportCases:
- description: Define a class that wraps support client actions.
snippet_tags:
- python.example_code.support.SupportWrapper_full
Swift:
versions:
- sdk_version: 1
github: swift/example_code/support
excerpts:
- description: The <filename>Package.swift</filename> file.
snippet_tags:
- swift.support.scenario.package
- description: The <filename>entry.swift</filename> file.
snippet_tags:
- swift.support.scenario.entry
- description: The <filename>Scenario.swift</filename> file.
snippet_tags:
- swift.support.scenario.scenario
services:
support: {AddAttachmentsToSet, AddCommunicationToCase, CreateCase, DescribeAttachment, DescribeCases, DescribeCommunications,
DescribeServices, DescribeSeverityLevels, ResolveCase}
132 changes: 132 additions & 0 deletions swift/example_code/support/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Support code examples for the SDK for Swift

## Overview

Shows how to use the AWS SDK for Swift to work with AWS Support.

<!--custom.overview.start-->
<!--custom.overview.end-->

_Support provides support for users of Amazon Web Services._

## ⚠ Important

* 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/).
* Running the tests might result in charges to your AWS account.
* 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).
* 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).

<!--custom.important.start-->
<!--custom.important.end-->

## Code examples

### Prerequisites

For prerequisites, see the [README](../../README.md#Prerequisites) in the `swift` folder.


<!--custom.prerequisites.start-->
<!--custom.prerequisites.end-->

### Get started

- [Hello Support](hello/Package.swift#L8) (`DescribeServices`)


### Basics

Code examples that show you how to perform the essential operations within a service.

- [Learn the basics](scenario/Package.swift)


### Single actions

Code excerpts that show you how to call individual service functions.

- [AddAttachmentsToSet](scenario/Sources/Scenario.swift#L456)
- [AddCommunicationToCase](scenario/Sources/Scenario.swift#L505)
- [CreateCase](scenario/Sources/Scenario.swift#L354)
- [DescribeAttachment](scenario/Sources/Scenario.swift#L593)
- [DescribeCases](scenario/Sources/Scenario.swift#L403)
- [DescribeCommunications](scenario/Sources/Scenario.swift#L555)
- [DescribeServices](scenario/Sources/Scenario.swift#L279)
- [DescribeSeverityLevels](scenario/Sources/Scenario.swift#L315)
- [ResolveCase](scenario/Sources/Scenario.swift#L633)


<!--custom.examples.start-->
<!--custom.examples.end-->

## Run the examples

### Instructions

To build any of these examples from a terminal window, navigate into its
directory, then use the following command:

```
$ swift build
```

To build one of these examples in Xcode, navigate to the example's directory
(such as the `ListUsers` directory, to build that example). Then type `xed.`
to open the example directory in Xcode. You can then use standard Xcode build
and run commands.

<!--custom.instructions.start-->
<!--custom.instructions.end-->

#### Hello Support

This example shows you how to get started using Support.


#### Learn the basics

This example shows you how to do the following:

- Get and display available services and severity levels for cases.
- Create a support case using a selected service, category, and severity level.
- Get and display a list of open cases for the current day.
- Add an attachment set and a communication to the new case.
- Describe the new attachment and communication for the case.
- Resolve the case.
- Get and display a list of resolved cases for the current day.

<!--custom.basic_prereqs.support_Scenario_GetStartedSupportCases.start-->
<!--custom.basic_prereqs.support_Scenario_GetStartedSupportCases.end-->


<!--custom.basics.support_Scenario_GetStartedSupportCases.start-->
<!--custom.basics.support_Scenario_GetStartedSupportCases.end-->


### Tests

⚠ Running tests might result in charges to your AWS account.


To find instructions for running these tests, see the [README](../../README.md#Tests)
in the `swift` folder.



<!--custom.tests.start-->
<!--custom.tests.end-->

## Additional resources

- [Support User Guide](https://docs.aws.amazon.com/awssupport/latest/user/getting-started.html)
- [Support API Reference](https://docs.aws.amazon.com/awssupport/latest/APIReference/welcome.html)
- [SDK for Swift Support reference](https://sdk.amazonaws.com/swift/api/awssupport/latest/documentation/awssupport)

<!--custom.resources.start-->
<!--custom.resources.end-->

---

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
47 changes: 47 additions & 0 deletions swift/example_code/support/hello/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// swift-tools-version: 5.9
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//
// (swift-tools-version has two lines here because it needs to be the first
// line in the file, but it should also appear in the snippet below)
//
// snippet-start:[swift.support.hello.package]
// swift-tools-version: 5.9
//
// The swift-tools-version declares the minimum version of Swift required to
// build this package.

import PackageDescription

let package = Package(
name: "hello-support",
// 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: "hello-support",
dependencies: [
.product(name: "AWSSupport", package: "aws-sdk-swift"),
.product(name: "ArgumentParser", package: "swift-argument-parser")
],
path: "Sources")

]
)
// snippet-end:[swift.support.hello.package]
Loading
Loading