"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 Memcache instance.
 *
 * To get more information about Instance, see:
 *
 * * [API documentation](https://cloud.google.com/memorystore/docs/memcached/reference/rest/v1/projects.locations.instances)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/memcache/docs/creating-instances)
 *
 * ## Example Usage
 *
 * ### Memcache Instance Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * // This example assumes this network already exists.
 * // The API creates a tenant network per network authorized for a
 * // Memcache instance and that network is not deleted when the user-created
 * // network (authorized_network) is deleted, so this prevents issues
 * // with tenant network quota.
 * // If this network hasn't been created and you are using this example in your
 * // config, add an additional network resource or change
 * // this from "data"to "resource"
 * const memcacheNetwork = new gcp.compute.Network("memcache_network", {name: "test-network"});
 * const serviceRange = new gcp.compute.GlobalAddress("service_range", {
 *     name: "address",
 *     purpose: "VPC_PEERING",
 *     addressType: "INTERNAL",
 *     prefixLength: 16,
 *     network: memcacheNetwork.id,
 * });
 * const privateServiceConnection = new gcp.servicenetworking.Connection("private_service_connection", {
 *     network: memcacheNetwork.id,
 *     service: "servicenetworking.googleapis.com",
 *     reservedPeeringRanges: [serviceRange.name],
 * });
 * const instance = new gcp.memcache.Instance("instance", {
 *     name: "test-instance",
 *     authorizedNetwork: privateServiceConnection.network,
 *     deletionProtection: false,
 *     labels: {
 *         env: "test",
 *     },
 *     nodeConfig: {
 *         cpuCount: 1,
 *         memorySizeMb: 1024,
 *     },
 *     nodeCount: 1,
 *     memcacheVersion: "MEMCACHE_1_5",
 *     maintenancePolicy: {
 *         weeklyMaintenanceWindows: [{
 *             day: "SATURDAY",
 *             duration: "14400s",
 *             startTime: {
 *                 hours: 0,
 *                 minutes: 30,
 *                 seconds: 0,
 *                 nanos: 0,
 *             },
 *         }],
 *     },
 * });
 * ```
 *
 * ## Import
 *
 * Instance can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{region}}/instances/{{name}}`
 *
 * * `{{project}}/{{region}}/{{name}}`
 *
 * * `{{region}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:memcache/instance:Instance default projects/{{project}}/locations/{{region}}/instances/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:memcache/instance:Instance default {{project}}/{{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:memcache/instance:Instance default {{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:memcache/instance:Instance default {{name}}
 * ```
 */
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["authorizedNetwork"] = state?.authorizedNetwork;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["deletionProtection"] = state?.deletionProtection;
            resourceInputs["discoveryEndpoint"] = state?.discoveryEndpoint;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["maintenancePolicy"] = state?.maintenancePolicy;
            resourceInputs["maintenanceSchedules"] = state?.maintenanceSchedules;
            resourceInputs["memcacheFullVersion"] = state?.memcacheFullVersion;
            resourceInputs["memcacheNodes"] = state?.memcacheNodes;
            resourceInputs["memcacheParameters"] = state?.memcacheParameters;
            resourceInputs["memcacheVersion"] = state?.memcacheVersion;
            resourceInputs["name"] = state?.name;
            resourceInputs["nodeConfig"] = state?.nodeConfig;
            resourceInputs["nodeCount"] = state?.nodeCount;
            resourceInputs["project"] = state?.project;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["region"] = state?.region;
            resourceInputs["reservedIpRangeIds"] = state?.reservedIpRangeIds;
            resourceInputs["zones"] = state?.zones;
        }
        else {
            const args = argsOrState;
            if (args?.nodeConfig === undefined && !opts.urn) {
                throw new Error("Missing required property 'nodeConfig'");
            }
            if (args?.nodeCount === undefined && !opts.urn) {
                throw new Error("Missing required property 'nodeCount'");
            }
            resourceInputs["authorizedNetwork"] = args?.authorizedNetwork;
            resourceInputs["deletionProtection"] = args?.deletionProtection;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["maintenancePolicy"] = args?.maintenancePolicy;
            resourceInputs["memcacheParameters"] = args?.memcacheParameters;
            resourceInputs["memcacheVersion"] = args?.memcacheVersion;
            resourceInputs["name"] = args?.name;
            resourceInputs["nodeConfig"] = args?.nodeConfig;
            resourceInputs["nodeCount"] = args?.nodeCount;
            resourceInputs["project"] = args?.project;
            resourceInputs["region"] = args?.region;
            resourceInputs["reservedIpRangeIds"] = args?.reservedIpRangeIds;
            resourceInputs["zones"] = args?.zones;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["discoveryEndpoint"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["maintenanceSchedules"] = undefined /*out*/;
            resourceInputs["memcacheFullVersion"] = undefined /*out*/;
            resourceInputs["memcacheNodes"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = 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:memcache/instance:Instance';
//# sourceMappingURL=instance.js.map