/// <summary> /// Initiates the asynchronous execution of the DescribeStacks operation. /// <seealso cref="Amazon.CloudFormation.IAmazonCloudFormation.DescribeStacks"/> /// </summary> /// /// <param name="describeStacksRequest">Container for the necessary parameters to execute the DescribeStacks 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 EndDescribeStacks /// operation.</returns> public IAsyncResult BeginDescribeStacks(DescribeStacksRequest describeStacksRequest, AsyncCallback callback, object state) { return invokeDescribeStacks(describeStacksRequest, callback, state, false); }
IAsyncResult invokeDescribeStacks(DescribeStacksRequest describeStacksRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new DescribeStacksRequestMarshaller().Marshall(describeStacksRequest); var unmarshaller = DescribeStacksResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the DescribeStacks operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeStacks 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 EndDescribeStacks /// operation.</returns> public IAsyncResult BeginDescribeStacks(DescribeStacksRequest request, AsyncCallback callback, object state) { var marshaller = new DescribeStacksRequestMarshaller(); var unmarshaller = DescribeStacksResponseUnmarshaller.Instance; return BeginInvoke<DescribeStacksRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>Returns the description for the specified stack; if no stack name was specified, then it returns the description for all the stacks /// created.</para> /// </summary> /// /// <param name="describeStacksRequest">Container for the necessary parameters to execute the DescribeStacks service method on /// AmazonCloudFormation.</param> /// /// <returns>The response from the DescribeStacks service method, as returned by AmazonCloudFormation.</returns> /// public DescribeStacksResponse DescribeStacks(DescribeStacksRequest describeStacksRequest) { IAsyncResult asyncResult = invokeDescribeStacks(describeStacksRequest, null, null, true); return EndDescribeStacks(asyncResult); }
internal DescribeStacksResponse DescribeStacks(DescribeStacksRequest request) { var task = DescribeStacksAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// <para>Returns the description for the specified stack; if no stack name was specified, then it returns the description for all the stacks /// created.</para> /// </summary> /// /// <param name="describeStacksRequest">Container for the necessary parameters to execute the DescribeStacks service method on /// AmazonCloudFormation.</param> /// /// <returns>The response from the DescribeStacks 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<DescribeStacksResponse> DescribeStacksAsync(DescribeStacksRequest describeStacksRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeStacksRequestMarshaller(); var unmarshaller = DescribeStacksResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DescribeStacksRequest, DescribeStacksResponse>(describeStacksRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal DescribeStacksResponse DescribeStacks(DescribeStacksRequest request) { var task = DescribeStacksAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
public Stack GetStack(string stackName) { var describeStacksRequest = new DescribeStacksRequest {StackName = stackName}; DescribeStacksResponse response; try { response = _cloudFormationClient.DescribeStacks(describeStacksRequest); } catch (AmazonCloudFormationException exception) { if (exception.Message.Contains(_nonExistenceMarker)) { return null; } throw; } return response.Stacks.FirstOrDefault(); }
private Amazon.CloudFormation.Model.DescribeStacksResponse CallAWSServiceOperation(IAmazonCloudFormation client, Amazon.CloudFormation.Model.DescribeStacksRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CloudFormation", "DescribeStacks"); try { #if DESKTOP return(client.DescribeStacks(request)); #elif CORECLR return(client.DescribeStacksAsync(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; } }
internal DescribeStacksPaginator(IAmazonCloudFormation client, DescribeStacksRequest request) { this._client = client; this._request = request; }
/// <summary> /// <para> Returns the description for the specified stack; if no stack name was specified, then it returns the description for all the stacks /// created. </para> /// </summary> /// /// <param name="describeStacksRequest">Container for the necessary parameters to execute the DescribeStacks service method on /// AmazonCloudFormation.</param> /// /// <returns>The response from the DescribeStacks service method, as returned by AmazonCloudFormation.</returns> /// public DescribeStacksResponse DescribeStacks(DescribeStacksRequest describeStacksRequest) { IRequest<DescribeStacksRequest> request = new DescribeStacksRequestMarshaller().Marshall(describeStacksRequest); DescribeStacksResponse response = Invoke<DescribeStacksRequest, DescribeStacksResponse> (request, this.signer, DescribeStacksResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the DescribeStacks operation. /// <seealso cref="Amazon.CloudFormation.IAmazonCloudFormation.DescribeStacks"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeStacks 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<DescribeStacksResponse> DescribeStacksAsync(DescribeStacksRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeStacksRequestMarshaller(); var unmarshaller = DescribeStacksResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, DescribeStacksRequest, DescribeStacksResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent; #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute // create request and set iteration invariants var request = new Amazon.CloudFormation.Model.DescribeStacksRequest(); if (cmdletContext.StackName != null) { request.StackName = cmdletContext.StackName; } // Initialize loop variant and commence piping var _nextToken = cmdletContext.NextToken; var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.NextToken)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.NextToken = _nextToken; CmdletOutput output; try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; if (!useParameterSelect) { pipelineOutput = cmdletContext.Select(response, this); } output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; _nextToken = response.NextToken; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return(null); }
internal DescribeStacksResponse DescribeStacks(DescribeStacksRequest request) { var marshaller = new DescribeStacksRequestMarshaller(); var unmarshaller = DescribeStacksResponseUnmarshaller.Instance; return Invoke<DescribeStacksRequest,DescribeStacksResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Paginator for DescribeStacks operation ///</summary> public IDescribeStacksPaginator DescribeStacks(DescribeStacksRequest request) { return(new DescribeStacksPaginator(this.client, request)); }
/// <summary> /// Initiates the asynchronous execution of the DescribeStacks operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DescribeStacks 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<DescribeStacksResponse> DescribeStacksAsync(DescribeStacksRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DescribeStacksRequestMarshaller(); var unmarshaller = DescribeStacksResponseUnmarshaller.Instance; return InvokeAsync<DescribeStacksRequest,DescribeStacksResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal void WaitForStack(string StackName, string StackID, string StatusToWaitOn, string SuccessStatus) { LogInformation("CloudFormation waiting for stack {0} ({1}) to get out of {2} status.", StackName, StackID, StatusToWaitOn); var req = new DescribeStacksRequest().WithStackName(StackName); var resp = client.DescribeStacks(req); if (resp.DescribeStacksResult.Stacks.Count < 1) { LogError("CloudFormation error in WaitForStack: No stacks in DescribeStacks"); return; } while (resp.DescribeStacksResult.Stacks[0].StackStatus == StatusToWaitOn) { System.Threading.Thread.Sleep(20000); resp = client.DescribeStacks(req); if (resp.DescribeStacksResult.Stacks.Count < 1) { LogError("CloudFormation error in WaitForStack: No stacks in DescribeStacks"); return; } } if (SuccessStatus == resp.DescribeStacksResult.Stacks[0].StackStatus) LogInformation("CloudFormation stack {0} ({1}) completed successfully. Output: {2}", StackName, StackID, resp.DescribeStacksResult.Stacks[0].Outputs.AsString()); else LogError("CloudFormation stack {0} ({1}) failed with status: {2}. Output: {3}", StackName, StackID, resp.DescribeStacksResult.Stacks[0].StackStatus, resp.DescribeStacksResult.Stacks[0].Outputs.AsString()); }