"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");
/**
 * A Google Cloud Memorystore instance.
 *
 * To get more information about Instance, see:
 *
 * * [API documentation](https://cloud.google.com/memorystore/docs/valkey/reference/rest/v1/projects.locations.instances)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/memorystore/docs/valkey/create-instances)
 *
 * ## Example Usage
 *
 * ### Memorystore Instance Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const producerNet = new gcp.compute.Network("producer_net", {
 *     name: "my-network",
 *     autoCreateSubnetworks: false,
 * });
 * const producerSubnet = new gcp.compute.Subnetwork("producer_subnet", {
 *     name: "my-subnet",
 *     ipCidrRange: "10.0.0.248/29",
 *     region: "us-central1",
 *     network: producerNet.id,
 * });
 * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", {
 *     name: "my-policy",
 *     location: "us-central1",
 *     serviceClass: "gcp-memorystore",
 *     description: "my basic service connection policy",
 *     network: producerNet.id,
 *     pscConfig: {
 *         subnetworks: [producerSubnet.id],
 *     },
 * });
 * const project = gcp.organizations.getProject({});
 * const instance_basic = new gcp.memorystore.Instance("instance-basic", {
 *     instanceId: "basic-instance",
 *     shardCount: 1,
 *     desiredAutoCreatedEndpoints: [{
 *         network: producerNet.id,
 *         projectId: project.then(project => project.projectId),
 *     }],
 *     location: "us-central1",
 *     deletionProtectionEnabled: false,
 *     maintenancePolicy: {
 *         weeklyMaintenanceWindows: [{
 *             day: "MONDAY",
 *             startTime: {
 *                 hours: 1,
 *                 minutes: 0,
 *                 seconds: 0,
 *                 nanos: 0,
 *             },
 *         }],
 *     },
 * }, {
 *     dependsOn: [_default],
 * });
 * ```
 * ### Memorystore Instance Full
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const producerNet = new gcp.compute.Network("producer_net", {
 *     name: "my-network",
 *     autoCreateSubnetworks: false,
 * });
 * const producerSubnet = new gcp.compute.Subnetwork("producer_subnet", {
 *     name: "my-subnet",
 *     ipCidrRange: "10.0.0.248/29",
 *     region: "us-central1",
 *     network: producerNet.id,
 * });
 * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", {
 *     name: "my-policy",
 *     location: "us-central1",
 *     serviceClass: "gcp-memorystore",
 *     description: "my basic service connection policy",
 *     network: producerNet.id,
 *     pscConfig: {
 *         subnetworks: [producerSubnet.id],
 *     },
 * });
 * const project = gcp.organizations.getProject({});
 * const instance_full = new gcp.memorystore.Instance("instance-full", {
 *     instanceId: "full-instance",
 *     shardCount: 1,
 *     desiredAutoCreatedEndpoints: [{
 *         network: producerNet.id,
 *         projectId: project.then(project => project.projectId),
 *     }],
 *     location: "us-central1",
 *     replicaCount: 1,
 *     nodeType: "SHARED_CORE_NANO",
 *     transitEncryptionMode: "TRANSIT_ENCRYPTION_DISABLED",
 *     authorizationMode: "AUTH_DISABLED",
 *     kmsKey: "my-key",
 *     engineConfigs: {
 *         "maxmemory-policy": "volatile-ttl",
 *     },
 *     zoneDistributionConfig: {
 *         mode: "SINGLE_ZONE",
 *         zone: "us-central1-b",
 *     },
 *     maintenancePolicy: {
 *         weeklyMaintenanceWindows: [{
 *             day: "MONDAY",
 *             startTime: {
 *                 hours: 1,
 *                 minutes: 0,
 *                 seconds: 0,
 *                 nanos: 0,
 *             },
 *         }],
 *     },
 *     engineVersion: "VALKEY_7_2",
 *     deletionProtectionEnabled: false,
 *     mode: "CLUSTER",
 *     persistenceConfig: {
 *         mode: "RDB",
 *         rdbConfig: {
 *             rdbSnapshotPeriod: "ONE_HOUR",
 *             rdbSnapshotStartTime: "2024-10-02T15:01:23Z",
 *         },
 *     },
 *     labels: {
 *         abc: "xyz",
 *     },
 * }, {
 *     dependsOn: [_default],
 * });
 * ```
 * ### Memorystore Instance Persistence Aof
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const producerNet = new gcp.compute.Network("producer_net", {
 *     name: "my-network",
 *     autoCreateSubnetworks: false,
 * });
 * const producerSubnet = new gcp.compute.Subnetwork("producer_subnet", {
 *     name: "my-subnet",
 *     ipCidrRange: "10.0.0.248/29",
 *     region: "us-central1",
 *     network: producerNet.id,
 * });
 * const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", {
 *     name: "my-policy",
 *     location: "us-central1",
 *     serviceClass: "gcp-memorystore",
 *     description: "my basic service connection policy",
 *     network: producerNet.id,
 *     pscConfig: {
 *         subnetworks: [producerSubnet.id],
 *     },
 * });
 * const project = gcp.organizations.getProject({});
 * const instance_persistence_aof = new gcp.memorystore.Instance("instance-persistence-aof", {
 *     instanceId: "aof-instance",
 *     shardCount: 1,
 *     desiredAutoCreatedEndpoints: [{
 *         network: producerNet.id,
 *         projectId: project.then(project => project.projectId),
 *     }],
 *     location: "us-central1",
 *     persistenceConfig: {
 *         mode: "AOF",
 *         aofConfig: {
 *             appendFsync: "EVERY_SEC",
 *         },
 *     },
 *     deletionProtectionEnabled: false,
 * }, {
 *     dependsOn: [_default],
 * });
 * ```
 * ### Memorystore Instance Secondary Instance
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const primaryProducerNet = new gcp.compute.Network("primary_producer_net", {
 *     name: "my-network-primary-instance",
 *     autoCreateSubnetworks: false,
 * });
 * const primaryProducerSubnet = new gcp.compute.Subnetwork("primary_producer_subnet", {
 *     name: "my-subnet-primary-instance",
 *     ipCidrRange: "10.0.1.0/29",
 *     region: "asia-east1",
 *     network: primaryProducerNet.id,
 * });
 * const primaryPolicy = new gcp.networkconnectivity.ServiceConnectionPolicy("primary_policy", {
 *     name: "my-policy-primary-instance",
 *     location: "asia-east1",
 *     serviceClass: "gcp-memorystore",
 *     description: "my basic service connection policy",
 *     network: primaryProducerNet.id,
 *     pscConfig: {
 *         subnetworks: [primaryProducerSubnet.id],
 *     },
 * });
 * const project = gcp.organizations.getProject({});
 * // Primary instance
 * const primaryInstance = new gcp.memorystore.Instance("primary_instance", {
 *     instanceId: "primary-instance",
 *     shardCount: 1,
 *     desiredAutoCreatedEndpoints: [{
 *         network: primaryProducerNet.id,
 *         projectId: project.then(project => project.projectId),
 *     }],
 *     location: "asia-east1",
 *     replicaCount: 1,
 *     nodeType: "SHARED_CORE_NANO",
 *     transitEncryptionMode: "TRANSIT_ENCRYPTION_DISABLED",
 *     authorizationMode: "AUTH_DISABLED",
 *     engineConfigs: {
 *         "maxmemory-policy": "volatile-ttl",
 *     },
 *     zoneDistributionConfig: {
 *         mode: "SINGLE_ZONE",
 *         zone: "asia-east1-c",
 *     },
 *     deletionProtectionEnabled: true,
 *     persistenceConfig: {
 *         mode: "RDB",
 *         rdbConfig: {
 *             rdbSnapshotPeriod: "ONE_HOUR",
 *             rdbSnapshotStartTime: "2024-10-02T15:01:23Z",
 *         },
 *     },
 *     labels: {
 *         abc: "xyz",
 *     },
 * }, {
 *     dependsOn: [primaryPolicy],
 * });
 * const secondaryProducerNet = new gcp.compute.Network("secondary_producer_net", {
 *     name: "my-network-secondary-instance",
 *     autoCreateSubnetworks: false,
 * });
 * const secondaryProducerSubnet = new gcp.compute.Subnetwork("secondary_producer_subnet", {
 *     name: "my-subnet-secondary-instance",
 *     ipCidrRange: "10.0.2.0/29",
 *     region: "europe-north1",
 *     network: secondaryProducerNet.id,
 * });
 * const secondaryPolicy = new gcp.networkconnectivity.ServiceConnectionPolicy("secondary_policy", {
 *     name: "my-policy-secondary-instance",
 *     location: "europe-north1",
 *     serviceClass: "gcp-memorystore",
 *     description: "my basic service connection policy",
 *     network: secondaryProducerNet.id,
 *     pscConfig: {
 *         subnetworks: [secondaryProducerSubnet.id],
 *     },
 * });
 * // Secondary instance
 * const secondaryInstance = new gcp.memorystore.Instance("secondary_instance", {
 *     instanceId: "secondary-instance",
 *     shardCount: 1,
 *     desiredAutoCreatedEndpoints: [{
 *         network: secondaryProducerNet.id,
 *         projectId: project.then(project => project.projectId),
 *     }],
 *     location: "europe-north1",
 *     replicaCount: 1,
 *     nodeType: "SHARED_CORE_NANO",
 *     transitEncryptionMode: "TRANSIT_ENCRYPTION_DISABLED",
 *     authorizationMode: "AUTH_DISABLED",
 *     engineConfigs: {
 *         "maxmemory-policy": "volatile-ttl",
 *     },
 *     zoneDistributionConfig: {
 *         mode: "SINGLE_ZONE",
 *         zone: "europe-north1-c",
 *     },
 *     deletionProtectionEnabled: true,
 *     crossInstanceReplicationConfig: {
 *         instanceRole: "SECONDARY",
 *         primaryInstance: {
 *             instance: primaryInstance.id,
 *         },
 *     },
 *     persistenceConfig: {
 *         mode: "RDB",
 *         rdbConfig: {
 *             rdbSnapshotPeriod: "ONE_HOUR",
 *             rdbSnapshotStartTime: "2024-10-02T15:01:23Z",
 *         },
 *     },
 *     labels: {
 *         abc: "xyz",
 *     },
 * }, {
 *     dependsOn: [secondaryPolicy],
 * });
 * ```
 *
 * ## Import
 *
 * Instance can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/instances/{{instance_id}}`
 *
 * * `{{project}}/{{location}}/{{instance_id}}`
 *
 * * `{{location}}/{{instance_id}}`
 *
 * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:memorystore/instance:Instance default projects/{{project}}/locations/{{location}}/instances/{{instance_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:memorystore/instance:Instance default {{project}}/{{location}}/{{instance_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:memorystore/instance:Instance default {{location}}/{{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["authorizationMode"] = state?.authorizationMode;
            resourceInputs["automatedBackupConfig"] = state?.automatedBackupConfig;
            resourceInputs["availableMaintenanceVersions"] = state?.availableMaintenanceVersions;
            resourceInputs["backupCollection"] = state?.backupCollection;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["crossInstanceReplicationConfig"] = state?.crossInstanceReplicationConfig;
            resourceInputs["deletionProtectionEnabled"] = state?.deletionProtectionEnabled;
            resourceInputs["desiredAutoCreatedEndpoints"] = state?.desiredAutoCreatedEndpoints;
            resourceInputs["desiredPscAutoConnections"] = state?.desiredPscAutoConnections;
            resourceInputs["discoveryEndpoints"] = state?.discoveryEndpoints;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["effectiveMaintenanceVersion"] = state?.effectiveMaintenanceVersion;
            resourceInputs["endpoints"] = state?.endpoints;
            resourceInputs["engineConfigs"] = state?.engineConfigs;
            resourceInputs["engineVersion"] = state?.engineVersion;
            resourceInputs["gcsSource"] = state?.gcsSource;
            resourceInputs["instanceId"] = state?.instanceId;
            resourceInputs["kmsKey"] = state?.kmsKey;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["location"] = state?.location;
            resourceInputs["maintenancePolicy"] = state?.maintenancePolicy;
            resourceInputs["maintenanceSchedules"] = state?.maintenanceSchedules;
            resourceInputs["maintenanceVersion"] = state?.maintenanceVersion;
            resourceInputs["managedBackupSource"] = state?.managedBackupSource;
            resourceInputs["managedServerCas"] = state?.managedServerCas;
            resourceInputs["mode"] = state?.mode;
            resourceInputs["name"] = state?.name;
            resourceInputs["nodeConfigs"] = state?.nodeConfigs;
            resourceInputs["nodeType"] = state?.nodeType;
            resourceInputs["persistenceConfig"] = state?.persistenceConfig;
            resourceInputs["project"] = state?.project;
            resourceInputs["pscAttachmentDetails"] = state?.pscAttachmentDetails;
            resourceInputs["pscAutoConnections"] = state?.pscAutoConnections;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["replicaCount"] = state?.replicaCount;
            resourceInputs["shardCount"] = state?.shardCount;
            resourceInputs["state"] = state?.state;
            resourceInputs["stateInfos"] = state?.stateInfos;
            resourceInputs["transitEncryptionMode"] = state?.transitEncryptionMode;
            resourceInputs["uid"] = state?.uid;
            resourceInputs["updateTime"] = state?.updateTime;
            resourceInputs["zoneDistributionConfig"] = state?.zoneDistributionConfig;
        }
        else {
            const args = argsOrState;
            if (args?.instanceId === undefined && !opts.urn) {
                throw new Error("Missing required property 'instanceId'");
            }
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.shardCount === undefined && !opts.urn) {
                throw new Error("Missing required property 'shardCount'");
            }
            resourceInputs["authorizationMode"] = args?.authorizationMode;
            resourceInputs["automatedBackupConfig"] = args?.automatedBackupConfig;
            resourceInputs["crossInstanceReplicationConfig"] = args?.crossInstanceReplicationConfig;
            resourceInputs["deletionProtectionEnabled"] = args?.deletionProtectionEnabled;
            resourceInputs["desiredAutoCreatedEndpoints"] = args?.desiredAutoCreatedEndpoints;
            resourceInputs["desiredPscAutoConnections"] = args?.desiredPscAutoConnections;
            resourceInputs["engineConfigs"] = args?.engineConfigs;
            resourceInputs["engineVersion"] = args?.engineVersion;
            resourceInputs["gcsSource"] = args?.gcsSource;
            resourceInputs["instanceId"] = args?.instanceId;
            resourceInputs["kmsKey"] = args?.kmsKey;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["location"] = args?.location;
            resourceInputs["maintenancePolicy"] = args?.maintenancePolicy;
            resourceInputs["maintenanceVersion"] = args?.maintenanceVersion;
            resourceInputs["managedBackupSource"] = args?.managedBackupSource;
            resourceInputs["mode"] = args?.mode;
            resourceInputs["nodeType"] = args?.nodeType;
            resourceInputs["persistenceConfig"] = args?.persistenceConfig;
            resourceInputs["project"] = args?.project;
            resourceInputs["replicaCount"] = args?.replicaCount;
            resourceInputs["shardCount"] = args?.shardCount;
            resourceInputs["transitEncryptionMode"] = args?.transitEncryptionMode;
            resourceInputs["zoneDistributionConfig"] = args?.zoneDistributionConfig;
            resourceInputs["availableMaintenanceVersions"] = undefined /*out*/;
            resourceInputs["backupCollection"] = undefined /*out*/;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["discoveryEndpoints"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["effectiveMaintenanceVersion"] = undefined /*out*/;
            resourceInputs["endpoints"] = undefined /*out*/;
            resourceInputs["maintenanceSchedules"] = undefined /*out*/;
            resourceInputs["managedServerCas"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["nodeConfigs"] = undefined /*out*/;
            resourceInputs["pscAttachmentDetails"] = undefined /*out*/;
            resourceInputs["pscAutoConnections"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["state"] = undefined /*out*/;
            resourceInputs["stateInfos"] = 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:memorystore/instance:Instance';
//# sourceMappingURL=instance.js.map