public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ElasticMapReduce.Model.PutAutoTerminationPolicyRequest(); // populate AutoTerminationPolicy var requestAutoTerminationPolicyIsNull = true; request.AutoTerminationPolicy = new Amazon.ElasticMapReduce.Model.AutoTerminationPolicy(); System.Int64?requestAutoTerminationPolicy_autoTerminationPolicy_IdleTimeout = null; if (cmdletContext.AutoTerminationPolicy_IdleTimeout != null) { requestAutoTerminationPolicy_autoTerminationPolicy_IdleTimeout = cmdletContext.AutoTerminationPolicy_IdleTimeout.Value; } if (requestAutoTerminationPolicy_autoTerminationPolicy_IdleTimeout != null) { request.AutoTerminationPolicy.IdleTimeout = requestAutoTerminationPolicy_autoTerminationPolicy_IdleTimeout.Value; requestAutoTerminationPolicyIsNull = false; } // determine if request.AutoTerminationPolicy should be set to null if (requestAutoTerminationPolicyIsNull) { request.AutoTerminationPolicy = null; } if (cmdletContext.ClusterId != null) { request.ClusterId = cmdletContext.ClusterId; } 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); }
private Amazon.ElasticMapReduce.Model.PutAutoTerminationPolicyResponse CallAWSServiceOperation(IAmazonElasticMapReduce client, Amazon.ElasticMapReduce.Model.PutAutoTerminationPolicyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Elastic MapReduce", "PutAutoTerminationPolicy"); try { #if DESKTOP return(client.PutAutoTerminationPolicy(request)); #elif CORECLR return(client.PutAutoTerminationPolicyAsync(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; } }