"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.InstancePartition = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A Cloud Spanner instance partition is a unit of Cloud Spanner database capacity
 * that can be used to partition data and processing capacity within an instance.
 *
 * To get more information about InstancePartition, see:
 *
 * * [API documentation](https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances.instancePartitions)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/spanner/docs/geo-partitioning)
 *
 * ## Example Usage
 *
 * ### Spanner Instance Partition Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const main = new gcp.spanner.Instance("main", {
 *     name: "test-instance",
 *     config: "nam6",
 *     displayName: "main-instance",
 *     numNodes: 1,
 *     edition: "ENTERPRISE_PLUS",
 * });
 * const partition = new gcp.spanner.InstancePartition("partition", {
 *     name: "test-partition",
 *     instance: main.name,
 *     config: "nam8",
 *     displayName: "test-spanner-partition",
 *     nodeCount: 1,
 * });
 * ```
 *
 * ## Import
 *
 * InstancePartition can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/instances/{{instance}}/instancePartitions/{{name}}`
 *
 * * `{{project}}/{{instance}}/{{name}}`
 *
 * * `{{instance}}/{{name}}`
 *
 * When using the `pulumi import` command, InstancePartition can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:spanner/instancePartition:InstancePartition default projects/{{project}}/instances/{{instance}}/instancePartitions/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:spanner/instancePartition:InstancePartition default {{project}}/{{instance}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:spanner/instancePartition:InstancePartition default {{instance}}/{{name}}
 * ```
 */
class InstancePartition extends pulumi.CustomResource {
    /**
     * Get an existing InstancePartition 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 InstancePartition(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of InstancePartition.  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'] === InstancePartition.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["config"] = state?.config;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["instance"] = state?.instance;
            resourceInputs["name"] = state?.name;
            resourceInputs["nodeCount"] = state?.nodeCount;
            resourceInputs["processingUnits"] = state?.processingUnits;
            resourceInputs["project"] = state?.project;
            resourceInputs["state"] = state?.state;
        }
        else {
            const args = argsOrState;
            if (args?.config === undefined && !opts.urn) {
                throw new Error("Missing required property 'config'");
            }
            if (args?.displayName === undefined && !opts.urn) {
                throw new Error("Missing required property 'displayName'");
            }
            if (args?.instance === undefined && !opts.urn) {
                throw new Error("Missing required property 'instance'");
            }
            resourceInputs["config"] = args?.config;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["instance"] = args?.instance;
            resourceInputs["name"] = args?.name;
            resourceInputs["nodeCount"] = args?.nodeCount;
            resourceInputs["processingUnits"] = args?.processingUnits;
            resourceInputs["project"] = args?.project;
            resourceInputs["state"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(InstancePartition.__pulumiType, name, resourceInputs, opts);
    }
}
exports.InstancePartition = InstancePartition;
/** @internal */
InstancePartition.__pulumiType = 'gcp:spanner/instancePartition:InstancePartition';
//# sourceMappingURL=instancePartition.js.map