// generated from terraform resource schema
import * as cdktf from 'cdktf';
export function emrInstanceFleetInstanceTypeConfigsConfigurationsToTerraform(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 {
        classification: cdktf.stringToTerraform(struct.classification),
        properties: cdktf.hashMapper(cdktf.stringToTerraform)(struct.properties),
    };
}
export function emrInstanceFleetInstanceTypeConfigsEbsConfigToTerraform(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 {
        iops: cdktf.numberToTerraform(struct.iops),
        size: cdktf.numberToTerraform(struct.size),
        type: cdktf.stringToTerraform(struct.type),
        volumes_per_instance: cdktf.numberToTerraform(struct.volumesPerInstance),
    };
}
export function emrInstanceFleetInstanceTypeConfigsToTerraform(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 {
        bid_price: cdktf.stringToTerraform(struct.bidPrice),
        bid_price_as_percentage_of_on_demand_price: cdktf.numberToTerraform(struct.bidPriceAsPercentageOfOnDemandPrice),
        instance_type: cdktf.stringToTerraform(struct.instanceType),
        weighted_capacity: cdktf.numberToTerraform(struct.weightedCapacity),
        configurations: cdktf.listMapper(emrInstanceFleetInstanceTypeConfigsConfigurationsToTerraform)(struct.configurations),
        ebs_config: cdktf.listMapper(emrInstanceFleetInstanceTypeConfigsEbsConfigToTerraform)(struct.ebsConfig),
    };
}
export function emrInstanceFleetLaunchSpecificationsOnDemandSpecificationToTerraform(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 {
        allocation_strategy: cdktf.stringToTerraform(struct.allocationStrategy),
    };
}
export function emrInstanceFleetLaunchSpecificationsSpotSpecificationToTerraform(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 {
        allocation_strategy: cdktf.stringToTerraform(struct.allocationStrategy),
        block_duration_minutes: cdktf.numberToTerraform(struct.blockDurationMinutes),
        timeout_action: cdktf.stringToTerraform(struct.timeoutAction),
        timeout_duration_minutes: cdktf.numberToTerraform(struct.timeoutDurationMinutes),
    };
}
export function emrInstanceFleetLaunchSpecificationsToTerraform(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 {
        on_demand_specification: cdktf.listMapper(emrInstanceFleetLaunchSpecificationsOnDemandSpecificationToTerraform)(struct.onDemandSpecification),
        spot_specification: cdktf.listMapper(emrInstanceFleetLaunchSpecificationsSpotSpecificationToTerraform)(struct.spotSpecification),
    };
}
export class EmrInstanceFleetLaunchSpecificationsOutputReference 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._onDemandSpecification !== undefined) {
            hasAnyValues = true;
            internalValueResult.onDemandSpecification = this._onDemandSpecification;
        }
        if (this._spotSpecification !== undefined) {
            hasAnyValues = true;
            internalValueResult.spotSpecification = this._spotSpecification;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._onDemandSpecification = undefined;
            this._spotSpecification = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._onDemandSpecification = value.onDemandSpecification;
            this._spotSpecification = value.spotSpecification;
        }
    }
    // on_demand_specification - computed: false, optional: true, required: false
    _onDemandSpecification;
    get onDemandSpecification() {
        // Getting the computed value is not yet implemented
        return this.interpolationForAttribute('on_demand_specification');
    }
    set onDemandSpecification(value) {
        this._onDemandSpecification = value;
    }
    resetOnDemandSpecification() {
        this._onDemandSpecification = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get onDemandSpecificationInput() {
        return this._onDemandSpecification;
    }
    // spot_specification - computed: false, optional: true, required: false
    _spotSpecification;
    get spotSpecification() {
        // Getting the computed value is not yet implemented
        return this.interpolationForAttribute('spot_specification');
    }
    set spotSpecification(value) {
        this._spotSpecification = value;
    }
    resetSpotSpecification() {
        this._spotSpecification = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get spotSpecificationInput() {
        return this._spotSpecification;
    }
}
/**
* Represents a {@link https://www.terraform.io/docs/providers/aws/r/emr_instance_fleet aws_emr_instance_fleet}
*/
export class EmrInstanceFleet extends cdktf.TerraformResource {
    // =================
    // STATIC PROPERTIES
    // =================
    static tfResourceType = "aws_emr_instance_fleet";
    // ===========
    // INITIALIZER
    // ===========
    /**
    * Create a new {@link https://www.terraform.io/docs/providers/aws/r/emr_instance_fleet aws_emr_instance_fleet} 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 EmrInstanceFleetConfig
    */
    constructor(scope, id, config) {
        super(scope, id, {
            terraformResourceType: 'aws_emr_instance_fleet',
            terraformGeneratorMetadata: {
                providerName: 'aws'
            },
            provider: config.provider,
            dependsOn: config.dependsOn,
            count: config.count,
            lifecycle: config.lifecycle
        });
        this._clusterId = config.clusterId;
        this._name = config.name;
        this._targetOnDemandCapacity = config.targetOnDemandCapacity;
        this._targetSpotCapacity = config.targetSpotCapacity;
        this._instanceTypeConfigs = config.instanceTypeConfigs;
        this._launchSpecifications.internalValue = config.launchSpecifications;
    }
    // ==========
    // ATTRIBUTES
    // ==========
    // cluster_id - computed: false, optional: false, required: true
    _clusterId;
    get clusterId() {
        return this.getStringAttribute('cluster_id');
    }
    set clusterId(value) {
        this._clusterId = value;
    }
    // Temporarily expose input value. Use with caution.
    get clusterIdInput() {
        return this._clusterId;
    }
    // id - computed: true, optional: true, required: false
    get id() {
        return this.getStringAttribute('id');
    }
    // name - computed: false, optional: true, required: false
    _name;
    get name() {
        return this.getStringAttribute('name');
    }
    set name(value) {
        this._name = value;
    }
    resetName() {
        this._name = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get nameInput() {
        return this._name;
    }
    // provisioned_on_demand_capacity - computed: true, optional: false, required: false
    get provisionedOnDemandCapacity() {
        return this.getNumberAttribute('provisioned_on_demand_capacity');
    }
    // provisioned_spot_capacity - computed: true, optional: false, required: false
    get provisionedSpotCapacity() {
        return this.getNumberAttribute('provisioned_spot_capacity');
    }
    // target_on_demand_capacity - computed: false, optional: true, required: false
    _targetOnDemandCapacity;
    get targetOnDemandCapacity() {
        return this.getNumberAttribute('target_on_demand_capacity');
    }
    set targetOnDemandCapacity(value) {
        this._targetOnDemandCapacity = value;
    }
    resetTargetOnDemandCapacity() {
        this._targetOnDemandCapacity = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get targetOnDemandCapacityInput() {
        return this._targetOnDemandCapacity;
    }
    // target_spot_capacity - computed: false, optional: true, required: false
    _targetSpotCapacity;
    get targetSpotCapacity() {
        return this.getNumberAttribute('target_spot_capacity');
    }
    set targetSpotCapacity(value) {
        this._targetSpotCapacity = value;
    }
    resetTargetSpotCapacity() {
        this._targetSpotCapacity = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get targetSpotCapacityInput() {
        return this._targetSpotCapacity;
    }
    // instance_type_configs - computed: false, optional: true, required: false
    _instanceTypeConfigs;
    get instanceTypeConfigs() {
        // Getting the computed value is not yet implemented
        return cdktf.Token.asAny(cdktf.Fn.tolist(this.interpolationForAttribute('instance_type_configs')));
    }
    set instanceTypeConfigs(value) {
        this._instanceTypeConfigs = value;
    }
    resetInstanceTypeConfigs() {
        this._instanceTypeConfigs = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get instanceTypeConfigsInput() {
        return this._instanceTypeConfigs;
    }
    // launch_specifications - computed: false, optional: true, required: false
    _launchSpecifications = new EmrInstanceFleetLaunchSpecificationsOutputReference(this, "launch_specifications", true);
    get launchSpecifications() {
        return this._launchSpecifications;
    }
    putLaunchSpecifications(value) {
        this._launchSpecifications.internalValue = value;
    }
    resetLaunchSpecifications() {
        this._launchSpecifications.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get launchSpecificationsInput() {
        return this._launchSpecifications.internalValue;
    }
    // =========
    // SYNTHESIS
    // =========
    synthesizeAttributes() {
        return {
            cluster_id: cdktf.stringToTerraform(this._clusterId),
            name: cdktf.stringToTerraform(this._name),
            target_on_demand_capacity: cdktf.numberToTerraform(this._targetOnDemandCapacity),
            target_spot_capacity: cdktf.numberToTerraform(this._targetSpotCapacity),
            instance_type_configs: cdktf.listMapper(emrInstanceFleetInstanceTypeConfigsToTerraform)(this._instanceTypeConfigs),
            launch_specifications: emrInstanceFleetLaunchSpecificationsToTerraform(this._launchSpecifications.internalValue),
        };
    }
}
//# sourceMappingURL=emr-instance-fleet.js.map