AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Deletes a cache policy.
You cannot delete a cache policy if it's attached to a cache behavior. First update your distributions to remove the cache policy from all cache behaviors, then delete the cache policy.
To delete a cache policy, you must provide the policy's identifier and version. To
get these values, you can use ListCachePolicies
or GetCachePolicy
.
For .NET Core this operation is only available in asynchronous form. Please refer to DeleteCachePolicyAsync.
Namespace: Amazon.CloudFront
Assembly: AWSSDK.CloudFront.dll
Version: 3.x.y.z
public virtual DeleteCachePolicyResponse DeleteCachePolicy( DeleteCachePolicyRequest request )
Container for the necessary parameters to execute the DeleteCachePolicy service method.
Exception | Condition |
---|---|
AccessDeniedException | Access denied. |
CachePolicyInUseException | Cannot delete the cache policy because it is attached to one or more cache behaviors. |
IllegalDeleteException | Deletion is not allowed for this entity. |
InvalidIfMatchVersionException | The If-Match version is missing or not valid. |
NoSuchCachePolicyException | The cache policy does not exist. |
PreconditionFailedException | The precondition in one or more of the request fields evaluated to false. |
.NET Framework:
Supported in: 4.5 and newer, 3.5