1. Packages
  2. Openstack Provider
  3. API Docs
  4. networking
  5. getPort
OpenStack v5.0.0 published on Friday, Sep 27, 2024 by Pulumi

openstack.networking.getPort

Explore with Pulumi AI

OpenStack v5.0.0 published on Friday, Sep 27, 2024 by Pulumi

Use this data source to get the ID of an available OpenStack port.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const port1 = openstack.networking.getPort({
    name: "port_1",
});
Copy
import pulumi
import pulumi_openstack as openstack

port1 = openstack.networking.get_port(name="port_1")
Copy
package main

import (
	"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/networking"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := networking.LookupPort(ctx, &networking.LookupPortArgs{
			Name: pulumi.StringRef("port_1"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;

return await Deployment.RunAsync(() => 
{
    var port1 = OpenStack.Networking.GetPort.Invoke(new()
    {
        Name = "port_1",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.NetworkingFunctions;
import com.pulumi.openstack.networking.inputs.GetPortArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var port1 = NetworkingFunctions.getPort(GetPortArgs.builder()
            .name("port_1")
            .build());

    }
}
Copy
variables:
  port1:
    fn::invoke:
      Function: openstack:networking:getPort
      Arguments:
        name: port_1
Copy

Using getPort

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getPort(args: GetPortArgs, opts?: InvokeOptions): Promise<GetPortResult>
function getPortOutput(args: GetPortOutputArgs, opts?: InvokeOptions): Output<GetPortResult>
Copy
def get_port(admin_state_up: Optional[bool] = None,
             description: Optional[str] = None,
             device_id: Optional[str] = None,
             device_owner: Optional[str] = None,
             dns_name: Optional[str] = None,
             fixed_ip: Optional[str] = None,
             mac_address: Optional[str] = None,
             name: Optional[str] = None,
             network_id: Optional[str] = None,
             port_id: Optional[str] = None,
             project_id: Optional[str] = None,
             region: Optional[str] = None,
             security_group_ids: Optional[Sequence[str]] = None,
             status: Optional[str] = None,
             tags: Optional[Sequence[str]] = None,
             tenant_id: Optional[str] = None,
             opts: Optional[InvokeOptions] = None) -> GetPortResult
def get_port_output(admin_state_up: Optional[pulumi.Input[bool]] = None,
             description: Optional[pulumi.Input[str]] = None,
             device_id: Optional[pulumi.Input[str]] = None,
             device_owner: Optional[pulumi.Input[str]] = None,
             dns_name: Optional[pulumi.Input[str]] = None,
             fixed_ip: Optional[pulumi.Input[str]] = None,
             mac_address: Optional[pulumi.Input[str]] = None,
             name: Optional[pulumi.Input[str]] = None,
             network_id: Optional[pulumi.Input[str]] = None,
             port_id: Optional[pulumi.Input[str]] = None,
             project_id: Optional[pulumi.Input[str]] = None,
             region: Optional[pulumi.Input[str]] = None,
             security_group_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
             status: Optional[pulumi.Input[str]] = None,
             tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
             tenant_id: Optional[pulumi.Input[str]] = None,
             opts: Optional[InvokeOptions] = None) -> Output[GetPortResult]
Copy
func LookupPort(ctx *Context, args *LookupPortArgs, opts ...InvokeOption) (*LookupPortResult, error)
func LookupPortOutput(ctx *Context, args *LookupPortOutputArgs, opts ...InvokeOption) LookupPortResultOutput
Copy

> Note: This function is named LookupPort in the Go SDK.

public static class GetPort 
{
    public static Task<GetPortResult> InvokeAsync(GetPortArgs args, InvokeOptions? opts = null)
    public static Output<GetPortResult> Invoke(GetPortInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetPortResult> getPort(GetPortArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Copy
fn::invoke:
  function: openstack:networking/getPort:getPort
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

AdminStateUp bool
The administrative state of the port.
Description string
Human-readable description of the port.
DeviceId string
The ID of the device the port belongs to.
DeviceOwner string
The device owner of the port.
DnsName string
The port DNS name to filter. Available, when Neutron DNS extension is enabled.
FixedIp string
The port IP address filter.
MacAddress string
The MAC address of the port.
Name string
The name of the port.
NetworkId string
The ID of the network the port belongs to.
PortId string
The ID of the port.
ProjectId string
The owner of the port.
Region string
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve port ids. If omitted, the region argument of the provider is used.
SecurityGroupIds List<string>
The list of port security group IDs to filter.
Status Changes to this property will trigger replacement. string
The status of the port.
Tags List<string>
The list of port tags to filter.
TenantId string
AdminStateUp bool
The administrative state of the port.
Description string
Human-readable description of the port.
DeviceId string
The ID of the device the port belongs to.
DeviceOwner string
The device owner of the port.
DnsName string
The port DNS name to filter. Available, when Neutron DNS extension is enabled.
FixedIp string
The port IP address filter.
MacAddress string
The MAC address of the port.
Name string
The name of the port.
NetworkId string
The ID of the network the port belongs to.
PortId string
The ID of the port.
ProjectId string
The owner of the port.
Region string
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve port ids. If omitted, the region argument of the provider is used.
SecurityGroupIds []string
The list of port security group IDs to filter.
Status Changes to this property will trigger replacement. string
The status of the port.
Tags []string
The list of port tags to filter.
TenantId string
adminStateUp Boolean
The administrative state of the port.
description String
Human-readable description of the port.
deviceId String
The ID of the device the port belongs to.
deviceOwner String
The device owner of the port.
dnsName String
The port DNS name to filter. Available, when Neutron DNS extension is enabled.
fixedIp String
The port IP address filter.
macAddress String
The MAC address of the port.
name String
The name of the port.
networkId String
The ID of the network the port belongs to.
portId String
The ID of the port.
projectId String
The owner of the port.
region String
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve port ids. If omitted, the region argument of the provider is used.
securityGroupIds List<String>
The list of port security group IDs to filter.
status Changes to this property will trigger replacement. String
The status of the port.
tags List<String>
The list of port tags to filter.
tenantId String
adminStateUp boolean
The administrative state of the port.
description string
Human-readable description of the port.
deviceId string
The ID of the device the port belongs to.
deviceOwner string
The device owner of the port.
dnsName string
The port DNS name to filter. Available, when Neutron DNS extension is enabled.
fixedIp string
The port IP address filter.
macAddress string
The MAC address of the port.
name string
The name of the port.
networkId string
The ID of the network the port belongs to.
portId string
The ID of the port.
projectId string
The owner of the port.
region string
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve port ids. If omitted, the region argument of the provider is used.
securityGroupIds string[]
The list of port security group IDs to filter.
status Changes to this property will trigger replacement. string
The status of the port.
tags string[]
The list of port tags to filter.
tenantId string
admin_state_up bool
The administrative state of the port.
description str
Human-readable description of the port.
device_id str
The ID of the device the port belongs to.
device_owner str
The device owner of the port.
dns_name str
The port DNS name to filter. Available, when Neutron DNS extension is enabled.
fixed_ip str
The port IP address filter.
mac_address str
The MAC address of the port.
name str
The name of the port.
network_id str
The ID of the network the port belongs to.
port_id str
The ID of the port.
project_id str
The owner of the port.
region str
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve port ids. If omitted, the region argument of the provider is used.
security_group_ids Sequence[str]
The list of port security group IDs to filter.
status Changes to this property will trigger replacement. str
The status of the port.
tags Sequence[str]
The list of port tags to filter.
tenant_id str
adminStateUp Boolean
The administrative state of the port.
description String
Human-readable description of the port.
deviceId String
The ID of the device the port belongs to.
deviceOwner String
The device owner of the port.
dnsName String
The port DNS name to filter. Available, when Neutron DNS extension is enabled.
fixedIp String
The port IP address filter.
macAddress String
The MAC address of the port.
name String
The name of the port.
networkId String
The ID of the network the port belongs to.
portId String
The ID of the port.
projectId String
The owner of the port.
region String
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve port ids. If omitted, the region argument of the provider is used.
securityGroupIds List<String>
The list of port security group IDs to filter.
status Changes to this property will trigger replacement. String
The status of the port.
tags List<String>
The list of port tags to filter.
tenantId String

getPort Result

The following output properties are available:

AllFixedIps List<string>
The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
AllSecurityGroupIds List<string>
The set of security group IDs applied on the port.
AllTags List<string>
The set of string tags applied on the port.
AllowedAddressPairs List<Pulumi.OpenStack.Networking.Outputs.GetPortAllowedAddressPair>
An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
Bindings List<Pulumi.OpenStack.Networking.Outputs.GetPortBinding>
The port binding information. The structure is described below.
DnsAssignments List<ImmutableDictionary<string, string>>
The list of maps representing port DNS assignments.
ExtraDhcpOptions List<Pulumi.OpenStack.Networking.Outputs.GetPortExtraDhcpOption>
An extra DHCP option configured on the port. The structure is described below.
Id string
The provider-assigned unique ID for this managed resource.
AdminStateUp bool
See Argument Reference above.
Description string
See Argument Reference above.
DeviceId string
See Argument Reference above.
DeviceOwner string
See Argument Reference above.
DnsName string
See Argument Reference above.
FixedIp string
MacAddress string
The additional MAC address.
Name string
Name of the DHCP option.
NetworkId string
See Argument Reference above.
PortId string
See Argument Reference above.
ProjectId string
See Argument Reference above.
Region string
See Argument Reference above.
SecurityGroupIds List<string>
Status string
Tags List<string>
TenantId string
AllFixedIps []string
The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
AllSecurityGroupIds []string
The set of security group IDs applied on the port.
AllTags []string
The set of string tags applied on the port.
AllowedAddressPairs []GetPortAllowedAddressPair
An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
Bindings []GetPortBinding
The port binding information. The structure is described below.
DnsAssignments []map[string]string
The list of maps representing port DNS assignments.
ExtraDhcpOptions []GetPortExtraDhcpOption
An extra DHCP option configured on the port. The structure is described below.
Id string
The provider-assigned unique ID for this managed resource.
AdminStateUp bool
See Argument Reference above.
Description string
See Argument Reference above.
DeviceId string
See Argument Reference above.
DeviceOwner string
See Argument Reference above.
DnsName string
See Argument Reference above.
FixedIp string
MacAddress string
The additional MAC address.
Name string
Name of the DHCP option.
NetworkId string
See Argument Reference above.
PortId string
See Argument Reference above.
ProjectId string
See Argument Reference above.
Region string
See Argument Reference above.
SecurityGroupIds []string
Status string
Tags []string
TenantId string
allFixedIps List<String>
The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
allSecurityGroupIds List<String>
The set of security group IDs applied on the port.
allTags List<String>
The set of string tags applied on the port.
allowedAddressPairs List<GetPortAllowedAddressPair>
An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
bindings List<GetPortBinding>
The port binding information. The structure is described below.
dnsAssignments List<Map<String,String>>
The list of maps representing port DNS assignments.
extraDhcpOptions List<GetPortExtraDhcpOption>
An extra DHCP option configured on the port. The structure is described below.
id String
The provider-assigned unique ID for this managed resource.
adminStateUp Boolean
See Argument Reference above.
description String
See Argument Reference above.
deviceId String
See Argument Reference above.
deviceOwner String
See Argument Reference above.
dnsName String
See Argument Reference above.
fixedIp String
macAddress String
The additional MAC address.
name String
Name of the DHCP option.
networkId String
See Argument Reference above.
portId String
See Argument Reference above.
projectId String
See Argument Reference above.
region String
See Argument Reference above.
securityGroupIds List<String>
status String
tags List<String>
tenantId String
allFixedIps string[]
The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
allSecurityGroupIds string[]
The set of security group IDs applied on the port.
allTags string[]
The set of string tags applied on the port.
allowedAddressPairs GetPortAllowedAddressPair[]
An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
bindings GetPortBinding[]
The port binding information. The structure is described below.
dnsAssignments {[key: string]: string}[]
The list of maps representing port DNS assignments.
extraDhcpOptions GetPortExtraDhcpOption[]
An extra DHCP option configured on the port. The structure is described below.
id string
The provider-assigned unique ID for this managed resource.
adminStateUp boolean
See Argument Reference above.
description string
See Argument Reference above.
deviceId string
See Argument Reference above.
deviceOwner string
See Argument Reference above.
dnsName string
See Argument Reference above.
fixedIp string
macAddress string
The additional MAC address.
name string
Name of the DHCP option.
networkId string
See Argument Reference above.
portId string
See Argument Reference above.
projectId string
See Argument Reference above.
region string
See Argument Reference above.
securityGroupIds string[]
status string
tags string[]
tenantId string
all_fixed_ips Sequence[str]
The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
all_security_group_ids Sequence[str]
The set of security group IDs applied on the port.
all_tags Sequence[str]
The set of string tags applied on the port.
allowed_address_pairs Sequence[GetPortAllowedAddressPair]
An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
bindings Sequence[GetPortBinding]
The port binding information. The structure is described below.
dns_assignments Sequence[Mapping[str, str]]
The list of maps representing port DNS assignments.
extra_dhcp_options Sequence[GetPortExtraDhcpOption]
An extra DHCP option configured on the port. The structure is described below.
id str
The provider-assigned unique ID for this managed resource.
admin_state_up bool
See Argument Reference above.
description str
See Argument Reference above.
device_id str
See Argument Reference above.
device_owner str
See Argument Reference above.
dns_name str
See Argument Reference above.
fixed_ip str
mac_address str
The additional MAC address.
name str
Name of the DHCP option.
network_id str
See Argument Reference above.
port_id str
See Argument Reference above.
project_id str
See Argument Reference above.
region str
See Argument Reference above.
security_group_ids Sequence[str]
status str
tags Sequence[str]
tenant_id str
allFixedIps List<String>
The collection of Fixed IP addresses on the port in the order returned by the Network v2 API.
allSecurityGroupIds List<String>
The set of security group IDs applied on the port.
allTags List<String>
The set of string tags applied on the port.
allowedAddressPairs List<Property Map>
An IP/MAC Address pair of additional IP addresses that can be active on this port. The structure is described below.
bindings List<Property Map>
The port binding information. The structure is described below.
dnsAssignments List<Map<String>>
The list of maps representing port DNS assignments.
extraDhcpOptions List<Property Map>
An extra DHCP option configured on the port. The structure is described below.
id String
The provider-assigned unique ID for this managed resource.
adminStateUp Boolean
See Argument Reference above.
description String
See Argument Reference above.
deviceId String
See Argument Reference above.
deviceOwner String
See Argument Reference above.
dnsName String
See Argument Reference above.
fixedIp String
macAddress String
The additional MAC address.
name String
Name of the DHCP option.
networkId String
See Argument Reference above.
portId String
See Argument Reference above.
projectId String
See Argument Reference above.
region String
See Argument Reference above.
securityGroupIds List<String>
status String
tags List<String>
tenantId String

Supporting Types

GetPortAllowedAddressPair

IpAddress This property is required. string
The additional IP address.
MacAddress This property is required. string
The MAC address of the port.
IpAddress This property is required. string
The additional IP address.
MacAddress This property is required. string
The MAC address of the port.
ipAddress This property is required. String
The additional IP address.
macAddress This property is required. String
The MAC address of the port.
ipAddress This property is required. string
The additional IP address.
macAddress This property is required. string
The MAC address of the port.
ip_address This property is required. str
The additional IP address.
mac_address This property is required. str
The MAC address of the port.
ipAddress This property is required. String
The additional IP address.
macAddress This property is required. String
The MAC address of the port.

GetPortBinding

HostId This property is required. string
The ID of the host, which has the allocatee port.
Profile This property is required. string
A JSON string containing the binding profile information.
VifDetails This property is required. Dictionary<string, string>
A map of JSON strings containing additional details for this specific binding.
VifType This property is required. string
The VNIC type of the port binding.
VnicType This property is required. string
VNIC type for the port.
HostId This property is required. string
The ID of the host, which has the allocatee port.
Profile This property is required. string
A JSON string containing the binding profile information.
VifDetails This property is required. map[string]string
A map of JSON strings containing additional details for this specific binding.
VifType This property is required. string
The VNIC type of the port binding.
VnicType This property is required. string
VNIC type for the port.
hostId This property is required. String
The ID of the host, which has the allocatee port.
profile This property is required. String
A JSON string containing the binding profile information.
vifDetails This property is required. Map<String,String>
A map of JSON strings containing additional details for this specific binding.
vifType This property is required. String
The VNIC type of the port binding.
vnicType This property is required. String
VNIC type for the port.
hostId This property is required. string
The ID of the host, which has the allocatee port.
profile This property is required. string
A JSON string containing the binding profile information.
vifDetails This property is required. {[key: string]: string}
A map of JSON strings containing additional details for this specific binding.
vifType This property is required. string
The VNIC type of the port binding.
vnicType This property is required. string
VNIC type for the port.
host_id This property is required. str
The ID of the host, which has the allocatee port.
profile This property is required. str
A JSON string containing the binding profile information.
vif_details This property is required. Mapping[str, str]
A map of JSON strings containing additional details for this specific binding.
vif_type This property is required. str
The VNIC type of the port binding.
vnic_type This property is required. str
VNIC type for the port.
hostId This property is required. String
The ID of the host, which has the allocatee port.
profile This property is required. String
A JSON string containing the binding profile information.
vifDetails This property is required. Map<String>
A map of JSON strings containing additional details for this specific binding.
vifType This property is required. String
The VNIC type of the port binding.
vnicType This property is required. String
VNIC type for the port.

GetPortExtraDhcpOption

IpVersion This property is required. int
IP protocol version
Name This property is required. string
The name of the port.
Value This property is required. string
Value of the DHCP option.
IpVersion This property is required. int
IP protocol version
Name This property is required. string
The name of the port.
Value This property is required. string
Value of the DHCP option.
ipVersion This property is required. Integer
IP protocol version
name This property is required. String
The name of the port.
value This property is required. String
Value of the DHCP option.
ipVersion This property is required. number
IP protocol version
name This property is required. string
The name of the port.
value This property is required. string
Value of the DHCP option.
ip_version This property is required. int
IP protocol version
name This property is required. str
The name of the port.
value This property is required. str
Value of the DHCP option.
ipVersion This property is required. Number
IP protocol version
name This property is required. String
The name of the port.
value This property is required. String
Value of the DHCP option.

Package Details

Repository
OpenStack pulumi/pulumi-openstack
License
Apache-2.0
Notes
This Pulumi package is based on the openstack Terraform Provider.
OpenStack v5.0.0 published on Friday, Sep 27, 2024 by Pulumi