@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
154 lines • 7.75 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 an ELB loadbalancer 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 ipv4SubnetId = config.requireObject("ipv4SubnetId");
* const lb1 = new huaweicloud.elb.Loadbalancer("lb1", {
* vipSubnetId: ipv4SubnetId,
* tags: {
* key: "value",
* },
* });
* ```
* ### Loadbalancer With EIP
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const ipv4SubnetId = config.requireObject("ipv4SubnetId");
* const lb1 = new huaweicloud.elb.Loadbalancer("lb1", {vipSubnetId: ipv4SubnetId});
* const eip1 = new huaweicloud.vpc.EipAssociate("eip1", {
* publicIp: "1.2.3.4",
* portId: lb1.vipPortId,
* });
* ```
*
* ## Import
*
* Load balancers can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Elb/loadbalancer:Loadbalancer test 3e3632db-36c6-4b28-a92e-e72e6562daa6
* ```
*
* 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`period_unit`, `period`, `auto_renew`. It is generally recommended running `terraform plan` after importing a loadbalancer. You can then decide if changes should be applied to the loadbalancer, or the resource definition should be updated to align with the loadbalancer. Also you can ignore changes as below. hcl resource "huaweicloud_lb_loadbalancer" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* period_unit, period, auto_renew,
*
* ]
*
* } }
*/
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["adminStateUp"] = state ? state.adminStateUp : undefined;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["chargeMode"] = state ? state.chargeMode : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["flavor"] = state ? state.flavor : undefined;
resourceInputs["frozenScene"] = state ? state.frozenScene : undefined;
resourceInputs["loadbalancerProvider"] = state ? state.loadbalancerProvider : undefined;
resourceInputs["name"] = state ? state.name : 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["publicIp"] = state ? state.publicIp : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["securityGroupIds"] = state ? state.securityGroupIds : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tenantId"] = state ? state.tenantId : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : undefined;
resourceInputs["vipAddress"] = state ? state.vipAddress : undefined;
resourceInputs["vipPortId"] = state ? state.vipPortId : undefined;
resourceInputs["vipSubnetId"] = state ? state.vipSubnetId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.vipSubnetId === undefined) && !opts.urn) {
throw new Error("Missing required property 'vipSubnetId'");
}
resourceInputs["adminStateUp"] = args ? args.adminStateUp : undefined;
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["flavor"] = args ? args.flavor : undefined;
resourceInputs["loadbalancerProvider"] = args ? args.loadbalancerProvider : 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["securityGroupIds"] = args ? args.securityGroupIds : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["tenantId"] = args ? args.tenantId : undefined;
resourceInputs["vipAddress"] = args ? args.vipAddress : undefined;
resourceInputs["vipSubnetId"] = args ? args.vipSubnetId : undefined;
resourceInputs["chargeMode"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["frozenScene"] = undefined /*out*/;
resourceInputs["publicIp"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
resourceInputs["vipPortId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Loadbalancer.__pulumiType, name, resourceInputs, opts);
}
}
exports.Loadbalancer = Loadbalancer;
/** @internal */
Loadbalancer.__pulumiType = 'huaweicloud:Elb/loadbalancer:Loadbalancer';
//# sourceMappingURL=loadbalancer.js.map