UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

123 lines 4.9 kB
"use strict"; // *** 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.EipAssociate = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Associates an EIP to a specified IP address or port. * * ## Example Usage * ### Associate with a fixed IP * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const publicAddress = config.requireObject("publicAddress"); * const networkId = config.requireObject("networkId"); * const associated = new huaweicloud.vpc.EipAssociate("associated", { * publicIp: publicAddress, * networkId: networkId, * fixedIp: "192.168.0.100", * }); * ``` * ### Associate with a port * * ```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 networkId = config.requireObject("networkId"); * const myport = huaweicloud.Vpc.getPort({ * networkId: networkId, * fixedIp: "192.168.0.100", * }); * const myeip = new huaweicloud.vpc.Eip("myeip", { * publicip: { * type: "5_bgp", * }, * bandwidth: { * name: "test", * size: 5, * shareType: "PER", * chargeMode: "traffic", * }, * }); * const associated = new huaweicloud.vpc.EipAssociate("associated", { * publicIp: myeip.address, * portId: myport.then(myport => myport.id), * }); * ``` * * ## Import * * EIP associations can be imported using the `id` of the EIP, e.g. bash * * ```sh * $ pulumi import huaweicloud:Vpc/eipAssociate:EipAssociate eip 2c7f39f3-702b-48d1-940c-b50384177ee1 * ``` */ class EipAssociate extends pulumi.CustomResource { /** * Get an existing EipAssociate 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 EipAssociate(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of EipAssociate. 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'] === EipAssociate.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["fixedIp"] = state ? state.fixedIp : undefined; resourceInputs["macAddress"] = state ? state.macAddress : undefined; resourceInputs["networkId"] = state ? state.networkId : undefined; resourceInputs["portId"] = state ? state.portId : undefined; resourceInputs["publicIp"] = state ? state.publicIp : undefined; resourceInputs["publicIpv6"] = state ? state.publicIpv6 : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["status"] = state ? state.status : undefined; } else { const args = argsOrState; if ((!args || args.publicIp === undefined) && !opts.urn) { throw new Error("Missing required property 'publicIp'"); } resourceInputs["fixedIp"] = args ? args.fixedIp : undefined; resourceInputs["networkId"] = args ? args.networkId : undefined; resourceInputs["portId"] = args ? args.portId : undefined; resourceInputs["publicIp"] = args ? args.publicIp : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["macAddress"] = undefined /*out*/; resourceInputs["publicIpv6"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(EipAssociate.__pulumiType, name, resourceInputs, opts); } } exports.EipAssociate = EipAssociate; /** @internal */ EipAssociate.__pulumiType = 'huaweicloud:Vpc/eipAssociate:EipAssociate'; //# sourceMappingURL=eipAssociate.js.map