1
1
function New-ITGlueConfigurationInterfaces {
2
2
Param (
3
- [Nullable [Int ]]$conf_id = $null ,
3
+ [Nullable [Int64 ]]$conf_id = $null ,
4
4
5
- [Parameter (Mandatory = $true )]
5
+ [Parameter (Mandatory = $true )]
6
6
$data
7
7
)
8
8
9
- $resource_uri = " /configuration_interfaces/"
9
+ $resource_uri = ' /configuration_interfaces/'
10
10
11
- if ($conf_id ) {
12
- $resource_uri = " /configurations/${conf_id } /relationships/configuration_interfaces"
11
+ if ($conf_id ) {
12
+ $resource_uri = ( ' /configurations/{0 }/relationships/configuration_interfaces' -f $conf_id )
13
13
}
14
14
15
- $body = ConvertTo-Json $data - Depth $ITGlue_JSON_Conversion_Depth
15
+ $body = ConvertTo-Json - InputObject $data - Depth $ITGlue_JSON_Conversion_Depth
16
16
17
- $ITGlue_Headers.Add (" x-api-key" , (New-Object System.Management.Automation.PSCredential ' N/A' , $ITGlue_API_Key ).GetNetworkCredential().Password)
18
- $rest_output = Invoke-RestMethod - method " POST" - uri ($ITGlue_Base_URI + $resource_uri ) - headers $ITGlue_Headers `
19
- - body $body - ErrorAction Stop - ErrorVariable $web_error
17
+ $ITGlue_Headers.Add (' x-api-key' , (New-Object - TypeName System.Management.Automation.PSCredential - ArgumentList ' N/A' , $ITGlue_API_Key ).GetNetworkCredential().Password)
18
+ $rest_output = Invoke-RestMethod - method ' POST' - uri ($ITGlue_Base_URI + $resource_uri ) - headers $ITGlue_Headers `
19
+ - body $body - ErrorAction Stop - ErrorVariable $web_error
20
20
$ITGlue_Headers.Remove (' x-api-key' ) > $null # Quietly clean up scope so the API key doesn't persist
21
21
22
22
$data = @ {}
23
23
$data = $rest_output
24
24
return $data
25
25
}
26
26
27
-
28
-
29
-
30
27
function Get-ITGlueConfigurationInterfaces {
31
- [CmdletBinding (DefaultParametersetName = " index" )]
28
+ [CmdletBinding (DefaultParametersetName = ' index' )]
32
29
Param (
33
- [Parameter (ParameterSetName = " index" )]
34
- [Parameter (ParameterSetName = " show" )]
35
- [Nullable [Int ]]$conf_id = $null ,
30
+ [Parameter (ParameterSetName = ' index' )]
31
+ [Parameter (ParameterSetName = ' show' )]
32
+ [Nullable [Int64 ]]$conf_id = $null ,
36
33
37
- [Parameter (ParameterSetName = " index" )]
38
- [Nullable [Int ]]$page_number = $null ,
34
+ [Parameter (ParameterSetName = ' index' )]
35
+ [Nullable [Int64 ]]$page_number = $null ,
39
36
40
- [Parameter (ParameterSetName = " index" )]
37
+ [Parameter (ParameterSetName = ' index' )]
41
38
[Nullable [int ]]$page_size = $null ,
42
39
43
- [Parameter (ParameterSetName = " show" )]
44
- [Nullable [Int ]]$id = $null
40
+ [Parameter (ParameterSetName = ' show' )]
41
+ [Nullable [Int64 ]]$id = $null
45
42
)
46
43
47
- $resource_uri = " /configurations/${conf_id } /relationships/configuration_interfaces/${id} "
48
- if (($PsCmdlet.ParameterSetName -eq " show" ) -and ($conf_id -eq $null )) {
49
- $resource_uri = " /configuration_interfaces/${id} "
44
+ $resource_uri = ( ' /configurations/{0 }/relationships/configuration_interfaces/{1} ' -f $conf_id , $id )
45
+ if (($PsCmdlet.ParameterSetName -eq ' show' ) -and ($conf_id -eq $null )) {
46
+ $resource_uri = ( ' /configuration_interfaces/{0} ' -f $id )
50
47
}
51
48
52
- if ($PSCmdlet.ParameterSetName -eq " index" ) {
49
+ if ($PSCmdlet.ParameterSetName -eq ' index' ) {
53
50
$body = @ {}
54
- if ($page_number ) {
55
- $body += @ {" page[number]" = $page_number }
51
+ if ($page_number ) {
52
+ $body += @ {' page[number]' = $page_number }
56
53
}
57
- if ($page_size ) {
58
- $body += @ {" page[size]" = $page_size }
54
+ if ($page_size ) {
55
+ $body += @ {' page[size]' = $page_size }
59
56
}
60
57
}
61
58
62
59
63
- $ITGlue_Headers.Add (" x-api-key" , (New-Object System.Management.Automation.PSCredential ' N/A' , $ITGlue_API_Key ).GetNetworkCredential().Password)
64
- $rest_output = Invoke-RestMethod - method " GET" - uri ($ITGlue_Base_URI + $resource_uri ) - headers $ITGlue_Headers `
65
- - body $body - ErrorAction Stop - ErrorVariable $web_error
60
+ $ITGlue_Headers.Add (' x-api-key' , (New-Object - TypeName System.Management.Automation.PSCredential - ArgumentList ' N/A' , $ITGlue_API_Key ).GetNetworkCredential().Password)
61
+ $rest_output = Invoke-RestMethod - method ' GET' - uri ($ITGlue_Base_URI + $resource_uri ) - headers $ITGlue_Headers `
62
+ - body $body - ErrorAction Stop - ErrorVariable $web_error
66
63
$ITGlue_Headers.Remove (' x-api-key' ) > $null # Quietly clean up scope so the API key doesn't persist
67
64
68
65
$data = @ {}
69
66
$data = $rest_output
70
67
return $data
71
68
}
72
69
73
-
74
-
75
-
76
70
function Set-ITGlueConfigurationInterfaces {
77
71
Param (
78
- [Nullable [Int ]]$id ,
72
+ [Nullable [Int64 ]]$id ,
79
73
80
- [Nullable [Int ]]$conf_id = $null ,
74
+ [Nullable [Int64 ]]$conf_id = $null ,
81
75
82
- [Parameter (Mandatory = $true )]
76
+ [Parameter (Mandatory = $true )]
83
77
$data
84
78
)
85
79
86
- $resource_uri = " /configuration_interfaces/${id} "
80
+ $resource_uri = ( ' /configuration_interfaces/{0} ' -f $id )
87
81
88
- if ($conf_id ) {
89
- $resource_uri = " /configurations/${conf_id } /relationships/configuration_interfaces/${id} "
82
+ if ($conf_id ) {
83
+ $resource_uri = ( ' /configurations/{0 }/relationships/configuration_interfaces/{1} ' -f $conf_id , $id )
90
84
}
91
85
92
- $body = ConvertTo-Json $data - Depth $ITGlue_JSON_Conversion_Depth
86
+ $body = ConvertTo-Json - InputObject $data - Depth $ITGlue_JSON_Conversion_Depth
93
87
94
- $ITGlue_Headers.Add (" x-api-key" , (New-Object System.Management.Automation.PSCredential ' N/A' , $ITGlue_API_Key ).GetNetworkCredential().Password)
95
- $rest_output = Invoke-RestMethod - method " PATCH" - uri ($ITGlue_Base_URI + $resource_uri ) - headers $ITGlue_Headers `
96
- - body $body - ErrorAction Stop - ErrorVariable $web_error
88
+ $ITGlue_Headers.Add (' x-api-key' , (New-Object - TypeName System.Management.Automation.PSCredential - ArgumentList ' N/A' , $ITGlue_API_Key ).GetNetworkCredential().Password)
89
+ $rest_output = Invoke-RestMethod - method ' PATCH' - uri ($ITGlue_Base_URI + $resource_uri ) - headers $ITGlue_Headers `
90
+ - body $body - ErrorAction Stop - ErrorVariable $web_error
97
91
$ITGlue_Headers.Remove (' x-api-key' ) > $null # Quietly clean up scope so the API key doesn't persist
98
92
99
93
$data = @ {}
100
94
$data = $rest_output
101
95
return $data
102
- }
96
+ }
0 commit comments