diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6b7b150 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8864b83 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Yuki Takei(noppoMan) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Package.pins b/Package.pins new file mode 100644 index 0000000..cdbf774 --- /dev/null +++ b/Package.pins @@ -0,0 +1,7 @@ +{ + "autoPin": true, + "pins": [ + + ], + "version": 1 +} \ No newline at end of file diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..647c5f3 --- /dev/null +++ b/Package.swift @@ -0,0 +1,10 @@ +// swift-tools-version:3.1 + +import PackageDescription + +let package = Package( + name: "SwiftAWSS3", + dependencies: [ + .Package(url: "https://github.com/noppoMan/aws-sdk-swift-core.git", majorVersion: 0, minor: 2) + ] +) diff --git a/README.md b/README.md new file mode 100644 index 0000000..e473130 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# s3 + +An AWS s3 type safe client for Swift (This is part of [aws-sdk-swift](https://github.com/noppoMan/aws-sdk-swift)) + +## Documentation + +Visit the aws-sdk-swift [documentation](http://htmlpreview.github.io/?https://github.com/noppoMan/aws-sdk-swift-doc/blob/master/docs/index.html) for instructions and browsing api references. + +## Installation + +### Package.swift + +```swift +import PackageDescription + +let package = Package( + name: "MyAWSApp", + dependencies: [ + .Package(url: "https://github.com/swift-aws/s3.git", majorVersion: 0, minor: 3) + ] +) +``` diff --git a/Sources/S3RequestMiddleware.swift b/Sources/S3RequestMiddleware.swift new file mode 100644 index 0000000..f0d037b --- /dev/null +++ b/Sources/S3RequestMiddleware.swift @@ -0,0 +1,49 @@ +import Foundation +import AWSSDKSwiftCore + +struct S3RequestMiddleware: AWSRequestMiddleware { + func chain(request: AWSRequest) throws -> AWSRequest { + var request = request + + var paths = request.url.path.components(separatedBy: "/").filter({ $0 != "" }) + if paths.count == 0 { + return request + } + + switch request.httpMethod.lowercased() { + case "get": + let query = request.url.query != nil ? "?\(request.url.query!)" : "" + let domain: String + if let host = request.url.host, host.contains("amazonaws.com") { + domain = "s3-\(request.region.rawValue).amazonaws.com" + } else { + let port = request.url.port == nil ? "" : ":\(request.url.port!)" + domain = request.url.host!+port + } + request.url = URL(string: "\(request.url.scheme ?? "https")://\(paths.removeFirst()).\(domain)/\(paths.joined(separator: "/"))\(query)")! + default: + break + } + + switch request.operation { + case "CreateBucket": + var xml = "" + xml += "" + xml += "" + xml += request.region.rawValue + xml += "" + xml += "" + request.body = .text(xml) + + case "PutObject": + if let data = try request.body.asData() { + let encoded = Data(bytes: md5(data)).base64EncodedString() + request.addValue(encoded, forHTTPHeaderField: "Content-MD5") + } + default: + break + } + + return request + } +} diff --git a/Sources/S3_API.swift b/Sources/S3_API.swift new file mode 100644 index 0000000..c831ce2 --- /dev/null +++ b/Sources/S3_API.swift @@ -0,0 +1,424 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +/** +The MIT License (MIT) + +Copyright (c) 2017 Yuki Takei(noppoMan) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +import Foundation +import AWSSDKSwiftCore + +/** + +*/ +public struct S3 { + + let client: AWSClient + + public init(accessKeyId: String? = nil, secretAccessKey: String? = nil, region: AWSSDKSwiftCore.Region? = nil, endpoint: String? = nil) { + self.client = AWSClient( + accessKeyId: accessKeyId, + secretAccessKey: secretAccessKey, + region: region, + service: "s3", + serviceProtocol: ServiceProtocol(type: .restxml), + apiVersion: "2006-03-01", + endpoint: endpoint, + serviceEndpoints: ["s3-external-1": "s3-external-1.amazonaws.com", "ap-southeast-1": "s3-ap-southeast-1.amazonaws.com", "us-west-1": "s3-us-west-1.amazonaws.com", "sa-east-1": "s3-sa-east-1.amazonaws.com", "ap-northeast-1": "s3-ap-northeast-1.amazonaws.com", "eu-west-1": "s3-eu-west-1.amazonaws.com", "us-west-2": "s3-us-west-2.amazonaws.com", "ap-southeast-2": "s3-ap-southeast-2.amazonaws.com", "us-east-1": "s3.amazonaws.com"], + partitionEndpoint: "us-east-1", + middlewares: [S3RequestMiddleware()], + possibleErrorTypes: [S3Error.self] + ) + } + + /// Sets an analytics configuration for the bucket (specified by the analytics configuration ID). + public func putBucketAnalyticsConfiguration(_ input: PutBucketAnalyticsConfigurationRequest) throws { + _ = try client.send(operation: "PutBucketAnalyticsConfiguration", path: "/{Bucket}?analytics", httpMethod: "PUT", input: input) + } + + /// Return torrent files from a bucket. + public func getObjectTorrent(_ input: GetObjectTorrentRequest) throws -> GetObjectTorrentOutput { + return try client.send(operation: "GetObjectTorrent", path: "/{Bucket}/{Key+}?torrent", httpMethod: "GET", input: input) + } + + /// Returns the cors configuration for the bucket. + public func getBucketCors(_ input: GetBucketCorsRequest) throws -> GetBucketCorsOutput { + return try client.send(operation: "GetBucketCors", path: "/{Bucket}?cors", httpMethod: "GET", input: input) + } + + /// Deprecated, see the PutBucketNotificationConfiguraiton operation. + public func putBucketNotification(_ input: PutBucketNotificationRequest) throws { + _ = try client.send(operation: "PutBucketNotification", path: "/{Bucket}?notification", httpMethod: "PUT", input: input) + } + + /// Returns an inventory configuration (identified by the inventory ID) from the bucket. + public func getBucketInventoryConfiguration(_ input: GetBucketInventoryConfigurationRequest) throws -> GetBucketInventoryConfigurationOutput { + return try client.send(operation: "GetBucketInventoryConfiguration", path: "/{Bucket}?inventory", httpMethod: "GET", input: input) + } + + /// Aborts a multipart upload.To verify that all parts have been removed, so you don't get charged for the part storage, you should call the List Parts operation and ensure the parts list is empty. + public func abortMultipartUpload(_ input: AbortMultipartUploadRequest) throws -> AbortMultipartUploadOutput { + return try client.send(operation: "AbortMultipartUpload", path: "/{Bucket}/{Key+}", httpMethod: "DELETE", input: input) + } + + /// Deletes the bucket. All objects (including all object versions and Delete Markers) in the bucket must be deleted before the bucket itself can be deleted. + public func deleteBucket(_ input: DeleteBucketRequest) throws { + _ = try client.send(operation: "DeleteBucket", path: "/{Bucket}", httpMethod: "DELETE", input: input) + } + + /// Uploads a part by copying data from an existing object as data source. + public func uploadPartCopy(_ input: UploadPartCopyRequest) throws -> UploadPartCopyOutput { + return try client.send(operation: "UploadPartCopy", path: "/{Bucket}/{Key+}", httpMethod: "PUT", input: input) + } + + /// Removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects. + public func deleteObject(_ input: DeleteObjectRequest) throws -> DeleteObjectOutput { + return try client.send(operation: "DeleteObject", path: "/{Bucket}/{Key+}", httpMethod: "DELETE", input: input) + } + + /// Restores an archived copy of an object back into Amazon S3 + public func restoreObject(_ input: RestoreObjectRequest) throws -> RestoreObjectOutput { + return try client.send(operation: "RestoreObject", path: "/{Bucket}/{Key+}?restore", httpMethod: "POST", input: input) + } + + /// This operation removes the website configuration from the bucket. + public func deleteBucketWebsite(_ input: DeleteBucketWebsiteRequest) throws { + _ = try client.send(operation: "DeleteBucketWebsite", path: "/{Bucket}?website", httpMethod: "DELETE", input: input) + } + + /// uses the acl subresource to set the access control list (ACL) permissions for an object that already exists in a bucket + public func putObjectAcl(_ input: PutObjectAclRequest) throws -> PutObjectAclOutput { + return try client.send(operation: "PutObjectAcl", path: "/{Bucket}/{Key+}?acl", httpMethod: "PUT", input: input) + } + + /// Returns the tag set associated with the bucket. + public func getBucketTagging(_ input: GetBucketTaggingRequest) throws -> GetBucketTaggingOutput { + return try client.send(operation: "GetBucketTagging", path: "/{Bucket}?tagging", httpMethod: "GET", input: input) + } + + /// Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. Note: ListObjectsV2 is the revised List Objects API and we recommend you use this revised API for new application development. + public func listObjectsV2(_ input: ListObjectsV2Request) throws -> ListObjectsV2Output { + return try client.send(operation: "ListObjectsV2", path: "/{Bucket}?list-type=2", httpMethod: "GET", input: input) + } + + /// Gets an analytics configuration for the bucket (specified by the analytics configuration ID). + public func getBucketAnalyticsConfiguration(_ input: GetBucketAnalyticsConfigurationRequest) throws -> GetBucketAnalyticsConfigurationOutput { + return try client.send(operation: "GetBucketAnalyticsConfiguration", path: "/{Bucket}?analytics", httpMethod: "GET", input: input) + } + + /// Returns the region the bucket resides in. + public func getBucketLocation(_ input: GetBucketLocationRequest) throws -> GetBucketLocationOutput { + return try client.send(operation: "GetBucketLocation", path: "/{Bucket}?location", httpMethod: "GET", input: input) + } + + /// Deletes the replication configuration from the bucket. + public func deleteBucketReplication(_ input: DeleteBucketReplicationRequest) throws { + _ = try client.send(operation: "DeleteBucketReplication", path: "/{Bucket}?replication", httpMethod: "DELETE", input: input) + } + + /// Returns a list of inventory configurations for the bucket. + public func listBucketInventoryConfigurations(_ input: ListBucketInventoryConfigurationsRequest) throws -> ListBucketInventoryConfigurationsOutput { + return try client.send(operation: "ListBucketInventoryConfigurations", path: "/{Bucket}?inventory", httpMethod: "GET", input: input) + } + + /// Sets lifecycle configuration for your bucket. If a lifecycle configuration exists, it replaces it. + public func putBucketLifecycleConfiguration(_ input: PutBucketLifecycleConfigurationRequest) throws { + _ = try client.send(operation: "PutBucketLifecycleConfiguration", path: "/{Bucket}?lifecycle", httpMethod: "PUT", input: input) + } + + /// Returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. + public func listObjects(_ input: ListObjectsRequest) throws -> ListObjectsOutput { + return try client.send(operation: "ListObjects", path: "/{Bucket}", httpMethod: "GET", input: input) + } + + /// Returns the notification configuration of a bucket. + public func getBucketNotificationConfiguration(_ input: GetBucketNotificationConfigurationRequest) throws -> NotificationConfiguration { + return try client.send(operation: "GetBucketNotificationConfiguration", path: "/{Bucket}?notification", httpMethod: "GET", input: input) + } + + /// Sets the versioning state of an existing bucket. To set the versioning state, you must be the bucket owner. + public func putBucketVersioning(_ input: PutBucketVersioningRequest) throws { + _ = try client.send(operation: "PutBucketVersioning", path: "/{Bucket}?versioning", httpMethod: "PUT", input: input) + } + + /// Deletes an inventory configuration (identified by the inventory ID) from the bucket. + public func deleteBucketInventoryConfiguration(_ input: DeleteBucketInventoryConfigurationRequest) throws { + _ = try client.send(operation: "DeleteBucketInventoryConfiguration", path: "/{Bucket}?inventory", httpMethod: "DELETE", input: input) + } + + /// Returns the tag-set of an object. + public func getObjectTagging(_ input: GetObjectTaggingRequest) throws -> GetObjectTaggingOutput { + return try client.send(operation: "GetObjectTagging", path: "/{Bucket}/{Key+}?tagging", httpMethod: "GET", input: input) + } + + /// Replaces a policy on a bucket. If the bucket already has a policy, the one in this request completely replaces it. + public func putBucketPolicy(_ input: PutBucketPolicyRequest) throws { + _ = try client.send(operation: "PutBucketPolicy", path: "/{Bucket}?policy", httpMethod: "PUT", input: input) + } + + /// Returns metadata about all of the versions of objects in a bucket. + public func listObjectVersions(_ input: ListObjectVersionsRequest) throws -> ListObjectVersionsOutput { + return try client.send(operation: "ListObjectVersions", path: "/{Bucket}?versions", httpMethod: "GET", input: input) + } + + /// Gets a metrics configuration (specified by the metrics configuration ID) from the bucket. + public func getBucketMetricsConfiguration(_ input: GetBucketMetricsConfigurationRequest) throws -> GetBucketMetricsConfigurationOutput { + return try client.send(operation: "GetBucketMetricsConfiguration", path: "/{Bucket}?metrics", httpMethod: "GET", input: input) + } + + /// Creates a new bucket. + public func createBucket(_ input: CreateBucketRequest) throws -> CreateBucketOutput { + return try client.send(operation: "CreateBucket", path: "/{Bucket}", httpMethod: "PUT", input: input) + } + + /// Returns the logging status of a bucket and the permissions users have to view and modify that status. To use GET, you must be the bucket owner. + public func getBucketLogging(_ input: GetBucketLoggingRequest) throws -> GetBucketLoggingOutput { + return try client.send(operation: "GetBucketLogging", path: "/{Bucket}?logging", httpMethod: "GET", input: input) + } + + /// Set the website configuration for a bucket. + public func putBucketWebsite(_ input: PutBucketWebsiteRequest) throws { + _ = try client.send(operation: "PutBucketWebsite", path: "/{Bucket}?website", httpMethod: "PUT", input: input) + } + + /// Returns the accelerate configuration of a bucket. + public func getBucketAccelerateConfiguration(_ input: GetBucketAccelerateConfigurationRequest) throws -> GetBucketAccelerateConfigurationOutput { + return try client.send(operation: "GetBucketAccelerateConfiguration", path: "/{Bucket}?accelerate", httpMethod: "GET", input: input) + } + + /// Deletes an analytics configuration for the bucket (specified by the analytics configuration ID). + public func deleteBucketAnalyticsConfiguration(_ input: DeleteBucketAnalyticsConfigurationRequest) throws { + _ = try client.send(operation: "DeleteBucketAnalyticsConfiguration", path: "/{Bucket}?analytics", httpMethod: "DELETE", input: input) + } + + /// Gets the access control policy for the bucket. + public func getBucketAcl(_ input: GetBucketAclRequest) throws -> GetBucketAclOutput { + return try client.send(operation: "GetBucketAcl", path: "/{Bucket}?acl", httpMethod: "GET", input: input) + } + + /// Deletes a metrics configuration (specified by the metrics configuration ID) from the bucket. + public func deleteBucketMetricsConfiguration(_ input: DeleteBucketMetricsConfigurationRequest) throws { + _ = try client.send(operation: "DeleteBucketMetricsConfiguration", path: "/{Bucket}?metrics", httpMethod: "DELETE", input: input) + } + + /// Creates a new replication configuration (or replaces an existing one, if present). + public func putBucketReplication(_ input: PutBucketReplicationRequest) throws { + _ = try client.send(operation: "PutBucketReplication", path: "/{Bucket}?replication", httpMethod: "PUT", input: input) + } + + /// Returns a list of all buckets owned by the authenticated sender of the request. + public func listBuckets() throws -> ListBucketsOutput { + return try client.send(operation: "ListBuckets", path: "/", httpMethod: "GET") + } + + /// This operation enables you to delete multiple objects from a bucket using a single HTTP request. You may specify up to 1000 keys. + public func deleteObjects(_ input: DeleteObjectsRequest) throws -> DeleteObjectsOutput { + return try client.send(operation: "DeleteObjects", path: "/{Bucket}?delete", httpMethod: "POST", input: input) + } + + /// Adds an inventory configuration (identified by the inventory ID) from the bucket. + public func putBucketInventoryConfiguration(_ input: PutBucketInventoryConfigurationRequest) throws { + _ = try client.send(operation: "PutBucketInventoryConfiguration", path: "/{Bucket}?inventory", httpMethod: "PUT", input: input) + } + + /// Sets the request payment configuration for a bucket. By default, the bucket owner pays for downloads from the bucket. This configuration parameter enables the bucket owner (only) to specify that the person requesting the download will be charged for the download. Documentation on requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html + public func putBucketRequestPayment(_ input: PutBucketRequestPaymentRequest) throws { + _ = try client.send(operation: "PutBucketRequestPayment", path: "/{Bucket}?requestPayment", httpMethod: "PUT", input: input) + } + + /// Deprecated, see the GetBucketNotificationConfiguration operation. + public func getBucketNotification(_ input: GetBucketNotificationConfigurationRequest) throws -> NotificationConfigurationDeprecated { + return try client.send(operation: "GetBucketNotification", path: "/{Bucket}?notification", httpMethod: "GET", input: input) + } + + /// Deprecated, see the GetBucketLifecycleConfiguration operation. + public func getBucketLifecycle(_ input: GetBucketLifecycleRequest) throws -> GetBucketLifecycleOutput { + return try client.send(operation: "GetBucketLifecycle", path: "/{Bucket}?lifecycle", httpMethod: "GET", input: input) + } + + /// Set the logging parameters for a bucket and to specify permissions for who can view and modify the logging parameters. To set the logging status of a bucket, you must be the bucket owner. + public func putBucketLogging(_ input: PutBucketLoggingRequest) throws { + _ = try client.send(operation: "PutBucketLogging", path: "/{Bucket}?logging", httpMethod: "PUT", input: input) + } + + /// Deletes the tags from the bucket. + public func deleteBucketTagging(_ input: DeleteBucketTaggingRequest) throws { + _ = try client.send(operation: "DeleteBucketTagging", path: "/{Bucket}?tagging", httpMethod: "DELETE", input: input) + } + + /// Removes the tag-set from an existing object. + public func deleteObjectTagging(_ input: DeleteObjectTaggingRequest) throws -> DeleteObjectTaggingOutput { + return try client.send(operation: "DeleteObjectTagging", path: "/{Bucket}/{Key+}?tagging", httpMethod: "DELETE", input: input) + } + + /// Returns the lifecycle configuration information set on the bucket. + public func getBucketLifecycleConfiguration(_ input: GetBucketLifecycleConfigurationRequest) throws -> GetBucketLifecycleConfigurationOutput { + return try client.send(operation: "GetBucketLifecycleConfiguration", path: "/{Bucket}?lifecycle", httpMethod: "GET", input: input) + } + + /// This operation lists in-progress multipart uploads. + public func listMultipartUploads(_ input: ListMultipartUploadsRequest) throws -> ListMultipartUploadsOutput { + return try client.send(operation: "ListMultipartUploads", path: "/{Bucket}?uploads", httpMethod: "GET", input: input) + } + + /// Adds an object to a bucket. + public func putObject(_ input: PutObjectRequest) throws -> PutObjectOutput { + return try client.send(operation: "PutObject", path: "/{Bucket}/{Key+}", httpMethod: "PUT", input: input) + } + + /// Deletes the policy from the bucket. + public func deleteBucketPolicy(_ input: DeleteBucketPolicyRequest) throws { + _ = try client.send(operation: "DeleteBucketPolicy", path: "/{Bucket}?policy", httpMethod: "DELETE", input: input) + } + + /// Sets the accelerate configuration of an existing bucket. + public func putBucketAccelerateConfiguration(_ input: PutBucketAccelerateConfigurationRequest) throws { + _ = try client.send(operation: "PutBucketAccelerateConfiguration", path: "/{Bucket}?accelerate", httpMethod: "PUT", input: input) + } + + /// This operation is useful to determine if a bucket exists and you have permission to access it. + public func headBucket(_ input: HeadBucketRequest) throws { + _ = try client.send(operation: "HeadBucket", path: "/{Bucket}", httpMethod: "HEAD", input: input) + } + + /// Creates a copy of an object that is already stored in Amazon S3. + public func copyObject(_ input: CopyObjectRequest) throws -> CopyObjectOutput { + return try client.send(operation: "CopyObject", path: "/{Bucket}/{Key+}", httpMethod: "PUT", input: input) + } + + /// Returns the replication configuration of a bucket. + public func getBucketReplication(_ input: GetBucketReplicationRequest) throws -> GetBucketReplicationOutput { + return try client.send(operation: "GetBucketReplication", path: "/{Bucket}?replication", httpMethod: "GET", input: input) + } + + /// Completes a multipart upload by assembling previously uploaded parts. + public func completeMultipartUpload(_ input: CompleteMultipartUploadRequest) throws -> CompleteMultipartUploadOutput { + return try client.send(operation: "CompleteMultipartUpload", path: "/{Bucket}/{Key+}", httpMethod: "POST", input: input) + } + + /// Enables notifications of specified events for a bucket. + public func putBucketNotificationConfiguration(_ input: PutBucketNotificationConfigurationRequest) throws { + _ = try client.send(operation: "PutBucketNotificationConfiguration", path: "/{Bucket}?notification", httpMethod: "PUT", input: input) + } + + /// Sets the permissions on a bucket using access control lists (ACL). + public func putBucketAcl(_ input: PutBucketAclRequest) throws { + _ = try client.send(operation: "PutBucketAcl", path: "/{Bucket}?acl", httpMethod: "PUT", input: input) + } + + /// Initiates a multipart upload and returns an upload ID.Note: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage. + public func createMultipartUpload(_ input: CreateMultipartUploadRequest) throws -> CreateMultipartUploadOutput { + return try client.send(operation: "CreateMultipartUpload", path: "/{Bucket}/{Key+}?uploads", httpMethod: "POST", input: input) + } + + /// Sets the cors configuration for a bucket. + public func putBucketCors(_ input: PutBucketCorsRequest) throws { + _ = try client.send(operation: "PutBucketCors", path: "/{Bucket}?cors", httpMethod: "PUT", input: input) + } + + /// Sets the supplied tag-set to an object that already exists in a bucket + public func putObjectTagging(_ input: PutObjectTaggingRequest) throws -> PutObjectTaggingOutput { + return try client.send(operation: "PutObjectTagging", path: "/{Bucket}/{Key+}?tagging", httpMethod: "PUT", input: input) + } + + /// Lists the analytics configurations for the bucket. + public func listBucketAnalyticsConfigurations(_ input: ListBucketAnalyticsConfigurationsRequest) throws -> ListBucketAnalyticsConfigurationsOutput { + return try client.send(operation: "ListBucketAnalyticsConfigurations", path: "/{Bucket}?analytics", httpMethod: "GET", input: input) + } + + /// Sets a metrics configuration (specified by the metrics configuration ID) for the bucket. + public func putBucketMetricsConfiguration(_ input: PutBucketMetricsConfigurationRequest) throws { + _ = try client.send(operation: "PutBucketMetricsConfiguration", path: "/{Bucket}?metrics", httpMethod: "PUT", input: input) + } + + /// Retrieves objects from Amazon S3. + public func getObject(_ input: GetObjectRequest) throws -> GetObjectOutput { + return try client.send(operation: "GetObject", path: "/{Bucket}/{Key+}", httpMethod: "GET", input: input) + } + + /// Lists the parts that have been uploaded for a specific multipart upload. + public func listParts(_ input: ListPartsRequest) throws -> ListPartsOutput { + return try client.send(operation: "ListParts", path: "/{Bucket}/{Key+}", httpMethod: "GET", input: input) + } + + /// Returns the access control list (ACL) of an object. + public func getObjectAcl(_ input: GetObjectAclRequest) throws -> GetObjectAclOutput { + return try client.send(operation: "GetObjectAcl", path: "/{Bucket}/{Key+}?acl", httpMethod: "GET", input: input) + } + + /// Uploads a part in a multipart upload.Note: After you initiate multipart upload and upload one or more parts, you must either complete or abort multipart upload in order to stop getting charged for storage of the uploaded parts. Only after you either complete or abort multipart upload, Amazon S3 frees up the parts storage and stops charging you for the parts storage. + public func uploadPart(_ input: UploadPartRequest) throws -> UploadPartOutput { + return try client.send(operation: "UploadPart", path: "/{Bucket}/{Key+}", httpMethod: "PUT", input: input) + } + + /// Deprecated, see the PutBucketLifecycleConfiguration operation. + public func putBucketLifecycle(_ input: PutBucketLifecycleRequest) throws { + _ = try client.send(operation: "PutBucketLifecycle", path: "/{Bucket}?lifecycle", httpMethod: "PUT", input: input) + } + + /// Deletes the lifecycle configuration from the bucket. + public func deleteBucketLifecycle(_ input: DeleteBucketLifecycleRequest) throws { + _ = try client.send(operation: "DeleteBucketLifecycle", path: "/{Bucket}?lifecycle", httpMethod: "DELETE", input: input) + } + + /// Deletes the cors configuration information set for the bucket. + public func deleteBucketCors(_ input: DeleteBucketCorsRequest) throws { + _ = try client.send(operation: "DeleteBucketCors", path: "/{Bucket}?cors", httpMethod: "DELETE", input: input) + } + + /// Lists the metrics configurations for the bucket. + public func listBucketMetricsConfigurations(_ input: ListBucketMetricsConfigurationsRequest) throws -> ListBucketMetricsConfigurationsOutput { + return try client.send(operation: "ListBucketMetricsConfigurations", path: "/{Bucket}?metrics", httpMethod: "GET", input: input) + } + + /// Returns the versioning state of a bucket. + public func getBucketVersioning(_ input: GetBucketVersioningRequest) throws -> GetBucketVersioningOutput { + return try client.send(operation: "GetBucketVersioning", path: "/{Bucket}?versioning", httpMethod: "GET", input: input) + } + + /// Returns the request payment configuration of a bucket. + public func getBucketRequestPayment(_ input: GetBucketRequestPaymentRequest) throws -> GetBucketRequestPaymentOutput { + return try client.send(operation: "GetBucketRequestPayment", path: "/{Bucket}?requestPayment", httpMethod: "GET", input: input) + } + + /// Returns the website configuration for a bucket. + public func getBucketWebsite(_ input: GetBucketWebsiteRequest) throws -> GetBucketWebsiteOutput { + return try client.send(operation: "GetBucketWebsite", path: "/{Bucket}?website", httpMethod: "GET", input: input) + } + + /// Returns the policy of a specified bucket. + public func getBucketPolicy(_ input: GetBucketPolicyRequest) throws -> GetBucketPolicyOutput { + return try client.send(operation: "GetBucketPolicy", path: "/{Bucket}?policy", httpMethod: "GET", input: input) + } + + /// The HEAD operation retrieves metadata from an object without returning the object itself. This operation is useful if you're only interested in an object's metadata. To use HEAD, you must have READ access to the object. + public func headObject(_ input: HeadObjectRequest) throws -> HeadObjectOutput { + return try client.send(operation: "HeadObject", path: "/{Bucket}/{Key+}", httpMethod: "HEAD", input: input) + } + + /// Sets the tags for a bucket. + public func putBucketTagging(_ input: PutBucketTaggingRequest) throws { + _ = try client.send(operation: "PutBucketTagging", path: "/{Bucket}?tagging", httpMethod: "PUT", input: input) + } + + +} \ No newline at end of file diff --git a/Sources/S3_Error.swift b/Sources/S3_Error.swift new file mode 100644 index 0000000..2964f20 --- /dev/null +++ b/Sources/S3_Error.swift @@ -0,0 +1,65 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +/** +The MIT License (MIT) + +Copyright (c) 2017 Yuki Takei(noppoMan) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +import AWSSDKSwiftCore + +/// Error enum for S3 +public enum S3Error: AWSErrorType { + case noSuchUpload(message: String?) + case objectAlreadyInActiveTierError(message: String?) + case noSuchKey(message: String?) + case noSuchBucket(message: String?) + case bucketAlreadyExists(message: String?) + case bucketAlreadyOwnedByYou(message: String?) + case objectNotInActiveTierError(message: String?) +} + +extension S3Error { + public init?(errorCode: String, message: String?){ + var errorCode = errorCode + if let index = errorCode.index(of: "#") { + errorCode = errorCode.substring(from: errorCode.index(index, offsetBy: 1)) + } + switch errorCode { + case "NoSuchUpload": + self = .noSuchUpload(message: message) + case "ObjectAlreadyInActiveTierError": + self = .objectAlreadyInActiveTierError(message: message) + case "NoSuchKey": + self = .noSuchKey(message: message) + case "NoSuchBucket": + self = .noSuchBucket(message: message) + case "BucketAlreadyExists": + self = .bucketAlreadyExists(message: message) + case "BucketAlreadyOwnedByYou": + self = .bucketAlreadyOwnedByYou(message: message) + case "ObjectNotInActiveTierError": + self = .objectNotInActiveTierError(message: message) + default: + return nil + } + } +} \ No newline at end of file diff --git a/Sources/S3_Shapes.swift b/Sources/S3_Shapes.swift new file mode 100644 index 0000000..cea99c3 --- /dev/null +++ b/Sources/S3_Shapes.swift @@ -0,0 +1,6803 @@ +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. +/** +The MIT License (MIT) + +Copyright (c) 2017 Yuki Takei(noppoMan) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +import Foundation +import AWSSDKSwiftCore + +extension S3 { + + public struct DeleteBucketWebsiteRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct MetricsAndOperator: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Tags", location: .body(locationName: "Tag"), required: false, type: .structure), + AWSShapeProperty(label: "Prefix", required: false, type: .string) + ] + /// The list of tags used when evaluating an AND predicate. + public let tags: TagSet? + /// The prefix used when evaluating an AND predicate. + public let prefix: String? + + public init(tags: TagSet? = nil, prefix: String? = nil) { + self.tags = tags + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + if let tags = dictionary["Tag"] as? [String: Any] { self.tags = try S3.TagSet(dictionary: tags) } else { self.tags = nil } + self.prefix = dictionary["Prefix"] as? String + } + } + + public struct LifecycleExpiration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ExpiredObjectDeleteMarker", required: false, type: .boolean), + AWSShapeProperty(label: "Date", required: false, type: .timestamp), + AWSShapeProperty(label: "Days", required: false, type: .integer) + ] + /// Indicates whether Amazon S3 will remove a delete marker with no noncurrent versions. If set to true, the delete marker will be expired; if set to false the policy takes no action. This cannot be specified with Days or Date in a Lifecycle Expiration Policy. + public let expiredObjectDeleteMarker: Bool? + /// Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format. + public let date: String? + /// Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer. + public let days: Int32? + + public init(expiredObjectDeleteMarker: Bool? = nil, date: String? = nil, days: Int32? = nil) { + self.expiredObjectDeleteMarker = expiredObjectDeleteMarker + self.date = date + self.days = days + } + + public init(dictionary: [String: Any]) throws { + self.expiredObjectDeleteMarker = dictionary["ExpiredObjectDeleteMarker"] as? Bool + self.date = dictionary["Date"] as? String + self.days = dictionary["Days"] as? Int32 + } + } + + public struct PutBucketCorsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "CORSConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "CORSConfiguration", location: .body(locationName: "CORSConfiguration"), required: true, type: .structure), + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string) + ] + public let bucket: String + public let cORSConfiguration: CORSConfiguration + public let contentMD5: String? + + public init(bucket: String, cORSConfiguration: CORSConfiguration, contentMD5: String? = nil) { + self.bucket = bucket + self.cORSConfiguration = cORSConfiguration + self.contentMD5 = contentMD5 + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let cORSConfiguration = dictionary["CORSConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("CORSConfiguration") } + self.cORSConfiguration = try S3.CORSConfiguration(dictionary: cORSConfiguration) + self.contentMD5 = dictionary["Content-MD5"] as? String + } + } + + public struct TagSet: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Tag", required: false, type: .list) + ] + public let tag: [Tag]? + + public init(tag: [Tag]? = nil) { + self.tag = tag + } + + public init(dictionary: [String: Any]) throws { + if let tag = dictionary["Tag"] as? [[String: Any]] { + self.tag = try tag.map({ try Tag(dictionary: $0) }) + } else { + self.tag = nil + } + } + } + + public struct DeleteBucketCorsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct Rule: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ID", required: false, type: .string), + AWSShapeProperty(label: "Status", required: true, type: .enum), + AWSShapeProperty(label: "AbortIncompleteMultipartUpload", required: false, type: .structure), + AWSShapeProperty(label: "NoncurrentVersionExpiration", required: false, type: .structure), + AWSShapeProperty(label: "Transition", required: false, type: .structure), + AWSShapeProperty(label: "NoncurrentVersionTransition", required: false, type: .structure), + AWSShapeProperty(label: "Expiration", required: false, type: .structure), + AWSShapeProperty(label: "Prefix", required: true, type: .string) + ] + /// Unique identifier for the rule. The value cannot be longer than 255 characters. + public let iD: String? + /// If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is not currently being applied. + public let status: ExpirationStatus + public let abortIncompleteMultipartUpload: AbortIncompleteMultipartUpload? + public let noncurrentVersionExpiration: NoncurrentVersionExpiration? + public let transition: Transition? + public let noncurrentVersionTransition: NoncurrentVersionTransition? + public let expiration: LifecycleExpiration? + /// Prefix identifying one or more objects to which the rule applies. + public let prefix: String + + public init(iD: String? = nil, status: ExpirationStatus, abortIncompleteMultipartUpload: AbortIncompleteMultipartUpload? = nil, noncurrentVersionExpiration: NoncurrentVersionExpiration? = nil, transition: Transition? = nil, noncurrentVersionTransition: NoncurrentVersionTransition? = nil, expiration: LifecycleExpiration? = nil, prefix: String) { + self.iD = iD + self.status = status + self.abortIncompleteMultipartUpload = abortIncompleteMultipartUpload + self.noncurrentVersionExpiration = noncurrentVersionExpiration + self.transition = transition + self.noncurrentVersionTransition = noncurrentVersionTransition + self.expiration = expiration + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + self.iD = dictionary["ID"] as? String + guard let rawStatus = dictionary["Status"] as? String, let status = ExpirationStatus(rawValue: rawStatus) else { throw InitializableError.missingRequiredParam("Status") } + self.status = status + if let abortIncompleteMultipartUpload = dictionary["AbortIncompleteMultipartUpload"] as? [String: Any] { self.abortIncompleteMultipartUpload = try S3.AbortIncompleteMultipartUpload(dictionary: abortIncompleteMultipartUpload) } else { self.abortIncompleteMultipartUpload = nil } + if let noncurrentVersionExpiration = dictionary["NoncurrentVersionExpiration"] as? [String: Any] { self.noncurrentVersionExpiration = try S3.NoncurrentVersionExpiration(dictionary: noncurrentVersionExpiration) } else { self.noncurrentVersionExpiration = nil } + if let transition = dictionary["Transition"] as? [String: Any] { self.transition = try S3.Transition(dictionary: transition) } else { self.transition = nil } + if let noncurrentVersionTransition = dictionary["NoncurrentVersionTransition"] as? [String: Any] { self.noncurrentVersionTransition = try S3.NoncurrentVersionTransition(dictionary: noncurrentVersionTransition) } else { self.noncurrentVersionTransition = nil } + if let expiration = dictionary["Expiration"] as? [String: Any] { self.expiration = try S3.LifecycleExpiration(dictionary: expiration) } else { self.expiration = nil } + guard let prefix = dictionary["Prefix"] as? String else { throw InitializableError.missingRequiredParam("Prefix") } + self.prefix = prefix + } + } + + public struct GetBucketReplicationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct GetBucketLifecycleConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct LifecycleRuleAndOperator: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Tags", location: .body(locationName: "Tag"), required: false, type: .structure), + AWSShapeProperty(label: "Prefix", required: false, type: .string) + ] + /// All of these tags must exist in the object's tag set in order for the rule to apply. + public let tags: TagSet? + public let prefix: String? + + public init(tags: TagSet? = nil, prefix: String? = nil) { + self.tags = tags + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + if let tags = dictionary["Tag"] as? [String: Any] { self.tags = try S3.TagSet(dictionary: tags) } else { self.tags = nil } + self.prefix = dictionary["Prefix"] as? String + } + } + + public struct GetBucketPolicyRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct CopyObjectResult: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ETag", required: false, type: .string), + AWSShapeProperty(label: "LastModified", required: false, type: .timestamp) + ] + public let eTag: String? + public let lastModified: String? + + public init(eTag: String? = nil, lastModified: String? = nil) { + self.eTag = eTag + self.lastModified = lastModified + } + + public init(dictionary: [String: Any]) throws { + self.eTag = dictionary["ETag"] as? String + self.lastModified = dictionary["LastModified"] as? String + } + } + + public struct PutBucketAccelerateConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "AccelerateConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "AccelerateConfiguration", location: .body(locationName: "AccelerateConfiguration"), required: true, type: .structure) + ] + /// Name of the bucket for which the accelerate configuration is set. + public let bucket: String + /// Specifies the Accelerate Configuration you want to set for the bucket. + public let accelerateConfiguration: AccelerateConfiguration + + public init(bucket: String, accelerateConfiguration: AccelerateConfiguration) { + self.bucket = bucket + self.accelerateConfiguration = accelerateConfiguration + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let accelerateConfiguration = dictionary["AccelerateConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("AccelerateConfiguration") } + self.accelerateConfiguration = try S3.AccelerateConfiguration(dictionary: accelerateConfiguration) + } + } + + public struct GetBucketLocationOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "LocationConstraint", required: false, type: .enum) + ] + public let locationConstraint: BucketLocationConstraint? + + public init(locationConstraint: BucketLocationConstraint? = nil) { + self.locationConstraint = locationConstraint + } + + public init(dictionary: [String: Any]) throws { + if let locationConstraint = dictionary["LocationConstraint"] as? String { self.locationConstraint = BucketLocationConstraint(rawValue: locationConstraint) } else { self.locationConstraint = nil } + } + } + + public struct RedirectAllRequestsTo: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "HostName", required: true, type: .string), + AWSShapeProperty(label: "Protocol", required: false, type: .enum) + ] + /// Name of the host where requests will be redirected. + public let hostName: String + /// Protocol to use (http, https) when redirecting requests. The default is the protocol that is used in the original request. + public let `protocol`: Protocol? + + public init(hostName: String, protocol: Protocol? = nil) { + self.hostName = hostName + self.`protocol` = `protocol` + } + + public init(dictionary: [String: Any]) throws { + guard let hostName = dictionary["HostName"] as? String else { throw InitializableError.missingRequiredParam("HostName") } + self.hostName = hostName + if let `protocol` = dictionary["Protocol"] as? String { self.`protocol` = Protocol(rawValue: `protocol`) } else { self.`protocol` = nil } + } + } + + public enum ServerSideEncryption: String, CustomStringConvertible { + case aes256 = "AES256" + case aws_kms = "aws:kms" + public var description: String { return self.rawValue } + } + + public struct UploadPartCopyOutput: AWSShape { + /// The key for the payload + public static let payload: String? = "CopyPartResult" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "CopyPartResult", required: false, type: .structure), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceVersionId", location: .header(locationName: "x-amz-copy-source-version-id"), required: false, type: .string), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum) + ] + public let copyPartResult: CopyPartResult? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key. + public let sSECustomerKeyMD5: String? + /// The version of the source object that was copied, if you have enabled versioning on the source bucket. + public let copySourceVersionId: String? + /// If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object. + public let sSEKMSKeyId: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used. + public let sSECustomerAlgorithm: String? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + public let requestCharged: RequestCharged? + + public init(copyPartResult: CopyPartResult? = nil, sSECustomerKeyMD5: String? = nil, copySourceVersionId: String? = nil, sSEKMSKeyId: String? = nil, sSECustomerAlgorithm: String? = nil, serverSideEncryption: ServerSideEncryption? = nil, requestCharged: RequestCharged? = nil) { + self.copyPartResult = copyPartResult + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.copySourceVersionId = copySourceVersionId + self.sSEKMSKeyId = sSEKMSKeyId + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.serverSideEncryption = serverSideEncryption + self.requestCharged = requestCharged + } + + public init(dictionary: [String: Any]) throws { + if let copyPartResult = dictionary["CopyPartResult"] as? [String: Any] { self.copyPartResult = try S3.CopyPartResult(dictionary: copyPartResult) } else { self.copyPartResult = nil } + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.copySourceVersionId = dictionary["x-amz-copy-source-version-id"] as? String + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + } + } + + public struct Tagging: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "TagSet", required: true, type: .structure) + ] + public let tagSet: TagSet + + public init(tagSet: TagSet) { + self.tagSet = tagSet + } + + public init(dictionary: [String: Any]) throws { + guard let tagSet = dictionary["TagSet"] as? [String: Any] else { throw InitializableError.missingRequiredParam("TagSet") } + self.tagSet = try S3.TagSet(dictionary: tagSet) + } + } + + public struct GetBucketAnalyticsConfigurationOutput: AWSShape { + /// The key for the payload + public static let payload: String? = "AnalyticsConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "AnalyticsConfiguration", required: false, type: .structure) + ] + /// The configuration and any analyses for the analytics filter. + public let analyticsConfiguration: AnalyticsConfiguration? + + public init(analyticsConfiguration: AnalyticsConfiguration? = nil) { + self.analyticsConfiguration = analyticsConfiguration + } + + public init(dictionary: [String: Any]) throws { + if let analyticsConfiguration = dictionary["AnalyticsConfiguration"] as? [String: Any] { self.analyticsConfiguration = try S3.AnalyticsConfiguration(dictionary: analyticsConfiguration) } else { self.analyticsConfiguration = nil } + } + } + + public struct Owner: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ID", required: false, type: .string), + AWSShapeProperty(label: "DisplayName", required: false, type: .string) + ] + public let iD: String? + public let displayName: String? + + public init(iD: String? = nil, displayName: String? = nil) { + self.iD = iD + self.displayName = displayName + } + + public init(dictionary: [String: Any]) throws { + self.iD = dictionary["ID"] as? String + self.displayName = dictionary["DisplayName"] as? String + } + } + + public struct CreateMultipartUploadOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .body(locationName: "Bucket"), required: false, type: .string), + AWSShapeProperty(label: "AbortDate", location: .header(locationName: "x-amz-abort-date"), required: false, type: .timestamp), + AWSShapeProperty(label: "AbortRuleId", location: .header(locationName: "x-amz-abort-rule-id"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Key", required: false, type: .string), + AWSShapeProperty(label: "UploadId", required: false, type: .string), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum) + ] + /// Name of the bucket to which the multipart upload was initiated. + public let bucket: String? + /// Date when multipart upload will become eligible for abort operation by lifecycle. + public let abortDate: String? + /// Id of the lifecycle rule that makes a multipart upload eligible for abort operation. + public let abortRuleId: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key. + public let sSECustomerKeyMD5: String? + /// Object key for which the multipart upload was initiated. + public let key: String? + /// ID for the initiated multipart upload. + public let uploadId: String? + /// If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object. + public let sSEKMSKeyId: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used. + public let sSECustomerAlgorithm: String? + public let requestCharged: RequestCharged? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + + public init(bucket: String? = nil, abortDate: String? = nil, abortRuleId: String? = nil, sSECustomerKeyMD5: String? = nil, key: String? = nil, uploadId: String? = nil, sSEKMSKeyId: String? = nil, sSECustomerAlgorithm: String? = nil, requestCharged: RequestCharged? = nil, serverSideEncryption: ServerSideEncryption? = nil) { + self.bucket = bucket + self.abortDate = abortDate + self.abortRuleId = abortRuleId + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.key = key + self.uploadId = uploadId + self.sSEKMSKeyId = sSEKMSKeyId + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.requestCharged = requestCharged + self.serverSideEncryption = serverSideEncryption + } + + public init(dictionary: [String: Any]) throws { + self.bucket = dictionary["Bucket"] as? String + self.abortDate = dictionary["x-amz-abort-date"] as? String + self.abortRuleId = dictionary["x-amz-abort-rule-id"] as? String + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.key = dictionary["Key"] as? String + self.uploadId = dictionary["UploadId"] as? String + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + } + } + + public struct Object: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "LastModified", required: false, type: .timestamp), + AWSShapeProperty(label: "StorageClass", required: false, type: .enum), + AWSShapeProperty(label: "Key", required: false, type: .string), + AWSShapeProperty(label: "ETag", required: false, type: .string), + AWSShapeProperty(label: "Owner", required: false, type: .structure), + AWSShapeProperty(label: "Size", required: false, type: .integer) + ] + public let lastModified: String? + /// The class of storage used to store the object. + public let storageClass: ObjectStorageClass? + public let key: String? + public let eTag: String? + public let owner: Owner? + public let size: Int32? + + public init(lastModified: String? = nil, storageClass: ObjectStorageClass? = nil, key: String? = nil, eTag: String? = nil, owner: Owner? = nil, size: Int32? = nil) { + self.lastModified = lastModified + self.storageClass = storageClass + self.key = key + self.eTag = eTag + self.owner = owner + self.size = size + } + + public init(dictionary: [String: Any]) throws { + self.lastModified = dictionary["LastModified"] as? String + if let storageClass = dictionary["StorageClass"] as? String { self.storageClass = ObjectStorageClass(rawValue: storageClass) } else { self.storageClass = nil } + self.key = dictionary["Key"] as? String + self.eTag = dictionary["ETag"] as? String + if let owner = dictionary["Owner"] as? [String: Any] { self.owner = try S3.Owner(dictionary: owner) } else { self.owner = nil } + self.size = dictionary["Size"] as? Int32 + } + } + + public struct CopyObjectRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Tagging", location: .header(locationName: "x-amz-tagging"), required: false, type: .string), + AWSShapeProperty(label: "ContentDisposition", location: .header(locationName: "Content-Disposition"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceIfModifiedSince", location: .header(locationName: "x-amz-copy-source-if-modified-since"), required: false, type: .timestamp), + AWSShapeProperty(label: "CopySourceIfNoneMatch", location: .header(locationName: "x-amz-copy-source-if-none-match"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceIfMatch", location: .header(locationName: "x-amz-copy-source-if-match"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceSSECustomerKey", location: .header(locationName: "x-amz-copy-source-server-side-encryption-customer-key"), required: false, type: .string), + AWSShapeProperty(label: "ContentLanguage", location: .header(locationName: "Content-Language"), required: false, type: .string), + AWSShapeProperty(label: "GrantReadACP", location: .header(locationName: "x-amz-grant-read-acp"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "ContentEncoding", location: .header(locationName: "Content-Encoding"), required: false, type: .string), + AWSShapeProperty(label: "GrantWriteACP", location: .header(locationName: "x-amz-grant-write-acp"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "WebsiteRedirectLocation", location: .header(locationName: "x-amz-website-redirect-location"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceSSECustomerKeyMD5", location: .header(locationName: "x-amz-copy-source-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceIfUnmodifiedSince", location: .header(locationName: "x-amz-copy-source-if-unmodified-since"), required: false, type: .timestamp), + AWSShapeProperty(label: "SSECustomerKey", location: .header(locationName: "x-amz-server-side-encryption-customer-key"), required: false, type: .string), + AWSShapeProperty(label: "CacheControl", location: .header(locationName: "Cache-Control"), required: false, type: .string), + AWSShapeProperty(label: "TaggingDirective", location: .header(locationName: "x-amz-tagging-directive"), required: false, type: .enum), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "GrantFullControl", location: .header(locationName: "x-amz-grant-full-control"), required: false, type: .string), + AWSShapeProperty(label: "MetadataDirective", location: .header(locationName: "x-amz-metadata-directive"), required: false, type: .enum), + AWSShapeProperty(label: "CopySource", location: .header(locationName: "x-amz-copy-source"), required: true, type: .string), + AWSShapeProperty(label: "ACL", location: .header(locationName: "x-amz-acl"), required: false, type: .enum), + AWSShapeProperty(label: "Metadata", required: false, type: .map), + AWSShapeProperty(label: "Expires", location: .header(locationName: "Expires"), required: false, type: .timestamp), + AWSShapeProperty(label: "ContentType", location: .header(locationName: "Content-Type"), required: false, type: .string), + AWSShapeProperty(label: "StorageClass", location: .header(locationName: "x-amz-storage-class"), required: false, type: .enum), + AWSShapeProperty(label: "CopySourceSSECustomerAlgorithm", location: .header(locationName: "x-amz-copy-source-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "GrantRead", location: .header(locationName: "x-amz-grant-read"), required: false, type: .string), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum) + ] + public let bucket: String + /// The tag-set for the object destination object this value must be used in conjunction with the TaggingDirective. The tag-set must be encoded as URL Query parameters + public let tagging: String? + /// Specifies presentational information for the object. + public let contentDisposition: String? + /// Copies the object if it has been modified since the specified time. + public let copySourceIfModifiedSince: String? + /// Copies the object if its entity tag (ETag) is different than the specified ETag. + public let copySourceIfNoneMatch: String? + /// Copies the object if its entity tag (ETag) matches the specified tag. + public let copySourceIfMatch: String? + /// Specifies the customer-provided encryption key for Amazon S3 to use to decrypt the source object. The encryption key provided in this header must be one that was used when the source object was created. + public let copySourceSSECustomerKey: String? + /// The language the content is in. + public let contentLanguage: String? + /// Allows grantee to read the object ACL. + public let grantReadACP: String? + /// Specifies the algorithm to use to when encrypting the object (e.g., AES256). + public let sSECustomerAlgorithm: String? + /// Specifies the AWS KMS key ID to use for object encryption. All GET and PUT requests for an object protected by AWS KMS will fail if not made via SSL or using SigV4. Documentation on configuring any of the officially supported AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version + public let sSEKMSKeyId: String? + /// Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. + public let contentEncoding: String? + /// Allows grantee to write the ACL for the applicable object. + public let grantWriteACP: String? + public let key: String + /// If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. + public let websiteRedirectLocation: String? + /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error. + public let copySourceSSECustomerKeyMD5: String? + /// Copies the object if it hasn't been modified since the specified time. + public let copySourceIfUnmodifiedSince: String? + /// Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header. + public let sSECustomerKey: String? + /// Specifies caching behavior along the request/reply chain. + public let cacheControl: String? + /// Specifies whether the object tag-set are copied from the source object or replaced with tag-set provided in the request. + public let taggingDirective: TaggingDirective? + public let requestPayer: RequestPayer? + /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error. + public let sSECustomerKeyMD5: String? + /// Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. + public let grantFullControl: String? + /// Specifies whether the metadata is copied from the source object or replaced with metadata provided in the request. + public let metadataDirective: MetadataDirective? + /// The name of the source bucket and key name of the source object, separated by a slash (/). Must be URL-encoded. + public let copySource: String + /// The canned ACL to apply to the object. + public let aCL: ObjectCannedACL? + /// A map of metadata to store with the object in S3. + public let metadata: [String: String]? + /// The date and time at which the object is no longer cacheable. + public let expires: String? + /// A standard MIME type describing the format of the object data. + public let contentType: String? + /// The type of storage to use for the object. Defaults to 'STANDARD'. + public let storageClass: StorageClass? + /// Specifies the algorithm to use when decrypting the source object (e.g., AES256). + public let copySourceSSECustomerAlgorithm: String? + /// Allows grantee to read the object data and its metadata. + public let grantRead: String? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + + public init(bucket: String, tagging: String? = nil, contentDisposition: String? = nil, copySourceIfModifiedSince: String? = nil, copySourceIfNoneMatch: String? = nil, copySourceIfMatch: String? = nil, copySourceSSECustomerKey: String? = nil, contentLanguage: String? = nil, grantReadACP: String? = nil, sSECustomerAlgorithm: String? = nil, sSEKMSKeyId: String? = nil, contentEncoding: String? = nil, grantWriteACP: String? = nil, key: String, websiteRedirectLocation: String? = nil, copySourceSSECustomerKeyMD5: String? = nil, copySourceIfUnmodifiedSince: String? = nil, sSECustomerKey: String? = nil, cacheControl: String? = nil, taggingDirective: TaggingDirective? = nil, requestPayer: RequestPayer? = nil, sSECustomerKeyMD5: String? = nil, grantFullControl: String? = nil, metadataDirective: MetadataDirective? = nil, copySource: String, aCL: ObjectCannedACL? = nil, metadata: [String: String]? = nil, expires: String? = nil, contentType: String? = nil, storageClass: StorageClass? = nil, copySourceSSECustomerAlgorithm: String? = nil, grantRead: String? = nil, serverSideEncryption: ServerSideEncryption? = nil) { + self.bucket = bucket + self.tagging = tagging + self.contentDisposition = contentDisposition + self.copySourceIfModifiedSince = copySourceIfModifiedSince + self.copySourceIfNoneMatch = copySourceIfNoneMatch + self.copySourceIfMatch = copySourceIfMatch + self.copySourceSSECustomerKey = copySourceSSECustomerKey + self.contentLanguage = contentLanguage + self.grantReadACP = grantReadACP + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.sSEKMSKeyId = sSEKMSKeyId + self.contentEncoding = contentEncoding + self.grantWriteACP = grantWriteACP + self.key = key + self.websiteRedirectLocation = websiteRedirectLocation + self.copySourceSSECustomerKeyMD5 = copySourceSSECustomerKeyMD5 + self.copySourceIfUnmodifiedSince = copySourceIfUnmodifiedSince + self.sSECustomerKey = sSECustomerKey + self.cacheControl = cacheControl + self.taggingDirective = taggingDirective + self.requestPayer = requestPayer + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.grantFullControl = grantFullControl + self.metadataDirective = metadataDirective + self.copySource = copySource + self.aCL = aCL + self.metadata = metadata + self.expires = expires + self.contentType = contentType + self.storageClass = storageClass + self.copySourceSSECustomerAlgorithm = copySourceSSECustomerAlgorithm + self.grantRead = grantRead + self.serverSideEncryption = serverSideEncryption + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.tagging = dictionary["x-amz-tagging"] as? String + self.contentDisposition = dictionary["Content-Disposition"] as? String + self.copySourceIfModifiedSince = dictionary["x-amz-copy-source-if-modified-since"] as? String + self.copySourceIfNoneMatch = dictionary["x-amz-copy-source-if-none-match"] as? String + self.copySourceIfMatch = dictionary["x-amz-copy-source-if-match"] as? String + self.copySourceSSECustomerKey = dictionary["x-amz-copy-source-server-side-encryption-customer-key"] as? String + self.contentLanguage = dictionary["Content-Language"] as? String + self.grantReadACP = dictionary["x-amz-grant-read-acp"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.contentEncoding = dictionary["Content-Encoding"] as? String + self.grantWriteACP = dictionary["x-amz-grant-write-acp"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.websiteRedirectLocation = dictionary["x-amz-website-redirect-location"] as? String + self.copySourceSSECustomerKeyMD5 = dictionary["x-amz-copy-source-server-side-encryption-customer-key-MD5"] as? String + self.copySourceIfUnmodifiedSince = dictionary["x-amz-copy-source-if-unmodified-since"] as? String + self.sSECustomerKey = dictionary["x-amz-server-side-encryption-customer-key"] as? String + self.cacheControl = dictionary["Cache-Control"] as? String + if let taggingDirective = dictionary["x-amz-tagging-directive"] as? String { self.taggingDirective = TaggingDirective(rawValue: taggingDirective) } else { self.taggingDirective = nil } + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.grantFullControl = dictionary["x-amz-grant-full-control"] as? String + if let metadataDirective = dictionary["x-amz-metadata-directive"] as? String { self.metadataDirective = MetadataDirective(rawValue: metadataDirective) } else { self.metadataDirective = nil } + guard let copySource = dictionary["x-amz-copy-source"] as? String else { throw InitializableError.missingRequiredParam("x-amz-copy-source") } + self.copySource = copySource + if let aCL = dictionary["x-amz-acl"] as? String { self.aCL = ObjectCannedACL(rawValue: aCL) } else { self.aCL = nil } + if let metadata = dictionary["x-amz-meta-"] as? [String: String] { + self.metadata = metadata + } else { + self.metadata = nil + } + self.expires = dictionary["Expires"] as? String + self.contentType = dictionary["Content-Type"] as? String + if let storageClass = dictionary["x-amz-storage-class"] as? String { self.storageClass = StorageClass(rawValue: storageClass) } else { self.storageClass = nil } + self.copySourceSSECustomerAlgorithm = dictionary["x-amz-copy-source-server-side-encryption-customer-algorithm"] as? String + self.grantRead = dictionary["x-amz-grant-read"] as? String + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + } + } + + public enum TaggingDirective: String, CustomStringConvertible { + case copy = "COPY" + case replace = "REPLACE" + public var description: String { return self.rawValue } + } + + public struct GetBucketLocationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct Grant: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Permission", required: false, type: .enum), + AWSShapeProperty(label: "Grantee", required: false, type: .structure) + ] + /// Specifies the permission given to the grantee. + public let permission: Permission? + public let grantee: Grantee? + + public init(permission: Permission? = nil, grantee: Grantee? = nil) { + self.permission = permission + self.grantee = grantee + } + + public init(dictionary: [String: Any]) throws { + if let permission = dictionary["Permission"] as? String { self.permission = Permission(rawValue: permission) } else { self.permission = nil } + if let grantee = dictionary["Grantee"] as? [String: Any] { self.grantee = try S3.Grantee(dictionary: grantee) } else { self.grantee = nil } + } + } + + public struct InventoryDestination: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "S3BucketDestination", required: true, type: .structure) + ] + /// Contains the bucket name, file format, bucket owner (optional), and prefix (optional) where inventory results are published. + public let s3BucketDestination: InventoryS3BucketDestination + + public init(s3BucketDestination: InventoryS3BucketDestination) { + self.s3BucketDestination = s3BucketDestination + } + + public init(dictionary: [String: Any]) throws { + guard let s3BucketDestination = dictionary["S3BucketDestination"] as? [String: Any] else { throw InitializableError.missingRequiredParam("S3BucketDestination") } + self.s3BucketDestination = try S3.InventoryS3BucketDestination(dictionary: s3BucketDestination) + } + } + + public enum BucketCannedACL: String, CustomStringConvertible { + case `private` = "private" + case public_read = "public-read" + case public_read_write = "public-read-write" + case authenticated_read = "authenticated-read" + public var description: String { return self.rawValue } + } + + public struct ListObjectsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "MaxKeys", location: .querystring(locationName: "max-keys"), required: false, type: .integer), + AWSShapeProperty(label: "Marker", location: .querystring(locationName: "marker"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "Prefix", location: .querystring(locationName: "prefix"), required: false, type: .string), + AWSShapeProperty(label: "Delimiter", location: .querystring(locationName: "delimiter"), required: false, type: .string), + AWSShapeProperty(label: "EncodingType", location: .querystring(locationName: "encoding-type"), required: false, type: .enum) + ] + public let bucket: String + /// Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more. + public let maxKeys: Int32? + /// Specifies the key to start with when listing objects in a bucket. + public let marker: String? + /// Confirms that the requester knows that she or he will be charged for the list objects request. Bucket owners need not specify this parameter in their requests. + public let requestPayer: RequestPayer? + /// Limits the response to keys that begin with the specified prefix. + public let prefix: String? + /// A delimiter is a character you use to group keys. + public let delimiter: String? + public let encodingType: EncodingType? + + public init(bucket: String, maxKeys: Int32? = nil, marker: String? = nil, requestPayer: RequestPayer? = nil, prefix: String? = nil, delimiter: String? = nil, encodingType: EncodingType? = nil) { + self.bucket = bucket + self.maxKeys = maxKeys + self.marker = marker + self.requestPayer = requestPayer + self.prefix = prefix + self.delimiter = delimiter + self.encodingType = encodingType + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.maxKeys = dictionary["max-keys"] as? Int32 + self.marker = dictionary["marker"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.prefix = dictionary["prefix"] as? String + self.delimiter = dictionary["delimiter"] as? String + if let encodingType = dictionary["encoding-type"] as? String { self.encodingType = EncodingType(rawValue: encodingType) } else { self.encodingType = nil } + } + } + + public struct PutBucketAnalyticsConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "AnalyticsConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "AnalyticsConfiguration", location: .body(locationName: "AnalyticsConfiguration"), required: true, type: .structure), + AWSShapeProperty(label: "Id", location: .querystring(locationName: "id"), required: true, type: .string) + ] + /// The name of the bucket to which an analytics configuration is stored. + public let bucket: String + /// The configuration and any analyses for the analytics filter. + public let analyticsConfiguration: AnalyticsConfiguration + /// The identifier used to represent an analytics configuration. + public let id: String + + public init(bucket: String, analyticsConfiguration: AnalyticsConfiguration, id: String) { + self.bucket = bucket + self.analyticsConfiguration = analyticsConfiguration + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let analyticsConfiguration = dictionary["AnalyticsConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("AnalyticsConfiguration") } + self.analyticsConfiguration = try S3.AnalyticsConfiguration(dictionary: analyticsConfiguration) + guard let id = dictionary["id"] as? String else { throw InitializableError.missingRequiredParam("id") } + self.id = id + } + } + + public struct CloudFunctionConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "CloudFunction", required: false, type: .string), + AWSShapeProperty(label: "InvocationRole", required: false, type: .string), + AWSShapeProperty(label: "Events", location: .body(locationName: "Event"), required: false, type: .list), + AWSShapeProperty(label: "Event", required: false, type: .enum), + AWSShapeProperty(label: "Id", required: false, type: .string) + ] + public let cloudFunction: String? + public let invocationRole: String? + public let events: [Event]? + public let event: Event? + public let id: String? + + public init(cloudFunction: String? = nil, invocationRole: String? = nil, events: [Event]? = nil, event: Event? = nil, id: String? = nil) { + self.cloudFunction = cloudFunction + self.invocationRole = invocationRole + self.events = events + self.event = event + self.id = id + } + + public init(dictionary: [String: Any]) throws { + self.cloudFunction = dictionary["CloudFunction"] as? String + self.invocationRole = dictionary["InvocationRole"] as? String + if let events = dictionary["Event"] as? [String] { self.events = events.flatMap({ Event(rawValue: $0)}) } else { self.events = nil } + if let event = dictionary["Event"] as? String { self.event = Event(rawValue: event) } else { self.event = nil } + self.id = dictionary["Id"] as? String + } + } + + public struct HeadObjectRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "SSECustomerKey", location: .header(locationName: "x-amz-server-side-encryption-customer-key"), required: false, type: .string), + AWSShapeProperty(label: "IfUnmodifiedSince", location: .header(locationName: "If-Unmodified-Since"), required: false, type: .timestamp), + AWSShapeProperty(label: "PartNumber", location: .querystring(locationName: "partNumber"), required: false, type: .integer), + AWSShapeProperty(label: "Range", location: .header(locationName: "Range"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "VersionId", location: .querystring(locationName: "versionId"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "IfNoneMatch", location: .header(locationName: "If-None-Match"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "IfModifiedSince", location: .header(locationName: "If-Modified-Since"), required: false, type: .timestamp), + AWSShapeProperty(label: "IfMatch", location: .header(locationName: "If-Match"), required: false, type: .string) + ] + public let bucket: String + /// Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header. + public let sSECustomerKey: String? + /// Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed). + public let ifUnmodifiedSince: String? + /// Part number of the object being read. This is a positive integer between 1 and 10,000. Effectively performs a 'ranged' HEAD request for the part specified. Useful querying about the size of the part and the number of parts in this object. + public let partNumber: Int32? + /// Downloads the specified range bytes of an object. For more information about the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. + public let range: String? + public let requestPayer: RequestPayer? + /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error. + public let sSECustomerKeyMD5: String? + /// VersionId used to reference a specific version of the object. + public let versionId: String? + /// Specifies the algorithm to use to when encrypting the object (e.g., AES256). + public let sSECustomerAlgorithm: String? + /// Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified). + public let ifNoneMatch: String? + public let key: String + /// Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified). + public let ifModifiedSince: String? + /// Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed). + public let ifMatch: String? + + public init(bucket: String, sSECustomerKey: String? = nil, ifUnmodifiedSince: String? = nil, partNumber: Int32? = nil, range: String? = nil, requestPayer: RequestPayer? = nil, sSECustomerKeyMD5: String? = nil, versionId: String? = nil, sSECustomerAlgorithm: String? = nil, ifNoneMatch: String? = nil, key: String, ifModifiedSince: String? = nil, ifMatch: String? = nil) { + self.bucket = bucket + self.sSECustomerKey = sSECustomerKey + self.ifUnmodifiedSince = ifUnmodifiedSince + self.partNumber = partNumber + self.range = range + self.requestPayer = requestPayer + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.versionId = versionId + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.ifNoneMatch = ifNoneMatch + self.key = key + self.ifModifiedSince = ifModifiedSince + self.ifMatch = ifMatch + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.sSECustomerKey = dictionary["x-amz-server-side-encryption-customer-key"] as? String + self.ifUnmodifiedSince = dictionary["If-Unmodified-Since"] as? String + self.partNumber = dictionary["partNumber"] as? Int32 + self.range = dictionary["Range"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.versionId = dictionary["versionId"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + self.ifNoneMatch = dictionary["If-None-Match"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.ifModifiedSince = dictionary["If-Modified-Since"] as? String + self.ifMatch = dictionary["If-Match"] as? String + } + } + + public struct GetBucketRequestPaymentOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Payer", required: false, type: .enum) + ] + /// Specifies who pays for the download and request fees. + public let payer: Payer? + + public init(payer: Payer? = nil) { + self.payer = payer + } + + public init(dictionary: [String: Any]) throws { + if let payer = dictionary["Payer"] as? String { self.payer = Payer(rawValue: payer) } else { self.payer = nil } + } + } + + public struct AbortMultipartUploadOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum) + ] + public let requestCharged: RequestCharged? + + public init(requestCharged: RequestCharged? = nil) { + self.requestCharged = requestCharged + } + + public init(dictionary: [String: Any]) throws { + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + } + } + + public struct PutObjectTaggingRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "Tagging" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Tagging", location: .body(locationName: "Tagging"), required: true, type: .structure), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "VersionId", location: .querystring(locationName: "versionId"), required: false, type: .string) + ] + public let bucket: String + public let contentMD5: String? + public let tagging: Tagging + public let key: String + public let versionId: String? + + public init(bucket: String, contentMD5: String? = nil, tagging: Tagging, key: String, versionId: String? = nil) { + self.bucket = bucket + self.contentMD5 = contentMD5 + self.tagging = tagging + self.key = key + self.versionId = versionId + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let tagging = dictionary["Tagging"] as? [String: Any] else { throw InitializableError.missingRequiredParam("Tagging") } + self.tagging = try S3.Tagging(dictionary: tagging) + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.versionId = dictionary["versionId"] as? String + } + } + + public struct CompletedMultipartUpload: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Parts", location: .body(locationName: "Part"), required: false, type: .list) + ] + public let parts: [CompletedPart]? + + public init(parts: [CompletedPart]? = nil) { + self.parts = parts + } + + public init(dictionary: [String: Any]) throws { + if let parts = dictionary["Part"] as? [[String: Any]] { + self.parts = try parts.map({ try CompletedPart(dictionary: $0) }) + } else { + self.parts = nil + } + } + } + + public enum ObjectCannedACL: String, CustomStringConvertible { + case `private` = "private" + case public_read = "public-read" + case public_read_write = "public-read-write" + case authenticated_read = "authenticated-read" + case aws_exec_read = "aws-exec-read" + case bucket_owner_read = "bucket-owner-read" + case bucket_owner_full_control = "bucket-owner-full-control" + public var description: String { return self.rawValue } + } + + public enum MFADeleteStatus: String, CustomStringConvertible { + case enabled = "Enabled" + case disabled = "Disabled" + public var description: String { return self.rawValue } + } + + public struct GetObjectOutput: AWSShape { + /// The key for the payload + public static let payload: String? = "Body" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "PartsCount", location: .header(locationName: "x-amz-mp-parts-count"), required: false, type: .integer), + AWSShapeProperty(label: "ContentDisposition", location: .header(locationName: "Content-Disposition"), required: false, type: .string), + AWSShapeProperty(label: "VersionId", location: .header(locationName: "x-amz-version-id"), required: false, type: .string), + AWSShapeProperty(label: "ReplicationStatus", location: .header(locationName: "x-amz-replication-status"), required: false, type: .enum), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "ContentLanguage", location: .header(locationName: "Content-Language"), required: false, type: .string), + AWSShapeProperty(label: "TagCount", location: .header(locationName: "x-amz-tagging-count"), required: false, type: .integer), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "Restore", location: .header(locationName: "x-amz-restore"), required: false, type: .string), + AWSShapeProperty(label: "ContentEncoding", location: .header(locationName: "Content-Encoding"), required: false, type: .string), + AWSShapeProperty(label: "ContentLength", location: .header(locationName: "Content-Length"), required: false, type: .long), + AWSShapeProperty(label: "Expiration", location: .header(locationName: "x-amz-expiration"), required: false, type: .string), + AWSShapeProperty(label: "WebsiteRedirectLocation", location: .header(locationName: "x-amz-website-redirect-location"), required: false, type: .string), + AWSShapeProperty(label: "ETag", location: .header(locationName: "ETag"), required: false, type: .string), + AWSShapeProperty(label: "Body", required: false, type: .blob), + AWSShapeProperty(label: "MissingMeta", location: .header(locationName: "x-amz-missing-meta"), required: false, type: .integer), + AWSShapeProperty(label: "CacheControl", location: .header(locationName: "Cache-Control"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "AcceptRanges", location: .header(locationName: "accept-ranges"), required: false, type: .string), + AWSShapeProperty(label: "LastModified", location: .header(locationName: "Last-Modified"), required: false, type: .timestamp), + AWSShapeProperty(label: "Metadata", required: false, type: .map), + AWSShapeProperty(label: "Expires", location: .header(locationName: "Expires"), required: false, type: .timestamp), + AWSShapeProperty(label: "ContentRange", location: .header(locationName: "Content-Range"), required: false, type: .string), + AWSShapeProperty(label: "ContentType", location: .header(locationName: "Content-Type"), required: false, type: .string), + AWSShapeProperty(label: "StorageClass", location: .header(locationName: "x-amz-storage-class"), required: false, type: .enum), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum), + AWSShapeProperty(label: "DeleteMarker", location: .header(locationName: "x-amz-delete-marker"), required: false, type: .boolean) + ] + /// The count of parts this object has. + public let partsCount: Int32? + /// Specifies presentational information for the object. + public let contentDisposition: String? + /// Version of the object. + public let versionId: String? + public let replicationStatus: ReplicationStatus? + /// If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object. + public let sSEKMSKeyId: String? + /// The language the content is in. + public let contentLanguage: String? + /// The number of tags, if any, on the object. + public let tagCount: Int32? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used. + public let sSECustomerAlgorithm: String? + /// Provides information about object restoration operation and expiration time of the restored object copy. + public let restore: String? + /// Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. + public let contentEncoding: String? + /// Size of the body in bytes. + public let contentLength: Int64? + /// If the object expiration is configured (see PUT Bucket lifecycle), the response includes this header. It includes the expiry-date and rule-id key value pairs providing object expiration information. The value of the rule-id is URL encoded. + public let expiration: String? + /// If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. + public let websiteRedirectLocation: String? + /// An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL + public let eTag: String? + /// Object data. + public let body: Data? + /// This is set to the number of metadata entries not returned in x-amz-meta headers. This can happen if you create metadata using an API like SOAP that supports more flexible metadata than the REST API. For example, using SOAP, you can create metadata whose values are not legal HTTP headers. + public let missingMeta: Int32? + /// Specifies caching behavior along the request/reply chain. + public let cacheControl: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key. + public let sSECustomerKeyMD5: String? + public let acceptRanges: String? + /// Last modified date of the object + public let lastModified: String? + /// A map of metadata to store with the object in S3. + public let metadata: [String: String]? + /// The date and time at which the object is no longer cacheable. + public let expires: String? + /// The portion of the object returned in the response. + public let contentRange: String? + /// A standard MIME type describing the format of the object data. + public let contentType: String? + public let storageClass: StorageClass? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + public let requestCharged: RequestCharged? + /// Specifies whether the object retrieved was (true) or was not (false) a Delete Marker. If false, this response header does not appear in the response. + public let deleteMarker: Bool? + + public init(partsCount: Int32? = nil, contentDisposition: String? = nil, versionId: String? = nil, replicationStatus: ReplicationStatus? = nil, sSEKMSKeyId: String? = nil, contentLanguage: String? = nil, tagCount: Int32? = nil, sSECustomerAlgorithm: String? = nil, restore: String? = nil, contentEncoding: String? = nil, contentLength: Int64? = nil, expiration: String? = nil, websiteRedirectLocation: String? = nil, eTag: String? = nil, body: Data? = nil, missingMeta: Int32? = nil, cacheControl: String? = nil, sSECustomerKeyMD5: String? = nil, acceptRanges: String? = nil, lastModified: String? = nil, metadata: [String: String]? = nil, expires: String? = nil, contentRange: String? = nil, contentType: String? = nil, storageClass: StorageClass? = nil, serverSideEncryption: ServerSideEncryption? = nil, requestCharged: RequestCharged? = nil, deleteMarker: Bool? = nil) { + self.partsCount = partsCount + self.contentDisposition = contentDisposition + self.versionId = versionId + self.replicationStatus = replicationStatus + self.sSEKMSKeyId = sSEKMSKeyId + self.contentLanguage = contentLanguage + self.tagCount = tagCount + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.restore = restore + self.contentEncoding = contentEncoding + self.contentLength = contentLength + self.expiration = expiration + self.websiteRedirectLocation = websiteRedirectLocation + self.eTag = eTag + self.body = body + self.missingMeta = missingMeta + self.cacheControl = cacheControl + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.acceptRanges = acceptRanges + self.lastModified = lastModified + self.metadata = metadata + self.expires = expires + self.contentRange = contentRange + self.contentType = contentType + self.storageClass = storageClass + self.serverSideEncryption = serverSideEncryption + self.requestCharged = requestCharged + self.deleteMarker = deleteMarker + } + + public init(dictionary: [String: Any]) throws { + self.partsCount = dictionary["x-amz-mp-parts-count"] as? Int32 + self.contentDisposition = dictionary["Content-Disposition"] as? String + self.versionId = dictionary["x-amz-version-id"] as? String + if let replicationStatus = dictionary["x-amz-replication-status"] as? String { self.replicationStatus = ReplicationStatus(rawValue: replicationStatus) } else { self.replicationStatus = nil } + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.contentLanguage = dictionary["Content-Language"] as? String + self.tagCount = dictionary["x-amz-tagging-count"] as? Int32 + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + self.restore = dictionary["x-amz-restore"] as? String + self.contentEncoding = dictionary["Content-Encoding"] as? String + self.contentLength = dictionary["Content-Length"] as? Int64 + self.expiration = dictionary["x-amz-expiration"] as? String + self.websiteRedirectLocation = dictionary["x-amz-website-redirect-location"] as? String + self.eTag = dictionary["ETag"] as? String + self.body = dictionary["Body"] as? Data + self.missingMeta = dictionary["x-amz-missing-meta"] as? Int32 + self.cacheControl = dictionary["Cache-Control"] as? String + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.acceptRanges = dictionary["accept-ranges"] as? String + self.lastModified = dictionary["Last-Modified"] as? String + if let metadata = dictionary["x-amz-meta-"] as? [String: String] { + self.metadata = metadata + } else { + self.metadata = nil + } + self.expires = dictionary["Expires"] as? String + self.contentRange = dictionary["Content-Range"] as? String + self.contentType = dictionary["Content-Type"] as? String + if let storageClass = dictionary["x-amz-storage-class"] as? String { self.storageClass = StorageClass(rawValue: storageClass) } else { self.storageClass = nil } + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + self.deleteMarker = dictionary["x-amz-delete-marker"] as? Bool + } + } + + public enum Event: String, CustomStringConvertible { + case s3_reducedredundancylostobject = "s3:ReducedRedundancyLostObject" + case s3_objectcreated_all = "s3:ObjectCreated:*" + case s3_objectcreated_put = "s3:ObjectCreated:Put" + case s3_objectcreated_post = "s3:ObjectCreated:Post" + case s3_objectcreated_copy = "s3:ObjectCreated:Copy" + case s3_objectcreated_completemultipartupload = "s3:ObjectCreated:CompleteMultipartUpload" + case s3_objectremoved_all = "s3:ObjectRemoved:*" + case s3_objectremoved_delete = "s3:ObjectRemoved:Delete" + case s3_objectremoved_deletemarkercreated = "s3:ObjectRemoved:DeleteMarkerCreated" + public var description: String { return self.rawValue } + } + + public struct NotificationConfigurationDeprecated: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "QueueConfiguration", required: false, type: .structure), + AWSShapeProperty(label: "TopicConfiguration", required: false, type: .structure), + AWSShapeProperty(label: "CloudFunctionConfiguration", required: false, type: .structure) + ] + public let queueConfiguration: QueueConfigurationDeprecated? + public let topicConfiguration: TopicConfigurationDeprecated? + public let cloudFunctionConfiguration: CloudFunctionConfiguration? + + public init(queueConfiguration: QueueConfigurationDeprecated? = nil, topicConfiguration: TopicConfigurationDeprecated? = nil, cloudFunctionConfiguration: CloudFunctionConfiguration? = nil) { + self.queueConfiguration = queueConfiguration + self.topicConfiguration = topicConfiguration + self.cloudFunctionConfiguration = cloudFunctionConfiguration + } + + public init(dictionary: [String: Any]) throws { + if let queueConfiguration = dictionary["QueueConfiguration"] as? [String: Any] { self.queueConfiguration = try S3.QueueConfigurationDeprecated(dictionary: queueConfiguration) } else { self.queueConfiguration = nil } + if let topicConfiguration = dictionary["TopicConfiguration"] as? [String: Any] { self.topicConfiguration = try S3.TopicConfigurationDeprecated(dictionary: topicConfiguration) } else { self.topicConfiguration = nil } + if let cloudFunctionConfiguration = dictionary["CloudFunctionConfiguration"] as? [String: Any] { self.cloudFunctionConfiguration = try S3.CloudFunctionConfiguration(dictionary: cloudFunctionConfiguration) } else { self.cloudFunctionConfiguration = nil } + } + } + + public struct Transition: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "StorageClass", required: false, type: .enum), + AWSShapeProperty(label: "Date", required: false, type: .timestamp), + AWSShapeProperty(label: "Days", required: false, type: .integer) + ] + /// The class of storage used to store the object. + public let storageClass: TransitionStorageClass? + /// Indicates at what date the object is to be moved or deleted. Should be in GMT ISO 8601 Format. + public let date: String? + /// Indicates the lifetime, in days, of the objects that are subject to the rule. The value must be a non-zero positive integer. + public let days: Int32? + + public init(storageClass: TransitionStorageClass? = nil, date: String? = nil, days: Int32? = nil) { + self.storageClass = storageClass + self.date = date + self.days = days + } + + public init(dictionary: [String: Any]) throws { + if let storageClass = dictionary["StorageClass"] as? String { self.storageClass = TransitionStorageClass(rawValue: storageClass) } else { self.storageClass = nil } + self.date = dictionary["Date"] as? String + self.days = dictionary["Days"] as? Int32 + } + } + + public struct MetricsConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Id", required: true, type: .string), + AWSShapeProperty(label: "Filter", required: false, type: .structure) + ] + /// The ID used to identify the metrics configuration. + public let id: String + /// Specifies a metrics configuration filter. The metrics configuration will only include objects that meet the filter's criteria. A filter must be a prefix, a tag, or a conjunction (MetricsAndOperator). + public let filter: MetricsFilter? + + public init(id: String, filter: MetricsFilter? = nil) { + self.id = id + self.filter = filter + } + + public init(dictionary: [String: Any]) throws { + guard let id = dictionary["Id"] as? String else { throw InitializableError.missingRequiredParam("Id") } + self.id = id + if let filter = dictionary["Filter"] as? [String: Any] { self.filter = try S3.MetricsFilter(dictionary: filter) } else { self.filter = nil } + } + } + + public struct Condition: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "HttpErrorCodeReturnedEquals", required: false, type: .string), + AWSShapeProperty(label: "KeyPrefixEquals", required: false, type: .string) + ] + /// The HTTP error code when the redirect is applied. In the event of an error, if the error code equals this value, then the specified redirect is applied. Required when parent element Condition is specified and sibling KeyPrefixEquals is not specified. If both are specified, then both must be true for the redirect to be applied. + public let httpErrorCodeReturnedEquals: String? + /// The object key name prefix when the redirect is applied. For example, to redirect requests for ExamplePage.html, the key prefix will be ExamplePage.html. To redirect request for all pages with the prefix docs/, the key prefix will be /docs, which identifies all objects in the docs/ folder. Required when the parent element Condition is specified and sibling HttpErrorCodeReturnedEquals is not specified. If both conditions are specified, both must be true for the redirect to be applied. + public let keyPrefixEquals: String? + + public init(httpErrorCodeReturnedEquals: String? = nil, keyPrefixEquals: String? = nil) { + self.httpErrorCodeReturnedEquals = httpErrorCodeReturnedEquals + self.keyPrefixEquals = keyPrefixEquals + } + + public init(dictionary: [String: Any]) throws { + self.httpErrorCodeReturnedEquals = dictionary["HttpErrorCodeReturnedEquals"] as? String + self.keyPrefixEquals = dictionary["KeyPrefixEquals"] as? String + } + } + + public struct VersioningConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "MFADelete", location: .body(locationName: "MfaDelete"), required: false, type: .enum), + AWSShapeProperty(label: "Status", required: false, type: .enum) + ] + /// Specifies whether MFA delete is enabled in the bucket versioning configuration. This element is only returned if the bucket has been configured with MFA delete. If the bucket has never been so configured, this element is not returned. + public let mFADelete: MFADelete? + /// The versioning state of the bucket. + public let status: BucketVersioningStatus? + + public init(mFADelete: MFADelete? = nil, status: BucketVersioningStatus? = nil) { + self.mFADelete = mFADelete + self.status = status + } + + public init(dictionary: [String: Any]) throws { + if let mFADelete = dictionary["MfaDelete"] as? String { self.mFADelete = MFADelete(rawValue: mFADelete) } else { self.mFADelete = nil } + if let status = dictionary["Status"] as? String { self.status = BucketVersioningStatus(rawValue: status) } else { self.status = nil } + } + } + + public struct AccelerateConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Status", required: false, type: .enum) + ] + /// The accelerate configuration of the bucket. + public let status: BucketAccelerateStatus? + + public init(status: BucketAccelerateStatus? = nil) { + self.status = status + } + + public init(dictionary: [String: Any]) throws { + if let status = dictionary["Status"] as? String { self.status = BucketAccelerateStatus(rawValue: status) } else { self.status = nil } + } + } + + public struct PutBucketLoggingRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "BucketLoggingStatus" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "BucketLoggingStatus", location: .body(locationName: "BucketLoggingStatus"), required: true, type: .structure) + ] + public let contentMD5: String? + public let bucket: String + public let bucketLoggingStatus: BucketLoggingStatus + + public init(contentMD5: String? = nil, bucket: String, bucketLoggingStatus: BucketLoggingStatus) { + self.contentMD5 = contentMD5 + self.bucket = bucket + self.bucketLoggingStatus = bucketLoggingStatus + } + + public init(dictionary: [String: Any]) throws { + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let bucketLoggingStatus = dictionary["BucketLoggingStatus"] as? [String: Any] else { throw InitializableError.missingRequiredParam("BucketLoggingStatus") } + self.bucketLoggingStatus = try S3.BucketLoggingStatus(dictionary: bucketLoggingStatus) + } + } + + public struct GetBucketPolicyOutput: AWSShape { + /// The key for the payload + public static let payload: String? = "Policy" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Policy", required: false, type: .string) + ] + /// The bucket policy as a JSON document. + public let policy: String? + + public init(policy: String? = nil) { + self.policy = policy + } + + public init(dictionary: [String: Any]) throws { + self.policy = dictionary["Policy"] as? String + } + } + + public struct ReplicationConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Role", required: true, type: .string), + AWSShapeProperty(label: "Rules", location: .body(locationName: "Rule"), required: true, type: .list) + ] + /// Amazon Resource Name (ARN) of an IAM role for Amazon S3 to assume when replicating the objects. + public let role: String + /// Container for information about a particular replication rule. Replication configuration must have at least one rule and can contain up to 1,000 rules. + public let rules: [ReplicationRule] + + public init(role: String, rules: [ReplicationRule]) { + self.role = role + self.rules = rules + } + + public init(dictionary: [String: Any]) throws { + guard let role = dictionary["Role"] as? String else { throw InitializableError.missingRequiredParam("Role") } + self.role = role + guard let rules = dictionary["Rule"] as? [[String: Any]] else { throw InitializableError.missingRequiredParam("Rule") } + self.rules = try rules.map({ try ReplicationRule(dictionary: $0) }) + } + } + + public enum ReplicationStatus: String, CustomStringConvertible { + case complete = "COMPLETE" + case pending = "PENDING" + case failed = "FAILED" + case replica = "REPLICA" + public var description: String { return self.rawValue } + } + + public struct ObjectVersion: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "LastModified", required: false, type: .timestamp), + AWSShapeProperty(label: "Size", required: false, type: .integer), + AWSShapeProperty(label: "VersionId", required: false, type: .string), + AWSShapeProperty(label: "StorageClass", required: false, type: .enum), + AWSShapeProperty(label: "Key", required: false, type: .string), + AWSShapeProperty(label: "IsLatest", required: false, type: .boolean), + AWSShapeProperty(label: "ETag", required: false, type: .string), + AWSShapeProperty(label: "Owner", required: false, type: .structure) + ] + /// Date and time the object was last modified. + public let lastModified: String? + /// Size in bytes of the object. + public let size: Int32? + /// Version ID of an object. + public let versionId: String? + /// The class of storage used to store the object. + public let storageClass: ObjectVersionStorageClass? + /// The object key. + public let key: String? + /// Specifies whether the object is (true) or is not (false) the latest version of an object. + public let isLatest: Bool? + public let eTag: String? + public let owner: Owner? + + public init(lastModified: String? = nil, size: Int32? = nil, versionId: String? = nil, storageClass: ObjectVersionStorageClass? = nil, key: String? = nil, isLatest: Bool? = nil, eTag: String? = nil, owner: Owner? = nil) { + self.lastModified = lastModified + self.size = size + self.versionId = versionId + self.storageClass = storageClass + self.key = key + self.isLatest = isLatest + self.eTag = eTag + self.owner = owner + } + + public init(dictionary: [String: Any]) throws { + self.lastModified = dictionary["LastModified"] as? String + self.size = dictionary["Size"] as? Int32 + self.versionId = dictionary["VersionId"] as? String + if let storageClass = dictionary["StorageClass"] as? String { self.storageClass = ObjectVersionStorageClass(rawValue: storageClass) } else { self.storageClass = nil } + self.key = dictionary["Key"] as? String + self.isLatest = dictionary["IsLatest"] as? Bool + self.eTag = dictionary["ETag"] as? String + if let owner = dictionary["Owner"] as? [String: Any] { self.owner = try S3.Owner(dictionary: owner) } else { self.owner = nil } + } + } + + public struct GetBucketReplicationOutput: AWSShape { + /// The key for the payload + public static let payload: String? = "ReplicationConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ReplicationConfiguration", required: false, type: .structure) + ] + public let replicationConfiguration: ReplicationConfiguration? + + public init(replicationConfiguration: ReplicationConfiguration? = nil) { + self.replicationConfiguration = replicationConfiguration + } + + public init(dictionary: [String: Any]) throws { + if let replicationConfiguration = dictionary["ReplicationConfiguration"] as? [String: Any] { self.replicationConfiguration = try S3.ReplicationConfiguration(dictionary: replicationConfiguration) } else { self.replicationConfiguration = nil } + } + } + + public struct PutBucketInventoryConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "InventoryConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "InventoryConfiguration", location: .body(locationName: "InventoryConfiguration"), required: true, type: .structure), + AWSShapeProperty(label: "Id", location: .querystring(locationName: "id"), required: true, type: .string) + ] + /// The name of the bucket where the inventory configuration will be stored. + public let bucket: String + /// Specifies the inventory configuration. + public let inventoryConfiguration: InventoryConfiguration + /// The ID used to identify the inventory configuration. + public let id: String + + public init(bucket: String, inventoryConfiguration: InventoryConfiguration, id: String) { + self.bucket = bucket + self.inventoryConfiguration = inventoryConfiguration + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let inventoryConfiguration = dictionary["InventoryConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("InventoryConfiguration") } + self.inventoryConfiguration = try S3.InventoryConfiguration(dictionary: inventoryConfiguration) + guard let id = dictionary["id"] as? String else { throw InitializableError.missingRequiredParam("id") } + self.id = id + } + } + + public enum ReplicationRuleStatus: String, CustomStringConvertible { + case enabled = "Enabled" + case disabled = "Disabled" + public var description: String { return self.rawValue } + } + + public struct ListObjectsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "MaxKeys", required: false, type: .integer), + AWSShapeProperty(label: "IsTruncated", required: false, type: .boolean), + AWSShapeProperty(label: "Marker", required: false, type: .string), + AWSShapeProperty(label: "Name", required: false, type: .string), + AWSShapeProperty(label: "Prefix", required: false, type: .string), + AWSShapeProperty(label: "CommonPrefixes", required: false, type: .list), + AWSShapeProperty(label: "Contents", required: false, type: .list), + AWSShapeProperty(label: "Delimiter", required: false, type: .string), + AWSShapeProperty(label: "EncodingType", required: false, type: .enum), + AWSShapeProperty(label: "NextMarker", required: false, type: .string) + ] + public let maxKeys: Int32? + /// A flag that indicates whether or not Amazon S3 returned all of the results that satisfied the search criteria. + public let isTruncated: Bool? + public let marker: String? + public let name: String? + public let prefix: String? + public let commonPrefixes: [CommonPrefix]? + public let contents: [Object]? + public let delimiter: String? + /// Encoding type used by Amazon S3 to encode object keys in the response. + public let encodingType: EncodingType? + /// When response is truncated (the IsTruncated element value in the response is true), you can use the key name in this field as marker in the subsequent request to get next set of objects. Amazon S3 lists objects in alphabetical order Note: This element is returned only if you have delimiter request parameter specified. If response does not include the NextMaker and it is truncated, you can use the value of the last Key in the response as the marker in the subsequent request to get the next set of object keys. + public let nextMarker: String? + + public init(maxKeys: Int32? = nil, isTruncated: Bool? = nil, marker: String? = nil, name: String? = nil, prefix: String? = nil, commonPrefixes: [CommonPrefix]? = nil, contents: [Object]? = nil, delimiter: String? = nil, encodingType: EncodingType? = nil, nextMarker: String? = nil) { + self.maxKeys = maxKeys + self.isTruncated = isTruncated + self.marker = marker + self.name = name + self.prefix = prefix + self.commonPrefixes = commonPrefixes + self.contents = contents + self.delimiter = delimiter + self.encodingType = encodingType + self.nextMarker = nextMarker + } + + public init(dictionary: [String: Any]) throws { + self.maxKeys = dictionary["MaxKeys"] as? Int32 + self.isTruncated = dictionary["IsTruncated"] as? Bool + self.marker = dictionary["Marker"] as? String + self.name = dictionary["Name"] as? String + self.prefix = dictionary["Prefix"] as? String + if let commonPrefixes = dictionary["CommonPrefixes"] as? [[String: Any]] { + self.commonPrefixes = try commonPrefixes.map({ try CommonPrefix(dictionary: $0) }) + } else { + self.commonPrefixes = nil + } + if let contents = dictionary["Contents"] as? [[String: Any]] { + self.contents = try contents.map({ try Object(dictionary: $0) }) + } else { + self.contents = nil + } + self.delimiter = dictionary["Delimiter"] as? String + if let encodingType = dictionary["EncodingType"] as? String { self.encodingType = EncodingType(rawValue: encodingType) } else { self.encodingType = nil } + self.nextMarker = dictionary["NextMarker"] as? String + } + } + + public struct CompleteMultipartUploadOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", required: false, type: .string), + AWSShapeProperty(label: "Location", required: false, type: .string), + AWSShapeProperty(label: "Expiration", location: .header(locationName: "x-amz-expiration"), required: false, type: .string), + AWSShapeProperty(label: "VersionId", location: .header(locationName: "x-amz-version-id"), required: false, type: .string), + AWSShapeProperty(label: "Key", required: false, type: .string), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "ETag", required: false, type: .string), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum) + ] + public let bucket: String? + public let location: String? + /// If the object expiration is configured, this will contain the expiration date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded. + public let expiration: String? + /// Version of the object. + public let versionId: String? + public let key: String? + /// If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object. + public let sSEKMSKeyId: String? + /// Entity tag of the object. + public let eTag: String? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + public let requestCharged: RequestCharged? + + public init(bucket: String? = nil, location: String? = nil, expiration: String? = nil, versionId: String? = nil, key: String? = nil, sSEKMSKeyId: String? = nil, eTag: String? = nil, serverSideEncryption: ServerSideEncryption? = nil, requestCharged: RequestCharged? = nil) { + self.bucket = bucket + self.location = location + self.expiration = expiration + self.versionId = versionId + self.key = key + self.sSEKMSKeyId = sSEKMSKeyId + self.eTag = eTag + self.serverSideEncryption = serverSideEncryption + self.requestCharged = requestCharged + } + + public init(dictionary: [String: Any]) throws { + self.bucket = dictionary["Bucket"] as? String + self.location = dictionary["Location"] as? String + self.expiration = dictionary["x-amz-expiration"] as? String + self.versionId = dictionary["x-amz-version-id"] as? String + self.key = dictionary["Key"] as? String + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.eTag = dictionary["ETag"] as? String + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + } + } + + public struct NotificationConfigurationFilter: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Key", location: .body(locationName: "S3Key"), required: false, type: .structure) + ] + public let key: S3KeyFilter? + + public init(key: S3KeyFilter? = nil) { + self.key = key + } + + public init(dictionary: [String: Any]) throws { + if let key = dictionary["S3Key"] as? [String: Any] { self.key = try S3.S3KeyFilter(dictionary: key) } else { self.key = nil } + } + } + + public struct PutObjectAclRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "AccessControlPolicy" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "AccessControlPolicy", location: .body(locationName: "AccessControlPolicy"), required: false, type: .structure), + AWSShapeProperty(label: "GrantWriteACP", location: .header(locationName: "x-amz-grant-write-acp"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "GrantFullControl", location: .header(locationName: "x-amz-grant-full-control"), required: false, type: .string), + AWSShapeProperty(label: "VersionId", location: .querystring(locationName: "versionId"), required: false, type: .string), + AWSShapeProperty(label: "GrantWrite", location: .header(locationName: "x-amz-grant-write"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "GrantReadACP", location: .header(locationName: "x-amz-grant-read-acp"), required: false, type: .string), + AWSShapeProperty(label: "GrantRead", location: .header(locationName: "x-amz-grant-read"), required: false, type: .string), + AWSShapeProperty(label: "ACL", location: .header(locationName: "x-amz-acl"), required: false, type: .enum) + ] + public let bucket: String + public let contentMD5: String? + public let accessControlPolicy: AccessControlPolicy? + /// Allows grantee to write the ACL for the applicable bucket. + public let grantWriteACP: String? + public let requestPayer: RequestPayer? + /// Allows grantee the read, write, read ACP, and write ACP permissions on the bucket. + public let grantFullControl: String? + /// VersionId used to reference a specific version of the object. + public let versionId: String? + /// Allows grantee to create, overwrite, and delete any object in the bucket. + public let grantWrite: String? + public let key: String + /// Allows grantee to read the bucket ACL. + public let grantReadACP: String? + /// Allows grantee to list the objects in the bucket. + public let grantRead: String? + /// The canned ACL to apply to the object. + public let aCL: ObjectCannedACL? + + public init(bucket: String, contentMD5: String? = nil, accessControlPolicy: AccessControlPolicy? = nil, grantWriteACP: String? = nil, requestPayer: RequestPayer? = nil, grantFullControl: String? = nil, versionId: String? = nil, grantWrite: String? = nil, key: String, grantReadACP: String? = nil, grantRead: String? = nil, aCL: ObjectCannedACL? = nil) { + self.bucket = bucket + self.contentMD5 = contentMD5 + self.accessControlPolicy = accessControlPolicy + self.grantWriteACP = grantWriteACP + self.requestPayer = requestPayer + self.grantFullControl = grantFullControl + self.versionId = versionId + self.grantWrite = grantWrite + self.key = key + self.grantReadACP = grantReadACP + self.grantRead = grantRead + self.aCL = aCL + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.contentMD5 = dictionary["Content-MD5"] as? String + if let accessControlPolicy = dictionary["AccessControlPolicy"] as? [String: Any] { self.accessControlPolicy = try S3.AccessControlPolicy(dictionary: accessControlPolicy) } else { self.accessControlPolicy = nil } + self.grantWriteACP = dictionary["x-amz-grant-write-acp"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.grantFullControl = dictionary["x-amz-grant-full-control"] as? String + self.versionId = dictionary["versionId"] as? String + self.grantWrite = dictionary["x-amz-grant-write"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.grantReadACP = dictionary["x-amz-grant-read-acp"] as? String + self.grantRead = dictionary["x-amz-grant-read"] as? String + if let aCL = dictionary["x-amz-acl"] as? String { self.aCL = ObjectCannedACL(rawValue: aCL) } else { self.aCL = nil } + } + } + + public enum AnalyticsS3ExportFileFormat: String, CustomStringConvertible { + case csv = "CSV" + public var description: String { return self.rawValue } + } + + public struct TopicConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "TopicArn", location: .body(locationName: "Topic"), required: true, type: .string), + AWSShapeProperty(label: "Filter", required: false, type: .structure), + AWSShapeProperty(label: "Events", location: .body(locationName: "Event"), required: true, type: .list), + AWSShapeProperty(label: "Id", required: false, type: .string) + ] + /// Amazon SNS topic ARN to which Amazon S3 will publish a message when it detects events of specified type. + public let topicArn: String + public let filter: NotificationConfigurationFilter? + public let events: [Event] + public let id: String? + + public init(topicArn: String, filter: NotificationConfigurationFilter? = nil, events: [Event], id: String? = nil) { + self.topicArn = topicArn + self.filter = filter + self.events = events + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let topicArn = dictionary["Topic"] as? String else { throw InitializableError.missingRequiredParam("Topic") } + self.topicArn = topicArn + if let filter = dictionary["Filter"] as? [String: Any] { self.filter = try S3.NotificationConfigurationFilter(dictionary: filter) } else { self.filter = nil } + guard let events = dictionary["Event"] as? [String] else { throw InitializableError.missingRequiredParam("Event") } + self.events = events.flatMap({ Event(rawValue: $0)}) + self.id = dictionary["Id"] as? String + } + } + + public struct RoutingRule: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Redirect", required: true, type: .structure), + AWSShapeProperty(label: "Condition", required: false, type: .structure) + ] + /// Container for redirect information. You can redirect requests to another host, to another page, or with another protocol. In the event of an error, you can can specify a different error code to return. + public let redirect: Redirect + /// A container for describing a condition that must be met for the specified redirect to apply. For example, 1. If request is for pages in the /docs folder, redirect to the /documents folder. 2. If request results in HTTP error 4xx, redirect request to another host where you might process the error. + public let condition: Condition? + + public init(redirect: Redirect, condition: Condition? = nil) { + self.redirect = redirect + self.condition = condition + } + + public init(dictionary: [String: Any]) throws { + guard let redirect = dictionary["Redirect"] as? [String: Any] else { throw InitializableError.missingRequiredParam("Redirect") } + self.redirect = try S3.Redirect(dictionary: redirect) + if let condition = dictionary["Condition"] as? [String: Any] { self.condition = try S3.Condition(dictionary: condition) } else { self.condition = nil } + } + } + + public enum EncodingType: String, CustomStringConvertible { + case url = "url" + public var description: String { return self.rawValue } + } + + public struct LifecycleRuleFilter: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Tag", required: false, type: .structure), + AWSShapeProperty(label: "And", required: false, type: .structure), + AWSShapeProperty(label: "Prefix", required: false, type: .string) + ] + /// This tag must exist in the object's tag set in order for the rule to apply. + public let tag: Tag? + public let and: LifecycleRuleAndOperator? + /// Prefix identifying one or more objects to which the rule applies. + public let prefix: String? + + public init(tag: Tag? = nil, and: LifecycleRuleAndOperator? = nil, prefix: String? = nil) { + self.tag = tag + self.and = and + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + if let tag = dictionary["Tag"] as? [String: Any] { self.tag = try S3.Tag(dictionary: tag) } else { self.tag = nil } + if let and = dictionary["And"] as? [String: Any] { self.and = try S3.LifecycleRuleAndOperator(dictionary: and) } else { self.and = nil } + self.prefix = dictionary["Prefix"] as? String + } + } + + public struct IndexDocument: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Suffix", required: true, type: .string) + ] + /// A suffix that is appended to a request that is for a directory on the website endpoint (e.g. if the suffix is index.html and you make a request to samplebucket/images/ the data that is returned will be for the object with the key name images/index.html) The suffix must not be empty and must not include a slash character. + public let suffix: String + + public init(suffix: String) { + self.suffix = suffix + } + + public init(dictionary: [String: Any]) throws { + guard let suffix = dictionary["Suffix"] as? String else { throw InitializableError.missingRequiredParam("Suffix") } + self.suffix = suffix + } + } + + public struct HeadObjectOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "PartsCount", location: .header(locationName: "x-amz-mp-parts-count"), required: false, type: .integer), + AWSShapeProperty(label: "ContentDisposition", location: .header(locationName: "Content-Disposition"), required: false, type: .string), + AWSShapeProperty(label: "VersionId", location: .header(locationName: "x-amz-version-id"), required: false, type: .string), + AWSShapeProperty(label: "ReplicationStatus", location: .header(locationName: "x-amz-replication-status"), required: false, type: .enum), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "ContentLanguage", location: .header(locationName: "Content-Language"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "Restore", location: .header(locationName: "x-amz-restore"), required: false, type: .string), + AWSShapeProperty(label: "ContentEncoding", location: .header(locationName: "Content-Encoding"), required: false, type: .string), + AWSShapeProperty(label: "ContentLength", location: .header(locationName: "Content-Length"), required: false, type: .long), + AWSShapeProperty(label: "Expiration", location: .header(locationName: "x-amz-expiration"), required: false, type: .string), + AWSShapeProperty(label: "WebsiteRedirectLocation", location: .header(locationName: "x-amz-website-redirect-location"), required: false, type: .string), + AWSShapeProperty(label: "ETag", location: .header(locationName: "ETag"), required: false, type: .string), + AWSShapeProperty(label: "MissingMeta", location: .header(locationName: "x-amz-missing-meta"), required: false, type: .integer), + AWSShapeProperty(label: "CacheControl", location: .header(locationName: "Cache-Control"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "AcceptRanges", location: .header(locationName: "accept-ranges"), required: false, type: .string), + AWSShapeProperty(label: "LastModified", location: .header(locationName: "Last-Modified"), required: false, type: .timestamp), + AWSShapeProperty(label: "Metadata", required: false, type: .map), + AWSShapeProperty(label: "Expires", location: .header(locationName: "Expires"), required: false, type: .timestamp), + AWSShapeProperty(label: "ContentType", location: .header(locationName: "Content-Type"), required: false, type: .string), + AWSShapeProperty(label: "StorageClass", location: .header(locationName: "x-amz-storage-class"), required: false, type: .enum), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum), + AWSShapeProperty(label: "DeleteMarker", location: .header(locationName: "x-amz-delete-marker"), required: false, type: .boolean) + ] + /// The count of parts this object has. + public let partsCount: Int32? + /// Specifies presentational information for the object. + public let contentDisposition: String? + /// Version of the object. + public let versionId: String? + public let replicationStatus: ReplicationStatus? + /// If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object. + public let sSEKMSKeyId: String? + /// The language the content is in. + public let contentLanguage: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used. + public let sSECustomerAlgorithm: String? + /// Provides information about object restoration operation and expiration time of the restored object copy. + public let restore: String? + /// Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. + public let contentEncoding: String? + /// Size of the body in bytes. + public let contentLength: Int64? + /// If the object expiration is configured (see PUT Bucket lifecycle), the response includes this header. It includes the expiry-date and rule-id key value pairs providing object expiration information. The value of the rule-id is URL encoded. + public let expiration: String? + /// If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. + public let websiteRedirectLocation: String? + /// An ETag is an opaque identifier assigned by a web server to a specific version of a resource found at a URL + public let eTag: String? + /// This is set to the number of metadata entries not returned in x-amz-meta headers. This can happen if you create metadata using an API like SOAP that supports more flexible metadata than the REST API. For example, using SOAP, you can create metadata whose values are not legal HTTP headers. + public let missingMeta: Int32? + /// Specifies caching behavior along the request/reply chain. + public let cacheControl: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key. + public let sSECustomerKeyMD5: String? + public let acceptRanges: String? + /// Last modified date of the object + public let lastModified: String? + /// A map of metadata to store with the object in S3. + public let metadata: [String: String]? + /// The date and time at which the object is no longer cacheable. + public let expires: String? + /// A standard MIME type describing the format of the object data. + public let contentType: String? + public let storageClass: StorageClass? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + public let requestCharged: RequestCharged? + /// Specifies whether the object retrieved was (true) or was not (false) a Delete Marker. If false, this response header does not appear in the response. + public let deleteMarker: Bool? + + public init(partsCount: Int32? = nil, contentDisposition: String? = nil, versionId: String? = nil, replicationStatus: ReplicationStatus? = nil, sSEKMSKeyId: String? = nil, contentLanguage: String? = nil, sSECustomerAlgorithm: String? = nil, restore: String? = nil, contentEncoding: String? = nil, contentLength: Int64? = nil, expiration: String? = nil, websiteRedirectLocation: String? = nil, eTag: String? = nil, missingMeta: Int32? = nil, cacheControl: String? = nil, sSECustomerKeyMD5: String? = nil, acceptRanges: String? = nil, lastModified: String? = nil, metadata: [String: String]? = nil, expires: String? = nil, contentType: String? = nil, storageClass: StorageClass? = nil, serverSideEncryption: ServerSideEncryption? = nil, requestCharged: RequestCharged? = nil, deleteMarker: Bool? = nil) { + self.partsCount = partsCount + self.contentDisposition = contentDisposition + self.versionId = versionId + self.replicationStatus = replicationStatus + self.sSEKMSKeyId = sSEKMSKeyId + self.contentLanguage = contentLanguage + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.restore = restore + self.contentEncoding = contentEncoding + self.contentLength = contentLength + self.expiration = expiration + self.websiteRedirectLocation = websiteRedirectLocation + self.eTag = eTag + self.missingMeta = missingMeta + self.cacheControl = cacheControl + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.acceptRanges = acceptRanges + self.lastModified = lastModified + self.metadata = metadata + self.expires = expires + self.contentType = contentType + self.storageClass = storageClass + self.serverSideEncryption = serverSideEncryption + self.requestCharged = requestCharged + self.deleteMarker = deleteMarker + } + + public init(dictionary: [String: Any]) throws { + self.partsCount = dictionary["x-amz-mp-parts-count"] as? Int32 + self.contentDisposition = dictionary["Content-Disposition"] as? String + self.versionId = dictionary["x-amz-version-id"] as? String + if let replicationStatus = dictionary["x-amz-replication-status"] as? String { self.replicationStatus = ReplicationStatus(rawValue: replicationStatus) } else { self.replicationStatus = nil } + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.contentLanguage = dictionary["Content-Language"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + self.restore = dictionary["x-amz-restore"] as? String + self.contentEncoding = dictionary["Content-Encoding"] as? String + self.contentLength = dictionary["Content-Length"] as? Int64 + self.expiration = dictionary["x-amz-expiration"] as? String + self.websiteRedirectLocation = dictionary["x-amz-website-redirect-location"] as? String + self.eTag = dictionary["ETag"] as? String + self.missingMeta = dictionary["x-amz-missing-meta"] as? Int32 + self.cacheControl = dictionary["Cache-Control"] as? String + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.acceptRanges = dictionary["accept-ranges"] as? String + self.lastModified = dictionary["Last-Modified"] as? String + if let metadata = dictionary["x-amz-meta-"] as? [String: String] { + self.metadata = metadata + } else { + self.metadata = nil + } + self.expires = dictionary["Expires"] as? String + self.contentType = dictionary["Content-Type"] as? String + if let storageClass = dictionary["x-amz-storage-class"] as? String { self.storageClass = StorageClass(rawValue: storageClass) } else { self.storageClass = nil } + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + self.deleteMarker = dictionary["x-amz-delete-marker"] as? Bool + } + } + + public struct CompletedPart: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ETag", required: false, type: .string), + AWSShapeProperty(label: "PartNumber", required: false, type: .integer) + ] + /// Entity tag returned when the part was uploaded. + public let eTag: String? + /// Part number that identifies the part. This is a positive integer between 1 and 10,000. + public let partNumber: Int32? + + public init(eTag: String? = nil, partNumber: Int32? = nil) { + self.eTag = eTag + self.partNumber = partNumber + } + + public init(dictionary: [String: Any]) throws { + self.eTag = dictionary["ETag"] as? String + self.partNumber = dictionary["PartNumber"] as? Int32 + } + } + + public struct GetBucketTaggingRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct ListObjectsV2Output: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "MaxKeys", required: false, type: .integer), + AWSShapeProperty(label: "StartAfter", required: false, type: .string), + AWSShapeProperty(label: "IsTruncated", required: false, type: .boolean), + AWSShapeProperty(label: "ContinuationToken", required: false, type: .string), + AWSShapeProperty(label: "Name", required: false, type: .string), + AWSShapeProperty(label: "Prefix", required: false, type: .string), + AWSShapeProperty(label: "NextContinuationToken", required: false, type: .string), + AWSShapeProperty(label: "CommonPrefixes", required: false, type: .list), + AWSShapeProperty(label: "Contents", required: false, type: .list), + AWSShapeProperty(label: "Delimiter", required: false, type: .string), + AWSShapeProperty(label: "EncodingType", required: false, type: .enum), + AWSShapeProperty(label: "KeyCount", required: false, type: .integer) + ] + /// Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more. + public let maxKeys: Int32? + /// StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this specified key. StartAfter can be any key in the bucket + public let startAfter: String? + /// A flag that indicates whether or not Amazon S3 returned all of the results that satisfied the search criteria. + public let isTruncated: Bool? + /// ContinuationToken indicates Amazon S3 that the list is being continued on this bucket with a token. ContinuationToken is obfuscated and is not a real key + public let continuationToken: String? + /// Name of the bucket to list. + public let name: String? + /// Limits the response to keys that begin with the specified prefix. + public let prefix: String? + /// NextContinuationToken is sent when isTruncated is true which means there are more keys in the bucket that can be listed. The next list requests to Amazon S3 can be continued with this NextContinuationToken. NextContinuationToken is obfuscated and is not a real key + public let nextContinuationToken: String? + /// CommonPrefixes contains all (if there are any) keys between Prefix and the next occurrence of the string specified by delimiter + public let commonPrefixes: [CommonPrefix]? + /// Metadata about each object returned. + public let contents: [Object]? + /// A delimiter is a character you use to group keys. + public let delimiter: String? + /// Encoding type used by Amazon S3 to encode object keys in the response. + public let encodingType: EncodingType? + /// KeyCount is the number of keys returned with this request. KeyCount will always be less than equals to MaxKeys field. Say you ask for 50 keys, your result will include less than equals 50 keys + public let keyCount: Int32? + + public init(maxKeys: Int32? = nil, startAfter: String? = nil, isTruncated: Bool? = nil, continuationToken: String? = nil, name: String? = nil, prefix: String? = nil, nextContinuationToken: String? = nil, commonPrefixes: [CommonPrefix]? = nil, contents: [Object]? = nil, delimiter: String? = nil, encodingType: EncodingType? = nil, keyCount: Int32? = nil) { + self.maxKeys = maxKeys + self.startAfter = startAfter + self.isTruncated = isTruncated + self.continuationToken = continuationToken + self.name = name + self.prefix = prefix + self.nextContinuationToken = nextContinuationToken + self.commonPrefixes = commonPrefixes + self.contents = contents + self.delimiter = delimiter + self.encodingType = encodingType + self.keyCount = keyCount + } + + public init(dictionary: [String: Any]) throws { + self.maxKeys = dictionary["MaxKeys"] as? Int32 + self.startAfter = dictionary["StartAfter"] as? String + self.isTruncated = dictionary["IsTruncated"] as? Bool + self.continuationToken = dictionary["ContinuationToken"] as? String + self.name = dictionary["Name"] as? String + self.prefix = dictionary["Prefix"] as? String + self.nextContinuationToken = dictionary["NextContinuationToken"] as? String + if let commonPrefixes = dictionary["CommonPrefixes"] as? [[String: Any]] { + self.commonPrefixes = try commonPrefixes.map({ try CommonPrefix(dictionary: $0) }) + } else { + self.commonPrefixes = nil + } + if let contents = dictionary["Contents"] as? [[String: Any]] { + self.contents = try contents.map({ try Object(dictionary: $0) }) + } else { + self.contents = nil + } + self.delimiter = dictionary["Delimiter"] as? String + if let encodingType = dictionary["EncodingType"] as? String { self.encodingType = EncodingType(rawValue: encodingType) } else { self.encodingType = nil } + self.keyCount = dictionary["KeyCount"] as? Int32 + } + } + + public struct TargetGrant: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Permission", required: false, type: .enum), + AWSShapeProperty(label: "Grantee", required: false, type: .structure) + ] + /// Logging permissions assigned to the Grantee for the bucket. + public let permission: BucketLogsPermission? + public let grantee: Grantee? + + public init(permission: BucketLogsPermission? = nil, grantee: Grantee? = nil) { + self.permission = permission + self.grantee = grantee + } + + public init(dictionary: [String: Any]) throws { + if let permission = dictionary["Permission"] as? String { self.permission = BucketLogsPermission(rawValue: permission) } else { self.permission = nil } + if let grantee = dictionary["Grantee"] as? [String: Any] { self.grantee = try S3.Grantee(dictionary: grantee) } else { self.grantee = nil } + } + } + + public struct BucketLoggingStatus: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "LoggingEnabled", required: false, type: .structure) + ] + public let loggingEnabled: LoggingEnabled? + + public init(loggingEnabled: LoggingEnabled? = nil) { + self.loggingEnabled = loggingEnabled + } + + public init(dictionary: [String: Any]) throws { + if let loggingEnabled = dictionary["LoggingEnabled"] as? [String: Any] { self.loggingEnabled = try S3.LoggingEnabled(dictionary: loggingEnabled) } else { self.loggingEnabled = nil } + } + } + + public struct AnalyticsS3BucketDestination: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", required: true, type: .string), + AWSShapeProperty(label: "Format", required: true, type: .enum), + AWSShapeProperty(label: "BucketAccountId", required: false, type: .string), + AWSShapeProperty(label: "Prefix", required: false, type: .string) + ] + /// The Amazon resource name (ARN) of the bucket to which data is exported. + public let bucket: String + /// The file format used when exporting data to Amazon S3. + public let format: AnalyticsS3ExportFileFormat + /// The account ID that owns the destination bucket. If no account ID is provided, the owner will not be validated prior to exporting data. + public let bucketAccountId: String? + /// The prefix to use when exporting data. The exported data begins with this prefix. + public let prefix: String? + + public init(bucket: String, format: AnalyticsS3ExportFileFormat, bucketAccountId: String? = nil, prefix: String? = nil) { + self.bucket = bucket + self.format = format + self.bucketAccountId = bucketAccountId + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let rawFormat = dictionary["Format"] as? String, let format = AnalyticsS3ExportFileFormat(rawValue: rawFormat) else { throw InitializableError.missingRequiredParam("Format") } + self.format = format + self.bucketAccountId = dictionary["BucketAccountId"] as? String + self.prefix = dictionary["Prefix"] as? String + } + } + + public enum InventoryFrequency: String, CustomStringConvertible { + case daily = "Daily" + case weekly = "Weekly" + public var description: String { return self.rawValue } + } + + public struct PutBucketLifecycleRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "LifecycleConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "LifecycleConfiguration", location: .body(locationName: "LifecycleConfiguration"), required: false, type: .structure) + ] + public let contentMD5: String? + public let bucket: String + public let lifecycleConfiguration: LifecycleConfiguration? + + public init(contentMD5: String? = nil, bucket: String, lifecycleConfiguration: LifecycleConfiguration? = nil) { + self.contentMD5 = contentMD5 + self.bucket = bucket + self.lifecycleConfiguration = lifecycleConfiguration + } + + public init(dictionary: [String: Any]) throws { + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + if let lifecycleConfiguration = dictionary["LifecycleConfiguration"] as? [String: Any] { self.lifecycleConfiguration = try S3.LifecycleConfiguration(dictionary: lifecycleConfiguration) } else { self.lifecycleConfiguration = nil } + } + } + + public struct WebsiteConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "RoutingRules", required: false, type: .structure), + AWSShapeProperty(label: "IndexDocument", required: false, type: .structure), + AWSShapeProperty(label: "ErrorDocument", required: false, type: .structure), + AWSShapeProperty(label: "RedirectAllRequestsTo", required: false, type: .structure) + ] + public let routingRules: RoutingRules? + public let indexDocument: IndexDocument? + public let errorDocument: ErrorDocument? + public let redirectAllRequestsTo: RedirectAllRequestsTo? + + public init(routingRules: RoutingRules? = nil, indexDocument: IndexDocument? = nil, errorDocument: ErrorDocument? = nil, redirectAllRequestsTo: RedirectAllRequestsTo? = nil) { + self.routingRules = routingRules + self.indexDocument = indexDocument + self.errorDocument = errorDocument + self.redirectAllRequestsTo = redirectAllRequestsTo + } + + public init(dictionary: [String: Any]) throws { + if let routingRules = dictionary["RoutingRules"] as? [String: Any] { self.routingRules = try S3.RoutingRules(dictionary: routingRules) } else { self.routingRules = nil } + if let indexDocument = dictionary["IndexDocument"] as? [String: Any] { self.indexDocument = try S3.IndexDocument(dictionary: indexDocument) } else { self.indexDocument = nil } + if let errorDocument = dictionary["ErrorDocument"] as? [String: Any] { self.errorDocument = try S3.ErrorDocument(dictionary: errorDocument) } else { self.errorDocument = nil } + if let redirectAllRequestsTo = dictionary["RedirectAllRequestsTo"] as? [String: Any] { self.redirectAllRequestsTo = try S3.RedirectAllRequestsTo(dictionary: redirectAllRequestsTo) } else { self.redirectAllRequestsTo = nil } + } + } + + public struct NotificationConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "TopicConfigurations", location: .body(locationName: "TopicConfiguration"), required: false, type: .list), + AWSShapeProperty(label: "QueueConfigurations", location: .body(locationName: "QueueConfiguration"), required: false, type: .list), + AWSShapeProperty(label: "LambdaFunctionConfigurations", location: .body(locationName: "CloudFunctionConfiguration"), required: false, type: .list) + ] + public let topicConfigurations: [TopicConfiguration]? + public let queueConfigurations: [QueueConfiguration]? + public let lambdaFunctionConfigurations: [LambdaFunctionConfiguration]? + + public init(topicConfigurations: [TopicConfiguration]? = nil, queueConfigurations: [QueueConfiguration]? = nil, lambdaFunctionConfigurations: [LambdaFunctionConfiguration]? = nil) { + self.topicConfigurations = topicConfigurations + self.queueConfigurations = queueConfigurations + self.lambdaFunctionConfigurations = lambdaFunctionConfigurations + } + + public init(dictionary: [String: Any]) throws { + if let topicConfigurations = dictionary["TopicConfiguration"] as? [[String: Any]] { + self.topicConfigurations = try topicConfigurations.map({ try TopicConfiguration(dictionary: $0) }) + } else { + self.topicConfigurations = nil + } + if let queueConfigurations = dictionary["QueueConfiguration"] as? [[String: Any]] { + self.queueConfigurations = try queueConfigurations.map({ try QueueConfiguration(dictionary: $0) }) + } else { + self.queueConfigurations = nil + } + if let lambdaFunctionConfigurations = dictionary["CloudFunctionConfiguration"] as? [[String: Any]] { + self.lambdaFunctionConfigurations = try lambdaFunctionConfigurations.map({ try LambdaFunctionConfiguration(dictionary: $0) }) + } else { + self.lambdaFunctionConfigurations = nil + } + } + } + + public struct AnalyticsFilter: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Tag", required: false, type: .structure), + AWSShapeProperty(label: "And", required: false, type: .structure), + AWSShapeProperty(label: "Prefix", required: false, type: .string) + ] + /// The tag to use when evaluating an analytics filter. + public let tag: Tag? + /// A conjunction (logical AND) of predicates, which is used in evaluating an analytics filter. The operator must have at least two predicates. + public let and: AnalyticsAndOperator? + /// The prefix to use when evaluating an analytics filter. + public let prefix: String? + + public init(tag: Tag? = nil, and: AnalyticsAndOperator? = nil, prefix: String? = nil) { + self.tag = tag + self.and = and + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + if let tag = dictionary["Tag"] as? [String: Any] { self.tag = try S3.Tag(dictionary: tag) } else { self.tag = nil } + if let and = dictionary["And"] as? [String: Any] { self.and = try S3.AnalyticsAndOperator(dictionary: and) } else { self.and = nil } + self.prefix = dictionary["Prefix"] as? String + } + } + + public struct GetBucketAclRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct GetObjectTaggingRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "VersionId", location: .querystring(locationName: "versionId"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string) + ] + public let bucket: String + public let versionId: String? + public let key: String + + public init(bucket: String, versionId: String? = nil, key: String) { + self.bucket = bucket + self.versionId = versionId + self.key = key + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.versionId = dictionary["versionId"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + } + } + + public struct PutBucketLifecycleConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "LifecycleConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "LifecycleConfiguration", location: .body(locationName: "LifecycleConfiguration"), required: false, type: .structure) + ] + public let bucket: String + public let lifecycleConfiguration: BucketLifecycleConfiguration? + + public init(bucket: String, lifecycleConfiguration: BucketLifecycleConfiguration? = nil) { + self.bucket = bucket + self.lifecycleConfiguration = lifecycleConfiguration + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + if let lifecycleConfiguration = dictionary["LifecycleConfiguration"] as? [String: Any] { self.lifecycleConfiguration = try S3.BucketLifecycleConfiguration(dictionary: lifecycleConfiguration) } else { self.lifecycleConfiguration = nil } + } + } + + public struct ListObjectVersionsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "MaxKeys", required: false, type: .integer), + AWSShapeProperty(label: "IsTruncated", required: false, type: .boolean), + AWSShapeProperty(label: "VersionIdMarker", required: false, type: .string), + AWSShapeProperty(label: "NextVersionIdMarker", required: false, type: .string), + AWSShapeProperty(label: "CommonPrefixes", required: false, type: .list), + AWSShapeProperty(label: "Delimiter", required: false, type: .string), + AWSShapeProperty(label: "KeyMarker", required: false, type: .string), + AWSShapeProperty(label: "EncodingType", required: false, type: .enum), + AWSShapeProperty(label: "Name", required: false, type: .string), + AWSShapeProperty(label: "Prefix", required: false, type: .string), + AWSShapeProperty(label: "DeleteMarkers", location: .body(locationName: "DeleteMarker"), required: false, type: .list), + AWSShapeProperty(label: "NextKeyMarker", required: false, type: .string), + AWSShapeProperty(label: "Versions", location: .body(locationName: "Version"), required: false, type: .list) + ] + public let maxKeys: Int32? + /// A flag that indicates whether or not Amazon S3 returned all of the results that satisfied the search criteria. If your results were truncated, you can make a follow-up paginated request using the NextKeyMarker and NextVersionIdMarker response parameters as a starting place in another request to return the rest of the results. + public let isTruncated: Bool? + public let versionIdMarker: String? + /// Use this value for the next version id marker parameter in a subsequent request. + public let nextVersionIdMarker: String? + public let commonPrefixes: [CommonPrefix]? + public let delimiter: String? + /// Marks the last Key returned in a truncated response. + public let keyMarker: String? + /// Encoding type used by Amazon S3 to encode object keys in the response. + public let encodingType: EncodingType? + public let name: String? + public let prefix: String? + public let deleteMarkers: [DeleteMarkerEntry]? + /// Use this value for the key marker request parameter in a subsequent request. + public let nextKeyMarker: String? + public let versions: [ObjectVersion]? + + public init(maxKeys: Int32? = nil, isTruncated: Bool? = nil, versionIdMarker: String? = nil, nextVersionIdMarker: String? = nil, commonPrefixes: [CommonPrefix]? = nil, delimiter: String? = nil, keyMarker: String? = nil, encodingType: EncodingType? = nil, name: String? = nil, prefix: String? = nil, deleteMarkers: [DeleteMarkerEntry]? = nil, nextKeyMarker: String? = nil, versions: [ObjectVersion]? = nil) { + self.maxKeys = maxKeys + self.isTruncated = isTruncated + self.versionIdMarker = versionIdMarker + self.nextVersionIdMarker = nextVersionIdMarker + self.commonPrefixes = commonPrefixes + self.delimiter = delimiter + self.keyMarker = keyMarker + self.encodingType = encodingType + self.name = name + self.prefix = prefix + self.deleteMarkers = deleteMarkers + self.nextKeyMarker = nextKeyMarker + self.versions = versions + } + + public init(dictionary: [String: Any]) throws { + self.maxKeys = dictionary["MaxKeys"] as? Int32 + self.isTruncated = dictionary["IsTruncated"] as? Bool + self.versionIdMarker = dictionary["VersionIdMarker"] as? String + self.nextVersionIdMarker = dictionary["NextVersionIdMarker"] as? String + if let commonPrefixes = dictionary["CommonPrefixes"] as? [[String: Any]] { + self.commonPrefixes = try commonPrefixes.map({ try CommonPrefix(dictionary: $0) }) + } else { + self.commonPrefixes = nil + } + self.delimiter = dictionary["Delimiter"] as? String + self.keyMarker = dictionary["KeyMarker"] as? String + if let encodingType = dictionary["EncodingType"] as? String { self.encodingType = EncodingType(rawValue: encodingType) } else { self.encodingType = nil } + self.name = dictionary["Name"] as? String + self.prefix = dictionary["Prefix"] as? String + if let deleteMarkers = dictionary["DeleteMarker"] as? [[String: Any]] { + self.deleteMarkers = try deleteMarkers.map({ try DeleteMarkerEntry(dictionary: $0) }) + } else { + self.deleteMarkers = nil + } + self.nextKeyMarker = dictionary["NextKeyMarker"] as? String + if let versions = dictionary["Version"] as? [[String: Any]] { + self.versions = try versions.map({ try ObjectVersion(dictionary: $0) }) + } else { + self.versions = nil + } + } + } + + public struct AnalyticsConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Id", required: true, type: .string), + AWSShapeProperty(label: "StorageClassAnalysis", required: true, type: .structure), + AWSShapeProperty(label: "Filter", required: false, type: .structure) + ] + /// The identifier used to represent an analytics configuration. + public let id: String + /// If present, it indicates that data related to access patterns will be collected and made available to analyze the tradeoffs between different storage classes. + public let storageClassAnalysis: StorageClassAnalysis + /// The filter used to describe a set of objects for analyses. A filter must have exactly one prefix, one tag, or one conjunction (AnalyticsAndOperator). If no filter is provided, all objects will be considered in any analysis. + public let filter: AnalyticsFilter? + + public init(id: String, storageClassAnalysis: StorageClassAnalysis, filter: AnalyticsFilter? = nil) { + self.id = id + self.storageClassAnalysis = storageClassAnalysis + self.filter = filter + } + + public init(dictionary: [String: Any]) throws { + guard let id = dictionary["Id"] as? String else { throw InitializableError.missingRequiredParam("Id") } + self.id = id + guard let storageClassAnalysis = dictionary["StorageClassAnalysis"] as? [String: Any] else { throw InitializableError.missingRequiredParam("StorageClassAnalysis") } + self.storageClassAnalysis = try S3.StorageClassAnalysis(dictionary: storageClassAnalysis) + if let filter = dictionary["Filter"] as? [String: Any] { self.filter = try S3.AnalyticsFilter(dictionary: filter) } else { self.filter = nil } + } + } + + public struct GetBucketVersioningOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "MFADelete", location: .body(locationName: "MfaDelete"), required: false, type: .enum), + AWSShapeProperty(label: "Status", required: false, type: .enum) + ] + /// Specifies whether MFA delete is enabled in the bucket versioning configuration. This element is only returned if the bucket has been configured with MFA delete. If the bucket has never been so configured, this element is not returned. + public let mFADelete: MFADeleteStatus? + /// The versioning state of the bucket. + public let status: BucketVersioningStatus? + + public init(mFADelete: MFADeleteStatus? = nil, status: BucketVersioningStatus? = nil) { + self.mFADelete = mFADelete + self.status = status + } + + public init(dictionary: [String: Any]) throws { + if let mFADelete = dictionary["MfaDelete"] as? String { self.mFADelete = MFADeleteStatus(rawValue: mFADelete) } else { self.mFADelete = nil } + if let status = dictionary["Status"] as? String { self.status = BucketVersioningStatus(rawValue: status) } else { self.status = nil } + } + } + + public struct InventoryFilter: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Prefix", required: true, type: .string) + ] + /// The prefix that an object must have to be included in the inventory results. + public let prefix: String + + public init(prefix: String) { + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + guard let prefix = dictionary["Prefix"] as? String else { throw InitializableError.missingRequiredParam("Prefix") } + self.prefix = prefix + } + } + + public struct DeleteObjectsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "Delete" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "MFA", location: .header(locationName: "x-amz-mfa"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "Delete", location: .body(locationName: "Delete"), required: true, type: .structure) + ] + public let bucket: String + /// The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. + public let mFA: String? + public let requestPayer: RequestPayer? + public let delete: Delete + + public init(bucket: String, mFA: String? = nil, requestPayer: RequestPayer? = nil, delete: Delete) { + self.bucket = bucket + self.mFA = mFA + self.requestPayer = requestPayer + self.delete = delete + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.mFA = dictionary["x-amz-mfa"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + guard let delete = dictionary["Delete"] as? [String: Any] else { throw InitializableError.missingRequiredParam("Delete") } + self.delete = try S3.Delete(dictionary: delete) + } + } + + public struct PutBucketVersioningRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "VersioningConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "MFA", location: .header(locationName: "x-amz-mfa"), required: false, type: .string), + AWSShapeProperty(label: "VersioningConfiguration", location: .body(locationName: "VersioningConfiguration"), required: true, type: .structure) + ] + public let bucket: String + public let contentMD5: String? + /// The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. + public let mFA: String? + public let versioningConfiguration: VersioningConfiguration + + public init(bucket: String, contentMD5: String? = nil, mFA: String? = nil, versioningConfiguration: VersioningConfiguration) { + self.bucket = bucket + self.contentMD5 = contentMD5 + self.mFA = mFA + self.versioningConfiguration = versioningConfiguration + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.contentMD5 = dictionary["Content-MD5"] as? String + self.mFA = dictionary["x-amz-mfa"] as? String + guard let versioningConfiguration = dictionary["VersioningConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("VersioningConfiguration") } + self.versioningConfiguration = try S3.VersioningConfiguration(dictionary: versioningConfiguration) + } + } + + public struct GetObjectAclOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Owner", required: false, type: .structure), + AWSShapeProperty(label: "Grants", location: .body(locationName: "AccessControlList"), required: false, type: .structure), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum) + ] + public let owner: Owner? + /// A list of grants. + public let grants: Grants? + public let requestCharged: RequestCharged? + + public init(owner: Owner? = nil, grants: Grants? = nil, requestCharged: RequestCharged? = nil) { + self.owner = owner + self.grants = grants + self.requestCharged = requestCharged + } + + public init(dictionary: [String: Any]) throws { + if let owner = dictionary["Owner"] as? [String: Any] { self.owner = try S3.Owner(dictionary: owner) } else { self.owner = nil } + if let grants = dictionary["AccessControlList"] as? [String: Any] { self.grants = try S3.Grants(dictionary: grants) } else { self.grants = nil } + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + } + } + + public struct Delete: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Objects", location: .body(locationName: "Object"), required: true, type: .list), + AWSShapeProperty(label: "Quiet", required: false, type: .boolean) + ] + public let objects: [ObjectIdentifier] + /// Element to enable quiet mode for the request. When you add this element, you must set its value to true. + public let quiet: Bool? + + public init(objects: [ObjectIdentifier], quiet: Bool? = nil) { + self.objects = objects + self.quiet = quiet + } + + public init(dictionary: [String: Any]) throws { + guard let objects = dictionary["Object"] as? [[String: Any]] else { throw InitializableError.missingRequiredParam("Object") } + self.objects = try objects.map({ try ObjectIdentifier(dictionary: $0) }) + self.quiet = dictionary["Quiet"] as? Bool + } + } + + public enum BucketLogsPermission: String, CustomStringConvertible { + case full_control = "FULL_CONTROL" + case read = "READ" + case write = "WRITE" + public var description: String { return self.rawValue } + } + + public struct ListMultipartUploadsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "UploadIdMarker", location: .querystring(locationName: "upload-id-marker"), required: false, type: .string), + AWSShapeProperty(label: "Prefix", location: .querystring(locationName: "prefix"), required: false, type: .string), + AWSShapeProperty(label: "MaxUploads", location: .querystring(locationName: "max-uploads"), required: false, type: .integer), + AWSShapeProperty(label: "Delimiter", location: .querystring(locationName: "delimiter"), required: false, type: .string), + AWSShapeProperty(label: "EncodingType", location: .querystring(locationName: "encoding-type"), required: false, type: .enum), + AWSShapeProperty(label: "KeyMarker", location: .querystring(locationName: "key-marker"), required: false, type: .string) + ] + public let bucket: String + /// Together with key-marker, specifies the multipart upload after which listing should begin. If key-marker is not specified, the upload-id-marker parameter is ignored. + public let uploadIdMarker: String? + /// Lists in-progress uploads only for those keys that begin with the specified prefix. + public let prefix: String? + /// Sets the maximum number of multipart uploads, from 1 to 1,000, to return in the response body. 1,000 is the maximum number of uploads that can be returned in a response. + public let maxUploads: Int32? + /// Character you use to group keys. + public let delimiter: String? + public let encodingType: EncodingType? + /// Together with upload-id-marker, this parameter specifies the multipart upload after which listing should begin. + public let keyMarker: String? + + public init(bucket: String, uploadIdMarker: String? = nil, prefix: String? = nil, maxUploads: Int32? = nil, delimiter: String? = nil, encodingType: EncodingType? = nil, keyMarker: String? = nil) { + self.bucket = bucket + self.uploadIdMarker = uploadIdMarker + self.prefix = prefix + self.maxUploads = maxUploads + self.delimiter = delimiter + self.encodingType = encodingType + self.keyMarker = keyMarker + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.uploadIdMarker = dictionary["upload-id-marker"] as? String + self.prefix = dictionary["prefix"] as? String + self.maxUploads = dictionary["max-uploads"] as? Int32 + self.delimiter = dictionary["delimiter"] as? String + if let encodingType = dictionary["encoding-type"] as? String { self.encodingType = EncodingType(rawValue: encodingType) } else { self.encodingType = nil } + self.keyMarker = dictionary["key-marker"] as? String + } + } + + public struct DeleteObjectsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum), + AWSShapeProperty(label: "Errors", location: .body(locationName: "Error"), required: false, type: .list), + AWSShapeProperty(label: "Deleted", required: false, type: .list) + ] + public let requestCharged: RequestCharged? + public let errors: [Error]? + public let deleted: [DeletedObject]? + + public init(requestCharged: RequestCharged? = nil, errors: [Error]? = nil, deleted: [DeletedObject]? = nil) { + self.requestCharged = requestCharged + self.errors = errors + self.deleted = deleted + } + + public init(dictionary: [String: Any]) throws { + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + if let errors = dictionary["Error"] as? [[String: Any]] { + self.errors = try errors.map({ try Error(dictionary: $0) }) + } else { + self.errors = nil + } + if let deleted = dictionary["Deleted"] as? [[String: Any]] { + self.deleted = try deleted.map({ try DeletedObject(dictionary: $0) }) + } else { + self.deleted = nil + } + } + } + + public struct DeleteBucketAnalyticsConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Id", location: .querystring(locationName: "id"), required: true, type: .string) + ] + /// The name of the bucket from which an analytics configuration is deleted. + public let bucket: String + /// The identifier used to represent an analytics configuration. + public let id: String + + public init(bucket: String, id: String) { + self.bucket = bucket + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let id = dictionary["id"] as? String else { throw InitializableError.missingRequiredParam("id") } + self.id = id + } + } + + public struct DeleteBucketReplicationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public enum StorageClass: String, CustomStringConvertible { + case standard = "STANDARD" + case reduced_redundancy = "REDUCED_REDUNDANCY" + case standard_ia = "STANDARD_IA" + public var description: String { return self.rawValue } + } + + public struct ListBucketAnalyticsConfigurationsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContinuationToken", required: false, type: .string), + AWSShapeProperty(label: "IsTruncated", required: false, type: .boolean), + AWSShapeProperty(label: "NextContinuationToken", required: false, type: .string), + AWSShapeProperty(label: "AnalyticsConfigurationList", location: .body(locationName: "AnalyticsConfiguration"), required: false, type: .list) + ] + /// The ContinuationToken that represents where this request began. + public let continuationToken: String? + /// Indicates whether the returned list of analytics configurations is complete. A value of true indicates that the list is not complete and the NextContinuationToken will be provided for a subsequent request. + public let isTruncated: Bool? + /// NextContinuationToken is sent when isTruncated is true, which indicates that there are more analytics configurations to list. The next request must include this NextContinuationToken. The token is obfuscated and is not a usable value. + public let nextContinuationToken: String? + /// The list of analytics configurations for a bucket. + public let analyticsConfigurationList: [AnalyticsConfiguration]? + + public init(continuationToken: String? = nil, isTruncated: Bool? = nil, nextContinuationToken: String? = nil, analyticsConfigurationList: [AnalyticsConfiguration]? = nil) { + self.continuationToken = continuationToken + self.isTruncated = isTruncated + self.nextContinuationToken = nextContinuationToken + self.analyticsConfigurationList = analyticsConfigurationList + } + + public init(dictionary: [String: Any]) throws { + self.continuationToken = dictionary["ContinuationToken"] as? String + self.isTruncated = dictionary["IsTruncated"] as? Bool + self.nextContinuationToken = dictionary["NextContinuationToken"] as? String + if let analyticsConfigurationList = dictionary["AnalyticsConfiguration"] as? [[String: Any]] { + self.analyticsConfigurationList = try analyticsConfigurationList.map({ try AnalyticsConfiguration(dictionary: $0) }) + } else { + self.analyticsConfigurationList = nil + } + } + } + + public struct InventorySchedule: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Frequency", required: true, type: .enum) + ] + /// Specifies how frequently inventory results are produced. + public let frequency: InventoryFrequency + + public init(frequency: InventoryFrequency) { + self.frequency = frequency + } + + public init(dictionary: [String: Any]) throws { + guard let rawFrequency = dictionary["Frequency"] as? String, let frequency = InventoryFrequency(rawValue: rawFrequency) else { throw InitializableError.missingRequiredParam("Frequency") } + self.frequency = frequency + } + } + + public struct ListMultipartUploadsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", required: false, type: .string), + AWSShapeProperty(label: "IsTruncated", required: false, type: .boolean), + AWSShapeProperty(label: "KeyMarker", required: false, type: .string), + AWSShapeProperty(label: "Prefix", required: false, type: .string), + AWSShapeProperty(label: "UploadIdMarker", required: false, type: .string), + AWSShapeProperty(label: "CommonPrefixes", required: false, type: .list), + AWSShapeProperty(label: "MaxUploads", required: false, type: .integer), + AWSShapeProperty(label: "Uploads", location: .body(locationName: "Upload"), required: false, type: .list), + AWSShapeProperty(label: "Delimiter", required: false, type: .string), + AWSShapeProperty(label: "EncodingType", required: false, type: .enum), + AWSShapeProperty(label: "NextKeyMarker", required: false, type: .string), + AWSShapeProperty(label: "NextUploadIdMarker", required: false, type: .string) + ] + /// Name of the bucket to which the multipart upload was initiated. + public let bucket: String? + /// Indicates whether the returned list of multipart uploads is truncated. A value of true indicates that the list was truncated. The list can be truncated if the number of multipart uploads exceeds the limit allowed or specified by max uploads. + public let isTruncated: Bool? + /// The key at or after which the listing began. + public let keyMarker: String? + /// When a prefix is provided in the request, this field contains the specified prefix. The result contains only keys starting with the specified prefix. + public let prefix: String? + /// Upload ID after which listing began. + public let uploadIdMarker: String? + public let commonPrefixes: [CommonPrefix]? + /// Maximum number of multipart uploads that could have been included in the response. + public let maxUploads: Int32? + public let uploads: [MultipartUpload]? + public let delimiter: String? + /// Encoding type used by Amazon S3 to encode object keys in the response. + public let encodingType: EncodingType? + /// When a list is truncated, this element specifies the value that should be used for the key-marker request parameter in a subsequent request. + public let nextKeyMarker: String? + /// When a list is truncated, this element specifies the value that should be used for the upload-id-marker request parameter in a subsequent request. + public let nextUploadIdMarker: String? + + public init(bucket: String? = nil, isTruncated: Bool? = nil, keyMarker: String? = nil, prefix: String? = nil, uploadIdMarker: String? = nil, commonPrefixes: [CommonPrefix]? = nil, maxUploads: Int32? = nil, uploads: [MultipartUpload]? = nil, delimiter: String? = nil, encodingType: EncodingType? = nil, nextKeyMarker: String? = nil, nextUploadIdMarker: String? = nil) { + self.bucket = bucket + self.isTruncated = isTruncated + self.keyMarker = keyMarker + self.prefix = prefix + self.uploadIdMarker = uploadIdMarker + self.commonPrefixes = commonPrefixes + self.maxUploads = maxUploads + self.uploads = uploads + self.delimiter = delimiter + self.encodingType = encodingType + self.nextKeyMarker = nextKeyMarker + self.nextUploadIdMarker = nextUploadIdMarker + } + + public init(dictionary: [String: Any]) throws { + self.bucket = dictionary["Bucket"] as? String + self.isTruncated = dictionary["IsTruncated"] as? Bool + self.keyMarker = dictionary["KeyMarker"] as? String + self.prefix = dictionary["Prefix"] as? String + self.uploadIdMarker = dictionary["UploadIdMarker"] as? String + if let commonPrefixes = dictionary["CommonPrefixes"] as? [[String: Any]] { + self.commonPrefixes = try commonPrefixes.map({ try CommonPrefix(dictionary: $0) }) + } else { + self.commonPrefixes = nil + } + self.maxUploads = dictionary["MaxUploads"] as? Int32 + if let uploads = dictionary["Upload"] as? [[String: Any]] { + self.uploads = try uploads.map({ try MultipartUpload(dictionary: $0) }) + } else { + self.uploads = nil + } + self.delimiter = dictionary["Delimiter"] as? String + if let encodingType = dictionary["EncodingType"] as? String { self.encodingType = EncodingType(rawValue: encodingType) } else { self.encodingType = nil } + self.nextKeyMarker = dictionary["NextKeyMarker"] as? String + self.nextUploadIdMarker = dictionary["NextUploadIdMarker"] as? String + } + } + + public struct GetBucketMetricsConfigurationOutput: AWSShape { + /// The key for the payload + public static let payload: String? = "MetricsConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "MetricsConfiguration", required: false, type: .structure) + ] + /// Specifies the metrics configuration. + public let metricsConfiguration: MetricsConfiguration? + + public init(metricsConfiguration: MetricsConfiguration? = nil) { + self.metricsConfiguration = metricsConfiguration + } + + public init(dictionary: [String: Any]) throws { + if let metricsConfiguration = dictionary["MetricsConfiguration"] as? [String: Any] { self.metricsConfiguration = try S3.MetricsConfiguration(dictionary: metricsConfiguration) } else { self.metricsConfiguration = nil } + } + } + + public struct ListBucketMetricsConfigurationsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContinuationToken", required: false, type: .string), + AWSShapeProperty(label: "IsTruncated", required: false, type: .boolean), + AWSShapeProperty(label: "MetricsConfigurationList", location: .body(locationName: "MetricsConfiguration"), required: false, type: .list), + AWSShapeProperty(label: "NextContinuationToken", required: false, type: .string) + ] + /// The marker that is used as a starting point for this metrics configuration list response. This value is present if it was sent in the request. + public let continuationToken: String? + /// Indicates whether the returned list of metrics configurations is complete. A value of true indicates that the list is not complete and the NextContinuationToken will be provided for a subsequent request. + public let isTruncated: Bool? + /// The list of metrics configurations for a bucket. + public let metricsConfigurationList: [MetricsConfiguration]? + /// The marker used to continue a metrics configuration listing that has been truncated. Use the NextContinuationToken from a previously truncated list response to continue the listing. The continuation token is an opaque value that Amazon S3 understands. + public let nextContinuationToken: String? + + public init(continuationToken: String? = nil, isTruncated: Bool? = nil, metricsConfigurationList: [MetricsConfiguration]? = nil, nextContinuationToken: String? = nil) { + self.continuationToken = continuationToken + self.isTruncated = isTruncated + self.metricsConfigurationList = metricsConfigurationList + self.nextContinuationToken = nextContinuationToken + } + + public init(dictionary: [String: Any]) throws { + self.continuationToken = dictionary["ContinuationToken"] as? String + self.isTruncated = dictionary["IsTruncated"] as? Bool + if let metricsConfigurationList = dictionary["MetricsConfiguration"] as? [[String: Any]] { + self.metricsConfigurationList = try metricsConfigurationList.map({ try MetricsConfiguration(dictionary: $0) }) + } else { + self.metricsConfigurationList = nil + } + self.nextContinuationToken = dictionary["NextContinuationToken"] as? String + } + } + + public struct GetBucketAclOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Owner", required: false, type: .structure), + AWSShapeProperty(label: "Grants", location: .body(locationName: "AccessControlList"), required: false, type: .structure) + ] + public let owner: Owner? + /// A list of grants. + public let grants: Grants? + + public init(owner: Owner? = nil, grants: Grants? = nil) { + self.owner = owner + self.grants = grants + } + + public init(dictionary: [String: Any]) throws { + if let owner = dictionary["Owner"] as? [String: Any] { self.owner = try S3.Owner(dictionary: owner) } else { self.owner = nil } + if let grants = dictionary["AccessControlList"] as? [String: Any] { self.grants = try S3.Grants(dictionary: grants) } else { self.grants = nil } + } + } + + public struct ListObjectsV2Request: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "MaxKeys", location: .querystring(locationName: "max-keys"), required: false, type: .integer), + AWSShapeProperty(label: "StartAfter", location: .querystring(locationName: "start-after"), required: false, type: .string), + AWSShapeProperty(label: "ContinuationToken", location: .querystring(locationName: "continuation-token"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "Prefix", location: .querystring(locationName: "prefix"), required: false, type: .string), + AWSShapeProperty(label: "FetchOwner", location: .querystring(locationName: "fetch-owner"), required: false, type: .boolean), + AWSShapeProperty(label: "Delimiter", location: .querystring(locationName: "delimiter"), required: false, type: .string), + AWSShapeProperty(label: "EncodingType", location: .querystring(locationName: "encoding-type"), required: false, type: .enum) + ] + /// Name of the bucket to list. + public let bucket: String + /// Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more. + public let maxKeys: Int32? + /// StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this specified key. StartAfter can be any key in the bucket + public let startAfter: String? + /// ContinuationToken indicates Amazon S3 that the list is being continued on this bucket with a token. ContinuationToken is obfuscated and is not a real key + public let continuationToken: String? + /// Confirms that the requester knows that she or he will be charged for the list objects request in V2 style. Bucket owners need not specify this parameter in their requests. + public let requestPayer: RequestPayer? + /// Limits the response to keys that begin with the specified prefix. + public let prefix: String? + /// The owner field is not present in listV2 by default, if you want to return owner field with each key in the result then set the fetch owner field to true + public let fetchOwner: Bool? + /// A delimiter is a character you use to group keys. + public let delimiter: String? + /// Encoding type used by Amazon S3 to encode object keys in the response. + public let encodingType: EncodingType? + + public init(bucket: String, maxKeys: Int32? = nil, startAfter: String? = nil, continuationToken: String? = nil, requestPayer: RequestPayer? = nil, prefix: String? = nil, fetchOwner: Bool? = nil, delimiter: String? = nil, encodingType: EncodingType? = nil) { + self.bucket = bucket + self.maxKeys = maxKeys + self.startAfter = startAfter + self.continuationToken = continuationToken + self.requestPayer = requestPayer + self.prefix = prefix + self.fetchOwner = fetchOwner + self.delimiter = delimiter + self.encodingType = encodingType + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.maxKeys = dictionary["max-keys"] as? Int32 + self.startAfter = dictionary["start-after"] as? String + self.continuationToken = dictionary["continuation-token"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.prefix = dictionary["prefix"] as? String + self.fetchOwner = dictionary["fetch-owner"] as? Bool + self.delimiter = dictionary["delimiter"] as? String + if let encodingType = dictionary["encoding-type"] as? String { self.encodingType = EncodingType(rawValue: encodingType) } else { self.encodingType = nil } + } + } + + public struct HeadBucketRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct CreateBucketRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "CreateBucketConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "CreateBucketConfiguration", location: .body(locationName: "CreateBucketConfiguration"), required: false, type: .structure), + AWSShapeProperty(label: "GrantWriteACP", location: .header(locationName: "x-amz-grant-write-acp"), required: false, type: .string), + AWSShapeProperty(label: "GrantFullControl", location: .header(locationName: "x-amz-grant-full-control"), required: false, type: .string), + AWSShapeProperty(label: "GrantWrite", location: .header(locationName: "x-amz-grant-write"), required: false, type: .string), + AWSShapeProperty(label: "GrantRead", location: .header(locationName: "x-amz-grant-read"), required: false, type: .string), + AWSShapeProperty(label: "ACL", location: .header(locationName: "x-amz-acl"), required: false, type: .enum), + AWSShapeProperty(label: "GrantReadACP", location: .header(locationName: "x-amz-grant-read-acp"), required: false, type: .string) + ] + public let bucket: String + public let createBucketConfiguration: CreateBucketConfiguration? + /// Allows grantee to write the ACL for the applicable bucket. + public let grantWriteACP: String? + /// Allows grantee the read, write, read ACP, and write ACP permissions on the bucket. + public let grantFullControl: String? + /// Allows grantee to create, overwrite, and delete any object in the bucket. + public let grantWrite: String? + /// Allows grantee to list the objects in the bucket. + public let grantRead: String? + /// The canned ACL to apply to the bucket. + public let aCL: BucketCannedACL? + /// Allows grantee to read the bucket ACL. + public let grantReadACP: String? + + public init(bucket: String, createBucketConfiguration: CreateBucketConfiguration? = nil, grantWriteACP: String? = nil, grantFullControl: String? = nil, grantWrite: String? = nil, grantRead: String? = nil, aCL: BucketCannedACL? = nil, grantReadACP: String? = nil) { + self.bucket = bucket + self.createBucketConfiguration = createBucketConfiguration + self.grantWriteACP = grantWriteACP + self.grantFullControl = grantFullControl + self.grantWrite = grantWrite + self.grantRead = grantRead + self.aCL = aCL + self.grantReadACP = grantReadACP + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + if let createBucketConfiguration = dictionary["CreateBucketConfiguration"] as? [String: Any] { self.createBucketConfiguration = try S3.CreateBucketConfiguration(dictionary: createBucketConfiguration) } else { self.createBucketConfiguration = nil } + self.grantWriteACP = dictionary["x-amz-grant-write-acp"] as? String + self.grantFullControl = dictionary["x-amz-grant-full-control"] as? String + self.grantWrite = dictionary["x-amz-grant-write"] as? String + self.grantRead = dictionary["x-amz-grant-read"] as? String + if let aCL = dictionary["x-amz-acl"] as? String { self.aCL = BucketCannedACL(rawValue: aCL) } else { self.aCL = nil } + self.grantReadACP = dictionary["x-amz-grant-read-acp"] as? String + } + } + + public enum BucketLocationConstraint: String, CustomStringConvertible { + case eu = "EU" + case eu_west_1 = "eu-west-1" + case us_west_1 = "us-west-1" + case us_west_2 = "us-west-2" + case ap_south_1 = "ap-south-1" + case ap_southeast_1 = "ap-southeast-1" + case ap_southeast_2 = "ap-southeast-2" + case ap_northeast_1 = "ap-northeast-1" + case sa_east_1 = "sa-east-1" + case cn_north_1 = "cn-north-1" + case eu_central_1 = "eu-central-1" + public var description: String { return self.rawValue } + } + + public struct Initiator: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ID", required: false, type: .string), + AWSShapeProperty(label: "DisplayName", required: false, type: .string) + ] + /// If the principal is an AWS account, it provides the Canonical User ID. If the principal is an IAM User, it provides a user ARN value. + public let iD: String? + /// Name of the Principal. + public let displayName: String? + + public init(iD: String? = nil, displayName: String? = nil) { + self.iD = iD + self.displayName = displayName + } + + public init(dictionary: [String: Any]) throws { + self.iD = dictionary["ID"] as? String + self.displayName = dictionary["DisplayName"] as? String + } + } + + public struct DeleteObjectTaggingOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "VersionId", location: .header(locationName: "x-amz-version-id"), required: false, type: .string) + ] + /// The versionId of the object the tag-set was removed from. + public let versionId: String? + + public init(versionId: String? = nil) { + self.versionId = versionId + } + + public init(dictionary: [String: Any]) throws { + self.versionId = dictionary["x-amz-version-id"] as? String + } + } + + public struct PutBucketReplicationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "ReplicationConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "ReplicationConfiguration", location: .body(locationName: "ReplicationConfiguration"), required: true, type: .structure) + ] + public let contentMD5: String? + public let bucket: String + public let replicationConfiguration: ReplicationConfiguration + + public init(contentMD5: String? = nil, bucket: String, replicationConfiguration: ReplicationConfiguration) { + self.contentMD5 = contentMD5 + self.bucket = bucket + self.replicationConfiguration = replicationConfiguration + } + + public init(dictionary: [String: Any]) throws { + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let replicationConfiguration = dictionary["ReplicationConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("ReplicationConfiguration") } + self.replicationConfiguration = try S3.ReplicationConfiguration(dictionary: replicationConfiguration) + } + } + + public enum InventoryOptionalField: String, CustomStringConvertible { + case size = "Size" + case lastmodifieddate = "LastModifiedDate" + case storageclass = "StorageClass" + case etag = "ETag" + case ismultipartuploaded = "IsMultipartUploaded" + case replicationstatus = "ReplicationStatus" + public var description: String { return self.rawValue } + } + + public struct CORSRule: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ExposeHeaders", location: .body(locationName: "ExposeHeader"), required: false, type: .list), + AWSShapeProperty(label: "AllowedMethods", location: .body(locationName: "AllowedMethod"), required: true, type: .list), + AWSShapeProperty(label: "MaxAgeSeconds", required: false, type: .integer), + AWSShapeProperty(label: "AllowedHeaders", location: .body(locationName: "AllowedHeader"), required: false, type: .list), + AWSShapeProperty(label: "AllowedOrigins", location: .body(locationName: "AllowedOrigin"), required: true, type: .list) + ] + /// One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript XMLHttpRequest object). + public let exposeHeaders: [String]? + /// Identifies HTTP methods that the domain/origin specified in the rule is allowed to execute. + public let allowedMethods: [String] + /// The time in seconds that your browser is to cache the preflight response for the specified resource. + public let maxAgeSeconds: Int32? + /// Specifies which headers are allowed in a pre-flight OPTIONS request. + public let allowedHeaders: [String]? + /// One or more origins you want customers to be able to access the bucket from. + public let allowedOrigins: [String] + + public init(exposeHeaders: [String]? = nil, allowedMethods: [String], maxAgeSeconds: Int32? = nil, allowedHeaders: [String]? = nil, allowedOrigins: [String]) { + self.exposeHeaders = exposeHeaders + self.allowedMethods = allowedMethods + self.maxAgeSeconds = maxAgeSeconds + self.allowedHeaders = allowedHeaders + self.allowedOrigins = allowedOrigins + } + + public init(dictionary: [String: Any]) throws { + self.exposeHeaders = dictionary["ExposeHeader"] as? [String] + guard let allowedMethods = dictionary["AllowedMethod"] as? [String] else { throw InitializableError.missingRequiredParam("AllowedMethod") } + self.allowedMethods = allowedMethods + self.maxAgeSeconds = dictionary["MaxAgeSeconds"] as? Int32 + self.allowedHeaders = dictionary["AllowedHeader"] as? [String] + guard let allowedOrigins = dictionary["AllowedOrigin"] as? [String] else { throw InitializableError.missingRequiredParam("AllowedOrigin") } + self.allowedOrigins = allowedOrigins + } + } + + public struct CreateMultipartUploadRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "SSECustomerKey", location: .header(locationName: "x-amz-server-side-encryption-customer-key"), required: false, type: .string), + AWSShapeProperty(label: "CacheControl", location: .header(locationName: "Cache-Control"), required: false, type: .string), + AWSShapeProperty(label: "Tagging", location: .header(locationName: "x-amz-tagging"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "ContentDisposition", location: .header(locationName: "Content-Disposition"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "GrantFullControl", location: .header(locationName: "x-amz-grant-full-control"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "GrantReadACP", location: .header(locationName: "x-amz-grant-read-acp"), required: false, type: .string), + AWSShapeProperty(label: "ACL", location: .header(locationName: "x-amz-acl"), required: false, type: .enum), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "ContentLanguage", location: .header(locationName: "Content-Language"), required: false, type: .string), + AWSShapeProperty(label: "Metadata", required: false, type: .map), + AWSShapeProperty(label: "ContentEncoding", location: .header(locationName: "Content-Encoding"), required: false, type: .string), + AWSShapeProperty(label: "Expires", location: .header(locationName: "Expires"), required: false, type: .timestamp), + AWSShapeProperty(label: "GrantWriteACP", location: .header(locationName: "x-amz-grant-write-acp"), required: false, type: .string), + AWSShapeProperty(label: "ContentType", location: .header(locationName: "Content-Type"), required: false, type: .string), + AWSShapeProperty(label: "StorageClass", location: .header(locationName: "x-amz-storage-class"), required: false, type: .enum), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "WebsiteRedirectLocation", location: .header(locationName: "x-amz-website-redirect-location"), required: false, type: .string), + AWSShapeProperty(label: "GrantRead", location: .header(locationName: "x-amz-grant-read"), required: false, type: .string), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum) + ] + /// Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header. + public let sSECustomerKey: String? + /// Specifies caching behavior along the request/reply chain. + public let cacheControl: String? + /// The tag-set for the object. The tag-set must be encoded as URL Query parameters + public let tagging: String? + public let bucket: String + /// Specifies presentational information for the object. + public let contentDisposition: String? + public let requestPayer: RequestPayer? + /// Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. + public let grantFullControl: String? + /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error. + public let sSECustomerKeyMD5: String? + /// Specifies the AWS KMS key ID to use for object encryption. All GET and PUT requests for an object protected by AWS KMS will fail if not made via SSL or using SigV4. Documentation on configuring any of the officially supported AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version + public let sSEKMSKeyId: String? + /// Allows grantee to read the object ACL. + public let grantReadACP: String? + /// The canned ACL to apply to the object. + public let aCL: ObjectCannedACL? + /// Specifies the algorithm to use to when encrypting the object (e.g., AES256). + public let sSECustomerAlgorithm: String? + /// The language the content is in. + public let contentLanguage: String? + /// A map of metadata to store with the object in S3. + public let metadata: [String: String]? + /// Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. + public let contentEncoding: String? + /// The date and time at which the object is no longer cacheable. + public let expires: String? + /// Allows grantee to write the ACL for the applicable object. + public let grantWriteACP: String? + /// A standard MIME type describing the format of the object data. + public let contentType: String? + /// The type of storage to use for the object. Defaults to 'STANDARD'. + public let storageClass: StorageClass? + public let key: String + /// If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. + public let websiteRedirectLocation: String? + /// Allows grantee to read the object data and its metadata. + public let grantRead: String? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + + public init(sSECustomerKey: String? = nil, cacheControl: String? = nil, tagging: String? = nil, bucket: String, contentDisposition: String? = nil, requestPayer: RequestPayer? = nil, grantFullControl: String? = nil, sSECustomerKeyMD5: String? = nil, sSEKMSKeyId: String? = nil, grantReadACP: String? = nil, aCL: ObjectCannedACL? = nil, sSECustomerAlgorithm: String? = nil, contentLanguage: String? = nil, metadata: [String: String]? = nil, contentEncoding: String? = nil, expires: String? = nil, grantWriteACP: String? = nil, contentType: String? = nil, storageClass: StorageClass? = nil, key: String, websiteRedirectLocation: String? = nil, grantRead: String? = nil, serverSideEncryption: ServerSideEncryption? = nil) { + self.sSECustomerKey = sSECustomerKey + self.cacheControl = cacheControl + self.tagging = tagging + self.bucket = bucket + self.contentDisposition = contentDisposition + self.requestPayer = requestPayer + self.grantFullControl = grantFullControl + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.sSEKMSKeyId = sSEKMSKeyId + self.grantReadACP = grantReadACP + self.aCL = aCL + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.contentLanguage = contentLanguage + self.metadata = metadata + self.contentEncoding = contentEncoding + self.expires = expires + self.grantWriteACP = grantWriteACP + self.contentType = contentType + self.storageClass = storageClass + self.key = key + self.websiteRedirectLocation = websiteRedirectLocation + self.grantRead = grantRead + self.serverSideEncryption = serverSideEncryption + } + + public init(dictionary: [String: Any]) throws { + self.sSECustomerKey = dictionary["x-amz-server-side-encryption-customer-key"] as? String + self.cacheControl = dictionary["Cache-Control"] as? String + self.tagging = dictionary["x-amz-tagging"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.contentDisposition = dictionary["Content-Disposition"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.grantFullControl = dictionary["x-amz-grant-full-control"] as? String + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.grantReadACP = dictionary["x-amz-grant-read-acp"] as? String + if let aCL = dictionary["x-amz-acl"] as? String { self.aCL = ObjectCannedACL(rawValue: aCL) } else { self.aCL = nil } + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + self.contentLanguage = dictionary["Content-Language"] as? String + if let metadata = dictionary["x-amz-meta-"] as? [String: String] { + self.metadata = metadata + } else { + self.metadata = nil + } + self.contentEncoding = dictionary["Content-Encoding"] as? String + self.expires = dictionary["Expires"] as? String + self.grantWriteACP = dictionary["x-amz-grant-write-acp"] as? String + self.contentType = dictionary["Content-Type"] as? String + if let storageClass = dictionary["x-amz-storage-class"] as? String { self.storageClass = StorageClass(rawValue: storageClass) } else { self.storageClass = nil } + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.websiteRedirectLocation = dictionary["x-amz-website-redirect-location"] as? String + self.grantRead = dictionary["x-amz-grant-read"] as? String + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + } + } + + public struct Grants: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Grant", required: false, type: .list) + ] + public let grant: [Grant]? + + public init(grant: [Grant]? = nil) { + self.grant = grant + } + + public init(dictionary: [String: Any]) throws { + if let grant = dictionary["Grant"] as? [[String: Any]] { + self.grant = try grant.map({ try Grant(dictionary: $0) }) + } else { + self.grant = nil + } + } + } + + public struct DeleteObjectRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "VersionId", location: .querystring(locationName: "versionId"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "MFA", location: .header(locationName: "x-amz-mfa"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum) + ] + /// VersionId used to reference a specific version of the object. + public let versionId: String? + public let bucket: String + public let key: String + /// The concatenation of the authentication device's serial number, a space, and the value that is displayed on your authentication device. + public let mFA: String? + public let requestPayer: RequestPayer? + + public init(versionId: String? = nil, bucket: String, key: String, mFA: String? = nil, requestPayer: RequestPayer? = nil) { + self.versionId = versionId + self.bucket = bucket + self.key = key + self.mFA = mFA + self.requestPayer = requestPayer + } + + public init(dictionary: [String: Any]) throws { + self.versionId = dictionary["versionId"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.mFA = dictionary["x-amz-mfa"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + } + } + + public struct PutObjectAclOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum) + ] + public let requestCharged: RequestCharged? + + public init(requestCharged: RequestCharged? = nil) { + self.requestCharged = requestCharged + } + + public init(dictionary: [String: Any]) throws { + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + } + } + + public struct ListPartsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "PartNumberMarker", required: false, type: .integer), + AWSShapeProperty(label: "Bucket", required: false, type: .string), + AWSShapeProperty(label: "IsTruncated", required: false, type: .boolean), + AWSShapeProperty(label: "AbortDate", location: .header(locationName: "x-amz-abort-date"), required: false, type: .timestamp), + AWSShapeProperty(label: "UploadId", required: false, type: .string), + AWSShapeProperty(label: "Owner", required: false, type: .structure), + AWSShapeProperty(label: "Parts", location: .body(locationName: "Part"), required: false, type: .list), + AWSShapeProperty(label: "Initiator", required: false, type: .structure), + AWSShapeProperty(label: "AbortRuleId", location: .header(locationName: "x-amz-abort-rule-id"), required: false, type: .string), + AWSShapeProperty(label: "StorageClass", required: false, type: .enum), + AWSShapeProperty(label: "Key", required: false, type: .string), + AWSShapeProperty(label: "MaxParts", required: false, type: .integer), + AWSShapeProperty(label: "NextPartNumberMarker", required: false, type: .integer), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum) + ] + /// Part number after which listing begins. + public let partNumberMarker: Int32? + /// Name of the bucket to which the multipart upload was initiated. + public let bucket: String? + /// Indicates whether the returned list of parts is truncated. + public let isTruncated: Bool? + /// Date when multipart upload will become eligible for abort operation by lifecycle. + public let abortDate: String? + /// Upload ID identifying the multipart upload whose parts are being listed. + public let uploadId: String? + public let owner: Owner? + public let parts: [Part]? + /// Identifies who initiated the multipart upload. + public let initiator: Initiator? + /// Id of the lifecycle rule that makes a multipart upload eligible for abort operation. + public let abortRuleId: String? + /// The class of storage used to store the object. + public let storageClass: StorageClass? + /// Object key for which the multipart upload was initiated. + public let key: String? + /// Maximum number of parts that were allowed in the response. + public let maxParts: Int32? + /// When a list is truncated, this element specifies the last part in the list, as well as the value to use for the part-number-marker request parameter in a subsequent request. + public let nextPartNumberMarker: Int32? + public let requestCharged: RequestCharged? + + public init(partNumberMarker: Int32? = nil, bucket: String? = nil, isTruncated: Bool? = nil, abortDate: String? = nil, uploadId: String? = nil, owner: Owner? = nil, parts: [Part]? = nil, initiator: Initiator? = nil, abortRuleId: String? = nil, storageClass: StorageClass? = nil, key: String? = nil, maxParts: Int32? = nil, nextPartNumberMarker: Int32? = nil, requestCharged: RequestCharged? = nil) { + self.partNumberMarker = partNumberMarker + self.bucket = bucket + self.isTruncated = isTruncated + self.abortDate = abortDate + self.uploadId = uploadId + self.owner = owner + self.parts = parts + self.initiator = initiator + self.abortRuleId = abortRuleId + self.storageClass = storageClass + self.key = key + self.maxParts = maxParts + self.nextPartNumberMarker = nextPartNumberMarker + self.requestCharged = requestCharged + } + + public init(dictionary: [String: Any]) throws { + self.partNumberMarker = dictionary["PartNumberMarker"] as? Int32 + self.bucket = dictionary["Bucket"] as? String + self.isTruncated = dictionary["IsTruncated"] as? Bool + self.abortDate = dictionary["x-amz-abort-date"] as? String + self.uploadId = dictionary["UploadId"] as? String + if let owner = dictionary["Owner"] as? [String: Any] { self.owner = try S3.Owner(dictionary: owner) } else { self.owner = nil } + if let parts = dictionary["Part"] as? [[String: Any]] { + self.parts = try parts.map({ try Part(dictionary: $0) }) + } else { + self.parts = nil + } + if let initiator = dictionary["Initiator"] as? [String: Any] { self.initiator = try S3.Initiator(dictionary: initiator) } else { self.initiator = nil } + self.abortRuleId = dictionary["x-amz-abort-rule-id"] as? String + if let storageClass = dictionary["StorageClass"] as? String { self.storageClass = StorageClass(rawValue: storageClass) } else { self.storageClass = nil } + self.key = dictionary["Key"] as? String + self.maxParts = dictionary["MaxParts"] as? Int32 + self.nextPartNumberMarker = dictionary["NextPartNumberMarker"] as? Int32 + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + } + } + + public struct ListBucketInventoryConfigurationsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContinuationToken", required: false, type: .string), + AWSShapeProperty(label: "IsTruncated", required: false, type: .boolean), + AWSShapeProperty(label: "NextContinuationToken", required: false, type: .string), + AWSShapeProperty(label: "InventoryConfigurationList", location: .body(locationName: "InventoryConfiguration"), required: false, type: .list) + ] + /// If sent in the request, the marker that is used as a starting point for this inventory configuration list response. + public let continuationToken: String? + /// Indicates whether the returned list of inventory configurations is truncated in this response. A value of true indicates that the list is truncated. + public let isTruncated: Bool? + /// The marker used to continue this inventory configuration listing. Use the NextContinuationToken from this response to continue the listing in a subsequent request. The continuation token is an opaque value that Amazon S3 understands. + public let nextContinuationToken: String? + /// The list of inventory configurations for a bucket. + public let inventoryConfigurationList: [InventoryConfiguration]? + + public init(continuationToken: String? = nil, isTruncated: Bool? = nil, nextContinuationToken: String? = nil, inventoryConfigurationList: [InventoryConfiguration]? = nil) { + self.continuationToken = continuationToken + self.isTruncated = isTruncated + self.nextContinuationToken = nextContinuationToken + self.inventoryConfigurationList = inventoryConfigurationList + } + + public init(dictionary: [String: Any]) throws { + self.continuationToken = dictionary["ContinuationToken"] as? String + self.isTruncated = dictionary["IsTruncated"] as? Bool + self.nextContinuationToken = dictionary["NextContinuationToken"] as? String + if let inventoryConfigurationList = dictionary["InventoryConfiguration"] as? [[String: Any]] { + self.inventoryConfigurationList = try inventoryConfigurationList.map({ try InventoryConfiguration(dictionary: $0) }) + } else { + self.inventoryConfigurationList = nil + } + } + } + + public struct ListBucketMetricsConfigurationsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "ContinuationToken", location: .querystring(locationName: "continuation-token"), required: false, type: .string) + ] + /// The name of the bucket containing the metrics configurations to retrieve. + public let bucket: String + /// The marker that is used to continue a metrics configuration listing that has been truncated. Use the NextContinuationToken from a previously truncated list response to continue the listing. The continuation token is an opaque value that Amazon S3 understands. + public let continuationToken: String? + + public init(bucket: String, continuationToken: String? = nil) { + self.bucket = bucket + self.continuationToken = continuationToken + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.continuationToken = dictionary["continuation-token"] as? String + } + } + + public struct TopicConfigurationDeprecated: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Topic", required: false, type: .string), + AWSShapeProperty(label: "Events", location: .body(locationName: "Event"), required: false, type: .list), + AWSShapeProperty(label: "Event", required: false, type: .enum), + AWSShapeProperty(label: "Id", required: false, type: .string) + ] + /// Amazon SNS topic to which Amazon S3 will publish a message to report the specified events for the bucket. + public let topic: String? + public let events: [Event]? + /// Bucket event for which to send notifications. + public let event: Event? + public let id: String? + + public init(topic: String? = nil, events: [Event]? = nil, event: Event? = nil, id: String? = nil) { + self.topic = topic + self.events = events + self.event = event + self.id = id + } + + public init(dictionary: [String: Any]) throws { + self.topic = dictionary["Topic"] as? String + if let events = dictionary["Event"] as? [String] { self.events = events.flatMap({ Event(rawValue: $0)}) } else { self.events = nil } + if let event = dictionary["Event"] as? String { self.event = Event(rawValue: event) } else { self.event = nil } + self.id = dictionary["Id"] as? String + } + } + + public enum ObjectVersionStorageClass: String, CustomStringConvertible { + case standard = "STANDARD" + public var description: String { return self.rawValue } + } + + public struct DeleteBucketRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public enum FilterRuleName: String, CustomStringConvertible { + case prefix = "prefix" + case suffix = "suffix" + public var description: String { return self.rawValue } + } + + public enum RequestPayer: String, CustomStringConvertible { + case requester = "requester" + public var description: String { return self.rawValue } + } + + public struct StorageClassAnalysis: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "DataExport", required: false, type: .structure) + ] + /// A container used to describe how data related to the storage class analysis should be exported. + public let dataExport: StorageClassAnalysisDataExport? + + public init(dataExport: StorageClassAnalysisDataExport? = nil) { + self.dataExport = dataExport + } + + public init(dictionary: [String: Any]) throws { + if let dataExport = dictionary["DataExport"] as? [String: Any] { self.dataExport = try S3.StorageClassAnalysisDataExport(dictionary: dataExport) } else { self.dataExport = nil } + } + } + + public struct GetBucketNotificationConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + /// Name of the bucket to get the notification configuration for. + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct CommonPrefix: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Prefix", required: false, type: .string) + ] + public let prefix: String? + + public init(prefix: String? = nil) { + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + self.prefix = dictionary["Prefix"] as? String + } + } + + public enum ExpirationStatus: String, CustomStringConvertible { + case enabled = "Enabled" + case disabled = "Disabled" + public var description: String { return self.rawValue } + } + + public struct GetObjectTorrentRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum) + ] + public let bucket: String + public let key: String + public let requestPayer: RequestPayer? + + public init(bucket: String, key: String, requestPayer: RequestPayer? = nil) { + self.bucket = bucket + self.key = key + self.requestPayer = requestPayer + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + } + } + + public struct InventoryS3BucketDestination: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", required: true, type: .string), + AWSShapeProperty(label: "Format", required: true, type: .enum), + AWSShapeProperty(label: "AccountId", required: false, type: .string), + AWSShapeProperty(label: "Prefix", required: false, type: .string) + ] + /// The Amazon resource name (ARN) of the bucket where inventory results will be published. + public let bucket: String + /// Specifies the output format of the inventory results. + public let format: InventoryFormat + /// The ID of the account that owns the destination bucket. + public let accountId: String? + /// The prefix that is prepended to all inventory results. + public let prefix: String? + + public init(bucket: String, format: InventoryFormat, accountId: String? = nil, prefix: String? = nil) { + self.bucket = bucket + self.format = format + self.accountId = accountId + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let rawFormat = dictionary["Format"] as? String, let format = InventoryFormat(rawValue: rawFormat) else { throw InitializableError.missingRequiredParam("Format") } + self.format = format + self.accountId = dictionary["AccountId"] as? String + self.prefix = dictionary["Prefix"] as? String + } + } + + public struct GetObjectAclRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "VersionId", location: .querystring(locationName: "versionId"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum) + ] + public let bucket: String + /// VersionId used to reference a specific version of the object. + public let versionId: String? + public let key: String + public let requestPayer: RequestPayer? + + public init(bucket: String, versionId: String? = nil, key: String, requestPayer: RequestPayer? = nil) { + self.bucket = bucket + self.versionId = versionId + self.key = key + self.requestPayer = requestPayer + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.versionId = dictionary["versionId"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + } + } + + public struct AccessControlPolicy: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Owner", required: false, type: .structure), + AWSShapeProperty(label: "Grants", location: .body(locationName: "AccessControlList"), required: false, type: .structure) + ] + public let owner: Owner? + /// A list of grants. + public let grants: Grants? + + public init(owner: Owner? = nil, grants: Grants? = nil) { + self.owner = owner + self.grants = grants + } + + public init(dictionary: [String: Any]) throws { + if let owner = dictionary["Owner"] as? [String: Any] { self.owner = try S3.Owner(dictionary: owner) } else { self.owner = nil } + if let grants = dictionary["AccessControlList"] as? [String: Any] { self.grants = try S3.Grants(dictionary: grants) } else { self.grants = nil } + } + } + + public struct DeleteBucketLifecycleRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct CreateBucketOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Location", location: .header(locationName: "Location"), required: false, type: .string) + ] + public let location: String? + + public init(location: String? = nil) { + self.location = location + } + + public init(dictionary: [String: Any]) throws { + self.location = dictionary["Location"] as? String + } + } + + public enum Payer: String, CustomStringConvertible { + case requester = "Requester" + case bucketowner = "BucketOwner" + public var description: String { return self.rawValue } + } + + public struct DeleteBucketInventoryConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Id", location: .querystring(locationName: "id"), required: true, type: .string) + ] + /// The name of the bucket containing the inventory configuration to delete. + public let bucket: String + /// The ID used to identify the inventory configuration. + public let id: String + + public init(bucket: String, id: String) { + self.bucket = bucket + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let id = dictionary["id"] as? String else { throw InitializableError.missingRequiredParam("id") } + self.id = id + } + } + + public struct GetBucketWebsiteOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "RoutingRules", required: false, type: .structure), + AWSShapeProperty(label: "IndexDocument", required: false, type: .structure), + AWSShapeProperty(label: "ErrorDocument", required: false, type: .structure), + AWSShapeProperty(label: "RedirectAllRequestsTo", required: false, type: .structure) + ] + public let routingRules: RoutingRules? + public let indexDocument: IndexDocument? + public let errorDocument: ErrorDocument? + public let redirectAllRequestsTo: RedirectAllRequestsTo? + + public init(routingRules: RoutingRules? = nil, indexDocument: IndexDocument? = nil, errorDocument: ErrorDocument? = nil, redirectAllRequestsTo: RedirectAllRequestsTo? = nil) { + self.routingRules = routingRules + self.indexDocument = indexDocument + self.errorDocument = errorDocument + self.redirectAllRequestsTo = redirectAllRequestsTo + } + + public init(dictionary: [String: Any]) throws { + if let routingRules = dictionary["RoutingRules"] as? [String: Any] { self.routingRules = try S3.RoutingRules(dictionary: routingRules) } else { self.routingRules = nil } + if let indexDocument = dictionary["IndexDocument"] as? [String: Any] { self.indexDocument = try S3.IndexDocument(dictionary: indexDocument) } else { self.indexDocument = nil } + if let errorDocument = dictionary["ErrorDocument"] as? [String: Any] { self.errorDocument = try S3.ErrorDocument(dictionary: errorDocument) } else { self.errorDocument = nil } + if let redirectAllRequestsTo = dictionary["RedirectAllRequestsTo"] as? [String: Any] { self.redirectAllRequestsTo = try S3.RedirectAllRequestsTo(dictionary: redirectAllRequestsTo) } else { self.redirectAllRequestsTo = nil } + } + } + + public struct LoggingEnabled: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "TargetGrants", required: false, type: .structure), + AWSShapeProperty(label: "TargetPrefix", required: false, type: .string), + AWSShapeProperty(label: "TargetBucket", required: false, type: .string) + ] + public let targetGrants: TargetGrants? + /// This element lets you specify a prefix for the keys that the log files will be stored under. + public let targetPrefix: String? + /// Specifies the bucket where you want Amazon S3 to store server access logs. You can have your logs delivered to any bucket that you own, including the same bucket that is being logged. You can also configure multiple buckets to deliver their logs to the same target bucket. In this case you should choose a different TargetPrefix for each source bucket so that the delivered log files can be distinguished by key. + public let targetBucket: String? + + public init(targetGrants: TargetGrants? = nil, targetPrefix: String? = nil, targetBucket: String? = nil) { + self.targetGrants = targetGrants + self.targetPrefix = targetPrefix + self.targetBucket = targetBucket + } + + public init(dictionary: [String: Any]) throws { + if let targetGrants = dictionary["TargetGrants"] as? [String: Any] { self.targetGrants = try S3.TargetGrants(dictionary: targetGrants) } else { self.targetGrants = nil } + self.targetPrefix = dictionary["TargetPrefix"] as? String + self.targetBucket = dictionary["TargetBucket"] as? String + } + } + + public struct CORSConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "CORSRules", location: .body(locationName: "CORSRule"), required: true, type: .list) + ] + public let cORSRules: [CORSRule] + + public init(cORSRules: [CORSRule]) { + self.cORSRules = cORSRules + } + + public init(dictionary: [String: Any]) throws { + guard let cORSRules = dictionary["CORSRule"] as? [[String: Any]] else { throw InitializableError.missingRequiredParam("CORSRule") } + self.cORSRules = try cORSRules.map({ try CORSRule(dictionary: $0) }) + } + } + + public struct ObjectIdentifier: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "VersionId", required: false, type: .string), + AWSShapeProperty(label: "Key", required: true, type: .string) + ] + /// VersionId for the specific version of the object to delete. + public let versionId: String? + /// Key name of the object to delete. + public let key: String + + public init(versionId: String? = nil, key: String) { + self.versionId = versionId + self.key = key + } + + public init(dictionary: [String: Any]) throws { + self.versionId = dictionary["VersionId"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + } + } + + public struct StorageClassAnalysisDataExport: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Destination", required: true, type: .structure), + AWSShapeProperty(label: "OutputSchemaVersion", required: true, type: .enum) + ] + /// The place to store the data for an analysis. + public let destination: AnalyticsExportDestination + /// The version of the output schema to use when exporting data. Must be V_1. + public let outputSchemaVersion: StorageClassAnalysisSchemaVersion + + public init(destination: AnalyticsExportDestination, outputSchemaVersion: StorageClassAnalysisSchemaVersion) { + self.destination = destination + self.outputSchemaVersion = outputSchemaVersion + } + + public init(dictionary: [String: Any]) throws { + guard let destination = dictionary["Destination"] as? [String: Any] else { throw InitializableError.missingRequiredParam("Destination") } + self.destination = try S3.AnalyticsExportDestination(dictionary: destination) + guard let rawOutputSchemaVersion = dictionary["OutputSchemaVersion"] as? String, let outputSchemaVersion = StorageClassAnalysisSchemaVersion(rawValue: rawOutputSchemaVersion) else { throw InitializableError.missingRequiredParam("OutputSchemaVersion") } + self.outputSchemaVersion = outputSchemaVersion + } + } + + public struct Tag: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Value", required: true, type: .string), + AWSShapeProperty(label: "Key", required: true, type: .string) + ] + /// Value of the tag. + public let value: String + /// Name of the tag. + public let key: String + + public init(value: String, key: String) { + self.value = value + self.key = key + } + + public init(dictionary: [String: Any]) throws { + guard let value = dictionary["Value"] as? String else { throw InitializableError.missingRequiredParam("Value") } + self.value = value + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + } + } + + public struct TargetGrants: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Grant", required: false, type: .list) + ] + public let grant: [TargetGrant]? + + public init(grant: [TargetGrant]? = nil) { + self.grant = grant + } + + public init(dictionary: [String: Any]) throws { + if let grant = dictionary["Grant"] as? [[String: Any]] { + self.grant = try grant.map({ try TargetGrant(dictionary: $0) }) + } else { + self.grant = nil + } + } + } + + public struct RestoreObjectOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum) + ] + public let requestCharged: RequestCharged? + + public init(requestCharged: RequestCharged? = nil) { + self.requestCharged = requestCharged + } + + public init(dictionary: [String: Any]) throws { + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + } + } + + public enum MetadataDirective: String, CustomStringConvertible { + case copy = "COPY" + case replace = "REPLACE" + public var description: String { return self.rawValue } + } + + public struct BucketLifecycleConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Rules", location: .body(locationName: "Rule"), required: true, type: .list) + ] + public let rules: [LifecycleRule] + + public init(rules: [LifecycleRule]) { + self.rules = rules + } + + public init(dictionary: [String: Any]) throws { + guard let rules = dictionary["Rule"] as? [[String: Any]] else { throw InitializableError.missingRequiredParam("Rule") } + self.rules = try rules.map({ try LifecycleRule(dictionary: $0) }) + } + } + + public struct GetBucketMetricsConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Id", location: .querystring(locationName: "id"), required: true, type: .string) + ] + /// The name of the bucket containing the metrics configuration to retrieve. + public let bucket: String + /// The ID used to identify the metrics configuration. + public let id: String + + public init(bucket: String, id: String) { + self.bucket = bucket + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let id = dictionary["id"] as? String else { throw InitializableError.missingRequiredParam("id") } + self.id = id + } + } + + public struct LifecycleRule: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ID", required: false, type: .string), + AWSShapeProperty(label: "Status", required: true, type: .enum), + AWSShapeProperty(label: "NoncurrentVersionExpiration", required: false, type: .structure), + AWSShapeProperty(label: "AbortIncompleteMultipartUpload", required: false, type: .structure), + AWSShapeProperty(label: "Expiration", required: false, type: .structure), + AWSShapeProperty(label: "Prefix", required: false, type: .string), + AWSShapeProperty(label: "Transitions", location: .body(locationName: "Transition"), required: false, type: .list), + AWSShapeProperty(label: "Filter", required: false, type: .structure), + AWSShapeProperty(label: "NoncurrentVersionTransitions", location: .body(locationName: "NoncurrentVersionTransition"), required: false, type: .list) + ] + /// Unique identifier for the rule. The value cannot be longer than 255 characters. + public let iD: String? + /// If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is not currently being applied. + public let status: ExpirationStatus + public let noncurrentVersionExpiration: NoncurrentVersionExpiration? + public let abortIncompleteMultipartUpload: AbortIncompleteMultipartUpload? + public let expiration: LifecycleExpiration? + /// Prefix identifying one or more objects to which the rule applies. This is deprecated; use Filter instead. + public let prefix: String? + public let transitions: [Transition]? + public let filter: LifecycleRuleFilter? + public let noncurrentVersionTransitions: [NoncurrentVersionTransition]? + + public init(iD: String? = nil, status: ExpirationStatus, noncurrentVersionExpiration: NoncurrentVersionExpiration? = nil, abortIncompleteMultipartUpload: AbortIncompleteMultipartUpload? = nil, expiration: LifecycleExpiration? = nil, prefix: String? = nil, transitions: [Transition]? = nil, filter: LifecycleRuleFilter? = nil, noncurrentVersionTransitions: [NoncurrentVersionTransition]? = nil) { + self.iD = iD + self.status = status + self.noncurrentVersionExpiration = noncurrentVersionExpiration + self.abortIncompleteMultipartUpload = abortIncompleteMultipartUpload + self.expiration = expiration + self.prefix = prefix + self.transitions = transitions + self.filter = filter + self.noncurrentVersionTransitions = noncurrentVersionTransitions + } + + public init(dictionary: [String: Any]) throws { + self.iD = dictionary["ID"] as? String + guard let rawStatus = dictionary["Status"] as? String, let status = ExpirationStatus(rawValue: rawStatus) else { throw InitializableError.missingRequiredParam("Status") } + self.status = status + if let noncurrentVersionExpiration = dictionary["NoncurrentVersionExpiration"] as? [String: Any] { self.noncurrentVersionExpiration = try S3.NoncurrentVersionExpiration(dictionary: noncurrentVersionExpiration) } else { self.noncurrentVersionExpiration = nil } + if let abortIncompleteMultipartUpload = dictionary["AbortIncompleteMultipartUpload"] as? [String: Any] { self.abortIncompleteMultipartUpload = try S3.AbortIncompleteMultipartUpload(dictionary: abortIncompleteMultipartUpload) } else { self.abortIncompleteMultipartUpload = nil } + if let expiration = dictionary["Expiration"] as? [String: Any] { self.expiration = try S3.LifecycleExpiration(dictionary: expiration) } else { self.expiration = nil } + self.prefix = dictionary["Prefix"] as? String + if let transitions = dictionary["Transition"] as? [[String: Any]] { + self.transitions = try transitions.map({ try Transition(dictionary: $0) }) + } else { + self.transitions = nil + } + if let filter = dictionary["Filter"] as? [String: Any] { self.filter = try S3.LifecycleRuleFilter(dictionary: filter) } else { self.filter = nil } + if let noncurrentVersionTransitions = dictionary["NoncurrentVersionTransition"] as? [[String: Any]] { + self.noncurrentVersionTransitions = try noncurrentVersionTransitions.map({ try NoncurrentVersionTransition(dictionary: $0) }) + } else { + self.noncurrentVersionTransitions = nil + } + } + } + + public struct InventoryOptionalFields: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Field", required: false, type: .list) + ] + public let field: [InventoryOptionalField]? + + public init(field: [InventoryOptionalField]? = nil) { + self.field = field + } + + public init(dictionary: [String: Any]) throws { + if let field = dictionary["Field"] as? [String] { self.field = field.flatMap({ InventoryOptionalField(rawValue: $0)}) } else { self.field = nil } + } + } + + public struct GetBucketCorsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct Bucket: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Name", required: false, type: .string), + AWSShapeProperty(label: "CreationDate", required: false, type: .timestamp) + ] + /// The name of the bucket. + public let name: String? + /// Date the bucket was created. + public let creationDate: String? + + public init(name: String? = nil, creationDate: String? = nil) { + self.name = name + self.creationDate = creationDate + } + + public init(dictionary: [String: Any]) throws { + self.name = dictionary["Name"] as? String + self.creationDate = dictionary["CreationDate"] as? String + } + } + + public struct Destination: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", required: true, type: .string), + AWSShapeProperty(label: "StorageClass", required: false, type: .enum) + ] + /// Amazon resource name (ARN) of the bucket where you want Amazon S3 to store replicas of the object identified by the rule. + public let bucket: String + /// The class of storage used to store the object. + public let storageClass: StorageClass? + + public init(bucket: String, storageClass: StorageClass? = nil) { + self.bucket = bucket + self.storageClass = storageClass + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + if let storageClass = dictionary["StorageClass"] as? String { self.storageClass = StorageClass(rawValue: storageClass) } else { self.storageClass = nil } + } + } + + public struct GlacierJobParameters: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Tier", required: true, type: .enum) + ] + /// Glacier retrieval tier at which the restore will be processed. + public let tier: Tier + + public init(tier: Tier) { + self.tier = tier + } + + public init(dictionary: [String: Any]) throws { + guard let rawTier = dictionary["Tier"] as? String, let tier = Tier(rawValue: rawTier) else { throw InitializableError.missingRequiredParam("Tier") } + self.tier = tier + } + } + + public struct PutBucketNotificationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "NotificationConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "NotificationConfiguration", location: .body(locationName: "NotificationConfiguration"), required: true, type: .structure) + ] + public let contentMD5: String? + public let bucket: String + public let notificationConfiguration: NotificationConfigurationDeprecated + + public init(contentMD5: String? = nil, bucket: String, notificationConfiguration: NotificationConfigurationDeprecated) { + self.contentMD5 = contentMD5 + self.bucket = bucket + self.notificationConfiguration = notificationConfiguration + } + + public init(dictionary: [String: Any]) throws { + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let notificationConfiguration = dictionary["NotificationConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("NotificationConfiguration") } + self.notificationConfiguration = try S3.NotificationConfigurationDeprecated(dictionary: notificationConfiguration) + } + } + + public struct CompleteMultipartUploadRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "MultipartUpload" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "MultipartUpload", location: .body(locationName: "CompleteMultipartUpload"), required: false, type: .structure), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "UploadId", location: .querystring(locationName: "uploadId"), required: true, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum) + ] + public let bucket: String + public let multipartUpload: CompletedMultipartUpload? + public let key: String + public let uploadId: String + public let requestPayer: RequestPayer? + + public init(bucket: String, multipartUpload: CompletedMultipartUpload? = nil, key: String, uploadId: String, requestPayer: RequestPayer? = nil) { + self.bucket = bucket + self.multipartUpload = multipartUpload + self.key = key + self.uploadId = uploadId + self.requestPayer = requestPayer + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + if let multipartUpload = dictionary["CompleteMultipartUpload"] as? [String: Any] { self.multipartUpload = try S3.CompletedMultipartUpload(dictionary: multipartUpload) } else { self.multipartUpload = nil } + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + guard let uploadId = dictionary["uploadId"] as? String else { throw InitializableError.missingRequiredParam("uploadId") } + self.uploadId = uploadId + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + } + } + + public struct PutBucketMetricsConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "MetricsConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "MetricsConfiguration", location: .body(locationName: "MetricsConfiguration"), required: true, type: .structure), + AWSShapeProperty(label: "Id", location: .querystring(locationName: "id"), required: true, type: .string) + ] + /// The name of the bucket for which the metrics configuration is set. + public let bucket: String + /// Specifies the metrics configuration. + public let metricsConfiguration: MetricsConfiguration + /// The ID used to identify the metrics configuration. + public let id: String + + public init(bucket: String, metricsConfiguration: MetricsConfiguration, id: String) { + self.bucket = bucket + self.metricsConfiguration = metricsConfiguration + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let metricsConfiguration = dictionary["MetricsConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("MetricsConfiguration") } + self.metricsConfiguration = try S3.MetricsConfiguration(dictionary: metricsConfiguration) + guard let id = dictionary["id"] as? String else { throw InitializableError.missingRequiredParam("id") } + self.id = id + } + } + + public struct Part: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "LastModified", required: false, type: .timestamp), + AWSShapeProperty(label: "PartNumber", required: false, type: .integer), + AWSShapeProperty(label: "ETag", required: false, type: .string), + AWSShapeProperty(label: "Size", required: false, type: .integer) + ] + /// Date and time at which the part was uploaded. + public let lastModified: String? + /// Part number identifying the part. This is a positive integer between 1 and 10,000. + public let partNumber: Int32? + /// Entity tag returned when the part was uploaded. + public let eTag: String? + /// Size of the uploaded part data. + public let size: Int32? + + public init(lastModified: String? = nil, partNumber: Int32? = nil, eTag: String? = nil, size: Int32? = nil) { + self.lastModified = lastModified + self.partNumber = partNumber + self.eTag = eTag + self.size = size + } + + public init(dictionary: [String: Any]) throws { + self.lastModified = dictionary["LastModified"] as? String + self.partNumber = dictionary["PartNumber"] as? Int32 + self.eTag = dictionary["ETag"] as? String + self.size = dictionary["Size"] as? Int32 + } + } + + public struct ListBucketsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Buckets", required: false, type: .structure), + AWSShapeProperty(label: "Owner", required: false, type: .structure) + ] + public let buckets: Buckets? + public let owner: Owner? + + public init(buckets: Buckets? = nil, owner: Owner? = nil) { + self.buckets = buckets + self.owner = owner + } + + public init(dictionary: [String: Any]) throws { + if let buckets = dictionary["Buckets"] as? [String: Any] { self.buckets = try S3.Buckets(dictionary: buckets) } else { self.buckets = nil } + if let owner = dictionary["Owner"] as? [String: Any] { self.owner = try S3.Owner(dictionary: owner) } else { self.owner = nil } + } + } + + public struct GetBucketAccelerateConfigurationOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Status", required: false, type: .enum) + ] + /// The accelerate configuration of the bucket. + public let status: BucketAccelerateStatus? + + public init(status: BucketAccelerateStatus? = nil) { + self.status = status + } + + public init(dictionary: [String: Any]) throws { + if let status = dictionary["Status"] as? String { self.status = BucketAccelerateStatus(rawValue: status) } else { self.status = nil } + } + } + + public struct CopyPartResult: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ETag", required: false, type: .string), + AWSShapeProperty(label: "LastModified", required: false, type: .timestamp) + ] + /// Entity tag of the object. + public let eTag: String? + /// Date and time at which the object was uploaded. + public let lastModified: String? + + public init(eTag: String? = nil, lastModified: String? = nil) { + self.eTag = eTag + self.lastModified = lastModified + } + + public init(dictionary: [String: Any]) throws { + self.eTag = dictionary["ETag"] as? String + self.lastModified = dictionary["LastModified"] as? String + } + } + + public struct NoncurrentVersionExpiration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "NoncurrentDays", required: false, type: .integer) + ] + /// Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action. For information about the noncurrent days calculations, see How Amazon S3 Calculates When an Object Became Noncurrent in the Amazon Simple Storage Service Developer Guide. + public let noncurrentDays: Int32? + + public init(noncurrentDays: Int32? = nil) { + self.noncurrentDays = noncurrentDays + } + + public init(dictionary: [String: Any]) throws { + self.noncurrentDays = dictionary["NoncurrentDays"] as? Int32 + } + } + + public struct AnalyticsExportDestination: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "S3BucketDestination", required: true, type: .structure) + ] + /// A destination signifying output to an S3 bucket. + public let s3BucketDestination: AnalyticsS3BucketDestination + + public init(s3BucketDestination: AnalyticsS3BucketDestination) { + self.s3BucketDestination = s3BucketDestination + } + + public init(dictionary: [String: Any]) throws { + guard let s3BucketDestination = dictionary["S3BucketDestination"] as? [String: Any] else { throw InitializableError.missingRequiredParam("S3BucketDestination") } + self.s3BucketDestination = try S3.AnalyticsS3BucketDestination(dictionary: s3BucketDestination) + } + } + + public enum InventoryFormat: String, CustomStringConvertible { + case csv = "CSV" + public var description: String { return self.rawValue } + } + + public struct FilterRule: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Value", required: false, type: .string), + AWSShapeProperty(label: "Name", required: false, type: .enum) + ] + public let value: String? + /// Object key name prefix or suffix identifying one or more objects to which the filtering rule applies. Maximum prefix length can be up to 1,024 characters. Overlapping prefixes and suffixes are not supported. For more information, go to Configuring Event Notifications in the Amazon Simple Storage Service Developer Guide. + public let name: FilterRuleName? + + public init(value: String? = nil, name: FilterRuleName? = nil) { + self.value = value + self.name = name + } + + public init(dictionary: [String: Any]) throws { + self.value = dictionary["Value"] as? String + if let name = dictionary["Name"] as? String { self.name = FilterRuleName(rawValue: name) } else { self.name = nil } + } + } + + public enum `Type`: String, CustomStringConvertible { + case canonicaluser = "CanonicalUser" + case amazoncustomerbyemail = "AmazonCustomerByEmail" + case group = "Group" + public var description: String { return self.rawValue } + } + + public struct ListBucketInventoryConfigurationsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "ContinuationToken", location: .querystring(locationName: "continuation-token"), required: false, type: .string) + ] + /// The name of the bucket containing the inventory configurations to retrieve. + public let bucket: String + /// The marker used to continue an inventory configuration listing that has been truncated. Use the NextContinuationToken from a previously truncated list response to continue the listing. The continuation token is an opaque value that Amazon S3 understands. + public let continuationToken: String? + + public init(bucket: String, continuationToken: String? = nil) { + self.bucket = bucket + self.continuationToken = continuationToken + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.continuationToken = dictionary["continuation-token"] as? String + } + } + + public struct PutBucketPolicyRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "Policy" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Policy", required: true, type: .string) + ] + public let contentMD5: String? + public let bucket: String + /// The bucket policy as a JSON document. + public let policy: String + + public init(contentMD5: String? = nil, bucket: String, policy: String) { + self.contentMD5 = contentMD5 + self.bucket = bucket + self.policy = policy + } + + public init(dictionary: [String: Any]) throws { + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let policy = dictionary["Policy"] as? String else { throw InitializableError.missingRequiredParam("Policy") } + self.policy = policy + } + } + + public struct GetObjectRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "SSECustomerKey", location: .header(locationName: "x-amz-server-side-encryption-customer-key"), required: false, type: .string), + AWSShapeProperty(label: "IfUnmodifiedSince", location: .header(locationName: "If-Unmodified-Since"), required: false, type: .timestamp), + AWSShapeProperty(label: "PartNumber", location: .querystring(locationName: "partNumber"), required: false, type: .integer), + AWSShapeProperty(label: "Range", location: .header(locationName: "Range"), required: false, type: .string), + AWSShapeProperty(label: "ResponseContentEncoding", location: .querystring(locationName: "response-content-encoding"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "ResponseContentLanguage", location: .querystring(locationName: "response-content-language"), required: false, type: .string), + AWSShapeProperty(label: "ResponseExpires", location: .querystring(locationName: "response-expires"), required: false, type: .timestamp), + AWSShapeProperty(label: "VersionId", location: .querystring(locationName: "versionId"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "IfNoneMatch", location: .header(locationName: "If-None-Match"), required: false, type: .string), + AWSShapeProperty(label: "ResponseContentDisposition", location: .querystring(locationName: "response-content-disposition"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "ResponseCacheControl", location: .querystring(locationName: "response-cache-control"), required: false, type: .string), + AWSShapeProperty(label: "ResponseContentType", location: .querystring(locationName: "response-content-type"), required: false, type: .string), + AWSShapeProperty(label: "IfModifiedSince", location: .header(locationName: "If-Modified-Since"), required: false, type: .timestamp), + AWSShapeProperty(label: "IfMatch", location: .header(locationName: "If-Match"), required: false, type: .string) + ] + public let bucket: String + /// Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header. + public let sSECustomerKey: String? + /// Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition failed). + public let ifUnmodifiedSince: String? + /// Part number of the object being read. This is a positive integer between 1 and 10,000. Effectively performs a 'ranged' GET request for the part specified. Useful for downloading just a part of an object. + public let partNumber: Int32? + /// Downloads the specified range bytes of an object. For more information about the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. + public let range: String? + /// Sets the Content-Encoding header of the response. + public let responseContentEncoding: String? + public let requestPayer: RequestPayer? + /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error. + public let sSECustomerKeyMD5: String? + /// Sets the Content-Language header of the response. + public let responseContentLanguage: String? + /// Sets the Expires header of the response. + public let responseExpires: String? + /// VersionId used to reference a specific version of the object. + public let versionId: String? + /// Specifies the algorithm to use to when encrypting the object (e.g., AES256). + public let sSECustomerAlgorithm: String? + /// Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not modified). + public let ifNoneMatch: String? + /// Sets the Content-Disposition header of the response + public let responseContentDisposition: String? + public let key: String + /// Sets the Cache-Control header of the response. + public let responseCacheControl: String? + /// Sets the Content-Type header of the response. + public let responseContentType: String? + /// Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified). + public let ifModifiedSince: String? + /// Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412 (precondition failed). + public let ifMatch: String? + + public init(bucket: String, sSECustomerKey: String? = nil, ifUnmodifiedSince: String? = nil, partNumber: Int32? = nil, range: String? = nil, responseContentEncoding: String? = nil, requestPayer: RequestPayer? = nil, sSECustomerKeyMD5: String? = nil, responseContentLanguage: String? = nil, responseExpires: String? = nil, versionId: String? = nil, sSECustomerAlgorithm: String? = nil, ifNoneMatch: String? = nil, responseContentDisposition: String? = nil, key: String, responseCacheControl: String? = nil, responseContentType: String? = nil, ifModifiedSince: String? = nil, ifMatch: String? = nil) { + self.bucket = bucket + self.sSECustomerKey = sSECustomerKey + self.ifUnmodifiedSince = ifUnmodifiedSince + self.partNumber = partNumber + self.range = range + self.responseContentEncoding = responseContentEncoding + self.requestPayer = requestPayer + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.responseContentLanguage = responseContentLanguage + self.responseExpires = responseExpires + self.versionId = versionId + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.ifNoneMatch = ifNoneMatch + self.responseContentDisposition = responseContentDisposition + self.key = key + self.responseCacheControl = responseCacheControl + self.responseContentType = responseContentType + self.ifModifiedSince = ifModifiedSince + self.ifMatch = ifMatch + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.sSECustomerKey = dictionary["x-amz-server-side-encryption-customer-key"] as? String + self.ifUnmodifiedSince = dictionary["If-Unmodified-Since"] as? String + self.partNumber = dictionary["partNumber"] as? Int32 + self.range = dictionary["Range"] as? String + self.responseContentEncoding = dictionary["response-content-encoding"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.responseContentLanguage = dictionary["response-content-language"] as? String + self.responseExpires = dictionary["response-expires"] as? String + self.versionId = dictionary["versionId"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + self.ifNoneMatch = dictionary["If-None-Match"] as? String + self.responseContentDisposition = dictionary["response-content-disposition"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.responseCacheControl = dictionary["response-cache-control"] as? String + self.responseContentType = dictionary["response-content-type"] as? String + self.ifModifiedSince = dictionary["If-Modified-Since"] as? String + self.ifMatch = dictionary["If-Match"] as? String + } + } + + public struct AbortMultipartUploadRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "UploadId", location: .querystring(locationName: "uploadId"), required: true, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum) + ] + public let bucket: String + public let key: String + public let uploadId: String + public let requestPayer: RequestPayer? + + public init(bucket: String, key: String, uploadId: String, requestPayer: RequestPayer? = nil) { + self.bucket = bucket + self.key = key + self.uploadId = uploadId + self.requestPayer = requestPayer + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + guard let uploadId = dictionary["uploadId"] as? String else { throw InitializableError.missingRequiredParam("uploadId") } + self.uploadId = uploadId + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + } + } + + public struct GetObjectTorrentOutput: AWSShape { + /// The key for the payload + public static let payload: String? = "Body" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Body", required: false, type: .blob), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum) + ] + public let body: Data? + public let requestCharged: RequestCharged? + + public init(body: Data? = nil, requestCharged: RequestCharged? = nil) { + self.body = body + self.requestCharged = requestCharged + } + + public init(dictionary: [String: Any]) throws { + self.body = dictionary["Body"] as? Data + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + } + } + + public enum MFADelete: String, CustomStringConvertible { + case enabled = "Enabled" + case disabled = "Disabled" + public var description: String { return self.rawValue } + } + + public struct NoncurrentVersionTransition: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "NoncurrentDays", required: false, type: .integer), + AWSShapeProperty(label: "StorageClass", required: false, type: .enum) + ] + /// Specifies the number of days an object is noncurrent before Amazon S3 can perform the associated action. For information about the noncurrent days calculations, see How Amazon S3 Calculates When an Object Became Noncurrent in the Amazon Simple Storage Service Developer Guide. + public let noncurrentDays: Int32? + /// The class of storage used to store the object. + public let storageClass: TransitionStorageClass? + + public init(noncurrentDays: Int32? = nil, storageClass: TransitionStorageClass? = nil) { + self.noncurrentDays = noncurrentDays + self.storageClass = storageClass + } + + public init(dictionary: [String: Any]) throws { + self.noncurrentDays = dictionary["NoncurrentDays"] as? Int32 + if let storageClass = dictionary["StorageClass"] as? String { self.storageClass = TransitionStorageClass(rawValue: storageClass) } else { self.storageClass = nil } + } + } + + public struct UploadPartCopyRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "SSECustomerKey", location: .header(locationName: "x-amz-server-side-encryption-customer-key"), required: false, type: .string), + AWSShapeProperty(label: "PartNumber", location: .querystring(locationName: "partNumber"), required: true, type: .integer), + AWSShapeProperty(label: "CopySourceIfModifiedSince", location: .header(locationName: "x-amz-copy-source-if-modified-since"), required: false, type: .timestamp), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceSSECustomerKey", location: .header(locationName: "x-amz-copy-source-server-side-encryption-customer-key"), required: false, type: .string), + AWSShapeProperty(label: "CopySource", location: .header(locationName: "x-amz-copy-source"), required: true, type: .string), + AWSShapeProperty(label: "CopySourceIfNoneMatch", location: .header(locationName: "x-amz-copy-source-if-none-match"), required: false, type: .string), + AWSShapeProperty(label: "UploadId", location: .querystring(locationName: "uploadId"), required: true, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceIfMatch", location: .header(locationName: "x-amz-copy-source-if-match"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceRange", location: .header(locationName: "x-amz-copy-source-range"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "CopySourceSSECustomerKeyMD5", location: .header(locationName: "x-amz-copy-source-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceSSECustomerAlgorithm", location: .header(locationName: "x-amz-copy-source-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceIfUnmodifiedSince", location: .header(locationName: "x-amz-copy-source-if-unmodified-since"), required: false, type: .timestamp) + ] + public let bucket: String + /// Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header. This must be the same encryption key specified in the initiate multipart upload request. + public let sSECustomerKey: String? + /// Part number of part being copied. This is a positive integer between 1 and 10,000. + public let partNumber: Int32 + /// Copies the object if it has been modified since the specified time. + public let copySourceIfModifiedSince: String? + public let requestPayer: RequestPayer? + /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error. + public let sSECustomerKeyMD5: String? + /// Specifies the customer-provided encryption key for Amazon S3 to use to decrypt the source object. The encryption key provided in this header must be one that was used when the source object was created. + public let copySourceSSECustomerKey: String? + /// The name of the source bucket and key name of the source object, separated by a slash (/). Must be URL-encoded. + public let copySource: String + /// Copies the object if its entity tag (ETag) is different than the specified ETag. + public let copySourceIfNoneMatch: String? + /// Upload ID identifying the multipart upload whose part is being copied. + public let uploadId: String + /// Specifies the algorithm to use to when encrypting the object (e.g., AES256). + public let sSECustomerAlgorithm: String? + /// Copies the object if its entity tag (ETag) matches the specified tag. + public let copySourceIfMatch: String? + /// The range of bytes to copy from the source object. The range value must use the form bytes=first-last, where the first and last are the zero-based byte offsets to copy. For example, bytes=0-9 indicates that you want to copy the first ten bytes of the source. You can copy a range only if the source object is greater than 5 GB. + public let copySourceRange: String? + public let key: String + /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error. + public let copySourceSSECustomerKeyMD5: String? + /// Specifies the algorithm to use when decrypting the source object (e.g., AES256). + public let copySourceSSECustomerAlgorithm: String? + /// Copies the object if it hasn't been modified since the specified time. + public let copySourceIfUnmodifiedSince: String? + + public init(bucket: String, sSECustomerKey: String? = nil, partNumber: Int32, copySourceIfModifiedSince: String? = nil, requestPayer: RequestPayer? = nil, sSECustomerKeyMD5: String? = nil, copySourceSSECustomerKey: String? = nil, copySource: String, copySourceIfNoneMatch: String? = nil, uploadId: String, sSECustomerAlgorithm: String? = nil, copySourceIfMatch: String? = nil, copySourceRange: String? = nil, key: String, copySourceSSECustomerKeyMD5: String? = nil, copySourceSSECustomerAlgorithm: String? = nil, copySourceIfUnmodifiedSince: String? = nil) { + self.bucket = bucket + self.sSECustomerKey = sSECustomerKey + self.partNumber = partNumber + self.copySourceIfModifiedSince = copySourceIfModifiedSince + self.requestPayer = requestPayer + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.copySourceSSECustomerKey = copySourceSSECustomerKey + self.copySource = copySource + self.copySourceIfNoneMatch = copySourceIfNoneMatch + self.uploadId = uploadId + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.copySourceIfMatch = copySourceIfMatch + self.copySourceRange = copySourceRange + self.key = key + self.copySourceSSECustomerKeyMD5 = copySourceSSECustomerKeyMD5 + self.copySourceSSECustomerAlgorithm = copySourceSSECustomerAlgorithm + self.copySourceIfUnmodifiedSince = copySourceIfUnmodifiedSince + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.sSECustomerKey = dictionary["x-amz-server-side-encryption-customer-key"] as? String + guard let partNumber = dictionary["partNumber"] as? Int32 else { throw InitializableError.missingRequiredParam("partNumber") } + self.partNumber = partNumber + self.copySourceIfModifiedSince = dictionary["x-amz-copy-source-if-modified-since"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.copySourceSSECustomerKey = dictionary["x-amz-copy-source-server-side-encryption-customer-key"] as? String + guard let copySource = dictionary["x-amz-copy-source"] as? String else { throw InitializableError.missingRequiredParam("x-amz-copy-source") } + self.copySource = copySource + self.copySourceIfNoneMatch = dictionary["x-amz-copy-source-if-none-match"] as? String + guard let uploadId = dictionary["uploadId"] as? String else { throw InitializableError.missingRequiredParam("uploadId") } + self.uploadId = uploadId + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + self.copySourceIfMatch = dictionary["x-amz-copy-source-if-match"] as? String + self.copySourceRange = dictionary["x-amz-copy-source-range"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.copySourceSSECustomerKeyMD5 = dictionary["x-amz-copy-source-server-side-encryption-customer-key-MD5"] as? String + self.copySourceSSECustomerAlgorithm = dictionary["x-amz-copy-source-server-side-encryption-customer-algorithm"] as? String + self.copySourceIfUnmodifiedSince = dictionary["x-amz-copy-source-if-unmodified-since"] as? String + } + } + + public struct PutBucketAclRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "AccessControlPolicy" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "AccessControlPolicy", location: .body(locationName: "AccessControlPolicy"), required: false, type: .structure), + AWSShapeProperty(label: "GrantWriteACP", location: .header(locationName: "x-amz-grant-write-acp"), required: false, type: .string), + AWSShapeProperty(label: "GrantFullControl", location: .header(locationName: "x-amz-grant-full-control"), required: false, type: .string), + AWSShapeProperty(label: "GrantWrite", location: .header(locationName: "x-amz-grant-write"), required: false, type: .string), + AWSShapeProperty(label: "GrantRead", location: .header(locationName: "x-amz-grant-read"), required: false, type: .string), + AWSShapeProperty(label: "ACL", location: .header(locationName: "x-amz-acl"), required: false, type: .enum), + AWSShapeProperty(label: "GrantReadACP", location: .header(locationName: "x-amz-grant-read-acp"), required: false, type: .string) + ] + public let bucket: String + public let contentMD5: String? + public let accessControlPolicy: AccessControlPolicy? + /// Allows grantee to write the ACL for the applicable bucket. + public let grantWriteACP: String? + /// Allows grantee the read, write, read ACP, and write ACP permissions on the bucket. + public let grantFullControl: String? + /// Allows grantee to create, overwrite, and delete any object in the bucket. + public let grantWrite: String? + /// Allows grantee to list the objects in the bucket. + public let grantRead: String? + /// The canned ACL to apply to the bucket. + public let aCL: BucketCannedACL? + /// Allows grantee to read the bucket ACL. + public let grantReadACP: String? + + public init(bucket: String, contentMD5: String? = nil, accessControlPolicy: AccessControlPolicy? = nil, grantWriteACP: String? = nil, grantFullControl: String? = nil, grantWrite: String? = nil, grantRead: String? = nil, aCL: BucketCannedACL? = nil, grantReadACP: String? = nil) { + self.bucket = bucket + self.contentMD5 = contentMD5 + self.accessControlPolicy = accessControlPolicy + self.grantWriteACP = grantWriteACP + self.grantFullControl = grantFullControl + self.grantWrite = grantWrite + self.grantRead = grantRead + self.aCL = aCL + self.grantReadACP = grantReadACP + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.contentMD5 = dictionary["Content-MD5"] as? String + if let accessControlPolicy = dictionary["AccessControlPolicy"] as? [String: Any] { self.accessControlPolicy = try S3.AccessControlPolicy(dictionary: accessControlPolicy) } else { self.accessControlPolicy = nil } + self.grantWriteACP = dictionary["x-amz-grant-write-acp"] as? String + self.grantFullControl = dictionary["x-amz-grant-full-control"] as? String + self.grantWrite = dictionary["x-amz-grant-write"] as? String + self.grantRead = dictionary["x-amz-grant-read"] as? String + if let aCL = dictionary["x-amz-acl"] as? String { self.aCL = BucketCannedACL(rawValue: aCL) } else { self.aCL = nil } + self.grantReadACP = dictionary["x-amz-grant-read-acp"] as? String + } + } + + public struct Redirect: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ReplaceKeyPrefixWith", required: false, type: .string), + AWSShapeProperty(label: "HttpRedirectCode", required: false, type: .string), + AWSShapeProperty(label: "HostName", required: false, type: .string), + AWSShapeProperty(label: "Protocol", required: false, type: .enum), + AWSShapeProperty(label: "ReplaceKeyWith", required: false, type: .string) + ] + /// The object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with KeyPrefixEquals set to docs/ and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required if one of the siblings is present. Can be present only if ReplaceKeyWith is not provided. + public let replaceKeyPrefixWith: String? + /// The HTTP redirect code to use on the response. Not required if one of the siblings is present. + public let httpRedirectCode: String? + /// The host name to use in the redirect request. + public let hostName: String? + /// Protocol to use (http, https) when redirecting requests. The default is the protocol that is used in the original request. + public let `protocol`: Protocol? + /// The specific object key to use in the redirect request. For example, redirect request to error.html. Not required if one of the sibling is present. Can be present only if ReplaceKeyPrefixWith is not provided. + public let replaceKeyWith: String? + + public init(replaceKeyPrefixWith: String? = nil, httpRedirectCode: String? = nil, hostName: String? = nil, protocol: Protocol? = nil, replaceKeyWith: String? = nil) { + self.replaceKeyPrefixWith = replaceKeyPrefixWith + self.httpRedirectCode = httpRedirectCode + self.hostName = hostName + self.`protocol` = `protocol` + self.replaceKeyWith = replaceKeyWith + } + + public init(dictionary: [String: Any]) throws { + self.replaceKeyPrefixWith = dictionary["ReplaceKeyPrefixWith"] as? String + self.httpRedirectCode = dictionary["HttpRedirectCode"] as? String + self.hostName = dictionary["HostName"] as? String + if let `protocol` = dictionary["Protocol"] as? String { self.`protocol` = Protocol(rawValue: `protocol`) } else { self.`protocol` = nil } + self.replaceKeyWith = dictionary["ReplaceKeyWith"] as? String + } + } + + public enum BucketVersioningStatus: String, CustomStringConvertible { + case enabled = "Enabled" + case suspended = "Suspended" + public var description: String { return self.rawValue } + } + + public struct MultipartUpload: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "StorageClass", required: false, type: .enum), + AWSShapeProperty(label: "Key", required: false, type: .string), + AWSShapeProperty(label: "UploadId", required: false, type: .string), + AWSShapeProperty(label: "Owner", required: false, type: .structure), + AWSShapeProperty(label: "Initiated", required: false, type: .timestamp), + AWSShapeProperty(label: "Initiator", required: false, type: .structure) + ] + /// The class of storage used to store the object. + public let storageClass: StorageClass? + /// Key of the object for which the multipart upload was initiated. + public let key: String? + /// Upload ID that identifies the multipart upload. + public let uploadId: String? + public let owner: Owner? + /// Date and time at which the multipart upload was initiated. + public let initiated: String? + /// Identifies who initiated the multipart upload. + public let initiator: Initiator? + + public init(storageClass: StorageClass? = nil, key: String? = nil, uploadId: String? = nil, owner: Owner? = nil, initiated: String? = nil, initiator: Initiator? = nil) { + self.storageClass = storageClass + self.key = key + self.uploadId = uploadId + self.owner = owner + self.initiated = initiated + self.initiator = initiator + } + + public init(dictionary: [String: Any]) throws { + if let storageClass = dictionary["StorageClass"] as? String { self.storageClass = StorageClass(rawValue: storageClass) } else { self.storageClass = nil } + self.key = dictionary["Key"] as? String + self.uploadId = dictionary["UploadId"] as? String + if let owner = dictionary["Owner"] as? [String: Any] { self.owner = try S3.Owner(dictionary: owner) } else { self.owner = nil } + self.initiated = dictionary["Initiated"] as? String + if let initiator = dictionary["Initiator"] as? [String: Any] { self.initiator = try S3.Initiator(dictionary: initiator) } else { self.initiator = nil } + } + } + + public struct ListBucketAnalyticsConfigurationsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "ContinuationToken", location: .querystring(locationName: "continuation-token"), required: false, type: .string) + ] + /// The name of the bucket from which analytics configurations are retrieved. + public let bucket: String + /// The ContinuationToken that represents a placeholder from where this request should begin. + public let continuationToken: String? + + public init(bucket: String, continuationToken: String? = nil) { + self.bucket = bucket + self.continuationToken = continuationToken + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.continuationToken = dictionary["continuation-token"] as? String + } + } + + public enum ObjectStorageClass: String, CustomStringConvertible { + case standard = "STANDARD" + case reduced_redundancy = "REDUCED_REDUNDANCY" + case glacier = "GLACIER" + public var description: String { return self.rawValue } + } + + public struct GetBucketLifecycleConfigurationOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Rules", location: .body(locationName: "Rule"), required: false, type: .list) + ] + public let rules: [LifecycleRule]? + + public init(rules: [LifecycleRule]? = nil) { + self.rules = rules + } + + public init(dictionary: [String: Any]) throws { + if let rules = dictionary["Rule"] as? [[String: Any]] { + self.rules = try rules.map({ try LifecycleRule(dictionary: $0) }) + } else { + self.rules = nil + } + } + } + + public struct GetBucketLifecycleRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct RequestPaymentConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Payer", required: true, type: .enum) + ] + /// Specifies who pays for the download and request fees. + public let payer: Payer + + public init(payer: Payer) { + self.payer = payer + } + + public init(dictionary: [String: Any]) throws { + guard let rawPayer = dictionary["Payer"] as? String, let payer = Payer(rawValue: rawPayer) else { throw InitializableError.missingRequiredParam("Payer") } + self.payer = payer + } + } + + public struct DeleteObjectOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "VersionId", location: .header(locationName: "x-amz-version-id"), required: false, type: .string), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum), + AWSShapeProperty(label: "DeleteMarker", location: .header(locationName: "x-amz-delete-marker"), required: false, type: .boolean) + ] + /// Returns the version ID of the delete marker created as a result of the DELETE operation. + public let versionId: String? + public let requestCharged: RequestCharged? + /// Specifies whether the versioned object that was permanently deleted was (true) or was not (false) a delete marker. + public let deleteMarker: Bool? + + public init(versionId: String? = nil, requestCharged: RequestCharged? = nil, deleteMarker: Bool? = nil) { + self.versionId = versionId + self.requestCharged = requestCharged + self.deleteMarker = deleteMarker + } + + public init(dictionary: [String: Any]) throws { + self.versionId = dictionary["x-amz-version-id"] as? String + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + self.deleteMarker = dictionary["x-amz-delete-marker"] as? Bool + } + } + + public enum StorageClassAnalysisSchemaVersion: String, CustomStringConvertible { + case v_1 = "V_1" + public var description: String { return self.rawValue } + } + + public struct RoutingRules: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "RoutingRule", required: false, type: .list) + ] + public let routingRule: [RoutingRule]? + + public init(routingRule: [RoutingRule]? = nil) { + self.routingRule = routingRule + } + + public init(dictionary: [String: Any]) throws { + if let routingRule = dictionary["RoutingRule"] as? [[String: Any]] { + self.routingRule = try routingRule.map({ try RoutingRule(dictionary: $0) }) + } else { + self.routingRule = nil + } + } + } + + public struct QueueConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Filter", required: false, type: .structure), + AWSShapeProperty(label: "QueueArn", location: .body(locationName: "Queue"), required: true, type: .string), + AWSShapeProperty(label: "Events", location: .body(locationName: "Event"), required: true, type: .list), + AWSShapeProperty(label: "Id", required: false, type: .string) + ] + public let filter: NotificationConfigurationFilter? + /// Amazon SQS queue ARN to which Amazon S3 will publish a message when it detects events of specified type. + public let queueArn: String + public let events: [Event] + public let id: String? + + public init(filter: NotificationConfigurationFilter? = nil, queueArn: String, events: [Event], id: String? = nil) { + self.filter = filter + self.queueArn = queueArn + self.events = events + self.id = id + } + + public init(dictionary: [String: Any]) throws { + if let filter = dictionary["Filter"] as? [String: Any] { self.filter = try S3.NotificationConfigurationFilter(dictionary: filter) } else { self.filter = nil } + guard let queueArn = dictionary["Queue"] as? String else { throw InitializableError.missingRequiredParam("Queue") } + self.queueArn = queueArn + guard let events = dictionary["Event"] as? [String] else { throw InitializableError.missingRequiredParam("Event") } + self.events = events.flatMap({ Event(rawValue: $0)}) + self.id = dictionary["Id"] as? String + } + } + + public struct GetBucketTaggingOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "TagSet", required: true, type: .structure) + ] + public let tagSet: TagSet + + public init(tagSet: TagSet) { + self.tagSet = tagSet + } + + public init(dictionary: [String: Any]) throws { + guard let tagSet = dictionary["TagSet"] as? [String: Any] else { throw InitializableError.missingRequiredParam("TagSet") } + self.tagSet = try S3.TagSet(dictionary: tagSet) + } + } + + public struct ErrorDocument: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Key", required: true, type: .string) + ] + /// The object key name to use when a 4XX class error occurs. + public let key: String + + public init(key: String) { + self.key = key + } + + public init(dictionary: [String: Any]) throws { + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + } + } + + public struct InventoryConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "OptionalFields", required: false, type: .structure), + AWSShapeProperty(label: "Destination", required: true, type: .structure), + AWSShapeProperty(label: "IsEnabled", required: true, type: .boolean), + AWSShapeProperty(label: "Schedule", required: true, type: .structure), + AWSShapeProperty(label: "Filter", required: false, type: .structure), + AWSShapeProperty(label: "IncludedObjectVersions", required: true, type: .enum), + AWSShapeProperty(label: "Id", required: true, type: .string) + ] + /// Contains the optional fields that are included in the inventory results. + public let optionalFields: InventoryOptionalFields? + /// Contains information about where to publish the inventory results. + public let destination: InventoryDestination + /// Specifies whether the inventory is enabled or disabled. + public let isEnabled: Bool + /// Specifies the schedule for generating inventory results. + public let schedule: InventorySchedule + /// Specifies an inventory filter. The inventory only includes objects that meet the filter's criteria. + public let filter: InventoryFilter? + /// Specifies which object version(s) to included in the inventory results. + public let includedObjectVersions: InventoryIncludedObjectVersions + /// The ID used to identify the inventory configuration. + public let id: String + + public init(optionalFields: InventoryOptionalFields? = nil, destination: InventoryDestination, isEnabled: Bool, schedule: InventorySchedule, filter: InventoryFilter? = nil, includedObjectVersions: InventoryIncludedObjectVersions, id: String) { + self.optionalFields = optionalFields + self.destination = destination + self.isEnabled = isEnabled + self.schedule = schedule + self.filter = filter + self.includedObjectVersions = includedObjectVersions + self.id = id + } + + public init(dictionary: [String: Any]) throws { + if let optionalFields = dictionary["OptionalFields"] as? [String: Any] { self.optionalFields = try S3.InventoryOptionalFields(dictionary: optionalFields) } else { self.optionalFields = nil } + guard let destination = dictionary["Destination"] as? [String: Any] else { throw InitializableError.missingRequiredParam("Destination") } + self.destination = try S3.InventoryDestination(dictionary: destination) + guard let isEnabled = dictionary["IsEnabled"] as? Bool else { throw InitializableError.missingRequiredParam("IsEnabled") } + self.isEnabled = isEnabled + guard let schedule = dictionary["Schedule"] as? [String: Any] else { throw InitializableError.missingRequiredParam("Schedule") } + self.schedule = try S3.InventorySchedule(dictionary: schedule) + if let filter = dictionary["Filter"] as? [String: Any] { self.filter = try S3.InventoryFilter(dictionary: filter) } else { self.filter = nil } + guard let rawIncludedObjectVersions = dictionary["IncludedObjectVersions"] as? String, let includedObjectVersions = InventoryIncludedObjectVersions(rawValue: rawIncludedObjectVersions) else { throw InitializableError.missingRequiredParam("IncludedObjectVersions") } + self.includedObjectVersions = includedObjectVersions + guard let id = dictionary["Id"] as? String else { throw InitializableError.missingRequiredParam("Id") } + self.id = id + } + } + + public struct MetricsFilter: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Tag", required: false, type: .structure), + AWSShapeProperty(label: "And", required: false, type: .structure), + AWSShapeProperty(label: "Prefix", required: false, type: .string) + ] + /// The tag used when evaluating a metrics filter. + public let tag: Tag? + /// A conjunction (logical AND) of predicates, which is used in evaluating a metrics filter. The operator must have at least two predicates, and an object must match all of the predicates in order for the filter to apply. + public let and: MetricsAndOperator? + /// The prefix used when evaluating a metrics filter. + public let prefix: String? + + public init(tag: Tag? = nil, and: MetricsAndOperator? = nil, prefix: String? = nil) { + self.tag = tag + self.and = and + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + if let tag = dictionary["Tag"] as? [String: Any] { self.tag = try S3.Tag(dictionary: tag) } else { self.tag = nil } + if let and = dictionary["And"] as? [String: Any] { self.and = try S3.MetricsAndOperator(dictionary: and) } else { self.and = nil } + self.prefix = dictionary["Prefix"] as? String + } + } + + public struct PutBucketTaggingRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "Tagging" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Tagging", location: .body(locationName: "Tagging"), required: true, type: .structure) + ] + public let contentMD5: String? + public let bucket: String + public let tagging: Tagging + + public init(contentMD5: String? = nil, bucket: String, tagging: Tagging) { + self.contentMD5 = contentMD5 + self.bucket = bucket + self.tagging = tagging + } + + public init(dictionary: [String: Any]) throws { + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let tagging = dictionary["Tagging"] as? [String: Any] else { throw InitializableError.missingRequiredParam("Tagging") } + self.tagging = try S3.Tagging(dictionary: tagging) + } + } + + public struct AnalyticsAndOperator: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Tags", location: .body(locationName: "Tag"), required: false, type: .structure), + AWSShapeProperty(label: "Prefix", required: false, type: .string) + ] + /// The list of tags to use when evaluating an AND predicate. + public let tags: TagSet? + /// The prefix to use when evaluating an AND predicate. + public let prefix: String? + + public init(tags: TagSet? = nil, prefix: String? = nil) { + self.tags = tags + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + if let tags = dictionary["Tag"] as? [String: Any] { self.tags = try S3.TagSet(dictionary: tags) } else { self.tags = nil } + self.prefix = dictionary["Prefix"] as? String + } + } + + public struct ListObjectVersionsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "MaxKeys", location: .querystring(locationName: "max-keys"), required: false, type: .integer), + AWSShapeProperty(label: "Prefix", location: .querystring(locationName: "prefix"), required: false, type: .string), + AWSShapeProperty(label: "Delimiter", location: .querystring(locationName: "delimiter"), required: false, type: .string), + AWSShapeProperty(label: "EncodingType", location: .querystring(locationName: "encoding-type"), required: false, type: .enum), + AWSShapeProperty(label: "KeyMarker", location: .querystring(locationName: "key-marker"), required: false, type: .string), + AWSShapeProperty(label: "VersionIdMarker", location: .querystring(locationName: "version-id-marker"), required: false, type: .string) + ] + public let bucket: String + /// Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never contain more. + public let maxKeys: Int32? + /// Limits the response to keys that begin with the specified prefix. + public let prefix: String? + /// A delimiter is a character you use to group keys. + public let delimiter: String? + public let encodingType: EncodingType? + /// Specifies the key to start with when listing objects in a bucket. + public let keyMarker: String? + /// Specifies the object version you want to start listing from. + public let versionIdMarker: String? + + public init(bucket: String, maxKeys: Int32? = nil, prefix: String? = nil, delimiter: String? = nil, encodingType: EncodingType? = nil, keyMarker: String? = nil, versionIdMarker: String? = nil) { + self.bucket = bucket + self.maxKeys = maxKeys + self.prefix = prefix + self.delimiter = delimiter + self.encodingType = encodingType + self.keyMarker = keyMarker + self.versionIdMarker = versionIdMarker + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.maxKeys = dictionary["max-keys"] as? Int32 + self.prefix = dictionary["prefix"] as? String + self.delimiter = dictionary["delimiter"] as? String + if let encodingType = dictionary["encoding-type"] as? String { self.encodingType = EncodingType(rawValue: encodingType) } else { self.encodingType = nil } + self.keyMarker = dictionary["key-marker"] as? String + self.versionIdMarker = dictionary["version-id-marker"] as? String + } + } + + public struct GetBucketLifecycleOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Rules", location: .body(locationName: "Rule"), required: false, type: .list) + ] + public let rules: [Rule]? + + public init(rules: [Rule]? = nil) { + self.rules = rules + } + + public init(dictionary: [String: Any]) throws { + if let rules = dictionary["Rule"] as? [[String: Any]] { + self.rules = try rules.map({ try Rule(dictionary: $0) }) + } else { + self.rules = nil + } + } + } + + public enum Tier: String, CustomStringConvertible { + case standard = "Standard" + case bulk = "Bulk" + case expedited = "Expedited" + public var description: String { return self.rawValue } + } + + public enum RequestCharged: String, CustomStringConvertible { + case requester = "requester" + public var description: String { return self.rawValue } + } + + public struct DeleteMarkerEntry: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "IsLatest", required: false, type: .boolean), + AWSShapeProperty(label: "LastModified", required: false, type: .timestamp), + AWSShapeProperty(label: "Key", required: false, type: .string), + AWSShapeProperty(label: "VersionId", required: false, type: .string), + AWSShapeProperty(label: "Owner", required: false, type: .structure) + ] + /// Specifies whether the object is (true) or is not (false) the latest version of an object. + public let isLatest: Bool? + /// Date and time the object was last modified. + public let lastModified: String? + /// The object key. + public let key: String? + /// Version ID of an object. + public let versionId: String? + public let owner: Owner? + + public init(isLatest: Bool? = nil, lastModified: String? = nil, key: String? = nil, versionId: String? = nil, owner: Owner? = nil) { + self.isLatest = isLatest + self.lastModified = lastModified + self.key = key + self.versionId = versionId + self.owner = owner + } + + public init(dictionary: [String: Any]) throws { + self.isLatest = dictionary["IsLatest"] as? Bool + self.lastModified = dictionary["LastModified"] as? String + self.key = dictionary["Key"] as? String + self.versionId = dictionary["VersionId"] as? String + if let owner = dictionary["Owner"] as? [String: Any] { self.owner = try S3.Owner(dictionary: owner) } else { self.owner = nil } + } + } + + public enum InventoryIncludedObjectVersions: String, CustomStringConvertible { + case all = "All" + case current = "Current" + public var description: String { return self.rawValue } + } + + public struct DeleteBucketTaggingRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct ReplicationRule: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ID", required: false, type: .string), + AWSShapeProperty(label: "Status", required: true, type: .enum), + AWSShapeProperty(label: "Destination", required: true, type: .structure), + AWSShapeProperty(label: "Prefix", required: true, type: .string) + ] + /// Unique identifier for the rule. The value cannot be longer than 255 characters. + public let iD: String? + /// The rule is ignored if status is not Enabled. + public let status: ReplicationRuleStatus + public let destination: Destination + /// Object keyname prefix identifying one or more objects to which the rule applies. Maximum prefix length can be up to 1,024 characters. Overlapping prefixes are not supported. + public let prefix: String + + public init(iD: String? = nil, status: ReplicationRuleStatus, destination: Destination, prefix: String) { + self.iD = iD + self.status = status + self.destination = destination + self.prefix = prefix + } + + public init(dictionary: [String: Any]) throws { + self.iD = dictionary["ID"] as? String + guard let rawStatus = dictionary["Status"] as? String, let status = ReplicationRuleStatus(rawValue: rawStatus) else { throw InitializableError.missingRequiredParam("Status") } + self.status = status + guard let destination = dictionary["Destination"] as? [String: Any] else { throw InitializableError.missingRequiredParam("Destination") } + self.destination = try S3.Destination(dictionary: destination) + guard let prefix = dictionary["Prefix"] as? String else { throw InitializableError.missingRequiredParam("Prefix") } + self.prefix = prefix + } + } + + public struct DeleteObjectTaggingRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "VersionId", location: .querystring(locationName: "versionId"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string) + ] + public let bucket: String + /// The versionId of the object that the tag-set will be removed from. + public let versionId: String? + public let key: String + + public init(bucket: String, versionId: String? = nil, key: String) { + self.bucket = bucket + self.versionId = versionId + self.key = key + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.versionId = dictionary["versionId"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + } + } + + public struct LambdaFunctionConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "LambdaFunctionArn", location: .body(locationName: "CloudFunction"), required: true, type: .string), + AWSShapeProperty(label: "Events", location: .body(locationName: "Event"), required: true, type: .list), + AWSShapeProperty(label: "Filter", required: false, type: .structure), + AWSShapeProperty(label: "Id", required: false, type: .string) + ] + /// Lambda cloud function ARN that Amazon S3 can invoke when it detects events of the specified type. + public let lambdaFunctionArn: String + public let events: [Event] + public let filter: NotificationConfigurationFilter? + public let id: String? + + public init(lambdaFunctionArn: String, events: [Event], filter: NotificationConfigurationFilter? = nil, id: String? = nil) { + self.lambdaFunctionArn = lambdaFunctionArn + self.events = events + self.filter = filter + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let lambdaFunctionArn = dictionary["CloudFunction"] as? String else { throw InitializableError.missingRequiredParam("CloudFunction") } + self.lambdaFunctionArn = lambdaFunctionArn + guard let events = dictionary["Event"] as? [String] else { throw InitializableError.missingRequiredParam("Event") } + self.events = events.flatMap({ Event(rawValue: $0)}) + if let filter = dictionary["Filter"] as? [String: Any] { self.filter = try S3.NotificationConfigurationFilter(dictionary: filter) } else { self.filter = nil } + self.id = dictionary["Id"] as? String + } + } + + public struct GetBucketLoggingOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "LoggingEnabled", required: false, type: .structure) + ] + public let loggingEnabled: LoggingEnabled? + + public init(loggingEnabled: LoggingEnabled? = nil) { + self.loggingEnabled = loggingEnabled + } + + public init(dictionary: [String: Any]) throws { + if let loggingEnabled = dictionary["LoggingEnabled"] as? [String: Any] { self.loggingEnabled = try S3.LoggingEnabled(dictionary: loggingEnabled) } else { self.loggingEnabled = nil } + } + } + + public struct UploadPartOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "ETag", location: .header(locationName: "ETag"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum) + ] + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key. + public let sSECustomerKeyMD5: String? + /// If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object. + public let sSEKMSKeyId: String? + /// Entity tag for the uploaded object. + public let eTag: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used. + public let sSECustomerAlgorithm: String? + public let requestCharged: RequestCharged? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + + public init(sSECustomerKeyMD5: String? = nil, sSEKMSKeyId: String? = nil, eTag: String? = nil, sSECustomerAlgorithm: String? = nil, requestCharged: RequestCharged? = nil, serverSideEncryption: ServerSideEncryption? = nil) { + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.sSEKMSKeyId = sSEKMSKeyId + self.eTag = eTag + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.requestCharged = requestCharged + self.serverSideEncryption = serverSideEncryption + } + + public init(dictionary: [String: Any]) throws { + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.eTag = dictionary["ETag"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + } + } + + public struct GetObjectTaggingOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "VersionId", location: .header(locationName: "x-amz-version-id"), required: false, type: .string), + AWSShapeProperty(label: "TagSet", required: true, type: .structure) + ] + public let versionId: String? + public let tagSet: TagSet + + public init(versionId: String? = nil, tagSet: TagSet) { + self.versionId = versionId + self.tagSet = tagSet + } + + public init(dictionary: [String: Any]) throws { + self.versionId = dictionary["x-amz-version-id"] as? String + guard let tagSet = dictionary["TagSet"] as? [String: Any] else { throw InitializableError.missingRequiredParam("TagSet") } + self.tagSet = try S3.TagSet(dictionary: tagSet) + } + } + + public struct GetBucketCorsOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "CORSRules", location: .body(locationName: "CORSRule"), required: false, type: .list) + ] + public let cORSRules: [CORSRule]? + + public init(cORSRules: [CORSRule]? = nil) { + self.cORSRules = cORSRules + } + + public init(dictionary: [String: Any]) throws { + if let cORSRules = dictionary["CORSRule"] as? [[String: Any]] { + self.cORSRules = try cORSRules.map({ try CORSRule(dictionary: $0) }) + } else { + self.cORSRules = nil + } + } + } + + public struct Error: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "VersionId", required: false, type: .string), + AWSShapeProperty(label: "Key", required: false, type: .string), + AWSShapeProperty(label: "Code", required: false, type: .string), + AWSShapeProperty(label: "Message", required: false, type: .string) + ] + public let versionId: String? + public let key: String? + public let code: String? + public let message: String? + + public init(versionId: String? = nil, key: String? = nil, code: String? = nil, message: String? = nil) { + self.versionId = versionId + self.key = key + self.code = code + self.message = message + } + + public init(dictionary: [String: Any]) throws { + self.versionId = dictionary["VersionId"] as? String + self.key = dictionary["Key"] as? String + self.code = dictionary["Code"] as? String + self.message = dictionary["Message"] as? String + } + } + + public struct PutObjectRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "Body" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Tagging", location: .header(locationName: "x-amz-tagging"), required: false, type: .string), + AWSShapeProperty(label: "ContentDisposition", location: .header(locationName: "Content-Disposition"), required: false, type: .string), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "GrantReadACP", location: .header(locationName: "x-amz-grant-read-acp"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "ContentLanguage", location: .header(locationName: "Content-Language"), required: false, type: .string), + AWSShapeProperty(label: "ContentEncoding", location: .header(locationName: "Content-Encoding"), required: false, type: .string), + AWSShapeProperty(label: "ContentLength", location: .header(locationName: "Content-Length"), required: false, type: .long), + AWSShapeProperty(label: "GrantWriteACP", location: .header(locationName: "x-amz-grant-write-acp"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "WebsiteRedirectLocation", location: .header(locationName: "x-amz-website-redirect-location"), required: false, type: .string), + AWSShapeProperty(label: "Body", required: false, type: .blob), + AWSShapeProperty(label: "SSECustomerKey", location: .header(locationName: "x-amz-server-side-encryption-customer-key"), required: false, type: .string), + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "CacheControl", location: .header(locationName: "Cache-Control"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "GrantFullControl", location: .header(locationName: "x-amz-grant-full-control"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "ACL", location: .header(locationName: "x-amz-acl"), required: false, type: .enum), + AWSShapeProperty(label: "Metadata", required: false, type: .map), + AWSShapeProperty(label: "Expires", location: .header(locationName: "Expires"), required: false, type: .timestamp), + AWSShapeProperty(label: "ContentType", location: .header(locationName: "Content-Type"), required: false, type: .string), + AWSShapeProperty(label: "StorageClass", location: .header(locationName: "x-amz-storage-class"), required: false, type: .enum), + AWSShapeProperty(label: "GrantRead", location: .header(locationName: "x-amz-grant-read"), required: false, type: .string), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum) + ] + /// Name of the bucket to which the PUT operation was initiated. + public let bucket: String + /// The tag-set for the object. The tag-set must be encoded as URL Query parameters + public let tagging: String? + /// Specifies presentational information for the object. + public let contentDisposition: String? + /// Specifies the AWS KMS key ID to use for object encryption. All GET and PUT requests for an object protected by AWS KMS will fail if not made via SSL or using SigV4. Documentation on configuring any of the officially supported AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version + public let sSEKMSKeyId: String? + /// Allows grantee to read the object ACL. + public let grantReadACP: String? + /// Specifies the algorithm to use to when encrypting the object (e.g., AES256). + public let sSECustomerAlgorithm: String? + /// The language the content is in. + public let contentLanguage: String? + /// Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field. + public let contentEncoding: String? + /// Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically. + public let contentLength: Int64? + /// Allows grantee to write the ACL for the applicable object. + public let grantWriteACP: String? + /// Object key for which the PUT operation was initiated. + public let key: String + /// If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. + public let websiteRedirectLocation: String? + /// Object data. + public let body: Data? + /// Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header. + public let sSECustomerKey: String? + /// The base64-encoded 128-bit MD5 digest of the part data. + public let contentMD5: String? + /// Specifies caching behavior along the request/reply chain. + public let cacheControl: String? + public let requestPayer: RequestPayer? + /// Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. + public let grantFullControl: String? + /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error. + public let sSECustomerKeyMD5: String? + /// The canned ACL to apply to the object. + public let aCL: ObjectCannedACL? + /// A map of metadata to store with the object in S3. + public let metadata: [String: String]? + /// The date and time at which the object is no longer cacheable. + public let expires: String? + /// A standard MIME type describing the format of the object data. + public let contentType: String? + /// The type of storage to use for the object. Defaults to 'STANDARD'. + public let storageClass: StorageClass? + /// Allows grantee to read the object data and its metadata. + public let grantRead: String? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + + public init(bucket: String, tagging: String? = nil, contentDisposition: String? = nil, sSEKMSKeyId: String? = nil, grantReadACP: String? = nil, sSECustomerAlgorithm: String? = nil, contentLanguage: String? = nil, contentEncoding: String? = nil, contentLength: Int64? = nil, grantWriteACP: String? = nil, key: String, websiteRedirectLocation: String? = nil, body: Data? = nil, sSECustomerKey: String? = nil, contentMD5: String? = nil, cacheControl: String? = nil, requestPayer: RequestPayer? = nil, grantFullControl: String? = nil, sSECustomerKeyMD5: String? = nil, aCL: ObjectCannedACL? = nil, metadata: [String: String]? = nil, expires: String? = nil, contentType: String? = nil, storageClass: StorageClass? = nil, grantRead: String? = nil, serverSideEncryption: ServerSideEncryption? = nil) { + self.bucket = bucket + self.tagging = tagging + self.contentDisposition = contentDisposition + self.sSEKMSKeyId = sSEKMSKeyId + self.grantReadACP = grantReadACP + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.contentLanguage = contentLanguage + self.contentEncoding = contentEncoding + self.contentLength = contentLength + self.grantWriteACP = grantWriteACP + self.key = key + self.websiteRedirectLocation = websiteRedirectLocation + self.body = body + self.sSECustomerKey = sSECustomerKey + self.contentMD5 = contentMD5 + self.cacheControl = cacheControl + self.requestPayer = requestPayer + self.grantFullControl = grantFullControl + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.aCL = aCL + self.metadata = metadata + self.expires = expires + self.contentType = contentType + self.storageClass = storageClass + self.grantRead = grantRead + self.serverSideEncryption = serverSideEncryption + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.tagging = dictionary["x-amz-tagging"] as? String + self.contentDisposition = dictionary["Content-Disposition"] as? String + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.grantReadACP = dictionary["x-amz-grant-read-acp"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + self.contentLanguage = dictionary["Content-Language"] as? String + self.contentEncoding = dictionary["Content-Encoding"] as? String + self.contentLength = dictionary["Content-Length"] as? Int64 + self.grantWriteACP = dictionary["x-amz-grant-write-acp"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.websiteRedirectLocation = dictionary["x-amz-website-redirect-location"] as? String + self.body = dictionary["Body"] as? Data + self.sSECustomerKey = dictionary["x-amz-server-side-encryption-customer-key"] as? String + self.contentMD5 = dictionary["Content-MD5"] as? String + self.cacheControl = dictionary["Cache-Control"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.grantFullControl = dictionary["x-amz-grant-full-control"] as? String + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + if let aCL = dictionary["x-amz-acl"] as? String { self.aCL = ObjectCannedACL(rawValue: aCL) } else { self.aCL = nil } + if let metadata = dictionary["x-amz-meta-"] as? [String: String] { + self.metadata = metadata + } else { + self.metadata = nil + } + self.expires = dictionary["Expires"] as? String + self.contentType = dictionary["Content-Type"] as? String + if let storageClass = dictionary["x-amz-storage-class"] as? String { self.storageClass = StorageClass(rawValue: storageClass) } else { self.storageClass = nil } + self.grantRead = dictionary["x-amz-grant-read"] as? String + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + } + } + + public struct CreateBucketConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "LocationConstraint", required: false, type: .enum) + ] + /// Specifies the region where the bucket will be created. If you don't specify a region, the bucket will be created in US Standard. + public let locationConstraint: BucketLocationConstraint? + + public init(locationConstraint: BucketLocationConstraint? = nil) { + self.locationConstraint = locationConstraint + } + + public init(dictionary: [String: Any]) throws { + if let locationConstraint = dictionary["LocationConstraint"] as? String { self.locationConstraint = BucketLocationConstraint(rawValue: locationConstraint) } else { self.locationConstraint = nil } + } + } + + public struct GetBucketWebsiteRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct UploadPartRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "Body" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "SSECustomerKey", location: .header(locationName: "x-amz-server-side-encryption-customer-key"), required: false, type: .string), + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "PartNumber", location: .querystring(locationName: "partNumber"), required: true, type: .integer), + AWSShapeProperty(label: "ContentLength", location: .header(locationName: "Content-Length"), required: false, type: .long), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "UploadId", location: .querystring(locationName: "uploadId"), required: true, type: .string), + AWSShapeProperty(label: "Body", required: false, type: .blob), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string) + ] + /// Name of the bucket to which the multipart upload was initiated. + public let bucket: String + /// Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to store the object and then it is discarded; Amazon does not store the encryption key. The key must be appropriate for use with the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm header. This must be the same encryption key specified in the initiate multipart upload request. + public let sSECustomerKey: String? + /// The base64-encoded 128-bit MD5 digest of the part data. + public let contentMD5: String? + /// Part number of part being uploaded. This is a positive integer between 1 and 10,000. + public let partNumber: Int32 + /// Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically. + public let contentLength: Int64? + public let requestPayer: RequestPayer? + /// Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a message integrity check to ensure the encryption key was transmitted without error. + public let sSECustomerKeyMD5: String? + /// Object key for which the multipart upload was initiated. + public let key: String + /// Upload ID identifying the multipart upload whose part is being uploaded. + public let uploadId: String + /// Object data. + public let body: Data? + /// Specifies the algorithm to use to when encrypting the object (e.g., AES256). + public let sSECustomerAlgorithm: String? + + public init(bucket: String, sSECustomerKey: String? = nil, contentMD5: String? = nil, partNumber: Int32, contentLength: Int64? = nil, requestPayer: RequestPayer? = nil, sSECustomerKeyMD5: String? = nil, key: String, uploadId: String, body: Data? = nil, sSECustomerAlgorithm: String? = nil) { + self.bucket = bucket + self.sSECustomerKey = sSECustomerKey + self.contentMD5 = contentMD5 + self.partNumber = partNumber + self.contentLength = contentLength + self.requestPayer = requestPayer + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.key = key + self.uploadId = uploadId + self.body = body + self.sSECustomerAlgorithm = sSECustomerAlgorithm + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.sSECustomerKey = dictionary["x-amz-server-side-encryption-customer-key"] as? String + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let partNumber = dictionary["partNumber"] as? Int32 else { throw InitializableError.missingRequiredParam("partNumber") } + self.partNumber = partNumber + self.contentLength = dictionary["Content-Length"] as? Int64 + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + guard let uploadId = dictionary["uploadId"] as? String else { throw InitializableError.missingRequiredParam("uploadId") } + self.uploadId = uploadId + self.body = dictionary["Body"] as? Data + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + } + } + + public struct DeletedObject: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "DeleteMarkerVersionId", required: false, type: .string), + AWSShapeProperty(label: "VersionId", required: false, type: .string), + AWSShapeProperty(label: "Key", required: false, type: .string), + AWSShapeProperty(label: "DeleteMarker", required: false, type: .boolean) + ] + public let deleteMarkerVersionId: String? + public let versionId: String? + public let key: String? + public let deleteMarker: Bool? + + public init(deleteMarkerVersionId: String? = nil, versionId: String? = nil, key: String? = nil, deleteMarker: Bool? = nil) { + self.deleteMarkerVersionId = deleteMarkerVersionId + self.versionId = versionId + self.key = key + self.deleteMarker = deleteMarker + } + + public init(dictionary: [String: Any]) throws { + self.deleteMarkerVersionId = dictionary["DeleteMarkerVersionId"] as? String + self.versionId = dictionary["VersionId"] as? String + self.key = dictionary["Key"] as? String + self.deleteMarker = dictionary["DeleteMarker"] as? Bool + } + } + + public struct PutObjectTaggingOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "VersionId", location: .header(locationName: "x-amz-version-id"), required: false, type: .string) + ] + public let versionId: String? + + public init(versionId: String? = nil) { + self.versionId = versionId + } + + public init(dictionary: [String: Any]) throws { + self.versionId = dictionary["x-amz-version-id"] as? String + } + } + + public struct GetBucketRequestPaymentRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct DeleteBucketPolicyRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct S3KeyFilter: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "FilterRules", location: .body(locationName: "FilterRule"), required: false, type: .list) + ] + public let filterRules: [FilterRule]? + + public init(filterRules: [FilterRule]? = nil) { + self.filterRules = filterRules + } + + public init(dictionary: [String: Any]) throws { + if let filterRules = dictionary["FilterRule"] as? [[String: Any]] { + self.filterRules = try filterRules.map({ try FilterRule(dictionary: $0) }) + } else { + self.filterRules = nil + } + } + } + + public enum TransitionStorageClass: String, CustomStringConvertible { + case glacier = "GLACIER" + case standard_ia = "STANDARD_IA" + public var description: String { return self.rawValue } + } + + public struct PutBucketWebsiteRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "WebsiteConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "WebsiteConfiguration", location: .body(locationName: "WebsiteConfiguration"), required: true, type: .structure) + ] + public let contentMD5: String? + public let bucket: String + public let websiteConfiguration: WebsiteConfiguration + + public init(contentMD5: String? = nil, bucket: String, websiteConfiguration: WebsiteConfiguration) { + self.contentMD5 = contentMD5 + self.bucket = bucket + self.websiteConfiguration = websiteConfiguration + } + + public init(dictionary: [String: Any]) throws { + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let websiteConfiguration = dictionary["WebsiteConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("WebsiteConfiguration") } + self.websiteConfiguration = try S3.WebsiteConfiguration(dictionary: websiteConfiguration) + } + } + + public struct PutBucketNotificationConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "NotificationConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "NotificationConfiguration", location: .body(locationName: "NotificationConfiguration"), required: true, type: .structure) + ] + public let bucket: String + public let notificationConfiguration: NotificationConfiguration + + public init(bucket: String, notificationConfiguration: NotificationConfiguration) { + self.bucket = bucket + self.notificationConfiguration = notificationConfiguration + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let notificationConfiguration = dictionary["NotificationConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("NotificationConfiguration") } + self.notificationConfiguration = try S3.NotificationConfiguration(dictionary: notificationConfiguration) + } + } + + public struct DeleteBucketMetricsConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Id", location: .querystring(locationName: "id"), required: true, type: .string) + ] + /// The name of the bucket containing the metrics configuration to delete. + public let bucket: String + /// The ID used to identify the metrics configuration. + public let id: String + + public init(bucket: String, id: String) { + self.bucket = bucket + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let id = dictionary["id"] as? String else { throw InitializableError.missingRequiredParam("id") } + self.id = id + } + } + + public struct AbortIncompleteMultipartUpload: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "DaysAfterInitiation", required: false, type: .integer) + ] + /// Indicates the number of days that must pass since initiation for Lifecycle to abort an Incomplete Multipart Upload. + public let daysAfterInitiation: Int32? + + public init(daysAfterInitiation: Int32? = nil) { + self.daysAfterInitiation = daysAfterInitiation + } + + public init(dictionary: [String: Any]) throws { + self.daysAfterInitiation = dictionary["DaysAfterInitiation"] as? Int32 + } + } + + public struct RestoreRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "GlacierJobParameters", required: false, type: .structure), + AWSShapeProperty(label: "Days", required: true, type: .integer) + ] + /// Glacier related prameters pertaining to this job. + public let glacierJobParameters: GlacierJobParameters? + /// Lifetime of the active copy in days + public let days: Int32 + + public init(glacierJobParameters: GlacierJobParameters? = nil, days: Int32) { + self.glacierJobParameters = glacierJobParameters + self.days = days + } + + public init(dictionary: [String: Any]) throws { + if let glacierJobParameters = dictionary["GlacierJobParameters"] as? [String: Any] { self.glacierJobParameters = try S3.GlacierJobParameters(dictionary: glacierJobParameters) } else { self.glacierJobParameters = nil } + guard let days = dictionary["Days"] as? Int32 else { throw InitializableError.missingRequiredParam("Days") } + self.days = days + } + } + + public struct GetBucketInventoryConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Id", location: .querystring(locationName: "id"), required: true, type: .string) + ] + /// The name of the bucket containing the inventory configuration to retrieve. + public let bucket: String + /// The ID used to identify the inventory configuration. + public let id: String + + public init(bucket: String, id: String) { + self.bucket = bucket + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let id = dictionary["id"] as? String else { throw InitializableError.missingRequiredParam("id") } + self.id = id + } + } + + public struct LifecycleConfiguration: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Rules", location: .body(locationName: "Rule"), required: true, type: .list) + ] + public let rules: [Rule] + + public init(rules: [Rule]) { + self.rules = rules + } + + public init(dictionary: [String: Any]) throws { + guard let rules = dictionary["Rule"] as? [[String: Any]] else { throw InitializableError.missingRequiredParam("Rule") } + self.rules = try rules.map({ try Rule(dictionary: $0) }) + } + } + + public struct GetBucketAnalyticsConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "Id", location: .querystring(locationName: "id"), required: true, type: .string) + ] + /// The name of the bucket from which an analytics configuration is retrieved. + public let bucket: String + /// The identifier used to represent an analytics configuration. + public let id: String + + public init(bucket: String, id: String) { + self.bucket = bucket + self.id = id + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let id = dictionary["id"] as? String else { throw InitializableError.missingRequiredParam("id") } + self.id = id + } + } + + public struct Buckets: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", required: false, type: .list) + ] + public let bucket: [Bucket]? + + public init(bucket: [Bucket]? = nil) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + if let bucket = dictionary["Bucket"] as? [[String: Any]] { + self.bucket = try bucket.map({ try Bucket(dictionary: $0) }) + } else { + self.bucket = nil + } + } + } + + public struct GetBucketAccelerateConfigurationRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + /// Name of the bucket for which the accelerate configuration is retrieved. + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct GetBucketInventoryConfigurationOutput: AWSShape { + /// The key for the payload + public static let payload: String? = "InventoryConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "InventoryConfiguration", required: false, type: .structure) + ] + /// Specifies the inventory configuration. + public let inventoryConfiguration: InventoryConfiguration? + + public init(inventoryConfiguration: InventoryConfiguration? = nil) { + self.inventoryConfiguration = inventoryConfiguration + } + + public init(dictionary: [String: Any]) throws { + if let inventoryConfiguration = dictionary["InventoryConfiguration"] as? [String: Any] { self.inventoryConfiguration = try S3.InventoryConfiguration(dictionary: inventoryConfiguration) } else { self.inventoryConfiguration = nil } + } + } + + public struct ListPartsRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "PartNumberMarker", location: .querystring(locationName: "part-number-marker"), required: false, type: .integer), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "UploadId", location: .querystring(locationName: "uploadId"), required: true, type: .string), + AWSShapeProperty(label: "MaxParts", location: .querystring(locationName: "max-parts"), required: false, type: .integer), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum) + ] + public let bucket: String + /// Specifies the part after which listing should begin. Only parts with higher part numbers will be listed. + public let partNumberMarker: Int32? + public let key: String + /// Upload ID identifying the multipart upload whose parts are being listed. + public let uploadId: String + /// Sets the maximum number of parts to return. + public let maxParts: Int32? + public let requestPayer: RequestPayer? + + public init(bucket: String, partNumberMarker: Int32? = nil, key: String, uploadId: String, maxParts: Int32? = nil, requestPayer: RequestPayer? = nil) { + self.bucket = bucket + self.partNumberMarker = partNumberMarker + self.key = key + self.uploadId = uploadId + self.maxParts = maxParts + self.requestPayer = requestPayer + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + self.partNumberMarker = dictionary["part-number-marker"] as? Int32 + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + guard let uploadId = dictionary["uploadId"] as? String else { throw InitializableError.missingRequiredParam("uploadId") } + self.uploadId = uploadId + self.maxParts = dictionary["max-parts"] as? Int32 + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + } + } + + public enum BucketAccelerateStatus: String, CustomStringConvertible { + case enabled = "Enabled" + case suspended = "Suspended" + public var description: String { return self.rawValue } + } + + public struct RestoreObjectRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "RestoreRequest" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "RestoreRequest", location: .body(locationName: "RestoreRequest"), required: false, type: .structure), + AWSShapeProperty(label: "Key", location: .uri(locationName: "Key"), required: true, type: .string), + AWSShapeProperty(label: "VersionId", location: .querystring(locationName: "versionId"), required: false, type: .string), + AWSShapeProperty(label: "RequestPayer", location: .header(locationName: "x-amz-request-payer"), required: false, type: .enum) + ] + public let bucket: String + public let restoreRequest: RestoreRequest? + public let key: String + public let versionId: String? + public let requestPayer: RequestPayer? + + public init(bucket: String, restoreRequest: RestoreRequest? = nil, key: String, versionId: String? = nil, requestPayer: RequestPayer? = nil) { + self.bucket = bucket + self.restoreRequest = restoreRequest + self.key = key + self.versionId = versionId + self.requestPayer = requestPayer + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + if let restoreRequest = dictionary["RestoreRequest"] as? [String: Any] { self.restoreRequest = try S3.RestoreRequest(dictionary: restoreRequest) } else { self.restoreRequest = nil } + guard let key = dictionary["Key"] as? String else { throw InitializableError.missingRequiredParam("Key") } + self.key = key + self.versionId = dictionary["versionId"] as? String + if let requestPayer = dictionary["x-amz-request-payer"] as? String { self.requestPayer = RequestPayer(rawValue: requestPayer) } else { self.requestPayer = nil } + } + } + + public struct Grantee: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ID", required: false, type: .string), + AWSShapeProperty(label: "EmailAddress", required: false, type: .string), + AWSShapeProperty(label: "Type", location: .body(locationName: "xsi:type"), required: true, type: .enum), + AWSShapeProperty(label: "DisplayName", required: false, type: .string), + AWSShapeProperty(label: "URI", required: false, type: .string) + ] + /// The canonical user ID of the grantee. + public let iD: String? + /// Email address of the grantee. + public let emailAddress: String? + /// Type of grantee + public let `type`: Type + /// Screen name of the grantee. + public let displayName: String? + /// URI of the grantee group. + public let uRI: String? + + public init(iD: String? = nil, emailAddress: String? = nil, type: Type, displayName: String? = nil, uRI: String? = nil) { + self.iD = iD + self.emailAddress = emailAddress + self.`type` = `type` + self.displayName = displayName + self.uRI = uRI + } + + public init(dictionary: [String: Any]) throws { + self.iD = dictionary["ID"] as? String + self.emailAddress = dictionary["EmailAddress"] as? String + guard let rawType = dictionary["xsi:type"] as? String, let `type` = Type(rawValue: rawType) else { throw InitializableError.missingRequiredParam("xsi:type") } + self.`type` = `type` + self.displayName = dictionary["DisplayName"] as? String + self.uRI = dictionary["URI"] as? String + } + } + + public struct QueueConfigurationDeprecated: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Queue", required: false, type: .string), + AWSShapeProperty(label: "Events", location: .body(locationName: "Event"), required: false, type: .list), + AWSShapeProperty(label: "Event", required: false, type: .enum), + AWSShapeProperty(label: "Id", required: false, type: .string) + ] + public let queue: String? + public let events: [Event]? + public let event: Event? + public let id: String? + + public init(queue: String? = nil, events: [Event]? = nil, event: Event? = nil, id: String? = nil) { + self.queue = queue + self.events = events + self.event = event + self.id = id + } + + public init(dictionary: [String: Any]) throws { + self.queue = dictionary["Queue"] as? String + if let events = dictionary["Event"] as? [String] { self.events = events.flatMap({ Event(rawValue: $0)}) } else { self.events = nil } + if let event = dictionary["Event"] as? String { self.event = Event(rawValue: event) } else { self.event = nil } + self.id = dictionary["Id"] as? String + } + } + + public struct GetBucketVersioningRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public struct GetBucketLoggingRequest: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string) + ] + public let bucket: String + + public init(bucket: String) { + self.bucket = bucket + } + + public init(dictionary: [String: Any]) throws { + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + } + } + + public enum `Protocol`: String, CustomStringConvertible { + case http = "http" + case https = "https" + public var description: String { return self.rawValue } + } + + public enum Permission: String, CustomStringConvertible { + case full_control = "FULL_CONTROL" + case write = "WRITE" + case write_acp = "WRITE_ACP" + case read = "READ" + case read_acp = "READ_ACP" + public var description: String { return self.rawValue } + } + + public struct PutBucketRequestPaymentRequest: AWSShape { + /// The key for the payload + public static let payload: String? = "RequestPaymentConfiguration" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "ContentMD5", location: .header(locationName: "Content-MD5"), required: false, type: .string), + AWSShapeProperty(label: "Bucket", location: .uri(locationName: "Bucket"), required: true, type: .string), + AWSShapeProperty(label: "RequestPaymentConfiguration", location: .body(locationName: "RequestPaymentConfiguration"), required: true, type: .structure) + ] + public let contentMD5: String? + public let bucket: String + public let requestPaymentConfiguration: RequestPaymentConfiguration + + public init(contentMD5: String? = nil, bucket: String, requestPaymentConfiguration: RequestPaymentConfiguration) { + self.contentMD5 = contentMD5 + self.bucket = bucket + self.requestPaymentConfiguration = requestPaymentConfiguration + } + + public init(dictionary: [String: Any]) throws { + self.contentMD5 = dictionary["Content-MD5"] as? String + guard let bucket = dictionary["Bucket"] as? String else { throw InitializableError.missingRequiredParam("Bucket") } + self.bucket = bucket + guard let requestPaymentConfiguration = dictionary["RequestPaymentConfiguration"] as? [String: Any] else { throw InitializableError.missingRequiredParam("RequestPaymentConfiguration") } + self.requestPaymentConfiguration = try S3.RequestPaymentConfiguration(dictionary: requestPaymentConfiguration) + } + } + + public struct PutObjectOutput: AWSShape { + /// The key for the payload + public static let payload: String? = nil + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "Expiration", location: .header(locationName: "x-amz-expiration"), required: false, type: .string), + AWSShapeProperty(label: "VersionId", location: .header(locationName: "x-amz-version-id"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "ETag", location: .header(locationName: "ETag"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum) + ] + /// If the object expiration is configured, this will contain the expiration date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded. + public let expiration: String? + /// Version of the object. + public let versionId: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key. + public let sSECustomerKeyMD5: String? + /// If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object. + public let sSEKMSKeyId: String? + /// Entity tag for the uploaded object. + public let eTag: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used. + public let sSECustomerAlgorithm: String? + public let requestCharged: RequestCharged? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + + public init(expiration: String? = nil, versionId: String? = nil, sSECustomerKeyMD5: String? = nil, sSEKMSKeyId: String? = nil, eTag: String? = nil, sSECustomerAlgorithm: String? = nil, requestCharged: RequestCharged? = nil, serverSideEncryption: ServerSideEncryption? = nil) { + self.expiration = expiration + self.versionId = versionId + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.sSEKMSKeyId = sSEKMSKeyId + self.eTag = eTag + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.requestCharged = requestCharged + self.serverSideEncryption = serverSideEncryption + } + + public init(dictionary: [String: Any]) throws { + self.expiration = dictionary["x-amz-expiration"] as? String + self.versionId = dictionary["x-amz-version-id"] as? String + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.eTag = dictionary["ETag"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + } + } + + public struct CopyObjectOutput: AWSShape { + /// The key for the payload + public static let payload: String? = "CopyObjectResult" + public static var parsingHints: [AWSShapeProperty] = [ + AWSShapeProperty(label: "CopyObjectResult", required: false, type: .structure), + AWSShapeProperty(label: "SSECustomerKeyMD5", location: .header(locationName: "x-amz-server-side-encryption-customer-key-MD5"), required: false, type: .string), + AWSShapeProperty(label: "VersionId", location: .header(locationName: "x-amz-version-id"), required: false, type: .string), + AWSShapeProperty(label: "CopySourceVersionId", location: .header(locationName: "x-amz-copy-source-version-id"), required: false, type: .string), + AWSShapeProperty(label: "SSEKMSKeyId", location: .header(locationName: "x-amz-server-side-encryption-aws-kms-key-id"), required: false, type: .string), + AWSShapeProperty(label: "Expiration", location: .header(locationName: "x-amz-expiration"), required: false, type: .string), + AWSShapeProperty(label: "SSECustomerAlgorithm", location: .header(locationName: "x-amz-server-side-encryption-customer-algorithm"), required: false, type: .string), + AWSShapeProperty(label: "ServerSideEncryption", location: .header(locationName: "x-amz-server-side-encryption"), required: false, type: .enum), + AWSShapeProperty(label: "RequestCharged", location: .header(locationName: "x-amz-request-charged"), required: false, type: .enum) + ] + public let copyObjectResult: CopyObjectResult? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header to provide round trip message integrity verification of the customer-provided encryption key. + public let sSECustomerKeyMD5: String? + /// Version ID of the newly created copy. + public let versionId: String? + public let copySourceVersionId: String? + /// If present, specifies the ID of the AWS Key Management Service (KMS) master encryption key that was used for the object. + public let sSEKMSKeyId: String? + /// If the object expiration is configured, the response includes this header. + public let expiration: String? + /// If server-side encryption with a customer-provided encryption key was requested, the response will include this header confirming the encryption algorithm used. + public let sSECustomerAlgorithm: String? + /// The Server-side encryption algorithm used when storing this object in S3 (e.g., AES256, aws:kms). + public let serverSideEncryption: ServerSideEncryption? + public let requestCharged: RequestCharged? + + public init(copyObjectResult: CopyObjectResult? = nil, sSECustomerKeyMD5: String? = nil, versionId: String? = nil, copySourceVersionId: String? = nil, sSEKMSKeyId: String? = nil, expiration: String? = nil, sSECustomerAlgorithm: String? = nil, serverSideEncryption: ServerSideEncryption? = nil, requestCharged: RequestCharged? = nil) { + self.copyObjectResult = copyObjectResult + self.sSECustomerKeyMD5 = sSECustomerKeyMD5 + self.versionId = versionId + self.copySourceVersionId = copySourceVersionId + self.sSEKMSKeyId = sSEKMSKeyId + self.expiration = expiration + self.sSECustomerAlgorithm = sSECustomerAlgorithm + self.serverSideEncryption = serverSideEncryption + self.requestCharged = requestCharged + } + + public init(dictionary: [String: Any]) throws { + if let copyObjectResult = dictionary["CopyObjectResult"] as? [String: Any] { self.copyObjectResult = try S3.CopyObjectResult(dictionary: copyObjectResult) } else { self.copyObjectResult = nil } + self.sSECustomerKeyMD5 = dictionary["x-amz-server-side-encryption-customer-key-MD5"] as? String + self.versionId = dictionary["x-amz-version-id"] as? String + self.copySourceVersionId = dictionary["x-amz-copy-source-version-id"] as? String + self.sSEKMSKeyId = dictionary["x-amz-server-side-encryption-aws-kms-key-id"] as? String + self.expiration = dictionary["x-amz-expiration"] as? String + self.sSECustomerAlgorithm = dictionary["x-amz-server-side-encryption-customer-algorithm"] as? String + if let serverSideEncryption = dictionary["x-amz-server-side-encryption"] as? String { self.serverSideEncryption = ServerSideEncryption(rawValue: serverSideEncryption) } else { self.serverSideEncryption = nil } + if let requestCharged = dictionary["x-amz-request-charged"] as? String { self.requestCharged = RequestCharged(rawValue: requestCharged) } else { self.requestCharged = nil } + } + } + +} \ No newline at end of file