createAccessSource method

Future<CreateAccessSourceOutput> createAccessSource({
  1. required String cidr,
  2. required String dnsViewId,
  3. required DnsProtocol protocol,
  4. String? clientToken,
  5. IpAddressType? ipAddressType,
  6. String? name,
  7. Map<String, String>? tags,
})

Creates an access source for a DNS view. Access sources define IP addresses or CIDR ranges that are allowed to send DNS queries to the Route 53 Global Resolver, along with the permitted DNS protocols.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter cidr : The IP address or CIDR range that is allowed to send DNS queries to the Route 53 Global Resolver.

Parameter dnsViewId : The ID of the DNS view to associate with this access source.

Parameter protocol : The DNS protocol that is permitted for this access source. Valid values are Do53 (DNS over port 53), DoT (DNS over TLS), and DoH (DNS over HTTPS).

Parameter clientToken : A unique string that identifies the request and ensures idempotency.

Parameter ipAddressType : The IP address type for this access source. Valid values are IPv4 and IPv6 (if the Route 53 Global Resolver supports dual-stack).

Parameter name : A descriptive name for the access source.

Parameter tags : Tags to associate with the access source.

Implementation

Future<CreateAccessSourceOutput> createAccessSource({
  required String cidr,
  required String dnsViewId,
  required DnsProtocol protocol,
  String? clientToken,
  IpAddressType? ipAddressType,
  String? name,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'cidr': cidr,
    'dnsViewId': dnsViewId,
    'protocol': protocol.value,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (ipAddressType != null) 'ipAddressType': ipAddressType.value,
    if (name != null) 'name': name,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/access-sources',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAccessSourceOutput.fromJson(response);
}