@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
111 lines • 4.68 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, Object.assign(Object.assign({}, 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 ? state.arn : undefined;
resourceInputs["comment"] = state ? state.comment : undefined;
resourceInputs["cookiesConfig"] = state ? state.cookiesConfig : undefined;
resourceInputs["etag"] = state ? state.etag : undefined;
resourceInputs["headersConfig"] = state ? state.headersConfig : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["queryStringsConfig"] = state ? state.queryStringsConfig : undefined;
}
else {
const args = argsOrState;
if ((!args || args.cookiesConfig === undefined) && !opts.urn) {
throw new Error("Missing required property 'cookiesConfig'");
}
if ((!args || args.headersConfig === undefined) && !opts.urn) {
throw new Error("Missing required property 'headersConfig'");
}
if ((!args || args.queryStringsConfig === undefined) && !opts.urn) {
throw new Error("Missing required property 'queryStringsConfig'");
}
resourceInputs["comment"] = args ? args.comment : undefined;
resourceInputs["cookiesConfig"] = args ? args.cookiesConfig : undefined;
resourceInputs["headersConfig"] = args ? args.headersConfig : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["queryStringsConfig"] = args ? args.queryStringsConfig : undefined;
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