associateDistributionWebACL method

Future<AssociateDistributionWebACLResult> associateDistributionWebACL({
  1. required String id,
  2. required String webACLArn,
  3. String? ifMatch,
})

Associates the WAF web ACL with a distribution.

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

Parameter id : The ID of the distribution.

Parameter webACLArn : The Amazon Resource Name (ARN) of the WAF web ACL to associate.

Parameter ifMatch : The value of the ETag header that you received when retrieving the distribution that you're associating with the WAF web ACL.

Implementation

Future<AssociateDistributionWebACLResult> associateDistributionWebACL({
  required String id,
  required String webACLArn,
  String? ifMatch,
}) async {
  final headers = <String, String>{
    if (ifMatch != null) 'If-Match': ifMatch.toString(),
  };
  final $result = await _protocol.sendRaw(
    method: 'PUT',
    requestUri:
        '/2020-05-31/distribution/${Uri.encodeComponent(id)}/associate-web-acl',
    headers: headers,
    payload: AssociateDistributionWebACLRequest(
            id: id, webACLArn: webACLArn, ifMatch: ifMatch)
        .toXml('AssociateDistributionWebACLRequest'),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return AssociateDistributionWebACLResult(
    id: _s.extractXmlStringValue($elem, 'Id'),
    webACLArn: _s.extractXmlStringValue($elem, 'WebACLArn'),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
  );
}