associateDistributionTenantWebACL method

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

Associates the WAF web ACL with a distribution tenant.

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 tenant.

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

Parameter ifMatch : The current ETag of the distribution tenant. This value is returned in the response of the GetDistributionTenant API operation.

Implementation

Future<AssociateDistributionTenantWebACLResult>
    associateDistributionTenantWebACL({
  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-tenant/${Uri.encodeComponent(id)}/associate-web-acl',
    headers: headers,
    payload: AssociateDistributionTenantWebACLRequest(
            id: id, webACLArn: webACLArn, ifMatch: ifMatch)
        .toXml('AssociateDistributionTenantWebACLRequest'),
    exceptionFnMap: _exceptionFns,
  );
  final $elem = await _s.xmlFromResponse($result);
  return AssociateDistributionTenantWebACLResult(
    id: _s.extractXmlStringValue($elem, 'Id'),
    webACLArn: _s.extractXmlStringValue($elem, 'WebACLArn'),
    eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
  );
}