createResolverEndpoint method

Future<CreateResolverEndpointResponse> createResolverEndpoint({
  1. required String creatorRequestId,
  2. required ResolverEndpointDirection direction,
  3. required List<IpAddressRequest> ipAddresses,
  4. required List<String> securityGroupIds,
  5. String? name,
  6. List<Tag>? tags,
})

Creates a Resolver endpoint. There are two types of Resolver endpoints, inbound and outbound:

  • An inbound Resolver endpoint forwards DNS queries to the DNS service for a VPC from your network.
  • An outbound Resolver endpoint forwards DNS queries from the DNS service for a VPC to your network.

May throw InvalidParameterException. May throw ResourceNotFoundException. May throw InvalidRequestException. May throw ResourceExistsException. May throw LimitExceededException. May throw InternalServiceErrorException. May throw ThrottlingException.

Parameter creatorRequestId : A unique string that identifies the request and that allows failed requests to be retried without the risk of executing the operation twice. CreatorRequestId can be any unique string, for example, a date/time stamp.

Parameter direction : Specify the applicable value:

  • INBOUND: Resolver forwards DNS queries to the DNS service for a VPC from your network
  • OUTBOUND: Resolver forwards DNS queries from the DNS service for a VPC to your network

Parameter ipAddresses : The subnets and IP addresses in your VPC that DNS queries originate from (for outbound endpoints) or that you forward DNS queries to (for inbound endpoints). The subnet ID uniquely identifies a VPC.

Parameter securityGroupIds : The ID of one or more security groups that you want to use to control access to this VPC. The security group that you specify must include one or more inbound rules (for inbound Resolver endpoints) or outbound rules (for outbound Resolver endpoints). Inbound and outbound rules must allow TCP and UDP access. For inbound access, open port 53. For outbound access, open the port that you're using for DNS queries on your network.

Parameter name : A friendly name that lets you easily find a configuration in the Resolver dashboard in the Route 53 console.

Parameter tags : A list of the tag keys and values that you want to associate with the endpoint.

Implementation

Future<CreateResolverEndpointResponse> createResolverEndpoint({
  required String creatorRequestId,
  required ResolverEndpointDirection direction,
  required List<IpAddressRequest> ipAddresses,
  required List<String> securityGroupIds,
  String? name,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(creatorRequestId, 'creatorRequestId');
  _s.validateStringLength(
    'creatorRequestId',
    creatorRequestId,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(direction, 'direction');
  ArgumentError.checkNotNull(ipAddresses, 'ipAddresses');
  ArgumentError.checkNotNull(securityGroupIds, 'securityGroupIds');
  _s.validateStringLength(
    'name',
    name,
    0,
    64,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Route53Resolver.CreateResolverEndpoint'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CreatorRequestId': creatorRequestId,
      'Direction': direction.toValue(),
      'IpAddresses': ipAddresses,
      'SecurityGroupIds': securityGroupIds,
      if (name != null) 'Name': name,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateResolverEndpointResponse.fromJson(jsonResponse.body);
}