Skip to content

Commit afff809

Browse files
committed
Merge dev branch
2 parents da52688 + 14d4a67 commit afff809

22 files changed

Lines changed: 782 additions & 79 deletions

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## 1.4.0 (2016-11-07)
2+
* Features
3+
* Added parameters to New-NSLBVirtualServer to configure a redirect (via @rokett)
4+
* Added parameter 'ICMPVSResponse' to New-NSLBVirtualServer which controler whether ICMP response is ACTIVE or PASSIVE on VIP (via @dbroeglin)
5+
* Added Add-NSLBVirtualServerResponderPolicyBinding an Get-NSLBVirtualServerResponderPolicyBinding (via @rokett)
6+
* Added (Get|New|Remove)-NSBackup to manage NetScaler backups (via @devblackops)
7+
* Added Get-NSStat function to get NetScaler stat objects (via @devblackops)
8+
* Added New-NSResponderPolicy function to create responder policies (via @rokett)
9+
* Added -Send and -Recv parameters to New-NSLBMonitor (via @rokett)
10+
11+
* Improvements
12+
* Added support for 'Arguments' parameter in _InvokeNsRestApiGet (via @dbroeglin)
13+
* Refactored Get-NSSystemFile to use internal _InvokeNSRestApiGet function (via @dbroeglin)
14+
* Added example to comment-based help in _InvokeNSRestApiGet (via @dbroeglin)
15+
16+
* Bug fixes
17+
* Fix typo in Add-NSLBVirtualServerBinding (via @rokett)
18+
19+
* Deprecated
20+
* Mark Get-NSLBStat as deprecated in favor of Get-NSStat
21+
122
## 1.3.0 (2016-09-10)
223
* Features
324
* Added Add-NSCSVirtualServerResponderPolicyBinding (via @rokett)

Contrib/New-GetCmdlet.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Param(
88
[Parameter(Mandatory)]
99
[String]$Label,
1010

11-
[Hashtable]$Filters = $Null
11+
[Hashtable]$Filters = $Null,
12+
13+
[Switch]$Arguments = $False
1214
)
1315
$ErrorActionPreference = "Stop"
1416

@@ -50,11 +52,13 @@ Param(
5052

5153

5254
if ($Filters -and ($Filters.Count -ne 0)) {
55+
$ArgumentName = "-Filters"
56+
if ($Arguments) { $ArgumentName = "-Arguments" }
5357
$ProcessBlock = @"
5458
# Contruct a filter hash if we specified any filters
5559
`$Filters = @{}
5660
$(($Filters.GetEnumerator() | % { Expand-Filter $_.Key $_.Value }) -Join "`n")
57-
_InvokeNSRestApiGet -Session `$Session -Type $Type -Name `$Name -Filters `$Filters
61+
_InvokeNSRestApiGet -Session `$Session -Type $Type -Name `$Name $ArgumentName `$Filters
5862
"@
5963
$FilterParameters = ",`n`n" + (
6064
($Filters.GetEnumerator() | % { Expand-FilterParam $_.Key $_.Value }) -Join ",`n`n"

Contrib/New-GetCmdlets.ps1

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# Format: @(<cmdlet name>, <resource type>, <documentation label>,
66
# <optional hashtable of parameter names to a hashtable of filter name to parameter label>
7-
# )
7+
# ), <optional boolean that indicates arguments instead of filters>
88

99
@(
1010
@("CSAction", "csaction", "content switching action",
@@ -156,13 +156,19 @@
156156
[ordered]@{
157157
"FileLocation" = @("filelocation", "file location")
158158
"Filename" = @("filename", "file name")
159-
}
160-
)
159+
}, $True
160+
)
161+
# The following Get cmdlet has been modified after generation!
162+
#@("VirtualServerCertificateBinding", "sslvserver_sslcertkey_binding", "virtual server certificate-key pair binding"
163+
# [ordered]@{}
164+
#)
165+
161166
#@("LBVirtualServerResponderPolicyBinding", "lbvserver_responderpolicy_binding", "load balancer server responder policy binding"),
162167
#@("LBVirtualServerRewritePolicyBinding", "lbvserver_rewritepolicy_binding", "load balancer server rewrite policy binding")
163-
) | % {
164-
echo "Get-NS$($_[0]) | Measure"
165-
Contrib\New-GetCmdlet -Name $_[0] -Type $_[1] -Label $_[2] -Filters $_[3]
168+
) | % {
169+
$Name, $Type, $Label, $Filters, $Arguments = $_
170+
echo "Get-NS$($Name) | Measure -Count"
171+
Contrib\New-GetCmdlet -Name $Name -Type $Type -Label $Label -Filters $Filters -Arguments:$Arguments
166172
}
167173

168174

NetScaler/NetScaler.psd1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = 'NetScaler.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.3.0'
15+
ModuleVersion = '1.4.0'
1616

1717
# ID used to uniquely identify this module
1818
GUID = 'bd4390dc-a8ad-4bce-8d69-f53ccf8e4163'
@@ -21,7 +21,7 @@ GUID = 'bd4390dc-a8ad-4bce-8d69-f53ccf8e4163'
2121
Author = 'Brandon Olin'
2222

2323
# Company or vendor of this module
24-
CompanyName = 'Unknown'
24+
CompanyName = 'Community'
2525

2626
# Copyright statement for this module
2727
Copyright = '(c) 2015 Brandon Olin. All rights reserved.'
@@ -75,6 +75,7 @@ FunctionsToExport = @(
7575
'Add-NSLBServiceGroupMonitorBinding',
7676
'Add-NSLBSSLVirtualServerCertificateBinding',
7777
'Add-NSLBVirtualServerBinding',
78+
'Add-NSLBVirtualServerResponderPolicyBinding',
7879
'Add-NSLBVirtualServerRewritePolicyBinding',
7980
'Add-NSRSAKey',
8081
'Add-NSServerCertificate',
@@ -100,6 +101,7 @@ FunctionsToExport = @(
100101
'Get-NSAAAUserBinding',
101102
'Get-NSAAAVirtualServer',
102103
'Get-NSAvailableTimeZone',
104+
'Get-NSBackup',
103105
'Get-NSConfig',
104106
'Get-NSCSAction',
105107
'Get-NSCSPolicy',
@@ -123,13 +125,15 @@ FunctionsToExport = @(
123125
'Get-NSLBStat',
124126
'Get-NSLBVirtualServer',
125127
'Get-NSLBVirtualServerBinding',
128+
'Get-NSLBVirtualServerResponderPolicyBinding',
126129
'Get-NSLBVirtualServerRewritePolicyBinding',
127130
'Get-NSLDAPAuthenticationPolicy',
128131
'Get-NSLDAPAuthenticationServer',
129132
'Get-NSResponderAction',
130133
'Get-NSResponderPolicy',
131134
'Get-NSRewriteAction',
132135
'Get-NSRewritePolicy',
136+
'Get-NSStat',
133137
'Get-NSMode',
134138
'Get-NSNTPServer',
135139
'Get-NSSAMLAuthenticationPolicy',
@@ -148,6 +152,7 @@ FunctionsToExport = @(
148152
'Get-NSVPNVirtualServerTheme',
149153
'Install-NSLicense',
150154
'Invoke-Nitro',
155+
'New-NSBackup',
151156
'New-NSCSVirtualServer',
152157
'New-NSKCDAccount',
153158
'New-NSLBMonitor',
@@ -160,11 +165,13 @@ FunctionsToExport = @(
160165
'New-NSLDAPAuthenticationServer',
161166
'New-NSNTPServer',
162167
'New-NSResponderAction',
168+
'New-NSResponderPolicy',
163169
'New-NSNTPServer',
164170
'New-NSSSLProfile',
165171
'New-NSVPNSessionPolicy',
166172
'New-NSVPNSessionProfile',
167173
'New-NSVPNVirtualServer',
174+
'Remove-NSBackup',
168175
'Remove-NSDnsSuffix',
169176
'Remove-NSLBMonitor',
170177
'Remove-NSLBServer',

NetScaler/Private/_InvokeNSRestApiGet.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@ function _InvokeNSRestApiGet {
1818
.PARAMETER Filters
1919
A Hashtable of search filter values.
2020
21+
.PARAMETER Arguments
22+
A Hashtable of arguments values.
23+
2124
.EXAMPLE
22-
TODO
25+
_InvokeNSRestApiGet -Session $Session -Type csaction -Name "ACT-rewrite-host"
2326
27+
Retrieves the csaction named 'ACT-rewrite-host'.
28+
2429
.OUTPUTS
2530
PSCustomObject that represents the JSON response content. This object can be manipulated using the ConvertTo-Json Cmdlet.
2631
#>
@@ -33,8 +38,10 @@ function _InvokeNSRestApiGet {
3338
[string[]]$Name = @(),
3439

3540
[string]$Type,
36-
37-
[Hashtable]$Filters = @{}
41+
42+
[Hashtable]$Filters = @{},
43+
44+
[Hashtable]$Arguments = @{}
3845
)
3946

4047
if ($Name.Count -gt 0) {
@@ -46,7 +53,7 @@ function _InvokeNSRestApiGet {
4653
}
4754
}
4855
} else {
49-
$response = _InvokeNSRestApi -Session $Session -Method Get -Type $Type -Action Get -Filters $Filters
56+
$response = _InvokeNSRestApi -Session $Session -Method Get -Type $Type -Action Get -Filters $Filters -Arguments $Arguments
5057
if ($response.errorcode -ne 0) { throw $response }
5158
if ($Response.psobject.properties.name -contains $Type) {
5259
$response.$Type

NetScaler/Public/Add-NSLBVirtualServerBinding.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function Add-NSLBVirtualServerBinding {
6161
Suppress confirmation when binding the service group to the virtual server.
6262
6363
.PARAMETER Passthru
64-
Return the load balancer server object.
64+
Return the binding object.
6565
#>
6666
[cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact='Medium', DefaultParameterSetName='servicegroup')]
6767
param(
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<#
2+
Copyright 2015 Brandon Olin
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
#>
16+
17+
function Add-NSLBVirtualServerResponderPolicyBinding {
18+
<#
19+
.SYNOPSIS
20+
Adds a new load balancer responder policy binding.
21+
22+
.DESCRIPTION
23+
Adds a new load balancer responder policy binding.
24+
25+
.EXAMPLE
26+
Add-NSLBVirtualServerResponderPolicyBinding -VirtualServerName 'vserver01' -PolicyName 'pol01' -Bindpoint 'RESPONSE' -Priority '100'
27+
28+
Bind the policy 'pol01' as a response policy with a priority of 100 to virtual server 'vserver01'.
29+
30+
.PARAMETER Session
31+
The NetScaler session object.
32+
33+
.PARAMETER VirtualServerName
34+
Name for the virtual server. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain
35+
only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at sign (@), equal sign (=),
36+
and hyphen (-) characters. Can be changed after the virtual server is created.
37+
38+
Minimum length = 1
39+
40+
.PARAMETER PolicyName
41+
Name of the policy bound to the LB vserver.
42+
43+
.PARAMETER Bindpoint
44+
The bindpoint to which the policy is bound.
45+
Possible values = REQUEST, RESPONSE
46+
47+
.PARAMETER Priority
48+
Policy priority.
49+
50+
.PARAMETER Passthru
51+
Return the load balancer server object.
52+
#>
53+
[cmdletbinding(SupportsShouldProcess = $true, ConfirmImpact='Medium')]
54+
param(
55+
$Session = $script:session,
56+
57+
[parameter(Mandatory=$True)]
58+
[string]
59+
$VirtualServerName = (Read-Host -Prompt 'LB virtual server name'),
60+
61+
[parameter(Mandatory=$True)]
62+
[string]
63+
$PolicyName,
64+
65+
[parameter(Mandatory=$True)]
66+
[ValidateSet('REQUEST', 'RESPONSE')]
67+
[string]
68+
$Bindpoint,
69+
70+
[parameter(Mandatory=$True)]
71+
[ValidateRange(1, 2147483647)]
72+
[int]
73+
$Priority,
74+
75+
[Switch]$PassThru
76+
)
77+
78+
begin {
79+
_AssertSessionActive
80+
}
81+
82+
process {
83+
if ($PSCmdlet.ShouldProcess($VirtualServerName, 'Add Virtual Server Binding')) {
84+
try {
85+
86+
$params = @{
87+
name = $VirtualServerName
88+
policyname = $PolicyName
89+
bindpoint = $Bindpoint
90+
priority = $Priority
91+
}
92+
93+
_InvokeNSRestApi -Session $Session -Method PUT -Type lbvserver_responderpolicy_binding -Payload $params
94+
95+
if ($PSBoundParameters.ContainsKey('PassThru')) {
96+
return Get-NSLBVirtualServerResponderPolicyBinding -Session $Session -Name $VirtualServerName
97+
}
98+
} catch {
99+
throw $_
100+
}
101+
}
102+
}
103+
}

NetScaler/Public/Get-NSBackup.ps1

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<#
2+
Copyright 2015 Brandon Olin
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
#>
16+
17+
function Get-NSBackup {
18+
<#
19+
.SYNOPSIS
20+
Gets the specified NetScaler backup object.
21+
22+
.DESCRIPTION
23+
Gets the specified NetScaler backup object.
24+
25+
.EXAMPLE
26+
Get-NSBackup | Format-Table
27+
28+
Get all backup objects.
29+
.EXAMPLE
30+
Get-NSBackup -Name 'test.tgz'
31+
32+
Get the backup object 'test.tgz'.
33+
.PARAMETER Session
34+
The NetScaler session object.
35+
36+
.PARAMETER Name
37+
The name or names of the backup objects to get.
38+
#>
39+
[cmdletbinding()]
40+
param(
41+
$Session = $script:session,
42+
43+
[parameter(ValueFromPipeline = $true, Position = 0, ValueFromPipelineByPropertyName)]
44+
[Alias('Filename')]
45+
[string[]]$Name = @()
46+
)
47+
48+
begin {
49+
_AssertSessionActive
50+
$response = @()
51+
}
52+
53+
process {
54+
if ($Name.Count -gt 0) {
55+
foreach ($item in $Name) {
56+
$response = _InvokeNSRestApi -Session $Session -Method Get -Type systembackup -Resource $item -Action Get
57+
if ($response.errorcode -ne 0) { throw $response }
58+
if ($Response.psobject.properties.name -contains 'systembackup') {
59+
$response.systembackup
60+
}
61+
}
62+
} else {
63+
$response = _InvokeNSRestApi -Session $Session -Method Get -Type systembackup -Action Get
64+
if ($response.errorcode -ne 0) { throw $response }
65+
if ($Response.psobject.properties.name -contains 'systembackup') {
66+
$response.systembackup
67+
}
68+
}
69+
}
70+
}

NetScaler/Public/Get-NSLBStat.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ function Get-NSLBStat {
4949
begin {
5050
_AssertSessionActive
5151
$stats = @()
52+
53+
Write-Warning -Message 'This function is deprecated in favor of Get-NSStat and will be removed in a future major release. Please use Get-NSStat -Type <typename> instead.'
5254
}
5355

5456
process {

0 commit comments

Comments
 (0)