createCustomRoutingListener method

Future<CreateCustomRoutingListenerResponse> createCustomRoutingListener({
  1. required String acceleratorArn,
  2. required List<PortRange> portRanges,
  3. String? idempotencyToken,
})

Create a listener to process inbound connections from clients to a custom routing accelerator. Connections arrive to assigned static IP addresses on the port range that you specify.

May throw InvalidArgumentException. May throw AcceleratorNotFoundException. May throw InvalidPortRangeException. May throw InternalServiceErrorException. May throw LimitExceededException.

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

Parameter portRanges : The port range to support for connections from clients to your accelerator.

Separately, you set port ranges for endpoints. For more information, see About endpoints for custom routing accelerators.

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

Implementation

Future<CreateCustomRoutingListenerResponse> createCustomRoutingListener({
  required String acceleratorArn,
  required List<PortRange> portRanges,
  String? idempotencyToken,
}) async {
  ArgumentError.checkNotNull(acceleratorArn, 'acceleratorArn');
  _s.validateStringLength(
    'acceleratorArn',
    acceleratorArn,
    0,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(portRanges, 'portRanges');
  _s.validateStringLength(
    'idempotencyToken',
    idempotencyToken,
    0,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'GlobalAccelerator_V20180706.CreateCustomRoutingListener'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AcceleratorArn': acceleratorArn,
      'PortRanges': portRanges,
      'IdempotencyToken': idempotencyToken ?? _s.generateIdempotencyToken(),
    },
  );

  return CreateCustomRoutingListenerResponse.fromJson(jsonResponse.body);
}