delete_origin_request_policy(
id: string,
*,
config_overrides: Optional[CloudFrontClientConfig] = None,
if_match: Optional[string] = None,
) -> None
Deletes an origin request policy.
You cannot delete an origin request policy if it's attached to any cache behaviors. First update your distributions to remove the origin request policy from all cache behaviors, then delete the origin request policy.
To delete an origin request policy, you must provide the policy's identifier and version. To get the identifier, you can use ListOriginRequestPolicies or GetOriginRequestPolicy.
Parameters:
-
id
(string)
–
The unique identifier for the origin request policy that you are deleting. To get the identifier, you can use ListOriginRequestPolicies.
-
if_match
(Optional[string], default:
None
)
–
The version of the origin request policy that you are deleting. The version is the origin request policy's ETag value, which you can get using ListOriginRequestPolicies, GetOriginRequestPolicy, or GetOriginRequestPolicyConfig.
Raises:
Source code in docs_src/capo_cloudfront/_services/cloud_front.py
| def delete_origin_request_policy(
self,
id: "capo_cloudfront.types.string.string",
*,
config_overrides: Optional[CloudFrontClientConfig] = None,
if_match: Optional["capo_cloudfront.types.string.string"] = None,
) -> None:
"""<p>Deletes an origin request policy.</p> <p>You cannot delete an origin request policy if it's attached to any cache behaviors. First update your distributions to remove the origin request policy from all cache behaviors, then delete the origin request policy.</p> <p>To delete an origin request policy, you must provide the policy's identifier and version. To get the identifier, you can use <code>ListOriginRequestPolicies</code> or <code>GetOriginRequestPolicy</code>.</p>
Args:
id: <p>The unique identifier for the origin request policy that you are deleting. To get the identifier, you can use <code>ListOriginRequestPolicies</code>.</p>
if_match: <p>The version of the origin request policy that you are deleting. The version is the origin request policy's <code>ETag</code> value, which you can get using <code>ListOriginRequestPolicies</code>, <code>GetOriginRequestPolicy</code>, or <code>GetOriginRequestPolicyConfig</code>.</p>
Raises:
capo_cloudfront.errors.access_denied.AccessDenied: <p>Access denied.</p>
capo_cloudfront.errors.illegal_delete.IllegalDelete: <p>Deletion is not allowed for this entity.</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.no_such_origin_request_policy.NoSuchOriginRequestPolicy: <p>The origin request policy does not exist.</p>
capo_cloudfront.errors.origin_request_policy_in_use.OriginRequestPolicyInUse: <p>Cannot delete the origin request policy because it is attached to one or more cache behaviors.</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.delete_origin_request_policy_request.DeleteOriginRequestPolicyRequest]",
) -> OperationResponse[None]:
import capo_cloudfront._operations.cloudfront2020_05_31.delete_origin_request_policy
output, http_response = (
capo_cloudfront._operations.cloudfront2020_05_31.delete_origin_request_policy.delete_origin_request_policy(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteOriginRequestPolicy")
)
input_: capo_cloudfront.types.delete_origin_request_policy_request.DeleteOriginRequestPolicyRequest = {
"id": id
}
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
|