You can navigate the NSX Policy SDK for PowerShell by using the Get-NsxOperation and Get-Help cmdlets.
To navigate the NSX Policy SDK for PowerShell, you must be familiar with the NSX Policy API and its reference documentation.
You can access two NSX REST API references on the VMware Developer website:
The NSX REST API reference
that contains all NSX networking services, for both on-prem and VMware Cloud on AWS.
The NSX VMC Policy API reference
that contains only the networking services for VMware Cloud on AWS. Here, you can find ready-to-use PowerCLI samples that you can paste directly into your PowerShell console.
The following procedure is based on the NSX REST API reference.
Procedure
- In the NSX REST API reference, navigate to the NSX Policy API operation you want to use.
- Copy the method and the path of the operation.
- In PowerShell, run Get-NsxOperation with the Method and Path parameters.
For example:
Get-NsxOperation -Method PUT -Path '/policy/api/v1/infra/tier-1s/<tier-1-id>/segments/<segment-id>'
The command retrieves a custom object with the NSX operation details.
Name : CreateOrReplaceSegment
CommandInfo : Invoke-CreateOrReplaceSegment
ApiName : PolicyConnectivityApi
Path : /infra/tier-1s/{tier-1-id}/segments/{segment-id}
Tags : {Policy, Networking, Connectivity, Segments...}
RelatedCommandInfos : {Initialize-Segment}
Method : PUT
Parameters : {tier1Id, segmentId, segment}
- Copy the PowerCLI cmdlet that corresponds to the API operation.
It is listed in the CommandInfo property.
- To retrieve information about the cmdlet , run Get-Help.
For example:
Get-Help Invoke-CreateOrReplaceSegment -full
You can see the full information about the cmdlet such as its description, parameters, and code examples.