Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
cksapp opened this issue Jan 1, 2025 · 0 comments · May be fixed by #10
Assignees

Comments

@cksapp
Copy link
Contributor

cksapp commented Jan 1, 2025

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
@cksapp cksapp linked a pull request Jan 1, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants