updateDomainAssociation method

Future<UpdateDomainAssociationResult> updateDomainAssociation({
  1. required String domain,
  2. required DistributionResourceId targetResource,
  3. String? ifMatch,
})
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.

May throw AccessDenied. May throw EntityNotFound. May throw IllegalUpdate. May throw InvalidArgument. May throw InvalidIfMatchVersion. May throw PreconditionFailed.

Parameter domain : The domain to update.

Parameter targetResource : The target standard distribution or distribution tenant resource for the domain. You can specify either DistributionId or DistributionTenantId, but not both.

Parameter ifMatch : The value of the ETag identifier for the standard distribution or distribution tenant that will be associated with the domain.

Implementation

Future<UpdateDomainAssociationResult> updateDomainAssociation({
  required String domain,
  required DistributionResourceId targetResource,
  String? ifMatch,
}) async {
  final headers = <String, String>{
    if (ifMatch != null) 'If-Match': ifMatch.toString(),
  };
  final $result = await _protocol.sendRaw(
    method: 'POST',
    requestUri: '/2020-05-31/domain-association',
    headers: headers,
    payload: UpdateDomainAssociationRequest(
            domain: domain, targetResource: targetResource, ifMatch: ifMatch)
        .toXml('UpdateDomainAssociationRequest'),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return UpdateDomainAssociationResult(
    domain: _s.extractXmlStringValue($elem, 'Domain'),
    resourceId: _s.extractXmlStringValue($elem, 'ResourceId'),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
  );
}