Public/SecureVariables.ps1
Function Remove-NmeSecureVariable { <# .SYNOPSIS Delete secure variable. .DESCRIPTION Delete secure variable. This function calls the /api/v1/secure-variable endpoint of the NME REST API, using the delete method. .PARAMETER NmeDeleteSecureVariableRestPayload Requires an NmeDeleteSecureVariableRestPayload object, as generated by the New-NmeDeleteSecureVariableRestPayload command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeDeleteSecureVariableRestPayload"){$true} else{throw " is not a NmeDeleteSecureVariableRestPayload object."}})]$NmeDeleteSecureVariableRestPayload ) Set-NmeAuthHeaders Try { $json = $NmeDeleteSecureVariableRestPayload | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/secure-variable$QueryString" -Method delete -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeSecureVariable { <# .SYNOPSIS Get secure variables. .DESCRIPTION Get secure variables. This function calls the /api/v1/secure-variable endpoint of the NME REST API, using the get method. #> [CmdletBinding()] Param( ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/secure-variable$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeSecureVariableRestModel') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Update-NmeSecureVariable { <# .SYNOPSIS Update secure variable partially. .DESCRIPTION Update secure variable partially. This function calls the /api/v1/secure-variable endpoint of the NME REST API, using the patch method. .PARAMETER NmeCreateOrUpdateSecureVariableRestPayload Requires an NmeCreateOrUpdateSecureVariableRestPayload object, as generated by the New-NmeCreateOrUpdateSecureVariableRestPayload command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeCreateOrUpdateSecureVariableRestPayload"){$true} else{throw " is not a NmeCreateOrUpdateSecureVariableRestPayload object."}})]$NmeCreateOrUpdateSecureVariableRestPayload ) Set-NmeAuthHeaders Try { $json = $NmeCreateOrUpdateSecureVariableRestPayload | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/secure-variable$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeSecureVariableRestModel') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeSecureVariable { <# .SYNOPSIS Create secure variable. .DESCRIPTION Create secure variable. This function calls the /api/v1/secure-variable endpoint of the NME REST API, using the post method. .PARAMETER NmeCreateOrUpdateSecureVariableRestPayload Requires an NmeCreateOrUpdateSecureVariableRestPayload object, as generated by the New-NmeCreateOrUpdateSecureVariableRestPayload command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeCreateOrUpdateSecureVariableRestPayload"){$true} else{throw " is not a NmeCreateOrUpdateSecureVariableRestPayload object."}})]$NmeCreateOrUpdateSecureVariableRestPayload ) Set-NmeAuthHeaders Try { $json = $NmeCreateOrUpdateSecureVariableRestPayload | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/secure-variable$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeSecureVariableRestModel') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeSecureVariable { <# .SYNOPSIS Update secure variable with new object passed. .DESCRIPTION Update secure variable with new object passed. This function calls the /api/v1/secure-variable endpoint of the NME REST API, using the put method. .PARAMETER NmeCreateOrUpdateSecureVariableRestPayload Requires an NmeCreateOrUpdateSecureVariableRestPayload object, as generated by the New-NmeCreateOrUpdateSecureVariableRestPayload command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeCreateOrUpdateSecureVariableRestPayload"){$true} else{throw " is not a NmeCreateOrUpdateSecureVariableRestPayload object."}})]$NmeCreateOrUpdateSecureVariableRestPayload ) Set-NmeAuthHeaders Try { $json = $NmeCreateOrUpdateSecureVariableRestPayload | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/secure-variable$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeSecureVariableRestModel') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } |