Skip to content

Commit

Permalink
Improved Code Quality
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank-Geisler committed Nov 25, 2024
1 parent 5742d94 commit e2d99d0
Show file tree
Hide file tree
Showing 22 changed files with 141 additions and 128 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ During the development of the module and the research I do I might pass some int
- [about_Comment_Based_Help](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help?view=powershell-5.1)
- [Examples of Comment-based Help](https://learn.microsoft.com/en-us/powershell/scripting/developer/help/examples-of-comment-based-help?view=powershell-7.4)
- [Using PSScriptAnalyzer](https://learn.microsoft.com/en-us/powershell/utility-modules/psscriptanalyzer/using-scriptanalyzer?view=ps-modules)
- [Querying Fabric KQL Database Using REST API](https://fabric.guru/querying-fabric-kql-database-using-rest-api)
- [How to Use GitHub Action for GitHub Push in Your Workflows](https://cicube.io/workflow-hub/ad-m-github-push-action/#how-to-use-a-github-app-token-for-pushing-changes)
12 changes: 12 additions & 0 deletions documentation/powerrti.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ Locale: en-US
{{ Fill in the Description }}

## powerrti Cmdlets
### [Add-RtiWorkspaceRoleAssignment](Add-RtiWorkspaceRoleAssignment.md)
{{ Fill in the Description }}

### [Connect-RtiAccount](Connect-RtiAccount.md)
{{ Fill in the Description }}

### [Get-RtiDebugInfo](Get-RtiDebugInfo.md)
{{ Fill in the Description }}

### [Get-RtiEventhouse](Get-RtiEventhouse.md)
{{ Fill in the Description }}

Expand All @@ -23,6 +29,9 @@ Locale: en-US
### [Get-RtiKQLDashboard](Get-RtiKQLDashboard.md)
{{ Fill in the Description }}

### [Get-RtiKQLDashboardDefinition](Get-RtiKQLDashboardDefinition.md)
{{ Fill in the Description }}

### [Get-RtiKQLDatabase](Get-RtiKQLDatabase.md)
{{ Fill in the Description }}

Expand All @@ -32,6 +41,9 @@ Locale: en-US
### [Get-RtiWorkspace](Get-RtiWorkspace.md)
{{ Fill in the Description }}

### [Get-RtiWorkspaceRoleAssignment](Get-RtiWorkspaceRoleAssignment.md)
{{ Fill in the Description }}

### [Invoke-RtiKQLCommand](Invoke-RtiKQLCommand.md)
{{ Fill in the Description }}

Expand Down
2 changes: 1 addition & 1 deletion powerrti/Public/Eventhouse/New-RTIEventhouse.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function New-RtiEventhouse {
Creates a new Fabric Eventhouse
.PARAMETER WorkspaceID
Id of the Fabric Workspace for which the Eventhouse should be created. The value for WorkspaceID is a GUID.
Id of the Fabric Workspace for which the Eventhouse should be created. The value for WorkspaceID is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.PARAMETER EventhouseName
Expand Down
2 changes: 1 addition & 1 deletion powerrti/Public/Eventhouse/Set-RtiEventhouse.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Set-RtiEventhouse {
-EventhouseDescription 'This is my new Eventhouse'
This example will update the Eventhouse with the Id '12345678-1234-1234-1234-123456789012'
in the Workspace with the Id '12345678-1234-1234-1234-123456789012' to
in the Workspace with the Id '12345678-1234-1234-1234-123456789012' to
have the name 'MyNewEventhouse' and the description
'This is my new Eventhouse'.
Expand Down
14 changes: 7 additions & 7 deletions powerrti/Public/Eventstream/Get-RtiEventstream.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ function Get-RtiEventstream {
parameters cannot be used together.
.PARAMETER WorkspaceId
Id of the Fabric Workspace for which the Eventstreams should be retrieved. The value for WorkspaceId is a GUID.
Id of the Fabric Workspace for which the Eventstreams should be retrieved. The value for WorkspaceId is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.PARAMETER EventstreamName
The name of the Eventstream to retrieve. This parameter cannot be used together with EventstreamID.
.PARAMETER EventstreamId
The Id of the Eventstream to retrieve. This parameter cannot be used together with EventstreamName. The value for EventstreamId is a GUID.
The Id of the Eventstream to retrieve. This parameter cannot be used together with EventstreamName. The value for EventstreamId is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.EXAMPLE
Expand All @@ -45,7 +45,7 @@ function Get-RtiEventstream {
https://learn.microsoft.com/en-us/rest/api/fabric/eventstream/items/get-eventstream?tabs=HTTP
.NOTES
TODO: Add functionality to list all Eventhouses. To do so fetch all workspaces and
TODO: Add functionality to list all Eventhouses. To do so fetch all workspaces and
then all eventhouses in each workspace.
Revision History:
Expand Down Expand Up @@ -73,13 +73,13 @@ begin {

# You can either use Name or WorkspaceID
if ($PSBoundParameters.ContainsKey("EventstreamName") -and $PSBoundParameters.ContainsKey("EventstreamID")) {
throw "Parameters EventstreamName and EventstreamID cannot be used together"
throw "Parameters EventstreamName and EventstreamID cannot be used together"
}

# Create Eventhouse API
$eventstreamApiUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/eventstreams"
$eventstreamApiUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/eventstreams"

$eventstreamAPIEventstreamIdUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/eventstreams/$EventstreamId"
$eventstreamAPIEventstreamIdUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/eventstreams/$EventstreamId"

}

Expand All @@ -92,7 +92,7 @@ process {
-Method GET `
-Uri $eventstreamAPIEventstreamIdUrl `
-ContentType "application/json"

$response
}
else {
Expand Down
12 changes: 6 additions & 6 deletions powerrti/Public/Eventstream/New-RtiEventstream.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function New-RtiEventstream {
.DESCRIPTION
Creates a new Fabric Eventstream
.PARAMETER WorkspaceID
Id of the Fabric Workspace for which the Eventstream should be created. The value for WorkspaceID is a GUID.
.PARAMETER WorkspaceID
Id of the Fabric Workspace for which the Eventstream should be created. The value for WorkspaceID is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.PARAMETER EventstreamName
Expand All @@ -28,7 +28,7 @@ function New-RtiEventstream {
.NOTES
Revsion History:
- 2024-11-07 - FGE: Implemented SupportShouldProcess
- 2024-11-09 - FGE: Added DisplaName as Alias for EventStreamName
Expand All @@ -40,8 +40,8 @@ function New-RtiEventstream {
param (

[Parameter(Mandatory=$true)]
[string]$WorkspaceID,
[string]$WorkspaceID,

[Parameter(Mandatory=$true)]
[Alias("Name","DisplayName")]
[string]$EventstreamName,
Expand All @@ -66,7 +66,7 @@ begin {
-Depth 1

# Create Eventhouse API URL
$eventstreamApiUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/eventstreams"
$eventstreamApiUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/eventstreams"
}

process {
Expand Down
14 changes: 7 additions & 7 deletions powerrti/Public/Eventstream/Remove-RtiEventstream.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ function Remove-RtiEventstream {
Removes an existing Fabric Eventstream
.PARAMETER WorkspaceId
Id of the Fabric Workspace for which the Eventstream should be deleted. The value for WorkspaceId is a GUID.
Id of the Fabric Workspace for which the Eventstream should be deleted. The value for WorkspaceId is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.PARAMETER EventstreamId
The Id of the Eventstream to delete. The value for Eventstream is a GUID.
The Id of the Eventstream to delete. The value for Eventstream is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.EXAMPLE
Expand All @@ -34,7 +34,7 @@ function Remove-RtiEventstream {
.NOTES
Revsion History:
- 2024-11-07 - FGE: Implemented SupportShouldProcess
- 2024-11-09 - FGE: Added DisplaName as Alias for EventStreamName
#>
Expand All @@ -45,8 +45,8 @@ function Remove-RtiEventstream {
param (

[Parameter(Mandatory=$true)]
[string]$WorkspaceId,
[string]$WorkspaceId,

[Alias("Id")]
[string]$EventstreamId,

Expand All @@ -63,7 +63,7 @@ begin {

# You can either use EventstreamName or EventstreamID
if ($PSBoundParameters.ContainsKey("EventstreamId") -and $PSBoundParameters.ContainsKey("EventstreamName")) {
throw "Parameters EventstreamId and EventstreamName cannot be used together"
throw "Parameters EventstreamId and EventstreamName cannot be used together"
}

if ($PSBoundParameters.ContainsKey("EventstreamName")) {
Expand All @@ -75,7 +75,7 @@ begin {
}

# Create Eventhouse API URL
$eventstreamApiUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/eventstreams/$EventstreamId"
$eventstreamApiUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/eventstreams/$EventstreamId"

}

Expand Down
16 changes: 8 additions & 8 deletions powerrti/Public/Eventstream/Set-RtiEventstream.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ function Set-RtiEventstream {
Updates Properties of an existing Fabric Eventstream
.PARAMETER WorkspaceId
Id of the Fabric Workspace for which the Eventstream should be updated. The value for WorkspaceId is a GUID.
Id of the Fabric Workspace for which the Eventstream should be updated. The value for WorkspaceId is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.PARAMETER EventstreamId
The Id of the Eventstream to update. The value for EventstreamId is a GUID.
The Id of the Eventstream to update. The value for EventstreamId is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.PARAMETER EventstreamNewName
Expand All @@ -29,8 +29,8 @@ function Set-RtiEventstream {
-EventstreamNewName 'MyNewEventstream' `
-EventstreamDescription 'This is my new Eventstream'
This example will update the Eventstream with the Id '12345678-1234-1234-1234-123456789012'.
This example will update the Eventstream with the Id '12345678-1234-1234-1234-123456789012'.
.NOTES
TODO: Add functionality to update Eventstream properties using EventstreamName instead of EventstreamId
Expand All @@ -44,12 +44,12 @@ function Set-RtiEventstream {
param (

[Parameter(Mandatory=$true)]
[string]$WorkspaceId,
[string]$WorkspaceId,

[Parameter(Mandatory=$true)]
[Alias("Id")]
[string]$EventstreamId,
[string]$EventstreamId,

[Alias("NewName","NewDisplayName")]
[string]$EventstreamNewName,

Expand Down Expand Up @@ -81,7 +81,7 @@ begin {
-Depth 1

# Create Eventstream API URL
$EventstreamApiUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/Eventstreams/$EventstreamId"
$EventstreamApiUrl = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/Eventstreams/$EventstreamId"
}

process {
Expand Down
2 changes: 1 addition & 1 deletion powerrti/Public/Get-RtiDebugInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Get-RtiDebugInfo {
Get-RtiDebugInfo
This example shows the current session object.
#>

[CmdletBinding()]
Expand Down
2 changes: 1 addition & 1 deletion powerrti/Public/Invoke-RtiKQLCommand.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function Invoke-RtiKQLCommand {
Executes a KQL command in a Kusto Database.
.DESCRIPTION
Executes a KQL command in a Kusto Database. The KQL command is executed in the Kusto Database
Executes a KQL command in a Kusto Database. The KQL command is executed in the Kusto Database
that is specified by the KQLDatabaseName or KQLDatabaseId parameter. The KQL command is executed
in the context of the Fabric Real-Time Intelligence session that is established by the
Connect-RTISession cmdlet.
Expand Down
14 changes: 7 additions & 7 deletions powerrti/Public/KQLDashboard/Get-RtiKQLDashboard.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ function Get-RtiKQLDashboard {
parameters cannot be used together.
.PARAMETER WorkspaceId
Id of the Fabric Workspace for which the KQLDashboards should be retrieved. The value for WorkspaceId is a GUID.
Id of the Fabric Workspace for which the KQLDashboards should be retrieved. The value for WorkspaceId is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.PARAMETER KQLDashboardName
The name of the KQLDashboard to retrieve. This parameter cannot be used together with KQLDashboardID.
.PARAMETER KQLDashboardID
The Id of the KQLDashboard to retrieve. This parameter cannot be used together with KQLDashboardName. The value for KQLDashboardID is a GUID.
The Id of the KQLDashboard to retrieve. This parameter cannot be used together with KQLDashboardName. The value for KQLDashboardID is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.EXAMPLE
Get-RTIKQLDashboard
.NOTES
TODO: Add functionality to list all KQLDashboards. To do so fetch all workspaces and
TODO: Add functionality to list all KQLDashboards. To do so fetch all workspaces and
then all KQLDashboards in each workspace.
Revision History:
Expand Down Expand Up @@ -54,13 +54,13 @@ begin {

# You can either use Name or WorkspaceID
if ($PSBoundParameters.ContainsKey("KQLDashboardName") -and $PSBoundParameters.ContainsKey("KQLDashboardId")) {
throw "Parameters KQLDashboardName and KQLDashboardId cannot be used together"
throw "Parameters KQLDashboardName and KQLDashboardId cannot be used together"
}

# Create KQLDashboard API
$KQLDashboardAPI = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/KQLDashboards"
$KQLDashboardAPI = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/KQLDashboards"

$KQLDashboardAPIKQLDashboardId = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/KQLDashboards/$KQLDashboardId"
$KQLDashboardAPIKQLDashboardId = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/KQLDashboards/$KQLDashboardId"

}

Expand All @@ -73,7 +73,7 @@ process {
-Method GET `
-Uri $KQLDashboardAPIKQLDashboardId `
-ContentType "application/json"

$response
}
else {
Expand Down
18 changes: 9 additions & 9 deletions powerrti/Public/KQLDashboard/Get-RtiKQLDashboardDefinition.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ function Get-RtiKQLDashboardDefinition {
This is provided as a JSON object.
.PARAMETER WorkspaceId
Id of the Fabric Workspace in which the KQLDashboard exists. The value for WorkspaceId is a GUID.
Id of the Fabric Workspace in which the KQLDashboard exists. The value for WorkspaceId is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.PARAMETER KQLDashboardName
The name of the KQLDashboard to retrieve. This parameter cannot be used together with KQLDashboardID.
.PARAMETER KQLDashboardID
The Id of the KQLDashboard to retrieve. This parameter cannot be used together with KQLDashboardName. The value for KQLDashboardID is a GUID.
The Id of the KQLDashboard to retrieve. This parameter cannot be used together with KQLDashboardName. The value for KQLDashboardID is a GUID.
An example of a GUID is '12345678-1234-1234-1234-123456789012'.
.EXAMPLE
Get-RtiKQLDashboardDefinition `
-WorkspaceId "12345678-1234-1234-1234-123456789012" `
-KQLDashboardName "MyKQLDashboard"
This example retrieves the KQLDashboard Definition for the KQLDashboard named "MyKQLDashboard" in the
This example retrieves the KQLDashboard Definition for the KQLDashboard named "MyKQLDashboard" in the
Workspace with the ID "12345678-1234-1234-1234-123456789012".
.EXAMPLE
Expand All @@ -36,10 +36,10 @@ function Get-RtiKQLDashboardDefinition {
$db[0].payload | `
Set-Content `
-Path "C:\temp\mydashboard.json"
-Path "C:\temp\mydashboard.json"
This example retrieves the KQLDashboard Definition for the KQLDashboard named "MyKQLDashboard" in the
Workspace with the ID "12345678-1234-1234-1234-123456789012".
Workspace with the ID "12345678-1234-1234-1234-123456789012".
The definition is saved to a file named "mydashboard.json".
Expand Down Expand Up @@ -73,13 +73,13 @@ begin {

# You can either use Name or WorkspaceID
if ($PSBoundParameters.ContainsKey("KQLDashboardName") -and $PSBoundParameters.ContainsKey("KQLDashboardId")) {
throw "Parameters KQLDashboardName and KQLDashboardId cannot be used together"
throw "Parameters KQLDashboardName and KQLDashboardId cannot be used together"
}

# Create KQLDashboard API
$KQLDashboardAPI = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/KQLDashboards"
$KQLDashboardAPI = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/KQLDashboards"

$KQLDashboardAPIKQLDashboardId = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/KQLDashboards/$KQLDashboardId/getDefinition"
$KQLDashboardAPIKQLDashboardId = "$($RTISession.BaseFabricUrl)/v1/workspaces/$WorkspaceId/KQLDashboards/$KQLDashboardId/getDefinition"

$body = @{
} | ConvertTo-Json `
Expand All @@ -97,7 +97,7 @@ process {
-Uri $KQLDashboardAPIKQLDashboardId `
-Body $null `
-ContentType "application/json"

$parts = $response.definition.parts

foreach ($part in $parts) {
Expand Down
Loading

0 comments on commit e2d99d0

Please sign in to comment.