"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.UserCreds = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * User credentials for a Cloud Firestore with MongoDB compatibility database.
 * The resource is owned by the database and is deleted along with the database.
 *
 * To get more information about UserCreds, see:
 *
 * * [API documentation](https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.userCreds)
 * * How-to Guides
 *     * [Authenticate and connect to a database](https://cloud.google.com/firestore/mongodb-compatibility/docs/connect)
 *
 * ## Example Usage
 *
 * ### Firestore User Creds Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const database = new gcp.firestore.Database("database", {
 *     project: "my-project-name",
 *     name: "database-id-mongodb-compatible",
 *     locationId: "nam5",
 *     type: "FIRESTORE_NATIVE",
 *     databaseEdition: "ENTERPRISE",
 *     deleteProtectionState: "DELETE_PROTECTION_DISABLED",
 *     deletionPolicy: "DELETE",
 * });
 * const my_user_creds = new gcp.firestore.UserCreds("my-user-creds", {
 *     project: "my-project-name",
 *     database: database.name,
 *     name: "my-username",
 * });
 * ```
 * ### Firestore User Creds With Secret Manager
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const database = new gcp.firestore.Database("database", {
 *     project: "my-project-name",
 *     name: "database-id-mongodb-compatible",
 *     locationId: "nam5",
 *     type: "FIRESTORE_NATIVE",
 *     databaseEdition: "ENTERPRISE",
 *     deleteProtectionState: "DELETE_PROTECTION_DISABLED",
 *     deletionPolicy: "DELETE",
 * });
 * const my_user_creds = new gcp.firestore.UserCreds("my-user-creds", {
 *     project: "my-project-name",
 *     database: database.name,
 *     name: "my-username",
 * });
 * const my_fs_user_creds_secret = new gcp.secretmanager.Secret("my-fs-user-creds-secret", {
 *     project: "my-project-name",
 *     secretId: "my-fs-user-creds-secret",
 *     replication: {
 *         auto: {},
 *     },
 * });
 * const my_fs_user_creds_secret_version = new gcp.secretmanager.SecretVersion("my-fs-user-creds-secret-version", {
 *     secret: my_fs_user_creds_secret.id,
 *     secretData: my_user_creds.securePassword,
 * });
 * ```
 *
 * ## Import
 *
 * UserCreds can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/databases/{{database}}/userCreds/{{name}}`
 *
 * * `{{project}}/{{database}}/{{name}}`
 *
 * * `{{database}}/{{name}}`
 *
 * When using the `pulumi import` command, UserCreds can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:firestore/userCreds:UserCreds default projects/{{project}}/databases/{{database}}/userCreds/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:firestore/userCreds:UserCreds default {{project}}/{{database}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:firestore/userCreds:UserCreds default {{database}}/{{name}}
 * ```
 */
class UserCreds extends pulumi.CustomResource {
    /**
     * Get an existing UserCreds 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 UserCreds(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of UserCreds.  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'] === UserCreds.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["database"] = state?.database;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["resourceIdentities"] = state?.resourceIdentities;
            resourceInputs["securePassword"] = state?.securePassword;
            resourceInputs["state"] = state?.state;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.database === undefined && !opts.urn) {
                throw new Error("Missing required property 'database'");
            }
            resourceInputs["database"] = args?.database;
            resourceInputs["name"] = args?.name;
            resourceInputs["project"] = args?.project;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["resourceIdentities"] = undefined /*out*/;
            resourceInputs["securePassword"] = undefined /*out*/;
            resourceInputs["state"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["securePassword"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(UserCreds.__pulumiType, name, resourceInputs, opts);
    }
}
exports.UserCreds = UserCreds;
/** @internal */
UserCreds.__pulumiType = 'gcp:firestore/userCreds:UserCreds';
//# sourceMappingURL=userCreds.js.map