listCustomRoutingPortMappings method

Future<ListCustomRoutingPortMappingsResponse> listCustomRoutingPortMappings({
  1. required String acceleratorArn,
  2. String? endpointGroupArn,
  3. int? maxResults,
  4. String? nextToken,
})

Provides a complete mapping from the public accelerator IP address and port to destination EC2 instance IP addresses and ports in the virtual public cloud (VPC) subnet endpoint for a custom routing accelerator. For each subnet endpoint that you add, Global Accelerator creates a new static port mapping for the accelerator. The port mappings don't change after Global Accelerator generates them, so you can retrieve and cache the full mapping on your servers.

If you remove a subnet from your accelerator, Global Accelerator removes (reclaims) the port mappings. If you add a subnet to your accelerator, Global Accelerator creates new port mappings (the existing ones don't change). If you add or remove EC2 instances in your subnet, the port mappings don't change, because the mappings are created when you add the subnet to Global Accelerator.

The mappings also include a flag for each destination denoting which destination IP addresses and ports are allowed or denied traffic.

May throw InvalidArgumentException. May throw InvalidNextTokenException. May throw EndpointGroupNotFoundException. May throw AcceleratorNotFoundException. May throw InternalServiceErrorException.

Parameter acceleratorArn : The Amazon Resource Name (ARN) of the accelerator to list the custom routing port mappings for.

Parameter endpointGroupArn : The Amazon Resource Name (ARN) of the endpoint group to list the custom routing port mappings for.

Parameter maxResults : The number of destination port mappings that you want to return with this call. The default value is 10.

Parameter nextToken : The token for the next set of results. You receive this token from a previous call.

Implementation

Future<ListCustomRoutingPortMappingsResponse> listCustomRoutingPortMappings({
  required String acceleratorArn,
  String? endpointGroupArn,
  int? maxResults,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(acceleratorArn, 'acceleratorArn');
  _s.validateStringLength(
    'acceleratorArn',
    acceleratorArn,
    0,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'endpointGroupArn',
    endpointGroupArn,
    0,
    255,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    20000,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'GlobalAccelerator_V20180706.ListCustomRoutingPortMappings'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AcceleratorArn': acceleratorArn,
      if (endpointGroupArn != null) 'EndpointGroupArn': endpointGroupArn,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListCustomRoutingPortMappingsResponse.fromJson(jsonResponse.body);
}