Container for the parameters to the GetStackPolicy operation. Returns the stack policy for a specified stack. If a stack doesn't have a policy, a null value is returned.
Inheritance: AmazonCloudFormationRequest
Example #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CloudFormation.Model.GetStackPolicyRequest();

            if (cmdletContext.StackName != null)
            {
                request.StackName = cmdletContext.StackName;
            }

            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 GetStackPolicy operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetStackPolicy 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<GetStackPolicyResponse> GetStackPolicyAsync(GetStackPolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetStackPolicyRequestMarshaller();
            var unmarshaller = GetStackPolicyResponseUnmarshaller.Instance;

            return InvokeAsync<GetStackPolicyRequest,GetStackPolicyResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        internal GetStackPolicyResponse GetStackPolicy(GetStackPolicyRequest request)
        {
            var marshaller = new GetStackPolicyRequestMarshaller();
            var unmarshaller = GetStackPolicyResponseUnmarshaller.Instance;

            return Invoke<GetStackPolicyRequest,GetStackPolicyResponse>(request, marshaller, unmarshaller);
        }
 IAsyncResult invokeGetStackPolicy(GetStackPolicyRequest getStackPolicyRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new GetStackPolicyRequestMarshaller().Marshall(getStackPolicyRequest);
     var unmarshaller = GetStackPolicyResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the GetStackPolicy operation.
 /// <seealso cref="Amazon.CloudFormation.IAmazonCloudFormation.GetStackPolicy"/>
 /// </summary>
 /// 
 /// <param name="getStackPolicyRequest">Container for the necessary parameters to execute the GetStackPolicy 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 EndGetStackPolicy
 ///         operation.</returns>
 public IAsyncResult BeginGetStackPolicy(GetStackPolicyRequest getStackPolicyRequest, AsyncCallback callback, object state)
 {
     return invokeGetStackPolicy(getStackPolicyRequest, callback, state, false);
 }
 /// <summary>
 /// <para>Returns the stack policy for a specified stack. If a stack doesn't have a policy, a null value is returned.</para>
 /// </summary>
 /// 
 /// <param name="getStackPolicyRequest">Container for the necessary parameters to execute the GetStackPolicy service method on
 ///          AmazonCloudFormation.</param>
 /// 
 /// <returns>The response from the GetStackPolicy service method, as returned by AmazonCloudFormation.</returns>
 /// 
 public GetStackPolicyResponse GetStackPolicy(GetStackPolicyRequest getStackPolicyRequest)
 {
     IAsyncResult asyncResult = invokeGetStackPolicy(getStackPolicyRequest, null, null, true);
     return EndGetStackPolicy(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the GetStackPolicy operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetStackPolicy 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 EndGetStackPolicy
        ///         operation.</returns>
        public IAsyncResult BeginGetStackPolicy(GetStackPolicyRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new GetStackPolicyRequestMarshaller();
            var unmarshaller = GetStackPolicyResponseUnmarshaller.Instance;

            return BeginInvoke<GetStackPolicyRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// <para>Returns the stack policy for a specified stack. If a stack doesn't have a policy, a null value is returned.</para>
        /// </summary>
        /// 
        /// <param name="getStackPolicyRequest">Container for the necessary parameters to execute the GetStackPolicy service method on
        /// AmazonCloudFormation.</param>
        /// 
        /// <returns>The response from the GetStackPolicy 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<GetStackPolicyResponse> GetStackPolicyAsync(GetStackPolicyRequest getStackPolicyRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetStackPolicyRequestMarshaller();
            var unmarshaller = GetStackPolicyResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, GetStackPolicyRequest, GetStackPolicyResponse>(getStackPolicyRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
		internal GetStackPolicyResponse GetStackPolicy(GetStackPolicyRequest request)
        {
            var task = GetStackPolicyAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
		internal GetStackPolicyResponse GetStackPolicy(GetStackPolicyRequest request)
        {
            var task = GetStackPolicyAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the GetStackPolicy operation.
        /// <seealso cref="Amazon.CloudFormation.IAmazonCloudFormation.GetStackPolicy"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetStackPolicy 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<GetStackPolicyResponse> GetStackPolicyAsync(GetStackPolicyRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetStackPolicyRequestMarshaller();
            var unmarshaller = GetStackPolicyResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, GetStackPolicyRequest, GetStackPolicyResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
Example #12
0
 private Amazon.CloudFormation.Model.GetStackPolicyResponse CallAWSServiceOperation(IAmazonCloudFormation client, Amazon.CloudFormation.Model.GetStackPolicyRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CloudFormation", "GetStackPolicy");
     try
     {
         #if DESKTOP
         return(client.GetStackPolicy(request));
         #elif CORECLR
         return(client.GetStackPolicyAsync(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;
     }
 }