Skip to content

Commit

Permalink
added help to functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
neztach committed Jul 5, 2024
1 parent 5958dbe commit d4dcaec
Show file tree
Hide file tree
Showing 29 changed files with 985 additions and 23 deletions.
18 changes: 18 additions & 0 deletions Private/Add-TestimoBaselines.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
function Add-TestimoBaselines {
<#
.SYNOPSIS
Adds baseline objects to the Testimo configuration.
.DESCRIPTION
This function adds baseline objects to the Testimo configuration. It compares baseline sources and targets, excluding specified properties, and stores the comparison results in the Testimo configuration.
.PARAMETER BaseLineObjects
Specifies an array of baseline objects to be added to the Testimo configuration.
.EXAMPLE
Add-TestimoBaselines -BaseLineObjects @($BaselineObject1, $BaselineObject2)
Adds $BaselineObject1 and $BaselineObject2 to the Testimo configuration and performs a comparison between their baseline sources and targets.
.NOTES
File Name : Add-TestimoBaselines.ps1
Prerequisite : This function requires Compare-MultipleObjects function.
#>
[CmdletBinding()]
param(
[System.Collections.IDictionary[]] $BaseLineObjects
Expand Down
22 changes: 22 additions & 0 deletions Private/Add-TestimoSources.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
function Add-TestimoSources {
<#
.SYNOPSIS
Adds external sources to the Testimo configuration.
.DESCRIPTION
This function adds external sources to the Testimo configuration based on the provided folder paths. It processes PowerShell script files within the specified folders to extract configuration data and updates the Testimo configuration accordingly.
.PARAMETER FolderPath
Specifies the folder paths containing the PowerShell script files to process.
.EXAMPLE
Add-TestimoSources -FolderPath "C:\Scripts"
Description:
Adds external sources from the "C:\Scripts" folder to the Testimo configuration.
.EXAMPLE
Add-TestimoSources -FolderPath "C:\Scripts", "D:\Scripts"
Description:
Adds external sources from both "C:\Scripts" and "D:\Scripts" folders to the Testimo configuration.
#>
[CmdletBinding()]
param(
[string[]] $FolderPath
Expand Down
32 changes: 32 additions & 0 deletions Private/Get-RequestedSources.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,36 @@
function Get-RequestedSources {
<#
.SYNOPSIS
Retrieves requested sources based on specified criteria.
.DESCRIPTION
This function retrieves requested sources based on the provided sources, exclude sources, include tags, and exclude tags. It filters out sources that do not match the criteria and categorizes them into working and non-working lists.
.PARAMETER Sources
Specifies an array of sources to be considered.
.PARAMETER ExcludeSources
Specifies an array of sources to be excluded from consideration.
.PARAMETER IncludeTags
Specifies an array of tags that sources must include to be considered.
.PARAMETER ExcludeTags
Specifies an array of tags that sources must exclude to be considered.
.EXAMPLE
Get-RequestedSources -Sources @('Source1', 'Source2') -ExcludeSources @('Source3') -IncludeTags @('Tag1')
Description:
Retrieves sources 'Source1' and 'Source2', excludes 'Source3', and includes sources with 'Tag1'.
.EXAMPLE
Get-RequestedSources -Sources @('SourceA', 'SourceB') -ExcludeTags @('TagX')
Description:
Retrieves sources 'SourceA' and 'SourceB', excluding sources with 'TagX'.
#>
[CmdletBinding()]
param(
[string[]] $Sources,
Expand Down
22 changes: 22 additions & 0 deletions Private/Get-TestimoDomainControllers.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
function Get-TestimoDomainControllers {
<#
.SYNOPSIS
Retrieves domain controllers in a specified domain, with an option to skip read-only domain controllers.
.DESCRIPTION
This function retrieves domain controllers in the specified domain. It can skip read-only domain controllers if desired.
.PARAMETER Domain
Specifies the name of the domain to retrieve domain controllers from.
.PARAMETER SkipRODC
Indicates whether to skip read-only domain controllers.
.EXAMPLE
Get-TestimoDomainControllers -Domain "contoso.com"
Retrieves all domain controllers in the "contoso.com" domain.
.EXAMPLE
Get-TestimoDomainControllers -Domain "contoso.com" -SkipRODC
Retrieves all domain controllers in the "contoso.com" domain, excluding read-only domain controllers.
#>
[CmdletBinding()]
param(
[string] $Domain,
Expand Down
18 changes: 18 additions & 0 deletions Private/Get-TestimoSourcesStatus.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
function Get-TestimoSourcesStatus {
<#
.SYNOPSIS
Retrieves the status of Testimo sources based on the specified scope.
.DESCRIPTION
This function retrieves the status of Testimo sources based on the specified scope. It checks if any Testimo source within the specified scope is enabled.
.PARAMETER Scope
Specifies the scope for which the Testimo sources status should be retrieved.
.EXAMPLE
Get-TestimoSourcesStatus -Scope "Global"
Retrieves the status of Testimo sources within the Global scope.
.EXAMPLE
Get-TestimoSourcesStatus -Scope "Local"
Retrieves the status of Testimo sources within the Local scope.
#>
[cmdletbinding()]
param(
[string] $Scope
Expand Down
23 changes: 23 additions & 0 deletions Private/Import-TestimoConfiguration.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
function Import-TestimoConfiguration {
<#
.SYNOPSIS
Imports a Testimo configuration from various sources.
.DESCRIPTION
This function imports a Testimo configuration from different sources such as Hashtable, JSON file, or JSON content. It then updates the Testimo configuration based on the provided input.
.PARAMETER Configuration
Specifies the configuration object to be imported. This can be a Hashtable, a path to a JSON file, or JSON content.
.EXAMPLE
Import-TestimoConfiguration -Configuration $Hashtable
Imports a Testimo configuration from a Hashtable.
.EXAMPLE
Import-TestimoConfiguration -Configuration "C:\Path\to\Configuration.json"
Imports a Testimo configuration from a JSON file located at the specified path.
.EXAMPLE
Import-TestimoConfiguration -Configuration '{"Key": {"Enable": true, "Source": {"ExpectedOutput": "Output"}}}'
Imports a Testimo configuration from JSON content.
#>
[CmdletBinding()]
param(
[Object] $Configuration
Expand Down
23 changes: 23 additions & 0 deletions Private/New-ChartData.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
function New-ChartData {
<#
.SYNOPSIS
Creates a chart data structure based on the input results.
.DESCRIPTION
This function takes an array of results and generates a chart data structure that counts the occurrences of each assessment. If an assessment is null, it is categorized as 'Skipped'.
.PARAMETER Results
The array of results to generate the chart data from.
.EXAMPLE
$results = @(
[PSCustomObject]@{ Assessment = 'Pass' },
[PSCustomObject]@{ Assessment = 'Fail' },
[PSCustomObject]@{ Assessment = 'Pass' },
[PSCustomObject]@{ Assessment = $null },
[PSCustomObject]@{ Assessment = 'Pass' }
)
New-ChartData -Results $results
This example creates a chart data structure based on the provided results array.
#>
[cmdletBinding()]
param(
$Results
Expand Down
33 changes: 33 additions & 0 deletions Private/Out-Begin.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
function Out-Begin {
<#
.SYNOPSIS
Outputs formatted text based on specified parameters.
.DESCRIPTION
The Out-Begin function outputs formatted text to the console based on the provided Scope, Text, Level, Type, Domain, and DomainController parameters.
.PARAMETER Scope
Specifies the scope of the output. Valid values are 'Forest', 'Domain', or 'DC'.
.PARAMETER Text
Specifies the text to be displayed.
.PARAMETER Level
Specifies the level of the output.
.PARAMETER Type
Specifies the type of output. Default value is 't'.
.PARAMETER Domain
Specifies the domain for the output.
.PARAMETER DomainController
Specifies the domain controller for the output.
.EXAMPLE
Out-Begin -Scope 'Forest' -Text 'Sample text' -Level 1 -Type 't' -Domain 'ExampleDomain' -DomainController 'DC1'
Outputs formatted text for the Forest scope with the specified parameters.
.EXAMPLE
Out-Begin -Scope 'Domain' -Text 'Error message' -Level 2 -Type 'e' -Domain 'AnotherDomain'
Outputs an error message for the Domain scope with the specified parameters.
#>
[CmdletBinding()]
param(
[string] $Scope,
Expand Down
43 changes: 43 additions & 0 deletions Private/Out-Failure.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,47 @@
function Out-Failure {
<#
.SYNOPSIS
Sends a failure status message with detailed information.
.DESCRIPTION
The Out-Failure function sends a failure status message with detailed information including the scope, text, level, extended value, domain, domain controller, reference ID, type, source, and test.
.PARAMETER Scope
Specifies the scope of the failure.
.PARAMETER Text
Specifies the text message associated with the failure.
.PARAMETER Level
Specifies the level of the failure.
.PARAMETER ExtendedValue
Specifies additional extended value information for the failure. Default is 'Input data not provided. Failing test.'.
.PARAMETER Domain
Specifies the domain associated with the failure.
.PARAMETER DomainController
Specifies the domain controller related to the failure.
.PARAMETER ReferenceID
Specifies a reference ID for the failure.
.PARAMETER Type
Specifies the type of failure. Valid values are 'e' (error), 'i' (information), or 't' (test). Default is 't'.
.PARAMETER Source
Specifies the source of the failure as a dictionary.
.PARAMETER Test
Specifies the test information related to the failure as a dictionary.
.EXAMPLE
Out-Failure -Scope "Global" -Text "Connection failed" -Level 3 -Domain "example.com" -DomainController "DC1" -ReferenceID "12345" -Type "e" -Source @{"SourceKey"="SourceValue"} -Test @{"TestKey"="TestValue"}
Sends a failure status message with the specified parameters.
#>
[CmdletBinding()]
param(
[string] $Scope,
Expand Down
49 changes: 49 additions & 0 deletions Private/Out-Informative.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,53 @@
function Out-Informative {
<#
.SYNOPSIS
Outputs informative messages with customizable colors and status indicators.
.DESCRIPTION
The Out-Informative function is used to output informative messages with customizable colors and status indicators. It allows for specifying the level, title, text, status, extended value, and scope of the message.
.PARAMETER Level
Specifies the indentation level for the message.
.PARAMETER OverrideTitle
Specifies an optional title to override the default title.
.PARAMETER OverrideTextStatus
Specifies an optional text status to override the default status.
.PARAMETER Domain
Specifies the domain related to the message.
.PARAMETER DomainController
Specifies the domain controller related to the message.
.PARAMETER Text
Specifies the main text content of the message.
.PARAMETER Status
Specifies the status of the message (true for pass, false for fail, null for informative).
.PARAMETER ExtendedValue
Specifies additional extended value information for the message.
.PARAMETER Start
Indicates whether the message is the start of a section.
.PARAMETER End
Indicates whether the message is the end of a section.
.PARAMETER Scope
Specifies the scope of the message.
.EXAMPLE
Out-Informative -Level 1 -OverrideTitle 'Custom Title' -Text 'This is a custom message' -Status $true -ExtendedValue 'Additional info' -Scope 'Domain'
Outputs a custom informative message with a specified title, text, pass status, extended value, and domain scope.
.EXAMPLE
Out-Informative -Level 0 -Text 'Default message' -Status $false
Outputs a default informative message with a fail status.
#>
[CmdletBinding()]
param(
[int] $Level = 0,
Expand Down
39 changes: 39 additions & 0 deletions Private/Out-Skip.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,43 @@
function Out-Skip {
<#
.SYNOPSIS
Skips a specific test and updates the test summary.
.DESCRIPTION
The Out-Skip function is used to skip a specific test and update the test summary with the skipped test count. It also provides a reason for skipping the test.
.PARAMETER Scope
Specifies the scope of the test.
.PARAMETER TestsSummary
Specifies the summary of all tests.
.PARAMETER Level
Specifies the level of the test.
.PARAMETER Domain
Specifies the domain of the test.
.PARAMETER DomainController
Specifies the domain controller for the test.
.PARAMETER Test
Specifies the name of the test being skipped.
.PARAMETER Source
Specifies the source of the test.
.PARAMETER Reason
Specifies the reason for skipping the test. Default is 'Skipping - unmet dependency'.
.EXAMPLE
Out-Skip -Scope 'Integration' -TestsSummary $TestsSummary -Level 1 -Domain 'example.com' -DomainController 'DC1' -Test 'Test1' -Source 'ModuleA'
Description
-----------
Skips the test named 'Test1' at level 1 in the 'Integration' scope for the domain 'example.com' using the domain controller 'DC1'. Updates the test summary with the skipped test count.
#>
[CmdletBinding()]
param(
[string] $Scope,
Expand Down
Loading

0 comments on commit d4dcaec

Please sign in to comment.