// generated from terraform resource schema import { Construct } from 'constructs'; import * as cdktf from 'cdktf'; /** * AWS Timestream Write */ export interface TimestreamwriteTableConfig extends cdktf.TerraformMetaArguments { /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/timestreamwrite_table.html#database_name TimestreamwriteTable#database_name} */ readonly databaseName: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/timestreamwrite_table.html#table_name TimestreamwriteTable#table_name} */ readonly tableName: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/timestreamwrite_table.html#tags TimestreamwriteTable#tags} */ readonly tags?: { [key: string]: string } | cdktf.IResolvable; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/timestreamwrite_table.html#tags_all TimestreamwriteTable#tags_all} */ readonly tagsAll?: { [key: string]: string } | cdktf.IResolvable; /** * retention_properties block * * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/timestreamwrite_table.html#retention_properties TimestreamwriteTable#retention_properties} */ readonly retentionProperties?: TimestreamwriteTableRetentionProperties; } export interface TimestreamwriteTableRetentionProperties { /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/timestreamwrite_table.html#magnetic_store_retention_period_in_days TimestreamwriteTable#magnetic_store_retention_period_in_days} */ readonly magneticStoreRetentionPeriodInDays: number; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/timestreamwrite_table.html#memory_store_retention_period_in_hours TimestreamwriteTable#memory_store_retention_period_in_hours} */ readonly memoryStoreRetentionPeriodInHours: number; } export function timestreamwriteTableRetentionPropertiesToTerraform(struct?: TimestreamwriteTableRetentionPropertiesOutputReference | TimestreamwriteTableRetentionProperties): 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 { magnetic_store_retention_period_in_days: cdktf.numberToTerraform(struct!.magneticStoreRetentionPeriodInDays), memory_store_retention_period_in_hours: cdktf.numberToTerraform(struct!.memoryStoreRetentionPeriodInHours), } } export class TimestreamwriteTableRetentionPropertiesOutputReference 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(): TimestreamwriteTableRetentionProperties | undefined { let hasAnyValues = this.isEmptyObject; const internalValueResult: any = {}; if (this._magneticStoreRetentionPeriodInDays !== undefined) { hasAnyValues = true; internalValueResult.magneticStoreRetentionPeriodInDays = this._magneticStoreRetentionPeriodInDays; } if (this._memoryStoreRetentionPeriodInHours !== undefined) { hasAnyValues = true; internalValueResult.memoryStoreRetentionPeriodInHours = this._memoryStoreRetentionPeriodInHours; } return hasAnyValues ? internalValueResult : undefined; } public set internalValue(value: TimestreamwriteTableRetentionProperties | undefined) { if (value === undefined) { this.isEmptyObject = false; this._magneticStoreRetentionPeriodInDays = undefined; this._memoryStoreRetentionPeriodInHours = undefined; } else { this.isEmptyObject = Object.keys(value).length === 0; this._magneticStoreRetentionPeriodInDays = value.magneticStoreRetentionPeriodInDays; this._memoryStoreRetentionPeriodInHours = value.memoryStoreRetentionPeriodInHours; } } // magnetic_store_retention_period_in_days - computed: false, optional: false, required: true private _magneticStoreRetentionPeriodInDays?: number; public get magneticStoreRetentionPeriodInDays() { return this.getNumberAttribute('magnetic_store_retention_period_in_days'); } public set magneticStoreRetentionPeriodInDays(value: number) { this._magneticStoreRetentionPeriodInDays = value; } // Temporarily expose input value. Use with caution. public get magneticStoreRetentionPeriodInDaysInput() { return this._magneticStoreRetentionPeriodInDays; } // memory_store_retention_period_in_hours - computed: false, optional: false, required: true private _memoryStoreRetentionPeriodInHours?: number; public get memoryStoreRetentionPeriodInHours() { return this.getNumberAttribute('memory_store_retention_period_in_hours'); } public set memoryStoreRetentionPeriodInHours(value: number) { this._memoryStoreRetentionPeriodInHours = value; } // Temporarily expose input value. Use with caution. public get memoryStoreRetentionPeriodInHoursInput() { return this._memoryStoreRetentionPeriodInHours; } } /** * Represents a {@link https://www.terraform.io/docs/providers/aws/r/timestreamwrite_table.html aws_timestreamwrite_table} */ export class TimestreamwriteTable extends cdktf.TerraformResource { // ================= // STATIC PROPERTIES // ================= public static readonly tfResourceType: string = "aws_timestreamwrite_table"; // =========== // INITIALIZER // =========== /** * Create a new {@link https://www.terraform.io/docs/providers/aws/r/timestreamwrite_table.html aws_timestreamwrite_table} 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 TimestreamwriteTableConfig */ public constructor(scope: Construct, id: string, config: TimestreamwriteTableConfig) { super(scope, id, { terraformResourceType: 'aws_timestreamwrite_table', terraformGeneratorMetadata: { providerName: 'aws' }, provider: config.provider, dependsOn: config.dependsOn, count: config.count, lifecycle: config.lifecycle }); this._databaseName = config.databaseName; this._tableName = config.tableName; this._tags = config.tags; this._tagsAll = config.tagsAll; this._retentionProperties.internalValue = config.retentionProperties; } // ========== // ATTRIBUTES // ========== // arn - computed: true, optional: false, required: false public get arn() { return this.getStringAttribute('arn'); } // database_name - computed: false, optional: false, required: true private _databaseName?: string; public get databaseName() { return this.getStringAttribute('database_name'); } public set databaseName(value: string) { this._databaseName = value; } // Temporarily expose input value. Use with caution. public get databaseNameInput() { return this._databaseName; } // id - computed: true, optional: true, required: false public get id() { return this.getStringAttribute('id'); } // table_name - computed: false, optional: false, required: true private _tableName?: string; public get tableName() { return this.getStringAttribute('table_name'); } public set tableName(value: string) { this._tableName = value; } // Temporarily expose input value. Use with caution. public get tableNameInput() { return this._tableName; } // 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; } // tags_all - computed: true, optional: true, required: false private _tagsAll?: { [key: string]: string } | cdktf.IResolvable; public get tagsAll() { // Getting the computed value is not yet implemented return this.interpolationForAttribute('tags_all') as any; } public set tagsAll(value: { [key: string]: string } | cdktf.IResolvable) { this._tagsAll = value; } public resetTagsAll() { this._tagsAll = undefined; } // Temporarily expose input value. Use with caution. public get tagsAllInput() { return this._tagsAll; } // retention_properties - computed: false, optional: true, required: false private _retentionProperties = new TimestreamwriteTableRetentionPropertiesOutputReference(this as any, "retention_properties", true); public get retentionProperties() { return this._retentionProperties; } public putRetentionProperties(value: TimestreamwriteTableRetentionProperties) { this._retentionProperties.internalValue = value; } public resetRetentionProperties() { this._retentionProperties.internalValue = undefined; } // Temporarily expose input value. Use with caution. public get retentionPropertiesInput() { return this._retentionProperties.internalValue; } // ========= // SYNTHESIS // ========= protected synthesizeAttributes(): { [name: string]: any } { return { database_name: cdktf.stringToTerraform(this._databaseName), table_name: cdktf.stringToTerraform(this._tableName), tags: cdktf.hashMapper(cdktf.anyToTerraform)(this._tags), tags_all: cdktf.hashMapper(cdktf.anyToTerraform)(this._tagsAll), retention_properties: timestreamwriteTableRetentionPropertiesToTerraform(this._retentionProperties.internalValue), }; } }