import { Command as $Command } from "@smithy/smithy-client"; import { MetadataBearer as __MetadataBearer } from "@smithy/types"; import { CloudFrontClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudFrontClient"; import { CreateCachePolicyRequest, CreateCachePolicyResult } from "../models/models_0"; /** * @public */ export type { __MetadataBearer }; export { $Command }; /** * @public * * The input for {@link CreateCachePolicyCommand}. */ export interface CreateCachePolicyCommandInput extends CreateCachePolicyRequest { } /** * @public * * The output of {@link CreateCachePolicyCommand}. */ export interface CreateCachePolicyCommandOutput extends CreateCachePolicyResult, __MetadataBearer { } declare const CreateCachePolicyCommand_base: { new (input: CreateCachePolicyCommandInput): import("@smithy/smithy-client").CommandImpl; new (input: CreateCachePolicyCommandInput): import("@smithy/smithy-client").CommandImpl; getEndpointParameterInstructions(): import("@smithy/middleware-endpoint").EndpointParameterInstructions; }; /** *

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 headers, cookies, and query strings that are included in the cache key are also included in requests that CloudFront sends to the origin. CloudFront sends a request when it can't find an object in its cache that matches the request's cache key. If you want to send values to the origin but not include them in the cache key, use OriginRequestPolicy.

For more information about cache policies, see Controlling the cache key in the Amazon CloudFront Developer Guide.

* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript * import { CloudFrontClient, CreateCachePolicyCommand } from "@aws-sdk/client-cloudfront"; // ES Modules import * // const { CloudFrontClient, CreateCachePolicyCommand } = require("@aws-sdk/client-cloudfront"); // CommonJS import * const client = new CloudFrontClient(config); * const input = { // CreateCachePolicyRequest * CachePolicyConfig: { // CachePolicyConfig * Comment: "STRING_VALUE", * Name: "STRING_VALUE", // required * DefaultTTL: Number("long"), * MaxTTL: Number("long"), * MinTTL: Number("long"), // required * ParametersInCacheKeyAndForwardedToOrigin: { // ParametersInCacheKeyAndForwardedToOrigin * EnableAcceptEncodingGzip: true || false, // required * EnableAcceptEncodingBrotli: true || false, * HeadersConfig: { // CachePolicyHeadersConfig * HeaderBehavior: "none" || "whitelist", // required * Headers: { // Headers * Quantity: Number("int"), // required * Items: [ // HeaderList * "STRING_VALUE", * ], * }, * }, * CookiesConfig: { // CachePolicyCookiesConfig * CookieBehavior: "none" || "whitelist" || "allExcept" || "all", // required * Cookies: { // CookieNames * Quantity: Number("int"), // required * Items: [ // CookieNameList * "STRING_VALUE", * ], * }, * }, * QueryStringsConfig: { // CachePolicyQueryStringsConfig * QueryStringBehavior: "none" || "whitelist" || "allExcept" || "all", // required * QueryStrings: { // QueryStringNames * Quantity: Number("int"), // required * Items: [ // QueryStringNamesList * "STRING_VALUE", * ], * }, * }, * }, * }, * }; * const command = new CreateCachePolicyCommand(input); * const response = await client.send(command); * // { // CreateCachePolicyResult * // CachePolicy: { // CachePolicy * // Id: "STRING_VALUE", // required * // LastModifiedTime: new Date("TIMESTAMP"), // required * // CachePolicyConfig: { // CachePolicyConfig * // Comment: "STRING_VALUE", * // Name: "STRING_VALUE", // required * // DefaultTTL: Number("long"), * // MaxTTL: Number("long"), * // MinTTL: Number("long"), // required * // ParametersInCacheKeyAndForwardedToOrigin: { // ParametersInCacheKeyAndForwardedToOrigin * // EnableAcceptEncodingGzip: true || false, // required * // EnableAcceptEncodingBrotli: true || false, * // HeadersConfig: { // CachePolicyHeadersConfig * // HeaderBehavior: "none" || "whitelist", // required * // Headers: { // Headers * // Quantity: Number("int"), // required * // Items: [ // HeaderList * // "STRING_VALUE", * // ], * // }, * // }, * // CookiesConfig: { // CachePolicyCookiesConfig * // CookieBehavior: "none" || "whitelist" || "allExcept" || "all", // required * // Cookies: { // CookieNames * // Quantity: Number("int"), // required * // Items: [ // CookieNameList * // "STRING_VALUE", * // ], * // }, * // }, * // QueryStringsConfig: { // CachePolicyQueryStringsConfig * // QueryStringBehavior: "none" || "whitelist" || "allExcept" || "all", // required * // QueryStrings: { // QueryStringNames * // Quantity: Number("int"), // required * // Items: [ // QueryStringNamesList * // "STRING_VALUE", * // ], * // }, * // }, * // }, * // }, * // }, * // Location: "STRING_VALUE", * // ETag: "STRING_VALUE", * // }; * * ``` * * @param CreateCachePolicyCommandInput - {@link CreateCachePolicyCommandInput} * @returns {@link CreateCachePolicyCommandOutput} * @see {@link CreateCachePolicyCommandInput} for command's `input` shape. * @see {@link CreateCachePolicyCommandOutput} for command's `response` shape. * @see {@link CloudFrontClientResolvedConfig | config} for CloudFrontClient's `config` shape. * * @throws {@link AccessDenied} (client fault) *

Access denied.

* * @throws {@link CachePolicyAlreadyExists} (client fault) *

A cache policy with this name already exists. You must provide a unique name. To modify an existing cache policy, use UpdateCachePolicy.

* * @throws {@link InconsistentQuantities} (client fault) *

The value of Quantity and the size of Items don't match.

* * @throws {@link InvalidArgument} (client fault) *

An argument is invalid.

* * @throws {@link TooManyCachePolicies} (client fault) *

You have reached the maximum number of cache policies for this Amazon Web Services account. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.

* * @throws {@link TooManyCookiesInCachePolicy} (client fault) *

The number of cookies in the cache policy exceeds the maximum. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.

* * @throws {@link TooManyHeadersInCachePolicy} (client fault) *

The number of headers in the cache policy exceeds the maximum. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.

* * @throws {@link TooManyQueryStringsInCachePolicy} (client fault) *

The number of query strings in the cache policy exceeds the maximum. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.

* * @throws {@link CloudFrontServiceException} *

Base exception class for all service exceptions from CloudFront service.

* * * @public */ export declare class CreateCachePolicyCommand extends CreateCachePolicyCommand_base { /** @internal type navigation helper, not in runtime. */ protected static __types: { api: { input: CreateCachePolicyRequest; output: CreateCachePolicyResult; }; sdk: { input: CreateCachePolicyCommandInput; output: CreateCachePolicyCommandOutput; }; }; }