AWS SDK Version 3 for .NET
API Reference

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.

Note:

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

Syntax

C#
public abstract DeleteCachePolicyResponse DeleteCachePolicy(
         DeleteCachePolicyRequest request
)

Parameters

request
Type: Amazon.CloudFront.Model.DeleteCachePolicyRequest

Container for the necessary parameters to execute the DeleteCachePolicy service method.

Return Value


The response from the DeleteCachePolicy service method, as returned by CloudFront.

Exceptions

ExceptionCondition
AccessDeniedException Access denied.
CachePolicyInUseException Cannot delete the cache policy because it is attached to one or more cache behaviors.
IllegalDeleteException You cannot delete a managed policy.
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.

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

See Also