Skip to content

Commit 4a4332a

Browse files
committed
Add -Inheritance switch to Get-IBObject to support requesting inherited values in results. (#67)
1 parent 78acd54 commit 4a4332a

File tree

3 files changed

+72
-5
lines changed

3 files changed

+72
-5
lines changed

Posh-IBWAPI/Public/Get-IBObject.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function Get-IBObject
3838
[int]$BatchGroupSize = 1000,
3939

4040
[switch]$ProxySearch,
41+
[switch]$Inheritance,
4142

4243
[ValidateScript({Test-ValidProfile $_ -ThrowOnFail})]
4344
[string]$ProfileName,
@@ -129,6 +130,12 @@ function Get-IBObject
129130
$queryargs.Add("_proxy_search=GM")
130131
}
131132

133+
# Deal with the Inheritance flag. From the WAPI docs
134+
# If this option is set to True, fields which support inheritance, will display data properly.
135+
if ($Inheritance) {
136+
$queryargs.Add('_inheritance=True')
137+
}
138+
132139
if ($BatchMode) {
133140
# create a list to save the objects in
134141
$deferredObjects = [Collections.Generic.List[PSObject]]::new()

Posh-IBWAPI/en-US/Posh-IBWAPI-help.xml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,17 @@
179179
</dev:type>
180180
<dev:defaultValue>None</dev:defaultValue>
181181
</command:parameter>
182+
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
183+
<maml:name>Inheritance</maml:name>
184+
<maml:description>
185+
<maml:para>If specified, returned fields which support inheritance will display data properly. WARNING: This may change the structure of the field's output.</maml:para>
186+
</maml:description>
187+
<dev:type>
188+
<maml:name>SwitchParameter</maml:name>
189+
<maml:uri />
190+
</dev:type>
191+
<dev:defaultValue>False</dev:defaultValue>
192+
</command:parameter>
182193
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
183194
<maml:name>ProfileName</maml:name>
184195
<maml:description>
@@ -312,6 +323,17 @@
312323
</dev:type>
313324
<dev:defaultValue>None</dev:defaultValue>
314325
</command:parameter>
326+
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
327+
<maml:name>Inheritance</maml:name>
328+
<maml:description>
329+
<maml:para>If specified, returned fields which support inheritance will display data properly. WARNING: This may change the structure of the field's output.</maml:para>
330+
</maml:description>
331+
<dev:type>
332+
<maml:name>SwitchParameter</maml:name>
333+
<maml:uri />
334+
</dev:type>
335+
<dev:defaultValue>False</dev:defaultValue>
336+
</command:parameter>
315337
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
316338
<maml:name>MaxResults</maml:name>
317339
<maml:description>
@@ -469,6 +491,17 @@
469491
</dev:type>
470492
<dev:defaultValue>None</dev:defaultValue>
471493
</command:parameter>
494+
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
495+
<maml:name>Inheritance</maml:name>
496+
<maml:description>
497+
<maml:para>If specified, returned fields which support inheritance will display data properly. WARNING: This may change the structure of the field's output.</maml:para>
498+
</maml:description>
499+
<dev:type>
500+
<maml:name>SwitchParameter</maml:name>
501+
<maml:uri />
502+
</dev:type>
503+
<dev:defaultValue>False</dev:defaultValue>
504+
</command:parameter>
472505
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
473506
<maml:name>NoPaging</maml:name>
474507
<maml:description>
@@ -625,6 +658,18 @@
625658
</dev:type>
626659
<dev:defaultValue>None</dev:defaultValue>
627660
</command:parameter>
661+
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
662+
<maml:name>Inheritance</maml:name>
663+
<maml:description>
664+
<maml:para>If specified, returned fields which support inheritance will display data properly. WARNING: This may change the structure of the field's output.</maml:para>
665+
</maml:description>
666+
<command:parameterValue required="false" variableLength="false">SwitchParameter</command:parameterValue>
667+
<dev:type>
668+
<maml:name>SwitchParameter</maml:name>
669+
<maml:uri />
670+
</dev:type>
671+
<dev:defaultValue>False</dev:defaultValue>
672+
</command:parameter>
628673
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
629674
<maml:name>MaxResults</maml:name>
630675
<maml:description>

docs/Functions/Get-IBObject.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ Retrieve objects from the Infoblox database.
1616
### ByType (Default)
1717
```powershell
1818
Get-IBObject [-ObjectType] <String> [-Filter <Object>] [-MaxResults <Int32>] [-PageSize <Int32>]
19-
[-ReturnField <String[]>] [-ReturnBase] [-ReturnAll] [-ProxySearch] [-ProfileName <String>]
19+
[-ReturnField <String[]>] [-ReturnBase] [-ReturnAll] [-ProxySearch] [-Inheritance] [-ProfileName <String>]
2020
[-WAPIHost <String>] [-WAPIVersion <String>] [-Credential <PSCredential>] [-SkipCertificateCheck]
2121
[<CommonParameters>]
2222
```
2323

2424
### ByTypeNoPaging
2525
```powershell
2626
Get-IBObject [-ObjectType] <String> [-Filter <Object>] [-NoPaging] [-ReturnField <String[]>] [-ReturnBase]
27-
[-ReturnAll] [-ProxySearch] [-ProfileName <String>] [-WAPIHost <String>] [-WAPIVersion <String>]
28-
[-Credential <PSCredential>] [-SkipCertificateCheck] [<CommonParameters>]
27+
[-ReturnAll] [-ProxySearch] [-Inheritance] [-ProfileName <String>] [-WAPIHost <String>]
28+
[-WAPIVersion <String>] [-Credential <PSCredential>] [-SkipCertificateCheck] [<CommonParameters>]
2929
```
3030

3131
### ByRef
3232
```powershell
3333
Get-IBObject [-ObjectRef] <String> [-ReturnField <String[]>] [-ReturnBase] [-ReturnAll] [-BatchMode]
34-
[-BatchGroupSize <Int32>] [-ProxySearch] [-ProfileName <String>] [-WAPIHost <String>] [-WAPIVersion <String>]
35-
[-Credential <PSCredential>] [-SkipCertificateCheck] [<CommonParameters>]
34+
[-BatchGroupSize <Int32>] [-ProxySearch] [-Inheritance] [-ProfileName <String>] [-WAPIHost <String>]
35+
[-WAPIVersion <String>] [-Credential <PSCredential>] [-SkipCertificateCheck] [<CommonParameters>]
3636
```
3737

3838
## Description
@@ -141,6 +141,21 @@ Accept pipeline input: False
141141
Accept wildcard characters: False
142142
```
143143

144+
### -Inheritance
145+
If specified, returned fields which support inheritance will display data properly. WARNING: This may change the structure of the field's output.
146+
147+
```yaml
148+
Type: SwitchParameter
149+
Parameter Sets: (All)
150+
Aliases:
151+
152+
Required: False
153+
Position: Named
154+
Default value: None
155+
Accept pipeline input: False
156+
Accept wildcard characters: False
157+
```
158+
144159
### -MaxResults
145160
If set to a positive number, the results list will be truncated to that number if necessary. If set to a negative number and the results would exceed the absolute value, an error is thrown.
146161

0 commit comments

Comments
 (0)