AWSS3TransferManager Class Reference

Inherits from AWSService : NSObject
Declared in AWSS3TransferManager.h
AWSS3TransferManager.m

Overview

High level utility for managing transfers to Amazon S3. S3TransferManager provides a simple API for uploading and downloading content to Amazon S3, and makes extensive use of Amazon S3 multipart uploads to achieve enhanced throughput, performance and reliability.

+ defaultS3TransferManager

Returns the singleton service client. If the singleton object does not exist, the SDK instantiates the default service client with defaultServiceConfiguration from [AWSServiceManager defaultServiceManager]. The reference to this object is maintained by the SDK, and you do not need to retain it manually.

+ (instancetype)defaultS3TransferManager

Return Value

The default service client.

Discussion

For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

Swift

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
     let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
     let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)
     AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration

     return true
 }

Objective-C

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                      identityPoolId:@"YourIdentityPoolId"];
      AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1
                                                                           credentialsProvider:credentialsProvider];
      [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;

      return YES;
  }

Then call the following to get the default service client:

Swift

 let S3TransferManager = AWSS3TransferManager.defaultS3TransferManager()

Objective-C

 AWSS3TransferManager *S3TransferManager = [AWSS3TransferManager defaultS3TransferManager];

Declared In

AWSS3TransferManager.h

+ registerS3TransferManagerWithConfiguration:forKey:

Creates a service client with the given service configuration and registers it for the key.

+ (void)registerS3TransferManagerWithConfiguration:(AWSServiceConfiguration *)configuration forKey:(NSString *)key

Parameters

configuration

A service configuration object.

key

A string to identify the service client.

Discussion

For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

Swift

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
     let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
     let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
     AWSS3TransferManager.registerS3TransferManagerWithConfiguration(configuration, forKey: "USWest2S3TransferManager")

     return true
 }

Objective-C

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                     identityPoolId:@"YourIdentityPoolId"];
     AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
                                                                          credentialsProvider:credentialsProvider];

     [AWSS3TransferManager registerS3TransferManagerWithConfiguration:configuration forKey:@"USWest2S3TransferManager"];

     return YES;
 }

Then call the following to get the service client:

Swift

 let S3TransferManager = AWSS3TransferManager(forKey: "USWest2S3TransferManager")

Objective-C

 AWSS3TransferManager *S3TransferManager = [AWSS3TransferManager S3TransferManagerForKey:@"USWest2S3TransferManager"];

Warning: After calling this method, do not modify the configuration object. It may cause unspecified behaviors.

Declared In

AWSS3TransferManager.h

+ S3TransferManagerForKey:

Retrieves the service client associated with the key. You need to call + registerS3TransferManagerWithConfiguration:forKey: before invoking this method.

+ (instancetype)S3TransferManagerForKey:(NSString *)key

Parameters

key

A string to identify the service client.

Return Value

An instance of the service client.

Discussion

For example, set the default service configuration in - application:didFinishLaunchingWithOptions:

Swift

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
     let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId")
     let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider)
     AWSS3TransferManager.registerS3TransferManagerWithConfiguration(configuration, forKey: "USWest2S3TransferManager")

     return true
 }

Objective-C

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1
                                                                                                     identityPoolId:@"YourIdentityPoolId"];
     AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2
                                                                          credentialsProvider:credentialsProvider];

     [AWSS3TransferManager registerS3TransferManagerWithConfiguration:configuration forKey:@"USWest2S3TransferManager"];

     return YES;
 }

Then call the following to get the service client:

Swift

 let S3TransferManager = AWSS3TransferManager(forKey: "USWest2S3TransferManager")

Objective-C

 AWSS3TransferManager *S3TransferManager = [AWSS3TransferManager S3TransferManagerForKey:@"USWest2S3TransferManager"];

Declared In

AWSS3TransferManager.h

+ removeS3TransferManagerForKey:

Removes the service client associated with the key and release it.

+ (void)removeS3TransferManagerForKey:(NSString *)key

Parameters

key

A string to identify the service client.

Discussion

Warning: Before calling this method, make sure no method is running on this client.

Declared In

AWSS3TransferManager.h

– upload:

Schedules a new transfer to upload data to Amazon S3.

- (AWSTask *)upload:(AWSS3TransferManagerUploadRequest *)uploadRequest

Parameters

uploadRequest

The upload request.

Return Value

AWSTask.

Declared In

AWSS3TransferManager.h

– download:

Schedules a new transfer to download data from Amazon S3 and save it to the specified file.

- (AWSTask *)download:(AWSS3TransferManagerDownloadRequest *)downloadRequest

Parameters

downloadRequest

The download request.

Return Value

AWSTask.

Declared In

AWSS3TransferManager.h

– cancelAll

Cancels all of the upload and download requests.

- (AWSTask *)cancelAll

Return Value

AWSTask.

Declared In

AWSS3TransferManager.h

– pauseAll

Pauses all of the upload and download requests.

- (AWSTask *)pauseAll

Return Value

AWSTask.

Declared In

AWSS3TransferManager.h

– resumeAll:

Resumes all of the upload and download requests.

- (AWSTask *)resumeAll:(AWSS3TransferManagerResumeAllBlock)block

Parameters

block

The block to optionally re-set the progress blocks to the requests.

Return Value

AWSTask.

Declared In

AWSS3TransferManager.h

– clearCache

Clears the local cache.

- (AWSTask *)clearCache

Return Value

AWSTask.

Declared In

AWSS3TransferManager.h