createCachePolicy2020_05_31 method
Future<CreateCachePolicyResult>
createCachePolicy2020_05_31({
- required CachePolicyConfig cachePolicyConfig,
Creates a cache policy.
After you create a cache policy, you can attach it to one or more cache behaviors. When it’s attached to a cache behavior, the cache policy determines the following:
- The values that CloudFront includes in the cache key. These values can include HTTP headers, cookies, and URL query strings. CloudFront uses the cache key to find an object in its cache that it can return to the viewer.
- The default, minimum, and maximum time to live (TTL) values that you want objects to stay in the CloudFront cache.
OriginRequestPolicy
.
For more information about cache policies, see Controlling the cache key in the Amazon CloudFront Developer Guide.
May throw AccessDenied. May throw InconsistentQuantities. May throw InvalidArgument. May throw CachePolicyAlreadyExists. May throw TooManyCachePolicies. May throw TooManyHeadersInCachePolicy. May throw TooManyCookiesInCachePolicy. May throw TooManyQueryStringsInCachePolicy.
Parameter cachePolicyConfig
:
A cache policy configuration.
Implementation
Future<CreateCachePolicyResult> createCachePolicy2020_05_31({
required CachePolicyConfig cachePolicyConfig,
}) async {
ArgumentError.checkNotNull(cachePolicyConfig, 'cachePolicyConfig');
final $result = await _protocol.sendRaw(
method: 'POST',
requestUri: '/2020-05-31/cache-policy',
payload: cachePolicyConfig.toXml('CachePolicyConfig'),
exceptionFnMap: _exceptionFns,
);
final $elem = await _s.xmlFromResponse($result);
return CreateCachePolicyResult(
cachePolicy: CachePolicy.fromXml($elem),
eTag: _s.extractHeaderStringValue($result.headers, 'ETag'),
location: _s.extractHeaderStringValue($result.headers, 'Location'),
);
}