UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

112 lines 4.36 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.CachePolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * Use the `aws.cloudfront.CachePolicy` resource to create a cache policy for CloudFront. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.cloudfront.CachePolicy("example", { * name: "example-policy", * comment: "test comment", * defaultTtl: 50, * maxTtl: 100, * minTtl: 1, * parametersInCacheKeyAndForwardedToOrigin: { * cookiesConfig: { * cookieBehavior: "whitelist", * cookies: { * items: ["example"], * }, * }, * headersConfig: { * headerBehavior: "whitelist", * headers: { * items: ["example"], * }, * }, * queryStringsConfig: { * queryStringBehavior: "whitelist", * queryStrings: { * items: ["example"], * }, * }, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import CloudFront cache policies using the `id` of the cache policy. For example: * * ```sh * $ pulumi import aws:cloudfront/cachePolicy:CachePolicy policy 658327ea-f89d-4fab-a63d-7e88639e58f6 * ``` */ class CachePolicy extends pulumi.CustomResource { /** * Get an existing CachePolicy resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new CachePolicy(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of CachePolicy. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === CachePolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["comment"] = state?.comment; resourceInputs["defaultTtl"] = state?.defaultTtl; resourceInputs["etag"] = state?.etag; resourceInputs["maxTtl"] = state?.maxTtl; resourceInputs["minTtl"] = state?.minTtl; resourceInputs["name"] = state?.name; resourceInputs["parametersInCacheKeyAndForwardedToOrigin"] = state?.parametersInCacheKeyAndForwardedToOrigin; } else { const args = argsOrState; if (args?.parametersInCacheKeyAndForwardedToOrigin === undefined && !opts.urn) { throw new Error("Missing required property 'parametersInCacheKeyAndForwardedToOrigin'"); } resourceInputs["comment"] = args?.comment; resourceInputs["defaultTtl"] = args?.defaultTtl; resourceInputs["maxTtl"] = args?.maxTtl; resourceInputs["minTtl"] = args?.minTtl; resourceInputs["name"] = args?.name; resourceInputs["parametersInCacheKeyAndForwardedToOrigin"] = args?.parametersInCacheKeyAndForwardedToOrigin; resourceInputs["arn"] = undefined /*out*/; resourceInputs["etag"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(CachePolicy.__pulumiType, name, resourceInputs, opts); } } exports.CachePolicy = CachePolicy; /** @internal */ CachePolicy.__pulumiType = 'aws:cloudfront/cachePolicy:CachePolicy'; //# sourceMappingURL=cachePolicy.js.map