GetACLAsync() public method

Initiates the asynchronous execution of the GetACL operation.
public GetACLAsync ( Amazon.S3.Model.GetACLRequest request, System cancellationToken = default(CancellationToken) ) : Task
request Amazon.S3.Model.GetACLRequest Container for the necessary parameters to execute the GetACL operation.
cancellationToken System /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
return Task
Beispiel #1
0
        public static GetACLResponse GetACLHelper(AmazonS3Client client, string bucketName, string key)
        {
            GetACLResponse r = null;
            Exception responseException = null;
            AutoResetEvent ars = new AutoResetEvent(false);

            client.GetACLAsync(new GetACLRequest()
            {
                BucketName = bucketName,
                Key = key
            }, (response) =>
            {
                responseException = response.Exception;
                if (responseException == null)
                {
                    r = response.Response;
                }
                ars.Set();
            }, new AsyncOptions { ExecuteCallbackOnMainThread = false });
            ars.WaitOne();

            if (responseException != null)
            {
                throw responseException;
            }
            return r;
        }