// generated from terraform resource schema
import * as cdktf from 'cdktf';
export function apigatewayv2ApiCorsConfigurationToTerraform(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 {
        allow_credentials: cdktf.booleanToTerraform(struct.allowCredentials),
        allow_headers: cdktf.listMapper(cdktf.stringToTerraform)(struct.allowHeaders),
        allow_methods: cdktf.listMapper(cdktf.stringToTerraform)(struct.allowMethods),
        allow_origins: cdktf.listMapper(cdktf.stringToTerraform)(struct.allowOrigins),
        expose_headers: cdktf.listMapper(cdktf.stringToTerraform)(struct.exposeHeaders),
        max_age: cdktf.numberToTerraform(struct.maxAge),
    };
}
export class Apigatewayv2ApiCorsConfigurationOutputReference 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._allowCredentials !== undefined) {
            hasAnyValues = true;
            internalValueResult.allowCredentials = this._allowCredentials;
        }
        if (this._allowHeaders !== undefined) {
            hasAnyValues = true;
            internalValueResult.allowHeaders = this._allowHeaders;
        }
        if (this._allowMethods !== undefined) {
            hasAnyValues = true;
            internalValueResult.allowMethods = this._allowMethods;
        }
        if (this._allowOrigins !== undefined) {
            hasAnyValues = true;
            internalValueResult.allowOrigins = this._allowOrigins;
        }
        if (this._exposeHeaders !== undefined) {
            hasAnyValues = true;
            internalValueResult.exposeHeaders = this._exposeHeaders;
        }
        if (this._maxAge !== undefined) {
            hasAnyValues = true;
            internalValueResult.maxAge = this._maxAge;
        }
        return hasAnyValues ? internalValueResult : undefined;
    }
    set internalValue(value) {
        if (value === undefined) {
            this.isEmptyObject = false;
            this._allowCredentials = undefined;
            this._allowHeaders = undefined;
            this._allowMethods = undefined;
            this._allowOrigins = undefined;
            this._exposeHeaders = undefined;
            this._maxAge = undefined;
        }
        else {
            this.isEmptyObject = Object.keys(value).length === 0;
            this._allowCredentials = value.allowCredentials;
            this._allowHeaders = value.allowHeaders;
            this._allowMethods = value.allowMethods;
            this._allowOrigins = value.allowOrigins;
            this._exposeHeaders = value.exposeHeaders;
            this._maxAge = value.maxAge;
        }
    }
    // allow_credentials - computed: false, optional: true, required: false
    _allowCredentials;
    get allowCredentials() {
        return this.getBooleanAttribute('allow_credentials');
    }
    set allowCredentials(value) {
        this._allowCredentials = value;
    }
    resetAllowCredentials() {
        this._allowCredentials = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get allowCredentialsInput() {
        return this._allowCredentials;
    }
    // allow_headers - computed: false, optional: true, required: false
    _allowHeaders;
    get allowHeaders() {
        return cdktf.Fn.tolist(this.getListAttribute('allow_headers'));
    }
    set allowHeaders(value) {
        this._allowHeaders = value;
    }
    resetAllowHeaders() {
        this._allowHeaders = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get allowHeadersInput() {
        return this._allowHeaders;
    }
    // allow_methods - computed: false, optional: true, required: false
    _allowMethods;
    get allowMethods() {
        return cdktf.Fn.tolist(this.getListAttribute('allow_methods'));
    }
    set allowMethods(value) {
        this._allowMethods = value;
    }
    resetAllowMethods() {
        this._allowMethods = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get allowMethodsInput() {
        return this._allowMethods;
    }
    // allow_origins - computed: false, optional: true, required: false
    _allowOrigins;
    get allowOrigins() {
        return cdktf.Fn.tolist(this.getListAttribute('allow_origins'));
    }
    set allowOrigins(value) {
        this._allowOrigins = value;
    }
    resetAllowOrigins() {
        this._allowOrigins = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get allowOriginsInput() {
        return this._allowOrigins;
    }
    // expose_headers - computed: false, optional: true, required: false
    _exposeHeaders;
    get exposeHeaders() {
        return cdktf.Fn.tolist(this.getListAttribute('expose_headers'));
    }
    set exposeHeaders(value) {
        this._exposeHeaders = value;
    }
    resetExposeHeaders() {
        this._exposeHeaders = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get exposeHeadersInput() {
        return this._exposeHeaders;
    }
    // max_age - computed: false, optional: true, required: false
    _maxAge;
    get maxAge() {
        return this.getNumberAttribute('max_age');
    }
    set maxAge(value) {
        this._maxAge = value;
    }
    resetMaxAge() {
        this._maxAge = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get maxAgeInput() {
        return this._maxAge;
    }
}
/**
* Represents a {@link https://www.terraform.io/docs/providers/aws/r/apigatewayv2_api aws_apigatewayv2_api}
*/
export class Apigatewayv2Api extends cdktf.TerraformResource {
    // =================
    // STATIC PROPERTIES
    // =================
    static tfResourceType = "aws_apigatewayv2_api";
    // ===========
    // INITIALIZER
    // ===========
    /**
    * Create a new {@link https://www.terraform.io/docs/providers/aws/r/apigatewayv2_api aws_apigatewayv2_api} 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 Apigatewayv2ApiConfig
    */
    constructor(scope, id, config) {
        super(scope, id, {
            terraformResourceType: 'aws_apigatewayv2_api',
            terraformGeneratorMetadata: {
                providerName: 'aws'
            },
            provider: config.provider,
            dependsOn: config.dependsOn,
            count: config.count,
            lifecycle: config.lifecycle
        });
        this._apiKeySelectionExpression = config.apiKeySelectionExpression;
        this._body = config.body;
        this._credentialsArn = config.credentialsArn;
        this._description = config.description;
        this._disableExecuteApiEndpoint = config.disableExecuteApiEndpoint;
        this._failOnWarnings = config.failOnWarnings;
        this._name = config.name;
        this._protocolType = config.protocolType;
        this._routeKey = config.routeKey;
        this._routeSelectionExpression = config.routeSelectionExpression;
        this._tags = config.tags;
        this._tagsAll = config.tagsAll;
        this._target = config.target;
        this._version = config.version;
        this._corsConfiguration.internalValue = config.corsConfiguration;
    }
    // ==========
    // ATTRIBUTES
    // ==========
    // api_endpoint - computed: true, optional: false, required: false
    get apiEndpoint() {
        return this.getStringAttribute('api_endpoint');
    }
    // api_key_selection_expression - computed: false, optional: true, required: false
    _apiKeySelectionExpression;
    get apiKeySelectionExpression() {
        return this.getStringAttribute('api_key_selection_expression');
    }
    set apiKeySelectionExpression(value) {
        this._apiKeySelectionExpression = value;
    }
    resetApiKeySelectionExpression() {
        this._apiKeySelectionExpression = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get apiKeySelectionExpressionInput() {
        return this._apiKeySelectionExpression;
    }
    // arn - computed: true, optional: false, required: false
    get arn() {
        return this.getStringAttribute('arn');
    }
    // body - computed: false, optional: true, required: false
    _body;
    get body() {
        return this.getStringAttribute('body');
    }
    set body(value) {
        this._body = value;
    }
    resetBody() {
        this._body = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get bodyInput() {
        return this._body;
    }
    // credentials_arn - computed: false, optional: true, required: false
    _credentialsArn;
    get credentialsArn() {
        return this.getStringAttribute('credentials_arn');
    }
    set credentialsArn(value) {
        this._credentialsArn = value;
    }
    resetCredentialsArn() {
        this._credentialsArn = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get credentialsArnInput() {
        return this._credentialsArn;
    }
    // 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;
    }
    // disable_execute_api_endpoint - computed: false, optional: true, required: false
    _disableExecuteApiEndpoint;
    get disableExecuteApiEndpoint() {
        return this.getBooleanAttribute('disable_execute_api_endpoint');
    }
    set disableExecuteApiEndpoint(value) {
        this._disableExecuteApiEndpoint = value;
    }
    resetDisableExecuteApiEndpoint() {
        this._disableExecuteApiEndpoint = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get disableExecuteApiEndpointInput() {
        return this._disableExecuteApiEndpoint;
    }
    // execution_arn - computed: true, optional: false, required: false
    get executionArn() {
        return this.getStringAttribute('execution_arn');
    }
    // fail_on_warnings - computed: false, optional: true, required: false
    _failOnWarnings;
    get failOnWarnings() {
        return this.getBooleanAttribute('fail_on_warnings');
    }
    set failOnWarnings(value) {
        this._failOnWarnings = value;
    }
    resetFailOnWarnings() {
        this._failOnWarnings = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get failOnWarningsInput() {
        return this._failOnWarnings;
    }
    // id - computed: true, optional: true, required: false
    get id() {
        return this.getStringAttribute('id');
    }
    // name - computed: false, optional: false, required: true
    _name;
    get name() {
        return this.getStringAttribute('name');
    }
    set name(value) {
        this._name = value;
    }
    // Temporarily expose input value. Use with caution.
    get nameInput() {
        return this._name;
    }
    // protocol_type - computed: false, optional: false, required: true
    _protocolType;
    get protocolType() {
        return this.getStringAttribute('protocol_type');
    }
    set protocolType(value) {
        this._protocolType = value;
    }
    // Temporarily expose input value. Use with caution.
    get protocolTypeInput() {
        return this._protocolType;
    }
    // route_key - computed: false, optional: true, required: false
    _routeKey;
    get routeKey() {
        return this.getStringAttribute('route_key');
    }
    set routeKey(value) {
        this._routeKey = value;
    }
    resetRouteKey() {
        this._routeKey = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get routeKeyInput() {
        return this._routeKey;
    }
    // route_selection_expression - computed: false, optional: true, required: false
    _routeSelectionExpression;
    get routeSelectionExpression() {
        return this.getStringAttribute('route_selection_expression');
    }
    set routeSelectionExpression(value) {
        this._routeSelectionExpression = value;
    }
    resetRouteSelectionExpression() {
        this._routeSelectionExpression = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get routeSelectionExpressionInput() {
        return this._routeSelectionExpression;
    }
    // tags - computed: false, optional: true, required: false
    _tags;
    get tags() {
        return this.getStringMapAttribute('tags');
    }
    set tags(value) {
        this._tags = value;
    }
    resetTags() {
        this._tags = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get tagsInput() {
        return this._tags;
    }
    // tags_all - computed: true, optional: true, required: false
    _tagsAll;
    get tagsAll() {
        return this.getStringMapAttribute('tags_all');
    }
    set tagsAll(value) {
        this._tagsAll = value;
    }
    resetTagsAll() {
        this._tagsAll = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get tagsAllInput() {
        return this._tagsAll;
    }
    // target - computed: false, optional: true, required: false
    _target;
    get target() {
        return this.getStringAttribute('target');
    }
    set target(value) {
        this._target = value;
    }
    resetTarget() {
        this._target = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get targetInput() {
        return this._target;
    }
    // version - computed: false, optional: true, required: false
    _version;
    get version() {
        return this.getStringAttribute('version');
    }
    set version(value) {
        this._version = value;
    }
    resetVersion() {
        this._version = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get versionInput() {
        return this._version;
    }
    // cors_configuration - computed: false, optional: true, required: false
    _corsConfiguration = new Apigatewayv2ApiCorsConfigurationOutputReference(this, "cors_configuration", true);
    get corsConfiguration() {
        return this._corsConfiguration;
    }
    putCorsConfiguration(value) {
        this._corsConfiguration.internalValue = value;
    }
    resetCorsConfiguration() {
        this._corsConfiguration.internalValue = undefined;
    }
    // Temporarily expose input value. Use with caution.
    get corsConfigurationInput() {
        return this._corsConfiguration.internalValue;
    }
    // =========
    // SYNTHESIS
    // =========
    synthesizeAttributes() {
        return {
            api_key_selection_expression: cdktf.stringToTerraform(this._apiKeySelectionExpression),
            body: cdktf.stringToTerraform(this._body),
            credentials_arn: cdktf.stringToTerraform(this._credentialsArn),
            description: cdktf.stringToTerraform(this._description),
            disable_execute_api_endpoint: cdktf.booleanToTerraform(this._disableExecuteApiEndpoint),
            fail_on_warnings: cdktf.booleanToTerraform(this._failOnWarnings),
            name: cdktf.stringToTerraform(this._name),
            protocol_type: cdktf.stringToTerraform(this._protocolType),
            route_key: cdktf.stringToTerraform(this._routeKey),
            route_selection_expression: cdktf.stringToTerraform(this._routeSelectionExpression),
            tags: cdktf.hashMapper(cdktf.stringToTerraform)(this._tags),
            tags_all: cdktf.hashMapper(cdktf.stringToTerraform)(this._tagsAll),
            target: cdktf.stringToTerraform(this._target),
            version: cdktf.stringToTerraform(this._version),
            cors_configuration: apigatewayv2ApiCorsConfigurationToTerraform(this._corsConfiguration.internalValue),
        };
    }
}
//# sourceMappingURL=apigatewayv2-api.js.map