UNPKG

@pulumi/gcp

Version:

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

192 lines • 7.76 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! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DatabaseInstance = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(require("../utilities")); /** * A Firebase Realtime Database instance. * * > **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider. * See Provider Versions for more details on beta resources. * * To get more information about Instance, see: * * * [API documentation](https://firebase.google.com/docs/reference/rest/database/database-management/rest) * * How-to Guides * * [Official Documentation](https://firebase.google.com/products/realtime-database) * * ## Example Usage * * ### Firebase Database Instance Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const basic = new gcp.firebase.DatabaseInstance("basic", { * project: "my-project-name", * region: "us-central1", * instanceId: "active-db", * }); * ``` * ### Firebase Database Instance Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const full = new gcp.firebase.DatabaseInstance("full", { * project: "my-project-name", * region: "europe-west1", * instanceId: "disabled-db", * type: "USER_DATABASE", * desiredState: "DISABLED", * }); * ``` * ### Firebase Database Instance Default Database * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * import * as time from "@pulumiverse/time"; * * const _default = new gcp.organizations.Project("default", { * projectId: "rtdb-project", * name: "rtdb-project", * orgId: "123456789", * deletionPolicy: "DELETE", * labels: { * firebase: "enabled", * }, * }); * const firebase = new gcp.projects.Service("firebase", { * project: _default.projectId, * service: "firebase.googleapis.com", * }); * const defaultProject = new gcp.firebase.Project("default", {project: _default.projectId}, { * dependsOn: [firebase], * }); * const firebaseDatabase = new gcp.projects.Service("firebase_database", { * project: defaultProject.project, * service: "firebasedatabase.googleapis.com", * }); * const wait60Seconds = new time.Sleep("wait_60_seconds", {createDuration: "60s"}, { * dependsOn: [firebaseDatabase], * }); * const defaultDatabaseInstance = new gcp.firebase.DatabaseInstance("default", { * project: defaultProject.project, * region: "us-central1", * instanceId: "rtdb-project-default-rtdb", * type: "DEFAULT_DATABASE", * }, { * dependsOn: [wait60Seconds], * }); * ``` * * ## Import * * Instance can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{region}}/instances/{{instance_id}}` * * `{{project}}/{{region}}/{{instance_id}}` * * `{{region}}/{{instance_id}}` * * `{{instance_id}}` * * When using the `pulumi import` command, Instance can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:firebase/databaseInstance:DatabaseInstance default projects/{{project}}/locations/{{region}}/instances/{{instance_id}} * $ pulumi import gcp:firebase/databaseInstance:DatabaseInstance default {{project}}/{{region}}/{{instance_id}} * $ pulumi import gcp:firebase/databaseInstance:DatabaseInstance default {{region}}/{{instance_id}} * $ pulumi import gcp:firebase/databaseInstance:DatabaseInstance default {{instance_id}} * ``` */ class DatabaseInstance extends pulumi.CustomResource { /** * Get an existing DatabaseInstance 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 DatabaseInstance(name, state, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'gcp:firebase/databaseInstance:DatabaseInstance'; /** * Returns true if the given object is an instance of DatabaseInstance. 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'] === DatabaseInstance.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["databaseUrl"] = state?.databaseUrl; resourceInputs["deletionPolicy"] = state?.deletionPolicy; resourceInputs["desiredState"] = state?.desiredState; resourceInputs["instanceId"] = state?.instanceId; resourceInputs["name"] = state?.name; resourceInputs["project"] = state?.project; resourceInputs["region"] = state?.region; resourceInputs["state"] = state?.state; resourceInputs["type"] = state?.type; } else { const args = argsOrState; if (args?.instanceId === undefined && !opts.urn) { throw new Error("Missing required property 'instanceId'"); } if (args?.region === undefined && !opts.urn) { throw new Error("Missing required property 'region'"); } resourceInputs["deletionPolicy"] = args?.deletionPolicy; resourceInputs["desiredState"] = args?.desiredState; resourceInputs["instanceId"] = args?.instanceId; resourceInputs["project"] = args?.project; resourceInputs["region"] = args?.region; resourceInputs["type"] = args?.type; resourceInputs["databaseUrl"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["state"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DatabaseInstance.__pulumiType, name, resourceInputs, opts); } } exports.DatabaseInstance = DatabaseInstance; //# sourceMappingURL=databaseInstance.js.map