Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
!Deploy!
Browse files Browse the repository at this point in the history
  • Loading branch information
DamagedDingo committed May 27, 2021
1 parent 7d4d2c4 commit dd3638e
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 62 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Format as below (Requires the '### Added' as a header or task fails)
...- Update ReadMe.MD

## [Unreleased]
### Added
- Bug fix

## [1.1] - 2021-05-27
### Added
Expand Down
30 changes: 29 additions & 1 deletion JSM.Insight/Public/Get-InsightCreds.ps1
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"
}
}
29 changes: 28 additions & 1 deletion JSM.Insight/Public/Get-WorkspaceID.ps1
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"
}
}
31 changes: 0 additions & 31 deletions JSM.Insight/Public/Set-InsightCreds.ps1

This file was deleted.

29 changes: 0 additions & 29 deletions JSM.Insight/Public/Set-WorkspaceID.ps1

This file was deleted.

0 comments on commit dd3638e

Please sign in to comment.