"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.Database = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * Represents a SQL database inside the Cloud SQL instance, hosted in
 * Google's cloud.
 *
 * ## Example Usage
 *
 * ### Sql Database Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
 * const instance = new gcp.sql.DatabaseInstance("instance", {
 *     name: "my-database-instance",
 *     region: "us-central1",
 *     databaseVersion: "MYSQL_8_0",
 *     settings: {
 *         tier: "db-f1-micro",
 *     },
 *     deletionProtection: true,
 * });
 * const database = new gcp.sql.Database("database", {
 *     name: "my-database",
 *     instance: instance.name,
 * });
 * ```
 * ### Sql Database Deletion Policy
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * // See versions at https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/sql_database_instance#database_version
 * const instance = new gcp.sql.DatabaseInstance("instance", {
 *     name: "my-database-instance",
 *     region: "us-central1",
 *     databaseVersion: "POSTGRES_14",
 *     settings: {
 *         tier: "db-g1-small",
 *     },
 *     deletionProtection: true,
 * });
 * const databaseDeletionPolicy = new gcp.sql.Database("database_deletion_policy", {
 *     name: "my-database",
 *     instance: instance.name,
 *     deletionPolicy: "ABANDON",
 * });
 * ```
 *
 * ## Import
 *
 * Database can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/instances/{{instance}}/databases/{{name}}`
 *
 * * `instances/{{instance}}/databases/{{name}}`
 *
 * * `{{project}}/{{instance}}/{{name}}`
 *
 * * `{{instance}}/{{name}}`
 *
 * When using the `pulumi import` command, Database can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:sql/database:Database default projects/{{project}}/instances/{{instance}}/databases/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:sql/database:Database default instances/{{instance}}/databases/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:sql/database:Database default {{project}}/{{instance}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:sql/database:Database default {{instance}}/{{name}}
 * ```
 */
class Database extends pulumi.CustomResource {
    /**
     * Get an existing Database 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 Database(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Database.  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'] === Database.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["charset"] = state?.charset;
            resourceInputs["collation"] = state?.collation;
            resourceInputs["deletionPolicy"] = state?.deletionPolicy;
            resourceInputs["instance"] = state?.instance;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["selfLink"] = state?.selfLink;
        }
        else {
            const args = argsOrState;
            if (args?.instance === undefined && !opts.urn) {
                throw new Error("Missing required property 'instance'");
            }
            resourceInputs["charset"] = args?.charset;
            resourceInputs["collation"] = args?.collation;
            resourceInputs["deletionPolicy"] = args?.deletionPolicy;
            resourceInputs["instance"] = args?.instance;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["selfLink"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Database.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Database = Database;
/** @internal */
Database.__pulumiType = 'gcp:sql/database:Database';
//# sourceMappingURL=database.js.map