public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.S3.Model.GetBucketVersioningRequest(); if (cmdletContext.BucketName != null) { request.BucketName = cmdletContext.BucketName; } if (cmdletContext.ExpectedBucketOwner != null) { request.ExpectedBucketOwner = cmdletContext.ExpectedBucketOwner; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
/// <summary> /// Initiates the asynchronous execution of the GetBucketVersioning operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetBucketVersioning operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<GetBucketVersioningResponse> GetBucketVersioningAsync(GetBucketVersioningRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetBucketVersioningRequestMarshaller(); var unmarshaller = GetBucketVersioningResponseUnmarshaller.Instance; return InvokeAsync<GetBucketVersioningRequest,GetBucketVersioningResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal GetBucketVersioningResponse GetBucketVersioning(GetBucketVersioningRequest request) { var marshaller = new GetBucketVersioningRequestMarshaller(); var unmarshaller = GetBucketVersioningResponseUnmarshaller.Instance; return Invoke<GetBucketVersioningRequest,GetBucketVersioningResponse>(request, marshaller, unmarshaller); }
private Amazon.S3.Model.GetBucketVersioningResponse CallAWSServiceOperation(IAmazonS3 client, Amazon.S3.Model.GetBucketVersioningRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Simple Storage Service (S3)", "GetBucketVersioning"); try { #if DESKTOP return(client.GetBucketVersioning(request)); #elif CORECLR return(client.GetBucketVersioningAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
IAsyncResult invokeGetBucketVersioning(GetBucketVersioningRequest getBucketVersioningRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new GetBucketVersioningRequestMarshaller().Marshall(getBucketVersioningRequest); var unmarshaller = GetBucketVersioningResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the GetBucketVersioning operation. /// <seealso cref="Amazon.S3.IAmazonS3.GetBucketVersioning"/> /// </summary> /// /// <param name="getBucketVersioningRequest">Container for the necessary parameters to execute the GetBucketVersioning operation on /// AmazonS3.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">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>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking /// EndGetBucketVersioning operation.</returns> public IAsyncResult BeginGetBucketVersioning(GetBucketVersioningRequest getBucketVersioningRequest, AsyncCallback callback, object state) { return invokeGetBucketVersioning(getBucketVersioningRequest, callback, state, false); }
/// <summary> /// <para>Returns the versioning state of a bucket.</para> /// </summary> /// /// <param name="getBucketVersioningRequest">Container for the necessary parameters to execute the GetBucketVersioning service method on /// AmazonS3.</param> /// /// <returns>The response from the GetBucketVersioning service method, as returned by AmazonS3.</returns> /// public GetBucketVersioningResponse GetBucketVersioning(GetBucketVersioningRequest getBucketVersioningRequest) { IAsyncResult asyncResult = invokeGetBucketVersioning(getBucketVersioningRequest, null, null, true); return EndGetBucketVersioning(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the GetBucketVersioning operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetBucketVersioning 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 GetBucketVersioningAsync(GetBucketVersioningRequest request, AmazonServiceCallback<GetBucketVersioningRequest, GetBucketVersioningResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new GetBucketVersioningRequestMarshaller(); var unmarshaller = GetBucketVersioningResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<GetBucketVersioningRequest,GetBucketVersioningResponse> responseObject = new AmazonServiceResult<GetBucketVersioningRequest,GetBucketVersioningResponse>((GetBucketVersioningRequest)req, (GetBucketVersioningResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<GetBucketVersioningRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// Returns the versioning state of a bucket. /// </summary> /// <param name="bucketName">A property of GetBucketVersioningRequest used to execute the GetBucketVersioning 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 GetBucketVersioning service method, as returned by S3.</returns> public void GetBucketVersioningAsync(string bucketName, AmazonServiceCallback<GetBucketVersioningRequest, GetBucketVersioningResponse> callback, AsyncOptions options = null) { var request = new GetBucketVersioningRequest(); request.BucketName = bucketName; GetBucketVersioningAsync(request, callback, options); }
/// <summary> /// Returns the versioning state of a bucket. /// </summary> /// <param name="bucketName">A property of GetBucketVersioningRequest used to execute the GetBucketVersioning service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the GetBucketVersioning service method, as returned by S3.</returns> public Task<GetBucketVersioningResponse> GetBucketVersioningAsync(string bucketName, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new GetBucketVersioningRequest(); request.BucketName = bucketName; return GetBucketVersioningAsync(request, cancellationToken); }
/// <summary> /// Returns the versioning state of a bucket. /// </summary> /// <param name="bucketName">A property of GetBucketVersioningRequest used to execute the GetBucketVersioning service method.</param> /// /// <returns>The response from the GetBucketVersioning service method, as returned by S3.</returns> public GetBucketVersioningResponse GetBucketVersioning(string bucketName) { var request = new GetBucketVersioningRequest(); request.BucketName = bucketName; return GetBucketVersioning(request); }
/// <summary> /// Initiates the asynchronous execution of the GetBucketVersioning operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetBucketVersioning operation on AmazonS3Client.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">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>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetBucketVersioning /// operation.</returns> public IAsyncResult BeginGetBucketVersioning(GetBucketVersioningRequest request, AsyncCallback callback, object state) { var marshaller = new GetBucketVersioningRequestMarshaller(); var unmarshaller = GetBucketVersioningResponseUnmarshaller.Instance; return BeginInvoke<GetBucketVersioningRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the GetBucketVersioning operation. /// <seealso cref="Amazon.S3.IAmazonS3.GetBucketVersioning"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetBucketVersioning operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<GetBucketVersioningResponse> GetBucketVersioningAsync(GetBucketVersioningRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetBucketVersioningRequestMarshaller(); var unmarshaller = GetBucketVersioningResponseUnmarshaller.GetInstance(); return Invoke<IRequest, GetBucketVersioningRequest, GetBucketVersioningResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para>Returns the versioning state of a bucket.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetBucketVersioning service method on /// AmazonS3.</param> /// /// <returns>The response from the GetBucketVersioning service method, as returned by AmazonS3.</returns> public GetBucketVersioningResponse GetBucketVersioning(GetBucketVersioningRequest request) { var task = GetBucketVersioningAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para>Returns the versioning state of a bucket.</para> /// </summary> /// /// <param name="getBucketVersioningRequest">Container for the necessary parameters to execute the GetBucketVersioning service method on /// AmazonS3.</param> /// /// <returns>The response from the GetBucketVersioning service method, as returned by AmazonS3.</returns> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<GetBucketVersioningResponse> GetBucketVersioningAsync(GetBucketVersioningRequest getBucketVersioningRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetBucketVersioningRequestMarshaller(); var unmarshaller = GetBucketVersioningResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, GetBucketVersioningRequest, GetBucketVersioningResponse>(getBucketVersioningRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para>Returns the versioning state of a bucket.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetBucketVersioning service method on /// AmazonS3.</param> /// /// <returns>The response from the GetBucketVersioning service method, as returned by AmazonS3.</returns> public GetBucketVersioningResponse GetBucketVersioning(GetBucketVersioningRequest request) { var task = GetBucketVersioningAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }