Amazon.S3.AmazonS3Client.ListBucketsAsync C# (CSharp) Method

ListBucketsAsync() public method

Initiates the asynchronous execution of the ListBuckets operation.
public ListBucketsAsync ( ListBucketsRequest request, ListBucketsResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void
request ListBucketsRequest Container for the necessary parameters to execute the ListBuckets operation on AmazonS3Client.
callback ListBucketsResponse>.AmazonServiceCallback An Action delegate that is invoked when the operation completes.
options AsyncOptions A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.
return void
        public void ListBucketsAsync(ListBucketsRequest request, AmazonServiceCallback<ListBucketsRequest, ListBucketsResponse> callback, AsyncOptions options = null)
        {
            options = options == null?new AsyncOptions():options;
            var marshaller = new ListBucketsRequestMarshaller();
            var unmarshaller = ListBucketsResponseUnmarshaller.Instance;
            Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
            if(callback !=null )
                callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
                    AmazonServiceResult<ListBucketsRequest,ListBucketsResponse> responseObject 
                            = new AmazonServiceResult<ListBucketsRequest,ListBucketsResponse>((ListBucketsRequest)req, (ListBucketsResponse)res, ex , ao.State);    
                        callback(responseObject); 
                };
            BeginInvoke<ListBucketsRequest>(request, marshaller, unmarshaller, options, callbackHelper);
        }

Same methods

AmazonS3Client::ListBucketsAsync ( ListBucketsRequest request, System cancellationToken = default(CancellationToken) ) : Task
AmazonS3Client::ListBucketsAsync ( System cancellationToken = default(CancellationToken) ) : Task
AmazonS3Client::ListBucketsAsync ( ListBucketsResponse>.AmazonServiceCallback callback, AsyncOptions options = null ) : void

Usage Example

Example #1
0
    // Use this for initialization
    void Start () {
        // ResultText is a label used for displaying status information
        Debug.Log("hallo1");

        


    Debug.Log("hallo2");
        S3Client = new AmazonS3Client(Credentials);
        Debug.Log("hallo3");
        ResultText.text = "Fetching all the Buckets";
        S3Client.ListBucketsAsync(new ListBucketsRequest(), (responseObject) =>
        {
            ResultText.text += "\n";
            if (responseObject.Exception == null)
            {
                ResultText.text += "Got Response \nPrinting now \n";
                responseObject.Response.Buckets.ForEach((s3b) =>
                {
                    ResultText.text += string.Format("bucket = {0}, created date = {1} \n",
                    s3b.BucketName, s3b.CreationDate);
                });
            }
            else
            {
                ResultText.text += "Got Exception \n";
            }
        });
    }
All Usage Examples Of Amazon.S3.AmazonS3Client::ListBucketsAsync
AmazonS3Client