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

add a -First option to Get-GSActivityReport #195

Closed
WJurecki opened this issue May 29, 2019 · 8 comments
Closed

add a -First option to Get-GSActivityReport #195

WJurecki opened this issue May 29, 2019 · 8 comments
Assignees

Comments

@WJurecki
Copy link
Contributor

When utilizing Get-GSActivityReport I would like to be able to limit the result set to a specified limit.

While simply using Get-GSActivityReport | Select-Object -First 50, for example, would limit the results to 50 items as desired, it requires all of the overhead of returning all results and then only selecting the first 50. By adding a -First option to Get-GSActivityReport the code could stop retrieving additional pages of results once the specified number has been received, thus reducing the time to obtain a final result set.

If, for example, I only wanted the first 50 objects I would simply use Get-GSActivityReport -First 50 -PageSize 50 which would return the entire set in one round-trip. If I only wanted to detect if ANY activity had happened I could use Get-GSActivityReport -First 1 -PageSize 1 which would result in one round-trip with the smallest possible result set.

@scrthq
Copy link
Member

scrthq commented May 29, 2019

Hey @WJurecki - Great idea! Checking it out!

@scrthq scrthq self-assigned this May 29, 2019
@scrthq
Copy link
Member

scrthq commented May 30, 2019

@WJurecki - Since this is pretty applicable to any of the other List functions, I POC'd it with Get-GSTeamDrive and it's working well. I opted for a parameter named Limit instead of First, but will add First as an alias to that parameter where applicable:

image

Green circled blocks shows the reduction of the page size when the next page is calculated to exceed the desired limit so that only the exact count desired are returned.

Blue circled blocks show the reduction of the page size when the first page is calculated to exceed the desired limit.

@scrthq
Copy link
Member

scrthq commented May 30, 2019

@WJurecki - Working well! Using your initial examples, for reference:

image

@scrthq
Copy link
Member

scrthq commented May 30, 2019

Bonus guardrails:

image

@scrthq
Copy link
Member

scrthq commented May 31, 2019

Sneak peak at the changelog so far for 2.28.0 with this request's additions highlighted 😃

image

scrthq added a commit that referenced this issue May 31, 2019
…, #197 (#198)

## 2.28.0

* [Issue #188](#188)
  * Added: `Get-GSDriveFile` now supports specifying a full file path.
  * Fixed: `Get-GSDriveFile` will now replace any special path characters in the filename with underscores
  * Added: The File object returned by `Get-GSDriveFile` will now include an additional `OutFilePath` property if the file is downloaded. This property will contain the full path to the downloaded file.
* [Issue #190](#190)
  * Fixed: `Fields` parameter on `Get-GSDriveFile` and `Update-GSDriveFile` were not being honored.
* [Issue #192](#192)
  * Added: Parameters to `Update-GSDriveFile`:
    * `CopyRequiresWriterPermission [switch]`
    * `Starred [switch]`
    * `Trashed [switch]`
    * `WritersCanShare [switch]`
* [Issue #194](#194)
  * Added: Parameters to `Update-GSChromeOSDevice`:
    * `AnnotatedAssetId [string]`
    * `AnnotatedLocation [string]`
    * `AnnotatedUser [string]`
    * `Notes [string]`
* [Issue #195](#195)
  * Added: `Limit` parameter with `First` alias to the following `List` functions:
    * `Get-GSActivityReport`
    * `Get-GSAdminRole`
    * `Get-GSAdminRoleAssignment`
    * `Get-GSCalendar`
    * `Get-GSCalendarAcl`
    * `Get-GSCalendarEvent`
    * `Get-GSChromeOSDevice`
    * `Get-GSDataTransferApplication`
    * `Get-GSDrive`
    * `Get-GSDriveFileList`
    * `Get-GSDrivePermission`
    * `Get-GSGmailMessageList`
    * `Get-GSGroup`
    * `Get-GSGroupMember`
    * `Get-GSMobileDevice`
    * `Get-GSResource`
    * `Get-GSTask`
    * `Get-GSTaskList`
    * `Get-GSUsageReport`
    * `Get-GSUser`
    * `Get-GSUserLicense`
* [Issue #196](#196)
  * Fixed: `Get-GSTeamDrive` was not paginating through the results.
* [Issue #197](#197)
  * Renamed: `Get-GSTeamDrive` has been changed to `Get-GSDrive`. `Get-GSTeamDrive` has been turned into an alias for `Get-GSDrive` to maintain backwards compatibility.
  * Replaced: `SupportsTeamDrives = $true` with `SupportsAllDrives = $true` on all functions that have it.
* Miscellaneous
  * Fixed: `Export-PSGSuiteConfig` is faster due to safely assuming that the P12Key and/or ClientSecrets values have already been pulled from the corresponding keys.
  * Fixed: Incomplete documentation for `Test-GSGroupMembership`.
  * Added: `UseDomainAdminAccess` switch parameter to `Get-GSTeamDrive`
  * Removed: `Get-GSUserLicenseListPrivate` by rolling the `List` code into `Get-GSUserLicense`
  * Removed: `Get-GSResourceListPrivate` by rolling the `List` code into `Get-GSResource`
scrthq added a commit that referenced this issue May 31, 2019
…, #197

## 2.28.0

* [Issue #188](#188)
  * Added: Get-GSDriveFile now supports specifying a full file path.
  * Fixed: Get-GSDriveFile will now replace any special path characters in the filename with underscores
  * Added: The File object returned by Get-GSDriveFile will now include an additional OutFilePath property if the file is downloaded. This property will contain the full path to the downloaded file.
* [Issue #190](#190)
  * Fixed: Fields parameter on Get-GSDriveFile and Update-GSDriveFile were not being honored.
* [Issue #192](#192)
  * Added: Parameters to Update-GSDriveFile:
    * CopyRequiresWriterPermission [switch]
    * Starred [switch]
    * Trashed [switch]
    * WritersCanShare [switch]
* [Issue #194](#194)
  * Added: Parameters to Update-GSChromeOSDevice:
    * AnnotatedAssetId [string]
    * AnnotatedLocation [string]
    * AnnotatedUser [string]
    * Notes [string]
* [Issue #195](#195)
  * Added: Limit parameter with First alias to the following List functions:
    * Get-GSActivityReport
    * Get-GSAdminRole
    * Get-GSAdminRoleAssignment
    * Get-GSCalendar
    * Get-GSCalendarAcl
    * Get-GSCalendarEvent
    * Get-GSChromeOSDevice
    * Get-GSDataTransferApplication
    * Get-GSDrive
    * Get-GSDriveFileList
    * Get-GSDrivePermission
    * Get-GSGmailMessageList
    * Get-GSGroup
    * Get-GSGroupMember
    * Get-GSMobileDevice
    * Get-GSResource
    * Get-GSTask
    * Get-GSTaskList
    * Get-GSUsageReport
    * Get-GSUser
    * Get-GSUserLicense
* [Issue #196](#196)
  * Fixed: Get-GSTeamDrive was not paginating through the results.
* [Issue #197](#197)
  * Renamed: Get-GSTeamDrive has been changed to Get-GSDrive. Get-GSTeamDrive has been turned into an alias for Get-GSDrive to maintain backwards compatibility.
  * Replaced: SupportsTeamDrives = True with SupportsAllDrives = True on all functions that have it.
* Miscellaneous
  * Fixed: Export-PSGSuiteConfig is faster due to safely assuming that the P12Key and/or ClientSecrets values have already been pulled from the corresponding keys.
  * Fixed: Incomplete documentation for Test-GSGroupMembership.
  * Added: UseDomainAdminAccess switch parameter to Get-GSTeamDrive
  * Removed: Get-GSUserLicenseListPrivate by rolling the List code into Get-GSUserLicense
  * Removed: Get-GSResourceListPrivate by rolling the List code into Get-GSResource
@scrthq
Copy link
Member

scrthq commented May 31, 2019

Hey @WJurecki - This has been deployed in v2.28.0! Let me know if all is well or if you are seeing any issues!

@WJurecki
Copy link
Contributor Author

@scrthq - Looks great. I've tried it a few times and looks to work well. I'll let you know if I run into any problems. Thanks again

@scrthq
Copy link
Member

scrthq commented May 31, 2019

Perfect! Thanks, @WJurecki !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants