diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7f6c5d9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,70 @@ +# Changelog +All notable changes to the [PSRP](https://github.com/Akaizoku/PSRP) project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.1](https://github.com/Akaizoku/PSRP/releases/tag/1.0.1) - 2020-02-26 + +Update + +### Added + +The following function has been added: +- Start-ContractSelection + +The following file has been added: +- CHANGELOG + +### Changed + +The following files have been updated: +- README + +## [1.0.0](https://github.com/Akaizoku/PSRP/releases/tag/1.0.0) - 2020-02-21 + +### Added + +The following functions have been added: +- Backup-Schema +- Get-ModelID +- Get-JavaClass +- Get-RiskProBatchResult +- Get-SolveID +- Grant-Role +- Invoke-CreateModel +- Invoke-CreateModelGroup +- Invoke-CreateUser +- Invoke-CreateUserGroup +- Invoke-DeleteModel +- Invoke-DeleteModelGroup +- Invoke-DeleteUser +- Invoke-List +- Invoke-MakeDir +- Invoke-MigratorTool +- Invoke-ModifyModel +- Invoke-ModifyModelGroup +- Invoke-ModifyUser +- Invoke-RiskProANTClient +- Invoke-RiskProBatchClient +- Invoke-Upload +- Restore-Schema +- Set-UserPassword +- Start-CleanRollupSolve +- Start-ExportToExcel +- Start-ImportXML +- Start-Maintenance +- Start-RollupSolve +- Start-Solve +- Test-MigratorToolOutcome +- Test-Model +- Test-RiskProBatchClientOutcome +- Test-Solve +- Unlock-User +- Write-MigratorToolCmd +- Write-RiskProANTCmd +- Write-RiskProBatchClientCmd + +The following files have been added: +- LICENSE +- README diff --git a/PSRP.psd1 b/PSRP.psd1 index dd0756c..f1b43f7 100644 --- a/PSRP.psd1 +++ b/PSRP.psd1 @@ -12,7 +12,7 @@ RootModule = 'PSRP.psm1' # Version number of this module. -ModuleVersion = '1.0.0' +ModuleVersion = '1.0.1' # Supported PSEditions # CompatiblePSEditions = @() @@ -69,7 +69,42 @@ PowerShellVersion = '3.0' # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = '*' +FunctionsToExport = @( + "Backup-Schema", + "Get-ModelID", + "Get-RiskProBatchResult", + "Get-SolveID", + "Grant-Role", + "Invoke-CreateModel", + "Invoke-CreateModelGroup", + "Invoke-CreateUser", + "Invoke-CreateUserGroup", + "Invoke-DeleteModel", + "Invoke-DeleteModelGroup", + "Invoke-DeleteUser", + "Invoke-List", + "Invoke-MakeDir", + "Invoke-MigratorTool", + "Invoke-ModifyModel", + "Invoke-ModifyModelGroup", + "Invoke-ModifyUser", + "Invoke-RiskProANTClient", + "Invoke-RiskProBatchClient", + "Invoke-Upload", + "Restore-Schema", + "Set-UserPassword", + "Start-CleanRollupSolve", + "Start-ExportToExcel", + "Start-ImportXML", + "Start-Maintenance", + "Start-RollupSolve", + "Start-Solve", + "Test-MigratorToolOutcome", + "Test-Model", + "Test-RiskProBatchClientOutcome", + "Test-Solve", + "Unlock-User" +) # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() @@ -108,8 +143,8 @@ PrivateData = @{ # ReleaseNotes of this module ReleaseNotes = @' -[1.0.0] -Framework for basic administration functions. +[1.0.1] +Add contract selection function and change log '@ } # End of PSData hashtable diff --git a/Public/Start-ContractSelection.ps1 b/Public/Start-ContractSelection.ps1 new file mode 100644 index 0000000..6204e86 --- /dev/null +++ b/Public/Start-ContractSelection.ps1 @@ -0,0 +1,258 @@ +function Start-ContractSelection { + <# + .SYNOPSIS + Start contract selection + + .DESCRIPTION + Wrapper function to start the contract selection process using the RiskPro batch client + + .PARAMETER JavaPath + The optional java path parameter corresponds to the path to the Java executable file. If not specified, please ensure that the path contains the Java home. + + .PARAMETER RiskProBatchClient + The RiskPro batch client parameter corresponds to the path to the RiskPro batch client JAR file. + + .PARAMETER ServerURI + The server URI parameter corresponds to the Uniform Resource Identifier (URI) of the RiskPro server. + + .PARAMETER Credentials + The credentials parameter corresponds to the credentials of the RiskPro account to use for the operation. + + .PARAMETER JavaOptions + The optional Java options parameter corresponds to the additional Java options to pass to the Java client. + + .PARAMETER ModelName + The model name parameter corresponds to the name of the model. + + .PARAMETER ResultSelectionName + The result selection name parameter corresponds to the name of the result selection. + + .PARAMETER SolveName + The solve name parameter corresponds to the name of the solve. + + .PARAMETER AccountStructureName + The account structure name parameter corresponds to the name of the account structure. + + .PARAMETER ContractSelectionType + The contract selection type parameter corresponds to the type of contract selection. + + Two values are available: + - FULL + - INCREMENTAL + + .PARAMETER SelectedContractGroup + The optional selected contract group parameter corresponds to the name of the data group in which to place selected contracts. + + .PARAMETER NonSelectedContractGroup + The optional non-selected data group parameter corresponds to the name of the data group in which to place non-selected contracts. + + .PARAMETER ErroneousContractGroup + The optional erroneous contract group parameter corresponds to the name of the data group in which to place erroneous contracts. + + .PARAMETER MaxNumberOfErrorsToLog + The optional maximum number of errors to log parameter corresponds to the maximum number of errors to log. + + .PARAMETER DataGroupNames + The optional data group names parameter corresponds to the name of the data groups. + + .PARAMETER DataFilters + The optional data filters parameter corresponds to the name of the data filters. + + .PARAMETER Separator + The optional separator parameter corresponds to the character used to separate values in lists. + + .PARAMETER SynchronousMode + The synchronous mode switch defines if the synchronous mode should be used. + + .NOTES + File name: Start-ContractSelection.ps1 + Author: Florian CARRIER + Creation date: 26/02/2020 + Last modified: 26/02/2020 + #> + [CmdletBinding ( + SupportsShouldProcess = $true + )] + Param( + [Parameter ( + Position = 1, + Mandatory = $false, + HelpMessage = "Java path" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $JavaPath, + [Parameter ( + Position = 2, + Mandatory = $true, + HelpMessage = "RiskPro batch client path" + )] + [ValidateNotNullOrEmpty ()] + [Alias ("Path", "RiskProPath")] + [System.String] + $RiskProBatchClient, + [Parameter ( + Position = 3, + Mandatory = $true, + HelpMessage = "RiskPro server URI" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $ServerURI, + [Parameter ( + Position = 4, + Mandatory = $true, + HelpMessage = "Credentials of the user" + )] + [ValidateNotNullOrEmpty ()] + [System.Management.Automation.PSCredential] + $Credentials, + [Parameter ( + Position = 5, + Mandatory = $false, + HelpMessage = "Java options" + )] + [ValidateNotNullOrEmpty ()] + [System.String[]] + $JavaOptions, + [Parameter ( + Position = 6, + Mandatory = $true, + HelpMessage = "Name of the model" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $ModelName, + [Parameter ( + Position = 7, + Mandatory = $true, + HelpMessage = "Name of the result selection" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $ResultSelectionName, + [Parameter ( + Position = 8, + Mandatory = $true, + HelpMessage = "Name of the solve" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $SolveName, + [Parameter ( + Position = 9, + Mandatory = $true, + HelpMessage = "Name of the account structure" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $AccountStructureName, + [Parameter ( + Position = 10, + Mandatory = $true, + HelpMessage = "Type of contract selection" + )] + [ValidateSet ( + "FULL", + "INCREMENTAL" + )] + [System.String] + $ContractSelectionType, + [Parameter ( + Position = 11, + Mandatory = $false, + HelpMessage = "Name of the data group in which to place selected contracts" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $SelectedContractGroup, + [Parameter ( + Position = 12, + Mandatory = $false, + HelpMessage = "Name of the data group in which to place non-selected contracts" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $NonSelectedContractGroup, + [Parameter ( + Position = 13, + Mandatory = $false, + HelpMessage = "Name of the data group in which to place erroneous contracts" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $ErroneousContractGroup, + [Parameter ( + Position = 14, + Mandatory = $false, + HelpMessage = "Maximum number of errors to log" + )] + [ValidateNotNullOrEmpty ()] + [System.Int32] + $MaxNumberOfErrorsToLog, + [Parameter ( + Position = 15, + Mandatory = $false, + HelpMessage = "Name of the data groups" + )] + [ValidateNotNullOrEmpty ()] + [System.String[]] + $DataGroupNames, + [Parameter ( + Position = 16, + Mandatory = $false, + HelpMessage = "Name of the data filters" + )] + [ValidateNotNullOrEmpty ()] + [System.String[]] + $DataFilters, + [Parameter ( + Position = 17, + Mandatory = $false, + HelpMessage = "Character used to separate values in lists" + )] + [ValidateNotNullOrEmpty ()] + [System.String] + $Separator, + [Parameter ( + HelpMessage = "Define if the synchronous mode should be enabled" + )] + [Switch] + $SynchronousMode + ) + Begin { + # Get global preference variables + Get-CallerPreference -Cmdlet $PSCmdlet -SessionState $ExecutionContext.SessionState + # Get utilities Java class + $JavaClass = Get-JavaClass -Name "Interfacing" + } + Process { + # Define operation + $Operation = "startContractSelection" + # Define mandatory operation parameters + $OperationParameters = New-Object -TypeName "System.Collections.Specialized.OrderedDictionary" + $OperationParameters.Add("ic.modelName" , $ModelName) + $OperationParameters.Add("ic.resultSelectionName" , $ResultSelectionName) + $OperationParameters.Add("ic.solveName" , $SolveName) + $OperationParameters.Add("ic.accountStructureName" , $AccountStructureName) + $OperationParameters.Add("ic.contractSelectionType" , $ContractSelectionType) + # Define optional operation parameters + if ($PSBoundParameters.ContainsKey("SelectedContractGroup")) { $OperationParameters.Add("ic.selectedContractGroup" , $SelectedContractGroup) } + if ($PSBoundParameters.ContainsKey("NonSelectedContractGroup")) { $OperationParameters.Add("ic.nonSelectedContractGroup" , $NonSelectedContractGroup) } + if ($PSBoundParameters.ContainsKey("ErroneousContractGroup")) { $OperationParameters.Add("ic.erroneousContractGroup" , $ErroneousContractGroup) } + if ($PSBoundParameters.ContainsKey("MaxNumberOfErrorsToLog")) { $OperationParameters.Add("ic.maxNumberOfErrorsToLog" , $MaxNumberOfErrorsToLog) } + if ($PSBoundParameters.ContainsKey("DataGroupNames")) { $OperationParameters.Add("ic.dataGroupNames" , $DataGroupNames) } + if ($PSBoundParameters.ContainsKey("DataFilters")) { $OperationParameters.Add("ic.dataFilters" , $DataFilters) } + if ($PSBoundParameters.ContainsKey("Separator")) { $OperationParameters.Add("ic.separator" , $Separator) } + # Configure syncrhonous mode + $OperationParameters.Add("ws.sync", $SynchronousMode) + # Format Java parameters + $Parameters = ConvertTo-JavaProperty -Properties $OperationParameters + # Call RiskPro batch client + if ($PSBoundParameters.ContainsKey("JavaPath")) { + Invoke-RiskProBatchClient -JavaPath $JavaPath -RiskProPath $RiskProBatchClient -ServerURI $ServerURI -Credentials $Credentials -JavaOptions $JavaOptions -Operation $Operation -Parameters $Parameters -Class $JavaClass + } else { + Invoke-RiskProBatchClient -RiskProPath $RiskProBatchClient -ServerURI $ServerURI -Credentials $Credentials -JavaOptions $JavaOptions -Operation $Operation -Parameters $Parameters -Class $JavaClass + } + } +} diff --git a/README.md b/README.md index 5bf606c..b753250 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,9 @@ RiskPro PowerShell module (PSRP) is a framework for the automation of tasks for ### Installation There are two ways of setting up the WildFly PowerShell Module on your system: -1. Download the `PSRP` module from the [Github repository](https://github.com/Akaizoku/PSRP); -1. Install the `PSRP` module from the [PowerShell Gallery](https://www.powershellgallery.com/packages/PSRP). + +1. Download the `PSRP` module from the [Github repository](https://github.com/Akaizoku/PSRP); +2. Install the `PSRP` module from the [PowerShell Gallery](https://www.powershellgallery.com/packages/PSRP). ```powershell Install-Module -Name "PSRP" -Repository "PSGallery" @@ -36,6 +37,44 @@ Import-Module -Name "PSRP" Get-Command -Module "PSRP" ``` +| CommandType | Name | Version | Source | +| ----------- | ------------------------------ | ------- | ------ | +| Function | Backup-Schema | 1.0.1 | PSRP | +| Function | Get-ModelID | 1.0.1 | PSRP | +| Function | Get-RiskProBatchResult | 1.0.1 | PSRP | +| Function | Get-SolveID | 1.0.1 | PSRP | +| Function | Grant-Role | 1.0.1 | PSRP | +| Function | Invoke-CreateModel | 1.0.1 | PSRP | +| Function | Invoke-CreateModelGroup | 1.0.1 | PSRP | +| Function | Invoke-CreateUser | 1.0.1 | PSRP | +| Function | Invoke-CreateUserGroup | 1.0.1 | PSRP | +| Function | Invoke-DeleteModel | 1.0.1 | PSRP | +| Function | Invoke-DeleteModelGroup | 1.0.1 | PSRP | +| Function | Invoke-DeleteUser | 1.0.1 | PSRP | +| Function | Invoke-List | 1.0.1 | PSRP | +| Function | Invoke-MakeDir | 1.0.1 | PSRP | +| Function | Invoke-MigratorTool | 1.0.1 | PSRP | +| Function | Invoke-ModifyModel | 1.0.1 | PSRP | +| Function | Invoke-ModifyModelGroup | 1.0.1 | PSRP | +| Function | Invoke-ModifyUser | 1.0.1 | PSRP | +| Function | Invoke-RiskProANTClient | 1.0.1 | PSRP | +| Function | Invoke-RiskProBatchClient | 1.0.1 | PSRP | +| Function | Invoke-Upload | 1.0.1 | PSRP | +| Function | Restore-Schema | 1.0.1 | PSRP | +| Function | Set-UserPassword | 1.0.1 | PSRP | +| Function | Start-CleanRollupSolve | 1.0.1 | PSRP | +| Function | Start-ContractSelection | 1.0.1 | PSRP | +| Function | Start-ExportToExcel | 1.0.1 | PSRP | +| Function | Start-ImportXML | 1.0.1 | PSRP | +| Function | Start-Maintenance | 1.0.1 | PSRP | +| Function | Start-RollupSolve | 1.0.1 | PSRP | +| Function | Start-Solve | 1.0.1 | PSRP | +| Function | Test-MigratorToolOutcome | 1.0.1 | PSRP | +| Function | Test-Model | 1.0.1 | PSRP | +| Function | Test-RiskProBatchClientOutcome | 1.0.1 | PSRP | +| Function | Test-Solve | 1.0.1 | PSRP | +| Function | Unlock-User | 1.0.1 | PSRP | + ## Dependencies This module depends on the usage of functions provided by the [PowerShell Tool Kit (PSTK)](https://www.powershellgallery.com/packages/PSTK/) module.