<% if ($CopyrightYear -and $Author) { %> <# Copyright $CopyrightYear $Author Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. #> <% } %> function <%= $FunctionName %> { <# .SYNOPSIS Gets the specified <%= $Label %> object(s). .DESCRIPTION Gets the specified <%= $Label %> object(s). Either returns a single object identified by its identifier (-<%= $ResourceIdParamName %> parameter) or a collection of objects filtered by the other parameters. Those filter parameters accept either a literal value or a regexp in the form "/someregexp/". .EXAMPLE <%= $FunctionName %> Get all <%= $Label %> objects. .EXAMPLE <%= $FunctionName %> -<%= $ResourceIdParamName %> 'foobar' Get the <%= $Label %> named 'foobar'. .PARAMETER Session The NetScaler session object. .PARAMETER <%= $ResourceIdParamName %> The identifier/name or identifiers/names of the <%= $Label %>s to get. <% $Filters.GetEnumerator() | % { $FilterName, $FilterDesc = $_.Key, $_.Value -%> .PARAMETER <%= $FilterName %> <%- if ($FilterDesc[2] -eq "default") { -%> If true, show builtins. Default value: $False <% } else { -%> A filter to apply to the <%= $FilterDesc[1] %> property. <% } %> <% } -%> <% if ($Partial) { -%> .NOTES Nitro implementation status: partial <% } %> #> [CmdletBinding(DefaultParameterSetName='get')] Param( $Session = $Script:Session, [Parameter(Position=0, ParameterSetName='get')] [string[]]$<%= $ResourceIdParamName %> = @()<%= if ($Filters -and $Filters.Count -ne 0) { "," } %> <% $Filters.GetEnumerator() | ForEach-Object { $i = 0 } { $i++ $FilterName, $FilterDesc = $_.Key, $_.Value $Comma = if ($i -eq $Filters.Count) { "" } else { "," } -%> [Parameter(ParameterSetName='search')] <% if ($FilterDesc[2] -eq "default") { -%> [switch]$<%= $FilterName + $Comma %> <% } else { -%> [string]$<%= $FilterName + $Comma %> <% } %> <% } -%> ) Begin { _AssertSessionActive } Process { <% if ($Filters -and ($Filters.Count -ne 0)) { -%> # Contruct a filter hash if we specified any filters $Filters = @{} <% $Filters.GetEnumerator() | % { $FilterName, $FilterDesc = $_.Key, $_.Value -%> <% if ($FilterDesc[2] -eq "default") { -%> if (!$<%= $FilterName %>) { $Filters['<%= $FilterDesc[0] %>'] = '<%= $FilterDesc[3] %>' } <% } else { -%> if ($PSBoundParameters.ContainsKey('<%= $FilterName %>')) { $Filters['<%= $FilterDesc[0] %>'] = $<%= $FilterName %> } <% } -%> <% } -%> _InvokeNSRestApiGet -Session $Session -Type <%= $Type %> -Name $<%= $ResourceIdParamName %> <%= if ($Arguments) { "-Arguments" } else { "-Filters" } %> $Filters <% } else { %> _InvokeNSRestApiGet -Session $Session -Type <%= $Type %> -Name $<%= $ResourceIdParamName %> <% } %> } }