Skip to content

Commit e29ebfe

Browse files
committed
2 parents 491b579 + 90db205 commit e29ebfe

8 files changed

+224
-25
lines changed

ITGlueAPI/ITGlueAPI.psd1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ NestedModules = 'Internal/BaseURI.ps1',
8080
'Resources/Contacts.ps1',
8181
'Resources/ContactTypes.ps1',
8282
'Resources/Countries.ps1',
83-
'Resources/Expirations.ps1',
83+
'Resources/Documents.ps1',
8484
'Resources/Domains.ps1',
85+
'Resources/Expirations.ps1',
8586
'Resources/FlexibleAssetFields.ps1',
8687
'Resources/FlexibleAssets.ps1',
8788
'Resources/FlexibleAssetTypes.ps1',
@@ -145,9 +146,11 @@ FunctionsToExport = 'Add-ITGlueAPIKey',
145146

146147
'Get-ITGlueCountries',
147148

148-
'Get-ITGlueExpirations',
149+
'Set-ITGlueDocuments',
149150

150151
'Get-ITGlueDomains',
152+
153+
'Get-ITGlueExpirations',
151154

152155
'New-ITGlueFlexibleAssetFields',
153156
'Get-ITGlueFlexibleAssetFields',

ITGlueAPI/Resources/Configurations.ps1

Lines changed: 126 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,52 +40,103 @@ function Get-ITGlueConfigurations {
4040
[Nullable[Int64]]$id,
4141

4242
[Parameter(ParameterSetName = 'index')]
43+
[Parameter(ParameterSetName = 'index_rmm')]
44+
[Parameter(ParameterSetName = 'index_psa')]
45+
[Parameter(ParameterSetName = 'index_rmm_psa')]
4346
[Parameter(ParameterSetName = 'show')]
4447
[Nullable[Int64]]$organization_id = $null,
4548

4649
[Parameter(ParameterSetName = 'index')]
50+
[Parameter(ParameterSetName = 'index_rmm')]
51+
[Parameter(ParameterSetName = 'index_psa')]
52+
[Parameter(ParameterSetName = 'index_rmm_psa')]
4753
[Nullable[Int64]]$filter_id = '',
4854

4955
[Parameter(ParameterSetName = 'index')]
56+
[Parameter(ParameterSetName = 'index_rmm')]
57+
[Parameter(ParameterSetName = 'index_psa')]
58+
[Parameter(ParameterSetName = 'index_rmm_psa')]
5059
[String]$filter_name = '',
5160

5261
[Parameter(ParameterSetName = 'index')]
62+
[Parameter(ParameterSetName = 'index_rmm')]
63+
[Parameter(ParameterSetName = 'index_psa')]
64+
[Parameter(ParameterSetName = 'index_rmm_psa')]
5365
[Nullable[Int64]]$filter_organization_id = $null,
5466

5567
[Parameter(ParameterSetName = 'index')]
68+
[Parameter(ParameterSetName = 'index_rmm')]
69+
[Parameter(ParameterSetName = 'index_psa')]
70+
[Parameter(ParameterSetName = 'index_rmm_psa')]
5671
[Nullable[Int64]]$filter_configuration_type_id = $null,
5772

5873
[Parameter(ParameterSetName = 'index')]
74+
[Parameter(ParameterSetName = 'index_rmm')]
75+
[Parameter(ParameterSetName = 'index_psa')]
76+
[Parameter(ParameterSetName = 'index_rmm_psa')]
5977
[Nullable[Int64]]$filter_configuration_status_id = $null,
6078

6179
[Parameter(ParameterSetName = 'index')]
80+
[Parameter(ParameterSetName = 'index_rmm')]
81+
[Parameter(ParameterSetName = 'index_psa')]
82+
[Parameter(ParameterSetName = 'index_rmm_psa')]
6283
[Nullable[Int64]]$filter_contact_id = $null,
6384

6485
[Parameter(ParameterSetName = 'index')]
86+
[Parameter(ParameterSetName = 'index_rmm')]
87+
[Parameter(ParameterSetName = 'index_psa')]
88+
[Parameter(ParameterSetName = 'index_rmm_psa')]
6589
[String]$filter_serial_number = '',
6690

91+
[Parameter(ParameterSetName = 'index_psa')]
92+
[Parameter(ParameterSetName = 'index_rmm_psa')]
93+
[String]$filter_psa_id = '',
94+
6795
[Parameter(ParameterSetName = 'index')]
96+
[Parameter(ParameterSetName = 'index_rmm')]
97+
[Parameter(ParameterSetName = 'index_psa', Mandatory = $true)]
98+
[Parameter(ParameterSetName = 'index_rmm_psa', Mandatory = $true)]
99+
[ValidateSet('manage', 'autotask', 'tigerpaw', 'kaseya-bms', 'pulseway-psa', 'vorex')]
100+
[String]$filter_psa_integration_type = '',
101+
102+
[Parameter(ParameterSetName = 'index_rmm')]
103+
[Parameter(ParameterSetName = 'index_rmm_psa')]
68104
[String]$filter_rmm_id = '',
69105

70106
[Parameter(ParameterSetName = 'index')]
71-
[ValidateSet('addigy', 'aem', 'atera', 'managed-workplace', `
72-
'continuum', 'jamf-pro', 'kaseya-vsa', 'automate', `
73-
'msp-rmm', 'msp-n-central', 'ninja-rmm', 'panorama9', `
74-
'pulseway-rmm', 'watchman-monitoring')]
107+
[Parameter(ParameterSetName = 'index_rmm', Mandatory = $true)]
108+
[Parameter(ParameterSetName = 'index_psa')]
109+
[Parameter(ParameterSetName = 'index_rmm_psa', Mandatory = $true)]
110+
[ValidateSet('addigy', 'aem', 'atera', 'auvik', 'managed-workplace', `
111+
'continuum', 'jamf-pro', 'kaseya-vsa', 'automate', 'log-me-in',`
112+
'msp-rmm', 'meraki', 'msp-n-central', 'ninja-rmm', 'panorama9', `
113+
'pulseway-rmm', 'syncro', 'watchman-monitoring')]
75114
[String]$filter_rmm_integration_type = '',
76115

77116
[Parameter(ParameterSetName = 'index')]
117+
[Parameter(ParameterSetName = 'index_rmm')]
118+
[Parameter(ParameterSetName = 'index_psa')]
119+
[Parameter(ParameterSetName = 'index_rmm_psa')]
78120
[ValidateSet('name', 'id', 'created_at', 'updated-at', `
79121
'-name', '-id', '-created_at', '-updated-at')]
80122
[String]$sort = '',
81123

82124
[Parameter(ParameterSetName = 'index')]
125+
[Parameter(ParameterSetName = 'index_rmm')]
126+
[Parameter(ParameterSetName = 'index_psa')]
127+
[Parameter(ParameterSetName = 'index_rmm_psa')]
83128
[Nullable[Int64]]$page_number = $null,
84129

85130
[Parameter(ParameterSetName = 'index')]
131+
[Parameter(ParameterSetName = 'index_rmm')]
132+
[Parameter(ParameterSetName = 'index_psa')]
133+
[Parameter(ParameterSetName = 'index_rmm_psa')]
86134
[Nullable[int]]$page_size = $null,
87135

88136
[Parameter(ParameterSetName = 'index')]
137+
[Parameter(ParameterSetName = 'index_rmm')]
138+
[Parameter(ParameterSetName = 'index_psa')]
139+
[Parameter(ParameterSetName = 'index_rmm_psa')]
89140
[Parameter(ParameterSetName = 'show')]
90141
[String]$include = ''
91142
)
@@ -100,7 +151,10 @@ function Get-ITGlueConfigurations {
100151

101152
$body = @{}
102153

103-
if ($PSCmdlet.ParameterSetName -eq 'index') {
154+
if (($PSCmdlet.ParameterSetName -eq 'index') -or `
155+
($PSCmdlet.ParameterSetName -eq 'index_rmm') -or `
156+
($PSCmdlet.ParameterSetName -eq 'index_psa') -or `
157+
($PSCmdlet.ParameterSetName -eq 'index_rmm_psa')) {
104158
if ($filter_id) {
105159
$body += @{'filter[id]' = $filter_id}
106160
}
@@ -122,12 +176,12 @@ function Get-ITGlueConfigurations {
122176
if ($filter_serial_number) {
123177
$body += @{'filter[serial_number]' = $filter_serial_number}
124178
}
125-
if ($filter_rmm_id) {
126-
$body += @{'filter[rmm_id]' = $filter_rmm_id}
127-
}
128179
if ($filter_rmm_integration_type) {
129180
$body += @{'filter[rmm_integration_type]' = $filter_rmm_integration_type}
130181
}
182+
if ($filter_psa_integration_type) {
183+
$body += @{'filter[psa_integration_type]' = $filter_psa_integration_type}
184+
}
131185
if ($sort) {
132186
$body += @{'sort' = $sort}
133187
}
@@ -138,6 +192,12 @@ function Get-ITGlueConfigurations {
138192
$body += @{'page[size]' = $page_size}
139193
}
140194
}
195+
if (($PSCmdlet.ParameterSetName -eq 'index_rmm') -or ($PSCmdlet.ParameterSetName -eq 'index_rmm_psa')) {
196+
$body += @{'filter[rmm_id]' = $filter_rmm_id}
197+
}
198+
if (($PSCmdlet.ParameterSetName -eq 'index_psa') -or ($PSCmdlet.ParameterSetName -eq 'index_rmm_psa')) {
199+
$body += @{'filter[psa_id]' = $filter_psa_id}
200+
}
141201

142202
if($include) {
143203
$body += @{'include' = $include}
@@ -168,38 +228,78 @@ function Set-ITGlueConfigurations {
168228
[Nullable[Int64]]$organization_id = $null,
169229

170230
[Parameter(ParameterSetName = 'bulk_update')]
231+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
232+
[Parameter(ParameterSetName = 'bulk_update_psa')]
233+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
171234
[Nullable[Int64]]$filter_id = $null,
172235

173236
[Parameter(ParameterSetName = 'bulk_update')]
237+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
238+
[Parameter(ParameterSetName = 'bulk_update_psa')]
239+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
174240
[String]$filter_name = '',
175241

176242
[Parameter(ParameterSetName = 'bulk_update')]
243+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
244+
[Parameter(ParameterSetName = 'bulk_update_psa')]
245+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
177246
[Nullable[Int64]]$filter_organization_id = $null,
178247

179248
[Parameter(ParameterSetName = 'bulk_update')]
249+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
250+
[Parameter(ParameterSetName = 'bulk_update_psa')]
251+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
180252
[Nullable[Int64]]$filter_configuration_type_id = $null,
181253

182254
[Parameter(ParameterSetName = 'bulk_update')]
255+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
256+
[Parameter(ParameterSetName = 'bulk_update_psa')]
257+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
183258
[Nullable[Int64]]$filter_configuration_status_id = $null,
184259

185260
[Parameter(ParameterSetName = 'bulk_update')]
261+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
262+
[Parameter(ParameterSetName = 'bulk_update_psa')]
263+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
186264
[Nullable[Int64]]$filter_contact_id = $null,
187265

188266
[Parameter(ParameterSetName = 'bulk_update')]
267+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
268+
[Parameter(ParameterSetName = 'bulk_update_psa')]
269+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
189270
[String]$filter_serial_number = '',
190271

272+
273+
[Parameter(ParameterSetName = 'bulk_update_psa')]
274+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
275+
[String]$filter_psa_id = '',
276+
191277
[Parameter(ParameterSetName = 'bulk_update')]
278+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
279+
[Parameter(ParameterSetName = 'bulk_update_psa', Mandatory = $true)]
280+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa', Mandatory = $true)]
281+
[ValidateSet('manage', 'autotask', 'tigerpaw', 'kaseya-bms', 'pulseway-psa', 'vorex')]
282+
[String]$filter_psa_integration_type = '',
283+
284+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
285+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
192286
[String]$filter_rmm_id = '',
193287

194288
[Parameter(ParameterSetName = 'bulk_update')]
195-
[ValidateSet('addigy', 'aem', 'atera', 'managed-workplace', `
196-
'continuum', 'jamf-pro', 'kaseya-vsa', 'automate', `
197-
'msp-rmm', 'msp-n-central', 'ninja-rmm', 'panorama9', `
198-
'pulseway-rmm', 'watchman-monitoring')]
289+
[Parameter(ParameterSetName = 'bulk_update_rmm', Mandatory = $true)]
290+
[Parameter(ParameterSetName = 'bulk_update_psa')]
291+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa', Mandatory = $true)]
292+
[ValidateSet('addigy', 'aem', 'atera', 'auvik', 'managed-workplace', `
293+
'continuum', 'jamf-pro', 'kaseya-vsa', 'automate', 'log-me-in',`
294+
'msp-rmm', 'meraki', 'msp-n-central', 'ninja-rmm', 'panorama9', `
295+
'pulseway-rmm', 'syncro', 'watchman-monitoring')]
199296
[String]$filter_rmm_integration_type = '',
200297

201298
[Parameter(ParameterSetName = 'update')]
202299
[Parameter(ParameterSetName = 'bulk_update')]
300+
[Parameter(ParameterSetName = 'bulk_update_rmm')]
301+
[Parameter(ParameterSetName = 'bulk_update_psa')]
302+
[Parameter(ParameterSetName = 'bulk_update_rmm_psa')]
203303
[Parameter(Mandatory = $true)]
204304
$data
205305
)
@@ -212,7 +312,10 @@ function Set-ITGlueConfigurations {
212312

213313
$body = @{}
214314

215-
if ($PSCmdlet.ParameterSetName -eq 'bulk_update') {
315+
if (($PSCmdlet.ParameterSetName -eq 'bulk_update') -or `
316+
($PSCmdlet.ParameterSetName -eq 'bulk_update_rmm') -or `
317+
($PSCmdlet.ParameterSetName -eq 'bulk_update_psa') -or `
318+
($PSCmdlet.ParameterSetName -eq 'bulk_update_rmm_psa')) {
216319
if ($filter_id) {
217320
$body += @{'filter[id]' = $filter_id}
218321
}
@@ -241,6 +344,12 @@ function Set-ITGlueConfigurations {
241344
$body += @{'filter[rmm_integration_type]' = $filter_rmm_integration_type}
242345
}
243346
}
347+
if (($PSCmdlet.ParameterSetName -eq 'bulk_update_rmm') -or ($PSCmdlet.ParameterSetName -eq 'bulk_update_rmm_psa')) {
348+
$body += @{'filter[rmm_id]' = $filter_rmm_id}
349+
}
350+
if (($PSCmdlet.ParameterSetName -eq 'bulk_update_psa') -or ($PSCmdlet.ParameterSetName -eq 'bulk_update_rmm_psa')) {
351+
$body += @{'filter[psa_id]' = $filter_psa_id}
352+
}
244353

245354
$body += @{'data' = $data}
246355

@@ -292,10 +401,10 @@ function Remove-ITGlueConfigurations {
292401
[String]$filter_rmm_id = '',
293402

294403
[Parameter(ParameterSetName = 'bulk_delete')]
295-
[ValidateSet('addigy', 'aem', 'atera', 'managed-workplace', `
296-
'continuum', 'jamf-pro', 'kaseya-vsa', 'automate', `
297-
'msp-rmm', 'msp-n-central', 'ninja-rmm', 'panorama9', `
298-
'pulseway-rmm', 'watchman-monitoring')]
404+
[ValidateSet('addigy', 'aem', 'atera', 'auvik', 'managed-workplace', `
405+
'continuum', 'jamf-pro', 'kaseya-vsa', 'automate', 'log-me-in',`
406+
'msp-rmm', 'meraki', 'msp-n-central', 'ninja-rmm', 'panorama9', `
407+
'pulseway-rmm', 'syncro', 'watchman-monitoring')]
299408
[String]$filter_rmm_integration_type = '',
300409

301410
[Parameter(ParameterSetName = 'bulk_delete', Mandatory = $true)]

ITGlueAPI/Resources/Contacts.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ function Get-ITGlueContacts {
7070
[String]$filter_primary_email = '',
7171

7272
[Parameter(ParameterSetName = 'index')]
73-
[Parameter(ParameterSetName = 'index_psa')]
73+
[Parameter(ParameterSetName = 'index_psa', Mandatory = $true)]
7474
[ValidateSet('manage', 'autotask', 'tigerpaw', 'kaseya-bms', 'pulseway-psa', 'vorex')]
7575
[String]$filter_psa_integration_type = '',
7676

77-
[Parameter(ParameterSetName = 'psa_id', Mandatory=$true)]
77+
[Parameter(ParameterSetName = 'index_psa')]
7878
[String]$filter_psa_id = '',
7979

8080
[Parameter(ParameterSetName = 'index')]

ITGlueAPI/Resources/Documents.ps1

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
function Set-ITGlueDocuments {
2+
[CmdletBinding(DefaultParameterSetName = 'update')]
3+
Param (
4+
[Parameter(ParameterSetName = 'update')]
5+
[int64]$organization_id,
6+
7+
[Parameter(ParameterSetName = 'update')]
8+
[Parameter(Mandatory = $true)]
9+
[int64]$id,
10+
11+
[Parameter(ParameterSetName = 'update')]
12+
[Parameter(ParameterSetName = 'bulk_update')]
13+
[Parameter(Mandatory = $true)]
14+
$data
15+
)
16+
17+
$resource_uri = ('/documents/{0}' -f $id)
18+
if ($organization_id) {
19+
$resource_uri = ('/organizations/{0}/relationships/documents/{1}' -f $organization_id, $id)
20+
}
21+
22+
$body = @{}
23+
24+
$body += @{'data' = $data}
25+
26+
$body = ConvertTo-Json -InputObject $body -Depth $ITGlue_JSON_Conversion_Depth
27+
28+
try {
29+
$ITGlue_Headers.Add('x-api-key', (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'N/A', $ITGlue_API_Key).GetNetworkCredential().Password)
30+
$rest_output = Invoke-RestMethod -method 'PATCH' -uri ($ITGlue_Base_URI + $resource_uri) -headers $ITGlue_Headers `
31+
-body $body -ErrorAction Stop -ErrorVariable $web_error
32+
} catch {
33+
Write-Error $_
34+
} finally {
35+
[void] $ITGlue_Headers.Remove('x-api-key') # Quietly clean up scope so the API key doesn't persist
36+
}
37+
38+
$data = @{}
39+
$data = $rest_output
40+
return $data
41+
}

ITGlueAPI/Resources/Expirations.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ function Get-ITGlueExpirations {
3030
[String]$filter_range = '',
3131

3232
[Parameter(ParameterSetName = 'index')]
33-
[ValidateSet( 'id', 'organization_id', 'expiration_date', 'created_at', 'updated_at' `
33+
[ValidateSet( 'id', 'organization_id', 'expiration_date', 'created_at', 'updated_at', `
3434
'-id', '-organization_id', '-expiration_date', '-created_at', '-updated_at')]
35-
[String]$sort = '',
35+
[String]$sort,
3636

3737
[Parameter(ParameterSetName = 'index')]
3838
[Nullable[Int64]]$page_number = $null,
@@ -41,7 +41,7 @@ function Get-ITGlueExpirations {
4141
[Nullable[int]]$page_size = $null,
4242

4343
[Parameter(Mandatory = $true, ParameterSetName = 'show')]
44-
[Nullable[Int64]]$id,
44+
[Nullable[Int64]]$id
4545
)
4646

4747
$resource_uri = ('/expirations/{0}' -f $id)

0 commit comments

Comments
 (0)