Container for the parameters to the SetTerminationProtection operation. SetTerminationProtection locks a job flow so the EC2 instances in the cluster cannot be terminated by user intervention, an API call, or in the event of a job-flow error. The cluster still terminates upon successful completion of the job flow. Calling SetTerminationProtection on a job flow is analogous to calling the Amazon EC2 DisableAPITermination API on all of the EC2 instances in a cluster.

SetTerminationProtection is used to prevent accidental termination of a job flow and to ensure that in the event of an error, the instances will persist so you can recover any data stored in their ephemeral instance storage.

To terminate a job flow that has been locked by setting SetTerminationProtection to true, you must first unlock the job flow by a subsequent call to SetTerminationProtection in which you set the value to false.

For more information, seeProtecting a Job Flow from Termination in the Amazon EMR Guide.

Inheritance: AmazonElasticMapReduceRequest
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.ElasticMapReduce.Model.SetTerminationProtectionRequest();

            if (cmdletContext.JobFlowId != null)
            {
                request.JobFlowIds = cmdletContext.JobFlowId;
            }
            if (cmdletContext.TerminationProtected != null)
            {
                request.TerminationProtected = cmdletContext.TerminationProtected.Value;
            }

            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 SetTerminationProtection operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetTerminationProtection 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<SetTerminationProtectionResponse> SetTerminationProtectionAsync(SetTerminationProtectionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetTerminationProtectionRequestMarshaller();
            var unmarshaller = SetTerminationProtectionResponseUnmarshaller.Instance;

            return InvokeAsync<SetTerminationProtectionRequest,SetTerminationProtectionResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        /// <summary>
        /// SetTerminationProtection locks a job flow so the Amazon EC2 instances in the cluster
        /// cannot be terminated by user intervention, an API call, or in the event of a job-flow
        /// error. The cluster still terminates upon successful completion of the job flow. Calling
        /// SetTerminationProtection on a job flow is analogous to calling the Amazon EC2 DisableAPITermination
        /// API on all of the EC2 instances in a cluster.
        /// 
        ///  
        /// <para>
        ///  SetTerminationProtection is used to prevent accidental termination of a job flow
        /// and to ensure that in the event of an error, the instances will persist so you can
        /// recover any data stored in their ephemeral instance storage.
        /// </para>
        ///  
        /// <para>
        ///  To terminate a job flow that has been locked by setting SetTerminationProtection
        /// to <code>true</code>, you must first unlock the job flow by a subsequent call to SetTerminationProtection
        /// in which you set the value to <code>false</code>. 
        /// </para>
        ///  
        /// <para>
        ///  For more information, go to <a href="http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_TerminationProtection.html">Protecting
        /// a Job Flow from Termination</a> in the <i>Amazon Elastic MapReduce Developer's Guide.</i>
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the SetTerminationProtection service method.</param>
        /// 
        /// <returns>The response from the SetTerminationProtection service method, as returned by ElasticMapReduce.</returns>
        /// <exception cref="Amazon.ElasticMapReduce.Model.InternalServerErrorException">
        /// Indicates that an error occurred while processing the request and that the request
        /// was not completed.
        /// </exception>
        public SetTerminationProtectionResponse SetTerminationProtection(SetTerminationProtectionRequest request)
        {
            var marshaller = new SetTerminationProtectionRequestMarshaller();
            var unmarshaller = SetTerminationProtectionResponseUnmarshaller.Instance;

            return Invoke<SetTerminationProtectionRequest,SetTerminationProtectionResponse>(request, marshaller, unmarshaller);
        }
 /// <summary>
 /// SetTerminationProtection locks a job flow so the Amazon EC2 instances in the cluster
 ///          cannot be terminated by user intervention, an API call, or in the event of
 /// a job-flow error.          The cluster still terminates upon successful completion
 /// of the job flow. Calling          SetTerminationProtection on a job flow is analogous
 /// to calling the          Amazon EC2 DisableAPITermination API on all of the EC2 instances
 /// in a cluster.
 /// 
 ///             
 /// <para>
 ///  SetTerminationProtection is used to prevent accidental termination of a job flow
 /// and to          ensure that in the event of an error, the instances will persist so
 /// you can recover          any data stored in their ephemeral instance storage.
 /// </para>
 ///             
 /// <para>
 ///  To terminate a job flow that has been locked by setting SetTerminationProtection
 /// to <code>true</code>,          you must first unlock the job flow by a subsequent
 /// call to SetTerminationProtection          in which you set the value to <code>false</code>.
 /// 
 /// </para>
 ///             
 /// <para>
 ///  For more information, go to <a href="http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_TerminationProtection.html">Protecting
 /// a Job Flow from Termination</a> in the          <i>Amazon Elastic MapReduce Developer's
 /// Guide.</i>
 /// </para>
 /// </summary>
 /// <param name="request">Container for the necessary parameters to execute the SetTerminationProtection service method.</param>
 /// 
 /// <returns>The response from the SetTerminationProtection service method, as returned by ElasticMapReduce.</returns>
 /// <exception cref="InternalServerErrorException">
 /// Indicates that an error occurred while processing the request and that the request
 /// was not         completed.
 /// </exception>
 public SetTerminationProtectionResponse SetTerminationProtection(SetTerminationProtectionRequest request)
 {
     var task = SetTerminationProtectionAsync(request);
     try
     {
         return task.Result;
     }
     catch(AggregateException e)
     {
         ExceptionDispatchInfo.Capture(e.InnerException).Throw();
         return null;
     }
 }
        /// <summary>
        /// Initiates the asynchronous execution of the SetTerminationProtection operation.
        /// <seealso cref="Amazon.ElasticMapReduce.IAmazonElasticMapReduce.SetTerminationProtection"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetTerminationProtection 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<SetTerminationProtectionResponse> SetTerminationProtectionAsync(SetTerminationProtectionRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetTerminationProtectionRequestMarshaller();
            var unmarshaller = SetTerminationProtectionResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, SetTerminationProtectionRequest, SetTerminationProtectionResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
        /// <summary>
        /// <para> SetTerminationProtection locks a job flow so the Amazon EC2 instances in the cluster cannot be terminated by user intervention, an
        /// API call, or in the event of a job-flow error. The cluster still terminates upon successful completion of the job flow. Calling
        /// SetTerminationProtection on a job flow is analogous to calling the Amazon EC2 DisableAPITermination API on all of the EC2 instances in a
        /// cluster.</para> <para> SetTerminationProtection is used to prevent accidental termination of a job flow and to ensure that in the event of
        /// an error, the instances will persist so you can recover any data stored in their ephemeral instance storage.</para> <para> To terminate a
        /// job flow that has been locked by setting SetTerminationProtection to <c>true</c> ,
        /// you must first unlock the job flow by a subsequent call to SetTerminationProtection in which you set the value to <c>false</c> .
        /// </para> <para> For more information, go to <a href="http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_TerminationProtection.html">Protecting a Job Flow from
        /// Termination</a> in the <i>Amazon Elastic MapReduce Developer's Guide.</i> </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetTerminationProtection service method
        /// on AmazonElasticMapReduce.</param>
        /// 
        /// <exception cref="T:Amazon.ElasticMapReduce.Model.InternalServerErrorException" />
		public SetTerminationProtectionResponse SetTerminationProtection(SetTerminationProtectionRequest request)
        {
            var task = SetTerminationProtectionAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the SetTerminationProtection operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetTerminationProtection operation on AmazonElasticMapReduceClient.</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 EndSetTerminationProtection
        ///         operation.</returns>
        public IAsyncResult BeginSetTerminationProtection(SetTerminationProtectionRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SetTerminationProtectionRequestMarshaller();
            var unmarshaller = SetTerminationProtectionResponseUnmarshaller.Instance;

            return BeginInvoke<SetTerminationProtectionRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 IAsyncResult invokeSetTerminationProtection(SetTerminationProtectionRequest setTerminationProtectionRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new SetTerminationProtectionRequestMarshaller().Marshall(setTerminationProtectionRequest);
     var unmarshaller = SetTerminationProtectionResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the SetTerminationProtection operation.
 /// <seealso cref="Amazon.ElasticMapReduce.IAmazonElasticMapReduce.SetTerminationProtection"/>
 /// </summary>
 /// 
 /// <param name="setTerminationProtectionRequest">Container for the necessary parameters to execute the SetTerminationProtection operation on
 ///          AmazonElasticMapReduce.</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 BeginSetTerminationProtection(SetTerminationProtectionRequest setTerminationProtectionRequest, AsyncCallback callback, object state)
 {
     return invokeSetTerminationProtection(setTerminationProtectionRequest, callback, state, false);
 }
 /// <summary>
 /// <para> SetTerminationProtection locks a job flow so the Amazon EC2 instances in the cluster cannot be terminated by user intervention, an
 /// API call, or in the event of a job-flow error. The cluster still terminates upon successful completion of the job flow. Calling
 /// SetTerminationProtection on a job flow is analogous to calling the Amazon EC2 DisableAPITermination API on all of the EC2 instances in a
 /// cluster.</para> <para> SetTerminationProtection is used to prevent accidental termination of a job flow and to ensure that in the event of
 /// an error, the instances will persist so you can recover any data stored in their ephemeral instance storage.</para> <para> To terminate a
 /// job flow that has been locked by setting SetTerminationProtection to <c>true</c> ,
 /// you must first unlock the job flow by a subsequent call to SetTerminationProtection in which you set the value to <c>false</c> .
 /// </para> <para> For more information, go to <a
 /// href="http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_TerminationProtection.html" >Protecting a Job Flow from
 /// Termination</a> in the <i>Amazon Elastic MapReduce Developer's Guide.</i> </para>
 /// </summary>
 /// 
 /// <param name="setTerminationProtectionRequest">Container for the necessary parameters to execute the SetTerminationProtection service method
 ///          on AmazonElasticMapReduce.</param>
 /// 
 /// <exception cref="InternalServerErrorException"/>
 public SetTerminationProtectionResponse SetTerminationProtection(SetTerminationProtectionRequest setTerminationProtectionRequest)
 {
     IAsyncResult asyncResult = invokeSetTerminationProtection(setTerminationProtectionRequest, null, null, true);
     return EndSetTerminationProtection(asyncResult);
 }
        /// <summary>
        /// <para> SetTerminationProtection locks a job flow so the Amazon EC2 instances in the cluster cannot be terminated by user intervention, an
        /// API call, or in the event of a job-flow error. The cluster still terminates upon successful completion of the job flow. Calling
        /// SetTerminationProtection on a job flow is analogous to calling the Amazon EC2 DisableAPITermination API on all of the EC2 instances in a
        /// cluster.</para> <para> SetTerminationProtection is used to prevent accidental termination of a job flow and to ensure that in the event of
        /// an error, the instances will persist so you can recover any data stored in their ephemeral instance storage.</para> <para> To terminate a
        /// job flow that has been locked by setting SetTerminationProtection to <c>true</c> ,
        /// you must first unlock the job flow by a subsequent call to SetTerminationProtection in which you set the value to <c>false</c> .
        /// </para> <para> For more information, go to <a href="http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/UsingEMR_TerminationProtection.html">Protecting a Job Flow from
        /// Termination</a> in the <i>Amazon Elastic MapReduce Developer's Guide.</i> </para>
        /// </summary>
        /// 
        /// <param name="setTerminationProtectionRequest">Container for the necessary parameters to execute the SetTerminationProtection service method
        /// on AmazonElasticMapReduce.</param>
        /// 
        /// <exception cref="T:Amazon.ElasticMapReduce.Model.InternalServerErrorException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public async Task<SetTerminationProtectionResponse> SetTerminationProtectionAsync(SetTerminationProtectionRequest setTerminationProtectionRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetTerminationProtectionRequestMarshaller();
            var unmarshaller = SetTerminationProtectionResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, SetTerminationProtectionRequest, SetTerminationProtectionResponse>(setTerminationProtectionRequest, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
        IAsyncResult invokeSetTerminationProtection(SetTerminationProtectionRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new SetTerminationProtectionRequestMarshaller();
            var unmarshaller = SetTerminationProtectionResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
 /// <summary>
 /// <para> SetTerminationProtection locks a job flow so the Amazon EC2 instances in the cluster cannot be terminated by user intervention, an
 /// API call, or in the event of a job-flow error. The cluster still terminates upon successful completion of the job flow. Calling
 /// SetTerminationProtection on a job flow is analogous to calling the Amazon EC2 DisableAPITermination API on all of the EC2 instances in a
 /// cluster.</para> <para> SetTerminationProtection is used to prevent accidental termination of a job flow and to ensure that in the event of
 /// an error, the instances will persist so you can recover any data stored in their ephemeral instance storage.</para> <para> To terminate a
 /// job flow that has been locked by setting SetTerminationProtection to <c>true</c> ,
 /// you must first unlock the job flow by a subsequent call to SetTerminationProtection in which you set the value to <c>false</c> .
 /// </para> <para> For more information, go to Protecting a Job Flow from Termination in the <i>Amazon Elastic MapReduce Developer's Guide.</i>
 /// </para>
 /// </summary>
 /// 
 /// <param name="setTerminationProtectionRequest">Container for the necessary parameters to execute the SetTerminationProtection service method
 ///           on AmazonElasticMapReduce.</param>
 /// 
 /// <exception cref="InternalServerErrorException"/>
 public SetTerminationProtectionResponse SetTerminationProtection(SetTerminationProtectionRequest setTerminationProtectionRequest)
 {
     IRequest<SetTerminationProtectionRequest> request = new SetTerminationProtectionRequestMarshaller().Marshall(setTerminationProtectionRequest);
     SetTerminationProtectionResponse response = Invoke<SetTerminationProtectionRequest, SetTerminationProtectionResponse> (request, this.signer, SetTerminationProtectionResponseUnmarshaller.GetInstance());
     return response;
 }
 private Amazon.ElasticMapReduce.Model.SetTerminationProtectionResponse CallAWSServiceOperation(IAmazonElasticMapReduce client, Amazon.ElasticMapReduce.Model.SetTerminationProtectionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic MapReduce", "SetTerminationProtection");
     try
     {
         #if DESKTOP
         return(client.SetTerminationProtection(request));
         #elif CORECLR
         return(client.SetTerminationProtectionAsync(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;
     }
 }