UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

130 lines 5.56 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** 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, Object.assign(Object.assign({}, 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 ? state.config : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["instance"] = state ? state.instance : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["nodeCount"] = state ? state.nodeCount : undefined; resourceInputs["processingUnits"] = state ? state.processingUnits : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["state"] = state ? state.state : undefined; } else { const args = argsOrState; if ((!args || args.config === undefined) && !opts.urn) { throw new Error("Missing required property 'config'"); } if ((!args || args.displayName === undefined) && !opts.urn) { throw new Error("Missing required property 'displayName'"); } if ((!args || args.instance === undefined) && !opts.urn) { throw new Error("Missing required property 'instance'"); } resourceInputs["config"] = args ? args.config : undefined; resourceInputs["displayName"] = args ? args.displayName : undefined; resourceInputs["instance"] = args ? args.instance : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["nodeCount"] = args ? args.nodeCount : undefined; resourceInputs["processingUnits"] = args ? args.processingUnits : undefined; resourceInputs["project"] = args ? args.project : undefined; 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