"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.Instance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * ## Example Usage
 *
 * ### Alloydb Instance Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"});
 * const defaultCluster = new gcp.alloydb.Cluster("default", {
 *     clusterId: "alloydb-cluster",
 *     location: "us-central1",
 *     networkConfig: {
 *         network: defaultNetwork.id,
 *     },
 *     initialUser: {
 *         password: "alloydb-cluster",
 *     },
 *     deletionProtection: false,
 * });
 * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
 *     name: "alloydb-cluster",
 *     addressType: "INTERNAL",
 *     purpose: "VPC_PEERING",
 *     prefixLength: 16,
 *     network: defaultNetwork.id,
 * });
 * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
 *     network: defaultNetwork.id,
 *     service: "servicenetworking.googleapis.com",
 *     reservedPeeringRanges: [privateIpAlloc.name],
 * });
 * const _default = new gcp.alloydb.Instance("default", {
 *     cluster: defaultCluster.name,
 *     instanceId: "alloydb-instance",
 *     instanceType: "PRIMARY",
 *     machineConfig: {
 *         cpuCount: 2,
 *     },
 * }, {
 *     dependsOn: [vpcConnection],
 * });
 * const project = gcp.organizations.getProject({});
 * ```
 * ### Alloydb Secondary Instance Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {name: "alloydb-secondary-network"});
 * const primary = new gcp.alloydb.Cluster("primary", {
 *     clusterId: "alloydb-primary-cluster",
 *     location: "us-central1",
 *     networkConfig: {
 *         network: _default.id,
 *     },
 *     deletionProtection: false,
 * });
 * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
 *     name: "alloydb-secondary-instance",
 *     addressType: "INTERNAL",
 *     purpose: "VPC_PEERING",
 *     prefixLength: 16,
 *     network: _default.id,
 * });
 * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
 *     network: _default.id,
 *     service: "servicenetworking.googleapis.com",
 *     reservedPeeringRanges: [privateIpAlloc.name],
 * });
 * const primaryInstance = new gcp.alloydb.Instance("primary", {
 *     cluster: primary.name,
 *     instanceId: "alloydb-primary-instance",
 *     instanceType: "PRIMARY",
 *     machineConfig: {
 *         cpuCount: 2,
 *     },
 * }, {
 *     dependsOn: [vpcConnection],
 * });
 * const secondary = new gcp.alloydb.Cluster("secondary", {
 *     clusterId: "alloydb-secondary-cluster",
 *     location: "us-east1",
 *     networkConfig: {
 *         network: defaultGoogleComputeNetwork.id,
 *     },
 *     clusterType: "SECONDARY",
 *     continuousBackupConfig: {
 *         enabled: false,
 *     },
 *     secondaryConfig: {
 *         primaryClusterName: primary.name,
 *     },
 *     deletionPolicy: "FORCE",
 *     deletionProtection: false,
 * }, {
 *     dependsOn: [primaryInstance],
 * });
 * const secondaryInstance = new gcp.alloydb.Instance("secondary", {
 *     cluster: secondary.name,
 *     instanceId: "alloydb-secondary-instance",
 *     instanceType: secondary.clusterType,
 *     machineConfig: {
 *         cpuCount: 2,
 *     },
 * }, {
 *     dependsOn: [vpcConnection],
 * });
 * const project = gcp.organizations.getProject({});
 * ```
 *
 * ## Import
 *
 * Instance can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/instances/{{instance_id}}`
 *
 * * `{{project}}/{{location}}/{{cluster}}/{{instance_id}}`
 *
 * * `{{location}}/{{cluster}}/{{instance_id}}`
 *
 * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:alloydb/instance:Instance default projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/instances/{{instance_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:alloydb/instance:Instance default {{project}}/{{location}}/{{cluster}}/{{instance_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:alloydb/instance:Instance default {{location}}/{{cluster}}/{{instance_id}}
 * ```
 */
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, { ...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["activationPolicy"] = state?.activationPolicy;
            resourceInputs["annotations"] = state?.annotations;
            resourceInputs["availabilityType"] = state?.availabilityType;
            resourceInputs["clientConnectionConfig"] = state?.clientConnectionConfig;
            resourceInputs["cluster"] = state?.cluster;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["databaseFlags"] = state?.databaseFlags;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["gceZone"] = state?.gceZone;
            resourceInputs["instanceId"] = state?.instanceId;
            resourceInputs["instanceType"] = state?.instanceType;
            resourceInputs["ipAddress"] = state?.ipAddress;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["machineConfig"] = state?.machineConfig;
            resourceInputs["name"] = state?.name;
            resourceInputs["networkConfig"] = state?.networkConfig;
            resourceInputs["observabilityConfig"] = state?.observabilityConfig;
            resourceInputs["outboundPublicIpAddresses"] = state?.outboundPublicIpAddresses;
            resourceInputs["pscInstanceConfig"] = state?.pscInstanceConfig;
            resourceInputs["publicIpAddress"] = state?.publicIpAddress;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["queryInsightsConfig"] = state?.queryInsightsConfig;
            resourceInputs["readPoolConfig"] = state?.readPoolConfig;
            resourceInputs["reconciling"] = state?.reconciling;
            resourceInputs["state"] = state?.state;
            resourceInputs["uid"] = state?.uid;
            resourceInputs["updateTime"] = state?.updateTime;
        }
        else {
            const args = argsOrState;
            if (args?.cluster === undefined && !opts.urn) {
                throw new Error("Missing required property 'cluster'");
            }
            if (args?.instanceId === undefined && !opts.urn) {
                throw new Error("Missing required property 'instanceId'");
            }
            if (args?.instanceType === undefined && !opts.urn) {
                throw new Error("Missing required property 'instanceType'");
            }
            resourceInputs["activationPolicy"] = args?.activationPolicy;
            resourceInputs["annotations"] = args?.annotations;
            resourceInputs["availabilityType"] = args?.availabilityType;
            resourceInputs["clientConnectionConfig"] = args?.clientConnectionConfig;
            resourceInputs["cluster"] = args?.cluster;
            resourceInputs["databaseFlags"] = args?.databaseFlags;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["gceZone"] = args?.gceZone;
            resourceInputs["instanceId"] = args?.instanceId;
            resourceInputs["instanceType"] = args?.instanceType;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["machineConfig"] = args?.machineConfig;
            resourceInputs["networkConfig"] = args?.networkConfig;
            resourceInputs["observabilityConfig"] = args?.observabilityConfig;
            resourceInputs["pscInstanceConfig"] = args?.pscInstanceConfig;
            resourceInputs["queryInsightsConfig"] = args?.queryInsightsConfig;
            resourceInputs["readPoolConfig"] = args?.readPoolConfig;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["effectiveAnnotations"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["ipAddress"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["outboundPublicIpAddresses"] = undefined /*out*/;
            resourceInputs["publicIpAddress"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["reconciling"] = undefined /*out*/;
            resourceInputs["state"] = undefined /*out*/;
            resourceInputs["uid"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(Instance.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'gcp:alloydb/instance:Instance';
//# sourceMappingURL=instance.js.map