@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
282 lines • 14.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.Loadbalancer = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a Dedicated load balancer resource within HuaweiCloud.
*
* ## Example Usage
* ### Basic Loadbalancer
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vpcId = config.requireObject("vpcId");
* const ipv4SubnetId = config.requireObject("ipv4SubnetId");
* const l4FlavorId = config.requireObject("l4FlavorId");
* const l7FlavorId = config.requireObject("l7FlavorId");
* const epsId = config.requireObject("epsId");
* const basic = new huaweicloud.dedicatedelb.Loadbalancer("basic", {
* description: "basic example",
* crossVpcBackend: true,
* vpcId: vpcId,
* ipv4SubnetId: ipv4SubnetId,
* l4FlavorId: l4FlavorId,
* l7FlavorId: l7FlavorId,
* availabilityZones: [
* "cn-north-4a",
* "cn-north-4b",
* ],
* enterpriseProjectId: epsId,
* });
* ```
* ### Loadbalancer With Existing EIP
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vpcId = config.requireObject("vpcId");
* const ipv4SubnetId = config.requireObject("ipv4SubnetId");
* const ipv6NetworkId = config.requireObject("ipv6NetworkId");
* const ipv6BandwidthId = config.requireObject("ipv6BandwidthId");
* const l4FlavorId = config.requireObject("l4FlavorId");
* const l7FlavorId = config.requireObject("l7FlavorId");
* const epsId = config.requireObject("epsId");
* const eipId = config.requireObject("eipId");
* const basic = new huaweicloud.dedicatedelb.Loadbalancer("basic", {
* description: "basic example",
* crossVpcBackend: true,
* vpcId: vpcId,
* ipv6NetworkId: ipv6NetworkId,
* ipv6BandwidthId: ipv6BandwidthId,
* ipv4SubnetId: ipv4SubnetId,
* l4FlavorId: l4FlavorId,
* l7FlavorId: l7FlavorId,
* availabilityZones: [
* "cn-north-4a",
* "cn-north-4b",
* ],
* enterpriseProjectId: epsId,
* ipv4EipId: eipId,
* });
* ```
* ### Loadbalancer With EIP
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vpcId = config.requireObject("vpcId");
* const ipv4SubnetId = config.requireObject("ipv4SubnetId");
* const ipv6NetworkId = config.requireObject("ipv6NetworkId");
* const ipv6BandwidthId = config.requireObject("ipv6BandwidthId");
* const l4FlavorId = config.requireObject("l4FlavorId");
* const l7FlavorId = config.requireObject("l7FlavorId");
* const basic = new huaweicloud.dedicatedelb.Loadbalancer("basic", {
* description: "basic example",
* crossVpcBackend: true,
* vpcId: vpcId,
* ipv6NetworkId: ipv6NetworkId,
* ipv6BandwidthId: ipv6BandwidthId,
* ipv4SubnetId: ipv4SubnetId,
* l4FlavorId: l4FlavorId,
* l7FlavorId: l7FlavorId,
* availabilityZones: [
* "cn-north-4a",
* "cn-north-4b",
* ],
* });
* ```
* ### Loadbalancer With gateway
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vpcId = config.requireObject("vpcId");
* const ipv4SubnetId = config.requireObject("ipv4SubnetId");
* const ipv6NetworkId = config.requireObject("ipv6NetworkId");
* const basic = new huaweicloud.dedicatedelb.Loadbalancer("basic", {
* description: "basic example",
* loadbalancerType: "gateway",
* vpcId: vpcId,
* ipv4SubnetId: ipv4SubnetId,
* ipv6NetworkId: ipv6NetworkId,
* availabilityZones: ["cn-north-4a"],
* });
* ```
*
* ## Import
*
* ELB load balancer can be imported using the ID, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:DedicatedElb/loadbalancer:Loadbalancer loadbalancer_1 <id>
* ```
*
* 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`ipv6_bandwidth_id`, `iptype`, `bandwidth_charge_mode`, `sharetype`,
*
* `bandwidth_size`, `bandwidth_id`, `force_delete` and `deletion_protection_enable`. It is generally recommended running `terraform plan` after importing a load balancer. You can then decide if changes should be applied to the load balancer, or the resource definition should be updated to align with the load balancer. Also you can ignore changes as below. hcl resource "huaweicloud_elb_loadbalancer" "loadbalancer_1" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* ipv6_bandwidth_id, iptype, bandwidth_charge_mode, sharetype, bandwidth_size, bandwidth_id, force_delete,
*
* deletion_protection_enable,
*
* ]
*
* } }
*/
class Loadbalancer extends pulumi.CustomResource {
/**
* Get an existing Loadbalancer 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 Loadbalancer(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Loadbalancer. 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'] === Loadbalancer.__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["autoscalingEnabled"] = state ? state.autoscalingEnabled : undefined;
resourceInputs["availabilityZones"] = state ? state.availabilityZones : undefined;
resourceInputs["backendSubnets"] = state ? state.backendSubnets : undefined;
resourceInputs["bandwidthChargeMode"] = state ? state.bandwidthChargeMode : undefined;
resourceInputs["bandwidthId"] = state ? state.bandwidthId : undefined;
resourceInputs["bandwidthSize"] = state ? state.bandwidthSize : undefined;
resourceInputs["chargeMode"] = state ? state.chargeMode : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["crossVpcBackend"] = state ? state.crossVpcBackend : undefined;
resourceInputs["deletionProtectionEnable"] = state ? state.deletionProtectionEnable : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["elbVirsubnetType"] = state ? state.elbVirsubnetType : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["forceDelete"] = state ? state.forceDelete : undefined;
resourceInputs["frozenScene"] = state ? state.frozenScene : undefined;
resourceInputs["guaranteed"] = state ? state.guaranteed : undefined;
resourceInputs["gwFlavorId"] = state ? state.gwFlavorId : undefined;
resourceInputs["iptype"] = state ? state.iptype : undefined;
resourceInputs["ipv4Address"] = state ? state.ipv4Address : undefined;
resourceInputs["ipv4Eip"] = state ? state.ipv4Eip : undefined;
resourceInputs["ipv4EipId"] = state ? state.ipv4EipId : undefined;
resourceInputs["ipv4PortId"] = state ? state.ipv4PortId : undefined;
resourceInputs["ipv4SubnetId"] = state ? state.ipv4SubnetId : undefined;
resourceInputs["ipv6Address"] = state ? state.ipv6Address : undefined;
resourceInputs["ipv6BandwidthId"] = state ? state.ipv6BandwidthId : undefined;
resourceInputs["ipv6Eip"] = state ? state.ipv6Eip : undefined;
resourceInputs["ipv6EipId"] = state ? state.ipv6EipId : undefined;
resourceInputs["ipv6NetworkId"] = state ? state.ipv6NetworkId : undefined;
resourceInputs["l4FlavorId"] = state ? state.l4FlavorId : undefined;
resourceInputs["l7FlavorId"] = state ? state.l7FlavorId : undefined;
resourceInputs["loadbalancerType"] = state ? state.loadbalancerType : undefined;
resourceInputs["minL7FlavorId"] = state ? state.minL7FlavorId : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["operatingStatus"] = state ? state.operatingStatus : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["protectionReason"] = state ? state.protectionReason : undefined;
resourceInputs["protectionStatus"] = state ? state.protectionStatus : undefined;
resourceInputs["publicBorderGroup"] = state ? state.publicBorderGroup : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["sharetype"] = state ? state.sharetype : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
resourceInputs["wafFailureAction"] = state ? state.wafFailureAction : undefined;
}
else {
const args = argsOrState;
if ((!args || args.availabilityZones === undefined) && !opts.urn) {
throw new Error("Missing required property 'availabilityZones'");
}
resourceInputs["autoPay"] = args ? args.autoPay : undefined;
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["autoscalingEnabled"] = args ? args.autoscalingEnabled : undefined;
resourceInputs["availabilityZones"] = args ? args.availabilityZones : undefined;
resourceInputs["backendSubnets"] = args ? args.backendSubnets : undefined;
resourceInputs["bandwidthChargeMode"] = args ? args.bandwidthChargeMode : undefined;
resourceInputs["bandwidthId"] = args ? args.bandwidthId : undefined;
resourceInputs["bandwidthSize"] = args ? args.bandwidthSize : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["crossVpcBackend"] = args ? args.crossVpcBackend : undefined;
resourceInputs["deletionProtectionEnable"] = args ? args.deletionProtectionEnable : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["forceDelete"] = args ? args.forceDelete : undefined;
resourceInputs["iptype"] = args ? args.iptype : undefined;
resourceInputs["ipv4Address"] = args ? args.ipv4Address : undefined;
resourceInputs["ipv4EipId"] = args ? args.ipv4EipId : undefined;
resourceInputs["ipv4SubnetId"] = args ? args.ipv4SubnetId : undefined;
resourceInputs["ipv6Address"] = args ? args.ipv6Address : undefined;
resourceInputs["ipv6BandwidthId"] = args ? args.ipv6BandwidthId : undefined;
resourceInputs["ipv6NetworkId"] = args ? args.ipv6NetworkId : undefined;
resourceInputs["l4FlavorId"] = args ? args.l4FlavorId : undefined;
resourceInputs["l7FlavorId"] = args ? args.l7FlavorId : undefined;
resourceInputs["loadbalancerType"] = args ? args.loadbalancerType : undefined;
resourceInputs["minL7FlavorId"] = args ? args.minL7FlavorId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["protectionReason"] = args ? args.protectionReason : undefined;
resourceInputs["protectionStatus"] = args ? args.protectionStatus : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["sharetype"] = args ? args.sharetype : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["wafFailureAction"] = args ? args.wafFailureAction : undefined;
resourceInputs["chargeMode"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["elbVirsubnetType"] = undefined /*out*/;
resourceInputs["frozenScene"] = undefined /*out*/;
resourceInputs["guaranteed"] = undefined /*out*/;
resourceInputs["gwFlavorId"] = undefined /*out*/;
resourceInputs["ipv4Eip"] = undefined /*out*/;
resourceInputs["ipv4PortId"] = undefined /*out*/;
resourceInputs["ipv6Eip"] = undefined /*out*/;
resourceInputs["ipv6EipId"] = undefined /*out*/;
resourceInputs["operatingStatus"] = undefined /*out*/;
resourceInputs["publicBorderGroup"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Loadbalancer.__pulumiType, name, resourceInputs, opts);
}
}
exports.Loadbalancer = Loadbalancer;
/** @internal */
Loadbalancer.__pulumiType = 'huaweicloud:DedicatedElb/loadbalancer:Loadbalancer';
//# sourceMappingURL=loadbalancer.js.map