Skip to content

[Bug]: Invoke-DattoRequest function -uri_Filter parameter optional, but required in helper function ConvertTo-DattoQueryString #9

@cksapp

Description

@cksapp

What happened?

Ln:92 of Invoke-DattoRequest function has parameter $uri_Filter as mandatory parameter for helper function ConvertTo-DattoQueryString while the parameter is only optional in the main function.

$query_string = ConvertTo-DattoQueryString -uri_Filter $uri_Filter -resource_Uri $resource_Uri

Expected behavior?

In the process of developing the SaaS seatFilter branch it was discovered that seatType enum should be included in query parameters for new seat endpoint query filter

Based on this addition, required to pass in seatType parameter to Get-DattoSeat and equivalent Get-DattoSaaS -endpoint_CustomerSeats for optional seat query filter, so removed from $excludedParameters in ConvertTy-DattoQueryString

This leads to unintended consequence of new Set-DattoBulkSeatChange PUT function to now send API request to https://api.datto.com/v1/saas/123456/Classic:Office365:654321/bulkSeatChange?seatType=User with seatType parameter being included as query parameter /bulkSeatChange?seatType=User

Since the Set-DattoBulkSeatChange function is PUT this should not require any query parameters and currently does not have any listed.
Invoke-DattoRequest function lists $uri_Filter parameter as Mandatory = $false, so should be optional to pass in for helper function in ConvertTo-DattoQueryString

DattoRequest.ps1:92:64
Line |
  92 |  … y_string = ConvertTo-DattoQueryString -uri_Filter $uri_Filter -resour …
     |                                                      ~~~~~~~~~~~
     | Cannot bind argument to parameter 'uri_Filter' because it is null.

Possible Solution?

Made changes in main...cksapp:Datto-PowerShellWrapper:optionalParameter-uri_Filter

PowerShell Version

7.4.x - (PowerShell Core)

What operating system are you seeing the problem on?

Windows, Linux - Ubuntu\Debian

Relevant log output

DattoRequest.ps1:92:64
Line |
  92 |  … y_string = ConvertTo-DattoQueryString -uri_Filter $uri_Filter -resour …
     |                                                      ~~~~~~~~~~~
     | Cannot bind argument to parameter 'uri_Filter' because it is null.

Help Commands

$PSversionTable

Name                           Value
----                           -----
PSVersion                      7.4.6
PSEdition                      Core
GitCommitId                    7.4.6
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


Get-Package -Name DattoAPI | Select-Object Name,Version,Source,ProviderName
Get-ComputerInfo -Property @( 'OsName', 'OsVersion', 'OsOperatingSystemSKU', 'OSArchitecture', 'WindowsVersion', 'WindowsBuildLabEx', 'OsLanguage', 'OsMuiLanguages' )
```Powershell
OsName               : Microsoft Windows 10 Enterprise
OsVersion            : 10.0.19045
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions