/******************************************************************************* * Copyright 2012-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"). You may not use * this file except in compliance with the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * ***************************************************************************** * * AWS Tools for Windows (TM) PowerShell (TM) * */ using System; using System.Collections.Generic; using System.Linq; using System.Management.Automation; using System.Text; using Amazon.PowerShell.Common; using Amazon.Runtime; using Amazon.Batch; using Amazon.Batch.Model; namespace Amazon.PowerShell.Cmdlets.BAT { /// /// Submits an Batch job from a job definition. Parameters that are specified during SubmitJob /// override parameters defined in the job definition. vCPU and memory requirements that /// are specified in the resourceRequirements objects in the job definition /// are the exception. They can't be overridden this way using the memory /// and vcpus parameters. Rather, you must specify updates to job definition /// parameters in a resourceRequirements object that's included in the containerOverrides /// parameter. /// /// /// Job queues with a scheduling policy are limited to 500 active fair share identifiers /// at a time. /// /// Jobs that run on Fargate resources can't be guaranteed to run for more than 14 days. /// This is because, after 14 days, Fargate resources might become unavailable and job /// might be terminated. /// /// [Cmdlet("Submit", "BATJob", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("Amazon.Batch.Model.SubmitJobResponse")] [AWSCmdlet("Calls the AWS Batch SubmitJob API operation.", Operation = new[] {"SubmitJob"}, SelectReturnType = typeof(Amazon.Batch.Model.SubmitJobResponse))] [AWSCmdletOutput("Amazon.Batch.Model.SubmitJobResponse", "This cmdlet returns an Amazon.Batch.Model.SubmitJobResponse object containing multiple properties. The object can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class SubmitBATJobCmdlet : AmazonBatchClientCmdlet, IExecutor { #region Parameter RetryStrategy_Attempt /// /// /// The number of times to move a job to the RUNNABLE status. You can specify /// between 1 and 10 attempts. If the value of attempts is greater than one, /// the job is retried on failure the same number of attempts as the value. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("RetryStrategy_Attempts")] public System.Int32? RetryStrategy_Attempt { get; set; } #endregion #region Parameter ContainerOverrides_Command /// /// /// The command to send to the container that overrides the default command from the Docker /// image or the job definition.This parameter can't contain an empty string. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String[] ContainerOverrides_Command { get; set; } #endregion #region Parameter PodProperties_Container /// /// /// The overrides for the container that's used on the Amazon EKS pod. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("EksPropertiesOverride_PodProperties_Containers")] public Amazon.Batch.Model.EksContainerOverride[] PodProperties_Container { get; set; } #endregion #region Parameter DependsOn /// /// /// A list of dependencies for the job. A job can depend upon a maximum of 20 jobs. You /// can specify a SEQUENTIAL type dependency without specifying a job ID /// for array jobs so that each child array job completes sequentially, starting at index /// 0. You can also specify an N_TO_N type dependency with a job ID for array /// jobs. In that case, each index child of this job must wait for the corresponding index /// child of each dependency to complete before it can begin. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public Amazon.Batch.Model.JobDependency[] DependsOn { get; set; } #endregion #region Parameter ContainerOverrides_Environment /// /// /// The environment variables to send to the container. You can add new environment variables, /// which are added to the container at launch, or you can override the existing environment /// variables from the Docker image or the job definition.Environment variables cannot start with "AWS_BATCH". This naming convention /// is reserved for variables that Batch sets. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public Amazon.Batch.Model.KeyValuePair[] ContainerOverrides_Environment { get; set; } #endregion #region Parameter RetryStrategy_EvaluateOnExit /// /// /// Array of up to 5 objects that specify the conditions where jobs are retried or failed. /// If this parameter is specified, then the attempts parameter must also /// be specified. If none of the listed conditions match, then the job is retried. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public Amazon.Batch.Model.EvaluateOnExit[] RetryStrategy_EvaluateOnExit { get; set; } #endregion #region Parameter ContainerOverrides_InstanceType /// /// /// The instance type to use for a multi-node parallel job.This parameter isn't applicable to single-node container jobs or jobs that run on /// Fargate resources, and shouldn't be provided. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String ContainerOverrides_InstanceType { get; set; } #endregion #region Parameter JobDefinition /// /// /// The job definition used by this job. This value can be one of definition-name, /// definition-name:revision, or the Amazon Resource Name (ARN) for the job /// definition, with or without the revision (arn:aws:batch:region:account:job-definition/definition-name:revision, or arn:aws:batch:region:account:job-definition/definition-name).If the revision is not specified, then the latest active revision is used. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String JobDefinition { get; set; } #endregion #region Parameter JobName /// /// /// The name of the job. It can be up to 128 letters long. The first character must be /// alphanumeric, can contain uppercase and lowercase letters, numbers, hyphens (-), and /// underscores (_). /// /// #if !MODULAR [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true)] #else [System.Management.Automation.Parameter(Position = 0, ValueFromPipelineByPropertyName = true, ValueFromPipeline = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String JobName { get; set; } #endregion #region Parameter JobQueue /// /// /// The job queue where the job is submitted. You can specify either the name or the Amazon /// Resource Name (ARN) of the queue. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyString] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] public System.String JobQueue { get; set; } #endregion #region Parameter Metadata_Label /// /// /// Key-value pairs used to identify, sort, and organize cube resources. Can contain up /// to 63 uppercase letters, lowercase letters, numbers, hyphens (-), and underscores /// (_). Labels can be added or modified at any time. Each resource can have multiple /// labels, but each key must be unique for a given object. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("EksPropertiesOverride_PodProperties_Metadata_Labels")] public System.Collections.Hashtable Metadata_Label { get; set; } #endregion #region Parameter NodeOverrides_NodePropertyOverride /// /// /// The node property overrides for the job. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("NodeOverrides_NodePropertyOverrides")] public Amazon.Batch.Model.NodePropertyOverride[] NodeOverrides_NodePropertyOverride { get; set; } #endregion #region Parameter NodeOverrides_NumNode /// /// /// The number of nodes to use with a multi-node parallel job. This value overrides the /// number of nodes that are specified in the job definition. To use this override, you /// must meet the following conditions: /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("NodeOverrides_NumNodes")] public System.Int32? NodeOverrides_NumNode { get; set; } #endregion #region Parameter Parameter /// /// /// Additional parameters passed to the job that replace parameter substitution placeholders /// that are set in the job definition. Parameters are specified as a key and value pair /// mapping. Parameters in a SubmitJob request override any corresponding /// parameter defaults from the job definition. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("Parameters")] public System.Collections.Hashtable Parameter { get; set; } #endregion #region Parameter PropagateTag /// /// /// Specifies whether to propagate the tags from the job or job definition to the corresponding /// Amazon ECS task. If no value is specified, the tags aren't propagated. Tags can only /// be propagated to the tasks during task creation. For tags with the same name, job /// tags are given priority over job definitions tags. If the total number of combined /// tags from the job and job definition is over 50, the job is moved to the FAILED /// state. When specified, this overrides the tag propagation setting in the job definition. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("PropagateTags")] public System.Boolean? PropagateTag { get; set; } #endregion #region Parameter ContainerOverrides_ResourceRequirement /// /// /// The type and amount of resources to assign to a container. This overrides the settings /// in the job definition. The supported resources include GPU, MEMORY, /// and VCPU. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("ContainerOverrides_ResourceRequirements")] public Amazon.Batch.Model.ResourceRequirement[] ContainerOverrides_ResourceRequirement { get; set; } #endregion #region Parameter SchedulingPriorityOverride /// /// /// The scheduling priority for the job. This only affects jobs in job queues with a fair /// share policy. Jobs with a higher scheduling priority are scheduled before jobs with /// a lower scheduling priority. This overrides any scheduling priority in the job definition.The minimum supported value is 0 and the maximum supported value is 9999. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Int32? SchedulingPriorityOverride { get; set; } #endregion #region Parameter ShareIdentifier /// /// /// The share identifier for the job. Don't specify this parameter if the job queue doesn't /// have a scheduling policy. If the job queue has a scheduling policy, then this parameter /// must be specified.This string is limited to 255 alphanumeric characters, and can be followed by an asterisk /// (*). /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String ShareIdentifier { get; set; } #endregion #region Parameter ArrayProperties_Size /// /// /// The size of the array job. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Int32? ArrayProperties_Size { get; set; } #endregion #region Parameter Tag /// /// /// The tags that you apply to the job request to help you categorize and organize your /// resources. Each tag consists of a key and an optional value. For more information, /// see Tagging /// Amazon Web Services Resources in Amazon Web Services General Reference. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("Tags")] public System.Collections.Hashtable Tag { get; set; } #endregion #region Parameter Timeout /// /// /// The timeout configuration for this SubmitJob operation. You can specify a timeout /// duration after which Batch terminates your jobs if they haven't finished. If a job /// is terminated due to a timeout, it isn't retried. The minimum value for the timeout /// is 60 seconds. This configuration overrides any timeout configuration specified in /// the job definition. For array jobs, child jobs have the same timeout configuration /// as the parent job. For more information, see Job /// Timeouts in the Amazon Elastic Container Service Developer Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public Amazon.Batch.Model.JobTimeout Timeout { get; set; } #endregion #region Parameter ContainerOverrides_Memory /// /// /// This parameter is deprecated, use resourceRequirements to override the /// memory requirements specified in the job definition. It's not supported for jobs running /// on Fargate resources. For jobs that run on EC2 resources, it overrides the memory /// parameter set in the job definition, but doesn't override any memory requirement that's /// specified in the resourceRequirements structure in the job definition. /// To override memory requirements that are specified in the resourceRequirements /// structure in the job definition, resourceRequirements must be specified /// in the SubmitJob request, with type set to MEMORY /// and value set to the new value. For more information, see Can't /// override job definition resource requirements in the Batch User Guide. /// /// This parameter is deprecated. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [System.ObsoleteAttribute("This field is deprecated, use resourceRequirements instead.")] public System.Int32? ContainerOverrides_Memory { get; set; } #endregion #region Parameter ContainerOverrides_Vcpus /// /// /// This parameter is deprecated, use resourceRequirements to override the /// vcpus parameter that's set in the job definition. It's not supported /// for jobs running on Fargate resources. For jobs that run on EC2 resources, it overrides /// the vcpus parameter set in the job definition, but doesn't override any /// vCPU requirement specified in the resourceRequirements structure in the /// job definition. To override vCPU requirements that are specified in the resourceRequirements /// structure in the job definition, resourceRequirements must be specified /// in the SubmitJob request, with type set to VCPU /// and value set to the new value. For more information, see Can't /// override job definition resource requirements in the Batch User Guide. /// /// This parameter is deprecated. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [System.ObsoleteAttribute("This field is deprecated, use resourceRequirements instead.")] public System.Int32? ContainerOverrides_Vcpus { get; set; } #endregion #region Parameter Select /// /// Use the -Select parameter to control the cmdlet output. The default value is '*'. /// Specifying -Select '*' will result in the cmdlet returning the whole service response (Amazon.Batch.Model.SubmitJobResponse). /// Specifying the name of a property of type Amazon.Batch.Model.SubmitJobResponse will result in that property being returned. /// Specifying -Select '^ParameterName' will result in the cmdlet returning the selected cmdlet parameter value. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public string Select { get; set; } = "*"; #endregion #region Parameter PassThru /// /// Changes the cmdlet behavior to return the value passed to the JobName parameter. /// The -PassThru parameter is deprecated, use -Select '^JobName' instead. This parameter will be removed in a future version. /// [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^JobName' instead. This parameter will be removed in a future version.")] [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter PassThru { get; set; } #endregion #region Parameter Force /// /// This parameter overrides confirmation prompts to force /// the cmdlet to continue its operation. This parameter should always /// be used with caution. /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public SwitchParameter Force { get; set; } #endregion protected override void ProcessRecord() { this._AWSSignerType = "v4"; base.ProcessRecord(); var resourceIdentifiersText = FormatParameterValuesForConfirmationMsg(nameof(this.JobName), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Submit-BATJob (SubmitJob)")) { return; } var context = new CmdletContext(); // allow for manipulation of parameters prior to loading into context PreExecutionContextLoad(context); #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute if (ParameterWasBound(nameof(this.Select))) { context.Select = CreateSelectDelegate(Select) ?? throw new System.ArgumentException("Invalid value for -Select parameter.", nameof(this.Select)); if (this.PassThru.IsPresent) { throw new System.ArgumentException("-PassThru cannot be used when -Select is specified.", nameof(this.Select)); } } else if (this.PassThru.IsPresent) { context.Select = (response, cmdlet) => this.JobName; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute context.ArrayProperties_Size = this.ArrayProperties_Size; if (this.ContainerOverrides_Command != null) { context.ContainerOverrides_Command = new List(this.ContainerOverrides_Command); } if (this.ContainerOverrides_Environment != null) { context.ContainerOverrides_Environment = new List(this.ContainerOverrides_Environment); } context.ContainerOverrides_InstanceType = this.ContainerOverrides_InstanceType; #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute context.ContainerOverrides_Memory = this.ContainerOverrides_Memory; #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute if (this.ContainerOverrides_ResourceRequirement != null) { context.ContainerOverrides_ResourceRequirement = new List(this.ContainerOverrides_ResourceRequirement); } #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute context.ContainerOverrides_Vcpus = this.ContainerOverrides_Vcpus; #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute if (this.DependsOn != null) { context.DependsOn = new List(this.DependsOn); } if (this.PodProperties_Container != null) { context.PodProperties_Container = new List(this.PodProperties_Container); } if (this.Metadata_Label != null) { context.Metadata_Label = new Dictionary(StringComparer.Ordinal); foreach (var hashKey in this.Metadata_Label.Keys) { context.Metadata_Label.Add((String)hashKey, (String)(this.Metadata_Label[hashKey])); } } context.JobDefinition = this.JobDefinition; #if MODULAR if (this.JobDefinition == null && ParameterWasBound(nameof(this.JobDefinition))) { WriteWarning("You are passing $null as a value for parameter JobDefinition which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.JobName = this.JobName; #if MODULAR if (this.JobName == null && ParameterWasBound(nameof(this.JobName))) { WriteWarning("You are passing $null as a value for parameter JobName which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif context.JobQueue = this.JobQueue; #if MODULAR if (this.JobQueue == null && ParameterWasBound(nameof(this.JobQueue))) { WriteWarning("You are passing $null as a value for parameter JobQueue which is marked as required. In case you believe this parameter was incorrectly marked as required, report this by opening an issue at https://github.com/aws/aws-tools-for-powershell/issues."); } #endif if (this.NodeOverrides_NodePropertyOverride != null) { context.NodeOverrides_NodePropertyOverride = new List(this.NodeOverrides_NodePropertyOverride); } context.NodeOverrides_NumNode = this.NodeOverrides_NumNode; if (this.Parameter != null) { context.Parameter = new Dictionary(StringComparer.Ordinal); foreach (var hashKey in this.Parameter.Keys) { context.Parameter.Add((String)hashKey, (String)(this.Parameter[hashKey])); } } context.PropagateTag = this.PropagateTag; context.RetryStrategy_Attempt = this.RetryStrategy_Attempt; if (this.RetryStrategy_EvaluateOnExit != null) { context.RetryStrategy_EvaluateOnExit = new List(this.RetryStrategy_EvaluateOnExit); } context.SchedulingPriorityOverride = this.SchedulingPriorityOverride; context.ShareIdentifier = this.ShareIdentifier; if (this.Tag != null) { context.Tag = new Dictionary(StringComparer.Ordinal); foreach (var hashKey in this.Tag.Keys) { context.Tag.Add((String)hashKey, (String)(this.Tag[hashKey])); } } context.Timeout = this.Timeout; // allow further manipulation of loaded context prior to processing PostExecutionContextLoad(context); var output = Execute(context) as CmdletOutput; ProcessOutput(output); } #region IExecutor Members public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Batch.Model.SubmitJobRequest(); // populate ArrayProperties var requestArrayPropertiesIsNull = true; request.ArrayProperties = new Amazon.Batch.Model.ArrayProperties(); System.Int32? requestArrayProperties_arrayProperties_Size = null; if (cmdletContext.ArrayProperties_Size != null) { requestArrayProperties_arrayProperties_Size = cmdletContext.ArrayProperties_Size.Value; } if (requestArrayProperties_arrayProperties_Size != null) { request.ArrayProperties.Size = requestArrayProperties_arrayProperties_Size.Value; requestArrayPropertiesIsNull = false; } // determine if request.ArrayProperties should be set to null if (requestArrayPropertiesIsNull) { request.ArrayProperties = null; } // populate ContainerOverrides var requestContainerOverridesIsNull = true; request.ContainerOverrides = new Amazon.Batch.Model.ContainerOverrides(); List requestContainerOverrides_containerOverrides_Command = null; if (cmdletContext.ContainerOverrides_Command != null) { requestContainerOverrides_containerOverrides_Command = cmdletContext.ContainerOverrides_Command; } if (requestContainerOverrides_containerOverrides_Command != null) { request.ContainerOverrides.Command = requestContainerOverrides_containerOverrides_Command; requestContainerOverridesIsNull = false; } List requestContainerOverrides_containerOverrides_Environment = null; if (cmdletContext.ContainerOverrides_Environment != null) { requestContainerOverrides_containerOverrides_Environment = cmdletContext.ContainerOverrides_Environment; } if (requestContainerOverrides_containerOverrides_Environment != null) { request.ContainerOverrides.Environment = requestContainerOverrides_containerOverrides_Environment; requestContainerOverridesIsNull = false; } System.String requestContainerOverrides_containerOverrides_InstanceType = null; if (cmdletContext.ContainerOverrides_InstanceType != null) { requestContainerOverrides_containerOverrides_InstanceType = cmdletContext.ContainerOverrides_InstanceType; } if (requestContainerOverrides_containerOverrides_InstanceType != null) { request.ContainerOverrides.InstanceType = requestContainerOverrides_containerOverrides_InstanceType; requestContainerOverridesIsNull = false; } #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute System.Int32? requestContainerOverrides_containerOverrides_Memory = null; if (cmdletContext.ContainerOverrides_Memory != null) { requestContainerOverrides_containerOverrides_Memory = cmdletContext.ContainerOverrides_Memory.Value; } if (requestContainerOverrides_containerOverrides_Memory != null) { request.ContainerOverrides.Memory = requestContainerOverrides_containerOverrides_Memory.Value; requestContainerOverridesIsNull = false; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute List requestContainerOverrides_containerOverrides_ResourceRequirement = null; if (cmdletContext.ContainerOverrides_ResourceRequirement != null) { requestContainerOverrides_containerOverrides_ResourceRequirement = cmdletContext.ContainerOverrides_ResourceRequirement; } if (requestContainerOverrides_containerOverrides_ResourceRequirement != null) { request.ContainerOverrides.ResourceRequirements = requestContainerOverrides_containerOverrides_ResourceRequirement; requestContainerOverridesIsNull = false; } #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute System.Int32? requestContainerOverrides_containerOverrides_Vcpus = null; if (cmdletContext.ContainerOverrides_Vcpus != null) { requestContainerOverrides_containerOverrides_Vcpus = cmdletContext.ContainerOverrides_Vcpus.Value; } if (requestContainerOverrides_containerOverrides_Vcpus != null) { request.ContainerOverrides.Vcpus = requestContainerOverrides_containerOverrides_Vcpus.Value; requestContainerOverridesIsNull = false; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute // determine if request.ContainerOverrides should be set to null if (requestContainerOverridesIsNull) { request.ContainerOverrides = null; } if (cmdletContext.DependsOn != null) { request.DependsOn = cmdletContext.DependsOn; } // populate EksPropertiesOverride var requestEksPropertiesOverrideIsNull = true; request.EksPropertiesOverride = new Amazon.Batch.Model.EksPropertiesOverride(); Amazon.Batch.Model.EksPodPropertiesOverride requestEksPropertiesOverride_eksPropertiesOverride_PodProperties = null; // populate PodProperties var requestEksPropertiesOverride_eksPropertiesOverride_PodPropertiesIsNull = true; requestEksPropertiesOverride_eksPropertiesOverride_PodProperties = new Amazon.Batch.Model.EksPodPropertiesOverride(); List requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_podProperties_Container = null; if (cmdletContext.PodProperties_Container != null) { requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_podProperties_Container = cmdletContext.PodProperties_Container; } if (requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_podProperties_Container != null) { requestEksPropertiesOverride_eksPropertiesOverride_PodProperties.Containers = requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_podProperties_Container; requestEksPropertiesOverride_eksPropertiesOverride_PodPropertiesIsNull = false; } Amazon.Batch.Model.EksMetadata requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata = null; // populate Metadata var requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_MetadataIsNull = true; requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata = new Amazon.Batch.Model.EksMetadata(); Dictionary requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata_metadata_Label = null; if (cmdletContext.Metadata_Label != null) { requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata_metadata_Label = cmdletContext.Metadata_Label; } if (requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata_metadata_Label != null) { requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata.Labels = requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata_metadata_Label; requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_MetadataIsNull = false; } // determine if requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata should be set to null if (requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_MetadataIsNull) { requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata = null; } if (requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata != null) { requestEksPropertiesOverride_eksPropertiesOverride_PodProperties.Metadata = requestEksPropertiesOverride_eksPropertiesOverride_PodProperties_eksPropertiesOverride_PodProperties_Metadata; requestEksPropertiesOverride_eksPropertiesOverride_PodPropertiesIsNull = false; } // determine if requestEksPropertiesOverride_eksPropertiesOverride_PodProperties should be set to null if (requestEksPropertiesOverride_eksPropertiesOverride_PodPropertiesIsNull) { requestEksPropertiesOverride_eksPropertiesOverride_PodProperties = null; } if (requestEksPropertiesOverride_eksPropertiesOverride_PodProperties != null) { request.EksPropertiesOverride.PodProperties = requestEksPropertiesOverride_eksPropertiesOverride_PodProperties; requestEksPropertiesOverrideIsNull = false; } // determine if request.EksPropertiesOverride should be set to null if (requestEksPropertiesOverrideIsNull) { request.EksPropertiesOverride = null; } if (cmdletContext.JobDefinition != null) { request.JobDefinition = cmdletContext.JobDefinition; } if (cmdletContext.JobName != null) { request.JobName = cmdletContext.JobName; } if (cmdletContext.JobQueue != null) { request.JobQueue = cmdletContext.JobQueue; } // populate NodeOverrides var requestNodeOverridesIsNull = true; request.NodeOverrides = new Amazon.Batch.Model.NodeOverrides(); List requestNodeOverrides_nodeOverrides_NodePropertyOverride = null; if (cmdletContext.NodeOverrides_NodePropertyOverride != null) { requestNodeOverrides_nodeOverrides_NodePropertyOverride = cmdletContext.NodeOverrides_NodePropertyOverride; } if (requestNodeOverrides_nodeOverrides_NodePropertyOverride != null) { request.NodeOverrides.NodePropertyOverrides = requestNodeOverrides_nodeOverrides_NodePropertyOverride; requestNodeOverridesIsNull = false; } System.Int32? requestNodeOverrides_nodeOverrides_NumNode = null; if (cmdletContext.NodeOverrides_NumNode != null) { requestNodeOverrides_nodeOverrides_NumNode = cmdletContext.NodeOverrides_NumNode.Value; } if (requestNodeOverrides_nodeOverrides_NumNode != null) { request.NodeOverrides.NumNodes = requestNodeOverrides_nodeOverrides_NumNode.Value; requestNodeOverridesIsNull = false; } // determine if request.NodeOverrides should be set to null if (requestNodeOverridesIsNull) { request.NodeOverrides = null; } if (cmdletContext.Parameter != null) { request.Parameters = cmdletContext.Parameter; } if (cmdletContext.PropagateTag != null) { request.PropagateTags = cmdletContext.PropagateTag.Value; } // 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; } List requestRetryStrategy_retryStrategy_EvaluateOnExit = null; if (cmdletContext.RetryStrategy_EvaluateOnExit != null) { requestRetryStrategy_retryStrategy_EvaluateOnExit = cmdletContext.RetryStrategy_EvaluateOnExit; } if (requestRetryStrategy_retryStrategy_EvaluateOnExit != null) { request.RetryStrategy.EvaluateOnExit = requestRetryStrategy_retryStrategy_EvaluateOnExit; requestRetryStrategyIsNull = false; } // determine if request.RetryStrategy should be set to null if (requestRetryStrategyIsNull) { request.RetryStrategy = null; } if (cmdletContext.SchedulingPriorityOverride != null) { request.SchedulingPriorityOverride = cmdletContext.SchedulingPriorityOverride.Value; } if (cmdletContext.ShareIdentifier != null) { request.ShareIdentifier = cmdletContext.ShareIdentifier; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.Timeout != null) { request.Timeout = cmdletContext.Timeout; } 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; } public ExecutorContext CreateContext() { return new CmdletContext(); } #endregion #region AWS Service Operation Call private Amazon.Batch.Model.SubmitJobResponse CallAWSServiceOperation(IAmazonBatch client, Amazon.Batch.Model.SubmitJobRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Batch", "SubmitJob"); try { #if DESKTOP return client.SubmitJob(request); #elif CORECLR return client.SubmitJobAsync(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; } } #endregion internal partial class CmdletContext : ExecutorContext { public System.Int32? ArrayProperties_Size { get; set; } public List ContainerOverrides_Command { get; set; } public List ContainerOverrides_Environment { get; set; } public System.String ContainerOverrides_InstanceType { get; set; } [System.ObsoleteAttribute] public System.Int32? ContainerOverrides_Memory { get; set; } public List ContainerOverrides_ResourceRequirement { get; set; } [System.ObsoleteAttribute] public System.Int32? ContainerOverrides_Vcpus { get; set; } public List DependsOn { get; set; } public List PodProperties_Container { get; set; } public Dictionary Metadata_Label { get; set; } public System.String JobDefinition { get; set; } public System.String JobName { get; set; } public System.String JobQueue { get; set; } public List NodeOverrides_NodePropertyOverride { get; set; } public System.Int32? NodeOverrides_NumNode { get; set; } public Dictionary Parameter { get; set; } public System.Boolean? PropagateTag { get; set; } public System.Int32? RetryStrategy_Attempt { get; set; } public List RetryStrategy_EvaluateOnExit { get; set; } public System.Int32? SchedulingPriorityOverride { get; set; } public System.String ShareIdentifier { get; set; } public Dictionary Tag { get; set; } public Amazon.Batch.Model.JobTimeout Timeout { get; set; } public System.Func Select { get; set; } = (response, cmdlet) => response; } } }