BucketMetric
Provides a S3 bucket metrics configuration resource.
Example Usage
Add metrics configuration for entire S3 bucket
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.S3.Bucket("example", new Aws.S3.BucketArgs
{
});
var example_entire_bucket = new Aws.S3.BucketMetric("example-entire-bucket", new Aws.S3.BucketMetricArgs
{
Bucket = example.BucketName,
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := s3.NewBucket(ctx, "example", nil)
if err != nil {
return err
}
_, err = s3.NewBucketMetric(ctx, "example_entire_bucket", &s3.BucketMetricArgs{
Bucket: example.Bucket,
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example = aws.s3.Bucket("example")
example_entire_bucket = aws.s3.BucketMetric("example-entire-bucket", bucket=example.bucket)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.s3.Bucket("example", {});
const example_entire_bucket = new aws.s3.BucketMetric("example-entire-bucket", {
bucket: example.bucket,
});Add metrics configuration with S3 bucket object filter
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.S3.Bucket("example", new Aws.S3.BucketArgs
{
});
var example_filtered = new Aws.S3.BucketMetric("example-filtered", new Aws.S3.BucketMetricArgs
{
Bucket = example.BucketName,
Filter = new Aws.S3.Inputs.BucketMetricFilterArgs
{
Prefix = "documents/",
Tags =
{
{ "class", "blue" },
{ "priority", "high" },
},
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := s3.NewBucket(ctx, "example", nil)
if err != nil {
return err
}
_, err = s3.NewBucketMetric(ctx, "example_filtered", &s3.BucketMetricArgs{
Bucket: example.Bucket,
Filter: &s3.BucketMetricFilterArgs{
Prefix: pulumi.String("documents/"),
Tags: pulumi.StringMap{
"class": pulumi.String("blue"),
"priority": pulumi.String("high"),
},
},
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example = aws.s3.Bucket("example")
example_filtered = aws.s3.BucketMetric("example-filtered",
bucket=example.bucket,
filter={
"prefix": "documents/",
"tags": {
"class": "blue",
"priority": "high",
},
})import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.s3.Bucket("example", {});
const example_filtered = new aws.s3.BucketMetric("example-filtered", {
bucket: example.bucket,
filter: {
prefix: "documents/",
tags: {
class: "blue",
priority: "high",
},
},
});Create a BucketMetric Resource
new BucketMetric(name: string, args: BucketMetricArgs, opts?: CustomResourceOptions);def BucketMetric(resource_name, opts=None, bucket=None, filter=None, name=None, __props__=None);func NewBucketMetric(ctx *Context, name string, args BucketMetricArgs, opts ...ResourceOption) (*BucketMetric, error)public BucketMetric(string name, BucketMetricArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args BucketMetricArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args BucketMetricArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args BucketMetricArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
BucketMetric Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The BucketMetric resource accepts the following input properties:
- Bucket string
The name of the bucket to put metric configuration.
- Filter
Bucket
Metric Filter Args Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
- Name string
Unique identifier of the metrics configuration for the bucket.
- Bucket string
The name of the bucket to put metric configuration.
- Filter
Bucket
Metric Filter Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
- Name string
Unique identifier of the metrics configuration for the bucket.
- bucket string
The name of the bucket to put metric configuration.
- filter
Bucket
Metric Filter Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
- name string
Unique identifier of the metrics configuration for the bucket.
- bucket str
The name of the bucket to put metric configuration.
- filter
Dict[Bucket
Metric Filter] Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
- name str
Unique identifier of the metrics configuration for the bucket.
Outputs
All input properties are implicitly available as output properties. Additionally, the BucketMetric resource produces the following output properties:
Look up an Existing BucketMetric Resource
Get an existing BucketMetric resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: BucketMetricState, opts?: CustomResourceOptions): BucketMetricstatic get(resource_name, id, opts=None, bucket=None, filter=None, name=None, __props__=None);func GetBucketMetric(ctx *Context, name string, id IDInput, state *BucketMetricState, opts ...ResourceOption) (*BucketMetric, error)public static BucketMetric Get(string name, Input<string> id, BucketMetricState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Bucket string
The name of the bucket to put metric configuration.
- Filter
Bucket
Metric Filter Args Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
- Name string
Unique identifier of the metrics configuration for the bucket.
- Bucket string
The name of the bucket to put metric configuration.
- Filter
Bucket
Metric Filter Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
- Name string
Unique identifier of the metrics configuration for the bucket.
- bucket string
The name of the bucket to put metric configuration.
- filter
Bucket
Metric Filter Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
- name string
Unique identifier of the metrics configuration for the bucket.
- bucket str
The name of the bucket to put metric configuration.
- filter
Dict[Bucket
Metric Filter] Object filtering that accepts a prefix, tags, or a logical AND of prefix and tags (documented below).
- name str
Unique identifier of the metrics configuration for the bucket.
Supporting Types
BucketMetricFilter
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.