/// <summary> /// Initiates the asynchronous execution of the CreateDeploymentConfig operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDeploymentConfig operation on AmazonCodeDeployClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateDeploymentConfig /// operation.</returns> public IAsyncResult BeginCreateDeploymentConfig(CreateDeploymentConfigRequest request, AsyncCallback callback, object state) { var marshaller = new CreateDeploymentConfigRequestMarshaller(); var unmarshaller = CreateDeploymentConfigResponseUnmarshaller.Instance; return BeginInvoke<CreateDeploymentConfigRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Creates a new deployment configuration. /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateDeploymentConfig service method.</param> /// /// <returns>The response from the CreateDeploymentConfig service method, as returned by CodeDeploy.</returns> /// <exception cref="Amazon.CodeDeploy.Model.DeploymentConfigAlreadyExistsException"> /// A deployment configuration with the specified name already exists with the applicable /// IAM user or AWS account. /// </exception> /// <exception cref="Amazon.CodeDeploy.Model.DeploymentConfigLimitExceededException"> /// The deployment configurations limit was exceeded. /// </exception> /// <exception cref="Amazon.CodeDeploy.Model.DeploymentConfigNameRequiredException"> /// The deployment configuration name was not specified. /// </exception> /// <exception cref="Amazon.CodeDeploy.Model.InvalidDeploymentConfigNameException"> /// The deployment configuration name was specified in an invalid format. /// </exception> /// <exception cref="Amazon.CodeDeploy.Model.InvalidMinimumHealthyHostValueException"> /// The minimum healthy instances value was specified in an invalid format. /// </exception> public CreateDeploymentConfigResponse CreateDeploymentConfig(CreateDeploymentConfigRequest request) { var marshaller = new CreateDeploymentConfigRequestMarshaller(); var unmarshaller = CreateDeploymentConfigResponseUnmarshaller.Instance; return Invoke<CreateDeploymentConfigRequest,CreateDeploymentConfigResponse>(request, marshaller, unmarshaller); }
private Amazon.CodeDeploy.Model.CreateDeploymentConfigResponse CallAWSServiceOperation(IAmazonCodeDeploy client, Amazon.CodeDeploy.Model.CreateDeploymentConfigRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS CodeDeploy", "CreateDeploymentConfig"); try { #if DESKTOP return(client.CreateDeploymentConfig(request)); #elif CORECLR return(client.CreateDeploymentConfigAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
/// <summary> /// Initiates the asynchronous execution of the CreateDeploymentConfig operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateDeploymentConfig operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task<CreateDeploymentConfigResponse> CreateDeploymentConfigAsync(CreateDeploymentConfigRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateDeploymentConfigRequestMarshaller(); var unmarshaller = CreateDeploymentConfigResponseUnmarshaller.Instance; return InvokeAsync<CreateDeploymentConfigRequest,CreateDeploymentConfigResponse>(request, marshaller, unmarshaller, cancellationToken); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.CodeDeploy.Model.CreateDeploymentConfigRequest(); if (cmdletContext.ComputePlatform != null) { request.ComputePlatform = cmdletContext.ComputePlatform; } if (cmdletContext.DeploymentConfigName != null) { request.DeploymentConfigName = cmdletContext.DeploymentConfigName; } // populate MinimumHealthyHosts var requestMinimumHealthyHostsIsNull = true; request.MinimumHealthyHosts = new Amazon.CodeDeploy.Model.MinimumHealthyHosts(); Amazon.CodeDeploy.MinimumHealthyHostsType requestMinimumHealthyHosts_minimumHealthyHosts_Type = null; if (cmdletContext.MinimumHealthyHosts_Type != null) { requestMinimumHealthyHosts_minimumHealthyHosts_Type = cmdletContext.MinimumHealthyHosts_Type; } if (requestMinimumHealthyHosts_minimumHealthyHosts_Type != null) { request.MinimumHealthyHosts.Type = requestMinimumHealthyHosts_minimumHealthyHosts_Type; requestMinimumHealthyHostsIsNull = false; } System.Int32?requestMinimumHealthyHosts_minimumHealthyHosts_Value = null; if (cmdletContext.MinimumHealthyHosts_Value != null) { requestMinimumHealthyHosts_minimumHealthyHosts_Value = cmdletContext.MinimumHealthyHosts_Value.Value; } if (requestMinimumHealthyHosts_minimumHealthyHosts_Value != null) { request.MinimumHealthyHosts.Value = requestMinimumHealthyHosts_minimumHealthyHosts_Value.Value; requestMinimumHealthyHostsIsNull = false; } // determine if request.MinimumHealthyHosts should be set to null if (requestMinimumHealthyHostsIsNull) { request.MinimumHealthyHosts = null; } // populate TrafficRoutingConfig var requestTrafficRoutingConfigIsNull = true; request.TrafficRoutingConfig = new Amazon.CodeDeploy.Model.TrafficRoutingConfig(); Amazon.CodeDeploy.TrafficRoutingType requestTrafficRoutingConfig_trafficRoutingConfig_Type = null; if (cmdletContext.TrafficRoutingConfig_Type != null) { requestTrafficRoutingConfig_trafficRoutingConfig_Type = cmdletContext.TrafficRoutingConfig_Type; } if (requestTrafficRoutingConfig_trafficRoutingConfig_Type != null) { request.TrafficRoutingConfig.Type = requestTrafficRoutingConfig_trafficRoutingConfig_Type; requestTrafficRoutingConfigIsNull = false; } Amazon.CodeDeploy.Model.TimeBasedCanary requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary = null; // populate TimeBasedCanary var requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanaryIsNull = true; requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary = new Amazon.CodeDeploy.Model.TimeBasedCanary(); System.Int32?requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary_timeBasedCanary_CanaryInterval = null; if (cmdletContext.TimeBasedCanary_CanaryInterval != null) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary_timeBasedCanary_CanaryInterval = cmdletContext.TimeBasedCanary_CanaryInterval.Value; } if (requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary_timeBasedCanary_CanaryInterval != null) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary.CanaryInterval = requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary_timeBasedCanary_CanaryInterval.Value; requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanaryIsNull = false; } System.Int32?requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary_timeBasedCanary_CanaryPercentage = null; if (cmdletContext.TimeBasedCanary_CanaryPercentage != null) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary_timeBasedCanary_CanaryPercentage = cmdletContext.TimeBasedCanary_CanaryPercentage.Value; } if (requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary_timeBasedCanary_CanaryPercentage != null) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary.CanaryPercentage = requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary_timeBasedCanary_CanaryPercentage.Value; requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanaryIsNull = false; } // determine if requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary should be set to null if (requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanaryIsNull) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary = null; } if (requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary != null) { request.TrafficRoutingConfig.TimeBasedCanary = requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedCanary; requestTrafficRoutingConfigIsNull = false; } Amazon.CodeDeploy.Model.TimeBasedLinear requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear = null; // populate TimeBasedLinear var requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinearIsNull = true; requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear = new Amazon.CodeDeploy.Model.TimeBasedLinear(); System.Int32?requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear_timeBasedLinear_LinearInterval = null; if (cmdletContext.TimeBasedLinear_LinearInterval != null) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear_timeBasedLinear_LinearInterval = cmdletContext.TimeBasedLinear_LinearInterval.Value; } if (requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear_timeBasedLinear_LinearInterval != null) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear.LinearInterval = requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear_timeBasedLinear_LinearInterval.Value; requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinearIsNull = false; } System.Int32?requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear_timeBasedLinear_LinearPercentage = null; if (cmdletContext.TimeBasedLinear_LinearPercentage != null) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear_timeBasedLinear_LinearPercentage = cmdletContext.TimeBasedLinear_LinearPercentage.Value; } if (requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear_timeBasedLinear_LinearPercentage != null) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear.LinearPercentage = requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear_timeBasedLinear_LinearPercentage.Value; requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinearIsNull = false; } // determine if requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear should be set to null if (requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinearIsNull) { requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear = null; } if (requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear != null) { request.TrafficRoutingConfig.TimeBasedLinear = requestTrafficRoutingConfig_trafficRoutingConfig_TimeBasedLinear; requestTrafficRoutingConfigIsNull = false; } // determine if request.TrafficRoutingConfig should be set to null if (requestTrafficRoutingConfigIsNull) { request.TrafficRoutingConfig = null; } 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); }