public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CloudFront.Model.GetDistributionRequest(); if (cmdletContext.Id != null) { request.Id = cmdletContext.Id; } 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 GetDistribution operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetDistribution operation on AmazonCloudFrontClient.</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 EndGetDistribution /// operation.</returns> public IAsyncResult BeginGetDistribution(GetDistributionRequest request, AsyncCallback callback, object state) { var marshaller = new GetDistributionRequestMarshaller(); var unmarshaller = GetDistributionResponseUnmarshaller.Instance; return BeginInvoke<GetDistributionRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Get the information about a distribution. /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetDistribution service method.</param> /// /// <returns>The response from the GetDistribution service method, as returned by CloudFront.</returns> /// <exception cref="Amazon.CloudFront.Model.AccessDeniedException"> /// Access denied. /// </exception> /// <exception cref="Amazon.CloudFront.Model.NoSuchDistributionException"> /// The specified distribution does not exist. /// </exception> public GetDistributionResponse GetDistribution(GetDistributionRequest request) { var marshaller = new GetDistributionRequestMarshaller(); var unmarshaller = GetDistributionResponseUnmarshaller.Instance; return Invoke<GetDistributionRequest,GetDistributionResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the GetDistribution operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetDistribution 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<GetDistributionResponse> GetDistributionAsync(GetDistributionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetDistributionRequestMarshaller(); var unmarshaller = GetDistributionResponseUnmarshaller.Instance; return InvokeAsync<GetDistributionRequest,GetDistributionResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Get the information about a distribution. /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetDistribution service method.</param> /// /// <returns>The response from the GetDistribution service method, as returned by CloudFront.</returns> /// <exception cref="AccessDeniedException"> /// Access denied. /// </exception> /// <exception cref="NoSuchDistributionException"> /// The specified distribution does not exist. /// </exception> public GetDistributionResponse GetDistribution(GetDistributionRequest request) { var task = GetDistributionAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the GetDistribution operation. /// <seealso cref="Amazon.CloudFront.AmazonCloudFront.GetDistribution"/> /// </summary> /// /// <param name="getDistributionRequest">Container for the necessary parameters to execute the GetDistribution operation on /// AmazonCloudFront.</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 EndGetDistribution /// operation.</returns> public IAsyncResult BeginGetDistribution(GetDistributionRequest getDistributionRequest, AsyncCallback callback, object state) { return invokeGetDistribution(getDistributionRequest, callback, state, false); }
IAsyncResult invokeGetDistribution(GetDistributionRequest getDistributionRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new GetDistributionRequestMarshaller().Marshall(getDistributionRequest); var unmarshaller = GetDistributionResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para> Get the information about a distribution. </para> /// </summary> /// /// <param name="getDistributionRequest">Container for the necessary parameters to execute the GetDistribution service method on /// AmazonCloudFront.</param> /// /// <returns>The response from the GetDistribution service method, as returned by AmazonCloudFront.</returns> /// /// <exception cref="NoSuchDistributionException"/> /// <exception cref="AccessDeniedException"/> public GetDistributionResponse GetDistribution(GetDistributionRequest getDistributionRequest) { IAsyncResult asyncResult = invokeGetDistribution(getDistributionRequest, null, null, true); return EndGetDistribution(asyncResult); }
/// <summary> /// <para> Get the information about a distribution. </para> /// </summary> /// /// <param name="getDistributionRequest">Container for the necessary parameters to execute the GetDistribution service method on /// AmazonCloudFront.</param> /// /// <returns>The response from the GetDistribution service method, as returned by AmazonCloudFront.</returns> /// /// <exception cref="T:Amazon.CloudFront.Model.NoSuchDistributionException" /> /// <exception cref="T:Amazon.CloudFront.Model.AccessDeniedException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<GetDistributionResponse> GetDistributionAsync(GetDistributionRequest getDistributionRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetDistributionRequestMarshaller(); var unmarshaller = GetDistributionResponseUnmarshaller.GetInstance(); return Invoke<IRequest, GetDistributionRequest, GetDistributionResponse>(getDistributionRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal GetDistributionResponse GetDistribution(GetDistributionRequest request) { var task = GetDistributionAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
IAsyncResult invokeGetDistribution(GetDistributionRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new GetDistributionRequestMarshaller(); var unmarshaller = GetDistributionResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }
/// <summary> /// Initiates the asynchronous execution of the GetDistribution operation. /// <seealso cref="Amazon.CloudFront.IAmazonCloudFront.GetDistribution"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetDistribution 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 async Task<GetDistributionResponse> GetDistributionAsync(GetDistributionRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetDistributionRequestMarshaller(); var unmarshaller = GetDistributionResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, GetDistributionRequest, GetDistributionResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
private Amazon.CloudFront.Model.GetDistributionResponse CallAWSServiceOperation(IAmazonCloudFront client, Amazon.CloudFront.Model.GetDistributionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudFront", "GetDistribution"); try { #if DESKTOP return(client.GetDistribution(request)); #elif CORECLR return(client.GetDistributionAsync(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; } }