Giter VIP home page Giter VIP logo

aws-sdk-swift's Introduction

AWS SDK for Swift

The AWS SDK for Swift is a pure Swift SDK for accessing any & all AWS services.

The AWS SDK for Swift is currently in developer preview and is intended strictly for feedback purposes only. Do not use this SDK for production workloads. Refer to the SDK stability guidelines for more detail.

License

This library is licensed under the Apache 2.0 License.

License

Requirements

The AWS SDK for Swift supports the following:

  • Swift 5.7 or higher
  • iOS & iPadOS 13.0 or higher
  • macOS 10.15 or higher
  • Ubuntu Linux 16.04 LTS or higher
  • Amazon Linux 2 or higher

Other environments (watchOS, tvOS, Windows, or others) may work but have not been verified.

These supported versions may change in the future.

Provide Credentials

For virtually all AWS operations, you must provide AWS security credentials for the SDK to use.

You can accomplish this for local development by installing and configuring the AWS Command Line Interface on your development machine. The AWS SDK for Swift will share the AWS CLI's credentials (written at ~/.aws/credentials) when executing on your development machine.

See your AWS account administrator to obtain your credentials if you do not already have them.

Test the AWS SDK for Swift with your credentials

Here, we'll be creating a simple Swift package to show you how the SDK is used, and verify that the SDK can use your credentials to access a live AWS service.

You can perform this on either Mac or Linux on any supported OS version, but must have a supported version of either Xcode (for Mac) or the Swift toolchain (for Linux) installed.

Be sure you've set up AWS credentials on your development machine, per the section above.

  1. On your command line, create a new, executable Swift package:
$ mkdir AWSCredentialTester
$ cd AWSCredentialTester
$ swift package init --type executable
  1. Edit your new package's Package.swift file to read:
// swift-tools-version: 5.7

import PackageDescription

let package = Package(
    name: "AWSCredentialTester",
    platforms: [.macOS(.v10_15), .iOS(.v13)],
    dependencies: [
        .package(url: "https://github.com/awslabs/aws-sdk-swift.git", from: "0.16.0")
    ],
    targets: [
        .executableTarget(
            name: "AWSCredentialTester",
            dependencies: [
                .product(name: "AWSSTS", package: "aws-sdk-swift")
            ],
            path: "Sources"
        )
    ]
)
  1. Edit your project's Sources/main.swift file to read:
import AWSSTS

let client = try STSClient(region: "us-east-1")
let input = GetCallerIdentityInput()
let output = try await client.getCallerIdentity(input: input)
let userID = output.userId ?? "not known"
print("Caller's AWS user ID is \(userID)")
  1. Execute your Swift package from the command line:
$ swift run

Your package will resolve dependencies, compile, and run.

In the terminal output, you will see (after a number of log statements):

Caller's AWS user ID is <an alphanumeric string>

(this user ID should match your AWS Access Key ID for your AWS credentials.)

If you’ve made it this far... congratulations! 🎉

Integrating Into an Existing Xcode Project or Package

Now that you've tested the SDK and your credentials in a simple project, here are steps to quickly get the AWS SDK for Swift installed into either your existing Xcode project or Swift package.

Installing the AWS SDK for Swift into your Xcode Project

  1. Open your project in the Xcode IDE. From the drop down menu, select File > Add Packages...

  2. In the field labeled "Search or Enter Package URL", enter "https://github.com/awslabs/aws-sdk-swift". Set the dependency rule and project as needed, then click "Add Package". The package will download and install to your Xcode project.

  3. In the "Choose Package Products for aws-sdk-swift" popup window, check the box next to the specific AWS services you want to access, and set the Xcode target next to each service. Click "Add Package".

Installing the AWS SDK for Swift into your Swift Package

  1. In your package's Package.swift, add AWS SDK for Swift as a package dependency:
let package = Package(
    name: "MyPackage",
    dependencies: [
+       .package(url: "https://github.com/awslabs/aws-sdk-swift", from: "0.16.0")
    ],
  1. Add the specific AWS services you plan to use into the dependencies of one of the targets in your package's Package.swift. To finish this example, you will need to add at least AWS Secure Token Service (STS) :
    targets: [
        .target(
            name: "MyTarget", 
            dependencies: [
+               .product(name: "AWSS3", package: "aws-sdk-swift"),
+               .product(name: "AWSSTS", package: "aws-sdk-swift"),
+               .product(name: "AWSTranscribe", package: "aws-sdk-swift")
            ]
        )
    ]

See the AWS SDK for Swift's Package.swift file for the names of all available AWS services.

What’s next? Try some other AWS services. Help us better understand what you think the most critical features are next. Give us feedback on your experience. etc...

Run into a bug? Please file a Github issue on this project. We try to respond within a business day.

API Reference documentation

We recommend that you use the documentation generation capabilities within Xcode (Option+Click on a symbol); if you run across an API that is not documented, please file an issue in this project.

Generated online documentation will be provided soon.

aws-sdk-swift's People

Contributors

andrewfossaws avatar atierian avatar aws-sdk-swift-automation avatar dayaffe avatar epau avatar finestructure avatar jbelkins avatar jmklix avatar kneekey23 avatar milesziemer avatar phani-srikar avatar royjit avatar sadiredd-sv avatar shepazon avatar sichanyoo avatar sugmanue avatar syall avatar wooj2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-sdk-swift's Issues

Generate API Reference documentation Spike

Remove dokka html and switch to swiftdoc

  1. Investigate:
    https://developer.apple.com/documentation/docc
  2. Investigate swiftdoc
  3. Determine to adopt docc or swiftdoc (output will be a document, pun intended, w/ analysis and decision)
  4. Gather requirements on hosting documentation (talk to kotlin folks about hosting)

Output:
Doc containing analysis and decision around with which documentaiton framework to adopt and additional requirements, around deployment/hosting and .. any other details/requirements.

Implementation will be done in a separate ticket

internal id: 178007585

Polly Presign Modification

Before presigning operation SynthesizeSpeech, Change operation HTTP method to GET from POST

internal id: 176722150

DynamoDB Complex Interaction between GZIP and CRC32

Allowing gzip is an option if the SDK explicitly sets the Accept-Encoding header on the request to gzip. This will prevent the underlying HTTP client from auto decoding the gzip response, (if there was one.) This would allow the CRC validation to still be performed without disabling gzip. The CRC is computed on the response after the response is gziped. If HTTP client auto decodes the response, the CRC will not match.

internal id: 176722188

Dynamic Streaming Support

Figure out how to support backpressure and dynamic streams appropriately with closures and no async yet.

internal id: 176365207

Kinesis Read Timeouts

GetRecords requires a read timeout to prevent the HTTP client waiting forever. Medium because controlling read timeouts might be non-trivial

internal id: 176722173

usability enhancements for all optional inputs

This task would be to look into improving usability of operations where we generate a synthetic input with all optional fields such that we could go from:

func foo(input: FooRequest, completion: (Result<FooResponse, FooError>) -> Void) ```

to either:

func foo(input: FooRequest? = nil, , completion: (Result<FooResponse, FooError>) -> Void)

OR

func foo(input: FooRequest = FooRequest(), completion: (Result<FooResponse, FooError>) -> Void)


which would allow customers to call it as:

client.foo() // instead of client.foo(input: FooRequest())


We need to understand how safe this actually is and if there are any "gotchas". Would we do this for all requests that have all optional fields? Is it _really_ guaranteed that a service team never adds `@required` somewhere down the road?

see also: https://quip-amazon.com/7C7jARMeOD6H/AWS-Kotlin-SDK-Service-Client-Design#AMY9CAN4eab


*internal id*: 177196246                

Properly generate documentation on structs

    boolean writeMemberDocs(Model model, MemberShape member) {
        return member.getMemberTrait(model, DocumentationTrait.class)
                .map(DocumentationTrait::getValue)
                .map(docs -> {
                    if (member.getMemberTrait(model, DeprecatedTrait.class).isPresent()) {
                        docs = "@deprecated\n\n" + docs;
                    }
                    writeDocs(docs);
                    return true;
                }).orElse(false);
    }

right now docs are not being generated in the structs. thats cuz you need to call getMemberTrait to actually get the doc trait which is on the target of the shape, not a member. so we just need to grab it correctly.

internal id: 176926503

Add a HeaderValue Struct to Client Runtime

this struct should contain a function to trytheValue someone entered and make sure it doesnt have emojis in it or other non-accepted characters and throw a proper error if they added these non accepted characters to their headers. There is a chance the CRT handles this for us so before implementing, try creating a call and adding an emoji to a header and see what happens. if the CRT does catch this for us, make sure the error is being bubbled up correctly and is not opaque to the customer.

internal id: 177419582

Test cleanup

refactor and fix any issues in smithy-swift tests. including one in which writers are overwritten

internal id: 176488102

RDS customizations

Operations CopyDBSnapshot, CreateDBInstanceReadReplica, CopyDBClusterSnapshot, CreateDBCluster, Add SourceRegion and DestinationRegion string members to level inputs shapes. Customizations read members for resigned URL behavior.

@jasdel will know what this means

internal id: 176722216

Specify locale for case conversions

case conversion without specifying locale can vary based on the locale of the machine executing the code. Conversion functions should specify the proper locale such that behavior is consistent regardless of locale.

See https://github.com/Kotlin/KEEP/blob/master/proposals/stdlib/locale-agnostic-string-conversions.md

A quick check to Smithy's source code yields that locale is always specified, so the scope of this is specific to SDKs that call case conversions explicitly, not those that call Smithy-based methods.

internal id: 176991541

Support http response query

In our code:

https://github.com/awslabs/smithy-swift/blob/dc2f293cec1745bd72acde79bd1292a3c66c875a/smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/integration/httpResponse/HttpResponsePayload.kt#L84

We are setting all query member names to nil. Per conversation with kstitch, we need to deserialize them. the only thing that the httpquery trait does is update where the request goes.

See attached screenshot and message below for context:


Kevin Stich  19 hours ago
That's looks like an output test based on the context, which means @httpQuery isn't relevant because it's the response being looked at (edited) 
:+1:
1

Kevin Stich  19 hours ago
See "httpQuery is only used on input" in the @httpQuery trait docs

Nicki Stone  18 hours ago
ty just found it in the spec right when you answered, sorry I didnt see it before

Nicki Stone  18 hours ago
do they ever need to be deserialized from the response or can we just itgnore them basicaly and set them to null?

Kevin Stich  18 hours ago
You definitely need to deserialize it. Services can provide those values on output. All that @httpQuery does is change the location of the member contents in a serialized HTTP request.

Nicki Stone  18 hours ago
@wooj ^ looks like th ecode we had was wrong ot begin with

internal id: 177952577

Region Resolver

Write region resolver that resolves region appropriately .

  1. if given in conifg, use that first
  2. if not given, find region in environment
  3. if no region available, choose a default like us-east-1

awslabs/aws-sdk-kotlin#137

internal id: 176364929

Automatic pagination design

Java SDK v2 added support for automatic pagination of (paginated) responses. We should look into possibly implementing this as it would be a better customer experience.

Use AsyncSequence in Swift 5.5 when it comes out to create a paginator.

internal id: 176365063

XML Parser on linux support

Need to get away from our use of XML Coder as it will be extremely slow on Linux and thus lambda.
Idea would be to take this c implementation: https://libexpat.github.io/

Wrap it in swift and conform it codable. We need a struct like the below one for JSON:

https://github.com/apple/swift-corelibs-foundation/blob/eec4b26deee34edb7664ddd9c1222492a399d122/Sources/Foundation/JSONSerialization.swift#L623

And we need to use only pure swift types to ensure speed on Linux.

internal id: 177731341

Handle Naming Collisions

There are two IDs being create that are synthesized to a single type in Swift. Need to fix this.

Kotlin detects this, and then fails codegen, to allow customers to pick out a better name for this. If we have a generic rule for this, it increases risks of breaking other services. This is also what java is doing as well.

https://github.com/awslabs/smithy-kotlin/blob/main/smithy-kotlin-codegen/src/main/kotlin/software/amazon/smithy/kotlin/codegen/model/OperationNormalizer.kt

internal id: 177442225

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.