@volcengine/pulumi
Version:
A Pulumi package for creating and managing volcengine cloud resources.
197 lines • 9.8 kB
JavaScript
;
// *** 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");
/**
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as volcengine from "@pulumi/volcengine";
* import * as volcengine from "@volcengine/pulumi";
*
* const fooZones = volcengine.ecs.getZones({});
* // create vpc
* const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
* vpcName: "acc-test-vpc",
* cidrBlock: "172.16.0.0/16",
* dnsServers: [
* "8.8.8.8",
* "114.114.114.114",
* ],
* projectName: "default",
* });
* // create subnet
* const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
* subnetName: "acc-test-subnet",
* cidrBlock: "172.16.0.0/24",
* zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
* vpcId: fooVpc.id,
* });
* // create mongodb ReplicaSet instance
* const foo_replica = new volcengine.mongodb.Instance("foo-replica", {
* zoneIds: [fooZones.then(fooZones => fooZones.zones?.[0]?.id)],
* dbEngineVersion: "MongoDB_4_0",
* instanceType: "ReplicaSet",
* nodeSpec: "mongo.2c4g",
* storageSpaceGb: 100,
* subnetId: fooSubnet.id,
* instanceName: "acc-test-mongodb-replica",
* chargeType: "PostPaid",
* superAccountPassword: "93f0cb0614Aab12",
* projectName: "default",
* tags: [{
* key: "k1",
* value: "v1",
* }],
* nodeAvailabilityZones: [{
* zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
* nodeNumber: 2,
* }],
* });
* // create mongodb ShardedCluster instance
* const foo_sharded = new volcengine.mongodb.Instance("foo-sharded", {
* zoneIds: [fooZones.then(fooZones => fooZones.zones?.[0]?.id)],
* dbEngineVersion: "MongoDB_4_0",
* instanceType: "ShardedCluster",
* nodeSpec: "mongo.shard.2c4g",
* mongosNodeSpec: "mongo.mongos.2c4g",
* mongosNodeNumber: 3,
* shardNumber: 3,
* configServerNodeSpec: "mongo.config.2c4g",
* configServerStorageSpaceGb: 30,
* storageSpaceGb: 100,
* subnetId: fooSubnet.id,
* instanceName: "acc-test-mongodb-sharded",
* chargeType: "PostPaid",
* superAccountPassword: "93f0cb0614Aab12",
* projectName: "default",
* tags: [{
* key: "k1",
* value: "v1",
* }],
* nodeAvailabilityZones: [{
* zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
* nodeNumber: 2,
* }],
* });
* ```
*
* ## Import
*
* mongodb instance can be imported using the id, e.g.
*
* ```sh
* $ pulumi import volcengine:mongodb/instance:Instance default mongo-replica-e405f8e2****
* ```
*/
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["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["chargeType"] = state ? state.chargeType : undefined;
resourceInputs["configServerNodeSpec"] = state ? state.configServerNodeSpec : undefined;
resourceInputs["configServerStorageSpaceGb"] = state ? state.configServerStorageSpaceGb : undefined;
resourceInputs["configServersId"] = state ? state.configServersId : undefined;
resourceInputs["dbEngineVersion"] = state ? state.dbEngineVersion : undefined;
resourceInputs["instanceName"] = state ? state.instanceName : undefined;
resourceInputs["instanceType"] = state ? state.instanceType : undefined;
resourceInputs["mongos"] = state ? state.mongos : undefined;
resourceInputs["mongosId"] = state ? state.mongosId : undefined;
resourceInputs["mongosNodeNumber"] = state ? state.mongosNodeNumber : undefined;
resourceInputs["mongosNodeSpec"] = state ? state.mongosNodeSpec : undefined;
resourceInputs["nodeAvailabilityZones"] = state ? state.nodeAvailabilityZones : undefined;
resourceInputs["nodeSpec"] = state ? state.nodeSpec : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["privateEndpoint"] = state ? state.privateEndpoint : undefined;
resourceInputs["projectName"] = state ? state.projectName : undefined;
resourceInputs["readOnlyNodeNumber"] = state ? state.readOnlyNodeNumber : undefined;
resourceInputs["shardNumber"] = state ? state.shardNumber : undefined;
resourceInputs["shards"] = state ? state.shards : undefined;
resourceInputs["storageSpaceGb"] = state ? state.storageSpaceGb : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["superAccountPassword"] = state ? state.superAccountPassword : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
resourceInputs["zoneId"] = state ? state.zoneId : undefined;
resourceInputs["zoneIds"] = state ? state.zoneIds : undefined;
}
else {
const args = argsOrState;
if ((!args || args.nodeSpec === undefined) && !opts.urn) {
throw new Error("Missing required property 'nodeSpec'");
}
if ((!args || args.storageSpaceGb === undefined) && !opts.urn) {
throw new Error("Missing required property 'storageSpaceGb'");
}
if ((!args || args.subnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["chargeType"] = args ? args.chargeType : undefined;
resourceInputs["configServerNodeSpec"] = args ? args.configServerNodeSpec : undefined;
resourceInputs["configServerStorageSpaceGb"] = args ? args.configServerStorageSpaceGb : undefined;
resourceInputs["dbEngineVersion"] = args ? args.dbEngineVersion : undefined;
resourceInputs["instanceName"] = args ? args.instanceName : undefined;
resourceInputs["instanceType"] = args ? args.instanceType : undefined;
resourceInputs["mongosNodeNumber"] = args ? args.mongosNodeNumber : undefined;
resourceInputs["mongosNodeSpec"] = args ? args.mongosNodeSpec : undefined;
resourceInputs["nodeAvailabilityZones"] = args ? args.nodeAvailabilityZones : undefined;
resourceInputs["nodeSpec"] = args ? args.nodeSpec : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["projectName"] = args ? args.projectName : undefined;
resourceInputs["shardNumber"] = args ? args.shardNumber : undefined;
resourceInputs["storageSpaceGb"] = args ? args.storageSpaceGb : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["superAccountPassword"] = (args === null || args === void 0 ? void 0 : args.superAccountPassword) ? pulumi.secret(args.superAccountPassword) : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["zoneId"] = args ? args.zoneId : undefined;
resourceInputs["zoneIds"] = args ? args.zoneIds : undefined;
resourceInputs["configServersId"] = undefined /*out*/;
resourceInputs["mongos"] = undefined /*out*/;
resourceInputs["mongosId"] = undefined /*out*/;
resourceInputs["privateEndpoint"] = undefined /*out*/;
resourceInputs["readOnlyNodeNumber"] = undefined /*out*/;
resourceInputs["shards"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["superAccountPassword"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'volcengine:mongodb/instance:Instance';
//# sourceMappingURL=instance.js.map