@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
145 lines • 6.54 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.Eip = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an EIP resource within HuaweiCloud.
*
* ## Example Usage
* ### Create an EIP with Dedicated Bandwidth
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const dedicated = new huaweicloud.vpc.Eip("dedicated", {
* publicip: {
* type: "5_bgp",
* },
* bandwidth: {
* shareType: "PER",
* name: _var.bandwidth_name,
* size: 10,
* chargeMode: "traffic",
* },
* });
* ```
* ### Create an EIP with Shared Bandwidth
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const test = new huaweicloud.vpc.Bandwidth("test", {size: 5});
* const shared = new huaweicloud.vpc.Eip("shared", {
* publicip: {
* type: "5_bgp",
* },
* bandwidth: {
* shareType: "WHOLE",
* id: test.id,
* },
* });
* ```
*
* ## Import
*
* EIPs can be imported using the `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Vpc/eip:Eip test 2c7f39f3-702b-48d1-940c-b50384177ee1
* ```
*/
class Eip extends pulumi.CustomResource {
/**
* Get an existing Eip 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 Eip(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Eip. 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'] === Eip.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["address"] = state ? state.address : undefined;
resourceInputs["associateId"] = state ? state.associateId : undefined;
resourceInputs["associateType"] = state ? state.associateType : undefined;
resourceInputs["autoPay"] = state ? state.autoPay : undefined;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["bandwidth"] = state ? state.bandwidth : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["instanceId"] = state ? state.instanceId : undefined;
resourceInputs["instanceType"] = state ? state.instanceType : undefined;
resourceInputs["ipv6Address"] = state ? state.ipv6Address : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["portId"] = state ? state.portId : undefined;
resourceInputs["privateIp"] = state ? state.privateIp : undefined;
resourceInputs["publicip"] = state ? state.publicip : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["updatedAt"] = state ? state.updatedAt : undefined;
}
else {
const args = argsOrState;
if ((!args || args.bandwidth === undefined) && !opts.urn) {
throw new Error("Missing required property 'bandwidth'");
}
if ((!args || args.publicip === undefined) && !opts.urn) {
throw new Error("Missing required property 'publicip'");
}
resourceInputs["autoPay"] = args ? args.autoPay : undefined;
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["bandwidth"] = args ? args.bandwidth : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["publicip"] = args ? args.publicip : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["address"] = undefined /*out*/;
resourceInputs["associateId"] = undefined /*out*/;
resourceInputs["associateType"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["instanceId"] = undefined /*out*/;
resourceInputs["instanceType"] = undefined /*out*/;
resourceInputs["ipv6Address"] = undefined /*out*/;
resourceInputs["portId"] = undefined /*out*/;
resourceInputs["privateIp"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Eip.__pulumiType, name, resourceInputs, opts);
}
}
exports.Eip = Eip;
/** @internal */
Eip.__pulumiType = 'huaweicloud:Vpc/eip:Eip';
//# sourceMappingURL=eip.js.map