UNPKG

@pulumi/gcp

Version:

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

167 lines 6.74 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.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, Object.assign(Object.assign({}, 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 ? state.autoscalingConfig : undefined; resourceInputs["config"] = state ? state.config : undefined; resourceInputs["defaultBackupScheduleType"] = state ? state.defaultBackupScheduleType : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["edition"] = state ? state.edition : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["forceDestroy"] = state ? state.forceDestroy : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["numNodes"] = state ? state.numNodes : undefined; resourceInputs["processingUnits"] = state ? state.processingUnits : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : 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'"); } resourceInputs["autoscalingConfig"] = args ? args.autoscalingConfig : undefined; resourceInputs["config"] = args ? args.config : undefined; resourceInputs["defaultBackupScheduleType"] = args ? args.defaultBackupScheduleType : undefined; resourceInputs["displayName"] = args ? args.displayName : undefined; resourceInputs["edition"] = args ? args.edition : undefined; resourceInputs["forceDestroy"] = args ? args.forceDestroy : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["numNodes"] = args ? args.numNodes : undefined; resourceInputs["processingUnits"] = args ? args.processingUnits : undefined; resourceInputs["project"] = args ? args.project : undefined; 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