Public/Get-NetworkSecurityRule.ps1

<#
    .DESCRIPTION
    Wrapper for Nutanix API version 0.3.
 
    .NOTES
    Author: Timothy Rasiah
#>


function Get-NetworkSecurityRule {
    [CmdletBinding()]
    param (
        $uuid,
        $name
    )
    
    if ($uuid) {
        $response = Send-Request -method "GET" -endpoint "/network_security_rules/$($uuid)"
        return $response
    }

    $data = @{
        "kind" = "network_security_rule"
    }

    if ($name) {
        $data["filter"] = "name==$($name)"
    }

    $response = Send-Request -method "POST" -endpoint "/network_security_rules/list" -data $data
    return $response.entities
}