private Amazon.ElasticLoadBalancingV2.Model.CreateTargetGroupResponse CallAWSServiceOperation(IAmazonElasticLoadBalancingV2 client, Amazon.ElasticLoadBalancingV2.Model.CreateTargetGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Elastic Load Balancing V2", "CreateTargetGroup"); try { #if DESKTOP return(client.CreateTargetGroup(request)); #elif CORECLR return(client.CreateTargetGroupAsync(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.ElasticLoadBalancingV2.Model.CreateTargetGroupRequest(); if (cmdletContext.HealthCheckEnabled != null) { request.HealthCheckEnabled = cmdletContext.HealthCheckEnabled.Value; } if (cmdletContext.HealthCheckIntervalSecond != null) { request.HealthCheckIntervalSeconds = cmdletContext.HealthCheckIntervalSecond.Value; } if (cmdletContext.HealthCheckPath != null) { request.HealthCheckPath = cmdletContext.HealthCheckPath; } if (cmdletContext.HealthCheckPort != null) { request.HealthCheckPort = cmdletContext.HealthCheckPort; } if (cmdletContext.HealthCheckProtocol != null) { request.HealthCheckProtocol = cmdletContext.HealthCheckProtocol; } if (cmdletContext.HealthCheckTimeoutSecond != null) { request.HealthCheckTimeoutSeconds = cmdletContext.HealthCheckTimeoutSecond.Value; } if (cmdletContext.HealthyThresholdCount != null) { request.HealthyThresholdCount = cmdletContext.HealthyThresholdCount.Value; } // populate Matcher var requestMatcherIsNull = true; request.Matcher = new Amazon.ElasticLoadBalancingV2.Model.Matcher(); System.String requestMatcher_matcher_HttpCode = null; if (cmdletContext.Matcher_HttpCode != null) { requestMatcher_matcher_HttpCode = cmdletContext.Matcher_HttpCode; } if (requestMatcher_matcher_HttpCode != null) { request.Matcher.HttpCode = requestMatcher_matcher_HttpCode; requestMatcherIsNull = false; } // determine if request.Matcher should be set to null if (requestMatcherIsNull) { request.Matcher = null; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.Port != null) { request.Port = cmdletContext.Port.Value; } if (cmdletContext.Protocol != null) { request.Protocol = cmdletContext.Protocol; } if (cmdletContext.TargetType != null) { request.TargetType = cmdletContext.TargetType; } if (cmdletContext.UnhealthyThresholdCount != null) { request.UnhealthyThresholdCount = cmdletContext.UnhealthyThresholdCount.Value; } if (cmdletContext.VpcId != null) { request.VpcId = cmdletContext.VpcId; } 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); }
/// <summary> /// Creates a target group. /// /// /// <para> /// To register targets with the target group, use <a>RegisterTargets</a>. To update the /// health check settings for the target group, use <a>ModifyTargetGroup</a>. To monitor /// the health of targets in the target group, use <a>DescribeTargetHealth</a>. /// </para> /// /// <para> /// To route traffic to the targets in a target group, specify the target group in an /// action using <a>CreateListener</a> or <a>CreateRule</a>. /// </para> /// /// <para> /// To delete a target group, use <a>DeleteTargetGroup</a>. /// </para> /// /// <para> /// For more information, see <a href="http://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html">Target /// Groups for Your Application Load Balancers</a> in the <i>Application Load Balancers /// Guide</i>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the CreateTargetGroup service method.</param> /// /// <returns>The response from the CreateTargetGroup service method, as returned by ElasticLoadBalancingV2.</returns> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.DuplicateTargetGroupNameException"> /// A target group with the specified name already exists. /// </exception> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.TooManyTargetGroupsException"> /// You've reached the limit on the number of target groups for your AWS account. /// </exception> public CreateTargetGroupResponse CreateTargetGroup(CreateTargetGroupRequest request) { var marshaller = new CreateTargetGroupRequestMarshaller(); var unmarshaller = CreateTargetGroupResponseUnmarshaller.Instance; return Invoke<CreateTargetGroupRequest,CreateTargetGroupResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the CreateTargetGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateTargetGroup 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<CreateTargetGroupResponse> CreateTargetGroupAsync(CreateTargetGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new CreateTargetGroupRequestMarshaller(); var unmarshaller = CreateTargetGroupResponseUnmarshaller.Instance; return InvokeAsync<CreateTargetGroupRequest,CreateTargetGroupResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the CreateTargetGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the CreateTargetGroup operation on AmazonElasticLoadBalancingV2Client.</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 EndCreateTargetGroup /// operation.</returns> public IAsyncResult BeginCreateTargetGroup(CreateTargetGroupRequest request, AsyncCallback callback, object state) { var marshaller = new CreateTargetGroupRequestMarshaller(); var unmarshaller = CreateTargetGroupResponseUnmarshaller.Instance; return BeginInvoke<CreateTargetGroupRequest>(request, marshaller, unmarshaller, callback, state); }