UNPKG

@pulumi/openstack

Version:

A Pulumi package for creating and managing OpenStack cloud resources.

208 lines • 8.93 kB
"use strict"; // *** 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.Port = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a V2 port resource within OpenStack. * * > **Note:** Ports do not get an IP if the network they are attached * to does not have a subnet. If you create the subnet resource in the * same run as the port, make sure to use `fixed_ip.subnet_id` or * `dependsOn` to enforce the subnet resource creation before the port * creation is triggered. More info here * * ## Example Usage * * ### Simple 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, * }); * ``` * * ### Port defining fixed_ip.subnet_id * * ```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 subnet1 = new openstack.networking.Subnet("subnet_1", { * name: "subnet_1", * networkId: network1.id, * cidr: "192.168.199.0/24", * }); * const port1 = new openstack.networking.Port("port_1", { * name: "port_1", * networkId: network1.id, * adminStateUp: true, * fixedIps: [{ * subnetId: subnet1.id, * }], * }); * ``` * * ### Port with physical binding information * * ```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, * deviceId: "cdf70fcf-c161-4f24-9c70-96b3f5a54b71", * deviceOwner: "baremetal:none", * adminStateUp: true, * binding: { * hostId: "b080b9cf-46e0-4ce8-ad47-0fd4accc872b", * vnicType: "baremetal", * profile: `{ * "local_link_information": [ * { * "switch_info": "info1", * "port_id": "Ethernet3/4", * "switch_id": "12:34:56:78:9A:BC" * }, * { * "switch_info": "info2", * "port_id": "Ethernet3/4", * "switch_id": "12:34:56:78:9A:BD" * } * ], * "vlan_type": "allowed" * } * `, * }, * }); * ``` * * ## Notes * * ### Ports and Instances * * There are some notes to consider when connecting Instances to networks using * Ports. Please see the `openstack.compute.Instance` documentation for further * documentation. * * ## Import * * Ports can be imported using the `id`, e.g. * * ```sh * $ pulumi import openstack:networking/port:Port port_1 eae26a3e-1c33-4cc1-9c31-0cd729c438a1 * ``` */ class Port extends pulumi.CustomResource { /** * Get an existing Port 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 Port(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of Port. 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'] === Port.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["adminStateUp"] = state ? state.adminStateUp : undefined; resourceInputs["allFixedIps"] = state ? state.allFixedIps : undefined; resourceInputs["allSecurityGroupIds"] = state ? state.allSecurityGroupIds : undefined; resourceInputs["allTags"] = state ? state.allTags : undefined; resourceInputs["allowedAddressPairs"] = state ? state.allowedAddressPairs : undefined; resourceInputs["binding"] = state ? state.binding : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["deviceId"] = state ? state.deviceId : undefined; resourceInputs["deviceOwner"] = state ? state.deviceOwner : undefined; resourceInputs["dnsAssignments"] = state ? state.dnsAssignments : undefined; resourceInputs["dnsName"] = state ? state.dnsName : undefined; resourceInputs["extraDhcpOptions"] = state ? state.extraDhcpOptions : undefined; resourceInputs["fixedIps"] = state ? state.fixedIps : undefined; resourceInputs["macAddress"] = state ? state.macAddress : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networkId"] = state ? state.networkId : undefined; resourceInputs["noFixedIp"] = state ? state.noFixedIp : undefined; resourceInputs["noSecurityGroups"] = state ? state.noSecurityGroups : undefined; resourceInputs["portSecurityEnabled"] = state ? state.portSecurityEnabled : undefined; resourceInputs["qosPolicyId"] = state ? state.qosPolicyId : 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["valueSpecs"] = state ? state.valueSpecs : undefined; } else { const args = argsOrState; if ((!args || args.networkId === undefined) && !opts.urn) { throw new Error("Missing required property 'networkId'"); } resourceInputs["adminStateUp"] = args ? args.adminStateUp : undefined; resourceInputs["allowedAddressPairs"] = args ? args.allowedAddressPairs : undefined; resourceInputs["binding"] = args ? args.binding : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["deviceId"] = args ? args.deviceId : undefined; resourceInputs["deviceOwner"] = args ? args.deviceOwner : undefined; resourceInputs["dnsName"] = args ? args.dnsName : undefined; resourceInputs["extraDhcpOptions"] = args ? args.extraDhcpOptions : undefined; resourceInputs["fixedIps"] = args ? args.fixedIps : undefined; resourceInputs["macAddress"] = args ? args.macAddress : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["networkId"] = args ? args.networkId : undefined; resourceInputs["noFixedIp"] = args ? args.noFixedIp : undefined; resourceInputs["noSecurityGroups"] = args ? args.noSecurityGroups : undefined; resourceInputs["portSecurityEnabled"] = args ? args.portSecurityEnabled : undefined; resourceInputs["qosPolicyId"] = args ? args.qosPolicyId : 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["valueSpecs"] = args ? args.valueSpecs : undefined; resourceInputs["allFixedIps"] = undefined /*out*/; resourceInputs["allSecurityGroupIds"] = undefined /*out*/; resourceInputs["allTags"] = undefined /*out*/; resourceInputs["dnsAssignments"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Port.__pulumiType, name, resourceInputs, opts); } } exports.Port = Port; /** @internal */ Port.__pulumiType = 'openstack:networking/port:Port'; //# sourceMappingURL=port.js.map