Container for the parameters to the SetStackPolicy operation. Sets a stack policy for a specified stack.
Inheritance: AmazonCloudFormationRequest
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CloudFormation.Model.SetStackPolicyRequest();

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

            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 SetStackPolicy operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetStackPolicy 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<SetStackPolicyResponse> SetStackPolicyAsync(SetStackPolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetStackPolicyRequestMarshaller();
            var unmarshaller = SetStackPolicyResponseUnmarshaller.Instance;

            return InvokeAsync<SetStackPolicyRequest,SetStackPolicyResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        internal SetStackPolicyResponse SetStackPolicy(SetStackPolicyRequest request)
        {
            var marshaller = new SetStackPolicyRequestMarshaller();
            var unmarshaller = SetStackPolicyResponseUnmarshaller.Instance;

            return Invoke<SetStackPolicyRequest,SetStackPolicyResponse>(request, marshaller, unmarshaller);
        }
 IAsyncResult invokeSetStackPolicy(SetStackPolicyRequest setStackPolicyRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new SetStackPolicyRequestMarshaller().Marshall(setStackPolicyRequest);
     var unmarshaller = SetStackPolicyResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the SetStackPolicy operation.
 /// <seealso cref="Amazon.CloudFormation.IAmazonCloudFormation.SetStackPolicy"/>
 /// </summary>
 /// 
 /// <param name="setStackPolicyRequest">Container for the necessary parameters to execute the SetStackPolicy 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>
 public IAsyncResult BeginSetStackPolicy(SetStackPolicyRequest setStackPolicyRequest, AsyncCallback callback, object state)
 {
     return invokeSetStackPolicy(setStackPolicyRequest, callback, state, false);
 }
 /// <summary>
 /// <para>Sets a stack policy for a specified stack.</para>
 /// </summary>
 /// 
 /// <param name="setStackPolicyRequest">Container for the necessary parameters to execute the SetStackPolicy service method on
 ///          AmazonCloudFormation.</param>
 /// 
 public SetStackPolicyResponse SetStackPolicy(SetStackPolicyRequest setStackPolicyRequest)
 {
     IAsyncResult asyncResult = invokeSetStackPolicy(setStackPolicyRequest, null, null, true);
     return EndSetStackPolicy(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the SetStackPolicy operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetStackPolicy 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 EndSetStackPolicy
        ///         operation.</returns>
        public IAsyncResult BeginSetStackPolicy(SetStackPolicyRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SetStackPolicyRequestMarshaller();
            var unmarshaller = SetStackPolicyResponseUnmarshaller.Instance;

            return BeginInvoke<SetStackPolicyRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// <para>Sets a stack policy for a specified stack.</para>
        /// </summary>
        /// 
        /// <param name="setStackPolicyRequest">Container for the necessary parameters to execute the SetStackPolicy service method on
        /// AmazonCloudFormation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<SetStackPolicyResponse> SetStackPolicyAsync(SetStackPolicyRequest setStackPolicyRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetStackPolicyRequestMarshaller();
            var unmarshaller = SetStackPolicyResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, SetStackPolicyRequest, SetStackPolicyResponse>(setStackPolicyRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
		internal SetStackPolicyResponse SetStackPolicy(SetStackPolicyRequest request)
        {
            var task = SetStackPolicyAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
		internal SetStackPolicyResponse SetStackPolicy(SetStackPolicyRequest request)
        {
            var task = SetStackPolicyAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
 private Amazon.CloudFormation.Model.SetStackPolicyResponse CallAWSServiceOperation(IAmazonCloudFormation client, Amazon.CloudFormation.Model.SetStackPolicyRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CloudFormation", "SetStackPolicy");
     try
     {
         #if DESKTOP
         return(client.SetStackPolicy(request));
         #elif CORECLR
         return(client.SetStackPolicyAsync(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;
     }
 }
        /// <summary>
        /// Initiates the asynchronous execution of the SetStackPolicy operation.
        /// <seealso cref="Amazon.CloudFormation.IAmazonCloudFormation.SetStackPolicy"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetStackPolicy 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<SetStackPolicyResponse> SetStackPolicyAsync(SetStackPolicyRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetStackPolicyRequestMarshaller();
            var unmarshaller = SetStackPolicyResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, SetStackPolicyRequest, SetStackPolicyResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }