From 29ceda7f430fd3d1ca9cb4185f238b105bddc3cf Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Wed, 10 Jan 2024 11:38:19 -0800 Subject: [PATCH] Added option `addcsvdata ` to `gam print datatransfers` --- docs/Aliases.md | 3 +++ docs/GamUpdates.md | 5 +++++ docs/Google-Data-Transfers.md | 3 +++ docs/How-to-Upgrade-from-Standard-GAM.md | 4 ++-- docs/Version-and-Help.md | 12 ++++++------ src/GamCommands.txt | 1 + src/GamUpdate.txt | 5 +++++ src/gam/__init__.py | 7 +++++++ 8 files changed, 32 insertions(+), 8 deletions(-) diff --git a/docs/Aliases.md b/docs/Aliases.md index 7aa0fa6d..d99e98ec 100644 --- a/docs/Aliases.md +++ b/docs/Aliases.md @@ -129,6 +129,9 @@ By default, the aliases in a list are separated by the `csv_output_field_delimit Specifying both `onerowpertarget` and `suppressnoaliasrows` causes GAM to not display any targets that have no aliases. +Add additional columns of data from the command line to the output +* `addcsvdata ` + When multiple domains are specified and a query/queries are specified, an API call is made for each domain/query combination. ``` $ gam print aliases domains school.org,students.school.org queries "'email:admin*','email:test*'" diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index 5bdd0c6a..f3f27576 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -11,6 +11,11 @@ Add the `-s` option to the end of the above commands to suppress creating the `g See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation +### 6.67.12 + +Added option `addcsvdata ` to `gam print datatransfers` that adds +additional columns of data to the CSV file output. + ### 6.67.11 Updated various Gmail related commands to handle this error: diff --git a/docs/Google-Data-Transfers.md b/docs/Google-Data-Transfers.md index ff4a21f0..4c459429 100644 --- a/docs/Google-Data-Transfers.md +++ b/docs/Google-Data-Transfers.md @@ -63,6 +63,7 @@ gam show datatransfers|transfers gam print datatransfers|transfers [todrive *] [olduser|oldowner ] [newuser|newowner ] [status completed|failed|inprogress|] [delimiter ] + (addcsvdata )* ``` By default, all data transfer operations are printed, use these options to select specific transfers. * `olduser|oldowner ` @@ -72,3 +73,5 @@ By default, all data transfer operations are printed, use these options to selec By default, the entries in lists of items are separated by the `csv_output_field_delimiter` from `gam.cfg`. * `delimiter ` - Separate list items with `` +Add additional columns of data from the command line to the output +* `addcsvdata ` diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index f5d045af..929604d1 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt. admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found -GAMADV-XTD3 6.67.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.1 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -1002,7 +1002,7 @@ writes the credentials into the file oauth2.txt. C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>gam version WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found -GAMADV-XTD3 6.67.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.1 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index fd3b4263..3448f61b 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -4,7 +4,7 @@ Print the current version of Gam with details ``` gam version -GAMADV-XTD3 6.67.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.1 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -16,7 +16,7 @@ Time: 2023-06-02T21:10:00-07:00 Print the current version of Gam with details and time offset information ``` gam version timeoffset -GAMADV-XTD3 6.67.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.1 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -28,7 +28,7 @@ Your system time differs from www.googleapis.com by less than 1 second Print the current version of Gam with extended details and SSL information ``` gam version extended -GAMADV-XTD3 6.67.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.1 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64 Path: /Users/Admin/bin/gamadv-xtd3 Version Check: Current: 5.35.08 - Latest: 6.67.11 + Latest: 6.67.12 echo $? 1 ``` @@ -73,7 +73,7 @@ echo $? Print the current version number without details ``` gam version simple -6.67.11 +6.67.12 ``` In Linux/MacOS you can do: ``` @@ -83,7 +83,7 @@ echo $VER Print the current version of Gam and address of this Wiki ``` gam help -GAM 6.67.11 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.67.12 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.12.1 64-bit final MacOS Sonoma 14.2.1 x86_64 diff --git a/src/GamCommands.txt b/src/GamCommands.txt index 5d12b8c5..fc1d8454 100644 --- a/src/GamCommands.txt +++ b/src/GamCommands.txt @@ -3140,6 +3140,7 @@ gam info datatransfer|transfer gam print datatransfers|transfers [todrive *] [olduser|oldowner ] [newuser|newowner ] [status completed|failed|inprogress] [delimiter ] + (addcsvdata )* gam show datatransfers|transfers [olduser|oldowner ] [newuser|newowner ] [status completed|failed|inprogress] [delimiter ] diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 5569d615..3673338b 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,11 @@ Merged GAM-Team version +6.67.12 + +Added option `addcsvdata ` to `gam print datatransfers` that adds +additional columns of data to the CSV file output. + 6.67.11 Updated various Gmail related commands to handle this error: diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 248d6a77..00267c55 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -16426,6 +16426,7 @@ DATA_TRANSFER_SORT_TITLES = ['id', 'requestTime', 'oldOwnerUserEmail', 'newOwner # gam print datatransfers|transfers [todrive *] # [olduser|oldowner ] [newuser|newowner ] # [status ] [delimiter ]] +# (addcsvdata )* # gam show datatransfers|transfers # [olduser|oldowner ] [newuser|newowner ] # [status ] [delimiter ]] @@ -16437,6 +16438,7 @@ def doPrintShowDataTransfers(): status = None csvPF = CSVPrintFile(['id'], DATA_TRANSFER_SORT_TITLES) if Act.csvFormat() else None delimiter = GC.Values[GC.CSV_OUTPUT_FIELD_DELIMITER] + addCSVData = {} while Cmd.ArgumentsRemaining(): myarg = getArgument() if csvPF and myarg == 'todrive': @@ -16449,6 +16451,9 @@ def doPrintShowDataTransfers(): status = getChoice(DATA_TRANSFER_STATUS_MAP, mapChoice=True) elif myarg == 'delimiter': delimiter = getCharacter() + elif myarg == 'addcsvdata': + k = getString(Cmd.OB_STRING) + addCSVData[k] = getString(Cmd.OB_STRING, minLen=0) else: unknownArgumentExit() try: @@ -16475,6 +16480,8 @@ def doPrintShowDataTransfers(): row['oldOwnerUserEmail'] = convertUserIDtoEmail(transfer['oldOwnerUserId']) row['newOwnerUserEmail'] = convertUserIDtoEmail(transfer['newOwnerUserId']) row['overallTransferStatusCode'] = transfer['overallTransferStatusCode'] + if addCSVData: + row.update(addCSVData) for app in transfer['applicationDataTransfers']: xrow = row.copy() xrow['application'] = _convertTransferAppIDtoName(apps, app['applicationId'])