public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ECS.Model.CreateTaskSetRequest(); if (cmdletContext.CapacityProviderStrategy != null) { request.CapacityProviderStrategy = cmdletContext.CapacityProviderStrategy; } if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } if (cmdletContext.Cluster != null) { request.Cluster = cmdletContext.Cluster; } if (cmdletContext.ExternalId != null) { request.ExternalId = cmdletContext.ExternalId; } if (cmdletContext.LaunchType != null) { request.LaunchType = cmdletContext.LaunchType; } if (cmdletContext.LoadBalancer != null) { request.LoadBalancers = cmdletContext.LoadBalancer; } // populate NetworkConfiguration var requestNetworkConfigurationIsNull = true; request.NetworkConfiguration = new Amazon.ECS.Model.NetworkConfiguration(); Amazon.ECS.Model.AwsVpcConfiguration requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration = null; // populate AwsvpcConfiguration var requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = true; requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration = new Amazon.ECS.Model.AwsVpcConfiguration(); Amazon.ECS.AssignPublicIp requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp = null; if (cmdletContext.AwsvpcConfiguration_AssignPublicIp != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp = cmdletContext.AwsvpcConfiguration_AssignPublicIp; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration.AssignPublicIp = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp; requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = false; } List <System.String> requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup = null; if (cmdletContext.AwsvpcConfiguration_SecurityGroup != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup = cmdletContext.AwsvpcConfiguration_SecurityGroup; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration.SecurityGroups = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup; requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = false; } List <System.String> requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet = null; if (cmdletContext.AwsvpcConfiguration_Subnet != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet = cmdletContext.AwsvpcConfiguration_Subnet; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration.Subnets = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet; requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = false; } // determine if requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration should be set to null if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration = null; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration != null) { request.NetworkConfiguration.AwsvpcConfiguration = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration; requestNetworkConfigurationIsNull = false; } // determine if request.NetworkConfiguration should be set to null if (requestNetworkConfigurationIsNull) { request.NetworkConfiguration = null; } if (cmdletContext.PlatformVersion != null) { request.PlatformVersion = cmdletContext.PlatformVersion; } // populate Scale var requestScaleIsNull = true; request.Scale = new Amazon.ECS.Model.Scale(); Amazon.ECS.ScaleUnit requestScale_scale_Unit = null; if (cmdletContext.Scale_Unit != null) { requestScale_scale_Unit = cmdletContext.Scale_Unit; } if (requestScale_scale_Unit != null) { request.Scale.Unit = requestScale_scale_Unit; requestScaleIsNull = false; } System.Double?requestScale_scale_Value = null; if (cmdletContext.Scale_Value != null) { requestScale_scale_Value = cmdletContext.Scale_Value.Value; } if (requestScale_scale_Value != null) { request.Scale.Value = requestScale_scale_Value.Value; requestScaleIsNull = false; } // determine if request.Scale should be set to null if (requestScaleIsNull) { request.Scale = null; } if (cmdletContext.Service != null) { request.Service = cmdletContext.Service; } if (cmdletContext.ServiceRegistry != null) { request.ServiceRegistries = cmdletContext.ServiceRegistry; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.TaskDefinition != null) { request.TaskDefinition = cmdletContext.TaskDefinition; } 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 object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ECS.Model.RunTaskRequest(); if (cmdletContext.CapacityProviderStrategy != null) { request.CapacityProviderStrategy = cmdletContext.CapacityProviderStrategy; } if (cmdletContext.Cluster != null) { request.Cluster = cmdletContext.Cluster; } if (cmdletContext.Count != null) { request.Count = cmdletContext.Count.Value; } if (cmdletContext.EnableECSManagedTag != null) { request.EnableECSManagedTags = cmdletContext.EnableECSManagedTag.Value; } if (cmdletContext.EnableExecuteCommand != null) { request.EnableExecuteCommand = cmdletContext.EnableExecuteCommand.Value; } if (cmdletContext.Group != null) { request.Group = cmdletContext.Group; } if (cmdletContext.LaunchType != null) { request.LaunchType = cmdletContext.LaunchType; } // populate NetworkConfiguration var requestNetworkConfigurationIsNull = true; request.NetworkConfiguration = new Amazon.ECS.Model.NetworkConfiguration(); Amazon.ECS.Model.AwsVpcConfiguration requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration = null; // populate AwsvpcConfiguration var requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = true; requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration = new Amazon.ECS.Model.AwsVpcConfiguration(); Amazon.ECS.AssignPublicIp requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp = null; if (cmdletContext.AwsvpcConfiguration_AssignPublicIp != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp = cmdletContext.AwsvpcConfiguration_AssignPublicIp; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration.AssignPublicIp = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp; requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = false; } List <System.String> requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup = null; if (cmdletContext.AwsvpcConfiguration_SecurityGroup != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup = cmdletContext.AwsvpcConfiguration_SecurityGroup; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration.SecurityGroups = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup; requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = false; } List <System.String> requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet = null; if (cmdletContext.AwsvpcConfiguration_Subnet != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet = cmdletContext.AwsvpcConfiguration_Subnet; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration.Subnets = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet; requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = false; } // determine if requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration should be set to null if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration = null; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration != null) { request.NetworkConfiguration.AwsvpcConfiguration = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration; requestNetworkConfigurationIsNull = false; } // determine if request.NetworkConfiguration should be set to null if (requestNetworkConfigurationIsNull) { request.NetworkConfiguration = null; } // populate Overrides var requestOverridesIsNull = true; request.Overrides = new Amazon.ECS.Model.TaskOverride(); List <Amazon.ECS.Model.ContainerOverride> requestOverrides_overrides_ContainerOverride = null; if (cmdletContext.Overrides_ContainerOverride != null) { requestOverrides_overrides_ContainerOverride = cmdletContext.Overrides_ContainerOverride; } if (requestOverrides_overrides_ContainerOverride != null) { request.Overrides.ContainerOverrides = requestOverrides_overrides_ContainerOverride; requestOverridesIsNull = false; } System.String requestOverrides_overrides_Cpu = null; if (cmdletContext.Overrides_Cpu != null) { requestOverrides_overrides_Cpu = cmdletContext.Overrides_Cpu; } if (requestOverrides_overrides_Cpu != null) { request.Overrides.Cpu = requestOverrides_overrides_Cpu; requestOverridesIsNull = false; } System.String requestOverrides_overrides_ExecutionRoleArn = null; if (cmdletContext.Overrides_ExecutionRoleArn != null) { requestOverrides_overrides_ExecutionRoleArn = cmdletContext.Overrides_ExecutionRoleArn; } if (requestOverrides_overrides_ExecutionRoleArn != null) { request.Overrides.ExecutionRoleArn = requestOverrides_overrides_ExecutionRoleArn; requestOverridesIsNull = false; } List <Amazon.ECS.Model.InferenceAcceleratorOverride> requestOverrides_overrides_InferenceAcceleratorOverride = null; if (cmdletContext.Overrides_InferenceAcceleratorOverride != null) { requestOverrides_overrides_InferenceAcceleratorOverride = cmdletContext.Overrides_InferenceAcceleratorOverride; } if (requestOverrides_overrides_InferenceAcceleratorOverride != null) { request.Overrides.InferenceAcceleratorOverrides = requestOverrides_overrides_InferenceAcceleratorOverride; requestOverridesIsNull = false; } System.String requestOverrides_overrides_Memory = null; if (cmdletContext.Overrides_Memory != null) { requestOverrides_overrides_Memory = cmdletContext.Overrides_Memory; } if (requestOverrides_overrides_Memory != null) { request.Overrides.Memory = requestOverrides_overrides_Memory; requestOverridesIsNull = false; } System.String requestOverrides_overrides_TaskRoleArn = null; if (cmdletContext.Overrides_TaskRoleArn != null) { requestOverrides_overrides_TaskRoleArn = cmdletContext.Overrides_TaskRoleArn; } if (requestOverrides_overrides_TaskRoleArn != null) { request.Overrides.TaskRoleArn = requestOverrides_overrides_TaskRoleArn; requestOverridesIsNull = false; } Amazon.ECS.Model.EphemeralStorage requestOverrides_overrides_EphemeralStorage = null; // populate EphemeralStorage var requestOverrides_overrides_EphemeralStorageIsNull = true; requestOverrides_overrides_EphemeralStorage = new Amazon.ECS.Model.EphemeralStorage(); System.Int32?requestOverrides_overrides_EphemeralStorage_ephemeralStorage_SizeInGiB = null; if (cmdletContext.EphemeralStorage_SizeInGiB != null) { requestOverrides_overrides_EphemeralStorage_ephemeralStorage_SizeInGiB = cmdletContext.EphemeralStorage_SizeInGiB.Value; } if (requestOverrides_overrides_EphemeralStorage_ephemeralStorage_SizeInGiB != null) { requestOverrides_overrides_EphemeralStorage.SizeInGiB = requestOverrides_overrides_EphemeralStorage_ephemeralStorage_SizeInGiB.Value; requestOverrides_overrides_EphemeralStorageIsNull = false; } // determine if requestOverrides_overrides_EphemeralStorage should be set to null if (requestOverrides_overrides_EphemeralStorageIsNull) { requestOverrides_overrides_EphemeralStorage = null; } if (requestOverrides_overrides_EphemeralStorage != null) { request.Overrides.EphemeralStorage = requestOverrides_overrides_EphemeralStorage; requestOverridesIsNull = false; } // determine if request.Overrides should be set to null if (requestOverridesIsNull) { request.Overrides = null; } if (cmdletContext.PlacementConstraint != null) { request.PlacementConstraints = cmdletContext.PlacementConstraint; } if (cmdletContext.PlacementStrategy != null) { request.PlacementStrategy = cmdletContext.PlacementStrategy; } if (cmdletContext.PlatformVersion != null) { request.PlatformVersion = cmdletContext.PlatformVersion; } if (cmdletContext.PropagateTag != null) { request.PropagateTags = cmdletContext.PropagateTag; } if (cmdletContext.ReferenceId != null) { request.ReferenceId = cmdletContext.ReferenceId; } if (cmdletContext.StartedBy != null) { request.StartedBy = cmdletContext.StartedBy; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.TaskDefinition != null) { request.TaskDefinition = cmdletContext.TaskDefinition; } 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 object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ECS.Model.UpdateServiceRequest(); if (cmdletContext.CapacityProviderStrategy != null) { request.CapacityProviderStrategy = cmdletContext.CapacityProviderStrategy; } if (cmdletContext.Cluster != null) { request.Cluster = cmdletContext.Cluster; } // populate DeploymentConfiguration var requestDeploymentConfigurationIsNull = true; request.DeploymentConfiguration = new Amazon.ECS.Model.DeploymentConfiguration(); System.Int32?requestDeploymentConfiguration_deploymentConfiguration_MaximumPercent = null; if (cmdletContext.DeploymentConfiguration_MaximumPercent != null) { requestDeploymentConfiguration_deploymentConfiguration_MaximumPercent = cmdletContext.DeploymentConfiguration_MaximumPercent.Value; } if (requestDeploymentConfiguration_deploymentConfiguration_MaximumPercent != null) { request.DeploymentConfiguration.MaximumPercent = requestDeploymentConfiguration_deploymentConfiguration_MaximumPercent.Value; requestDeploymentConfigurationIsNull = false; } System.Int32?requestDeploymentConfiguration_deploymentConfiguration_MinimumHealthyPercent = null; if (cmdletContext.DeploymentConfiguration_MinimumHealthyPercent != null) { requestDeploymentConfiguration_deploymentConfiguration_MinimumHealthyPercent = cmdletContext.DeploymentConfiguration_MinimumHealthyPercent.Value; } if (requestDeploymentConfiguration_deploymentConfiguration_MinimumHealthyPercent != null) { request.DeploymentConfiguration.MinimumHealthyPercent = requestDeploymentConfiguration_deploymentConfiguration_MinimumHealthyPercent.Value; requestDeploymentConfigurationIsNull = false; } // determine if request.DeploymentConfiguration should be set to null if (requestDeploymentConfigurationIsNull) { request.DeploymentConfiguration = null; } if (cmdletContext.DesiredCount != null) { request.DesiredCount = cmdletContext.DesiredCount.Value; } if (cmdletContext.ForceNewDeployment != null) { request.ForceNewDeployment = cmdletContext.ForceNewDeployment.Value; } if (cmdletContext.HealthCheckGracePeriodSecond != null) { request.HealthCheckGracePeriodSeconds = cmdletContext.HealthCheckGracePeriodSecond.Value; } // populate NetworkConfiguration var requestNetworkConfigurationIsNull = true; request.NetworkConfiguration = new Amazon.ECS.Model.NetworkConfiguration(); Amazon.ECS.Model.AwsVpcConfiguration requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration = null; // populate AwsvpcConfiguration var requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = true; requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration = new Amazon.ECS.Model.AwsVpcConfiguration(); Amazon.ECS.AssignPublicIp requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp = null; if (cmdletContext.AwsvpcConfiguration_AssignPublicIp != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp = cmdletContext.AwsvpcConfiguration_AssignPublicIp; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration.AssignPublicIp = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_AssignPublicIp; requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = false; } List <System.String> requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup = null; if (cmdletContext.AwsvpcConfiguration_SecurityGroup != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup = cmdletContext.AwsvpcConfiguration_SecurityGroup; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration.SecurityGroups = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_SecurityGroup; requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = false; } List <System.String> requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet = null; if (cmdletContext.AwsvpcConfiguration_Subnet != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet = cmdletContext.AwsvpcConfiguration_Subnet; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet != null) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration.Subnets = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration_awsvpcConfiguration_Subnet; requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull = false; } // determine if requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration should be set to null if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfigurationIsNull) { requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration = null; } if (requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration != null) { request.NetworkConfiguration.AwsvpcConfiguration = requestNetworkConfiguration_networkConfiguration_AwsvpcConfiguration; requestNetworkConfigurationIsNull = false; } // determine if request.NetworkConfiguration should be set to null if (requestNetworkConfigurationIsNull) { request.NetworkConfiguration = null; } if (cmdletContext.PlatformVersion != null) { request.PlatformVersion = cmdletContext.PlatformVersion; } if (cmdletContext.Service != null) { request.Service = cmdletContext.Service; } if (cmdletContext.TaskDefinition != null) { request.TaskDefinition = cmdletContext.TaskDefinition; } 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); }