// generated from terraform resource schema import { Construct } from 'constructs'; import * as cdktf from 'cdktf'; /** * AWS CloudWatch Event Bridge */ export interface CloudwatchEventPermissionConfig extends cdktf.TerraformMetaArguments { /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html#action CloudwatchEventPermission#action} */ readonly action?: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html#event_bus_name CloudwatchEventPermission#event_bus_name} */ readonly eventBusName?: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html#principal CloudwatchEventPermission#principal} */ readonly principal: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html#statement_id CloudwatchEventPermission#statement_id} */ readonly statementId: string; /** * condition block * * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html#condition CloudwatchEventPermission#condition} */ readonly condition?: CloudwatchEventPermissionCondition; } export interface CloudwatchEventPermissionCondition { /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html#key CloudwatchEventPermission#key} */ readonly key: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html#type CloudwatchEventPermission#type} */ readonly type: string; /** * Docs at Terraform Registry: {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html#value CloudwatchEventPermission#value} */ readonly value: string; } export function cloudwatchEventPermissionConditionToTerraform(struct?: CloudwatchEventPermissionConditionOutputReference | CloudwatchEventPermissionCondition): 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 { key: cdktf.stringToTerraform(struct!.key), type: cdktf.stringToTerraform(struct!.type), value: cdktf.stringToTerraform(struct!.value), } } export class CloudwatchEventPermissionConditionOutputReference 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(): CloudwatchEventPermissionCondition | undefined { let hasAnyValues = this.isEmptyObject; const internalValueResult: any = {}; if (this._key !== undefined) { hasAnyValues = true; internalValueResult.key = this._key; } if (this._type !== undefined) { hasAnyValues = true; internalValueResult.type = this._type; } if (this._value !== undefined) { hasAnyValues = true; internalValueResult.value = this._value; } return hasAnyValues ? internalValueResult : undefined; } public set internalValue(value: CloudwatchEventPermissionCondition | undefined) { if (value === undefined) { this.isEmptyObject = false; this._key = undefined; this._type = undefined; this._value = undefined; } else { this.isEmptyObject = Object.keys(value).length === 0; this._key = value.key; this._type = value.type; this._value = value.value; } } // key - computed: false, optional: false, required: true private _key?: string; public get key() { return this.getStringAttribute('key'); } public set key(value: string) { this._key = value; } // Temporarily expose input value. Use with caution. public get keyInput() { return this._key; } // type - computed: false, optional: false, required: true private _type?: string; public get type() { return this.getStringAttribute('type'); } public set type(value: string) { this._type = value; } // Temporarily expose input value. Use with caution. public get typeInput() { return this._type; } // value - computed: false, optional: false, required: true private _value?: string; public get value() { return this.getStringAttribute('value'); } public set value(value: string) { this._value = value; } // Temporarily expose input value. Use with caution. public get valueInput() { return this._value; } } /** * Represents a {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html aws_cloudwatch_event_permission} */ export class CloudwatchEventPermission extends cdktf.TerraformResource { // ================= // STATIC PROPERTIES // ================= public static readonly tfResourceType: string = "aws_cloudwatch_event_permission"; // =========== // INITIALIZER // =========== /** * Create a new {@link https://www.terraform.io/docs/providers/aws/r/cloudwatch_event_permission.html aws_cloudwatch_event_permission} 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 CloudwatchEventPermissionConfig */ public constructor(scope: Construct, id: string, config: CloudwatchEventPermissionConfig) { super(scope, id, { terraformResourceType: 'aws_cloudwatch_event_permission', terraformGeneratorMetadata: { providerName: 'aws' }, provider: config.provider, dependsOn: config.dependsOn, count: config.count, lifecycle: config.lifecycle }); this._action = config.action; this._eventBusName = config.eventBusName; this._principal = config.principal; this._statementId = config.statementId; this._condition.internalValue = config.condition; } // ========== // ATTRIBUTES // ========== // action - computed: false, optional: true, required: false private _action?: string; public get action() { return this.getStringAttribute('action'); } public set action(value: string) { this._action = value; } public resetAction() { this._action = undefined; } // Temporarily expose input value. Use with caution. public get actionInput() { return this._action; } // event_bus_name - computed: false, optional: true, required: false private _eventBusName?: string; public get eventBusName() { return this.getStringAttribute('event_bus_name'); } public set eventBusName(value: string) { this._eventBusName = value; } public resetEventBusName() { this._eventBusName = undefined; } // Temporarily expose input value. Use with caution. public get eventBusNameInput() { return this._eventBusName; } // id - computed: true, optional: true, required: false public get id() { return this.getStringAttribute('id'); } // principal - computed: false, optional: false, required: true private _principal?: string; public get principal() { return this.getStringAttribute('principal'); } public set principal(value: string) { this._principal = value; } // Temporarily expose input value. Use with caution. public get principalInput() { return this._principal; } // statement_id - computed: false, optional: false, required: true private _statementId?: string; public get statementId() { return this.getStringAttribute('statement_id'); } public set statementId(value: string) { this._statementId = value; } // Temporarily expose input value. Use with caution. public get statementIdInput() { return this._statementId; } // condition - computed: false, optional: true, required: false private _condition = new CloudwatchEventPermissionConditionOutputReference(this as any, "condition", true); public get condition() { return this._condition; } public putCondition(value: CloudwatchEventPermissionCondition) { this._condition.internalValue = value; } public resetCondition() { this._condition.internalValue = undefined; } // Temporarily expose input value. Use with caution. public get conditionInput() { return this._condition.internalValue; } // ========= // SYNTHESIS // ========= protected synthesizeAttributes(): { [name: string]: any } { return { action: cdktf.stringToTerraform(this._action), event_bus_name: cdktf.stringToTerraform(this._eventBusName), principal: cdktf.stringToTerraform(this._principal), statement_id: cdktf.stringToTerraform(this._statementId), condition: cloudwatchEventPermissionConditionToTerraform(this._condition.internalValue), }; } }