@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
135 lines • 7.59 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.Bucket = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a S3 bucket resource.
*
* > This resource provides functionality for managing S3 general purpose buckets in an AWS Partition. To manage Amazon S3 Express directory buckets, use the `awsDirectoryBucket` resource. To manage [S3 on Outposts](https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html), use the `aws.s3control.Bucket` resource.
*
* > Object Lock can be enabled by using the `objectLockEnable` attribute or by using the `aws.s3.BucketObjectLockConfiguration` resource. Please note, that by using the resource, Object Lock can be enabled/disabled without destroying and recreating the bucket.
*
* ## Example Usage
*
* ### Private Bucket With Tags
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.s3.Bucket("example", {
* bucket: "my-tf-test-bucket",
* tags: {
* Name: "My bucket",
* Environment: "Dev",
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import S3 bucket using the `bucket`. For example:
*
* ```sh
* $ pulumi import aws:s3/bucket:Bucket bucket bucket-name
* ```
*/
class Bucket extends pulumi.CustomResource {
/**
* Get an existing Bucket 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 Bucket(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Bucket. 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'] === Bucket.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accelerationStatus"] = state ? state.accelerationStatus : undefined;
resourceInputs["acl"] = state ? state.acl : undefined;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["bucket"] = state ? state.bucket : undefined;
resourceInputs["bucketDomainName"] = state ? state.bucketDomainName : undefined;
resourceInputs["bucketPrefix"] = state ? state.bucketPrefix : undefined;
resourceInputs["bucketRegion"] = state ? state.bucketRegion : undefined;
resourceInputs["bucketRegionalDomainName"] = state ? state.bucketRegionalDomainName : undefined;
resourceInputs["corsRules"] = state ? state.corsRules : undefined;
resourceInputs["forceDestroy"] = state ? state.forceDestroy : undefined;
resourceInputs["grants"] = state ? state.grants : undefined;
resourceInputs["hostedZoneId"] = state ? state.hostedZoneId : undefined;
resourceInputs["lifecycleRules"] = state ? state.lifecycleRules : undefined;
resourceInputs["logging"] = state ? state.logging : undefined;
resourceInputs["objectLockConfiguration"] = state ? state.objectLockConfiguration : undefined;
resourceInputs["objectLockEnabled"] = state ? state.objectLockEnabled : undefined;
resourceInputs["policy"] = state ? state.policy : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["replicationConfiguration"] = state ? state.replicationConfiguration : undefined;
resourceInputs["requestPayer"] = state ? state.requestPayer : undefined;
resourceInputs["serverSideEncryptionConfiguration"] = state ? state.serverSideEncryptionConfiguration : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["versioning"] = state ? state.versioning : undefined;
resourceInputs["website"] = state ? state.website : undefined;
resourceInputs["websiteDomain"] = state ? state.websiteDomain : undefined;
resourceInputs["websiteEndpoint"] = state ? state.websiteEndpoint : undefined;
}
else {
const args = argsOrState;
resourceInputs["accelerationStatus"] = args ? args.accelerationStatus : undefined;
resourceInputs["acl"] = args ? args.acl : undefined;
resourceInputs["bucket"] = args ? args.bucket : undefined;
resourceInputs["bucketPrefix"] = args ? args.bucketPrefix : undefined;
resourceInputs["corsRules"] = args ? args.corsRules : undefined;
resourceInputs["forceDestroy"] = args ? args.forceDestroy : undefined;
resourceInputs["grants"] = args ? args.grants : undefined;
resourceInputs["lifecycleRules"] = args ? args.lifecycleRules : undefined;
resourceInputs["logging"] = args ? args.logging : undefined;
resourceInputs["objectLockConfiguration"] = args ? args.objectLockConfiguration : undefined;
resourceInputs["objectLockEnabled"] = args ? args.objectLockEnabled : undefined;
resourceInputs["policy"] = args ? args.policy : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["replicationConfiguration"] = args ? args.replicationConfiguration : undefined;
resourceInputs["requestPayer"] = args ? args.requestPayer : undefined;
resourceInputs["serverSideEncryptionConfiguration"] = args ? args.serverSideEncryptionConfiguration : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["versioning"] = args ? args.versioning : undefined;
resourceInputs["website"] = args ? args.website : undefined;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["bucketDomainName"] = undefined /*out*/;
resourceInputs["bucketRegion"] = undefined /*out*/;
resourceInputs["bucketRegionalDomainName"] = undefined /*out*/;
resourceInputs["hostedZoneId"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["websiteDomain"] = undefined /*out*/;
resourceInputs["websiteEndpoint"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "aws:s3/bucketV2:BucketV2" }, { type: "aws:s3/bucketV2:BucketV2" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(Bucket.__pulumiType, name, resourceInputs, opts);
}
}
exports.Bucket = Bucket;
/** @internal */
Bucket.__pulumiType = 'aws:s3/bucket:Bucket';
//# sourceMappingURL=bucket.js.map