@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
111 lines • 4.39 kB
JavaScript
;
// *** 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.OriginRequestPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* ## Example Usage
*
* The following example below creates a CloudFront origin request policy.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cloudfront.OriginRequestPolicy("example", {
* name: "example-policy",
* comment: "example comment",
* cookiesConfig: {
* cookieBehavior: "whitelist",
* cookies: {
* items: ["example"],
* },
* },
* headersConfig: {
* headerBehavior: "whitelist",
* headers: {
* items: ["example"],
* },
* },
* queryStringsConfig: {
* queryStringBehavior: "whitelist",
* queryStrings: {
* items: ["example"],
* },
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Cloudfront Origin Request Policies using the `id`. For example:
*
* ```sh
* $ pulumi import aws:cloudfront/originRequestPolicy:OriginRequestPolicy policy ccca32ef-dce3-4df3-80df-1bd3000bc4d3
* ```
*/
class OriginRequestPolicy extends pulumi.CustomResource {
/**
* Get an existing OriginRequestPolicy 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 OriginRequestPolicy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of OriginRequestPolicy. 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'] === OriginRequestPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["comment"] = state?.comment;
resourceInputs["cookiesConfig"] = state?.cookiesConfig;
resourceInputs["etag"] = state?.etag;
resourceInputs["headersConfig"] = state?.headersConfig;
resourceInputs["name"] = state?.name;
resourceInputs["queryStringsConfig"] = state?.queryStringsConfig;
}
else {
const args = argsOrState;
if (args?.cookiesConfig === undefined && !opts.urn) {
throw new Error("Missing required property 'cookiesConfig'");
}
if (args?.headersConfig === undefined && !opts.urn) {
throw new Error("Missing required property 'headersConfig'");
}
if (args?.queryStringsConfig === undefined && !opts.urn) {
throw new Error("Missing required property 'queryStringsConfig'");
}
resourceInputs["comment"] = args?.comment;
resourceInputs["cookiesConfig"] = args?.cookiesConfig;
resourceInputs["headersConfig"] = args?.headersConfig;
resourceInputs["name"] = args?.name;
resourceInputs["queryStringsConfig"] = args?.queryStringsConfig;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OriginRequestPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.OriginRequestPolicy = OriginRequestPolicy;
/** @internal */
OriginRequestPolicy.__pulumiType = 'aws:cloudfront/originRequestPolicy:OriginRequestPolicy';
//# sourceMappingURL=originRequestPolicy.js.map