UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

144 lines 5.49 kB
"use strict"; // *** 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.Inventory = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a S3 bucket [inventory configuration](https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) resource. * * > This resource cannot be used with S3 directory buckets. * * ## Example Usage * * ### Add inventory configuration * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const test = new aws.s3.Bucket("test", {bucket: "my-tf-test-bucket"}); * const inventory = new aws.s3.Bucket("inventory", {bucket: "my-tf-inventory-bucket"}); * const testInventory = new aws.s3.Inventory("test", { * bucket: test.id, * name: "EntireBucketDaily", * includedObjectVersions: "All", * schedule: { * frequency: "Daily", * }, * destination: { * bucket: { * format: "ORC", * bucketArn: inventory.arn, * }, * }, * }); * ``` * * ### Add inventory configuration with S3 object prefix * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const test = new aws.s3.Bucket("test", {bucket: "my-tf-test-bucket"}); * const inventory = new aws.s3.Bucket("inventory", {bucket: "my-tf-inventory-bucket"}); * const test_prefix = new aws.s3.Inventory("test-prefix", { * bucket: test.id, * name: "DocumentsWeekly", * includedObjectVersions: "All", * schedule: { * frequency: "Daily", * }, * filter: { * prefix: "documents/", * }, * destination: { * bucket: { * format: "ORC", * bucketArn: inventory.arn, * prefix: "inventory", * }, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import S3 bucket inventory configurations using `bucket:inventory`. For example: * * ```sh * $ pulumi import aws:s3/inventory:Inventory my-bucket-entire-bucket my-bucket:EntireBucket * ``` */ class Inventory extends pulumi.CustomResource { /** * Get an existing Inventory 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 Inventory(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Inventory. 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'] === Inventory.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["bucket"] = state?.bucket; resourceInputs["destination"] = state?.destination; resourceInputs["enabled"] = state?.enabled; resourceInputs["filter"] = state?.filter; resourceInputs["includedObjectVersions"] = state?.includedObjectVersions; resourceInputs["name"] = state?.name; resourceInputs["optionalFields"] = state?.optionalFields; resourceInputs["region"] = state?.region; resourceInputs["schedule"] = state?.schedule; } else { const args = argsOrState; if (args?.bucket === undefined && !opts.urn) { throw new Error("Missing required property 'bucket'"); } if (args?.destination === undefined && !opts.urn) { throw new Error("Missing required property 'destination'"); } if (args?.includedObjectVersions === undefined && !opts.urn) { throw new Error("Missing required property 'includedObjectVersions'"); } if (args?.schedule === undefined && !opts.urn) { throw new Error("Missing required property 'schedule'"); } resourceInputs["bucket"] = args?.bucket; resourceInputs["destination"] = args?.destination; resourceInputs["enabled"] = args?.enabled; resourceInputs["filter"] = args?.filter; resourceInputs["includedObjectVersions"] = args?.includedObjectVersions; resourceInputs["name"] = args?.name; resourceInputs["optionalFields"] = args?.optionalFields; resourceInputs["region"] = args?.region; resourceInputs["schedule"] = args?.schedule; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Inventory.__pulumiType, name, resourceInputs, opts); } } exports.Inventory = Inventory; /** @internal */ Inventory.__pulumiType = 'aws:s3/inventory:Inventory'; //# sourceMappingURL=inventory.js.map