Authorizes the Amazon Web Services account that created a specified VPC to submit an AssociateVPCWithHostedZone request to associate the VPC with a specified hosted zone that was created by a different account. To submit a CreateVPCAssociationAuthorization request, you must use the account that created the hosted zone. After you authorize the association, use the account that created the VPC to submit an AssociateVPCWithHostedZone request.
If you want to associate multiple VPCs that you created by using one account with a hosted zone that you created by using a different account, you must submit one authorization request for each VPC.
Parameters:
-
hosted_zone_id
(ResourceId)
–
The ID of the private hosted zone that you want to authorize associating a VPC with.
-
vpc
(VPC)
–
A complex type that contains the VPC ID and region for the VPC that you want to authorize associating with your hosted zone.
Raises:
-
ConcurrentModification
–
Another user submitted a request to create, update, or delete the object at the same time that you did. Retry the request.
-
InvalidInput
–
-
InvalidVPCId
–
The VPC ID that you specified either isn't a valid ID or the current account is not authorized to access this VPC.
-
NoSuchHostedZone
–
No hosted zone exists with the ID that you specified.
-
TooManyVPCAssociationAuthorizations
–
You've created the maximum number of authorizations that can be created for the specified hosted zone. To authorize another VPC to be associated with the hosted zone, submit a DeleteVPCAssociationAuthorization request to remove an existing authorization. To get a list of existing authorizations, submit a ListVPCAssociationAuthorizations request.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_route_53/_services/async_route53.py
| async def create_vpc_association_authorization(
self,
hosted_zone_id: "capo_route_53.types.resource_id.ResourceId",
vpc: "capo_route_53.types.vpc.VPC",
*,
config_overrides: Optional[AsyncRoute53ClientConfig] = None,
) -> "capo_route_53.types.create_vpc_association_authorization_response.CreateVPCAssociationAuthorizationResponse":
"""<p>Authorizes the Amazon Web Services account that created a specified VPC to submit an <code>AssociateVPCWithHostedZone</code> request to associate the VPC with a specified hosted zone that was created by a different account. To submit a <code>CreateVPCAssociationAuthorization</code> request, you must use the account that created the hosted zone. After you authorize the association, use the account that created the VPC to submit an <code>AssociateVPCWithHostedZone</code> request.</p> <note> <p>If you want to associate multiple VPCs that you created by using one account with a hosted zone that you created by using a different account, you must submit one authorization request for each VPC.</p> </note>
Args:
hosted_zone_id: <p>The ID of the private hosted zone that you want to authorize associating a VPC with.</p>
vpc: <p>A complex type that contains the VPC ID and region for the VPC that you want to authorize associating with your hosted zone.</p>
Raises:
capo_route_53.errors.concurrent_modification.ConcurrentModification: <p>Another user submitted a request to create, update, or delete the object at the same time that you did. Retry the request. </p>
capo_route_53.errors.invalid_input.InvalidInput: <p>The input is not valid.</p>
capo_route_53.errors.invalid_vpc_id.InvalidVPCId: <p>The VPC ID that you specified either isn't a valid ID or the current account is not authorized to access this VPC.</p>
capo_route_53.errors.no_such_hosted_zone.NoSuchHostedZone: <p>No hosted zone exists with the ID that you specified.</p>
capo_route_53.errors.too_many_vpc_association_authorizations.TooManyVPCAssociationAuthorizations: <p>You've created the maximum number of authorizations that can be created for the specified hosted zone. To authorize another VPC to be associated with the hosted zone, submit a <code>DeleteVPCAssociationAuthorization</code> request to remove an existing authorization. To get a list of existing authorizations, submit a <code>ListVPCAssociationAuthorizations</code> request.</p>
capo_route_53.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_route_53.types.create_vpc_association_authorization_request.CreateVPCAssociationAuthorizationRequest]",
) -> AsyncOperationResponse[
"capo_route_53.types.create_vpc_association_authorization_response.CreateVPCAssociationAuthorizationResponse"
]:
import capo_route_53._operations.aws_dns_v20130401.create_vpc_association_authorization
(
output,
http_response,
) = await capo_route_53._operations.aws_dns_v20130401.create_vpc_association_authorization.async_create_vpc_association_authorization(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CreateVPCAssociationAuthorization")
)
input_: capo_route_53.types.create_vpc_association_authorization_request.CreateVPCAssociationAuthorizationRequest = {
"hosted_zone_id": hosted_zone_id,
"vpc": vpc,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|