Associates the WAF web ACL with a distribution.
Parameters:
-
id
(string)
–
The ID of the distribution.
-
web_acl_arn
(string)
–
The Amazon Resource Name (ARN) of the WAF web ACL to associate.
-
if_match
(Optional[string], default:
None
)
–
The value of the ETag header that you received when retrieving the distribution that you're associating with the WAF web ACL.
Raises:
Source code in docs_src/capo_cloudfront/_services/cloud_front.py
| def associate_distribution_web_acl(
self,
id: "capo_cloudfront.types.string.string",
web_acl_arn: "capo_cloudfront.types.string.string",
*,
config_overrides: Optional[CloudFrontClientConfig] = None,
if_match: Optional["capo_cloudfront.types.string.string"] = None,
) -> "capo_cloudfront.types.associate_distribution_web_acl_result.AssociateDistributionWebACLResult":
"""<p>Associates the WAF web ACL with a distribution.</p>
Args:
id: <p>The ID of the distribution.</p>
web_acl_arn: <p>The Amazon Resource Name (ARN) of the WAF web ACL to associate.</p>
if_match: <p>The value of the <code>ETag</code> header that you received when retrieving the distribution that you're associating with the WAF web ACL.</p>
Raises:
capo_cloudfront.errors.access_denied.AccessDenied: <p>Access denied.</p>
capo_cloudfront.errors.entity_limit_exceeded.EntityLimitExceeded: <p>The entity limit has been exceeded.</p>
capo_cloudfront.errors.entity_not_found.EntityNotFound: <p>The entity was not found.</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.
"""
def _handler(
req: "OperationRequest[capo_cloudfront.types.associate_distribution_web_acl_request.AssociateDistributionWebACLRequest]",
) -> OperationResponse[
"capo_cloudfront.types.associate_distribution_web_acl_result.AssociateDistributionWebACLResult"
]:
import capo_cloudfront._operations.cloudfront2020_05_31.associate_distribution_web_acl
output, http_response = (
capo_cloudfront._operations.cloudfront2020_05_31.associate_distribution_web_acl.associate_distribution_web_acl(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("AssociateDistributionWebACL")
)
input_: capo_cloudfront.types.associate_distribution_web_acl_request.AssociateDistributionWebACLRequest = {
"id": id,
"web_acl_arn": web_acl_arn,
}
if if_match is not None:
input_["if_match"] = if_match
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|