@pulumi/openstack
Version:
A Pulumi package for creating and managing OpenStack cloud resources.
141 lines • 5.21 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.InterfaceAttach = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Attaches a Network Interface (a Port) to an Instance using the OpenStack
* Compute (Nova) v2 API.
*
* ## Example Usage
*
* ### Basic Attachment
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const network1 = new openstack.networking.Network("network_1", {
* name: "network_1",
* adminStateUp: true,
* });
* const instance1 = new openstack.compute.Instance("instance_1", {
* name: "instance_1",
* securityGroups: ["default"],
* });
* const ai1 = new openstack.compute.InterfaceAttach("ai_1", {
* instanceId: instance1.id,
* networkId: network1.id,
* });
* ```
*
* ### Attachment Specifying a Fixed IP
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const network1 = new openstack.networking.Network("network_1", {
* name: "network_1",
* adminStateUp: true,
* });
* const instance1 = new openstack.compute.Instance("instance_1", {
* name: "instance_1",
* securityGroups: ["default"],
* });
* const ai1 = new openstack.compute.InterfaceAttach("ai_1", {
* instanceId: instance1.id,
* networkId: network1OpenstackNetworkingPortV2.id,
* fixedIp: "10.0.10.10",
* });
* ```
*
* ### Attachment Using an Existing Port
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as openstack from "@pulumi/openstack";
*
* const network1 = new openstack.networking.Network("network_1", {
* name: "network_1",
* adminStateUp: true,
* });
* const port1 = new openstack.networking.Port("port_1", {
* name: "port_1",
* networkId: network1.id,
* adminStateUp: true,
* });
* const instance1 = new openstack.compute.Instance("instance_1", {
* name: "instance_1",
* securityGroups: ["default"],
* });
* const ai1 = new openstack.compute.InterfaceAttach("ai_1", {
* instanceId: instance1.id,
* portId: port1.id,
* });
* ```
*
* ## Import
*
* Interface Attachments can be imported using the Instance ID and Port ID
* separated by a slash, e.g.
*
* ```sh
* $ pulumi import openstack:compute/interfaceAttach:InterfaceAttach ai_1 89c60255-9bd6-460c-822a-e2b959ede9d2/45670584-225f-46c3-b33e-6707b589b666
* ```
*/
class InterfaceAttach extends pulumi.CustomResource {
/**
* Get an existing InterfaceAttach 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 InterfaceAttach(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of InterfaceAttach. 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'] === InterfaceAttach.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["fixedIp"] = state ? state.fixedIp : undefined;
resourceInputs["instanceId"] = state ? state.instanceId : undefined;
resourceInputs["networkId"] = state ? state.networkId : undefined;
resourceInputs["portId"] = state ? state.portId : undefined;
resourceInputs["region"] = state ? state.region : undefined;
}
else {
const args = argsOrState;
if ((!args || args.instanceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'instanceId'");
}
resourceInputs["fixedIp"] = args ? args.fixedIp : undefined;
resourceInputs["instanceId"] = args ? args.instanceId : undefined;
resourceInputs["networkId"] = args ? args.networkId : undefined;
resourceInputs["portId"] = args ? args.portId : undefined;
resourceInputs["region"] = args ? args.region : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(InterfaceAttach.__pulumiType, name, resourceInputs, opts);
}
}
exports.InterfaceAttach = InterfaceAttach;
/** @internal */
InterfaceAttach.__pulumiType = 'openstack:compute/interfaceAttach:InterfaceAttach';
//# sourceMappingURL=interfaceAttach.js.map