This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d4d2c4
commit dd3638e
Showing
5 changed files
with
59 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,31 @@ | ||
Function Get-InsightCreds { | ||
$script:InsightCreds | ||
[CmdletBinding()] | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseShouldProcessForStateChangingFunctions', '')] | ||
param( | ||
[Parameter( Mandatory )] | ||
[ValidateNotNullOrEmpty()] | ||
[Alias('user')] | ||
[string]$Username, | ||
[Parameter( Mandatory )] | ||
[ValidateNotNullOrEmpty()] | ||
[Alias('pass')] | ||
[string]$Password | ||
) | ||
|
||
begin { | ||
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started" | ||
} | ||
|
||
process { | ||
#Encode Creds | ||
$auth = $username + ':' + $password | ||
$Encoded = [System.Text.Encoding]::UTF8.GetBytes($auth) | ||
$authorizationInfo = [System.Convert]::ToBase64String($Encoded) | ||
$Script:InsightCreds = $authorizationInfo | ||
} | ||
|
||
end { | ||
$authorizationInfo | ||
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,30 @@ | ||
|
||
function Get-WorkspaceID { | ||
$script:InsightWorkstationID | ||
param ( | ||
[cmdletbinding()] | ||
[uri]$InsightServerUrl, | ||
[string]$InsightCreds = $InsightCreds | ||
) | ||
|
||
begin { | ||
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function started" | ||
$Headers = New-Headers -ExperimentalApi | ||
} | ||
|
||
process { | ||
$Request = [System.UriBuilder]"$InsightServerUrl/rest/servicedeskapi/insight/workspace" | ||
} | ||
|
||
end { | ||
try { | ||
$response = Invoke-RestMethod -Uri $Request.Uri -Headers $headers -Method GET | ||
} | ||
catch { | ||
Write-Error -Message "$($_.Exception.Message)" -ErrorId $_.Exception.Code -Category InvalidOperation | ||
} | ||
$script:InsightWorkstationID = $response.values.workspaceId | ||
$response.values.workspaceId | ||
|
||
Write-Verbose "[$($MyInvocation.MyCommand.Name)] Complete" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.