private Amazon.Lightsail.Model.CreateContainerServiceDeploymentResponse CallAWSServiceOperation(IAmazonLightsail client, Amazon.Lightsail.Model.CreateContainerServiceDeploymentRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Lightsail", "CreateContainerServiceDeployment");
     try
     {
         #if DESKTOP
         return(client.CreateContainerServiceDeployment(request));
         #elif CORECLR
         return(client.CreateContainerServiceDeploymentAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Lightsail.Model.CreateContainerServiceDeploymentRequest();

            if (cmdletContext.Container != null)
            {
                request.Containers = cmdletContext.Container;
            }

            // populate PublicEndpoint
            var requestPublicEndpointIsNull = true;

            request.PublicEndpoint = new Amazon.Lightsail.Model.EndpointRequest();
            System.String requestPublicEndpoint_publicEndpoint_ContainerName = null;
            if (cmdletContext.PublicEndpoint_ContainerName != null)
            {
                requestPublicEndpoint_publicEndpoint_ContainerName = cmdletContext.PublicEndpoint_ContainerName;
            }
            if (requestPublicEndpoint_publicEndpoint_ContainerName != null)
            {
                request.PublicEndpoint.ContainerName = requestPublicEndpoint_publicEndpoint_ContainerName;
                requestPublicEndpointIsNull          = false;
            }
            System.Int32?requestPublicEndpoint_publicEndpoint_ContainerPort = null;
            if (cmdletContext.PublicEndpoint_ContainerPort != null)
            {
                requestPublicEndpoint_publicEndpoint_ContainerPort = cmdletContext.PublicEndpoint_ContainerPort.Value;
            }
            if (requestPublicEndpoint_publicEndpoint_ContainerPort != null)
            {
                request.PublicEndpoint.ContainerPort = requestPublicEndpoint_publicEndpoint_ContainerPort.Value;
                requestPublicEndpointIsNull          = false;
            }
            Amazon.Lightsail.Model.ContainerServiceHealthCheckConfig requestPublicEndpoint_publicEndpoint_HealthCheck = null;

            // populate HealthCheck
            var requestPublicEndpoint_publicEndpoint_HealthCheckIsNull = true;

            requestPublicEndpoint_publicEndpoint_HealthCheck = new Amazon.Lightsail.Model.ContainerServiceHealthCheckConfig();
            System.Int32?requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_HealthyThreshold = null;
            if (cmdletContext.HealthCheck_HealthyThreshold != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_HealthyThreshold = cmdletContext.HealthCheck_HealthyThreshold.Value;
            }
            if (requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_HealthyThreshold != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck.HealthyThreshold = requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_HealthyThreshold.Value;
                requestPublicEndpoint_publicEndpoint_HealthCheckIsNull            = false;
            }
            System.Int32?requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_IntervalSecond = null;
            if (cmdletContext.HealthCheck_IntervalSecond != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_IntervalSecond = cmdletContext.HealthCheck_IntervalSecond.Value;
            }
            if (requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_IntervalSecond != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck.IntervalSeconds = requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_IntervalSecond.Value;
                requestPublicEndpoint_publicEndpoint_HealthCheckIsNull           = false;
            }
            System.String requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_Path = null;
            if (cmdletContext.HealthCheck_Path != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_Path = cmdletContext.HealthCheck_Path;
            }
            if (requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_Path != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck.Path  = requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_Path;
                requestPublicEndpoint_publicEndpoint_HealthCheckIsNull = false;
            }
            System.String requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_SuccessCode = null;
            if (cmdletContext.HealthCheck_SuccessCode != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_SuccessCode = cmdletContext.HealthCheck_SuccessCode;
            }
            if (requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_SuccessCode != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck.SuccessCodes = requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_SuccessCode;
                requestPublicEndpoint_publicEndpoint_HealthCheckIsNull        = false;
            }
            System.Int32?requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_TimeoutSecond = null;
            if (cmdletContext.HealthCheck_TimeoutSecond != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_TimeoutSecond = cmdletContext.HealthCheck_TimeoutSecond.Value;
            }
            if (requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_TimeoutSecond != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck.TimeoutSeconds = requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_TimeoutSecond.Value;
                requestPublicEndpoint_publicEndpoint_HealthCheckIsNull          = false;
            }
            System.Int32?requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_UnhealthyThreshold = null;
            if (cmdletContext.HealthCheck_UnhealthyThreshold != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_UnhealthyThreshold = cmdletContext.HealthCheck_UnhealthyThreshold.Value;
            }
            if (requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_UnhealthyThreshold != null)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck.UnhealthyThreshold = requestPublicEndpoint_publicEndpoint_HealthCheck_healthCheck_UnhealthyThreshold.Value;
                requestPublicEndpoint_publicEndpoint_HealthCheckIsNull = false;
            }
            // determine if requestPublicEndpoint_publicEndpoint_HealthCheck should be set to null
            if (requestPublicEndpoint_publicEndpoint_HealthCheckIsNull)
            {
                requestPublicEndpoint_publicEndpoint_HealthCheck = null;
            }
            if (requestPublicEndpoint_publicEndpoint_HealthCheck != null)
            {
                request.PublicEndpoint.HealthCheck = requestPublicEndpoint_publicEndpoint_HealthCheck;
                requestPublicEndpointIsNull        = false;
            }
            // determine if request.PublicEndpoint should be set to null
            if (requestPublicEndpointIsNull)
            {
                request.PublicEndpoint = null;
            }
            if (cmdletContext.ServiceName != null)
            {
                request.ServiceName = cmdletContext.ServiceName;
            }

            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);
        }