PowerCLI Reference

Get-NsxtService

Synopsis

This cmdlet retrieves PSObject objects that represent a proxy to an NSX-T API service.

Syntax

Get-NsxtService [[-Name] <String[]>] [-Server <CisServer[]>] [<CommonParameters>]

Related Commands

Online Version

Detailed Description

This cmdlet retrieves PSObject objects that represent a proxy to a NSX-T API service and can be used to invoke the operations of the NSX-T API service. The cmdlet returns one PSObject object for every service available on NSX-T server.


Every service proxy has a top-level Help property that contains documentation about the service's methods, parameters, constants, and so on. The Help object is hierarchical and mirrors the service's methods, parameters, constants, and so on. The Help object can also be used for creation of parameters that the service methods accept through a method named "Create".


The "Create" method is available for the following objects:


- A parameter.


- Inheritors of a parameter that accepts instances of types that derive the declared parameter type.


- Elements of a parameter that is of type List, Set or Optional.




- Key and Value of a parameter of type Map.


- Fields of a parameter of type Structure.

For more information, see Example 2.

Parameters

NameTypeDescriptionRequired?Pipeline InputDefault Value
NameString[]Specifies the service type ID.falseFalse
ServerCisServer[]Specifies the NSX-T servers on which you want to run the cmdlet. If no value is given to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-NsxtServer.falseFalse

Return Type

One or more PSObject objects

Notes

Examples

-------------------------- Example 1 --------------------------

$userService = Get-NsxtService -Name "com.vmware.nsx.aaa.user_info"
$userService.get()

Retrieves the binding for the specified service and invokes a service operation.

-------------------------- Example 2 --------------------------

# Retrieve Logical Routers Service 
$logicalRoutersService = Get-NsxtService -Name 'com.vmware.nsx.logical_routers' 

# Create input argument for creation of a logical router 
$logicalRouterCreateSpec = $logicalRoutersService.Help.create.logical_router.Create() 

# Fill in the create spec properties 
$logicalRouterCreateSpec.display_name = "MyLogicalRouter" 
$logicalRouterCreateSpec.router_type = "TIER1" 

# Create Logical Router Entity 
$logicalRouter = $logicalRoutersService.create($logicalRouterCreateSpec) 

# Retrieve logical router ports service 
$logicalRouterPortsService = Get-NsxtService -Name 'com.vmware.nsx.logical_router_ports' 

# Create Input argument for logical router downlink port creation 
$logicalRouterPortCreateSpec = $logicalRouterPortsService.Help.create.logical_router_port.logical_router_down_link_port.Create() 

# Fill in the properties of the logical router port create spec 
$logicalRouterPortCreateSpec.logical_router_id = $logicalRouter.id 
$logicalRouterPortCreateSpec.display_name = "MyLogicalRouterDownlinkPort" 
$logicalRouterPortCreateSpec.subnets = $logicalRouterPortsService.Help.create.logical_router_port.logical_router_down_link_port.subnets.Create() 

# Create subnet element 
$subnet = $logicalRouterPortsService.Help.create.logical_router_port.logical_router_down_link_port.subnets.Element.Create() 

# Fill in subnet properties 
$subnet.ip_addresses = @('11.11.11.11') 
$subnet.prefix_length = 22 

# Add subnet into the subnets collection of the logical router port create spec 
$logicalRouterPortCreateSpec.subnets.Add($subnet) 

# Create Logical Router Downlink Port Entity 
$logicalRouterPortsService.create($logicalRouterPortCreateSpec)

Creates logical router and logical router downlink port entities.


Copyright © VMware, Inc. All rights reserved.