Skip to content

create_access_source async

create_access_source(
    cidr: Cidr,
    dns_view_id: ResourceId,
    protocol: DnsProtocol,
    *,
    config_overrides: Optional[AsyncRoute53GlobalResolverClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    ip_address_type: Optional[IpAddressType] = None,
    name: Optional[ResourceNameShort] = None,
    tags: Optional[Tags] = None,
) -> CreateAccessSourceOutput

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.

Route 53 Global Resolver is a global service that supports resolvers in multiple Amazon Web Services Regions but you must specify the US East (Ohio) Region to create, update, or otherwise work with Route 53 Global Resolver resources. That is, for example, specify --region us-east-2 on Amazon Web Services CLI commands.

Parameters:

  • cidr (Cidr) –

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

  • client_token (Optional[ClientToken], default: None ) –

    A unique string that identifies the request and ensures idempotency.

  • ip_address_type (Optional[IpAddressType], default: None ) –

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

  • name (Optional[ResourceNameShort], default: None ) –

    A descriptive name for the access source.

  • dns_view_id (ResourceId) –

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

  • protocol (DnsProtocol) –

    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).

  • tags (Optional[Tags], default: None ) –

    Tags to associate with the access source.

Raises:

  • AccessDeniedException –

    You don't have permission to perform this operation. Check your IAM permissions and try again.

  • ConflictException –

    The request conflicts with the current state of the resource. This can occur when trying to modify a resource that is not in a valid state for the requested operation.

  • InternalServerException –

    An internal server error occurred. Try again later.

  • ResourceNotFoundException –

    The specified resource was not found. Verify the resource ID and try again.

  • ServiceQuotaExceededException –

    The request would exceed one or more service quotas. Check your current usage and quotas, then try again.

  • ThrottlingException –

    The request was throttled due to too many requests. Wait a moment and try again.

  • ValidationException –

    The input parameters are invalid. Check the parameter values and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

CreateAccessSource example

>>> await client.create_access_source(cidr='85.90.183.3/30', client_token='9fas9-9usdfa-xbi8-kco', dns_view_id='dnsv-123456789', ip_address_type='IPV4', name='My Access Source', protocol='DO53', tags={'Key1': 'Value1'})
Source code in docs_src/capo_route53globalresolver/_services/async_route53_global_resolver.py
async def create_access_source(
    self,
    cidr: "capo_route53globalresolver.types.cidr.Cidr",
    dns_view_id: "capo_route53globalresolver.types.resource_id.ResourceId",
    protocol: "capo_route53globalresolver.types.dns_protocol.DnsProtocol",
    *,
    config_overrides: Optional[AsyncRoute53GlobalResolverClientConfig] = None,
    client_token: Optional[
        "capo_route53globalresolver.types.client_token.ClientToken"
    ] = None,
    ip_address_type: Optional[
        "capo_route53globalresolver.types.ip_address_type.IpAddressType"
    ] = None,
    name: Optional[
        "capo_route53globalresolver.types.resource_name_short.ResourceNameShort"
    ] = None,
    tags: Optional["capo_route53globalresolver.types.tags.Tags"] = None,
) -> "capo_route53globalresolver.types.create_access_source_output.CreateAccessSourceOutput":
    """<p>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.</p> <important> <p>Route 53 Global Resolver is a global service that supports resolvers in multiple Amazon Web Services Regions but you must specify the US East (Ohio) Region to create, update, or otherwise work with Route 53 Global Resolver resources. That is, for example, specify <code>--region us-east-2</code> on Amazon Web Services CLI commands.</p> </important>

    Args:
        cidr: <p>The IP address or CIDR range that is allowed to send DNS queries to the Route 53 Global Resolver.</p>
        client_token: <p>A unique string that identifies the request and ensures idempotency.</p>
        ip_address_type: <p>The IP address type for this access source. Valid values are IPv4 and IPv6 (if the Route 53 Global Resolver supports dual-stack).</p>
        name: <p>A descriptive name for the access source.</p>
        dns_view_id: <p>The ID of the DNS view to associate with this access source.</p>
        protocol: <p>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).</p>
        tags: <p>Tags to associate with the access source.</p>

    Raises:
        capo_route53globalresolver.errors.access_denied_exception.AccessDeniedException: <p>You don't have permission to perform this operation. Check your IAM permissions and try again.</p>
        capo_route53globalresolver.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. This can occur when trying to modify a resource that is not in a valid state for the requested operation.</p>
        capo_route53globalresolver.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Try again later.</p>
        capo_route53globalresolver.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. Verify the resource ID and try again.</p>
        capo_route53globalresolver.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed one or more service quotas. Check your current usage and quotas, then try again.</p>
        capo_route53globalresolver.errors.throttling_exception.ThrottlingException: <p>The request was throttled due to too many requests. Wait a moment and try again.</p>
        capo_route53globalresolver.errors.validation_exception.ValidationException: <p>The input parameters are invalid. Check the parameter values and try again.</p>
        capo_route53globalresolver.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        CreateAccessSource example

        >>> await client.create_access_source(cidr='85.90.183.3/30', client_token='9fas9-9usdfa-xbi8-kco', dns_view_id='dnsv-123456789', ip_address_type='IPV4', name='My Access Source', protocol='DO53', tags={'Key1': 'Value1'})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_route53globalresolver.types.create_access_source_input.CreateAccessSourceInput]",
    ) -> AsyncOperationResponse[
        "capo_route53globalresolver.types.create_access_source_output.CreateAccessSourceOutput"
    ]:
        import capo_route53globalresolver._operations.ec2_dns_global_resolver_customer_api.create_access_source

        (
            output,
            http_response,
        ) = await capo_route53globalresolver._operations.ec2_dns_global_resolver_customer_api.create_access_source.async_create_access_source(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAccessSource")
    )
    input_: capo_route53globalresolver.types.create_access_source_input.CreateAccessSourceInput = {
        "cidr": cidr,
        "dns_view_id": dns_view_id,
        "protocol": protocol,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if ip_address_type is not None:
        input_["ip_address_type"] = ip_address_type
    if name is not None:
        input_["name"] = name
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output