在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):soto-project/soto开源软件地址(OpenSource Url):https://github.com/soto-project/soto开源编程语言(OpenSource Language):Swift 99.9%开源软件介绍(OpenSource Introduction):Soto for AWSSoto is a Swift language SDK for Amazon Web Services (AWS), working on Linux, macOS and iOS. This library provides access to all AWS services. The service APIs it provides are a direct mapping of the REST APIs Amazon publishes for each of its services. Soto is a community supported project and is in no way affiliated with AWS. Table of Contents
StructureThe library consists of three parts
Swift Package ManagerSoto uses the Swift Package Manager to manage its code dependencies. To use Soto in your codebase it is recommended you do the same. Add a dependency to the package in your own Package.swift dependencies. dependencies: [
.package(url: "https://github.com/soto-project/soto.git", from: "5.0.0")
], Then add target dependencies for each of the Soto targets you want to use. targets: [
.target(name: "MyApp", dependencies: [
.product(name: "SotoS3", package: "soto"),
.product(name: "SotoSES", package: "soto"),
.product(name: "SotoIAM", package: "soto")
]),
]
) Alternatively if you are using Xcode 11 or later you can use the Swift Package Manager integration and add a dependency to Soto through that. CompatibilitySoto works on Linux, macOS and iOS. It requires v2.0 of Swift NIO. Below is a compatibility table for different Soto versions.
Configuring CredentialsBefore using the SDK, you will need AWS credentials to sign all your requests. Credentials can be provided to the library in the following ways.
You can find out more about credential providers here Using SotoTo use Soto you need to create an Each Soto command returns a Swift NIO The recommended manner to interact with import SotoS3 //ensure this module is specified as a dependency in your package.swift
let bucket = "my-bucket"
let client = AWSClient(
credentialProvider: .static(accessKeyId: "Your-Access-Key", secretAccessKey: "Your-Secret-Key"),
httpClientProvider: .createNew
)
let s3 = S3(client: client, region: .uswest2)
func createBucketPutGetObject() -> EventLoopFuture<S3.GetObjectOutput> {
// Create Bucket, Put an Object, Get the Object
let createBucketRequest = S3.CreateBucketRequest(bucket: bucket)
s3.createBucket(createBucketRequest)
.flatMap { response -> EventLoopFuture<S3.PutObjectOutput> in
// Upload text file to the s3
let bodyData = "hello world".data(using: .utf8)!
let putObjectRequest = S3.PutObjectRequest(
acl: .publicRead,
body: bodyData,
bucket: bucket,
key: "hello.txt"
)
return s3.putObject(putObjectRequest)
}
.flatMap { response -> EventLoopFuture<S3.GetObjectOutput> in
let getObjectRequest = S3.GetObjectRequest(bucket: bucket, key: "hello.txt")
return s3.getObject(getObjectRequest)
}
.whenSuccess { response in
if let body = response.body {
print(String(data: body, encoding: .utf8)!)
}
}
} DocumentationAPI ReferenceVisit soto.codes to browse the user guides and api reference. As there is a one-to-one correspondence with AWS REST api calls and the Soto api calls, you can also use the official AWS documentation for more detailed information about AWS commands. User guidesAdditional user guides for specific elements of Soto are available
ContributingWe welcome and encourage contributions from all developers. Please read CONTRIBUTING.md for our contributing guidelines. LicenseSoto is released under the Apache License, Version 2.0. See LICENSE for details. BackersSupport development of Soto by becoming a backer |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论