/******************************************************************************* * 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.ECS; using Amazon.ECS.Model; namespace Amazon.PowerShell.Cmdlets.ECS { /// /// Registers a new task definition from the supplied family and containerDefinitions. /// Optionally, you can add data volumes to your containers with the volumes /// parameter. For more information about task definition parameters and defaults, see /// Amazon /// ECS Task Definitions in the Amazon Elastic Container Service Developer Guide. /// /// /// /// You can specify a role for your task with the taskRoleArn parameter. /// When you specify a role for a task, its containers can then use the latest versions /// of the CLI or SDKs to make API requests to the Amazon Web Services services that are /// specified in the policy that's associated with the role. For more information, see /// IAM /// Roles for Tasks in the Amazon Elastic Container Service Developer Guide. /// /// You can specify a Docker networking mode for the containers in your task definition /// with the networkMode parameter. The available network modes correspond /// to those described in Network /// settings in the Docker run reference. If you specify the awsvpc network /// mode, the task is allocated an elastic network interface, and you must specify a NetworkConfiguration /// when you create a service or run a task with the task definition. For more information, /// see Task /// Networking in the Amazon Elastic Container Service Developer Guide. /// /// [Cmdlet("Register", "ECSTaskDefinition", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Medium)] [OutputType("Amazon.ECS.Model.RegisterTaskDefinitionResponse")] [AWSCmdlet("Calls the Amazon EC2 Container Service RegisterTaskDefinition API operation.", Operation = new[] {"RegisterTaskDefinition"}, SelectReturnType = typeof(Amazon.ECS.Model.RegisterTaskDefinitionResponse))] [AWSCmdletOutput("Amazon.ECS.Model.RegisterTaskDefinitionResponse", "This cmdlet returns an Amazon.ECS.Model.RegisterTaskDefinitionResponse object containing multiple properties. The object can also be referenced from properties attached to the cmdlet entry in the $AWSHistory stack." )] public partial class RegisterECSTaskDefinitionCmdlet : AmazonECSClientCmdlet, IExecutor { #region Parameter ContainerDefinition /// /// /// A list of container definitions in JSON format that describe the different containers /// that make up your task. /// /// #if !MODULAR [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] #else [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true)] [System.Management.Automation.AllowEmptyCollection] [System.Management.Automation.AllowNull] #endif [Amazon.PowerShell.Common.AWSRequiredParameter] [Alias("ContainerDefinitions")] public Amazon.ECS.Model.ContainerDefinition[] ContainerDefinition { get; set; } #endregion #region Parameter ProxyConfiguration_ContainerName /// /// /// The name of the container that will serve as the App Mesh proxy. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String ProxyConfiguration_ContainerName { get; set; } #endregion #region Parameter Cpu /// /// /// The number of CPU units used by the task. It can be expressed as an integer using /// CPU units (for example, 1024) or as a string using vCPUs (for example, /// 1 vCPU or 1 vcpu) in a task definition. String values are /// converted to an integer indicating the CPU units when the task definition is registered.Task-level CPU and memory parameters are ignored for Windows containers. We recommend /// specifying container-level resources for Windows containers.If you're using the EC2 launch type, this field is optional. Supported values are /// between 128 CPU units (0.125 vCPUs) and 10240 /// CPU units (10 vCPUs). If you do not specify a value, the parameter is /// ignored.If you're using the Fargate launch type, this field is required and you must use one /// of the following values, which determines your range of supported values for the memory /// parameter:The CPU units cannot be less than 1 vCPU when you use Windows containers on Fargate. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String Cpu { get; set; } #endregion #region Parameter RuntimePlatform_CpuArchitecture /// /// /// The CPU architecture.You can run your Linux tasks on an ARM-based platform by setting the value to ARM64. /// This option is available for tasks that run on Linux Amazon EC2 instance or Linux /// containers on Fargate. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.ECS.CPUArchitecture")] public Amazon.ECS.CPUArchitecture RuntimePlatform_CpuArchitecture { get; set; } #endregion #region Parameter ExecutionRoleArn /// /// /// The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS /// container agent permission to make Amazon Web Services API calls on your behalf. The /// task execution IAM role is required depending on the requirements of your task. For /// more information, see Amazon /// ECS task execution IAM role in the Amazon Elastic Container Service Developer /// Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String ExecutionRoleArn { get; set; } #endregion #region Parameter Family /// /// /// You must specify a family for a task definition. You can use it track /// multiple versions of the same task definition. The family is used as /// a name for your task definition. Up to 255 letters (uppercase and lowercase), numbers, /// underscores, and hyphens are allowed. /// /// #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 Family { get; set; } #endregion #region Parameter InferenceAccelerator /// /// /// The Elastic Inference accelerators to use for the containers in the task. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("InferenceAccelerators")] public Amazon.ECS.Model.InferenceAccelerator[] InferenceAccelerator { get; set; } #endregion #region Parameter IpcMode /// /// /// The IPC resource namespace to use for the containers in the task. The valid values /// are host, task, or none. If host /// is specified, then all containers within the tasks that specified the host /// IPC mode on the same container instance share the same IPC resources with the host /// Amazon EC2 instance. If task is specified, all containers within the /// specified task share the same IPC resources. If none is specified, then /// IPC resources within the containers of a task are private and not shared with other /// containers in a task or on the container instance. If no value is specified, then /// the IPC resource namespace sharing depends on the Docker daemon setting on the container /// instance. For more information, see IPC /// settings in the Docker run reference.If the host IPC mode is used, be aware that there is a heightened risk /// of undesired IPC namespace expose. For more information, see Docker /// security.If you are setting namespaced kernel parameters using systemControls /// for the containers in the task, the following will apply to your IPC resource namespace. /// For more information, see System /// Controls in the Amazon Elastic Container Service Developer Guide.This parameter is not supported for Windows containers or tasks run on Fargate. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.ECS.IpcMode")] public Amazon.ECS.IpcMode IpcMode { get; set; } #endregion #region Parameter Memory /// /// /// The amount of memory (in MiB) used by the task. It can be expressed as an integer /// using MiB (for example ,1024) or as a string using GB (for example, 1GB /// or 1 GB) in a task definition. String values are converted to an integer /// indicating the MiB when the task definition is registered.Task-level CPU and memory parameters are ignored for Windows containers. We recommend /// specifying container-level resources for Windows containers.If using the EC2 launch type, this field is optional.If using the Fargate launch type, this field is required and you must use one of the /// following values. This determines your range of supported values for the cpu /// parameter.The CPU units cannot be less than 1 vCPU when you use Windows containers on Fargate. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String Memory { get; set; } #endregion #region Parameter NetworkMode /// /// /// The Docker networking mode to use for the containers in the task. The valid values /// are none, bridge, awsvpc, and host. /// If no network mode is specified, the default is bridge.For Amazon ECS tasks on Fargate, the awsvpc network mode is required. /// For Amazon ECS tasks on Amazon EC2 Linux instances, any network mode can be used. /// For Amazon ECS tasks on Amazon EC2 Windows instances, <default> /// or awsvpc can be used. If the network mode is set to none, /// you cannot specify port mappings in your container definitions, and the tasks containers /// do not have external connectivity. The host and awsvpc network /// modes offer the highest networking performance for containers because they use the /// EC2 network stack instead of the virtualized network stack provided by the bridge /// mode.With the host and awsvpc network modes, exposed container /// ports are mapped directly to the corresponding host port (for the host /// network mode) or the attached elastic network interface port (for the awsvpc /// network mode), so you cannot take advantage of dynamic host port mappings. When using the host network mode, you should not run containers using /// the root user (UID 0). It is considered best practice to use a non-root user.If the network mode is awsvpc, the task is allocated an elastic network /// interface, and you must specify a NetworkConfiguration value when you create /// a service or run a task with the task definition. For more information, see Task /// Networking in the Amazon Elastic Container Service Developer Guide.If the network mode is host, you cannot run multiple instantiations of /// the same task on a single container instance when port mappings are used.For more information, see Network /// settings in the Docker run reference. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.ECS.NetworkMode")] public Amazon.ECS.NetworkMode NetworkMode { get; set; } #endregion #region Parameter RuntimePlatform_OperatingSystemFamily /// /// /// The operating system. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.ECS.OSFamily")] public Amazon.ECS.OSFamily RuntimePlatform_OperatingSystemFamily { get; set; } #endregion #region Parameter PidMode /// /// /// The process namespace to use for the containers in the task. The valid values are /// host or task. If host is specified, then all /// containers within the tasks that specified the host PID mode on the same /// container instance share the same process namespace with the host Amazon EC2 instance. /// If task is specified, all containers within the specified task share /// the same process namespace. If no value is specified, the default is a private namespace. /// For more information, see PID /// settings in the Docker run reference.If the host PID mode is used, be aware that there is a heightened risk /// of undesired process namespace expose. For more information, see Docker /// security.This parameter is not supported for Windows containers or tasks run on Fargate. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.ECS.PidMode")] public Amazon.ECS.PidMode PidMode { get; set; } #endregion #region Parameter PlacementConstraint /// /// /// An array of placement constraint objects to use for the task. You can specify a maximum /// of 10 constraints for each task. This limit includes constraints in the task definition /// and those specified at runtime. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("PlacementConstraints")] public Amazon.ECS.Model.TaskDefinitionPlacementConstraint[] PlacementConstraint { get; set; } #endregion #region Parameter ProxyConfiguration_Property /// /// /// The set of network configuration parameters to provide the Container Network Interface /// (CNI) plugin, specified as key-value pairs. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("ProxyConfiguration_Properties")] public Amazon.ECS.Model.KeyValuePair[] ProxyConfiguration_Property { get; set; } #endregion #region Parameter RequiresCompatibility /// /// /// The task launch type that Amazon ECS validates the task definition against. A client /// exception is returned if the task definition doesn't validate against the compatibilities /// specified. If no value is specified, the parameter is omitted from the response. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("RequiresCompatibilities")] public System.String[] RequiresCompatibility { get; set; } #endregion #region Parameter EphemeralStorage_SizeInGiB /// /// /// The total amount, in GiB, of ephemeral storage to set for the task. The minimum supported /// value is 21 GiB and the maximum supported value is 200 GiB. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.Int32? EphemeralStorage_SizeInGiB { get; set; } #endregion #region Parameter Tag /// /// /// The metadata that you apply to the task definition to help you categorize and organize /// them. Each tag consists of a key and an optional value. You define both of them.The following basic restrictions apply to tags: /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("Tags")] public Amazon.ECS.Model.Tag[] Tag { get; set; } #endregion #region Parameter TaskRoleArn /// /// /// The short name or full Amazon Resource Name (ARN) of the IAM role that containers /// in this task can assume. All containers in this task are granted the permissions that /// are specified in this role. For more information, see IAM /// Roles for Tasks in the Amazon Elastic Container Service Developer Guide. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] public System.String TaskRoleArn { get; set; } #endregion #region Parameter ProxyConfiguration_Type /// /// /// The proxy type. The only supported value is APPMESH. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [AWSConstantClassSource("Amazon.ECS.ProxyConfigurationType")] public Amazon.ECS.ProxyConfigurationType ProxyConfiguration_Type { get; set; } #endregion #region Parameter Volume /// /// /// A list of volume definitions in JSON format that containers in your task might use. /// /// [System.Management.Automation.Parameter(ValueFromPipelineByPropertyName = true)] [Alias("Volumes")] public Amazon.ECS.Model.Volume[] Volume { 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.ECS.Model.RegisterTaskDefinitionResponse). /// Specifying the name of a property of type Amazon.ECS.Model.RegisterTaskDefinitionResponse 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 Family parameter. /// The -PassThru parameter is deprecated, use -Select '^Family' instead. This parameter will be removed in a future version. /// [System.Obsolete("The -PassThru parameter is deprecated, use -Select '^Family' 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.Family), MyInvocation.BoundParameters); if (!ConfirmShouldProceed(this.Force.IsPresent, resourceIdentifiersText, "Register-ECSTaskDefinition (RegisterTaskDefinition)")) { 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.Family; } #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute if (this.ContainerDefinition != null) { context.ContainerDefinition = new List(this.ContainerDefinition); } #if MODULAR if (this.ContainerDefinition == null && ParameterWasBound(nameof(this.ContainerDefinition))) { WriteWarning("You are passing $null as a value for parameter ContainerDefinition 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.Cpu = this.Cpu; context.EphemeralStorage_SizeInGiB = this.EphemeralStorage_SizeInGiB; context.ExecutionRoleArn = this.ExecutionRoleArn; context.Family = this.Family; #if MODULAR if (this.Family == null && ParameterWasBound(nameof(this.Family))) { WriteWarning("You are passing $null as a value for parameter Family 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.InferenceAccelerator != null) { context.InferenceAccelerator = new List(this.InferenceAccelerator); } context.IpcMode = this.IpcMode; context.Memory = this.Memory; context.NetworkMode = this.NetworkMode; context.PidMode = this.PidMode; if (this.PlacementConstraint != null) { context.PlacementConstraint = new List(this.PlacementConstraint); } context.ProxyConfiguration_ContainerName = this.ProxyConfiguration_ContainerName; if (this.ProxyConfiguration_Property != null) { context.ProxyConfiguration_Property = new List(this.ProxyConfiguration_Property); } context.ProxyConfiguration_Type = this.ProxyConfiguration_Type; if (this.RequiresCompatibility != null) { context.RequiresCompatibility = new List(this.RequiresCompatibility); } context.RuntimePlatform_CpuArchitecture = this.RuntimePlatform_CpuArchitecture; context.RuntimePlatform_OperatingSystemFamily = this.RuntimePlatform_OperatingSystemFamily; if (this.Tag != null) { context.Tag = new List(this.Tag); } context.TaskRoleArn = this.TaskRoleArn; if (this.Volume != null) { context.Volume = new List(this.Volume); } // 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.ECS.Model.RegisterTaskDefinitionRequest(); if (cmdletContext.ContainerDefinition != null) { request.ContainerDefinitions = cmdletContext.ContainerDefinition; } if (cmdletContext.Cpu != null) { request.Cpu = cmdletContext.Cpu; } // populate EphemeralStorage var requestEphemeralStorageIsNull = true; request.EphemeralStorage = new Amazon.ECS.Model.EphemeralStorage(); System.Int32? requestEphemeralStorage_ephemeralStorage_SizeInGiB = null; if (cmdletContext.EphemeralStorage_SizeInGiB != null) { requestEphemeralStorage_ephemeralStorage_SizeInGiB = cmdletContext.EphemeralStorage_SizeInGiB.Value; } if (requestEphemeralStorage_ephemeralStorage_SizeInGiB != null) { request.EphemeralStorage.SizeInGiB = requestEphemeralStorage_ephemeralStorage_SizeInGiB.Value; requestEphemeralStorageIsNull = false; } // determine if request.EphemeralStorage should be set to null if (requestEphemeralStorageIsNull) { request.EphemeralStorage = null; } if (cmdletContext.ExecutionRoleArn != null) { request.ExecutionRoleArn = cmdletContext.ExecutionRoleArn; } if (cmdletContext.Family != null) { request.Family = cmdletContext.Family; } if (cmdletContext.InferenceAccelerator != null) { request.InferenceAccelerators = cmdletContext.InferenceAccelerator; } if (cmdletContext.IpcMode != null) { request.IpcMode = cmdletContext.IpcMode; } if (cmdletContext.Memory != null) { request.Memory = cmdletContext.Memory; } if (cmdletContext.NetworkMode != null) { request.NetworkMode = cmdletContext.NetworkMode; } if (cmdletContext.PidMode != null) { request.PidMode = cmdletContext.PidMode; } if (cmdletContext.PlacementConstraint != null) { request.PlacementConstraints = cmdletContext.PlacementConstraint; } // populate ProxyConfiguration var requestProxyConfigurationIsNull = true; request.ProxyConfiguration = new Amazon.ECS.Model.ProxyConfiguration(); System.String requestProxyConfiguration_proxyConfiguration_ContainerName = null; if (cmdletContext.ProxyConfiguration_ContainerName != null) { requestProxyConfiguration_proxyConfiguration_ContainerName = cmdletContext.ProxyConfiguration_ContainerName; } if (requestProxyConfiguration_proxyConfiguration_ContainerName != null) { request.ProxyConfiguration.ContainerName = requestProxyConfiguration_proxyConfiguration_ContainerName; requestProxyConfigurationIsNull = false; } List requestProxyConfiguration_proxyConfiguration_Property = null; if (cmdletContext.ProxyConfiguration_Property != null) { requestProxyConfiguration_proxyConfiguration_Property = cmdletContext.ProxyConfiguration_Property; } if (requestProxyConfiguration_proxyConfiguration_Property != null) { request.ProxyConfiguration.Properties = requestProxyConfiguration_proxyConfiguration_Property; requestProxyConfigurationIsNull = false; } Amazon.ECS.ProxyConfigurationType requestProxyConfiguration_proxyConfiguration_Type = null; if (cmdletContext.ProxyConfiguration_Type != null) { requestProxyConfiguration_proxyConfiguration_Type = cmdletContext.ProxyConfiguration_Type; } if (requestProxyConfiguration_proxyConfiguration_Type != null) { request.ProxyConfiguration.Type = requestProxyConfiguration_proxyConfiguration_Type; requestProxyConfigurationIsNull = false; } // determine if request.ProxyConfiguration should be set to null if (requestProxyConfigurationIsNull) { request.ProxyConfiguration = null; } if (cmdletContext.RequiresCompatibility != null) { request.RequiresCompatibilities = cmdletContext.RequiresCompatibility; } // populate RuntimePlatform var requestRuntimePlatformIsNull = true; request.RuntimePlatform = new Amazon.ECS.Model.RuntimePlatform(); Amazon.ECS.CPUArchitecture requestRuntimePlatform_runtimePlatform_CpuArchitecture = null; if (cmdletContext.RuntimePlatform_CpuArchitecture != null) { requestRuntimePlatform_runtimePlatform_CpuArchitecture = cmdletContext.RuntimePlatform_CpuArchitecture; } if (requestRuntimePlatform_runtimePlatform_CpuArchitecture != null) { request.RuntimePlatform.CpuArchitecture = requestRuntimePlatform_runtimePlatform_CpuArchitecture; requestRuntimePlatformIsNull = false; } Amazon.ECS.OSFamily requestRuntimePlatform_runtimePlatform_OperatingSystemFamily = null; if (cmdletContext.RuntimePlatform_OperatingSystemFamily != null) { requestRuntimePlatform_runtimePlatform_OperatingSystemFamily = cmdletContext.RuntimePlatform_OperatingSystemFamily; } if (requestRuntimePlatform_runtimePlatform_OperatingSystemFamily != null) { request.RuntimePlatform.OperatingSystemFamily = requestRuntimePlatform_runtimePlatform_OperatingSystemFamily; requestRuntimePlatformIsNull = false; } // determine if request.RuntimePlatform should be set to null if (requestRuntimePlatformIsNull) { request.RuntimePlatform = null; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.TaskRoleArn != null) { request.TaskRoleArn = cmdletContext.TaskRoleArn; } if (cmdletContext.Volume != null) { request.Volumes = cmdletContext.Volume; } 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.ECS.Model.RegisterTaskDefinitionResponse CallAWSServiceOperation(IAmazonECS client, Amazon.ECS.Model.RegisterTaskDefinitionRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon EC2 Container Service", "RegisterTaskDefinition"); try { #if DESKTOP return client.RegisterTaskDefinition(request); #elif CORECLR return client.RegisterTaskDefinitionAsync(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 List ContainerDefinition { get; set; } public System.String Cpu { get; set; } public System.Int32? EphemeralStorage_SizeInGiB { get; set; } public System.String ExecutionRoleArn { get; set; } public System.String Family { get; set; } public List InferenceAccelerator { get; set; } public Amazon.ECS.IpcMode IpcMode { get; set; } public System.String Memory { get; set; } public Amazon.ECS.NetworkMode NetworkMode { get; set; } public Amazon.ECS.PidMode PidMode { get; set; } public List PlacementConstraint { get; set; } public System.String ProxyConfiguration_ContainerName { get; set; } public List ProxyConfiguration_Property { get; set; } public Amazon.ECS.ProxyConfigurationType ProxyConfiguration_Type { get; set; } public List RequiresCompatibility { get; set; } public Amazon.ECS.CPUArchitecture RuntimePlatform_CpuArchitecture { get; set; } public Amazon.ECS.OSFamily RuntimePlatform_OperatingSystemFamily { get; set; } public List Tag { get; set; } public System.String TaskRoleArn { get; set; } public List Volume { get; set; } public System.Func Select { get; set; } = (response, cmdlet) => response; } } }