We recommend that you use the UpdateDomainAssociation API operation to move a domain association, as it supports both standard distributions and distribution tenants. AssociateAlias performs similar checks but only supports standard distributions.
Moves a domain from its current standard distribution or distribution tenant to another one.
You must first disable the source distribution (standard distribution or distribution tenant) and then separately call this operation to move the domain to another target distribution (standard distribution or distribution tenant).
To use this operation, specify the domain and the ID of the target resource (standard distribution or distribution tenant). For more information, including how to set up the target resource, prerequisites that you must complete, and other restrictions, see Moving an alternate domain name to a different standard distribution or distribution tenant in the Amazon CloudFront Developer Guide.
Parameters:
-
domain
(string)
–
-
target_resource
(DistributionResourceId)
–
The target standard distribution or distribution tenant resource for the domain. You can specify either DistributionId or DistributionTenantId, but not both.
-
if_match
(Optional[string], default:
None
)
–
The value of the ETag identifier for the standard distribution or distribution tenant that will be associated with the domain.
Raises:
Source code in docs_src/capo_cloudfront/_services/async_cloud_front.py
| async def update_domain_association(
self,
domain: "capo_cloudfront.types.string.string",
target_resource: "capo_cloudfront.types.distribution_resource_id.DistributionResourceId",
*,
config_overrides: Optional[AsyncCloudFrontClientConfig] = None,
if_match: Optional["capo_cloudfront.types.string.string"] = None,
) -> "capo_cloudfront.types.update_domain_association_result.UpdateDomainAssociationResult":
"""<note> <p>We recommend that you use the <code>UpdateDomainAssociation</code> API operation to move a domain association, as it supports both standard distributions and distribution tenants. <a href="https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_AssociateAlias.html">AssociateAlias</a> performs similar checks but only supports standard distributions.</p> </note> <p>Moves a domain from its current standard distribution or distribution tenant to another one.</p> <p>You must first disable the source distribution (standard distribution or distribution tenant) and then separately call this operation to move the domain to another target distribution (standard distribution or distribution tenant).</p> <p>To use this operation, specify the domain and the ID of the target resource (standard distribution or distribution tenant). For more information, including how to set up the target resource, prerequisites that you must complete, and other restrictions, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-move">Moving an alternate domain name to a different standard distribution or distribution tenant</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
Args:
domain: <p>The domain to update.</p>
target_resource: <p>The target standard distribution or distribution tenant resource for the domain. You can specify either <code>DistributionId</code> or <code>DistributionTenantId</code>, but not both.</p>
if_match: <p>The value of the <code>ETag</code> identifier for the standard distribution or distribution tenant that will be associated with the domain.</p>
Raises:
capo_cloudfront.errors.access_denied.AccessDenied: <p>Access denied.</p>
capo_cloudfront.errors.entity_not_found.EntityNotFound: <p>The entity was not found.</p>
capo_cloudfront.errors.illegal_update.IllegalUpdate: <p>The update contains modifications that are not allowed.</p>
capo_cloudfront.errors.invalid_argument.InvalidArgument: <p>An argument is invalid.</p>
capo_cloudfront.errors.invalid_if_match_version.InvalidIfMatchVersion: <p>The <code>If-Match</code> version is missing or not valid.</p>
capo_cloudfront.errors.precondition_failed.PreconditionFailed: <p>The precondition in one or more of the request fields evaluated to <code>false</code>.</p>
capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_cloudfront.types.update_domain_association_request.UpdateDomainAssociationRequest]",
) -> AsyncOperationResponse[
"capo_cloudfront.types.update_domain_association_result.UpdateDomainAssociationResult"
]:
import capo_cloudfront._operations.cloudfront2020_05_31.update_domain_association
(
output,
http_response,
) = await capo_cloudfront._operations.cloudfront2020_05_31.update_domain_association.async_update_domain_association(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateDomainAssociation")
)
input_: capo_cloudfront.types.update_domain_association_request.UpdateDomainAssociationRequest = {
"domain": domain,
"target_resource": target_resource,
}
if if_match is not None:
input_["if_match"] = if_match
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|