"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatabaseInstance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A Firebase Realtime Database instance.
 *
 * To get more information about Instance, see:
 *
 * * [API documentation](https://firebase.google.com/docs/reference/rest/database/database-management/rest)
 * * How-to Guides
 *     * [Official Documentation](https://firebase.google.com/products/realtime-database)
 *
 * ## Example Usage
 *
 * ### Firebase Database Instance Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const basic = new gcp.firebase.DatabaseInstance("basic", {
 *     project: "my-project-name",
 *     region: "us-central1",
 *     instanceId: "active-db",
 * });
 * ```
 * ### Firebase Database Instance Full
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const full = new gcp.firebase.DatabaseInstance("full", {
 *     project: "my-project-name",
 *     region: "europe-west1",
 *     instanceId: "disabled-db",
 *     type: "USER_DATABASE",
 *     desiredState: "DISABLED",
 * });
 * ```
 * ### Firebase Database Instance Default Database
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * import * as time from "@pulumiverse/time";
 *
 * const _default = new gcp.organizations.Project("default", {
 *     projectId: "rtdb-project",
 *     name: "rtdb-project",
 *     orgId: "123456789",
 *     deletionPolicy: "DELETE",
 *     labels: {
 *         firebase: "enabled",
 *     },
 * });
 * const firebase = new gcp.projects.Service("firebase", {
 *     project: _default.projectId,
 *     service: "firebase.googleapis.com",
 * });
 * const defaultProject = new gcp.firebase.Project("default", {project: _default.projectId}, {
 *     dependsOn: [firebase],
 * });
 * const firebaseDatabase = new gcp.projects.Service("firebase_database", {
 *     project: defaultProject.project,
 *     service: "firebasedatabase.googleapis.com",
 * });
 * const wait60Seconds = new time.Sleep("wait_60_seconds", {createDuration: "60s"}, {
 *     dependsOn: [firebaseDatabase],
 * });
 * const defaultDatabaseInstance = new gcp.firebase.DatabaseInstance("default", {
 *     project: defaultProject.project,
 *     region: "us-central1",
 *     instanceId: "rtdb-project-default-rtdb",
 *     type: "DEFAULT_DATABASE",
 * }, {
 *     dependsOn: [wait60Seconds],
 * });
 * ```
 *
 * ## Import
 *
 * Instance can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{region}}/instances/{{instance_id}}`
 *
 * * `{{project}}/{{region}}/{{instance_id}}`
 *
 * * `{{region}}/{{instance_id}}`
 *
 * * `{{instance_id}}`
 *
 * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:firebase/databaseInstance:DatabaseInstance default projects/{{project}}/locations/{{region}}/instances/{{instance_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:firebase/databaseInstance:DatabaseInstance default {{project}}/{{region}}/{{instance_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:firebase/databaseInstance:DatabaseInstance default {{region}}/{{instance_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:firebase/databaseInstance:DatabaseInstance default {{instance_id}}
 * ```
 */
class DatabaseInstance extends pulumi.CustomResource {
    /**
     * Get an existing DatabaseInstance 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 DatabaseInstance(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of DatabaseInstance.  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'] === DatabaseInstance.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["databaseUrl"] = state?.databaseUrl;
            resourceInputs["desiredState"] = state?.desiredState;
            resourceInputs["instanceId"] = state?.instanceId;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["region"] = state?.region;
            resourceInputs["state"] = state?.state;
            resourceInputs["type"] = state?.type;
        }
        else {
            const args = argsOrState;
            if (args?.instanceId === undefined && !opts.urn) {
                throw new Error("Missing required property 'instanceId'");
            }
            if (args?.region === undefined && !opts.urn) {
                throw new Error("Missing required property 'region'");
            }
            resourceInputs["desiredState"] = args?.desiredState;
            resourceInputs["instanceId"] = args?.instanceId;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
            resourceInputs["type"] = args?.type;
            resourceInputs["databaseUrl"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["state"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(DatabaseInstance.__pulumiType, name, resourceInputs, opts);
    }
}
exports.DatabaseInstance = DatabaseInstance;
/** @internal */
DatabaseInstance.__pulumiType = 'gcp:firebase/databaseInstance:DatabaseInstance';
//# sourceMappingURL=databaseInstance.js.map