"use strict";
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Instance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Provides a resource to manage rds mysql instance
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as volcengine from "@pulumi/volcengine";
 * import * as volcengine from "@volcengine/pulumi";
 *
 * const fooZones = volcengine.ecs.getZones({});
 * // create vpc
 * const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
 *     vpcName: "acc-test-vpc",
 *     cidrBlock: "172.16.0.0/16",
 *     dnsServers: [
 *         "8.8.8.8",
 *         "114.114.114.114",
 *     ],
 *     projectName: "default",
 * });
 * // create subnet
 * const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
 *     subnetName: "acc-test-subnet",
 *     cidrBlock: "172.16.0.0/24",
 *     zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
 *     vpcId: fooVpc.id,
 * });
 * // create mysql instance
 * const fooInstance = new volcengine.rds_mysql.Instance("fooInstance", {
 *     dbEngineVersion: "MySQL_5_7",
 *     nodeSpec: "rds.mysql.2c4g",
 *     primaryZoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
 *     secondaryZoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
 *     storageSpace: 80,
 *     subnetId: fooSubnet.id,
 *     instanceName: "acc-test-mysql-instance",
 *     lowerCaseTableNames: "1",
 *     projectName: "default",
 *     tags: [{
 *         key: "k1",
 *         value: "v1",
 *     }],
 *     chargeInfo: {
 *         chargeType: "PostPaid",
 *     },
 *     parameters: [
 *         {
 *             parameterName: "auto_increment_increment",
 *             parameterValue: "2",
 *         },
 *         {
 *             parameterName: "auto_increment_offset",
 *             parameterValue: "5",
 *         },
 *     ],
 *     deletionProtection: "Disabled",
 *     dataSyncMode: "SemiSync",
 *     autoStorageScalingConfig: {
 *         enableStorageAutoScale: true,
 *         storageThreshold: 40,
 *         storageUpperBound: 110,
 *     },
 * });
 * // create mysql instance readonly node
 * const fooInstanceReadonlyNode = new volcengine.rds_mysql.InstanceReadonlyNode("fooInstanceReadonlyNode", {
 *     instanceId: fooInstance.id,
 *     nodeSpec: "rds.mysql.2c4g",
 *     zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
 * });
 * // create mysql allow list
 * const fooAllowlist = new volcengine.rds_mysql.Allowlist("fooAllowlist", {
 *     allowListName: "acc-test-allowlist",
 *     allowListDesc: "acc-test",
 *     allowListType: "IPv4",
 *     allowLists: [
 *         "192.168.0.0/24",
 *         "192.168.1.0/24",
 *     ],
 * });
 * // associate mysql allow list to mysql instance
 * const fooAllowlistAssociate = new volcengine.rds_mysql.AllowlistAssociate("fooAllowlistAssociate", {
 *     allowListId: fooAllowlist.id,
 *     instanceId: fooInstance.id,
 * });
 * // create mysql database
 * const fooDatabase = new volcengine.rds_mysql.Database("fooDatabase", {
 *     dbName: "acc-test-database",
 *     instanceId: fooInstance.id,
 * });
 * ```
 *
 * ## Import
 *
 * Rds Mysql Instance can be imported using the id, e.g.
 *
 * ```sh
 * $ pulumi import volcengine:rds_mysql/instance:Instance default mysql-72da4258c2c7
 * ```
 */
class Instance extends pulumi.CustomResource {
    /**
     * Get an existing Instance resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new Instance(name, state, Object.assign(Object.assign({}, opts), { id: id }));
    }
    /**
     * Returns true if the given object is an instance of Instance.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === Instance.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["allowListIds"] = state ? state.allowListIds : undefined;
            resourceInputs["allowListVersion"] = state ? state.allowListVersion : undefined;
            resourceInputs["autoStorageScalingConfig"] = state ? state.autoStorageScalingConfig : undefined;
            resourceInputs["autoUpgradeMinorVersion"] = state ? state.autoUpgradeMinorVersion : undefined;
            resourceInputs["backupUse"] = state ? state.backupUse : undefined;
            resourceInputs["binlogDump"] = state ? state.binlogDump : undefined;
            resourceInputs["chargeDetails"] = state ? state.chargeDetails : undefined;
            resourceInputs["chargeInfo"] = state ? state.chargeInfo : undefined;
            resourceInputs["connectionPoolType"] = state ? state.connectionPoolType : undefined;
            resourceInputs["createTime"] = state ? state.createTime : undefined;
            resourceInputs["dataSyncMode"] = state ? state.dataSyncMode : undefined;
            resourceInputs["dbEngineVersion"] = state ? state.dbEngineVersion : undefined;
            resourceInputs["dbProxyStatus"] = state ? state.dbProxyStatus : undefined;
            resourceInputs["dbTimeZone"] = state ? state.dbTimeZone : undefined;
            resourceInputs["deletionProtection"] = state ? state.deletionProtection : undefined;
            resourceInputs["drDtsTaskId"] = state ? state.drDtsTaskId : undefined;
            resourceInputs["drDtsTaskName"] = state ? state.drDtsTaskName : undefined;
            resourceInputs["drDtsTaskStatus"] = state ? state.drDtsTaskStatus : undefined;
            resourceInputs["drSecondsBehindMaster"] = state ? state.drSecondsBehindMaster : undefined;
            resourceInputs["endpoints"] = state ? state.endpoints : undefined;
            resourceInputs["featureStates"] = state ? state.featureStates : undefined;
            resourceInputs["globalReadOnly"] = state ? state.globalReadOnly : undefined;
            resourceInputs["instanceId"] = state ? state.instanceId : undefined;
            resourceInputs["instanceName"] = state ? state.instanceName : undefined;
            resourceInputs["instanceStatus"] = state ? state.instanceStatus : undefined;
            resourceInputs["kernelVersion"] = state ? state.kernelVersion : undefined;
            resourceInputs["lowerCaseTableNames"] = state ? state.lowerCaseTableNames : undefined;
            resourceInputs["maintenanceWindow"] = state ? state.maintenanceWindow : undefined;
            resourceInputs["masterInstanceId"] = state ? state.masterInstanceId : undefined;
            resourceInputs["masterInstanceName"] = state ? state.masterInstanceName : undefined;
            resourceInputs["masterRegion"] = state ? state.masterRegion : undefined;
            resourceInputs["memory"] = state ? state.memory : undefined;
            resourceInputs["nodeCpuUsedPercentage"] = state ? state.nodeCpuUsedPercentage : undefined;
            resourceInputs["nodeMemoryUsedPercentage"] = state ? state.nodeMemoryUsedPercentage : undefined;
            resourceInputs["nodeNumber"] = state ? state.nodeNumber : undefined;
            resourceInputs["nodeSpaceUsedPercentage"] = state ? state.nodeSpaceUsedPercentage : undefined;
            resourceInputs["nodeSpec"] = state ? state.nodeSpec : undefined;
            resourceInputs["nodes"] = state ? state.nodes : undefined;
            resourceInputs["parameters"] = state ? state.parameters : undefined;
            resourceInputs["primaryZoneId"] = state ? state.primaryZoneId : undefined;
            resourceInputs["projectName"] = state ? state.projectName : undefined;
            resourceInputs["regionId"] = state ? state.regionId : undefined;
            resourceInputs["secondaryZoneId"] = state ? state.secondaryZoneId : undefined;
            resourceInputs["storageMaxCapacity"] = state ? state.storageMaxCapacity : undefined;
            resourceInputs["storageMaxTriggerThreshold"] = state ? state.storageMaxTriggerThreshold : undefined;
            resourceInputs["storageMinCapacity"] = state ? state.storageMinCapacity : undefined;
            resourceInputs["storageMinTriggerThreshold"] = state ? state.storageMinTriggerThreshold : undefined;
            resourceInputs["storageSpace"] = state ? state.storageSpace : undefined;
            resourceInputs["storageType"] = state ? state.storageType : undefined;
            resourceInputs["storageUse"] = state ? state.storageUse : undefined;
            resourceInputs["subnetId"] = state ? state.subnetId : undefined;
            resourceInputs["tags"] = state ? state.tags : undefined;
            resourceInputs["timeZone"] = state ? state.timeZone : undefined;
            resourceInputs["updateTime"] = state ? state.updateTime : undefined;
            resourceInputs["vCpu"] = state ? state.vCpu : undefined;
            resourceInputs["vpcId"] = state ? state.vpcId : undefined;
            resourceInputs["zoneId"] = state ? state.zoneId : undefined;
            resourceInputs["zoneIds"] = state ? state.zoneIds : undefined;
        }
        else {
            const args = argsOrState;
            if ((!args || args.chargeInfo === undefined) && !opts.urn) {
                throw new Error("Missing required property 'chargeInfo'");
            }
            if ((!args || args.dbEngineVersion === undefined) && !opts.urn) {
                throw new Error("Missing required property 'dbEngineVersion'");
            }
            if ((!args || args.nodeSpec === undefined) && !opts.urn) {
                throw new Error("Missing required property 'nodeSpec'");
            }
            if ((!args || args.primaryZoneId === undefined) && !opts.urn) {
                throw new Error("Missing required property 'primaryZoneId'");
            }
            if ((!args || args.secondaryZoneId === undefined) && !opts.urn) {
                throw new Error("Missing required property 'secondaryZoneId'");
            }
            if ((!args || args.subnetId === undefined) && !opts.urn) {
                throw new Error("Missing required property 'subnetId'");
            }
            resourceInputs["allowListIds"] = args ? args.allowListIds : undefined;
            resourceInputs["autoStorageScalingConfig"] = args ? args.autoStorageScalingConfig : undefined;
            resourceInputs["chargeInfo"] = args ? args.chargeInfo : undefined;
            resourceInputs["connectionPoolType"] = args ? args.connectionPoolType : undefined;
            resourceInputs["dataSyncMode"] = args ? args.dataSyncMode : undefined;
            resourceInputs["dbEngineVersion"] = args ? args.dbEngineVersion : undefined;
            resourceInputs["dbTimeZone"] = args ? args.dbTimeZone : undefined;
            resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined;
            resourceInputs["globalReadOnly"] = args ? args.globalReadOnly : undefined;
            resourceInputs["instanceName"] = args ? args.instanceName : undefined;
            resourceInputs["lowerCaseTableNames"] = args ? args.lowerCaseTableNames : undefined;
            resourceInputs["maintenanceWindow"] = args ? args.maintenanceWindow : undefined;
            resourceInputs["nodeSpec"] = args ? args.nodeSpec : undefined;
            resourceInputs["parameters"] = args ? args.parameters : undefined;
            resourceInputs["primaryZoneId"] = args ? args.primaryZoneId : undefined;
            resourceInputs["projectName"] = args ? args.projectName : undefined;
            resourceInputs["secondaryZoneId"] = args ? args.secondaryZoneId : undefined;
            resourceInputs["storageSpace"] = args ? args.storageSpace : undefined;
            resourceInputs["subnetId"] = args ? args.subnetId : undefined;
            resourceInputs["tags"] = args ? args.tags : undefined;
            resourceInputs["allowListVersion"] = undefined /*out*/;
            resourceInputs["autoUpgradeMinorVersion"] = undefined /*out*/;
            resourceInputs["backupUse"] = undefined /*out*/;
            resourceInputs["binlogDump"] = undefined /*out*/;
            resourceInputs["chargeDetails"] = undefined /*out*/;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["dbProxyStatus"] = undefined /*out*/;
            resourceInputs["drDtsTaskId"] = undefined /*out*/;
            resourceInputs["drDtsTaskName"] = undefined /*out*/;
            resourceInputs["drDtsTaskStatus"] = undefined /*out*/;
            resourceInputs["drSecondsBehindMaster"] = undefined /*out*/;
            resourceInputs["endpoints"] = undefined /*out*/;
            resourceInputs["featureStates"] = undefined /*out*/;
            resourceInputs["instanceId"] = undefined /*out*/;
            resourceInputs["instanceStatus"] = undefined /*out*/;
            resourceInputs["kernelVersion"] = undefined /*out*/;
            resourceInputs["masterInstanceId"] = undefined /*out*/;
            resourceInputs["masterInstanceName"] = undefined /*out*/;
            resourceInputs["masterRegion"] = undefined /*out*/;
            resourceInputs["memory"] = undefined /*out*/;
            resourceInputs["nodeCpuUsedPercentage"] = undefined /*out*/;
            resourceInputs["nodeMemoryUsedPercentage"] = undefined /*out*/;
            resourceInputs["nodeNumber"] = undefined /*out*/;
            resourceInputs["nodeSpaceUsedPercentage"] = undefined /*out*/;
            resourceInputs["nodes"] = undefined /*out*/;
            resourceInputs["regionId"] = undefined /*out*/;
            resourceInputs["storageMaxCapacity"] = undefined /*out*/;
            resourceInputs["storageMaxTriggerThreshold"] = undefined /*out*/;
            resourceInputs["storageMinCapacity"] = undefined /*out*/;
            resourceInputs["storageMinTriggerThreshold"] = undefined /*out*/;
            resourceInputs["storageType"] = undefined /*out*/;
            resourceInputs["storageUse"] = undefined /*out*/;
            resourceInputs["timeZone"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
            resourceInputs["vCpu"] = undefined /*out*/;
            resourceInputs["vpcId"] = undefined /*out*/;
            resourceInputs["zoneId"] = undefined /*out*/;
            resourceInputs["zoneIds"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Instance.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'volcengine:rds_mysql/instance:Instance';
//# sourceMappingURL=instance.js.map