@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
158 lines • 6.22 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.ResponseHeadersPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a CloudFront response headers policy resource.
* A response headers policy contains information about a set of HTTP response headers and their values.
* After you create a response headers policy, you can use its ID to attach it to one or more cache behaviors in a CloudFront distribution.
* When it’s attached to a cache behavior, CloudFront adds the headers in the policy to every response that it sends for requests that match the cache behavior.
*
* ## Example Usage
*
* The example below creates a CloudFront response headers policy.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cloudfront.ResponseHeadersPolicy("example", {
* name: "example-policy",
* comment: "test comment",
* corsConfig: {
* accessControlAllowCredentials: true,
* accessControlAllowHeaders: {
* items: ["test"],
* },
* accessControlAllowMethods: {
* items: ["GET"],
* },
* accessControlAllowOrigins: {
* items: ["test.example.comtest"],
* },
* originOverride: true,
* },
* });
* ```
*
* The example below creates a CloudFront response headers policy with a custom headers config.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cloudfront.ResponseHeadersPolicy("example", {
* name: "example-headers-policy",
* customHeadersConfig: {
* items: [
* {
* header: "X-Permitted-Cross-Domain-Policies",
* override: true,
* value: "none",
* },
* {
* header: "X-Test",
* override: true,
* value: "none",
* },
* ],
* },
* });
* ```
*
* The example below creates a CloudFront response headers policy with a custom headers config, remove headers config and server timing headers config.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cloudfront.ResponseHeadersPolicy("example", {
* name: "example-headers-policy",
* customHeadersConfig: {
* items: [{
* header: "X-Permitted-Cross-Domain-Policies",
* override: true,
* value: "none",
* }],
* },
* removeHeadersConfig: {
* items: [{
* header: "Set-Cookie",
* }],
* },
* serverTimingHeadersConfig: {
* enabled: true,
* samplingRate: 50,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Cloudfront Response Headers Policies using the `id`. For example:
*
* ```sh
* $ pulumi import aws:cloudfront/responseHeadersPolicy:ResponseHeadersPolicy policy 658327ea-f89d-4fab-a63d-7e88639e58f9
* ```
*/
class ResponseHeadersPolicy extends pulumi.CustomResource {
/**
* Get an existing ResponseHeadersPolicy 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 ResponseHeadersPolicy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ResponseHeadersPolicy. 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'] === ResponseHeadersPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["comment"] = state?.comment;
resourceInputs["corsConfig"] = state?.corsConfig;
resourceInputs["customHeadersConfig"] = state?.customHeadersConfig;
resourceInputs["etag"] = state?.etag;
resourceInputs["name"] = state?.name;
resourceInputs["removeHeadersConfig"] = state?.removeHeadersConfig;
resourceInputs["securityHeadersConfig"] = state?.securityHeadersConfig;
resourceInputs["serverTimingHeadersConfig"] = state?.serverTimingHeadersConfig;
}
else {
const args = argsOrState;
resourceInputs["comment"] = args?.comment;
resourceInputs["corsConfig"] = args?.corsConfig;
resourceInputs["customHeadersConfig"] = args?.customHeadersConfig;
resourceInputs["name"] = args?.name;
resourceInputs["removeHeadersConfig"] = args?.removeHeadersConfig;
resourceInputs["securityHeadersConfig"] = args?.securityHeadersConfig;
resourceInputs["serverTimingHeadersConfig"] = args?.serverTimingHeadersConfig;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ResponseHeadersPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.ResponseHeadersPolicy = ResponseHeadersPolicy;
/** @internal */
ResponseHeadersPolicy.__pulumiType = 'aws:cloudfront/responseHeadersPolicy:ResponseHeadersPolicy';
//# sourceMappingURL=responseHeadersPolicy.js.map