@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
309 lines • 16.4 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 a DCS instance within HuaweiCloud.
*
* !> **WARNING:** DCS for Memcached is about to become unavailable and is no longer sold in some regions.
* You can use DCS for Redis 4.0, 5.0 or 6.0 instead. It is not possible to create Memcached instances through this resource.
* You can use this resource to manage Memcached instances that exist in HuaweiCloud.
*
* ## Example Usage
* ### Create a single mode Redis instance
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as huaweicloud from "@pulumi/huaweicloud";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vpcId = config.requireObject("vpcId");
* const subnetId = config.requireObject("subnetId");
* const singleFlavors = huaweicloud.Dcs.getFlavors({
* cacheMode: "single",
* capacity: 0.125,
* });
* const instance1 = new huaweicloud.dcs.Instance("instance1", {
* engine: "Redis",
* engineVersion: "5.0",
* capacity: singleFlavors.then(singleFlavors => singleFlavors.capacity),
* flavor: singleFlavors.then(singleFlavors => singleFlavors.flavors?[0]?.name),
* availabilityZones: ["cn-north-1a"],
* password: "YourPassword@123",
* vpcId: vpcId,
* subnetId: subnetId,
* });
* ```
* ### Create Master/Standby mode Redis instances with backup policy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vpcId = config.requireObject("vpcId");
* const subnetId = config.requireObject("subnetId");
* const instance2 = new huaweicloud.dcs.Instance("instance2", {
* engine: "Redis",
* engineVersion: "5.0",
* capacity: 4,
* flavor: "redis.ha.xu1.large.r2.4",
* availabilityZones: [
* "cn-north-1a",
* "cn-north-1b",
* ],
* password: "YourPassword@123",
* vpcId: vpcId,
* subnetId: subnetId,
* chargingMode: "prePaid",
* periodUnit: "month",
* autoRenew: "true",
* period: 1,
* backupPolicy: {
* backupType: "auto",
* saveDays: 3,
* backupAts: [
* 1,
* 3,
* 5,
* 7,
* ],
* beginAt: "02:00-04:00",
* },
* whitelists: [
* {
* groupName: "test-group1",
* ipAddresses: [
* "192.168.10.100",
* "192.168.0.0/24",
* ],
* },
* {
* groupName: "test-group2",
* ipAddresses: [
* "172.16.10.100",
* "172.16.0.0/24",
* ],
* },
* ],
* parameters: [
* {
* id: "1",
* name: "timeout",
* value: "500",
* },
* {
* id: "3",
* name: "hash-max-ziplist-entries",
* value: "4096",
* },
* ],
* });
* ```
*
* ## Import
*
* DCS instance can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Dcs/instance:Instance instance_1 80e373f9-872e-4046-aae9-ccd9ddc55511
* ```
*
* 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`, `auto_renew`, `period`, `period_unit`, `rename_commands`, `internal_version`, `save_days`, `backup_type`, `begin_at`, `period_type`, `backup_at`, `parameters`. 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_dcs_instance" "instance_1" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* password, rename_commands,
*
* ]
*
* } }
*/
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["accessUser"] = state ? state.accessUser : undefined;
resourceInputs["autoPay"] = state ? state.autoPay : undefined;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["availabilityZones"] = state ? state.availabilityZones : undefined;
resourceInputs["availableZones"] = state ? state.availableZones : undefined;
resourceInputs["backupAts"] = state ? state.backupAts : undefined;
resourceInputs["backupPolicy"] = state ? state.backupPolicy : undefined;
resourceInputs["backupType"] = state ? state.backupType : undefined;
resourceInputs["bandwidthInfos"] = state ? state.bandwidthInfos : undefined;
resourceInputs["beginAt"] = state ? state.beginAt : undefined;
resourceInputs["cacheMode"] = state ? state.cacheMode : undefined;
resourceInputs["capacity"] = state ? state.capacity : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["cpuType"] = state ? state.cpuType : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["deletedNodes"] = state ? state.deletedNodes : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["domainName"] = state ? state.domainName : undefined;
resourceInputs["engine"] = state ? state.engine : undefined;
resourceInputs["engineVersion"] = state ? state.engineVersion : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["enterpriseProjectName"] = state ? state.enterpriseProjectName : undefined;
resourceInputs["flavor"] = state ? state.flavor : undefined;
resourceInputs["internalVersion"] = state ? state.internalVersion : undefined;
resourceInputs["ip"] = state ? state.ip : undefined;
resourceInputs["launchedAt"] = state ? state.launchedAt : undefined;
resourceInputs["maintainBegin"] = state ? state.maintainBegin : undefined;
resourceInputs["maintainEnd"] = state ? state.maintainEnd : undefined;
resourceInputs["maxMemory"] = state ? state.maxMemory : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["orderId"] = state ? state.orderId : undefined;
resourceInputs["parameters"] = state ? state.parameters : undefined;
resourceInputs["password"] = state ? state.password : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodType"] = state ? state.periodType : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["port"] = state ? state.port : undefined;
resourceInputs["privateIp"] = state ? state.privateIp : undefined;
resourceInputs["productId"] = state ? state.productId : undefined;
resourceInputs["productType"] = state ? state.productType : undefined;
resourceInputs["readonlyDomainName"] = state ? state.readonlyDomainName : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["renameCommands"] = state ? state.renameCommands : undefined;
resourceInputs["replicaCount"] = state ? state.replicaCount : undefined;
resourceInputs["reservedIps"] = state ? state.reservedIps : undefined;
resourceInputs["saveDays"] = state ? state.saveDays : undefined;
resourceInputs["securityGroupId"] = state ? state.securityGroupId : undefined;
resourceInputs["securityGroupName"] = state ? state.securityGroupName : undefined;
resourceInputs["shardingCount"] = state ? state.shardingCount : undefined;
resourceInputs["sslEnable"] = state ? state.sslEnable : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["subnetCidr"] = state ? state.subnetCidr : undefined;
resourceInputs["subnetId"] = state ? state.subnetId : undefined;
resourceInputs["subnetName"] = state ? state.subnetName : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["templateId"] = state ? state.templateId : undefined;
resourceInputs["transparentClientIpEnable"] = state ? state.transparentClientIpEnable : undefined;
resourceInputs["usedMemory"] = state ? state.usedMemory : undefined;
resourceInputs["userId"] = state ? state.userId : undefined;
resourceInputs["userName"] = state ? state.userName : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
resourceInputs["vpcName"] = state ? state.vpcName : undefined;
resourceInputs["whitelistEnable"] = state ? state.whitelistEnable : undefined;
resourceInputs["whitelists"] = state ? state.whitelists : undefined;
}
else {
const args = argsOrState;
if ((!args || args.capacity === undefined) && !opts.urn) {
throw new Error("Missing required property 'capacity'");
}
if ((!args || args.engine === undefined) && !opts.urn) {
throw new Error("Missing required property 'engine'");
}
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["accessUser"] = args ? args.accessUser : undefined;
resourceInputs["autoPay"] = args ? args.autoPay : undefined;
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["availabilityZones"] = args ? args.availabilityZones : undefined;
resourceInputs["availableZones"] = args ? args.availableZones : undefined;
resourceInputs["backupAts"] = args ? args.backupAts : undefined;
resourceInputs["backupPolicy"] = args ? args.backupPolicy : undefined;
resourceInputs["backupType"] = args ? args.backupType : undefined;
resourceInputs["beginAt"] = args ? args.beginAt : undefined;
resourceInputs["capacity"] = args ? args.capacity : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["deletedNodes"] = args ? args.deletedNodes : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["engine"] = args ? args.engine : undefined;
resourceInputs["engineVersion"] = args ? args.engineVersion : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["enterpriseProjectName"] = args ? args.enterpriseProjectName : undefined;
resourceInputs["flavor"] = args ? args.flavor : undefined;
resourceInputs["maintainBegin"] = args ? args.maintainBegin : undefined;
resourceInputs["maintainEnd"] = args ? args.maintainEnd : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["parameters"] = args ? args.parameters : undefined;
resourceInputs["password"] = args ? args.password : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodType"] = args ? args.periodType : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["port"] = args ? args.port : undefined;
resourceInputs["privateIp"] = args ? args.privateIp : undefined;
resourceInputs["productId"] = args ? args.productId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["renameCommands"] = args ? args.renameCommands : undefined;
resourceInputs["reservedIps"] = args ? args.reservedIps : undefined;
resourceInputs["saveDays"] = args ? args.saveDays : undefined;
resourceInputs["securityGroupId"] = args ? args.securityGroupId : undefined;
resourceInputs["sslEnable"] = args ? args.sslEnable : undefined;
resourceInputs["subnetId"] = args ? args.subnetId : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["templateId"] = args ? args.templateId : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["whitelistEnable"] = args ? args.whitelistEnable : undefined;
resourceInputs["whitelists"] = args ? args.whitelists : undefined;
resourceInputs["bandwidthInfos"] = undefined /*out*/;
resourceInputs["cacheMode"] = undefined /*out*/;
resourceInputs["cpuType"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["domainName"] = undefined /*out*/;
resourceInputs["internalVersion"] = undefined /*out*/;
resourceInputs["ip"] = undefined /*out*/;
resourceInputs["launchedAt"] = undefined /*out*/;
resourceInputs["maxMemory"] = undefined /*out*/;
resourceInputs["orderId"] = undefined /*out*/;
resourceInputs["productType"] = undefined /*out*/;
resourceInputs["readonlyDomainName"] = undefined /*out*/;
resourceInputs["replicaCount"] = undefined /*out*/;
resourceInputs["securityGroupName"] = undefined /*out*/;
resourceInputs["shardingCount"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["subnetCidr"] = undefined /*out*/;
resourceInputs["subnetName"] = undefined /*out*/;
resourceInputs["transparentClientIpEnable"] = undefined /*out*/;
resourceInputs["usedMemory"] = undefined /*out*/;
resourceInputs["userId"] = undefined /*out*/;
resourceInputs["userName"] = undefined /*out*/;
resourceInputs["vpcName"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'huaweicloud:Dcs/instance:Instance';
//# sourceMappingURL=instance.js.map