@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
130 lines • 4.6 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.BucketMetric = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a S3 bucket [metrics configuration](http://docs.aws.amazon.com/AmazonS3/latest/dev/metrics-configurations.html) resource.
*
* > This resource cannot be used with S3 directory buckets.
*
* ## Example Usage
*
* ### Add metrics configuration for entire S3 bucket
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.s3.Bucket("example", {bucket: "example"});
* const example_entire_bucket = new aws.s3.BucketMetric("example-entire-bucket", {
* bucket: example.id,
* name: "EntireBucket",
* });
* ```
*
* ### Add metrics configuration with S3 object filter
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.s3.Bucket("example", {bucket: "example"});
* const example_filtered = new aws.s3.BucketMetric("example-filtered", {
* bucket: example.id,
* name: "ImportantBlueDocuments",
* filter: {
* prefix: "documents/",
* tags: {
* priority: "high",
* "class": "blue",
* },
* },
* });
* ```
*
* ### Add metrics configuration with S3 object filter for S3 Access Point
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.s3.Bucket("example", {bucket: "example"});
* const example_access_point = new aws.s3.AccessPoint("example-access-point", {
* bucket: example.id,
* name: "example-access-point",
* });
* const example_filtered = new aws.s3.BucketMetric("example-filtered", {
* bucket: example.id,
* name: "ImportantBlueDocuments",
* filter: {
* accessPoint: example_access_point.arn,
* tags: {
* priority: "high",
* "class": "blue",
* },
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import S3 bucket metric configurations using `bucket:metric`. For example:
*
* ```sh
* $ pulumi import aws:s3/bucketMetric:BucketMetric my-bucket-entire-bucket my-bucket:EntireBucket
* ```
*/
class BucketMetric extends pulumi.CustomResource {
/**
* Get an existing BucketMetric 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 BucketMetric(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of BucketMetric. 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'] === BucketMetric.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["bucket"] = state?.bucket;
resourceInputs["filter"] = state?.filter;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
}
else {
const args = argsOrState;
if (args?.bucket === undefined && !opts.urn) {
throw new Error("Missing required property 'bucket'");
}
resourceInputs["bucket"] = args?.bucket;
resourceInputs["filter"] = args?.filter;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(BucketMetric.__pulumiType, name, resourceInputs, opts);
}
}
exports.BucketMetric = BucketMetric;
/** @internal */
BucketMetric.__pulumiType = 'aws:s3/bucketMetric:BucketMetric';
//# sourceMappingURL=bucketMetric.js.map
;