This class is used to configure the thread on which the callback should be execute for a given request and pass optional state to the callback.
Example #1
0
        /// <summary>
        /// Upload data to Amazon S3 using HTTP POST.
        /// </summary>
        /// <remarks>
        /// For more information, <see href="http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingHTTPPOST.html"/>
        /// </remarks>
        /// <param name="request">Request object which describes the data to POST</param>
        /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
        /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        public void PostObjectAsync(PostObjectRequest request, AmazonServiceCallback<PostObjectRequest, PostObjectResponse> callback, AsyncOptions options = null)
        {
            options = options == null ? new AsyncOptions() : options;

            Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper
                = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) =>
                {
                    AmazonServiceResult<PostObjectRequest, PostObjectResponse> responseObject
                        = new AmazonServiceResult<PostObjectRequest, PostObjectResponse>((PostObjectRequest)req, (PostObjectResponse)res, ex, ao.State);
                    if (callback != null)
                        callback(responseObject);
                };

            ThreadPool.QueueUserWorkItem(new WaitCallback(delegate
            {
                // Provide a default policy if user doesn't set it.
                try
                {
                    InferContentType(request);
                    if (request.SignedPolicy == null)
                    {
                        CreateSignedPolicy(request);
                    }
                    PostObject(request, options, callbackHelper);
                }
                catch (Exception e)
                {
                    callback(new AmazonServiceResult<PostObjectRequest, PostObjectResponse>(request, null, e, options.State));
                }
            }));

        }
 public static void AsyncExecutor(Action action, AsyncOptions options)
 {
     if (options.ExecuteCallbackOnMainThread)
     {
         if (UnityInitializer.IsMainThread())
         {
             SafeExecute(action);
         }
         else
         {
             UnityRequestQueue.Instance.ExecuteOnMainThread(action);
         }
     }
     else
     {
         if (!UnityInitializer.IsMainThread())
         {
             SafeExecute(action);
         }
         else
         {
             ThreadPool.QueueUserWorkItem((state) =>
             {
                 SafeExecute(action);
             });
         }
     }
 }
 /// <summary>
 /// Initiates the asynchronous execution of the GetRemaining operation.
 /// <seealso cref="Amazon.DynamoDBv2.DocumentModel.Search.GetRemaining"/>
 /// </summary>        
 /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> 
 /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
 public void GetRemainingAsync(AmazonDynamoDBCallback<List<Document>> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync<List<Document>>(
         () => { return GetRemainingHelper(true); },
         asyncOptions,
         callback);
 }
Example #4
0
 internal static void LoadTableAsync(IAmazonDynamoDB ddbClient, string tableName, Table.DynamoDBConsumer consumer, DynamoDBEntryConversion conversion, AmazonDynamoDBCallback<Table> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions??new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync<Table>(
     ()=>{
         return LoadTable(ddbClient,tableName,consumer,conversion);
     },asyncOptions,callback);
 }
 /// <summary>
 /// Initiates the asynchronous execution of the Execute operation.
 /// <seealso cref="Amazon.DynamoDBv2.DataModel.MultiTableBatchWrite.Execute"/>
 /// </summary>        
 /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param>
 /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
 public void ExecuteAsync(AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () => { ExecuteHelper(true); },
         asyncOptions,
         callback);
 }
Example #6
0
 /// <summary>
 /// Initiates the asynchronous execution of the PutItem operation.
 /// </summary>
 /// <param name="doc">Document to save.</param>        
 /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> 
 /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
 public void PutItemAsync(Document doc, AmazonDynamoDBCallback<Document> callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync<Document>(
         () => { return PutItemHelper(doc, null, true); },
         asyncOptions,
         callback);
 }
Example #7
0
        /// <summary>
        /// Synchronize <see cref="Dataset"/> between local storage and remote storage.
        /// </summary>
        public virtual void SynchronizeAsync(AsyncOptions options = null)
        {
            options = options == null ? new AsyncOptions() : options;
            if (_netReachability.NetworkStatus == NetworkStatus.NotReachable)
            {
                FireSyncFailureEvent(new NetworkException("Network connectivity unavailable."), options);
                return;
            }

            SynchronizeHelperAsync(options);
        }
Example #8
0
 /// <summary>
 /// Initiates the asynchronous execution of the UploadFrom operation.
 /// </summary>
 /// <param name="sourcePath">Path of the file to be uploaded.</param>        
 /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> 
 /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
 public void UploadFromAsync(string sourcePath, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () =>
         {
             this.s3ClientCache.GetClient(this.RegionAsEndpoint).UploadObjectFromFilePath(
                 this.linker.s3.bucket, this.linker.s3.key, sourcePath, null);
         },
         asyncOptions,
         callback);
 }
Example #9
0
 /// <summary>
 /// Attempt to synchronize <see cref="Dataset"/> when connectivity is available. If
 /// the connectivity is available right away, it behaves the same as
 /// <see cref="Dataset.SynchronizeAsync(AsyncOptions)"/>. Otherwise it listens to connectivity
 /// changes, and will do a sync once the connectivity is back. Note that if
 /// this method is called multiple times, only the last synchronize request
 /// is kept. If either the dataset or the callback is garbage collected
 /// , this method will not perform a sync and the callback won't fire.
 /// </summary>
 public virtual void SynchronizeOnConnectivity(AsyncOptions options = null)
 {
     if (_netReachability.NetworkStatus != NetworkStatus.NotReachable)
     {
         SynchronizeAsync(options);
     }
     else
     {
         waitingForConnectivity = true;
         OnConnectivityOptions = options;
     }
 }
Example #10
0
 /// <summary>
 /// Initiates the asynchronous execution of the DownloadTo operation.
 /// </summary>
 /// <param name="downloadPath">Path to save the file.</param>
 /// <param name="callback">The callback that will be invoked when the asynchronous operation completes.</param> 
 /// <param name="asyncOptions">An instance of AsyncOptions that specifies how the async method should be executed.</param>
 public void DownloadToAsync(string downloadPath, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null)
 {
     asyncOptions = asyncOptions ?? new AsyncOptions();
     DynamoDBAsyncExecutor.ExecuteAsync(
         () =>
         {
             this.s3ClientCache.GetClient(this.RegionAsEndpoint).DownloadToFilePath(
         this.linker.s3.bucket, this.linker.s3.key, downloadPath, null);
         },
         asyncOptions,
         callback);
 }
 /// <summary>
 /// Refreshes dataset metadata. Dataset metadata is pulled from remote
 /// storage and stored in local storage. Their record data isn't pulled down
 /// until you sync each dataset.
 /// </summary>
 /// <param name="callback">Callback once the refresh is complete</param>
 /// <param name="options">Options for asynchronous execution</param>
 /// <exception cref="Amazon.CognitoSync.SyncManager.DataStorageException">Thrown when fail to fresh dataset metadata</exception>
 public void RefreshDatasetMetadataAsync(AmazonCognitoSyncCallback<List<DatasetMetadata>> callback, AsyncOptions options = null)
 {
     options = options ?? new AsyncOptions();
     AmazonCognitoSyncResult<List<DatasetMetadata>> cognitoResult = new AmazonCognitoSyncResult<List<DatasetMetadata>>(options.State);
     
     InternalSDKUtils.AsyncExecutor(() =>
     {
         try
         {
             var response = Remote.ListDatasetMetadata();
             Local.UpdateDatasetMetadata(IdentityId, response);
             cognitoResult.Response = response;
         }
         catch (Exception e)
         {
             cognitoResult.Exception = e;
         }
         callback(cognitoResult);
     }, options);
 }
        private void PopulateGetDatasetMetadataAsync(string nextToken, List<DatasetMetadata> datasets, AmazonCognitoSyncCallback<List<DatasetMetadata>> callback, AsyncOptions options)
        {

            ListDatasetsRequest request = new ListDatasetsRequest();
            // a large enough number to reduce # of requests
            request.MaxResults = 64;
            request.NextToken = nextToken;

            client.ListDatasetsAsync(request, (responseObj) =>
            {
                Exception ex = responseObj.Exception;
                ListDatasetsResponse response = responseObj.Response;
                object obj = responseObj.state;
                if (ex != null)
                {
                    InternalSDKUtils.AsyncExecutor(() => callback(new AmazonCognitoSyncResult<List<DatasetMetadata>>(null, ex, obj)), options);
                }
                else
                {
                    foreach (Amazon.CognitoSync.Model.Dataset dataset in response.Datasets)
                    {
                        datasets.Add(ModelToDatasetMetadata(dataset));
                    }

                    nextToken = response.NextToken;

                    if (nextToken == null)
                    {
                        InternalSDKUtils.AsyncExecutor(() => callback(new AmazonCognitoSyncResult<List<DatasetMetadata>>(datasets, null, obj)), options);
                        return;
                    }
                    PopulateGetDatasetMetadataAsync(nextToken, datasets, callback, options);
                }
            },
            options);
        }
 /// <summary>
 /// Gets an OpenID token, using a known Cognito ID. This known Cognito ID is returned
 /// by <a>GetId</a>. You can optionally add additional logins for the identity. Supplying
 /// multiple logins creates an implicit link.
 /// 
 ///  
 /// <para>
 /// The OpenId token is valid for 15 minutes.
 /// </para>
 /// </summary>
 /// <param name="identityId">A unique identifier in the format REGION:GUID.</param>
 /// 
 /// <returns>The response from the GetOpenIdToken service method, as returned by CognitoIdentity.</returns>
 /// <exception cref="Amazon.CognitoIdentity.Model.InternalErrorException">
 /// Thrown when the service encounters an error during processing the request.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.InvalidParameterException">
 /// Thrown for missing or bad input parameter(s).
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.NotAuthorizedException">
 /// Thrown when a user is not authorized to access the requested resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceConflictException">
 /// Thrown when a user tries to use a login which is already linked to another account.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceNotFoundException">
 /// Thrown when the requested resource (for example, a dataset or record) does not exist.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.TooManyRequestsException">
 /// Thrown when a request is throttled.
 /// </exception>
 public void GetOpenIdTokenAsync(string identityId, AmazonServiceCallback<GetOpenIdTokenRequest, GetOpenIdTokenResponse> callback, AsyncOptions options = null)
 {
     var request = new GetOpenIdTokenRequest();
     request.IdentityId = identityId;
     GetOpenIdTokenAsync(request, callback, options);
 }
 /// <summary>
 /// Returns credentials for the the provided identity ID. Any provided logins will be
 /// validated against supported login providers. If the token is for cognito-identity.amazonaws.com,
 /// it will be passed through to AWS Security Token Service with the appropriate role
 /// for the token.
 /// </summary>
 /// <param name="identityId">A unique identifier in the format REGION:GUID.</param>
 /// <param name="logins">A set of optional name-value pairs that map provider names to provider tokens.</param>
 /// 
 /// <returns>The response from the GetCredentialsForIdentity service method, as returned by CognitoIdentity.</returns>
 /// <exception cref="Amazon.CognitoIdentity.Model.InternalErrorException">
 /// Thrown when the service encounters an error during processing the request.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.InvalidIdentityPoolConfigurationException">
 /// Thrown if the identity pool has no role associated for the given auth type (auth/unauth)
 /// or if the AssumeRole fails.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.InvalidParameterException">
 /// Thrown for missing or bad input parameter(s).
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.NotAuthorizedException">
 /// Thrown when a user is not authorized to access the requested resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceConflictException">
 /// Thrown when a user tries to use a login which is already linked to another account.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceNotFoundException">
 /// Thrown when the requested resource (for example, a dataset or record) does not exist.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.TooManyRequestsException">
 /// Thrown when a request is throttled.
 /// </exception>
 public void GetCredentialsForIdentityAsync(string identityId, Dictionary<string, string> logins, AmazonServiceCallback<GetCredentialsForIdentityRequest, GetCredentialsForIdentityResponse> callback, AsyncOptions options = null)
 {
     var request = new GetCredentialsForIdentityRequest();
     request.IdentityId = identityId;
     request.Logins = logins;
     GetCredentialsForIdentityAsync(request, callback, options);
 }
 /// <summary>
 /// Sets the roles for an identity pool. These roles are used when making calls to <code>GetCredentialsForIdentity</code>
 /// action.
 /// </summary>
 /// <param name="identityPoolId">An identity pool ID in the format REGION:GUID.</param>
 /// <param name="roles">The map of roles associated with this pool. Currently only authenticated and unauthenticated roles are supported.</param>
 /// 
 /// <returns>The response from the SetIdentityPoolRoles service method, as returned by CognitoIdentity.</returns>
 /// <exception cref="Amazon.CognitoIdentity.Model.InternalErrorException">
 /// Thrown when the service encounters an error during processing the request.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.InvalidParameterException">
 /// Thrown for missing or bad input parameter(s).
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.NotAuthorizedException">
 /// Thrown when a user is not authorized to access the requested resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceConflictException">
 /// Thrown when a user tries to use a login which is already linked to another account.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceNotFoundException">
 /// Thrown when the requested resource (for example, a dataset or record) does not exist.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.TooManyRequestsException">
 /// Thrown when a request is throttled.
 /// </exception>
 public void SetIdentityPoolRolesAsync(string identityPoolId, Dictionary<string, string> roles, AmazonServiceCallback<SetIdentityPoolRolesRequest, SetIdentityPoolRolesResponse> callback, AsyncOptions options = null)
 {
     var request = new SetIdentityPoolRolesRequest();
     request.IdentityPoolId = identityPoolId;
     request.Roles = roles;
     SetIdentityPoolRolesAsync(request, callback, options);
 }
Example #16
0
        protected IAsyncResult BeginInvoke <TRequest>(TRequest request,
                                                      IMarshaller <IRequest, AmazonWebServiceRequest> marshaller, ResponseUnmarshaller unmarshaller, AsyncOptions asyncOptions,
                                                      Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper)
            where TRequest : AmazonWebServiceRequest
        {
            ThrowIfDisposed();

            asyncOptions = asyncOptions ?? new AsyncOptions();
            var executionContext = new AsyncExecutionContext(
                new AsyncRequestContext(this.Config.LogMetrics, Signer)
            {
                ClientConfig    = this.Config,
                Marshaller      = marshaller,
                OriginalRequest = request,
                Unmarshaller    = unmarshaller,
                Action          = callbackHelper,
                AsyncOptions    = asyncOptions,
                IsAsync         = true
            },
                new AsyncResponseContext()
                );

            return(this.RuntimePipeline.InvokeAsync(executionContext));
        }
        /// <summary>
        /// Returns an instance of ImmutableCredentials for this instance
        /// </summary>
        /// <param name="callback">The callback which is executed when the asynchronous operations is completed</param>
        /// <param name="options">Options for executing asynchronous operation</param>
        public void GetCredentialsAsync(AmazonCognitoIdentityCallback<ImmutableCredentials> callback, AsyncOptions options = null)
        {
            options = options == null ? new AsyncOptions() : options;

            CognitoIdentityAsyncExecutor.ExecuteAsync<ImmutableCredentials>(() =>
            {
                return GetCredentials();
            }, options, callback);
        }
        /// <summary>
        /// Gets the Identity Id corresponding to the credentials retrieved from Cognito.
        /// Note: this setting may change during execution. To be notified of its
        /// new value, attach a listener to IdentityChangedEvent
        /// </summary>
        /// <param name="callback">The callback which is executed when the asynchronous operations is completed</param>
        /// <param name="options">Options for executing asynchronous operation</param>
        public void GetIdentityIdAsync(AmazonCognitoIdentityCallback<string> callback, AsyncOptions options = null)
        {
            options = options == null ? new AsyncOptions() : options;

            CognitoIdentityAsyncExecutor.ExecuteAsync<string>(() =>
            {
                return GetIdentityId();
            }, options, callback);
        }
 /// <summary>
 /// Returns a set of temporary credentials for an AWS account or IAM user. The credentials
 /// consist of an access key ID, a secret access key, and a security token. Typically,
 /// you use <code>GetSessionToken</code> if you want to use MFA to protect programmatic
 /// calls to specific AWS APIs like Amazon EC2 <code>StopInstances</code>. MFA-enabled
 /// IAM users would need to call <code>GetSessionToken</code> and submit an MFA code that
 /// is associated with their MFA device. Using the temporary security credentials that
 /// are returned from the call, IAM users can then make programmatic calls to APIs that
 /// require MFA authentication. 
 /// 
 ///  
 /// <para>
 /// The <code>GetSessionToken</code> action must be called by using the long-term AWS
 /// security credentials of the AWS account or an IAM user. Credentials that are created
 /// by IAM users are valid for the duration that you specify, between 900 seconds (15
 /// minutes) and 129600 seconds (36 hours); credentials that are created by using account
 /// credentials have a maximum duration of 3600 seconds (1 hour). 
 /// </para>
 ///  <note> 
 /// <para>
 /// We recommend that you do not call <code>GetSessionToken</code> with root account credentials.
 /// Instead, follow our <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/IAMBestPractices.html#create-iam-users">best
 /// practices</a> by creating one or more IAM users, giving them the necessary permissions,
 /// and using IAM users for everyday interaction with AWS. 
 /// </para>
 ///  </note> 
 /// <para>
 /// The permissions associated with the temporary security credentials returned by <code>GetSessionToken</code>
 /// are based on the permissions associated with account or IAM user whose credentials
 /// are used to call the action. If <code>GetSessionToken</code> is called using root
 /// account credentials, the temporary credentials have root account permissions. Similarly,
 /// if <code>GetSessionToken</code> is called using the credentials of an IAM user, the
 /// temporary credentials have the same permissions as the IAM user. 
 /// </para>
 ///  
 /// <para>
 /// For more information about using <code>GetSessionToken</code> to create temporary
 /// credentials, go to <a href="http://docs.aws.amazon.com/STS/latest/UsingSTS/CreatingSessionTokens.html"
 /// target="_blank">Creating Temporary Credentials to Enable Access for IAM Users</a>.
 /// 
 /// </para>
 /// </summary>
  /// <param name="options">
  ///     A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
  ///     procedure using the AsyncState property.
  /// </param>
 /// 
 /// <returns>The response from the GetSessionToken service method, as returned by SecurityTokenService.</returns>
 public void GetSessionTokenAsync(AmazonServiceCallback<GetSessionTokenRequest, GetSessionTokenResponse> callback, AsyncOptions options = null)
 {
     GetSessionTokenAsync(new GetSessionTokenRequest(), callback, options);
 }
Example #20
0
        /// <summary>
        /// Refreshes dataset metadata. Dataset metadata is pulled from remote
        /// storage and stored in local storage. Their record data isn't pulled down
        /// until you sync each dataset.
        /// </summary>
        /// <param name="callback">Callback once the refresh is complete</param>
        /// <param name="options">Options for asynchronous execution</param>
        /// <exception cref="Amazon.CognitoSync.SyncManager.DataStorageException">Thrown when fail to fresh dataset metadata</exception>
        public void RefreshDatasetMetadataAsync(AmazonCognitoSyncCallback<List<DatasetMetadata>> callback, AsyncOptions options = null)
        {
            options = options ?? new AsyncOptions();

            remote.GetDatasetMetadataAsync((cognitoResult) =>
            {
                Exception ex = cognitoResult.Exception;
                List<DatasetMetadata> res = cognitoResult.Response;
                if (ex != null)
                {
                    InternalSDKUtils.AsyncExecutor(() => callback(cognitoResult), options);
                }
                else
                {
                    Local.UpdateDatasetMetadata(GetIdentityId(), res);
                    InternalSDKUtils.AsyncExecutor(() => callback(cognitoResult), options);
                }
            }, options);
        }
Example #21
0
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteObject operation.
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value for this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the DeleteObject operation on AmazonS3Client.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void DeleteObjectAsync(DeleteObjectRequest request, AmazonServiceCallback<DeleteObjectRequest, DeleteObjectResponse> callback, AsyncOptions options = null)
 {
     if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW)
     {
         throw new InvalidOperationException("DeleteObject is only allowed with AWSConfigs.HttpClientOption.UnityWebRequest API option");
     }
     options = options == null?new AsyncOptions():options;
     var marshaller = new DeleteObjectRequestMarshaller();
     var unmarshaller = DeleteObjectResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<DeleteObjectRequest,DeleteObjectResponse> responseObject 
                     = new AmazonServiceResult<DeleteObjectRequest,DeleteObjectResponse>((DeleteObjectRequest)req, (DeleteObjectResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<DeleteObjectRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
Example #22
0
 /// <summary>
 /// 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.
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value of this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// <param name="bucketName">A property of DeleteObjectRequest used to execute the DeleteObject service method.</param>
 /// <param name="key">A property of DeleteObjectRequest used to execute the DeleteObject service method.</param>
 /// <param name="versionId">VersionId used to reference a specific version of the object.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">
 ///     A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///     procedure using the AsyncState property.
 /// </param>
 /// 
 /// <returns>The response from the DeleteObject service method, as returned by S3.</returns>
 public void DeleteObjectAsync(string bucketName, string key, string versionId,  AmazonServiceCallback<DeleteObjectRequest, DeleteObjectResponse> callback, AsyncOptions options = null)
 {
     var request = new DeleteObjectRequest();
     request.BucketName = bucketName;
     request.Key = key;
     request.VersionId = versionId;
     DeleteObjectAsync(request, callback, options);
 }
Example #23
0
        protected IAsyncResult BeginInvoke <TRequest>(TRequest request,
                                                      IMarshaller <IRequest, AmazonWebServiceRequest> marshaller, ResponseUnmarshaller unmarshaller, AsyncOptions asyncOptions,
                                                      Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper)
            where TRequest : AmazonWebServiceRequest
        {
            var options = new InvokeOptions();

            options.RequestMarshaller    = marshaller;
            options.ResponseUnmarshaller = unmarshaller;
            return(BeginInvoke(request, options, asyncOptions, callbackHelper));
        }
 /// <summary>
 /// Initiates the asynchronous execution of the SetIdentityPoolConfiguration operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the SetIdentityPoolConfiguration operation on AmazonCognitoSyncClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void SetIdentityPoolConfigurationAsync(SetIdentityPoolConfigurationRequest request, AmazonServiceCallback<SetIdentityPoolConfigurationRequest, SetIdentityPoolConfigurationResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new SetIdentityPoolConfigurationRequestMarshaller();
     var unmarshaller = SetIdentityPoolConfigurationResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<SetIdentityPoolConfigurationRequest,SetIdentityPoolConfigurationResponse> responseObject 
                     = new AmazonServiceResult<SetIdentityPoolConfigurationRequest,SetIdentityPoolConfigurationResponse>((SetIdentityPoolConfigurationRequest)req, (SetIdentityPoolConfigurationResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<SetIdentityPoolConfigurationRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
 /// <summary>
 /// Initiates the asynchronous execution of the DescribeIdentityUsage operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the DescribeIdentityUsage operation on AmazonCognitoSyncClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void DescribeIdentityUsageAsync(DescribeIdentityUsageRequest request, AmazonServiceCallback<DescribeIdentityUsageRequest, DescribeIdentityUsageResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new DescribeIdentityUsageRequestMarshaller();
     var unmarshaller = DescribeIdentityUsageResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<DescribeIdentityUsageRequest,DescribeIdentityUsageResponse> responseObject 
                     = new AmazonServiceResult<DescribeIdentityUsageRequest,DescribeIdentityUsageResponse>((DescribeIdentityUsageRequest)req, (DescribeIdentityUsageResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<DescribeIdentityUsageRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
 /// <summary>
 /// Initiates the asynchronous execution of the GetOpenIdTokenForDeveloperIdentity operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the GetOpenIdTokenForDeveloperIdentity operation on AmazonCognitoIdentityClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void GetOpenIdTokenForDeveloperIdentityAsync(GetOpenIdTokenForDeveloperIdentityRequest request, AmazonServiceCallback<GetOpenIdTokenForDeveloperIdentityRequest, GetOpenIdTokenForDeveloperIdentityResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new GetOpenIdTokenForDeveloperIdentityRequestMarshaller();
     var unmarshaller = GetOpenIdTokenForDeveloperIdentityResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<GetOpenIdTokenForDeveloperIdentityRequest,GetOpenIdTokenForDeveloperIdentityResponse> responseObject 
                     = new AmazonServiceResult<GetOpenIdTokenForDeveloperIdentityRequest,GetOpenIdTokenForDeveloperIdentityResponse>((GetOpenIdTokenForDeveloperIdentityRequest)req, (GetOpenIdTokenForDeveloperIdentityResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<GetOpenIdTokenForDeveloperIdentityRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
Example #27
0
        protected IAsyncResult BeginInvoke(AmazonWebServiceRequest request, InvokeOptionsBase options, AsyncOptions asyncOptions,
                                           Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper)
        {
            ThrowIfDisposed();

            asyncOptions = asyncOptions ?? new AsyncOptions();
            var executionContext = new AsyncExecutionContext(
                new AsyncRequestContext(this.Config.LogMetrics, Signer)
            {
                ClientConfig    = this.Config,
                Marshaller      = options.RequestMarshaller,
                OriginalRequest = request,
                Unmarshaller    = options.ResponseUnmarshaller,
                Action          = callbackHelper,
                AsyncOptions    = asyncOptions,
                IsAsync         = true,
                ServiceMetaData = this.ServiceMetadata,
                Options         = options
            },
                new AsyncResponseContext()
                );

            return(this.RuntimePipeline.InvokeAsync(executionContext));
        }
 /// <summary>
 /// Gets usage details (for example, data storage) about a particular identity pool.
 /// 
 ///  
 /// <para>
 /// This API can only be called with developer credentials. You cannot call this API with
 /// the temporary user credentials provided by Cognito Identity.
 /// </para>
 /// </summary>
 /// <param name="identityPoolId">A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. GUID generation is unique within a region.</param>
 /// <param name="options">
  ///     A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
  ///     procedure using the AsyncState property.
  /// </param>
 /// 
 /// <returns>The response from the DescribeIdentityPoolUsage service method, as returned by CognitoSync.</returns>
 /// <exception cref="Amazon.CognitoSync.Model.InternalErrorException">
 /// Indicates an internal service error.
 /// </exception>
 /// <exception cref="Amazon.CognitoSync.Model.InvalidParameterException">
 /// Thrown when a request parameter does not comply with the associated constraints.
 /// </exception>
 /// <exception cref="Amazon.CognitoSync.Model.NotAuthorizedException">
 /// Thrown when a user is not authorized to access the requested resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoSync.Model.ResourceNotFoundException">
 /// Thrown if the resource doesn't exist.
 /// </exception>
 /// <exception cref="Amazon.CognitoSync.Model.TooManyRequestsException">
 /// Thrown if the request is throttled.
 /// </exception>
 public void DescribeIdentityPoolUsageAsync(string identityPoolId,  AmazonServiceCallback<DescribeIdentityPoolUsageRequest, DescribeIdentityPoolUsageResponse> callback, AsyncOptions options = null)
 {
     var request = new DescribeIdentityPoolUsageRequest();
     request.IdentityPoolId = identityPoolId;
     DescribeIdentityPoolUsageAsync(request, callback, options);
 }
Example #29
0
 /// <summary>
 /// Uploads a part by copying data from an existing object as data source.
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value of this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// <param name="sourceBucket">A property of CopyPartRequest used to execute the CopyPart service method.</param>
 /// <param name="sourceKey">A property of CopyPartRequest used to execute the CopyPart service method.</param>
 /// <param name="sourceVersionId">A property of CopyPartRequest used to execute the CopyPart service method.</param>
 /// <param name="destinationBucket">A property of CopyPartRequest used to execute the CopyPart service method.</param>
 /// <param name="destinationKey">A property of CopyPartRequest used to execute the CopyPart service method.</param>
 /// <param name="uploadId">Upload ID identifying the multipart upload whose part is being copied.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">
 ///     A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///     procedure using the AsyncState property.
 /// </param>
 /// 
 /// <returns>The response from the CopyPart service method, as returned by S3.</returns>
 public void CopyPartAsync(string sourceBucket, string sourceKey, string sourceVersionId, string destinationBucket, string destinationKey, string uploadId,  AmazonServiceCallback<CopyPartRequest, CopyPartResponse> callback, AsyncOptions options = null)
 {
     var request = new CopyPartRequest();
     request.SourceBucket = sourceBucket;
     request.SourceKey = sourceKey;
     request.SourceVersionId = sourceVersionId;
     request.DestinationBucket = destinationBucket;
     request.DestinationKey = destinationKey;
     request.UploadId = uploadId;
     CopyPartAsync(request, callback, options);
 }
 /// <summary>
 /// Gets the configuration settings of an identity pool.
 /// 
 ///  
 /// <para>
 /// This API can only be called with developer credentials. You cannot call this API with
 /// the temporary user credentials provided by Cognito Identity.
 /// </para>
 /// </summary>
 /// <param name="identityPoolId">A name-spaced GUID (for example, us-east-1:23EC4050-6AEA-7089-A2DD-08002EXAMPLE) created by Amazon Cognito. This is the ID of the pool for which to return a configuration.</param>
 /// <param name="options">
  ///     A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
  ///     procedure using the AsyncState property.
  /// </param>
 /// 
 /// <returns>The response from the GetIdentityPoolConfiguration service method, as returned by CognitoSync.</returns>
 /// <exception cref="Amazon.CognitoSync.Model.InternalErrorException">
 /// Indicates an internal service error.
 /// </exception>
 /// <exception cref="Amazon.CognitoSync.Model.InvalidParameterException">
 /// Thrown when a request parameter does not comply with the associated constraints.
 /// </exception>
 /// <exception cref="Amazon.CognitoSync.Model.NotAuthorizedException">
 /// Thrown when a user is not authorized to access the requested resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoSync.Model.ResourceNotFoundException">
 /// Thrown if the resource doesn't exist.
 /// </exception>
 /// <exception cref="Amazon.CognitoSync.Model.TooManyRequestsException">
 /// Thrown if the request is throttled.
 /// </exception>
 public void GetIdentityPoolConfigurationAsync(string identityPoolId,  AmazonServiceCallback<GetIdentityPoolConfigurationRequest, GetIdentityPoolConfigurationResponse> callback, AsyncOptions options = null)
 {
     var request = new GetIdentityPoolConfigurationRequest();
     request.IdentityPoolId = identityPoolId;
     GetIdentityPoolConfigurationAsync(request, callback, options);
 }
Example #31
0
 /// <summary>
 /// This operation removes the website configuration from the bucket.
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value of this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// <param name="bucketName">A property of DeleteBucketWebsiteRequest used to execute the DeleteBucketWebsite service method.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">
 ///     A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///     procedure using the AsyncState property.
 /// </param>
 /// 
 /// <returns>The response from the DeleteBucketWebsite service method, as returned by S3.</returns>
 public void DeleteBucketWebsiteAsync(string bucketName,  AmazonServiceCallback<DeleteBucketWebsiteRequest, DeleteBucketWebsiteResponse> callback, AsyncOptions options = null)
 {
     var request = new DeleteBucketWebsiteRequest();
     request.BucketName = bucketName;
     DeleteBucketWebsiteAsync(request, callback, options);
 }
 /// <summary>
 /// Initiates the asynchronous execution of the UpdateRecords operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the UpdateRecords operation on AmazonCognitoSyncClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void UpdateRecordsAsync(UpdateRecordsRequest request, AmazonServiceCallback<UpdateRecordsRequest, UpdateRecordsResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new UpdateRecordsRequestMarshaller();
     var unmarshaller = UpdateRecordsResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<UpdateRecordsRequest,UpdateRecordsResponse> responseObject 
                     = new AmazonServiceResult<UpdateRecordsRequest,UpdateRecordsResponse>((UpdateRecordsRequest)req, (UpdateRecordsResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<UpdateRecordsRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
Example #33
0
 /// <summary>
 /// Deletes the lifecycle configuration from the bucket.
 /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value of this configuration option is AWSConfigs.HttpClientOption.UnityWWW
 /// </summary>
 /// <param name="bucketName">A property of DeleteLifecycleConfigurationRequest used to execute the DeleteLifecycleConfiguration service method.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">
 ///     A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///     procedure using the AsyncState property.
 /// </param>
 /// 
 /// <returns>The response from the DeleteLifecycleConfiguration service method, as returned by S3.</returns>
 public void DeleteLifecycleConfigurationAsync(string bucketName,  AmazonServiceCallback<DeleteLifecycleConfigurationRequest, DeleteLifecycleConfigurationResponse> callback, AsyncOptions options = null)
 {
     var request = new DeleteLifecycleConfigurationRequest();
     request.BucketName = bucketName;
     DeleteLifecycleConfigurationAsync(request, callback, options);
 }