"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.SourceRepresentationInstance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A source representation instance is a Cloud SQL instance that represents
 * the source database server to the Cloud SQL replica. It is visible in the
 * Cloud Console and appears the same as a regular Cloud SQL instance, but it
 * contains no data, requires no configuration or maintenance, and does not
 * affect billing. You cannot update the source representation instance.
 *
 * ## Example Usage
 *
 * ### Sql Source Representation Instance Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const instance = new gcp.sql.SourceRepresentationInstance("instance", {
 *     name: "my-instance",
 *     region: "us-central1",
 *     databaseVersion: "MYSQL_8_0",
 *     host: "10.20.30.40",
 *     port: 3306,
 *     username: "some-user",
 *     password: "password-for-the-user",
 *     dumpFilePath: "gs://replica-bucket/source-database.sql.gz",
 * });
 * ```
 * ### Sql Source Representation Instance Postgres
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const instance = new gcp.sql.SourceRepresentationInstance("instance", {
 *     name: "my-instance",
 *     region: "us-central1",
 *     databaseVersion: "POSTGRES_9_6",
 *     host: "10.20.30.40",
 *     port: 3306,
 *     username: "some-user",
 *     password: "password-for-the-user",
 *     dumpFilePath: "gs://replica-bucket/source-database.sql.gz",
 * });
 * ```
 *
 * ## Import
 *
 * SourceRepresentationInstance can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/instances/{{name}}`
 *
 * * `{{project}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, SourceRepresentationInstance can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default projects/{{project}}/instances/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default {{project}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance default {{name}}
 * ```
 */
class SourceRepresentationInstance extends pulumi.CustomResource {
    /**
     * Get an existing SourceRepresentationInstance 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 SourceRepresentationInstance(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of SourceRepresentationInstance.  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'] === SourceRepresentationInstance.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["caCertificate"] = state?.caCertificate;
            resourceInputs["clientCertificate"] = state?.clientCertificate;
            resourceInputs["clientKey"] = state?.clientKey;
            resourceInputs["databaseVersion"] = state?.databaseVersion;
            resourceInputs["dumpFilePath"] = state?.dumpFilePath;
            resourceInputs["host"] = state?.host;
            resourceInputs["name"] = state?.name;
            resourceInputs["password"] = state?.password;
            resourceInputs["port"] = state?.port;
            resourceInputs["project"] = state?.project;
            resourceInputs["region"] = state?.region;
            resourceInputs["username"] = state?.username;
        }
        else {
            const args = argsOrState;
            if (args?.databaseVersion === undefined && !opts.urn) {
                throw new Error("Missing required property 'databaseVersion'");
            }
            if (args?.host === undefined && !opts.urn) {
                throw new Error("Missing required property 'host'");
            }
            resourceInputs["caCertificate"] = args?.caCertificate;
            resourceInputs["clientCertificate"] = args?.clientCertificate;
            resourceInputs["clientKey"] = args?.clientKey;
            resourceInputs["databaseVersion"] = args?.databaseVersion;
            resourceInputs["dumpFilePath"] = args?.dumpFilePath;
            resourceInputs["host"] = args?.host;
            resourceInputs["name"] = args?.name;
            resourceInputs["password"] = args?.password ? pulumi.secret(args.password) : undefined;
            resourceInputs["port"] = args?.port;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
            resourceInputs["username"] = args?.username;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["password"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(SourceRepresentationInstance.__pulumiType, name, resourceInputs, opts);
    }
}
exports.SourceRepresentationInstance = SourceRepresentationInstance;
/** @internal */
SourceRepresentationInstance.__pulumiType = 'gcp:sql/sourceRepresentationInstance:SourceRepresentationInstance';
//# sourceMappingURL=sourceRepresentationInstance.js.map