updateEndpointGroup method

Future<UpdateEndpointGroupResponse> updateEndpointGroup({
  1. required String endpointGroupArn,
  2. List<EndpointConfiguration>? endpointConfigurations,
  3. int? healthCheckIntervalSeconds,
  4. String? healthCheckPath,
  5. int? healthCheckPort,
  6. HealthCheckProtocol? healthCheckProtocol,
  7. List<PortOverride>? portOverrides,
  8. int? thresholdCount,
  9. double? trafficDialPercentage,
})

Update an endpoint group. A resource must be valid and active when you add it as an endpoint.

May throw InvalidArgumentException. May throw EndpointGroupNotFoundException. May throw InternalServiceErrorException. May throw LimitExceededException. May throw AccessDeniedException.

Parameter endpointGroupArn : The Amazon Resource Name (ARN) of the endpoint group.

Parameter endpointConfigurations : The list of endpoint objects. A resource must be valid and active when you add it as an endpoint.

Parameter healthCheckIntervalSeconds : The time—10 seconds or 30 seconds—between each health check for an endpoint. The default value is 30.

Parameter healthCheckPath : If the protocol is HTTP/S, then this specifies the path that is the destination for health check targets. The default value is slash (/).

Parameter healthCheckPort : The port that AWS Global Accelerator uses to check the health of endpoints that are part of this endpoint group. The default port is the listener port that this endpoint group is associated with. If the listener port is a list of ports, Global Accelerator uses the first port in the list.

Parameter healthCheckProtocol : The protocol that AWS Global Accelerator uses to check the health of endpoints that are part of this endpoint group. The default value is TCP.

Parameter portOverrides : Override specific listener ports used to route traffic to endpoints that are part of this endpoint group. For example, you can create a port override in which the listener receives user traffic on ports 80 and 443, but your accelerator routes that traffic to ports 1080 and 1443, respectively, on the endpoints.

For more information, see Port overrides in the AWS Global Accelerator Developer Guide.

Parameter thresholdCount : The number of consecutive health checks required to set the state of a healthy endpoint to unhealthy, or to set an unhealthy endpoint to healthy. The default value is 3.

Parameter trafficDialPercentage : The percentage of traffic to send to an AWS Region. Additional traffic is distributed to other endpoint groups for this listener.

Use this action to increase (dial up) or decrease (dial down) traffic to a specific Region. The percentage is applied to the traffic that would otherwise have been routed to the Region based on optimal routing.

The default value is 100.

Implementation

Future<UpdateEndpointGroupResponse> updateEndpointGroup({
  required String endpointGroupArn,
  List<EndpointConfiguration>? endpointConfigurations,
  int? healthCheckIntervalSeconds,
  String? healthCheckPath,
  int? healthCheckPort,
  HealthCheckProtocol? healthCheckProtocol,
  List<PortOverride>? portOverrides,
  int? thresholdCount,
  double? trafficDialPercentage,
}) async {
  ArgumentError.checkNotNull(endpointGroupArn, 'endpointGroupArn');
  _s.validateStringLength(
    'endpointGroupArn',
    endpointGroupArn,
    0,
    255,
    isRequired: true,
  );
  _s.validateNumRange(
    'healthCheckIntervalSeconds',
    healthCheckIntervalSeconds,
    10,
    30,
  );
  _s.validateStringLength(
    'healthCheckPath',
    healthCheckPath,
    0,
    255,
  );
  _s.validateNumRange(
    'healthCheckPort',
    healthCheckPort,
    1,
    65535,
  );
  _s.validateNumRange(
    'thresholdCount',
    thresholdCount,
    1,
    10,
  );
  _s.validateNumRange(
    'trafficDialPercentage',
    trafficDialPercentage,
    0,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GlobalAccelerator_V20180706.UpdateEndpointGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EndpointGroupArn': endpointGroupArn,
      if (endpointConfigurations != null)
        'EndpointConfigurations': endpointConfigurations,
      if (healthCheckIntervalSeconds != null)
        'HealthCheckIntervalSeconds': healthCheckIntervalSeconds,
      if (healthCheckPath != null) 'HealthCheckPath': healthCheckPath,
      if (healthCheckPort != null) 'HealthCheckPort': healthCheckPort,
      if (healthCheckProtocol != null)
        'HealthCheckProtocol': healthCheckProtocol.toValue(),
      if (portOverrides != null) 'PortOverrides': portOverrides,
      if (thresholdCount != null) 'ThresholdCount': thresholdCount,
      if (trafficDialPercentage != null)
        'TrafficDialPercentage': trafficDialPercentage,
    },
  );

  return UpdateEndpointGroupResponse.fromJson(jsonResponse.body);
}