// generated from terraform resource schema
import * as cdktf from 'cdktf';
export function ec2TrafficMirrorFilterRuleDestinationPortRangeToTerraform(struct) {
    if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(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 {
        from_port: cdktf.numberToTerraform(struct.fromPort),
        to_port: cdktf.numberToTerraform(struct.toPort),
    };
}
export class Ec2TrafficMirrorFilterRuleDestinationPortRangeOutputReference extends cdktf.ComplexObject {
    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
    */
    constructor(terraformResource, terraformAttribute, isSingleItem) {
        super(terraformResource, terraformAttribute, isSingleItem);
    }
    get internalValue() {
        let hasAnyValues = this.isEmptyObject;
        const internalValueResult = {};
        if (this._fromPort !== undefined) {
            hasAnyValues = true;
            internalValueResult.fromPort = this._fromPort;
        }
        if (this._toPort !== undefined) {
            hasAnyValues = true;
            internalValueResult.toPort = this._toPort;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._fromPort = undefined;
            this._toPort = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._fromPort = value.fromPort;
            this._toPort = value.toPort;
        }
    }
    // from_port - computed: false, optional: true, required: false
    _fromPort;
    get fromPort() {
        return this.getNumberAttribute('from_port');
    }
    set fromPort(value) {
        this._fromPort = value;
    }
    resetFromPort() {
        this._fromPort = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get fromPortInput() {
        return this._fromPort;
    }
    // to_port - computed: false, optional: true, required: false
    _toPort;
    get toPort() {
        return this.getNumberAttribute('to_port');
    }
    set toPort(value) {
        this._toPort = value;
    }
    resetToPort() {
        this._toPort = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get toPortInput() {
        return this._toPort;
    }
}
export function ec2TrafficMirrorFilterRuleSourcePortRangeToTerraform(struct) {
    if (!cdktf.canInspect(struct) || cdktf.Tokenization.isResolvable(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 {
        from_port: cdktf.numberToTerraform(struct.fromPort),
        to_port: cdktf.numberToTerraform(struct.toPort),
    };
}
export class Ec2TrafficMirrorFilterRuleSourcePortRangeOutputReference extends cdktf.ComplexObject {
    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
    */
    constructor(terraformResource, terraformAttribute, isSingleItem) {
        super(terraformResource, terraformAttribute, isSingleItem);
    }
    get internalValue() {
        let hasAnyValues = this.isEmptyObject;
        const internalValueResult = {};
        if (this._fromPort !== undefined) {
            hasAnyValues = true;
            internalValueResult.fromPort = this._fromPort;
        }
        if (this._toPort !== undefined) {
            hasAnyValues = true;
            internalValueResult.toPort = this._toPort;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._fromPort = undefined;
            this._toPort = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._fromPort = value.fromPort;
            this._toPort = value.toPort;
        }
    }
    // from_port - computed: false, optional: true, required: false
    _fromPort;
    get fromPort() {
        return this.getNumberAttribute('from_port');
    }
    set fromPort(value) {
        this._fromPort = value;
    }
    resetFromPort() {
        this._fromPort = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get fromPortInput() {
        return this._fromPort;
    }
    // to_port - computed: false, optional: true, required: false
    _toPort;
    get toPort() {
        return this.getNumberAttribute('to_port');
    }
    set toPort(value) {
        this._toPort = value;
    }
    resetToPort() {
        this._toPort = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get toPortInput() {
        return this._toPort;
    }
}
/**
* Represents a {@link https://www.terraform.io/docs/providers/aws/r/ec2_traffic_mirror_filter_rule aws_ec2_traffic_mirror_filter_rule}
*/
export class Ec2TrafficMirrorFilterRule extends cdktf.TerraformResource {
    // =================
    // STATIC PROPERTIES
    // =================
    static tfResourceType = "aws_ec2_traffic_mirror_filter_rule";
    // ===========
    // INITIALIZER
    // ===========
    /**
    * Create a new {@link https://www.terraform.io/docs/providers/aws/r/ec2_traffic_mirror_filter_rule aws_ec2_traffic_mirror_filter_rule} 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 Ec2TrafficMirrorFilterRuleConfig
    */
    constructor(scope, id, config) {
        super(scope, id, {
            terraformResourceType: 'aws_ec2_traffic_mirror_filter_rule',
            terraformGeneratorMetadata: {
                providerName: 'aws'
            },
            provider: config.provider,
            dependsOn: config.dependsOn,
            count: config.count,
            lifecycle: config.lifecycle
        });
        this._description = config.description;
        this._destinationCidrBlock = config.destinationCidrBlock;
        this._protocol = config.protocol;
        this._ruleAction = config.ruleAction;
        this._ruleNumber = config.ruleNumber;
        this._sourceCidrBlock = config.sourceCidrBlock;
        this._trafficDirection = config.trafficDirection;
        this._trafficMirrorFilterId = config.trafficMirrorFilterId;
        this._destinationPortRange.internalValue = config.destinationPortRange;
        this._sourcePortRange.internalValue = config.sourcePortRange;
    }
    // ==========
    // ATTRIBUTES
    // ==========
    // arn - computed: true, optional: false, required: false
    get arn() {
        return this.getStringAttribute('arn');
    }
    // description - computed: false, optional: true, required: false
    _description;
    get description() {
        return this.getStringAttribute('description');
    }
    set description(value) {
        this._description = value;
    }
    resetDescription() {
        this._description = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get descriptionInput() {
        return this._description;
    }
    // destination_cidr_block - computed: false, optional: false, required: true
    _destinationCidrBlock;
    get destinationCidrBlock() {
        return this.getStringAttribute('destination_cidr_block');
    }
    set destinationCidrBlock(value) {
        this._destinationCidrBlock = value;
    }
    // Temporarily expose input value. Use with caution.
    get destinationCidrBlockInput() {
        return this._destinationCidrBlock;
    }
    // id - computed: true, optional: true, required: false
    get id() {
        return this.getStringAttribute('id');
    }
    // protocol - computed: false, optional: true, required: false
    _protocol;
    get protocol() {
        return this.getNumberAttribute('protocol');
    }
    set protocol(value) {
        this._protocol = value;
    }
    resetProtocol() {
        this._protocol = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get protocolInput() {
        return this._protocol;
    }
    // rule_action - computed: false, optional: false, required: true
    _ruleAction;
    get ruleAction() {
        return this.getStringAttribute('rule_action');
    }
    set ruleAction(value) {
        this._ruleAction = value;
    }
    // Temporarily expose input value. Use with caution.
    get ruleActionInput() {
        return this._ruleAction;
    }
    // rule_number - computed: false, optional: false, required: true
    _ruleNumber;
    get ruleNumber() {
        return this.getNumberAttribute('rule_number');
    }
    set ruleNumber(value) {
        this._ruleNumber = value;
    }
    // Temporarily expose input value. Use with caution.
    get ruleNumberInput() {
        return this._ruleNumber;
    }
    // source_cidr_block - computed: false, optional: false, required: true
    _sourceCidrBlock;
    get sourceCidrBlock() {
        return this.getStringAttribute('source_cidr_block');
    }
    set sourceCidrBlock(value) {
        this._sourceCidrBlock = value;
    }
    // Temporarily expose input value. Use with caution.
    get sourceCidrBlockInput() {
        return this._sourceCidrBlock;
    }
    // traffic_direction - computed: false, optional: false, required: true
    _trafficDirection;
    get trafficDirection() {
        return this.getStringAttribute('traffic_direction');
    }
    set trafficDirection(value) {
        this._trafficDirection = value;
    }
    // Temporarily expose input value. Use with caution.
    get trafficDirectionInput() {
        return this._trafficDirection;
    }
    // traffic_mirror_filter_id - computed: false, optional: false, required: true
    _trafficMirrorFilterId;
    get trafficMirrorFilterId() {
        return this.getStringAttribute('traffic_mirror_filter_id');
    }
    set trafficMirrorFilterId(value) {
        this._trafficMirrorFilterId = value;
    }
    // Temporarily expose input value. Use with caution.
    get trafficMirrorFilterIdInput() {
        return this._trafficMirrorFilterId;
    }
    // destination_port_range - computed: false, optional: true, required: false
    _destinationPortRange = new Ec2TrafficMirrorFilterRuleDestinationPortRangeOutputReference(this, "destination_port_range", true);
    get destinationPortRange() {
        return this._destinationPortRange;
    }
    putDestinationPortRange(value) {
        this._destinationPortRange.internalValue = value;
    }
    resetDestinationPortRange() {
        this._destinationPortRange.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get destinationPortRangeInput() {
        return this._destinationPortRange.internalValue;
    }
    // source_port_range - computed: false, optional: true, required: false
    _sourcePortRange = new Ec2TrafficMirrorFilterRuleSourcePortRangeOutputReference(this, "source_port_range", true);
    get sourcePortRange() {
        return this._sourcePortRange;
    }
    putSourcePortRange(value) {
        this._sourcePortRange.internalValue = value;
    }
    resetSourcePortRange() {
        this._sourcePortRange.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get sourcePortRangeInput() {
        return this._sourcePortRange.internalValue;
    }
    // =========
    // SYNTHESIS
    // =========
    synthesizeAttributes() {
        return {
            description: cdktf.stringToTerraform(this._description),
            destination_cidr_block: cdktf.stringToTerraform(this._destinationCidrBlock),
            protocol: cdktf.numberToTerraform(this._protocol),
            rule_action: cdktf.stringToTerraform(this._ruleAction),
            rule_number: cdktf.numberToTerraform(this._ruleNumber),
            source_cidr_block: cdktf.stringToTerraform(this._sourceCidrBlock),
            traffic_direction: cdktf.stringToTerraform(this._trafficDirection),
            traffic_mirror_filter_id: cdktf.stringToTerraform(this._trafficMirrorFilterId),
            destination_port_range: ec2TrafficMirrorFilterRuleDestinationPortRangeToTerraform(this._destinationPortRange.internalValue),
            source_port_range: ec2TrafficMirrorFilterRuleSourcePortRangeToTerraform(this._sourcePortRange.internalValue),
        };
    }
}
//# sourceMappingURL=ec2-traffic-mirror-filter-rule.js.map