Skip to content

associate_resolver_rule async

associate_resolver_rule(
    resolver_rule_id: ResourceId,
    vpc_id: ResourceId,
    *,
    config_overrides: Optional[AsyncRoute53ResolverClientConfig] = None,
    name: Optional[Name] = None,
) -> AssociateResolverRuleResponse

Associates a Resolver rule with a VPC. When you associate a rule with a VPC, Resolver forwards all DNS queries for the domain name that is specified in the rule and that originate in the VPC. The queries are forwarded to the IP addresses for the DNS resolvers that are specified in the rule. For more information about rules, see CreateResolverRule.

Parameters:

  • resolver_rule_id (ResourceId) –

    The ID of the Resolver rule that you want to associate with the VPC. To list the existing Resolver rules, use ListResolverRules.

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

    A name for the association that you're creating between a Resolver rule and a VPC.

    The name can be up to 64 characters long and can contain letters (a-z, A-Z), numbers (0-9), hyphens (-), underscores (_), and spaces. The name cannot consist of only numbers.

  • vpc_id (ResourceId) –

    The ID of the VPC that you want to associate the Resolver rule with.

Raises:

Source code in docs_src/capo_route53resolver/_services/async_route53_resolver.py
async def associate_resolver_rule(
    self,
    resolver_rule_id: "capo_route53resolver.types.resource_id.ResourceId",
    vpc_id: "capo_route53resolver.types.resource_id.ResourceId",
    *,
    config_overrides: Optional[AsyncRoute53ResolverClientConfig] = None,
    name: Optional["capo_route53resolver.types.name.Name"] = None,
) -> "capo_route53resolver.types.associate_resolver_rule_response.AssociateResolverRuleResponse":
    """<p>Associates a Resolver rule with a VPC. When you associate a rule with a VPC, Resolver forwards all DNS queries for the domain name that is specified in the rule and that originate in the VPC. The queries are forwarded to the IP addresses for the DNS resolvers that are specified in the rule. For more information about rules, see <a href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_CreateResolverRule.html">CreateResolverRule</a>. </p>

    Args:
        resolver_rule_id: <p>The ID of the Resolver rule that you want to associate with the VPC. To list the existing Resolver rules, use <a href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_route53resolver_ListResolverRules.html">ListResolverRules</a>.</p>
        name: <p>A name for the association that you're creating between a Resolver rule and a VPC.</p> <p>The name can be up to 64 characters long and can contain letters (a-z, A-Z), numbers (0-9), hyphens (-), underscores (_), and spaces. The name cannot consist of only numbers.</p>
        vpc_id: <p>The ID of the VPC that you want to associate the Resolver rule with.</p>

    Raises:
        capo_route53resolver.errors.internal_service_error_exception.InternalServiceErrorException: <p>We encountered an unknown error. Try again in a few minutes.</p>
        capo_route53resolver.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more parameters in this request are not valid.</p>
        capo_route53resolver.errors.invalid_request_exception.InvalidRequestException: <p>The request is invalid.</p>
        capo_route53resolver.errors.limit_exceeded_exception.LimitExceededException: <p>The request caused one or more limits to be exceeded.</p>
        capo_route53resolver.errors.resource_exists_exception.ResourceExistsException: <p>The resource that you tried to create already exists.</p>
        capo_route53resolver.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource doesn't exist.</p>
        capo_route53resolver.errors.resource_unavailable_exception.ResourceUnavailableException: <p>The specified resource isn't available.</p>
        capo_route53resolver.errors.throttling_exception.ThrottlingException: <p>The request was throttled. Try again in a few minutes.</p>
        capo_route53resolver.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_route53resolver.types.associate_resolver_rule_request.AssociateResolverRuleRequest]",
    ) -> AsyncOperationResponse[
        "capo_route53resolver.types.associate_resolver_rule_response.AssociateResolverRuleResponse"
    ]:
        import capo_route53resolver._operations.route53_resolver.associate_resolver_rule

        (
            output,
            http_response,
        ) = await capo_route53resolver._operations.route53_resolver.associate_resolver_rule.async_associate_resolver_rule(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociateResolverRule")
    )
    input_: capo_route53resolver.types.associate_resolver_rule_request.AssociateResolverRuleRequest = {
        "resolver_rule_id": resolver_rule_id,
        "vpc_id": vpc_id,
    }
    if name is not None:
        input_["name"] = name

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