/// <summary> /// Initiates the asynchronous execution of the SetTerminationProtection operation. /// <seealso cref="Amazon.ElasticMapReduce.IAmazonElasticMapReduce"/> /// </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.Instance; return(Invoke <IRequest, SetTerminationProtectionRequest, SetTerminationProtectionResponse>(request, marshaller, unmarshaller, signer, cancellationToken)); }
internal SetTerminationProtectionResponse SetTerminationProtection(SetTerminationProtectionRequest request) { var marshaller = new SetTerminationProtectionRequestMarshaller(); var unmarshaller = SetTerminationProtectionResponseUnmarshaller.Instance; return(Invoke <SetTerminationProtectionRequest, SetTerminationProtectionResponse>(request, marshaller, unmarshaller)); }
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); }
internal SetTerminationProtectionResponse SetTerminationProtection(SetTerminationProtectionRequest request) { var task = SetTerminationProtectionAsync(request); try { return(task.Result); } catch (AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return(null); } }
/// <summary> /// Send a request to EMR service to terminate job /// </summary> /// <param name="emrClient">EMR Client to make requests to the Amazon EMR Service</param> /// <param name="settings">Settings to replace placeholders</param> /// <param name="jobFlowId">Existing jobflow Id, can be null for the new job.</param> /// <returns>JobFlow Id, if request failed -> returns null</returns> public override async Task <string> SendAsync(IAmazonElasticMapReduce emrClient, IBuilderSettings settings, string jobFlowId) { SetTerminationProtectionRequest setTerminationProtectionRequest = new SetTerminationProtectionRequest(); setTerminationProtectionRequest.JobFlowIds = new List <string> { jobFlowId }; setTerminationProtectionRequest.TerminationProtected = false; AmazonWebServiceResponse response = await emrClient.SetTerminationProtectionAsync(setTerminationProtectionRequest); TerminateJobFlowsRequest terminateJobRequest = new TerminateJobFlowsRequest(); terminateJobRequest.JobFlowIds = new List <string> { jobFlowId }; response = await emrClient.TerminateJobFlowsAsync(terminateJobRequest); return(this.IsOk(response) ? jobFlowId : null); }
/// <summary> /// Initiates the asynchronous execution of the SetTerminationProtection operation. /// <seealso cref="Amazon.ElasticMapReduce.AmazonElasticMapReduce.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 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) { IAsyncResult asyncResult = invokeSetTerminationProtection(setTerminationProtectionRequest, null, null, true); return(EndSetTerminationProtection(asyncResult)); }