To monitor the health of the targets, use DescribeTargetHealth.
private Amazon.ElasticLoadBalancingV2.Model.ModifyTargetGroupResponse CallAWSServiceOperation(IAmazonElasticLoadBalancingV2 client, Amazon.ElasticLoadBalancingV2.Model.ModifyTargetGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Elastic Load Balancing V2", "ModifyTargetGroup"); try { #if DESKTOP return(client.ModifyTargetGroup(request)); #elif CORECLR return(client.ModifyTargetGroupAsync(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.ModifyTargetGroupRequest(); 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.TargetGroupArn != null) { request.TargetGroupArn = cmdletContext.TargetGroupArn; } if (cmdletContext.UnhealthyThresholdCount != null) { request.UnhealthyThresholdCount = cmdletContext.UnhealthyThresholdCount.Value; } 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> /// Modifies the health checks used when evaluating the health state of the targets in /// the specified target group. /// /// /// <para> /// To monitor the health of the targets, use <a>DescribeTargetHealth</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the ModifyTargetGroup service method.</param> /// /// <returns>The response from the ModifyTargetGroup service method, as returned by ElasticLoadBalancingV2.</returns> /// <exception cref="Amazon.ElasticLoadBalancingV2.Model.TargetGroupNotFoundException"> /// The specified target group does not exist. /// </exception> public ModifyTargetGroupResponse ModifyTargetGroup(ModifyTargetGroupRequest request) { var marshaller = new ModifyTargetGroupRequestMarshaller(); var unmarshaller = ModifyTargetGroupResponseUnmarshaller.Instance; return Invoke<ModifyTargetGroupRequest,ModifyTargetGroupResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the ModifyTargetGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyTargetGroup 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<ModifyTargetGroupResponse> ModifyTargetGroupAsync(ModifyTargetGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ModifyTargetGroupRequestMarshaller(); var unmarshaller = ModifyTargetGroupResponseUnmarshaller.Instance; return InvokeAsync<ModifyTargetGroupRequest,ModifyTargetGroupResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the ModifyTargetGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ModifyTargetGroup 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 EndModifyTargetGroup /// operation.</returns> public IAsyncResult BeginModifyTargetGroup(ModifyTargetGroupRequest request, AsyncCallback callback, object state) { var marshaller = new ModifyTargetGroupRequestMarshaller(); var unmarshaller = ModifyTargetGroupResponseUnmarshaller.Instance; return BeginInvoke<ModifyTargetGroupRequest>(request, marshaller, unmarshaller, callback, state); }