AWSS3ServiceClient
public protocol AWSS3ServiceClient
The AWS S3 service client, which can be used to interact with AWS Simple Storage Service (S3) via MongoDB Stitch.
-
Puts an object into an AWS S3 bucket as a string.
Declaration
Swift
func putObject(bucket: String, key: String, acl: String, contentType: String, body: String, _ completionHandler: @escaping (StitchResult<AWSS3PutObjectResult>) -> Void)
Parameters
bucket
the bucket to put the object in
key
the key (or name) of the object
acl
the ACL to apply to the object (e.g. private)
contentType
the content type of the object (e.g.
application/json
)body
the body of the object as a string
completionHandler
The completion handler to call when the object is put or the operation fails. This handler is executed on a non-main global
DispatchQueue
. If the operation is successful, the result will contain the result of the put request as anAWSS3PutObjectResult.
-
Puts a binary object into an AWS S3 bucket as a Foundation
Data
object.Declaration
Swift
func putObject(bucket: String, key: String, acl: String, contentType: String, body: Data, _ completionHandler: @escaping (StitchResult<AWSS3PutObjectResult>) -> Void)
Parameters
bucket
the bucket to put the object in
key
the key (or name) of the object
acl
the ACL to apply to the object (e.g. private)
contentType
the content type of the object (e.g.
application/json
)body
the body of the object as a
Data
completionHandler
The completion handler to call when the object is put or the operation fails. This handler is executed on a non-main global
DispatchQueue
. If the operation is successful, the result will contain the result of the put request as anAWSS3PutObjectResult.
-
Puts a binary object into an AWS S3 bucket as a BSON
Binary
object.Declaration
Swift
func putObject(bucket: String, key: String, acl: String, contentType: String, body: Binary, _ completionHandler: @escaping (StitchResult<AWSS3PutObjectResult>) -> Void)
Parameters
bucket
the bucket to put the object in
key
the key (or name) of the object
acl
the ACL to apply to the object (e.g. private)
contentType
the content type of the object (e.g.
application/json
)body
the body of the object as a BSON
Binary
completionHandler
The completion handler to call when the object is put or the operation fails. This handler is executed on a non-main global
DispatchQueue
. If the operation is successful, the result will contain the result of the put request as anAWSS3PutObjectResult.
-
Signs an AWS S3 security policy for a future put object request. This future request would be made outside of the Stitch SDK. This is typically used for large requests that are better sent directly to AWS.
Declaration
Swift
func signPolicy(bucket: String, key: String, acl: String, contentType: String, _ completionHandler: @escaping (StitchResult<AWSS3SignPolicyResult>) -> Void)
Parameters
bucket
the bucket to put the object in
key
the key (or name) of the object
acl
the ACL to apply to the object (e.g. private)
contentType
the content type of the object (e.g.
application/json
)completionHandler
The completion handler to call when the policy is signed or the operation fails. This handler is executed on a non-main global
DispatchQueue
. If the operation is successful, the result will contain the result of the sign policy request as anAWSS3SignPolicyResult.