Added option showdeleted [<Boolean>]' to gam <UserTypeEntity> print|show chatmessages`.

Updated commands that call the Reports API (including `gam info domain`) to handle a change
in the Reports API that generated the following warning:
```
WARNING: End date greater than LastReportedDate.
This commit is contained in:
Ross Scroggs
2023-09-07 09:03:00 -07:00
parent ed62abe464
commit c30931545f
6 changed files with 54 additions and 21 deletions

View File

@@ -10,6 +10,16 @@ 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. See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation.
### 6.63.12
Updated commands that call the Reports API (including `gam info domain`) to handle a change
in the Reports API that generated the following warning:
```
WARNING: End date greater than LastReportedDate.
```
Added option `showdeleted [<Boolean>]' to `gam <UserTypeEntity> print|show chatmessages`.
### 6.63.11 ### 6.63.11
Added option `ou_and_children <OrgUnitItem>` to `gam print|show crostelemetry` to simplify getting Added option `ou_and_children <OrgUnitItem>` to `gam print|show crostelemetry` to simplify getting

View File

@@ -330,7 +330,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$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version 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 WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.10.8 64-bit final Python 3.10.8 64-bit final
MacOS High Sierra 10.13.6 x86_64 MacOS High Sierra 10.13.6 x86_64
@@ -972,7 +972,7 @@ writes the credentials into the file oauth2.txt.
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
Windows-10-10.0.17134 AMD64 Windows-10-10.0.17134 AMD64

View File

@@ -3,7 +3,7 @@
Print the current version of Gam with details Print the current version of Gam with details
``` ```
gam version gam version
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
MacOS Monterey 12.6.6 x86_64 MacOS Monterey 12.6.6 x86_64
@@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00
Print the current version of Gam with details and time offset information Print the current version of Gam with details and time offset information
``` ```
gam version timeoffset gam version timeoffset
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
MacOS Monterey 12.6.6 x86_64 MacOS Monterey 12.6.6 x86_64
@@ -27,7 +27,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 Print the current version of Gam with extended details and SSL information
``` ```
gam version extended gam version extended
GAMADV-XTD3 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource GAMADV-XTD3 6.63.12 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
MacOS Monterey 12.6.6 x86_64 MacOS Monterey 12.6.6 x86_64
@@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3 Path: /Users/Admin/bin/gamadv-xtd3
Version Check: Version Check:
Current: 5.35.08 Current: 5.35.08
Latest: 6.63.11 Latest: 6.63.12
echo $? echo $?
1 1
``` ```
@@ -72,7 +72,7 @@ echo $?
Print the current version number without details Print the current version number without details
``` ```
gam version simple gam version simple
6.63.11 6.63.12
``` ```
In Linux/MacOS you can do: In Linux/MacOS you can do:
``` ```
@@ -82,7 +82,7 @@ echo $VER
Print the current version of Gam and address of this Wiki Print the current version of Gam and address of this Wiki
``` ```
gam help gam help
GAM 6.63.11 - https://github.com/taers232c/GAMADV-XTD3 GAM 6.63.12 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com> Ross Scroggs <ross.scroggs@gmail.com>
Python 3.11.5 64-bit final Python 3.11.5 64-bit final
MacOS Monterey 12.6.6 x86_64 MacOS Monterey 12.6.6 x86_64

View File

@@ -5780,10 +5780,10 @@ gam <UserTypeEntity> delete chatmessage name <ChatMessage>
gam <UserTypeEntity> info chatmessage name <ChatMessage> gam <UserTypeEntity> info chatmessage name <ChatMessage>
[formatjson] [formatjson]
gam <UserTypeEntity> show chatmessages <ChatSpace> gam <UserTypeEntity> show chatmessages <ChatSpace>
[filter <String>] [showdeleted [<Boolean>]] [filter <String>]
[formatjson] [formatjson]
gam <UserTypeEntity> print chatmessages [todrive <ToDriveAttribute>*] <ChatSpace> gam <UserTypeEntity> print chatmessages [todrive <ToDriveAttribute>*] <ChatSpace>
[filter <String>] [showdeleted [<Boolean>]] [filter <String>]
[formatjson [quotechar <Character>]] [formatjson [quotechar <Character>]]
# Users - Data Studuo # Users - Data Studuo

View File

@@ -2,6 +2,16 @@
Merged GAM-Team version Merged GAM-Team version
6.63.12
Updated commands that call the Reports API (including `gam info domain`) to handle a change
in the Reports API that generated the following warning:
```
WARNING: End date greater than LastReportedDate.
```
Added option `showdeleted [<Boolean>]' to `gam <UserTypeEntity> print|show chatmessages`.
6.63.11 6.63.11
Added option `ou_and_children <OrgUnitItem>` to `gam print|show crostelemetry` to simplify getting Added option `ou_and_children <OrgUnitItem>` to `gam print|show crostelemetry` to simplify getting

View File

@@ -12479,14 +12479,23 @@ def doWhatIs():
entityUnknownWarning(Ent.EMAIL, email) entityUnknownWarning(Ent.EMAIL, email)
setSysExitRC(ENTITY_IS_UKNOWN_RC) setSysExitRC(ENTITY_IS_UKNOWN_RC)
def _adjustTryDate(errMsg, noDateChange): def _adjustTryDate(errMsg, noDateChange, prevTryDate):
match_date = re.match('Data for dates later than (.*) is not yet available. Please check back later', errMsg) match_date = re.match('Data for dates later than (.*) is not yet available. Please check back later', errMsg)
if not match_date: if match_date:
tryDate = match_date.group(1)
else:
match_date = re.match('Start date can not be later than (.*)', errMsg) match_date = re.match('Start date can not be later than (.*)', errMsg)
if match_date:
tryDate = match_date.group(1)
else:
match_date = re.match('End date greater than LastReportedDate.', errMsg)
if match_date:
tryDateTime = datetime.datetime.strptime(prevTryDate, YYYYMMDD_FORMAT)-datetime.timedelta(days=1)
tryDate = tryDateTime.strftime(YYYYMMDD_FORMAT)
if (not match_date) or noDateChange: if (not match_date) or noDateChange:
printWarningMessage(DATA_NOT_AVALIABLE_RC, errMsg) printWarningMessage(DATA_NOT_AVALIABLE_RC, errMsg)
return None return None
return match_date.group(1) return tryDate
def _checkDataRequiredServices(result, tryDate, dataRequiredServices, parameterServices=None, checkUserEmail=False): def _checkDataRequiredServices(result, tryDate, dataRequiredServices, parameterServices=None, checkUserEmail=False):
# -1: Data not available: # -1: Data not available:
@@ -12594,7 +12603,7 @@ def doReportUsageParameters():
printErrorMessage(BAD_REQUEST_RC, Msg.BAD_REQUEST) printErrorMessage(BAD_REQUEST_RC, Msg.BAD_REQUEST)
return return
except GAPI.invalid as e: except GAPI.invalid as e:
tryDate = _adjustTryDate(str(e), False) tryDate = _adjustTryDate(str(e), False, tryDate)
if not tryDate: if not tryDate:
break break
for parameter in sorted(allParameters): for parameter in sorted(allParameters):
@@ -13373,7 +13382,7 @@ def doReport():
if not status: if not status:
break break
except GAPI.invalid as e: except GAPI.invalid as e:
tryDate = _adjustTryDate(str(e), noDateChange) tryDate = _adjustTryDate(str(e), noDateChange, tryDate)
if not tryDate: if not tryDate:
break break
startDateTime = endDateTime = datetime.datetime.strptime(tryDate, YYYYMMDD_FORMAT) startDateTime = endDateTime = datetime.datetime.strptime(tryDate, YYYYMMDD_FORMAT)
@@ -13450,7 +13459,7 @@ def doReport():
if not status: if not status:
break break
except GAPI.invalid as e: except GAPI.invalid as e:
tryDate = _adjustTryDate(str(e), noDateChange) tryDate = _adjustTryDate(str(e), noDateChange, tryDate)
if not tryDate: if not tryDate:
break break
startDateTime = endDateTime = datetime.datetime.strptime(tryDate, YYYYMMDD_FORMAT) startDateTime = endDateTime = datetime.datetime.strptime(tryDate, YYYYMMDD_FORMAT)
@@ -15338,7 +15347,7 @@ def _showCustomerLicenseInfo(customerInfo, FJQC):
continue continue
break break
except GAPI.invalid as e: except GAPI.invalid as e:
tryDate = _adjustTryDate(str(e), False) tryDate = _adjustTryDate(str(e), False, tryDate)
if not tryDate: if not tryDate:
return return
continue continue
@@ -25265,10 +25274,10 @@ def doInfoChatMessage():
infoChatMessage([None]) infoChatMessage([None])
# gam <UserTypeEntity> show chatmessages <ChatSpace> # gam <UserTypeEntity> show chatmessages <ChatSpace>
# [filter <String>] # [showdeleted [<Boolean>]] [filter <String>]
# [formatjson] # [formatjson]
# gam <UserTypeEntity> print chatmessages [todrive <ToDriveAttribute>*] <ChatSpace>i # gam <UserTypeEntity> print chatmessages [todrive <ToDriveAttribute>*] <ChatSpace>i
# [filter <String>] # [showdeleted [<Boolean>]] [filter <String>]
# [formatjson [quotechar <Character>]] # [formatjson [quotechar <Character>]]
def printShowChatMessages(users): def printShowChatMessages(users):
def _printChatMessage(user, message): def _printChatMessage(user, message):
@@ -25289,12 +25298,15 @@ def printShowChatMessages(users):
csvPF = CSVPrintFile(['User', 'name'] if not isinstance(users, list) else ['name']) if Act.csvFormat() else None csvPF = CSVPrintFile(['User', 'name'] if not isinstance(users, list) else ['name']) if Act.csvFormat() else None
FJQC = FormatJSONQuoteChar(csvPF) FJQC = FormatJSONQuoteChar(csvPF)
parent = pfilter = None parent = pfilter = None
showDeleted = False
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
myarg = getArgument() myarg = getArgument()
if csvPF and myarg == 'todrive': if csvPF and myarg == 'todrive':
csvPF.GetTodriveParameters() csvPF.GetTodriveParameters()
elif myarg == 'space' or myarg.startswith('spaces/'): elif myarg == 'space' or myarg.startswith('spaces/'):
parent = getChatSpace(myarg) parent = getChatSpace(myarg)
elif myarg == 'showdeleted':
showDeleted = getBoolean()
elif myarg =='filter': elif myarg =='filter':
pfilter = getString(Cmd.OB_STRING) pfilter = getString(Cmd.OB_STRING)
else: else:
@@ -25314,9 +25326,10 @@ def printShowChatMessages(users):
messages = callGAPIpages(chat.spaces().messages(), 'list', 'messages', messages = callGAPIpages(chat.spaces().messages(), 'list', 'messages',
pageMessage=_getChatPageMessage(Ent.CHAT_MESSAGE, user, i, count, qfilter), pageMessage=_getChatPageMessage(Ent.CHAT_MESSAGE, user, i, count, qfilter),
throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED], throwReasons=[GAPI.NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED],
pageSize=CHAT_PAGE_SIZE, parent=parent, filter=pfilter) pageSize=CHAT_PAGE_SIZE, parent=parent, filter=pfilter, showDeleted=showDeleted)
for message in messages: for message in messages:
_getChatSenderEmail(cd, message['sender']) if 'sender' in message:
_getChatSenderEmail(cd, message['sender'])
except (GAPI.notFound, GAPI.invalidArgument, GAPI.permissionDenied) as e: except (GAPI.notFound, GAPI.invalidArgument, GAPI.permissionDenied) as e:
exitIfChatNotConfigured(chat, kvList, str(e), i, count) exitIfChatNotConfigured(chat, kvList, str(e), i, count)
continue continue