Skip to content

Commit 39b2e77

Browse files
committed
Added Get-NSHANode to support high-availability setup
1 parent 9792b5d commit 39b2e77

File tree

3 files changed

+124
-0
lines changed

3 files changed

+124
-0
lines changed

Contrib/CODE_GENERATION.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,14 @@ generator. The preferred approach now is to use a template base generator. The g
2525
"`$1`r`n$list`r`n`$2"))
2626

2727

28+
# Example code generation:
29+
30+
New-NSGet -Name HANode -Label "HA Node" -Filters ([ordered]@{
31+
"Name" = "name"
32+
"IPAddress" = "ipaddress"
33+
"State" = "state"
34+
"HAStatus" = "hastatus"
35+
"HASync" = "hasync"
36+
}) -ResourceIdParamName ID -Partial
37+
2838

NetScaler/NetScaler.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ FunctionsToExport = @(
113113
'Get-NSDnsNameServer',
114114
'Get-NSDnsSuffix',
115115
'Get-NSFeature',
116+
'Get-NSHANode',
116117
'Get-NSHardware',
117118
'Get-NSHostname',
118119
'Get-NSIP6Resource',

NetScaler/Public/Get-NSHANode.ps1

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
2+
<#
3+
Copyright $CopyrightYear $Author
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
#>
17+
18+
function Get-NSHANode {
19+
<#
20+
.SYNOPSIS
21+
Gets the specified HA Node object(s).
22+
23+
.DESCRIPTION
24+
Gets the specified HA Node object(s).
25+
Either returns a single object identified by its identifier (-ID parameter)
26+
or a collection of objects filtered by the other parameters. Those
27+
filter parameters accept either a literal value or a regexp in the form
28+
"/someregexp/".
29+
30+
.EXAMPLE
31+
Get-NSHANode
32+
33+
Get all HA Node objects.
34+
35+
.EXAMPLE
36+
Get-NSHANode -ID 'foobar'
37+
38+
Get the HA Node named 'foobar'.
39+
40+
.PARAMETER Session
41+
The NetScaler session object.
42+
43+
.PARAMETER ID
44+
The identifier/name or identifiers/names of the HA Nodes to get.
45+
46+
.PARAMETER IPAddress
47+
A filter to apply to the ipaddress property.
48+
49+
.PARAMETER HASync
50+
A filter to apply to the hasync property.
51+
52+
.PARAMETER Name
53+
A filter to apply to the name property.
54+
55+
.PARAMETER HAStatus
56+
A filter to apply to the hastatus property.
57+
58+
.PARAMETER State
59+
A filter to apply to the state property.
60+
61+
.NOTES
62+
Nitro implementation status: partial
63+
64+
#>
65+
[CmdletBinding(DefaultParameterSetName='get')]
66+
Param(
67+
$Session = $Script:Session,
68+
69+
[Parameter(Position=0, ParameterSetName='get')]
70+
[string[]]$ID = @(),
71+
72+
[Parameter(ParameterSetName='search')]
73+
[string]$IPAddress,
74+
75+
[Parameter(ParameterSetName='search')]
76+
[string]$HASync,
77+
78+
[Parameter(ParameterSetName='search')]
79+
[string]$Name,
80+
81+
[Parameter(ParameterSetName='search')]
82+
[string]$HAStatus,
83+
84+
[Parameter(ParameterSetName='search')]
85+
[string]$State
86+
87+
)
88+
Begin {
89+
_AssertSessionActive
90+
}
91+
92+
Process {
93+
# Contruct a filter hash if we specified any filters
94+
$Filters = @{}
95+
if ($PSBoundParameters.ContainsKey('IPAddress')) {
96+
$Filters['ipaddress'] = $IPAddress
97+
}
98+
if ($PSBoundParameters.ContainsKey('HASync')) {
99+
$Filters['hasync'] = $HASync
100+
}
101+
if ($PSBoundParameters.ContainsKey('Name')) {
102+
$Filters['name'] = $Name
103+
}
104+
if ($PSBoundParameters.ContainsKey('HAStatus')) {
105+
$Filters['hastatus'] = $HAStatus
106+
}
107+
if ($PSBoundParameters.ContainsKey('State')) {
108+
$Filters['state'] = $State
109+
}
110+
_InvokeNSRestApiGet -Session $Session -Type hanode -Name $ID -Filters $Filters
111+
112+
}
113+
}

0 commit comments

Comments
 (0)