@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
100 lines • 4.41 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.OriginAccessControl = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an AWS CloudFront Origin Access Control, which is used by CloudFront Distributions with an Amazon S3 bucket as the origin.
*
* Read more about Origin Access Control in the [CloudFront Developer Guide](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html).
*
* ## Example Usage
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.cloudfront.OriginAccessControl("example", {
* name: "example",
* description: "Example Policy",
* originAccessControlOriginType: "s3",
* signingBehavior: "always",
* signingProtocol: "sigv4",
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import CloudFront Origin Access Control using the `id`. For example:
*
* ```sh
* $ pulumi import aws:cloudfront/originAccessControl:OriginAccessControl example E327GJI25M56DG
* ```
*/
class OriginAccessControl extends pulumi.CustomResource {
/**
* Get an existing OriginAccessControl 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 OriginAccessControl(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of OriginAccessControl. 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'] === OriginAccessControl.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["description"] = state?.description;
resourceInputs["etag"] = state?.etag;
resourceInputs["name"] = state?.name;
resourceInputs["originAccessControlOriginType"] = state?.originAccessControlOriginType;
resourceInputs["signingBehavior"] = state?.signingBehavior;
resourceInputs["signingProtocol"] = state?.signingProtocol;
}
else {
const args = argsOrState;
if (args?.originAccessControlOriginType === undefined && !opts.urn) {
throw new Error("Missing required property 'originAccessControlOriginType'");
}
if (args?.signingBehavior === undefined && !opts.urn) {
throw new Error("Missing required property 'signingBehavior'");
}
if (args?.signingProtocol === undefined && !opts.urn) {
throw new Error("Missing required property 'signingProtocol'");
}
resourceInputs["description"] = args?.description;
resourceInputs["name"] = args?.name;
resourceInputs["originAccessControlOriginType"] = args?.originAccessControlOriginType;
resourceInputs["signingBehavior"] = args?.signingBehavior;
resourceInputs["signingProtocol"] = args?.signingProtocol;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OriginAccessControl.__pulumiType, name, resourceInputs, opts);
}
}
exports.OriginAccessControl = OriginAccessControl;
/** @internal */
OriginAccessControl.__pulumiType = 'aws:cloudfront/originAccessControl:OriginAccessControl';
//# sourceMappingURL=originAccessControl.js.map
;