/// <summary> /// Initiates the asynchronous execution of the RegisterJobDefinition operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RegisterJobDefinition 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<RegisterJobDefinitionResponse> RegisterJobDefinitionAsync(RegisterJobDefinitionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RegisterJobDefinitionRequestMarshaller(); var unmarshaller = RegisterJobDefinitionResponseUnmarshaller.Instance; return InvokeAsync<RegisterJobDefinitionRequest,RegisterJobDefinitionResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal RegisterJobDefinitionResponse RegisterJobDefinition(RegisterJobDefinitionRequest request) { var marshaller = new RegisterJobDefinitionRequestMarshaller(); var unmarshaller = RegisterJobDefinitionResponseUnmarshaller.Instance; return Invoke<RegisterJobDefinitionRequest,RegisterJobDefinitionResponse>(request, marshaller, unmarshaller); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Batch.Model.RegisterJobDefinitionRequest(); // populate ContainerProperties var requestContainerPropertiesIsNull = true; request.ContainerProperties = new Amazon.Batch.Model.ContainerProperties(); List <System.String> requestContainerProperties_containerProperties_Command = null; if (cmdletContext.ContainerProperties_Command != null) { requestContainerProperties_containerProperties_Command = cmdletContext.ContainerProperties_Command; } if (requestContainerProperties_containerProperties_Command != null) { request.ContainerProperties.Command = requestContainerProperties_containerProperties_Command; requestContainerPropertiesIsNull = false; } List <Amazon.Batch.Model.KeyValuePair> requestContainerProperties_containerProperties_Environment = null; if (cmdletContext.ContainerProperties_Environment != null) { requestContainerProperties_containerProperties_Environment = cmdletContext.ContainerProperties_Environment; } if (requestContainerProperties_containerProperties_Environment != null) { request.ContainerProperties.Environment = requestContainerProperties_containerProperties_Environment; requestContainerPropertiesIsNull = false; } System.String requestContainerProperties_containerProperties_Image = null; if (cmdletContext.ContainerProperties_Image != null) { requestContainerProperties_containerProperties_Image = cmdletContext.ContainerProperties_Image; } if (requestContainerProperties_containerProperties_Image != null) { request.ContainerProperties.Image = requestContainerProperties_containerProperties_Image; requestContainerPropertiesIsNull = false; } System.String requestContainerProperties_containerProperties_InstanceType = null; if (cmdletContext.ContainerProperties_InstanceType != null) { requestContainerProperties_containerProperties_InstanceType = cmdletContext.ContainerProperties_InstanceType; } if (requestContainerProperties_containerProperties_InstanceType != null) { request.ContainerProperties.InstanceType = requestContainerProperties_containerProperties_InstanceType; requestContainerPropertiesIsNull = false; } System.String requestContainerProperties_containerProperties_JobRoleArn = null; if (cmdletContext.ContainerProperties_JobRoleArn != null) { requestContainerProperties_containerProperties_JobRoleArn = cmdletContext.ContainerProperties_JobRoleArn; } if (requestContainerProperties_containerProperties_JobRoleArn != null) { request.ContainerProperties.JobRoleArn = requestContainerProperties_containerProperties_JobRoleArn; requestContainerPropertiesIsNull = false; } System.Int32?requestContainerProperties_containerProperties_Memory = null; if (cmdletContext.ContainerProperties_Memory != null) { requestContainerProperties_containerProperties_Memory = cmdletContext.ContainerProperties_Memory.Value; } if (requestContainerProperties_containerProperties_Memory != null) { request.ContainerProperties.Memory = requestContainerProperties_containerProperties_Memory.Value; requestContainerPropertiesIsNull = false; } List <Amazon.Batch.Model.MountPoint> requestContainerProperties_containerProperties_MountPoint = null; if (cmdletContext.ContainerProperties_MountPoint != null) { requestContainerProperties_containerProperties_MountPoint = cmdletContext.ContainerProperties_MountPoint; } if (requestContainerProperties_containerProperties_MountPoint != null) { request.ContainerProperties.MountPoints = requestContainerProperties_containerProperties_MountPoint; requestContainerPropertiesIsNull = false; } System.Boolean?requestContainerProperties_containerProperties_Privileged = null; if (cmdletContext.ContainerProperties_Privileged != null) { requestContainerProperties_containerProperties_Privileged = cmdletContext.ContainerProperties_Privileged.Value; } if (requestContainerProperties_containerProperties_Privileged != null) { request.ContainerProperties.Privileged = requestContainerProperties_containerProperties_Privileged.Value; requestContainerPropertiesIsNull = false; } System.Boolean?requestContainerProperties_containerProperties_ReadonlyRootFilesystem = null; if (cmdletContext.ContainerProperties_ReadonlyRootFilesystem != null) { requestContainerProperties_containerProperties_ReadonlyRootFilesystem = cmdletContext.ContainerProperties_ReadonlyRootFilesystem.Value; } if (requestContainerProperties_containerProperties_ReadonlyRootFilesystem != null) { request.ContainerProperties.ReadonlyRootFilesystem = requestContainerProperties_containerProperties_ReadonlyRootFilesystem.Value; requestContainerPropertiesIsNull = false; } List <Amazon.Batch.Model.ResourceRequirement> requestContainerProperties_containerProperties_ResourceRequirement = null; if (cmdletContext.ContainerProperties_ResourceRequirement != null) { requestContainerProperties_containerProperties_ResourceRequirement = cmdletContext.ContainerProperties_ResourceRequirement; } if (requestContainerProperties_containerProperties_ResourceRequirement != null) { request.ContainerProperties.ResourceRequirements = requestContainerProperties_containerProperties_ResourceRequirement; requestContainerPropertiesIsNull = false; } List <Amazon.Batch.Model.Ulimit> requestContainerProperties_containerProperties_Ulimit = null; if (cmdletContext.ContainerProperties_Ulimit != null) { requestContainerProperties_containerProperties_Ulimit = cmdletContext.ContainerProperties_Ulimit; } if (requestContainerProperties_containerProperties_Ulimit != null) { request.ContainerProperties.Ulimits = requestContainerProperties_containerProperties_Ulimit; requestContainerPropertiesIsNull = false; } System.String requestContainerProperties_containerProperties_User = null; if (cmdletContext.ContainerProperties_User != null) { requestContainerProperties_containerProperties_User = cmdletContext.ContainerProperties_User; } if (requestContainerProperties_containerProperties_User != null) { request.ContainerProperties.User = requestContainerProperties_containerProperties_User; requestContainerPropertiesIsNull = false; } System.Int32?requestContainerProperties_containerProperties_Vcpus = null; if (cmdletContext.ContainerProperties_Vcpus != null) { requestContainerProperties_containerProperties_Vcpus = cmdletContext.ContainerProperties_Vcpus.Value; } if (requestContainerProperties_containerProperties_Vcpus != null) { request.ContainerProperties.Vcpus = requestContainerProperties_containerProperties_Vcpus.Value; requestContainerPropertiesIsNull = false; } List <Amazon.Batch.Model.Volume> requestContainerProperties_containerProperties_Volume = null; if (cmdletContext.ContainerProperties_Volume != null) { requestContainerProperties_containerProperties_Volume = cmdletContext.ContainerProperties_Volume; } if (requestContainerProperties_containerProperties_Volume != null) { request.ContainerProperties.Volumes = requestContainerProperties_containerProperties_Volume; requestContainerPropertiesIsNull = false; } Amazon.Batch.Model.LinuxParameters requestContainerProperties_containerProperties_LinuxParameters = null; // populate LinuxParameters var requestContainerProperties_containerProperties_LinuxParametersIsNull = true; requestContainerProperties_containerProperties_LinuxParameters = new Amazon.Batch.Model.LinuxParameters(); List <Amazon.Batch.Model.Device> requestContainerProperties_containerProperties_LinuxParameters_linuxParameters_Device = null; if (cmdletContext.LinuxParameters_Device != null) { requestContainerProperties_containerProperties_LinuxParameters_linuxParameters_Device = cmdletContext.LinuxParameters_Device; } if (requestContainerProperties_containerProperties_LinuxParameters_linuxParameters_Device != null) { requestContainerProperties_containerProperties_LinuxParameters.Devices = requestContainerProperties_containerProperties_LinuxParameters_linuxParameters_Device; requestContainerProperties_containerProperties_LinuxParametersIsNull = false; } // determine if requestContainerProperties_containerProperties_LinuxParameters should be set to null if (requestContainerProperties_containerProperties_LinuxParametersIsNull) { requestContainerProperties_containerProperties_LinuxParameters = null; } if (requestContainerProperties_containerProperties_LinuxParameters != null) { request.ContainerProperties.LinuxParameters = requestContainerProperties_containerProperties_LinuxParameters; requestContainerPropertiesIsNull = false; } // determine if request.ContainerProperties should be set to null if (requestContainerPropertiesIsNull) { request.ContainerProperties = null; } if (cmdletContext.JobDefinitionName != null) { request.JobDefinitionName = cmdletContext.JobDefinitionName; } // populate NodeProperties var requestNodePropertiesIsNull = true; request.NodeProperties = new Amazon.Batch.Model.NodeProperties(); System.Int32?requestNodeProperties_nodeProperties_MainNode = null; if (cmdletContext.NodeProperties_MainNode != null) { requestNodeProperties_nodeProperties_MainNode = cmdletContext.NodeProperties_MainNode.Value; } if (requestNodeProperties_nodeProperties_MainNode != null) { request.NodeProperties.MainNode = requestNodeProperties_nodeProperties_MainNode.Value; requestNodePropertiesIsNull = false; } List <Amazon.Batch.Model.NodeRangeProperty> requestNodeProperties_nodeProperties_NodeRangeProperty = null; if (cmdletContext.NodeProperties_NodeRangeProperty != null) { requestNodeProperties_nodeProperties_NodeRangeProperty = cmdletContext.NodeProperties_NodeRangeProperty; } if (requestNodeProperties_nodeProperties_NodeRangeProperty != null) { request.NodeProperties.NodeRangeProperties = requestNodeProperties_nodeProperties_NodeRangeProperty; requestNodePropertiesIsNull = false; } System.Int32?requestNodeProperties_nodeProperties_NumNode = null; if (cmdletContext.NodeProperties_NumNode != null) { requestNodeProperties_nodeProperties_NumNode = cmdletContext.NodeProperties_NumNode.Value; } if (requestNodeProperties_nodeProperties_NumNode != null) { request.NodeProperties.NumNodes = requestNodeProperties_nodeProperties_NumNode.Value; requestNodePropertiesIsNull = false; } // determine if request.NodeProperties should be set to null if (requestNodePropertiesIsNull) { request.NodeProperties = null; } if (cmdletContext.Parameter != null) { request.Parameters = cmdletContext.Parameter; } // populate RetryStrategy var requestRetryStrategyIsNull = true; request.RetryStrategy = new Amazon.Batch.Model.RetryStrategy(); System.Int32?requestRetryStrategy_retryStrategy_Attempt = null; if (cmdletContext.RetryStrategy_Attempt != null) { requestRetryStrategy_retryStrategy_Attempt = cmdletContext.RetryStrategy_Attempt.Value; } if (requestRetryStrategy_retryStrategy_Attempt != null) { request.RetryStrategy.Attempts = requestRetryStrategy_retryStrategy_Attempt.Value; requestRetryStrategyIsNull = false; } // determine if request.RetryStrategy should be set to null if (requestRetryStrategyIsNull) { request.RetryStrategy = null; } if (cmdletContext.Timeout != null) { request.Timeout = cmdletContext.Timeout; } if (cmdletContext.Type != null) { request.Type = cmdletContext.Type; } 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.Batch.Model.RegisterJobDefinitionResponse CallAWSServiceOperation(IAmazonBatch client, Amazon.Batch.Model.RegisterJobDefinitionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Batch", "RegisterJobDefinition"); try { #if DESKTOP return(client.RegisterJobDefinition(request)); #elif CORECLR return(client.RegisterJobDefinitionAsync(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 RegisterJobDefinition operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RegisterJobDefinition 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 EndRegisterJobDefinition /// operation.</returns> public IAsyncResult BeginRegisterJobDefinition(RegisterJobDefinitionRequest request, AsyncCallback callback, object state) { var marshaller = new RegisterJobDefinitionRequestMarshaller(); var unmarshaller = RegisterJobDefinitionResponseUnmarshaller.Instance; return BeginInvoke<RegisterJobDefinitionRequest>(request, marshaller, unmarshaller, callback, state); }