UNPKG

@pulumi/yandex

Version:

A Pulumi package for creating and managing yandex cloud resources.

166 lines 7.65 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.MdbMongodbCluster = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Manages a MongoDB cluster within the Yandex.Cloud. For more information, see * [the official documentation](https://cloud.yandex.com/docs/managed-mongodb/concepts). * * ## Example Usage * * Example of creating a Single Node MongoDB. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as yandex from "@pulumi/yandex"; * * const fooVpcNetwork = new yandex.VpcNetwork("foo", {}); * const fooVpcSubnet = new yandex.VpcSubnet("foo", { * networkId: fooVpcNetwork.id, * v4CidrBlocks: ["10.1.0.0/24"], * zone: "ru-central1-a", * }); * const fooMdbMongodbCluster = new yandex.MdbMongodbCluster("foo", { * clusterConfig: { * version: "4.2", * }, * databases: [{ * name: "testdb", * }], * environment: "PRESTABLE", * hosts: [{ * subnetId: fooVpcSubnet.id, * zoneId: "ru-central1-a", * }], * labels: { * test_key: "test_value", * }, * maintenanceWindow: { * type: "ANYTIME", * }, * networkId: fooVpcNetwork.id, * resources: { * diskSize: 16, * diskTypeId: "network-hdd", * resourcePresetId: "b1.nano", * }, * users: [{ * name: "john", * password: "password", * permissions: [{ * databaseName: "testdb", * }], * }], * }); * ``` * * ## Import * * A cluster can be imported using the `id` of the resource, e.g. * * ```sh * $ pulumi import yandex:index/mdbMongodbCluster:MdbMongodbCluster foo cluster_id * ``` */ class MdbMongodbCluster extends pulumi.CustomResource { constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["clusterConfig"] = state ? state.clusterConfig : undefined; resourceInputs["clusterId"] = state ? state.clusterId : undefined; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["databases"] = state ? state.databases : undefined; resourceInputs["deletionProtection"] = state ? state.deletionProtection : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["environment"] = state ? state.environment : undefined; resourceInputs["folderId"] = state ? state.folderId : undefined; resourceInputs["health"] = state ? state.health : undefined; resourceInputs["hosts"] = state ? state.hosts : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["maintenanceWindow"] = state ? state.maintenanceWindow : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networkId"] = state ? state.networkId : undefined; resourceInputs["resources"] = state ? state.resources : undefined; resourceInputs["securityGroupIds"] = state ? state.securityGroupIds : undefined; resourceInputs["sharded"] = state ? state.sharded : undefined; resourceInputs["status"] = state ? state.status : undefined; resourceInputs["users"] = state ? state.users : undefined; } else { const args = argsOrState; if ((!args || args.clusterConfig === undefined) && !opts.urn) { throw new Error("Missing required property 'clusterConfig'"); } if ((!args || args.databases === undefined) && !opts.urn) { throw new Error("Missing required property 'databases'"); } if ((!args || args.environment === undefined) && !opts.urn) { throw new Error("Missing required property 'environment'"); } if ((!args || args.hosts === undefined) && !opts.urn) { throw new Error("Missing required property 'hosts'"); } if ((!args || args.networkId === undefined) && !opts.urn) { throw new Error("Missing required property 'networkId'"); } if ((!args || args.resources === undefined) && !opts.urn) { throw new Error("Missing required property 'resources'"); } if ((!args || args.users === undefined) && !opts.urn) { throw new Error("Missing required property 'users'"); } resourceInputs["clusterConfig"] = args ? args.clusterConfig : undefined; resourceInputs["clusterId"] = args ? args.clusterId : undefined; resourceInputs["databases"] = args ? args.databases : undefined; resourceInputs["deletionProtection"] = args ? args.deletionProtection : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["environment"] = args ? args.environment : undefined; resourceInputs["folderId"] = args ? args.folderId : undefined; resourceInputs["hosts"] = args ? args.hosts : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["maintenanceWindow"] = args ? args.maintenanceWindow : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["networkId"] = args ? args.networkId : undefined; resourceInputs["resources"] = args ? args.resources : undefined; resourceInputs["securityGroupIds"] = args ? args.securityGroupIds : undefined; resourceInputs["users"] = args ? args.users : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["health"] = undefined /*out*/; resourceInputs["sharded"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(MdbMongodbCluster.__pulumiType, name, resourceInputs, opts); } /** * Get an existing MdbMongodbCluster 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 MdbMongodbCluster(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of MdbMongodbCluster. 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'] === MdbMongodbCluster.__pulumiType; } } exports.MdbMongodbCluster = MdbMongodbCluster; /** @internal */ MdbMongodbCluster.__pulumiType = 'yandex:index/mdbMongodbCluster:MdbMongodbCluster'; //# sourceMappingURL=mdbMongodbCluster.js.map