UNPKG

@pulumi/gcp

Version:

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

169 lines 6.33 kB
"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"); /** * An isolated set of Cloud Spanner resources on which databases can be * hosted. * * To get more information about Instance, see: * * * [API documentation](https://cloud.google.com/spanner/docs/reference/rest/v1/projects.instances) * * How-to Guides * * [Official Documentation](https://cloud.google.com/spanner/) * * ## Example Usage * * ### Spanner Instance Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const example = new gcp.spanner.Instance("example", { * config: "regional-us-central1", * displayName: "Test Spanner Instance", * numNodes: 2, * edition: "STANDARD", * defaultBackupScheduleType: "AUTOMATIC", * labels: { * foo: "bar", * }, * }); * ``` * ### Spanner Instance Processing Units * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const example = new gcp.spanner.Instance("example", { * config: "regional-us-central1", * displayName: "Test Spanner Instance", * processingUnits: 200, * labels: { * foo: "bar", * }, * }); * ``` * ### Spanner Instance Multi Regional * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const example = new gcp.spanner.Instance("example", { * config: "nam-eur-asia1", * displayName: "Multi Regional Instance", * numNodes: 2, * labels: { * foo: "bar", * }, * }); * ``` * * ## Import * * Instance can be imported using any of these accepted formats: * * * `projects/{{project}}/instances/{{name}}` * * * `{{project}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:spanner/instance:Instance default projects/{{project}}/instances/{{name}} * ``` * * ```sh * $ pulumi import gcp:spanner/instance:Instance default {{project}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:spanner/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["autoscalingConfig"] = state?.autoscalingConfig; resourceInputs["config"] = state?.config; resourceInputs["defaultBackupScheduleType"] = state?.defaultBackupScheduleType; resourceInputs["displayName"] = state?.displayName; resourceInputs["edition"] = state?.edition; resourceInputs["effectiveLabels"] = state?.effectiveLabels; resourceInputs["forceDestroy"] = state?.forceDestroy; resourceInputs["instanceType"] = state?.instanceType; resourceInputs["labels"] = state?.labels; resourceInputs["name"] = state?.name; resourceInputs["numNodes"] = state?.numNodes; resourceInputs["processingUnits"] = state?.processingUnits; resourceInputs["project"] = state?.project; resourceInputs["pulumiLabels"] = state?.pulumiLabels; 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'"); } resourceInputs["autoscalingConfig"] = args?.autoscalingConfig; resourceInputs["config"] = args?.config; resourceInputs["defaultBackupScheduleType"] = args?.defaultBackupScheduleType; resourceInputs["displayName"] = args?.displayName; resourceInputs["edition"] = args?.edition; resourceInputs["forceDestroy"] = args?.forceDestroy; resourceInputs["instanceType"] = args?.instanceType; resourceInputs["labels"] = args?.labels; resourceInputs["name"] = args?.name; resourceInputs["numNodes"] = args?.numNodes; resourceInputs["processingUnits"] = args?.processingUnits; resourceInputs["project"] = args?.project; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["state"] = 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:spanner/instance:Instance'; //# sourceMappingURL=instance.js.map