本文整理汇总了C#中AmazonServiceCallback类的典型用法代码示例。如果您正苦于以下问题:C# AmazonServiceCallback类的具体用法?C# AmazonServiceCallback怎么用?C# AmazonServiceCallback使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AmazonServiceCallback类属于命名空间,在下文中一共展示了AmazonServiceCallback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostObjectAsync
/// <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));
}
}));
}
示例2: AbortMultipartUploadAsync
/// <summary>
/// Aborts a multipart upload.
///
///
/// <para>
/// 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.
/// </para>
/// 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 AbortMultipartUploadRequest used to execute the AbortMultipartUpload service method.</param>
/// <param name="key">A property of AbortMultipartUploadRequest used to execute the AbortMultipartUpload service method.</param>
/// <param name="uploadId">A property of AbortMultipartUploadRequest used to execute the AbortMultipartUpload 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 AbortMultipartUpload service method, as returned by S3.</returns>
public void AbortMultipartUploadAsync(string bucketName, string key, string uploadId, AmazonServiceCallback<AbortMultipartUploadRequest, AbortMultipartUploadResponse> callback, AsyncOptions options = null)
{
var request = new AbortMultipartUploadRequest();
request.BucketName = bucketName;
request.Key = key;
request.UploadId = uploadId;
AbortMultipartUploadAsync(request, callback, options);
}
示例3: SetIdentityPoolConfigurationAsync
/// <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);
}
示例4: DescribeIdentityUsageAsync
/// <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);
}
示例5: GetOpenIdTokenForDeveloperIdentityAsync
/// <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);
}
示例6: GetCredentialsForIdentityAsync
/// <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);
}
示例7: GetSessionTokenAsync
/// <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);
}
示例8: DeleteObjectAsync
/// <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);
}
示例9: PutBucketPolicyAsync
/// <summary>
/// Replaces a policy on a bucket. If the bucket already has a policy, the one in this
/// request completely replaces it.
/// 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 PutBucketPolicyRequest used to execute the PutBucketPolicy service method.</param>
/// <param name="policy">The bucket policy as a JSON document.</param>
/// <param name="contentMD5">A property of PutBucketPolicyRequest used to execute the PutBucketPolicy 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 PutBucketPolicy service method, as returned by S3.</returns>
public void PutBucketPolicyAsync(string bucketName, string policy, string contentMD5, AmazonServiceCallback<PutBucketPolicyRequest, PutBucketPolicyResponse> callback, AsyncOptions options = null)
{
var request = new PutBucketPolicyRequest();
request.BucketName = bucketName;
request.Policy = policy;
request.ContentMD5 = contentMD5;
PutBucketPolicyAsync(request, callback, options);
}
示例10: PutBucketAsync
/// <summary>
/// Creates a new 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 PutBucketRequest used to execute the PutBucket 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 PutBucket service method, as returned by S3.</returns>
public void PutBucketAsync(string bucketName, AmazonServiceCallback<PutBucketRequest, PutBucketResponse> callback, AsyncOptions options = null)
{
var request = new PutBucketRequest();
request.BucketName = bucketName;
PutBucketAsync(request, callback, options);
}
示例11: ListVersionsAsync
/// <summary>
/// Returns metadata about all of the versions of objects in a bucket.
/// </summary>
/// <param name="bucketName">A property of ListVersionsRequest used to execute the ListVersions service method.</param>
/// <param name="prefix">Limits the response to keys that begin with the specified prefix.</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 ListVersions service method, as returned by S3.</returns>
public void ListVersionsAsync(string bucketName, string prefix, AmazonServiceCallback<ListVersionsRequest, ListVersionsResponse> callback, AsyncOptions options = null)
{
var request = new ListVersionsRequest();
request.BucketName = bucketName;
request.Prefix = prefix;
ListVersionsAsync(request, callback, options);
}
示例12: ListPartsAsync
/// <summary>
/// Lists the parts that have been uploaded for a specific multipart upload.
/// 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 ListPartsRequest used to execute the ListParts service method.</param>
/// <param name="key">A property of ListPartsRequest used to execute the ListParts service method.</param>
/// <param name="uploadId">Upload ID identifying the multipart upload whose parts are being listed.</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 ListParts service method, as returned by S3.</returns>
public void ListPartsAsync(string bucketName, string key, string uploadId, AmazonServiceCallback<ListPartsRequest, ListPartsResponse> callback, AsyncOptions options = null)
{
var request = new ListPartsRequest();
request.BucketName = bucketName;
request.Key = key;
request.UploadId = uploadId;
ListPartsAsync(request, callback, options);
}
示例13: ListObjectsAsync
/// <summary>
/// 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.
/// </summary>
/// <param name="bucketName">A property of ListObjectsRequest used to execute the ListObjects 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 ListObjects service method, as returned by S3.</returns>
public void ListObjectsAsync(string bucketName, AmazonServiceCallback<ListObjectsRequest, ListObjectsResponse> callback, AsyncOptions options = null)
{
var request = new ListObjectsRequest();
request.BucketName = bucketName;
ListObjectsAsync(request, callback, options);
}
示例14: ListBucketsAsync
/// <summary>
/// Returns a list of all buckets owned by the authenticated sender of the request.
/// </summary>
/// <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 ListBuckets service method, as returned by S3.</returns>
public void ListBucketsAsync(AmazonServiceCallback<ListBucketsRequest, ListBucketsResponse> callback, AsyncOptions options = null)
{
ListBucketsAsync(new ListBucketsRequest(), callback, options);
}
示例15: ListBucketMetricsConfigurationsAsync
/// <summary>
/// Initiates the asynchronous execution of the ListBucketMetricsConfigurations operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListBucketMetricsConfigurations 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 ListBucketMetricsConfigurationsAsync(ListBucketMetricsConfigurationsRequest request, AmazonServiceCallback<ListBucketMetricsConfigurationsRequest, ListBucketMetricsConfigurationsResponse> callback, AsyncOptions options = null)
{
options = options == null?new AsyncOptions():options;
var marshaller = new ListBucketMetricsConfigurationsRequestMarshaller();
var unmarshaller = ListBucketMetricsConfigurationsResponseUnmarshaller.Instance;
Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
if(callback !=null )
callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => {
AmazonServiceResult<ListBucketMetricsConfigurationsRequest,ListBucketMetricsConfigurationsResponse> responseObject
= new AmazonServiceResult<ListBucketMetricsConfigurationsRequest,ListBucketMetricsConfigurationsResponse>((ListBucketMetricsConfigurationsRequest)req, (ListBucketMetricsConfigurationsResponse)res, ex , ao.State);
callback(responseObject);
};
BeginInvoke<ListBucketMetricsConfigurationsRequest>(request, marshaller, unmarshaller, options, callbackHelper);
}