private Amazon.Batch.Model.UpdateComputeEnvironmentResponse CallAWSServiceOperation(IAmazonBatch client, Amazon.Batch.Model.UpdateComputeEnvironmentRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Batch", "UpdateComputeEnvironment"); try { #if DESKTOP return(client.UpdateComputeEnvironment(request)); #elif CORECLR return(client.UpdateComputeEnvironmentAsync(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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Batch.Model.UpdateComputeEnvironmentRequest(); if (cmdletContext.ComputeEnvironment != null) { request.ComputeEnvironment = cmdletContext.ComputeEnvironment; } // populate ComputeResources var requestComputeResourcesIsNull = true; request.ComputeResources = new Amazon.Batch.Model.ComputeResourceUpdate(); System.Int32?requestComputeResources_computeResources_DesiredvCpu = null; if (cmdletContext.ComputeResources_DesiredvCpu != null) { requestComputeResources_computeResources_DesiredvCpu = cmdletContext.ComputeResources_DesiredvCpu.Value; } if (requestComputeResources_computeResources_DesiredvCpu != null) { request.ComputeResources.DesiredvCpus = requestComputeResources_computeResources_DesiredvCpu.Value; requestComputeResourcesIsNull = false; } System.Int32?requestComputeResources_computeResources_MaxvCpu = null; if (cmdletContext.ComputeResources_MaxvCpu != null) { requestComputeResources_computeResources_MaxvCpu = cmdletContext.ComputeResources_MaxvCpu.Value; } if (requestComputeResources_computeResources_MaxvCpu != null) { request.ComputeResources.MaxvCpus = requestComputeResources_computeResources_MaxvCpu.Value; requestComputeResourcesIsNull = false; } System.Int32?requestComputeResources_computeResources_MinvCpu = null; if (cmdletContext.ComputeResources_MinvCpu != null) { requestComputeResources_computeResources_MinvCpu = cmdletContext.ComputeResources_MinvCpu.Value; } if (requestComputeResources_computeResources_MinvCpu != null) { request.ComputeResources.MinvCpus = requestComputeResources_computeResources_MinvCpu.Value; requestComputeResourcesIsNull = false; } List <System.String> requestComputeResources_computeResources_SecurityGroupId = null; if (cmdletContext.ComputeResources_SecurityGroupId != null) { requestComputeResources_computeResources_SecurityGroupId = cmdletContext.ComputeResources_SecurityGroupId; } if (requestComputeResources_computeResources_SecurityGroupId != null) { request.ComputeResources.SecurityGroupIds = requestComputeResources_computeResources_SecurityGroupId; requestComputeResourcesIsNull = false; } List <System.String> requestComputeResources_computeResources_Subnet = null; if (cmdletContext.ComputeResources_Subnet != null) { requestComputeResources_computeResources_Subnet = cmdletContext.ComputeResources_Subnet; } if (requestComputeResources_computeResources_Subnet != null) { request.ComputeResources.Subnets = requestComputeResources_computeResources_Subnet; requestComputeResourcesIsNull = false; } // determine if request.ComputeResources should be set to null if (requestComputeResourcesIsNull) { request.ComputeResources = null; } if (cmdletContext.ServiceRole != null) { request.ServiceRole = cmdletContext.ServiceRole; } if (cmdletContext.State != null) { request.State = cmdletContext.State; } 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); }
internal UpdateComputeEnvironmentResponse UpdateComputeEnvironment(UpdateComputeEnvironmentRequest request) { var marshaller = new UpdateComputeEnvironmentRequestMarshaller(); var unmarshaller = UpdateComputeEnvironmentResponseUnmarshaller.Instance; return Invoke<UpdateComputeEnvironmentRequest,UpdateComputeEnvironmentResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the UpdateComputeEnvironment operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateComputeEnvironment 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<UpdateComputeEnvironmentResponse> UpdateComputeEnvironmentAsync(UpdateComputeEnvironmentRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateComputeEnvironmentRequestMarshaller(); var unmarshaller = UpdateComputeEnvironmentResponseUnmarshaller.Instance; return InvokeAsync<UpdateComputeEnvironmentRequest,UpdateComputeEnvironmentResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the UpdateComputeEnvironment operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateComputeEnvironment operation on AmazonBatchClient.</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 EndUpdateComputeEnvironment /// operation.</returns> public IAsyncResult BeginUpdateComputeEnvironment(UpdateComputeEnvironmentRequest request, AsyncCallback callback, object state) { var marshaller = new UpdateComputeEnvironmentRequestMarshaller(); var unmarshaller = UpdateComputeEnvironmentResponseUnmarshaller.Instance; return BeginInvoke<UpdateComputeEnvironmentRequest>(request, marshaller, unmarshaller, callback, state); }