Skip to content

Commit

Permalink
Module 0.2.0 build, add PSScriptAnalyzer suppress message
Browse files Browse the repository at this point in the history
  • Loading branch information
cksapp committed Jan 7, 2025
1 parent c61719e commit 641f07b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
26 changes: 19 additions & 7 deletions Datto.DBPool.API/0.2.0/Datto.DBPool.API.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ function Invoke-DBPoolRequest {
.PARAMETER data
Defines the data to be sent with the API request body when using POST or PATCH
.PARAMETER DBPool_JSON_Conversion_Depth
.PARAMETER jsonDepth
Defines the depth of the JSON conversion for the 'data' parameter request body
.PARAMETER allPages
Expand Down Expand Up @@ -514,14 +514,21 @@ function Invoke-DBPoolRequest {

[Parameter(Mandatory = $false)]
#[ValidateRange(0, [int]::MaxValue)]
[int]$DBPool_JSON_Conversion_Depth = 5,
[int]$jsonDepth = $DBPool_JSON_Conversion_Depth,

[Parameter(DontShow = $true, Mandatory = $false)]
[Switch]$allPages

)

begin {}
begin {

if (-not $PSBoundParameters['jsonDepth'] -and $null -eq $DBPool_JSON_Conversion_Depth) {
$jsonDepth = 100
Write-Debug "The 'jsonDepth' parameter was not set. Using the default value of [ $jsonDepth ]"
}

}

process {

Expand All @@ -541,7 +548,7 @@ function Invoke-DBPoolRequest {
if ($null -eq $data) {
$request_Body = $null
} else {
$request_Body = $data | ConvertTo-Json -Depth $DBPool_JSON_Conversion_Depth
$request_Body = $data | ConvertTo-Json -Depth $jsonDepth
}

try {
Expand Down Expand Up @@ -2007,6 +2014,7 @@ function New-DBPoolContainer {
#>

[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Low')]
[Alias('Add-DBPoolContainer', 'Clone-DBPoolContainer', 'Copy-DBPoolContainer', 'Create-DBPoolContainer')]
[OutputType([PSCustomObject])]
param (
[Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
Expand Down Expand Up @@ -2814,6 +2822,10 @@ function Invoke-DBPoolDebug {
.NOTES
Equivalent API endpoint:
- GET /api/docs/error
- PATCH /api/docs/error
- POST /api/docs/error
- PUT /api/docs/error
- DELETE /api/docs/error
.LINK
https://datto-dbpool-api.kentsapp.com/Debug/Invoke-DBPoolDebug/
Expand All @@ -2824,7 +2836,7 @@ function Invoke-DBPoolDebug {
[OutputType([System.Management.Automation.ErrorRecord])]
param (
[Parameter(Mandatory = $false)]
[ValidateSet('DELETE', 'GET', 'PATCH', 'POST')]
[ValidateSet('DELETE', 'GET', 'PATCH', 'POST' , 'PUT')]
[string]$method = 'GET'
)

Expand Down Expand Up @@ -2899,7 +2911,7 @@ function Get-DBPoolOpenAPI {
process {

try {
$response = Invoke-DBPoolRequest -method Get -resource_Uri $requestPath -ErrorAction Stop -WarningAction SilentlyContinue
$response = Invoke-DBPoolRequest -method Get -resource_Uri $requestPath -WarningAction SilentlyContinue -ErrorAction Stop
if ($null -ne $response) {
$response | ConvertFrom-Json -ErrorAction Stop
}
Expand Down Expand Up @@ -2971,8 +2983,8 @@ function Get-DBPoolUser {
#>


[CmdletBinding(DefaultParameterSetName = 'Self')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # PSScriptAnalyzer - ignore creation of a SecureString using plain text for the contents of this script file
[OutputType([PSCustomObject])]
param (
[Parameter(ParameterSetName = 'Self', Position = 0)]
Expand Down
8 changes: 4 additions & 4 deletions Datto.DBPool.API/0.2.0/en-US/Datto.DBPool.API-help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2466,7 +2466,7 @@ Invoke-DBPoolContainerAccess -Id '12345' -Username 'John.Doe' -GetAccess</dev:co
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="5" aliases="none">
<maml:name>DBPool_JSON_Conversion_Depth</maml:name>
<maml:name>jsonDepth</maml:name>
<maml:description>
<maml:para>Defines the depth of the JSON conversion for the 'data' parameter request body</maml:para>
</maml:description>
Expand All @@ -2475,7 +2475,7 @@ Invoke-DBPoolContainerAccess -Id '12345' -Username 'John.Doe' -GetAccess</dev:co
<maml:name>Int32</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>5</dev:defaultValue>
<dev:defaultValue>$DBPool_JSON_Conversion_Depth</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>allPages</maml:name>
Expand Down Expand Up @@ -2546,7 +2546,7 @@ Invoke-DBPoolContainerAccess -Id '12345' -Username 'John.Doe' -GetAccess</dev:co
<dev:defaultValue>None</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="5" aliases="none">
<maml:name>DBPool_JSON_Conversion_Depth</maml:name>
<maml:name>jsonDepth</maml:name>
<maml:description>
<maml:para>Defines the depth of the JSON conversion for the 'data' parameter request body</maml:para>
</maml:description>
Expand All @@ -2555,7 +2555,7 @@ Invoke-DBPoolContainerAccess -Id '12345' -Username 'John.Doe' -GetAccess</dev:co
<maml:name>Int32</maml:name>
<maml:uri />
</dev:type>
<dev:defaultValue>5</dev:defaultValue>
<dev:defaultValue>$DBPool_JSON_Conversion_Depth</dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="true" globbing="false" pipelineInput="False" position="named" aliases="none">
<maml:name>allPages</maml:name>
Expand Down
7 changes: 3 additions & 4 deletions docs/en-US/Invoke-DBPoolRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Internal function to make an API request to the DBPool API

```
Invoke-DBPoolRequest [[-method] <String>] [-resource_Uri] <String> [[-uri_Filter] <Hashtable>]
[[-data] <Hashtable>] [[-DBPool_JSON_Conversion_Depth] <Int32>] [-allPages] [<CommonParameters>]
[[-data] <Hashtable>] [[-jsonDepth] <Int32>] [-allPages] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -125,7 +125,7 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -DBPool_JSON_Conversion_Depth
### -jsonDepth
Defines the depth of the JSON conversion for the 'data' parameter request body
```yaml
Expand All @@ -135,7 +135,7 @@ Aliases:

Required: False
Position: 5
Default value: 5
Default value: $DBPool_JSON_Conversion_Depth
Accept pipeline input: False
Accept wildcard characters: False
```
Expand Down Expand Up @@ -176,4 +176,3 @@ N/A
## RELATED LINKS
[https://datto-dbpool-api.kentsapp.com/Internal/apiCalls/Invoke-DBPoolRequest/](https://datto-dbpool-api.kentsapp.com/Internal/apiCalls/Invoke-DBPoolRequest/)
3 changes: 1 addition & 2 deletions docs/site/Internal/apiCalls/Invoke-DBPoolRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ Invoke an API request against the defined resource using any of the provided par

Defines the type of API method to use

Allowed values:
'DEFAULT', 'DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'
Allowed values: 'DEFAULT', 'DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'

```yaml
Type: String
Expand Down
2 changes: 1 addition & 1 deletion src/Public/Users/Get-DBPoolUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ function Get-DBPoolUser {
#>


[CmdletBinding(DefaultParameterSetName = 'Self')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')] # PSScriptAnalyzer - ignore creation of a SecureString using plain text rule for function
[OutputType([PSCustomObject])]
param (
[Parameter(ParameterSetName = 'Self', Position = 0)]
Expand Down

0 comments on commit 641f07b

Please sign in to comment.