@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
119 lines • 6.29 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.BucketObjectLockConfigurationV2 = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an S3 bucket Object Lock configuration resource. For more information about Object Locking, go to [Using S3 Object Lock](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html) in the Amazon S3 User Guide.
*
* > This resource can be used enable Object Lock for **new** and **existing** buckets.
*
* > This resource cannot be used with S3 directory buckets.
*
* ## Example Usage
*
* ### Object Lock configuration for new or existing buckets
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.s3.Bucket("example", {bucket: "mybucket"});
* const exampleBucketVersioning = new aws.s3.BucketVersioning("example", {
* bucket: example.id,
* versioningConfiguration: {
* status: "Enabled",
* },
* });
* const exampleBucketObjectLockConfiguration = new aws.s3.BucketObjectLockConfiguration("example", {
* bucket: example.id,
* rule: {
* defaultRetention: {
* mode: "COMPLIANCE",
* days: 5,
* },
* },
* });
* ```
*
* ## Import
*
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner`, separated by a comma (`,`). For example:
*
* __Using `pulumi import`__, import an S3 bucket Object Lock Configuration using one of two forms. If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, import using the `bucket`. For example:
*
* ```sh
* $ pulumi import aws:s3/bucketObjectLockConfigurationV2:BucketObjectLockConfigurationV2 example bucket-name
* ```
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner`, separated by a comma (`,`). For example:
*
* ```sh
* $ pulumi import aws:s3/bucketObjectLockConfigurationV2:BucketObjectLockConfigurationV2 example bucket-name,123456789012
* ```
*
* @deprecated aws.s3/bucketobjectlockconfigurationv2.BucketObjectLockConfigurationV2 has been deprecated in favor of aws.s3/bucketobjectlockconfiguration.BucketObjectLockConfiguration
*/
class BucketObjectLockConfigurationV2 extends pulumi.CustomResource {
/**
* Get an existing BucketObjectLockConfigurationV2 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) {
pulumi.log.warn("BucketObjectLockConfigurationV2 is deprecated: aws.s3/bucketobjectlockconfigurationv2.BucketObjectLockConfigurationV2 has been deprecated in favor of aws.s3/bucketobjectlockconfiguration.BucketObjectLockConfiguration");
return new BucketObjectLockConfigurationV2(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of BucketObjectLockConfigurationV2. 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'] === BucketObjectLockConfigurationV2.__pulumiType;
}
/** @deprecated aws.s3/bucketobjectlockconfigurationv2.BucketObjectLockConfigurationV2 has been deprecated in favor of aws.s3/bucketobjectlockconfiguration.BucketObjectLockConfiguration */
constructor(name, argsOrState, opts) {
pulumi.log.warn("BucketObjectLockConfigurationV2 is deprecated: aws.s3/bucketobjectlockconfigurationv2.BucketObjectLockConfigurationV2 has been deprecated in favor of aws.s3/bucketobjectlockconfiguration.BucketObjectLockConfiguration");
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["bucket"] = state?.bucket;
resourceInputs["expectedBucketOwner"] = state?.expectedBucketOwner;
resourceInputs["objectLockEnabled"] = state?.objectLockEnabled;
resourceInputs["region"] = state?.region;
resourceInputs["rule"] = state?.rule;
resourceInputs["token"] = state?.token;
}
else {
const args = argsOrState;
if (args?.bucket === undefined && !opts.urn) {
throw new Error("Missing required property 'bucket'");
}
resourceInputs["bucket"] = args?.bucket;
resourceInputs["expectedBucketOwner"] = args?.expectedBucketOwner;
resourceInputs["objectLockEnabled"] = args?.objectLockEnabled;
resourceInputs["region"] = args?.region;
resourceInputs["rule"] = args?.rule;
resourceInputs["token"] = args?.token ? pulumi.secret(args.token) : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "aws:s3/bucketObjectLockConfigurationV2:BucketObjectLockConfigurationV2" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
const secretOpts = { additionalSecretOutputs: ["token"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(BucketObjectLockConfigurationV2.__pulumiType, name, resourceInputs, opts);
}
}
exports.BucketObjectLockConfigurationV2 = BucketObjectLockConfigurationV2;
/** @internal */
BucketObjectLockConfigurationV2.__pulumiType = 'aws:s3/bucketObjectLockConfigurationV2:BucketObjectLockConfigurationV2';
//# sourceMappingURL=bucketObjectLockConfigurationV2.js.map