// generated from terraform resource schema import { Construct } from 'constructs'; import * as cdktf from 'cdktf'; /** * AWS Simple Storage Service */ export interface S3BucketMetricConfig extends cdktf.TerraformMetaArguments { /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/s3_bucket_metric.html#bucket S3BucketMetric#bucket} */ readonly bucket: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/s3_bucket_metric.html#name S3BucketMetric#name} */ readonly name: string; /** * filter block * * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/s3_bucket_metric.html#filter S3BucketMetric#filter} */ readonly filter?: S3BucketMetricFilter; } export interface S3BucketMetricFilter { /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/s3_bucket_metric.html#prefix S3BucketMetric#prefix} */ readonly prefix?: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/s3_bucket_metric.html#tags S3BucketMetric#tags} */ readonly tags?: { [key: string]: string } | cdktf.IResolvable; } export function s3BucketMetricFilterToTerraform(struct?: S3BucketMetricFilterOutputReference | S3BucketMetricFilter): any { if (!cdktf.canInspect(struct)) { return struct; } if (cdktf.isComplexElement(struct)) { throw new Error("A complex element was used as configuration, this is not supported: https://cdk.tf/complex-object-as-configuration"); } return { prefix: cdktf.stringToTerraform(struct!.prefix), tags: cdktf.hashMapper(cdktf.anyToTerraform)(struct!.tags), } } export class S3BucketMetricFilterOutputReference extends cdktf.ComplexObject { private isEmptyObject = false; /** * @param terraformResource The parent resource * @param terraformAttribute The attribute on the parent resource this class is referencing * @param isSingleItem True if this is a block, false if it's a list */ public constructor(terraformResource: cdktf.ITerraformResource, terraformAttribute: string, isSingleItem: boolean) { super(terraformResource, terraformAttribute, isSingleItem); } public get internalValue(): S3BucketMetricFilter | undefined { let hasAnyValues = this.isEmptyObject; const internalValueResult: any = {}; if (this._prefix !== undefined) { hasAnyValues = true; internalValueResult.prefix = this._prefix; } if (this._tags !== undefined) { hasAnyValues = true; internalValueResult.tags = this._tags; } return hasAnyValues ? internalValueResult : undefined; } public set internalValue(value: S3BucketMetricFilter | undefined) { if (value === undefined) { this.isEmptyObject = false; this._prefix = undefined; this._tags = undefined; } else { this.isEmptyObject = Object.keys(value).length === 0; this._prefix = value.prefix; this._tags = value.tags; } } // prefix - computed: false, optional: true, required: false private _prefix?: string; public get prefix() { return this.getStringAttribute('prefix'); } public set prefix(value: string) { this._prefix = value; } public resetPrefix() { this._prefix = undefined; } // Temporarily expose input value. Use with caution. public get prefixInput() { return this._prefix; } // tags - computed: false, optional: true, required: false private _tags?: { [key: string]: string } | cdktf.IResolvable; public get tags() { // Getting the computed value is not yet implemented return this.interpolationForAttribute('tags') as any; } public set tags(value: { [key: string]: string } | cdktf.IResolvable) { this._tags = value; } public resetTags() { this._tags = undefined; } // Temporarily expose input value. Use with caution. public get tagsInput() { return this._tags; } } /** * Represents a {@link https://www.terraform.io/docs/providers/aws/r/s3_bucket_metric.html aws_s3_bucket_metric} */ export class S3BucketMetric extends cdktf.TerraformResource { // ================= // STATIC PROPERTIES // ================= public static readonly tfResourceType: string = "aws_s3_bucket_metric"; // =========== // INITIALIZER // =========== /** * Create a new {@link https://www.terraform.io/docs/providers/aws/r/s3_bucket_metric.html aws_s3_bucket_metric} Resource * * @param scope The scope in which to define this construct * @param id The scoped construct ID. Must be unique amongst siblings in the same scope * @param options S3BucketMetricConfig */ public constructor(scope: Construct, id: string, config: S3BucketMetricConfig) { super(scope, id, { terraformResourceType: 'aws_s3_bucket_metric', terraformGeneratorMetadata: { providerName: 'aws' }, provider: config.provider, dependsOn: config.dependsOn, count: config.count, lifecycle: config.lifecycle }); this._bucket = config.bucket; this._name = config.name; this._filter.internalValue = config.filter; } // ========== // ATTRIBUTES // ========== // bucket - computed: false, optional: false, required: true private _bucket?: string; public get bucket() { return this.getStringAttribute('bucket'); } public set bucket(value: string) { this._bucket = value; } // Temporarily expose input value. Use with caution. public get bucketInput() { return this._bucket; } // id - computed: true, optional: true, required: false public get id() { return this.getStringAttribute('id'); } // name - computed: false, optional: false, required: true private _name?: string; public get name() { return this.getStringAttribute('name'); } public set name(value: string) { this._name = value; } // Temporarily expose input value. Use with caution. public get nameInput() { return this._name; } // filter - computed: false, optional: true, required: false private _filter = new S3BucketMetricFilterOutputReference(this as any, "filter", true); public get filter() { return this._filter; } public putFilter(value: S3BucketMetricFilter) { this._filter.internalValue = value; } public resetFilter() { this._filter.internalValue = undefined; } // Temporarily expose input value. Use with caution. public get filterInput() { return this._filter.internalValue; } // ========= // SYNTHESIS // ========= protected synthesizeAttributes(): { [name: string]: any } { return { bucket: cdktf.stringToTerraform(this._bucket), name: cdktf.stringToTerraform(this._name), filter: s3BucketMetricFilterToTerraform(this._filter.internalValue), }; } }