1. Packages
  2. Nsxt Provider
  3. API Docs
  4. getPolicySegmentPort
nsxt 3.11.0 published on Monday, Dec 15, 2025 by vmware
nsxt logo
nsxt 3.11.0 published on Monday, Dec 15, 2025 by vmware

    This resource provides a method for the management of Segments Port.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as nsxt from "@pulumi/nsxt";
    
    const segmentport1 = nsxt.getPolicySegmentPort({
        displayName: "segport1",
    });
    
    import pulumi
    import pulumi_nsxt as nsxt
    
    segmentport1 = nsxt.get_policy_segment_port(display_name="segport1")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/nsxt/v3/nsxt"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := nsxt.LookupPolicySegmentPort(ctx, &nsxt.LookupPolicySegmentPortArgs{
    			DisplayName: pulumi.StringRef("segport1"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nsxt = Pulumi.Nsxt;
    
    return await Deployment.RunAsync(() => 
    {
        var segmentport1 = Nsxt.GetPolicySegmentPort.Invoke(new()
        {
            DisplayName = "segport1",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nsxt.NsxtFunctions;
    import com.pulumi.nsxt.inputs.GetPolicySegmentPortArgs;
    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 segmentport1 = NsxtFunctions.getPolicySegmentPort(GetPolicySegmentPortArgs.builder()
                .displayName("segport1")
                .build());
    
        }
    }
    
    variables:
      segmentport1:
        fn::invoke:
          function: nsxt:getPolicySegmentPort
          arguments:
            displayName: segport1
    

    Multi-Tenancy

    import * as pulumi from "@pulumi/pulumi";
    import * as nsxt from "@pulumi/nsxt";
    
    const demoproj = nsxt.getPolicyProject({
        displayName: "demoproj",
    });
    const segmentport1 = demoproj.then(demoproj => nsxt.getPolicySegmentPort({
        context: {
            projectId: demoproj.id,
        },
        displayName: "segport1",
    }));
    
    import pulumi
    import pulumi_nsxt as nsxt
    
    demoproj = nsxt.get_policy_project(display_name="demoproj")
    segmentport1 = nsxt.get_policy_segment_port(context={
            "project_id": demoproj.id,
        },
        display_name="segport1")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/nsxt/v3/nsxt"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		demoproj, err := nsxt.LookupPolicyProject(ctx, &nsxt.LookupPolicyProjectArgs{
    			DisplayName: pulumi.StringRef("demoproj"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = nsxt.LookupPolicySegmentPort(ctx, &nsxt.LookupPolicySegmentPortArgs{
    			Context: nsxt.GetPolicySegmentPortContext{
    				ProjectId: pulumi.StringRef(demoproj.Id),
    			},
    			DisplayName: pulumi.StringRef("segport1"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nsxt = Pulumi.Nsxt;
    
    return await Deployment.RunAsync(() => 
    {
        var demoproj = Nsxt.GetPolicyProject.Invoke(new()
        {
            DisplayName = "demoproj",
        });
    
        var segmentport1 = Nsxt.GetPolicySegmentPort.Invoke(new()
        {
            Context = new Nsxt.Inputs.GetPolicySegmentPortContextInputArgs
            {
                ProjectId = demoproj.Apply(getPolicyProjectResult => getPolicyProjectResult.Id),
            },
            DisplayName = "segport1",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nsxt.NsxtFunctions;
    import com.pulumi.nsxt.inputs.GetPolicyProjectArgs;
    import com.pulumi.nsxt.inputs.GetPolicySegmentPortArgs;
    import com.pulumi.nsxt.inputs.GetPolicySegmentPortContextArgs;
    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 demoproj = NsxtFunctions.getPolicyProject(GetPolicyProjectArgs.builder()
                .displayName("demoproj")
                .build());
    
            final var segmentport1 = NsxtFunctions.getPolicySegmentPort(GetPolicySegmentPortArgs.builder()
                .context(GetPolicySegmentPortContextArgs.builder()
                    .projectId(demoproj.id())
                    .build())
                .displayName("segport1")
                .build());
    
        }
    }
    
    variables:
      demoproj:
        fn::invoke:
          function: nsxt:getPolicyProject
          arguments:
            displayName: demoproj
      segmentport1:
        fn::invoke:
          function: nsxt:getPolicySegmentPort
          arguments:
            context:
              projectId: ${demoproj.id}
            displayName: segport1
    

    Using getPolicySegmentPort

    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 getPolicySegmentPort(args: GetPolicySegmentPortArgs, opts?: InvokeOptions): Promise<GetPolicySegmentPortResult>
    function getPolicySegmentPortOutput(args: GetPolicySegmentPortOutputArgs, opts?: InvokeOptions): Output<GetPolicySegmentPortResult>
    def get_policy_segment_port(context: Optional[GetPolicySegmentPortContext] = None,
                                description: Optional[str] = None,
                                display_name: Optional[str] = None,
                                id: Optional[str] = None,
                                segment_path: Optional[str] = None,
                                vif_id: Optional[str] = None,
                                opts: Optional[InvokeOptions] = None) -> GetPolicySegmentPortResult
    def get_policy_segment_port_output(context: Optional[pulumi.Input[GetPolicySegmentPortContextArgs]] = None,
                                description: Optional[pulumi.Input[str]] = None,
                                display_name: Optional[pulumi.Input[str]] = None,
                                id: Optional[pulumi.Input[str]] = None,
                                segment_path: Optional[pulumi.Input[str]] = None,
                                vif_id: Optional[pulumi.Input[str]] = None,
                                opts: Optional[InvokeOptions] = None) -> Output[GetPolicySegmentPortResult]
    func LookupPolicySegmentPort(ctx *Context, args *LookupPolicySegmentPortArgs, opts ...InvokeOption) (*LookupPolicySegmentPortResult, error)
    func LookupPolicySegmentPortOutput(ctx *Context, args *LookupPolicySegmentPortOutputArgs, opts ...InvokeOption) LookupPolicySegmentPortResultOutput

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

    public static class GetPolicySegmentPort 
    {
        public static Task<GetPolicySegmentPortResult> InvokeAsync(GetPolicySegmentPortArgs args, InvokeOptions? opts = null)
        public static Output<GetPolicySegmentPortResult> Invoke(GetPolicySegmentPortInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetPolicySegmentPortResult> getPolicySegmentPort(GetPolicySegmentPortArgs args, InvokeOptions options)
    public static Output<GetPolicySegmentPortResult> getPolicySegmentPort(GetPolicySegmentPortArgs args, InvokeOptions options)
    
    fn::invoke:
      function: nsxt:index/getPolicySegmentPort:getPolicySegmentPort
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Context GetPolicySegmentPortContext
    The context which the object belongs to
    Description string
    The description of the resource.
    DisplayName string
    The Display Name prefix of the Segment to retrieve.
    Id string
    The ID of Segment Port to retrieve.
    SegmentPath string
    Path of the associated segment.
    VifId string
    Segment Port attachment id.
    Context GetPolicySegmentPortContext
    The context which the object belongs to
    Description string
    The description of the resource.
    DisplayName string
    The Display Name prefix of the Segment to retrieve.
    Id string
    The ID of Segment Port to retrieve.
    SegmentPath string
    Path of the associated segment.
    VifId string
    Segment Port attachment id.
    context GetPolicySegmentPortContext
    The context which the object belongs to
    description String
    The description of the resource.
    displayName String
    The Display Name prefix of the Segment to retrieve.
    id String
    The ID of Segment Port to retrieve.
    segmentPath String
    Path of the associated segment.
    vifId String
    Segment Port attachment id.
    context GetPolicySegmentPortContext
    The context which the object belongs to
    description string
    The description of the resource.
    displayName string
    The Display Name prefix of the Segment to retrieve.
    id string
    The ID of Segment Port to retrieve.
    segmentPath string
    Path of the associated segment.
    vifId string
    Segment Port attachment id.
    context GetPolicySegmentPortContext
    The context which the object belongs to
    description str
    The description of the resource.
    display_name str
    The Display Name prefix of the Segment to retrieve.
    id str
    The ID of Segment Port to retrieve.
    segment_path str
    Path of the associated segment.
    vif_id str
    Segment Port attachment id.
    context Property Map
    The context which the object belongs to
    description String
    The description of the resource.
    displayName String
    The Display Name prefix of the Segment to retrieve.
    id String
    The ID of Segment Port to retrieve.
    segmentPath String
    Path of the associated segment.
    vifId String
    Segment Port attachment id.

    getPolicySegmentPort Result

    The following output properties are available:

    Description string
    The description of the resource.
    DisplayName string
    Id string
    Path string
    The NSX path of the policy resource.
    Context GetPolicySegmentPortContext
    SegmentPath string
    Path of the associated segment.
    VifId string
    Description string
    The description of the resource.
    DisplayName string
    Id string
    Path string
    The NSX path of the policy resource.
    Context GetPolicySegmentPortContext
    SegmentPath string
    Path of the associated segment.
    VifId string
    description String
    The description of the resource.
    displayName String
    id String
    path String
    The NSX path of the policy resource.
    context GetPolicySegmentPortContext
    segmentPath String
    Path of the associated segment.
    vifId String
    description string
    The description of the resource.
    displayName string
    id string
    path string
    The NSX path of the policy resource.
    context GetPolicySegmentPortContext
    segmentPath string
    Path of the associated segment.
    vifId string
    description str
    The description of the resource.
    display_name str
    id str
    path str
    The NSX path of the policy resource.
    context GetPolicySegmentPortContext
    segment_path str
    Path of the associated segment.
    vif_id str
    description String
    The description of the resource.
    displayName String
    id String
    path String
    The NSX path of the policy resource.
    context Property Map
    segmentPath String
    Path of the associated segment.
    vifId String

    Supporting Types

    GetPolicySegmentPortContext

    FromGlobal bool
    Search among global resource
    ProjectId string

    The ID of the project which the object belongs to

    Note: Atleast one of vif_id, display_name or id should be set.

    FromGlobal bool
    Search among global resource
    ProjectId string

    The ID of the project which the object belongs to

    Note: Atleast one of vif_id, display_name or id should be set.

    fromGlobal Boolean
    Search among global resource
    projectId String

    The ID of the project which the object belongs to

    Note: Atleast one of vif_id, display_name or id should be set.

    fromGlobal boolean
    Search among global resource
    projectId string

    The ID of the project which the object belongs to

    Note: Atleast one of vif_id, display_name or id should be set.

    from_global bool
    Search among global resource
    project_id str

    The ID of the project which the object belongs to

    Note: Atleast one of vif_id, display_name or id should be set.

    fromGlobal Boolean
    Search among global resource
    projectId String

    The ID of the project which the object belongs to

    Note: Atleast one of vif_id, display_name or id should be set.

    Package Details

    Repository
    nsxt vmware/terraform-provider-nsxt
    License
    Notes
    This Pulumi package is based on the nsxt Terraform Provider.
    nsxt logo
    nsxt 3.11.0 published on Monday, Dec 15, 2025 by vmware
      Meet Neo: Your AI Platform Teammate