public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CloudFormation.Model.GetTemplateRequest(); if (cmdletContext.ChangeSetName != null) { request.ChangeSetName = cmdletContext.ChangeSetName; } if (cmdletContext.StackName != null) { request.StackName = cmdletContext.StackName; } if (cmdletContext.TemplateStage != null) { request.TemplateStage = cmdletContext.TemplateStage; } 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 GetTemplate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetTemplate 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<GetTemplateResponse> GetTemplateAsync(GetTemplateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetTemplateRequestMarshaller(); var unmarshaller = GetTemplateResponseUnmarshaller.Instance; return InvokeAsync<GetTemplateRequest,GetTemplateResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal GetTemplateResponse GetTemplate(GetTemplateRequest request) { var marshaller = new GetTemplateRequestMarshaller(); var unmarshaller = GetTemplateResponseUnmarshaller.Instance; return Invoke<GetTemplateRequest,GetTemplateResponse>(request, marshaller, unmarshaller); }
IAsyncResult invokeGetTemplate(GetTemplateRequest getTemplateRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new GetTemplateRequestMarshaller().Marshall(getTemplateRequest); var unmarshaller = GetTemplateResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the GetTemplate operation. /// <seealso cref="Amazon.CloudFormation.IAmazonCloudFormation.GetTemplate"/> /// </summary> /// /// <param name="getTemplateRequest">Container for the necessary parameters to execute the GetTemplate operation on /// AmazonCloudFormation.</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 EndGetTemplate /// operation.</returns> public IAsyncResult BeginGetTemplate(GetTemplateRequest getTemplateRequest, AsyncCallback callback, object state) { return invokeGetTemplate(getTemplateRequest, callback, state, false); }
/// <summary> /// <para>Returns the template body for a specified stack. You can get the template for running or deleted stacks.</para> <para>For deleted /// stacks, GetTemplate returns the template for up to 90 days after the stack has been deleted.</para> <para><b>NOTE:</b> If the template does /// not exist, a ValidationError is returned. </para> /// </summary> /// /// <param name="getTemplateRequest">Container for the necessary parameters to execute the GetTemplate service method on /// AmazonCloudFormation.</param> /// /// <returns>The response from the GetTemplate service method, as returned by AmazonCloudFormation.</returns> /// public GetTemplateResponse GetTemplate(GetTemplateRequest getTemplateRequest) { IAsyncResult asyncResult = invokeGetTemplate(getTemplateRequest, null, null, true); return EndGetTemplate(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the GetTemplate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetTemplate operation on AmazonCloudFormationClient.</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 EndGetTemplate /// operation.</returns> public IAsyncResult BeginGetTemplate(GetTemplateRequest request, AsyncCallback callback, object state) { var marshaller = new GetTemplateRequestMarshaller(); var unmarshaller = GetTemplateResponseUnmarshaller.Instance; return BeginInvoke<GetTemplateRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>Returns the template body for a specified stack. You can get the template for running or deleted stacks.</para> <para>For deleted /// stacks, GetTemplate returns the template for up to 90 days after the stack has been deleted.</para> <para><b>NOTE:</b> If the template does /// not exist, a ValidationError is returned. </para> /// </summary> /// /// <param name="getTemplateRequest">Container for the necessary parameters to execute the GetTemplate service method on /// AmazonCloudFormation.</param> /// /// <returns>The response from the GetTemplate service method, as returned by AmazonCloudFormation.</returns> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<GetTemplateResponse> GetTemplateAsync(GetTemplateRequest getTemplateRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetTemplateRequestMarshaller(); var unmarshaller = GetTemplateResponseUnmarshaller.GetInstance(); return Invoke<IRequest, GetTemplateRequest, GetTemplateResponse>(getTemplateRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal GetTemplateResponse GetTemplate(GetTemplateRequest request) { var task = GetTemplateAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
internal GetTemplateResponse GetTemplate(GetTemplateRequest request) { var task = GetTemplateAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para>Returns the template body for a specified stack name. You can get the template for running or deleted stacks.</para> <para>For deleted /// stacks, GetTemplate returns the template for up to 90 days after the stack has been deleted. </para> <para><b>NOTE:</b> If the template does /// not exist, a ValidationError is returned. </para> /// </summary> /// /// <param name="getTemplateRequest">Container for the necessary parameters to execute the GetTemplate service method on /// AmazonCloudFormation.</param> /// /// <returns>The response from the GetTemplate service method, as returned by AmazonCloudFormation.</returns> /// public GetTemplateResponse GetTemplate(GetTemplateRequest getTemplateRequest) { IRequest<GetTemplateRequest> request = new GetTemplateRequestMarshaller().Marshall(getTemplateRequest); GetTemplateResponse response = Invoke<GetTemplateRequest, GetTemplateResponse> (request, this.signer, GetTemplateResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the GetTemplate operation. /// <seealso cref="Amazon.CloudFormation.IAmazonCloudFormation.GetTemplate"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetTemplate 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<GetTemplateResponse> GetTemplateAsync(GetTemplateRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetTemplateRequestMarshaller(); var unmarshaller = GetTemplateResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, GetTemplateRequest, GetTemplateResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
private Amazon.CloudFormation.Model.GetTemplateResponse CallAWSServiceOperation(IAmazonCloudFormation client, Amazon.CloudFormation.Model.GetTemplateRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CloudFormation", "GetTemplate"); try { #if DESKTOP return(client.GetTemplate(request)); #elif CORECLR return(client.GetTemplateAsync(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; } }