@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
251 lines • 12.6 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");
/**
* Manages dds instance resource within HuaweiCloud.
*
* ## Example Usage
* ### Creating A Cluster Community Edition
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const ddsPassword = config.requireObject("ddsPassword");
* const instance = new huaweicloud.dds.Instance("instance", {
* datastore: {
* type: "DDS-Community",
* version: "4.0",
* storageEngine: "wiredTiger",
* },
* availabilityZone: "{{ availability_zone }}",
* vpcId: "{{ vpc_id }}",
* subnetId: "{{ subnet_network_id }}}",
* securityGroupId: "{{ security_group_id }}",
* password: ddsPassword,
* mode: "Sharding",
* maintainBegin: "02:00",
* maintainEnd: "03:00",
* flavors: [
* {
* type: "mongos",
* num: 2,
* specCode: "dds.mongodb.c3.medium.4.mongos",
* },
* {
* type: "shard",
* num: 2,
* storage: "ULTRAHIGH",
* size: 20,
* specCode: "dds.mongodb.c3.medium.4.shard",
* },
* {
* type: "config",
* num: 1,
* storage: "ULTRAHIGH",
* size: 20,
* specCode: "dds.mongodb.c3.large.2.config",
* },
* ],
* backupStrategy: {
* startTime: "08:00-09:00",
* keepDays: 8,
* },
* });
* ```
* ### Creating A Replica Set Community Edition
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const ddsPassword = config.requireObject("ddsPassword");
* const instance = new huaweicloud.dds.Instance("instance", {
* datastore: {
* type: "DDS-Community",
* version: "4.0",
* storageEngine: "wiredTiger",
* },
* availabilityZone: "{{ availability_zone }}",
* vpcId: "{{ vpc_id }}",
* subnetId: "{{ subnet_network_id }}}",
* securityGroupId: "{{ security_group_id }}",
* password: ddsPassword,
* mode: "ReplicaSet",
* flavors: [{
* type: "replica",
* num: 3,
* storage: "ULTRAHIGH",
* size: 30,
* specCode: "dds.mongodb.c3.medium.4.repset",
* }],
* });
* ```
*
* ## Import
*
* DDS instance can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import huaweicloud:Dds/instance:Instance instance 9c6d6ff2cba3434293fd479571517e16in02
* ```
*
* Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`password`, `availability_zone`, `flavor`, configuration. It is generally recommended running `terraform plan` after importing an instance. You can then decide if changes should be applied to the instance, or the resource definition should be updated to align with the instance. Also you can ignore changes as below. hcl resource "huaweicloud_dds_instance" "instance" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* password, availability_zone, flavor, configuration,
*
* ]
*
* } }
*/
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["autoPay"] = state ? state.autoPay : undefined;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined;
resourceInputs["backupStrategy"] = state ? state.backupStrategy : undefined;
resourceInputs["balancerActiveBegin"] = state ? state.balancerActiveBegin : undefined;
resourceInputs["balancerActiveEnd"] = state ? state.balancerActiveEnd : undefined;
resourceInputs["balancerStatus"] = state ? state.balancerStatus : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["clientNetworkRanges"] = state ? state.clientNetworkRanges : undefined;
resourceInputs["configurations"] = state ? state.configurations : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["datastore"] = state ? state.datastore : undefined;
resourceInputs["dbUsername"] = state ? state.dbUsername : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["diskEncryptionId"] = state ? state.diskEncryptionId : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["flavors"] = state ? state.flavors : undefined;
resourceInputs["groups"] = state ? state.groups : undefined;
resourceInputs["maintainBegin"] = state ? state.maintainBegin : undefined;
resourceInputs["maintainEnd"] = state ? state.maintainEnd : undefined;
resourceInputs["mode"] = state ? state.mode : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["nodes"] = state ? state.nodes : undefined;
resourceInputs["password"] = state ? state.password : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["port"] = state ? state.port : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["replicaSetName"] = state ? state.replicaSetName : undefined;
resourceInputs["secondLevelMonitoringEnabled"] = state ? state.secondLevelMonitoringEnabled : undefined;
resourceInputs["securityGroupId"] = state ? state.securityGroupId : undefined;
resourceInputs["slowLogDesensitization"] = state ? state.slowLogDesensitization : undefined;
resourceInputs["ssl"] = state ? state.ssl : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["timeZone"] = state ? state.timeZone : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.availabilityZone === undefined) && !opts.urn) {
throw new Error("Missing required property 'availabilityZone'");
}
if ((!args || args.datastore === undefined) && !opts.urn) {
throw new Error("Missing required property 'datastore'");
}
if ((!args || args.flavors === undefined) && !opts.urn) {
throw new Error("Missing required property 'flavors'");
}
if ((!args || args.mode === undefined) && !opts.urn) {
throw new Error("Missing required property 'mode'");
}
if ((!args || args.securityGroupId === undefined) && !opts.urn) {
throw new Error("Missing required property 'securityGroupId'");
}
if ((!args || args.subnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'subnetId'");
}
if ((!args || args.vpcId === undefined) && !opts.urn) {
throw new Error("Missing required property 'vpcId'");
}
resourceInputs["autoPay"] = args ? args.autoPay : undefined;
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined;
resourceInputs["backupStrategy"] = args ? args.backupStrategy : undefined;
resourceInputs["balancerActiveBegin"] = args ? args.balancerActiveBegin : undefined;
resourceInputs["balancerActiveEnd"] = args ? args.balancerActiveEnd : undefined;
resourceInputs["balancerStatus"] = args ? args.balancerStatus : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["clientNetworkRanges"] = args ? args.clientNetworkRanges : undefined;
resourceInputs["configurations"] = args ? args.configurations : undefined;
resourceInputs["datastore"] = args ? args.datastore : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["diskEncryptionId"] = args ? args.diskEncryptionId : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["flavors"] = args ? args.flavors : undefined;
resourceInputs["maintainBegin"] = args ? args.maintainBegin : undefined;
resourceInputs["maintainEnd"] = args ? args.maintainEnd : undefined;
resourceInputs["mode"] = args ? args.mode : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["password"] = args ? args.password : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["port"] = args ? args.port : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["replicaSetName"] = args ? args.replicaSetName : undefined;
resourceInputs["secondLevelMonitoringEnabled"] = args ? args.secondLevelMonitoringEnabled : undefined;
resourceInputs["securityGroupId"] = args ? args.securityGroupId : undefined;
resourceInputs["slowLogDesensitization"] = args ? args.slowLogDesensitization : undefined;
resourceInputs["ssl"] = args ? args.ssl : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["dbUsername"] = undefined /*out*/;
resourceInputs["groups"] = undefined /*out*/;
resourceInputs["nodes"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["timeZone"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'huaweicloud:Dds/instance:Instance';
//# sourceMappingURL=instance.js.map