createCustomRoutingEndpointGroup method

Future<CreateCustomRoutingEndpointGroupResponse> createCustomRoutingEndpointGroup({
  1. required List<CustomRoutingDestinationConfiguration> destinationConfigurations,
  2. required String endpointGroupRegion,
  3. required String listenerArn,
  4. String? idempotencyToken,
})

Create an endpoint group for the specified listener for a custom routing accelerator. An endpoint group is a collection of endpoints in one AWS Region.

May throw AcceleratorNotFoundException. May throw EndpointGroupAlreadyExistsException. May throw ListenerNotFoundException. May throw InternalServiceErrorException. May throw InvalidArgumentException. May throw InvalidPortRangeException. May throw LimitExceededException. May throw AccessDeniedException.

Parameter destinationConfigurations : Sets the port range and protocol for all endpoints (virtual private cloud subnets) in a custom routing endpoint group to accept client traffic on.

Parameter endpointGroupRegion : The AWS Region where the endpoint group is located. A listener can have only one endpoint group in a specific Region.

Parameter listenerArn : The Amazon Resource Name (ARN) of the listener for a custom routing endpoint.

Parameter idempotencyToken : A unique, case-sensitive identifier that you provide to ensure the idempotency—that is, the uniqueness—of the request.

Implementation

Future<CreateCustomRoutingEndpointGroupResponse>
    createCustomRoutingEndpointGroup({
  required List<CustomRoutingDestinationConfiguration>
      destinationConfigurations,
  required String endpointGroupRegion,
  required String listenerArn,
  String? idempotencyToken,
}) async {
  ArgumentError.checkNotNull(
      destinationConfigurations, 'destinationConfigurations');
  ArgumentError.checkNotNull(endpointGroupRegion, 'endpointGroupRegion');
  _s.validateStringLength(
    'endpointGroupRegion',
    endpointGroupRegion,
    0,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(listenerArn, 'listenerArn');
  _s.validateStringLength(
    'listenerArn',
    listenerArn,
    0,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'idempotencyToken',
    idempotencyToken,
    0,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'GlobalAccelerator_V20180706.CreateCustomRoutingEndpointGroup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DestinationConfigurations': destinationConfigurations,
      'EndpointGroupRegion': endpointGroupRegion,
      'ListenerArn': listenerArn,
      'IdempotencyToken': idempotencyToken ?? _s.generateIdempotencyToken(),
    },
  );

  return CreateCustomRoutingEndpointGroupResponse.fromJson(jsonResponse.body);
}