@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
87 lines • 3.8 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.FloatingIpAssociate = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Associates a floating IP to a port. This is useful for situations
* where you have a pre-allocated floating IP or are unable to use the
* `openstack.networking.FloatingIp` resource to create a floating IP.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const port1 = new openstack.networking.Port("port_1", {networkId: "a5bbd213-e1d3-49b6-aed1-9df60ea94b9a"});
* const fip1 = new openstack.networking.FloatingIpAssociate("fip_1", {
* floatingIp: "1.2.3.4",
* portId: port1.id,
* });
* ```
*
* ## Import
*
* Floating IP associations can be imported using the `id` of the floating IP, e.g.
*
* ```sh
* $ pulumi import openstack:networking/floatingIpAssociate:FloatingIpAssociate fip 2c7f39f3-702b-48d1-940c-b50384177ee1
* ```
*/
class FloatingIpAssociate extends pulumi.CustomResource {
/**
* Get an existing FloatingIpAssociate 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 FloatingIpAssociate(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of FloatingIpAssociate. 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'] === FloatingIpAssociate.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["fixedIp"] = state ? state.fixedIp : undefined;
resourceInputs["floatingIp"] = state ? state.floatingIp : undefined;
resourceInputs["portId"] = state ? state.portId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
}
else {
const args = argsOrState;
if ((!args || args.floatingIp === undefined) && !opts.urn) {
throw new Error("Missing required property 'floatingIp'");
}
if ((!args || args.portId === undefined) && !opts.urn) {
throw new Error("Missing required property 'portId'");
}
resourceInputs["fixedIp"] = args ? args.fixedIp : undefined;
resourceInputs["floatingIp"] = args ? args.floatingIp : undefined;
resourceInputs["portId"] = args ? args.portId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(FloatingIpAssociate.__pulumiType, name, resourceInputs, opts);
}
}
exports.FloatingIpAssociate = FloatingIpAssociate;
/** @internal */
FloatingIpAssociate.__pulumiType = 'openstack:networking/floatingIpAssociate:FloatingIpAssociate';
//# sourceMappingURL=floatingIpAssociate.js.map