modifyTargetGroup method

Future<ModifyTargetGroupOutput> modifyTargetGroup({
  1. required String targetGroupArn,
  2. bool? healthCheckEnabled,
  3. int? healthCheckIntervalSeconds,
  4. String? healthCheckPath,
  5. String? healthCheckPort,
  6. ProtocolEnum? healthCheckProtocol,
  7. int? healthCheckTimeoutSeconds,
  8. int? healthyThresholdCount,
  9. Matcher? matcher,
  10. int? unhealthyThresholdCount,
})

Modifies the health checks used when evaluating the health state of the targets in the specified target group.

May throw InvalidConfigurationRequestException. May throw TargetGroupNotFoundException.

Parameter targetGroupArn : The Amazon Resource Name (ARN) of the target group.

Parameter healthCheckEnabled : Indicates whether health checks are enabled. If the target type is lambda, health checks are disabled by default but can be enabled. If the target type is instance, ip, or alb, health checks are always enabled and can't be disabled.

Parameter healthCheckIntervalSeconds : The approximate amount of time, in seconds, between health checks of an individual target.

Parameter healthCheckPath : [HTTP/HTTPS health checks] The destination for health checks on the targets.

[HTTP1 or HTTP2 protocol version] The ping path. The default is /.

[GRPC protocol version] The path of a custom health check method with the format /package.service/method. The default is /Amazon Web Services.ALB/healthcheck.

Parameter healthCheckPort : The port the load balancer uses when performing health checks on targets.

Parameter healthCheckProtocol : The protocol the load balancer uses when performing health checks on targets. For Application Load Balancers, the default is HTTP. For Network Load Balancers and Gateway Load Balancers, the default is TCP. The TCP protocol is not supported for health checks if the protocol of the target group is HTTP or HTTPS. It is supported for health checks only if the protocol of the target group is TCP, TLS, UDP, or TCP_UDP. The GENEVE, TLS, UDP, TCP_UDP, QUIC, and TCP_QUIC protocols are not supported for health checks.

Parameter healthCheckTimeoutSeconds : [HTTP/HTTPS health checks] The amount of time, in seconds, during which no response means a failed health check.

Parameter healthyThresholdCount : The number of consecutive health checks successes required before considering an unhealthy target healthy.

Parameter matcher : [HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for a successful response from a target. For target groups with a protocol of TCP, TCP_UDP, UDP or TLS the range is 200-599. For target groups with a protocol of HTTP or HTTPS, the range is 200-499. For target groups with a protocol of GENEVE, the range is 200-399.

Parameter unhealthyThresholdCount : The number of consecutive health check failures required before considering the target unhealthy.

Implementation

Future<ModifyTargetGroupOutput> modifyTargetGroup({
  required String targetGroupArn,
  bool? healthCheckEnabled,
  int? healthCheckIntervalSeconds,
  String? healthCheckPath,
  String? healthCheckPort,
  ProtocolEnum? healthCheckProtocol,
  int? healthCheckTimeoutSeconds,
  int? healthyThresholdCount,
  Matcher? matcher,
  int? unhealthyThresholdCount,
}) async {
  _s.validateNumRange(
    'healthCheckIntervalSeconds',
    healthCheckIntervalSeconds,
    5,
    300,
  );
  _s.validateNumRange(
    'healthCheckTimeoutSeconds',
    healthCheckTimeoutSeconds,
    2,
    120,
  );
  _s.validateNumRange(
    'healthyThresholdCount',
    healthyThresholdCount,
    2,
    10,
  );
  _s.validateNumRange(
    'unhealthyThresholdCount',
    unhealthyThresholdCount,
    2,
    10,
  );
  final $request = <String, String>{
    'TargetGroupArn': targetGroupArn,
    if (healthCheckEnabled != null)
      'HealthCheckEnabled': healthCheckEnabled.toString(),
    if (healthCheckIntervalSeconds != null)
      'HealthCheckIntervalSeconds': healthCheckIntervalSeconds.toString(),
    if (healthCheckPath != null) 'HealthCheckPath': healthCheckPath,
    if (healthCheckPort != null) 'HealthCheckPort': healthCheckPort,
    if (healthCheckProtocol != null)
      'HealthCheckProtocol': healthCheckProtocol.value,
    if (healthCheckTimeoutSeconds != null)
      'HealthCheckTimeoutSeconds': healthCheckTimeoutSeconds.toString(),
    if (healthyThresholdCount != null)
      'HealthyThresholdCount': healthyThresholdCount.toString(),
    if (matcher != null)
      for (var e1 in matcher.toQueryMap().entries)
        'Matcher.${e1.key}': e1.value,
    if (unhealthyThresholdCount != null)
      'UnhealthyThresholdCount': unhealthyThresholdCount.toString(),
  };
  final $result = await _protocol.send(
    $request,
    action: 'ModifyTargetGroup',
    version: '2015-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'ModifyTargetGroupResult',
  );
  return ModifyTargetGroupOutput.fromXml($result);
}