"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.Cluster = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * ## Example Usage
 *
 * ### Alloydb Cluster Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-cluster"});
 * const _default = new gcp.alloydb.Cluster("default", {
 *     clusterId: "alloydb-cluster",
 *     location: "us-central1",
 *     networkConfig: {
 *         network: defaultNetwork.id,
 *     },
 *     deletionProtection: false,
 * });
 * const project = gcp.organizations.getProject({});
 * ```
 * ### Alloydb Cluster Before Upgrade
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = gcp.compute.getNetwork({
 *     name: "alloydb-network",
 * });
 * const defaultCluster = new gcp.alloydb.Cluster("default", {
 *     clusterId: "alloydb-cluster",
 *     location: "us-central1",
 *     networkConfig: {
 *         network: _default.then(_default => _default.id),
 *     },
 *     databaseVersion: "POSTGRES_14",
 *     initialUser: {
 *         password: "alloydb-cluster",
 *     },
 *     deletionProtection: false,
 * });
 * const defaultInstance = new gcp.alloydb.Instance("default", {
 *     cluster: defaultCluster.name,
 *     instanceId: "alloydb-instance",
 *     instanceType: "PRIMARY",
 *     machineConfig: {
 *         cpuCount: 2,
 *     },
 * });
 * ```
 * ### Alloydb Cluster After Upgrade
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = gcp.compute.getNetwork({
 *     name: "alloydb-network",
 * });
 * const defaultCluster = new gcp.alloydb.Cluster("default", {
 *     clusterId: "alloydb-cluster",
 *     location: "us-central1",
 *     networkConfig: {
 *         network: _default.then(_default => _default.id),
 *     },
 *     databaseVersion: "POSTGRES_15",
 *     initialUser: {
 *         password: "alloydb-cluster",
 *     },
 *     deletionProtection: false,
 * });
 * const defaultInstance = new gcp.alloydb.Instance("default", {
 *     cluster: defaultCluster.name,
 *     instanceId: "alloydb-instance",
 *     instanceType: "PRIMARY",
 *     machineConfig: {
 *         cpuCount: 2,
 *     },
 * });
 * ```
 * ### Alloydb Cluster Full
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {name: "alloydb-cluster-full"});
 * const full = new gcp.alloydb.Cluster("full", {
 *     clusterId: "alloydb-cluster-full",
 *     location: "us-central1",
 *     networkConfig: {
 *         network: _default.id,
 *     },
 *     databaseVersion: "POSTGRES_15",
 *     initialUser: {
 *         user: "alloydb-cluster-full",
 *         password: "alloydb-cluster-full",
 *     },
 *     continuousBackupConfig: {
 *         enabled: true,
 *         recoveryWindowDays: 14,
 *     },
 *     automatedBackupPolicy: {
 *         location: "us-central1",
 *         backupWindow: "1800s",
 *         enabled: true,
 *         weeklySchedule: {
 *             daysOfWeeks: ["MONDAY"],
 *             startTimes: [{
 *                 hours: 23,
 *                 minutes: 0,
 *                 seconds: 0,
 *                 nanos: 0,
 *             }],
 *         },
 *         quantityBasedRetention: {
 *             count: 1,
 *         },
 *         labels: {
 *             test: "alloydb-cluster-full",
 *         },
 *     },
 *     labels: {
 *         test: "alloydb-cluster-full",
 *     },
 *     deletionProtection: false,
 * });
 * const project = gcp.organizations.getProject({});
 * ```
 * ### Alloydb Cluster Restore
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = gcp.compute.getNetwork({
 *     name: "alloydb-network",
 * });
 * const source = new gcp.alloydb.Cluster("source", {
 *     clusterId: "alloydb-source-cluster",
 *     location: "us-central1",
 *     network: _default.then(_default => _default.id),
 *     initialUser: {
 *         password: "alloydb-source-cluster",
 *     },
 *     deletionProtection: false,
 * });
 * const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
 *     name: "alloydb-source-cluster",
 *     addressType: "INTERNAL",
 *     purpose: "VPC_PEERING",
 *     prefixLength: 16,
 *     network: _default.then(_default => _default.id),
 * });
 * const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
 *     network: _default.then(_default => _default.id),
 *     service: "servicenetworking.googleapis.com",
 *     reservedPeeringRanges: [privateIpAlloc.name],
 * });
 * const sourceInstance = new gcp.alloydb.Instance("source", {
 *     cluster: source.name,
 *     instanceId: "alloydb-instance",
 *     instanceType: "PRIMARY",
 *     machineConfig: {
 *         cpuCount: 2,
 *     },
 * }, {
 *     dependsOn: [vpcConnection],
 * });
 * const sourceBackup = new gcp.alloydb.Backup("source", {
 *     backupId: "alloydb-backup",
 *     location: "us-central1",
 *     clusterName: source.name,
 * }, {
 *     dependsOn: [sourceInstance],
 * });
 * const restoredFromBackup = new gcp.alloydb.Cluster("restored_from_backup", {
 *     clusterId: "alloydb-backup-restored",
 *     location: "us-central1",
 *     networkConfig: {
 *         network: _default.then(_default => _default.id),
 *     },
 *     restoreBackupSource: {
 *         backupName: sourceBackup.name,
 *     },
 *     deletionProtection: false,
 * });
 * const restoredViaPitr = new gcp.alloydb.Cluster("restored_via_pitr", {
 *     clusterId: "alloydb-pitr-restored",
 *     location: "us-central1",
 *     networkConfig: {
 *         network: _default.then(_default => _default.id),
 *     },
 *     restoreContinuousBackupSource: {
 *         cluster: source.name,
 *         pointInTime: "2023-08-03T19:19:00.094Z",
 *     },
 *     deletionProtection: false,
 * });
 * const project = gcp.organizations.getProject({});
 * ```
 * ### Alloydb Secondary Cluster Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {name: "alloydb-secondary-cluster"});
 * 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-cluster",
 *     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: _default.id,
 *     },
 *     clusterType: "SECONDARY",
 *     continuousBackupConfig: {
 *         enabled: false,
 *     },
 *     secondaryConfig: {
 *         primaryClusterName: primary.name,
 *     },
 *     deletionProtection: false,
 * }, {
 *     dependsOn: [primaryInstance],
 * });
 * const project = gcp.organizations.getProject({});
 * ```
 *
 * ## Import
 *
 * Cluster can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}`
 *
 * * `{{project}}/{{location}}/{{cluster_id}}`
 *
 * * `{{location}}/{{cluster_id}}`
 *
 * * `{{cluster_id}}`
 *
 * When using the `pulumi import` command, Cluster can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:alloydb/cluster:Cluster default projects/{{project}}/locations/{{location}}/clusters/{{cluster_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:alloydb/cluster:Cluster default {{project}}/{{location}}/{{cluster_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:alloydb/cluster:Cluster default {{location}}/{{cluster_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:alloydb/cluster:Cluster default {{cluster_id}}
 * ```
 */
class Cluster extends pulumi.CustomResource {
    /**
     * Get an existing Cluster 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 Cluster(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Cluster.  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'] === Cluster.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["annotations"] = state?.annotations;
            resourceInputs["automatedBackupPolicy"] = state?.automatedBackupPolicy;
            resourceInputs["backupSources"] = state?.backupSources;
            resourceInputs["clusterId"] = state?.clusterId;
            resourceInputs["clusterType"] = state?.clusterType;
            resourceInputs["continuousBackupConfig"] = state?.continuousBackupConfig;
            resourceInputs["continuousBackupInfos"] = state?.continuousBackupInfos;
            resourceInputs["databaseVersion"] = state?.databaseVersion;
            resourceInputs["deletionPolicy"] = state?.deletionPolicy;
            resourceInputs["deletionProtection"] = state?.deletionProtection;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["encryptionConfig"] = state?.encryptionConfig;
            resourceInputs["encryptionInfos"] = state?.encryptionInfos;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["initialUser"] = state?.initialUser;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["location"] = state?.location;
            resourceInputs["maintenanceUpdatePolicy"] = state?.maintenanceUpdatePolicy;
            resourceInputs["migrationSources"] = state?.migrationSources;
            resourceInputs["name"] = state?.name;
            resourceInputs["networkConfig"] = state?.networkConfig;
            resourceInputs["project"] = state?.project;
            resourceInputs["pscConfig"] = state?.pscConfig;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["reconciling"] = state?.reconciling;
            resourceInputs["restoreBackupSource"] = state?.restoreBackupSource;
            resourceInputs["restoreContinuousBackupSource"] = state?.restoreContinuousBackupSource;
            resourceInputs["secondaryConfig"] = state?.secondaryConfig;
            resourceInputs["skipAwaitMajorVersionUpgrade"] = state?.skipAwaitMajorVersionUpgrade;
            resourceInputs["state"] = state?.state;
            resourceInputs["subscriptionType"] = state?.subscriptionType;
            resourceInputs["trialMetadatas"] = state?.trialMetadatas;
            resourceInputs["uid"] = state?.uid;
        }
        else {
            const args = argsOrState;
            if (args?.clusterId === undefined && !opts.urn) {
                throw new Error("Missing required property 'clusterId'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            resourceInputs["annotations"] = args?.annotations;
            resourceInputs["automatedBackupPolicy"] = args?.automatedBackupPolicy;
            resourceInputs["clusterId"] = args?.clusterId;
            resourceInputs["clusterType"] = args?.clusterType;
            resourceInputs["continuousBackupConfig"] = args?.continuousBackupConfig;
            resourceInputs["databaseVersion"] = args?.databaseVersion;
            resourceInputs["deletionPolicy"] = args?.deletionPolicy;
            resourceInputs["deletionProtection"] = args?.deletionProtection;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["encryptionConfig"] = args?.encryptionConfig;
            resourceInputs["etag"] = args?.etag;
            resourceInputs["initialUser"] = args?.initialUser;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["location"] = args?.location;
            resourceInputs["maintenanceUpdatePolicy"] = args?.maintenanceUpdatePolicy;
            resourceInputs["networkConfig"] = args?.networkConfig;
            resourceInputs["project"] = args?.project;
            resourceInputs["pscConfig"] = args?.pscConfig;
            resourceInputs["restoreBackupSource"] = args?.restoreBackupSource;
            resourceInputs["restoreContinuousBackupSource"] = args?.restoreContinuousBackupSource;
            resourceInputs["secondaryConfig"] = args?.secondaryConfig;
            resourceInputs["skipAwaitMajorVersionUpgrade"] = args?.skipAwaitMajorVersionUpgrade;
            resourceInputs["subscriptionType"] = args?.subscriptionType;
            resourceInputs["backupSources"] = undefined /*out*/;
            resourceInputs["continuousBackupInfos"] = undefined /*out*/;
            resourceInputs["effectiveAnnotations"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["encryptionInfos"] = undefined /*out*/;
            resourceInputs["migrationSources"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["reconciling"] = undefined /*out*/;
            resourceInputs["state"] = undefined /*out*/;
            resourceInputs["trialMetadatas"] = undefined /*out*/;
            resourceInputs["uid"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(Cluster.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Cluster = Cluster;
/** @internal */
Cluster.__pulumiType = 'gcp:alloydb/cluster:Cluster';
//# sourceMappingURL=cluster.js.map