This commit is contained in:
Jay Lee
2023-07-25 15:46:08 +00:00
4 changed files with 120 additions and 43 deletions

View File

@ -426,6 +426,13 @@ jobs:
"${PYTHON}" -m pip install --upgrade wheel
"${PYTHON}" -m pip install --upgrade setuptools
- name: ToT Google Auth for Python 3.12
if: matrix.python == '3.12'
run: |
# This can be removed once google-auth 2.23+ is out
# and removes six deps
"${PYTHON}" -m pip install --upgrade --force git+https://github.com/googleapis/google-auth-library-python@main
- name: Install pip requirements
run: |
echo "before anything..."
@ -619,6 +626,7 @@ jobs:
$gam config customer_id "C03uzfv2s" save
$gam config domain "pdl.jaylee.us" save
$gam config admin_email "${gam_user}" save
$gam config enable_dasa false save
$gam oauth info
$gam oauth refresh
$gam config enable_dasa true save
@ -704,9 +712,9 @@ jobs:
$gam user $gam_user draftemail subject "GHA draft $newbase" message "Draft message test"
$gam csvfile sample.csv:email waitformailbox
$gam user $newuser delegate to "${newbase}-bulkuser-1"
$gam users "$gam_user $newbase-bulkuser-1 $newbase-bulkuser-2 $newbase-bulkuser-3" delete messages query in:anywhere maxtodelete 99999 doit
$gam users "$newbase-bulkuser-4 $newbase-bulkuser-5 $newbase-bulkuser-6" trash messages query in:anywhere maxtotrash 99999 doit
$gam users "$newbase-bulkuser-7 $newbase-bulkuser-8 $newbase-bulkuser-9" modify messages query in:anywhere maxtomodify 99999 addlabel IMPORTANT addlabel STARRED doit
$gam users "$gam_user $newbase-bulkuser-1 $newbase-bulkuser-2 $newbase-bulkuser-3" delete messages query in:anywhere maxtodelete 99999 doit || if [ $? != 60 ]; then exit $?; fi # expect a 60 return code (no messages)
$gam users "$newbase-bulkuser-4 $newbase-bulkuser-5 $newbase-bulkuser-6" trash messages query in:anywhere maxtotrash 99999 doit || if [ $? != 60 ]; then exit $?; fi # expect a 60 return code (no messages)
$gam users "$newbase-bulkuser-7 $newbase-bulkuser-8 $newbase-bulkuser-9" modify messages query in:anywhere maxtomodify 99999 addlabel IMPORTANT addlabel STARRED doit || if [ $? != 60 ]; then exit $?; fi # expect a 60 return code (no messages)
$gam user $newuser delete label --ALL_LABELS--
$gam config csv_output_row_filter "name:regex:gha-test-${JID}" print features | $gam csv - gam delete feature ~name
$gam create feature name VC-$newbase
@ -716,18 +724,16 @@ jobs:
$gam info resource $newresource
$gam user $newuser add drivefile drivefilename "TPS Reports" mimetype gfolder
$gam user $newuser show filelist
$gam calendar $gam_user printacl | $gam csv - gam calendar $gam_user delete id ~id # clear ACLs
$gam calendar $gam_user printacl | $gam csv - gam calendar $gam_user delete ~id # clear ACLs
$gam calendar $gam_user add read domain
$gam calendar $gam_user add freebusy default
$gam calendar $gam_user add editor $newuser
$gam calendar $gam_user showacl
$gam calendar $gam_user printacl | $gam csv - gam calendar $gam_user delete ~id
starttime=$($PYTHON -c "import datetime; print((datetime.datetime.now() + datetime.timedelta(hours=1)).strftime('%Y-%m-%dT%H:%M:%S.%f+00:00'))")
endtime=$($PYTHON -c "import datetime; print((datetime.datetime.now() + datetime.timedelta(hours=2)).strftime('%Y-%m-%dT%H:%M:%S.%f+00:00'))")
$gam calendar $gam_user addevent summary "GHA test event" start "${starttime}" end "${endtime}" attendee $newgroup hangoutsmeet guestscanmodify true sendupdates all
$gam calendar $gam_user addevent summary "GHA test event" start +1h end +2h attendee $newgroup hangoutsmeet guestscanmodify true sendupdates all
$gam calendar $gam_user printevents after -0d
$gam config enable_dasa false save
matterid=uid:$($gam create vaultmatter name "GHA matter $newbase" description "test matter" collaborators $newuser | head -1 | cut -d ' ' -f 3)
matterid=uid:$($gam create vaultmatter name "GHA matter $newbase" description "test matter" collaborators $newuser returnidonly)
$gam create vaulthold matter $matterid name "GHA hold $newbase" corpus mail accounts $newuser
$gam print vaultmatters matterstate open
$gam print vaultholds matter $matterid
@ -746,7 +752,7 @@ jobs:
$gam user $newuser delete license workspaceenterpriseplus
echo finish
$gam config enable_dasa true save
$gam whatis $newuser
$gam whatis $newuser || if [ $? != 20 ]; then exit $?; fi # expect a 20 return code (is a user)
$gam user $gam_user show tokens
$gam config enable_dasa false save
$gam print exports matter $matterid | $gam csv - gam download export $matterid id:~~id~~
@ -769,7 +775,8 @@ jobs:
$gam report usageparameters customer
$gam report usage customer parameters gmail:num_emails_sent,accounts:num_1day_logins
$gam report customer todrive
$gam report users fields accounts:is_less_secure_apps_access_allowed,gmail:last_imap_time,gmail:last_pop_time filters "accounts:last_login_time>2019-01-01T00:00:00.000Z" todrive
#$gam report users fields accounts:is_less_secure_apps_access_allowed,gmail:last_imap_time,gmail:last_pop_time filters "accounts:last_login_time>2019-01-01T00:00:00.000Z" todrive
$gam report users todrive
$gam report admin start -3d todrive
$gam print devices nopersonaldevices nodeviceusers filter "serial:$JID$JID$JID$JID-" | $gam csv - gam delete device id ~name
$gam config enable_dasa false save
@ -779,7 +786,7 @@ jobs:
$gam create caalevel "zzz_${newbase}" basic condition ipsubnetworks 1.1.1.1/32,2.2.2.2/32 endcondition
$gam print caalevels
$gam delete caalevel "zzz_${newbase}"
driveid=$($gam user $gam_user add shareddrive "${newbase}" | awk '{print $NF}')
driveid=$($gam user $gam_user add shareddrive "${newbase}" returnidonly)
echo "Created shared drive ${driveid}"
$gam user $gam_user add drivefile localfile gam.py parentid "${driveid}"
$gam user $gam_user update shareddrive "${driveid}" ou "${newou}"
@ -794,7 +801,7 @@ jobs:
$gam delete inboundssoprofile "id:${ssoprofile}"
$gam print printermodels | wc -l
$gam print printers
printerid=$($gam create printer displayname "${newbase}" uri ipp://localhost:631 driverless description "made by $(gam_user)" ou "${newou}" | grep 'id: [a-z,0-9]*$' | cut -d' ' -f3)
printerid=$($gam create printer displayname "${newbase}" uri ipp://localhost:631 driverless description "made by $(gam_user)" ou "${newou}" nodetails | awk '{print substr($2, 1, length($2)-1)}')
$gam info printer "$printerid"
$gam delete printer "$printerid"
$gam delete ou "${newou}"

View File

@ -1460,6 +1460,17 @@ gam print alias|aliases [todrive <ToDriveAttribute>*]
gam whatis <EmailItem> [noinfo] [noinivitablecheck]
# Analytics UA
gam <UserTypeEntity> print analyticuaproperties [todrive <ToDriveAttribute>*]
accountid [accounts/]<String>
[maxresults <Integer>]
[formatjson [quotechar <Character>]]
gam <UserTypeEntity> show analyticuaproperties
accountid [accounts/]<String>
[maxresults <Integer>]
[formatjson]
# Analytics Admin
gam <UserTypeEntity> print analyticaccounts [todrive <ToDriveAttribute>*]
@ -4785,7 +4796,7 @@ gam <UserTypeEntity> show teamdriveacls
gam create|add vaultmatter|matter [name <String>] [description <string>]
[collaborator|collaborators <EmailItemList>] [sendemails <Boolean>] [ccme <Boolean>]
[showdetails]
[showdetails|returnidonly]
gam update vaultmatter|matter <MatterItem> [name <String>] [description <string>]
[addcollaborator|addcollaborators <EmailItemList>] [removecollaborator|removecollaborators <EmailItemList>]
gam update vaultmatter|matter <MatterItem> action close|reopen|delete|undelete
@ -4834,7 +4845,7 @@ gam create vaultexport|export matter <MatterItem> [name <String>] corpus drive|m
[showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>]
[includerooms <Boolean>] [covereddata calllogs|textmessages|voicemails]
[includeshareddrives|includeteamdrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
[region any|europe|us] [showdetails]
[region any|europe|us] [showdetails|returnidonly]
gam delete vaultexport|export <ExportItem> matter <MatterItem>
gam delete vaultexport|export <MatterItem> <ExportItem>
gam download vaultexport|export <ExportItem> matter <MatterItem>
@ -4894,7 +4905,7 @@ gam create vaulthold|hold matter <MatterItem> [name <String>] corpus drive|mail|
[terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
[includerooms <Boolean>] [covereddata calllogs|textmessages|voicemails]
[includeshareddrives|includeteamdrives <Boolean>]
[showdetails]
[showdetails|returnidonly]
gam update vaulthold|hold <HoldItem> matter <MatterItem>
[([addaccounts|addgroups|addusers <EmailItemList>] [removeaccounts|removegroups|removeusers <EmailItemList>]) | (orgunit|org|ou <OrgUnit>)]
[query <QueryVaultCorpus>]

View File

@ -2,6 +2,34 @@
Merged GAM-Team version
6.61.13
Added commands to display Analytic UA properties.
```
gam <UserTypeEntity> print analyticuaproperties [todrive <ToDriveAttribute>*]
accountid [accounts/]<String>
[maxresults <Integer>]
[formatjson [quotechar <Character>]]
gam <UserTypeEntity> show analyticuaproperties
accountid [accounts/]<String>
[maxresults <Integer>]
[formatjson]
```
6.61.12
Updated `gam print|show vaultexports|vaultholds|vaultqueries` to handle the case
where a vault matter changes state from `OPEN` to `CLOSED|DELETED` while the command is being processed.
6.61.11
Added option `returnidonly` to `gam create vaultexport|vaulthold|vaultmatter`
that causes GAM to return just the ID of the item created as output.
6.61.10
Fixed bug in `gam oauth create admin <EmailAddress>` which caused no scopes to be selected.
6.61.09
Updated `gam oauth create` to handle case where Google takes a very long time to respond

View File

@ -14823,7 +14823,7 @@ def printShowAnalyticItems(users, entityType):
elif entityType == Ent.ANALYTIC_PROPERTY and myarg == 'filter':
kwargs['filter'] = getString(Cmd.OB_STRING)
elif entityType == Ent.ANALYTIC_UA_PROPERTY and myarg == 'accountid':
kwargs['accountId'] = getString(Cmd.OB_STRING)
kwargs['accountId'] = getString(Cmd.OB_STRING).replace('accounts/', '')
elif entityType == Ent.ANALYTIC_DATASTREAM and myarg == 'parent':
kwargs['parent'] = getString(Cmd.OB_STRING)
else:
@ -14935,11 +14935,11 @@ def printShowAnalyticProperties(users):
printShowAnalyticItems(users, Ent.ANALYTIC_PROPERTY)
# gam <UserTypeEntity> print analyticuaproperties [todrive <ToDriveAttribute>*]
# accountid <String>
# accountid [accounts/]<String>
# [maxresults <Integer>]
# [formatjson [quotechar <Character>]]
# gam <UserTypeEntity> show analyticuaproperties
# accountid <String>
# accountid [accounts/]<String>
# [maxresults <Integer>]
# [formatjson]
def printShowAnalyticUAProperties(users):
@ -36752,9 +36752,17 @@ def getMatterItem(v, state=None):
matterId, _, matterNameId, _ = convertMatterNameToID(v, getString(Cmd.OB_MATTER_ITEM), state=state)
return (matterId, matterNameId)
def warnMatterNotOpen(matter, matterNameId, j, jcount):
def warnMatterNotOpen(v, matter, matterNameId, j, jcount):
if v is not None:
try:
matter['state'] = callGAPI(v.matters(), 'get',
throwReasons=[GAPI.NOT_FOUND, GAPI.FORBIDDEN],
matterId=matter['matterId'], view='BASIC', fields='state')['state']
except (GAPI.notFound, GAPI.forbidden):
matter['state'] = 'Unknown'
printWarningMessage(DATA_NOT_AVALIABLE_RC, formatKeyValueList('',
Ent.FormatEntityValueList([Ent.VAULT_MATTER, matterNameId])+[Msg.MATTER_NOT_OPEN.format(matter['state'])],
Ent.FormatEntityValueList([Ent.VAULT_MATTER, matterNameId])+
[Msg.MATTER_NOT_OPEN.format(matter['state'])],
currentCount(j, jcount)))
def _cleanVaultExport(export, cd):
@ -36895,14 +36903,14 @@ def _validateVaultQuery(query):
# [includerooms <Boolean>]
# [covereddata calllogs|textmessages|voicemails]
# [includeshareddrives|includeteamdrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
# [region any|europe|us] [showdetails]
# [region any|europe|us] [showdetails|returnidonly]
def doCreateVaultExport():
v = buildGAPIObject(API.VAULT)
matterId = None
body = {'query': {'dataScope': 'ALL_DATA'}, 'exportOptions': {}}
exportFormat = 'MBOX'
showConfidentialModeContent = None
showDetails = False
returnIdOnly = showDetails = False
useNewExport = None
while Cmd.ArgumentsRemaining():
myarg = getArgument()
@ -36927,6 +36935,10 @@ def doCreateVaultExport():
body['exportOptions'].setdefault('voiceOptions', {})['coveredData'] = getChoice(VAULT_VOICE_COVERED_DATA_MAP, mapChoice=True)
elif myarg == 'showdetails':
showDetails = True
returnIdOnly = False
elif myarg == 'returnidonly':
returnIdOnly = True
showDetails = False
else:
unknownArgumentExit()
if not matterId:
@ -36950,9 +36962,12 @@ def doCreateVaultExport():
throwReasons=[GAPI.ALREADY_EXISTS, GAPI.BAD_REQUEST, GAPI.BACKEND_ERROR, GAPI.INVALID_ARGUMENT,
GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN, GAPI.QUOTA_EXCEEDED],
matterId=matterId, body=body)
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_EXPORT, formatVaultNameId(export['name'], export['id'])])
if showDetails:
_showVaultExport(None, export, None, None)
if not returnIdOnly:
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_EXPORT, formatVaultNameId(export['name'], export['id'])])
if showDetails:
_showVaultExport(None, export, None, None)
else:
writeStdout(f'{export["id"]}\n')
except (GAPI.alreadyExists, GAPI.badRequest, GAPI.backendError, GAPI.invalidArgument,
GAPI.failedPrecondition, GAPI.forbidden, GAPI.quotaExceeded) as e:
entityActionFailedWarning([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_EXPORT, body.get('name')], str(e))
@ -37128,13 +37143,13 @@ def doPrintShowVaultExports():
throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN],
matterId=matterId, fields=fields)
except GAPI.failedPrecondition:
warnMatterNotOpen(matter, matterNameId, j, jcount)
warnMatterNotOpen(v, matter, matterNameId, j, jcount)
continue
except GAPI.forbidden as e:
entityActionFailedWarning([Ent.VAULT_EXPORT, None], str(e))
break
else:
warnMatterNotOpen(matter, matterNameId, j, jcount)
warnMatterNotOpen(None, matter, matterNameId, j, jcount)
continue
kcount = len(exports)
if not csvPF:
@ -37467,14 +37482,14 @@ def _setHoldQuery(body, queryParameters):
# [includerooms <Boolean>]
# [covereddata calllogs|textmessages|voicemails]
# [includeshareddrives|includeteamdrives <Boolean>]
# [showdetails]
# [showdetails|returnidonly]
def doCreateVaultHold():
v = buildGAPIObject(API.VAULT)
body = {}
matterId = None
accounts = []
queryParameters = {}
showDetails = False
returnIdOnly = showDetails = False
while Cmd.ArgumentsRemaining():
myarg = getArgument()
if myarg == 'matter':
@ -37492,6 +37507,10 @@ def doCreateVaultHold():
pass
elif myarg == 'showdetails':
showDetails = True
returnIdOnly = False
elif myarg == 'returnidonly':
returnIdOnly = True
showDetails = False
else:
unknownArgumentExit()
if matterId is None:
@ -37511,9 +37530,12 @@ def doCreateVaultHold():
hold = callGAPI(v.matters().holds(), 'create',
throwReasons=[GAPI.ALREADY_EXISTS, GAPI.BAD_REQUEST, GAPI.BACKEND_ERROR, GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN],
matterId=matterId, body=body)
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_HOLD, formatVaultNameId(hold['name'], hold['holdId'])])
if showDetails:
_showVaultHold(None, hold, None, None)
if not returnIdOnly:
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_HOLD, formatVaultNameId(hold['name'], hold['holdId'])])
if showDetails:
_showVaultHold(None, hold, None, None)
else:
writeStdout(f'{hold["holdId"]}\n')
except (GAPI.alreadyExists, GAPI.badRequest, GAPI.backendError, GAPI.failedPrecondition, GAPI.forbidden) as e:
entityActionFailedWarning([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_HOLD, body.get('name')], str(e))
@ -37780,13 +37802,13 @@ def doPrintShowVaultHolds():
throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN],
matterId=matterId, fields=fields)
except GAPI.failedPrecondition:
warnMatterNotOpen(matter, matterNameId, j, jcount)
warnMatterNotOpen(v, matter, matterNameId, j, jcount)
continue
except GAPI.forbidden as e:
entityActionFailedWarning([Ent.VAULT_HOLD, None], str(e))
break
else:
warnMatterNotOpen(matter, matterNameId, j, jcount)
warnMatterNotOpen(None, matter, matterNameId, j, jcount)
continue
kcount = len(holds)
if not csvPF:
@ -37830,7 +37852,7 @@ def printShowUserVaultHolds(entityList):
matters = callGAPIpages(v.matters(), 'list', 'matters',
pageMessage=getPageMessage(),
throwReasons=[GAPI.FORBIDDEN],
view='BASIC', state='OPEN', fields='matters(matterId,name),nextPageToken')
view='BASIC', state='OPEN', fields='matters(matterId,name,state),nextPageToken')
except GAPI.forbidden as e:
entityActionFailedWarning([Ent.VAULT_HOLD, None], str(e))
return
@ -37848,7 +37870,7 @@ def printShowUserVaultHolds(entityList):
throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN],
matterId=matterId, fields='holds(holdId,name,accounts(accountId,email),orgUnit(orgUnitId)),nextPageToken')
except GAPI.failedPrecondition:
warnMatterNotOpen(matter, matterNameId, j, jcount)
warnMatterNotOpen(v, matter, matterNameId, j, jcount)
except GAPI.forbidden as e:
entityActionFailedWarning([Ent.VAULT_HOLD, None], str(e), j, jcount)
totalHolds = 0
@ -38037,13 +38059,13 @@ def doPrintShowVaultQueries():
throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN],
matterId=matterId, fields=fields)
except GAPI.failedPrecondition:
warnMatterNotOpen(matter, matterNameId, j, jcount)
warnMatterNotOpen(v, matter, matterNameId, j, jcount)
continue
except GAPI.forbidden as e:
entityActionFailedWarning([Ent.VAULT_QUERY, None], str(e))
break
else:
warnMatterNotOpen(matter, matterNameId, j, jcount)
warnMatterNotOpen(None, matter, matterNameId, j, jcount)
continue
kcount = len(queries)
if not csvPF:
@ -38092,14 +38114,14 @@ def _showVaultMatter(matter, cd, FJQC, j=0, jcount=0):
# gam create vaultmatter|matter [name <String>] [description <string>]
# [collaborator|collaborators <CollaboratorItemList>] [sendemails <Boolean>] [ccme <Boolean>]
# [showdetails]
# [showdetails|returnidonly]
def doCreateVaultMatter():
v = buildGAPIObject(API.VAULT)
body = {}
cbody = {'matterPermission': {'role': 'COLLABORATOR', 'accountId': ''}, 'sendEmails': False, 'ccMe': False}
collaborators = []
cd = None
showDetails = False
returnIdOnly = showDetails = False
while Cmd.ArgumentsRemaining():
myarg = getArgument()
if myarg == 'name':
@ -38116,6 +38138,10 @@ def doCreateVaultMatter():
cbody['ccMe'] = getBoolean()
elif myarg == 'showdetails':
showDetails = True
returnIdOnly = False
elif myarg == 'returnidonly':
returnIdOnly = True
showDetails = False
else:
unknownArgumentExit()
if 'name' not in body:
@ -38126,14 +38152,18 @@ def doCreateVaultMatter():
body=body)
matterId = matter['matterId']
matterNameId = formatVaultNameId(matter['name'], matterId)
entityActionPerformed([Ent.VAULT_MATTER, matterNameId])
if not returnIdOnly:
entityActionPerformed([Ent.VAULT_MATTER, matterNameId])
else:
writeStdout(f'{matterId}\n')
except (GAPI.alreadyExists, GAPI.forbidden) as e:
entityActionFailedWarning([Ent.VAULT_MATTER, body['name']], str(e))
return
jcount = len(collaborators)
if jcount > 0:
Act.Set(Act.ADD)
entityPerformActionNumItems([Ent.VAULT_MATTER, matterNameId], jcount, Ent.COLLABORATOR)
if not returnIdOnly:
entityPerformActionNumItems([Ent.VAULT_MATTER, matterNameId], jcount, Ent.COLLABORATOR)
Ind.Increment()
j = 0
for collaborator in collaborators:
@ -38143,7 +38173,8 @@ def doCreateVaultMatter():
callGAPI(v.matters(), 'addPermissions',
throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN],
matterId=matterId, body=cbody)
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.COLLABORATOR, collaborator['email']], j, jcount)
if not returnIdOnly:
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.COLLABORATOR, collaborator['email']], j, jcount)
except (GAPI.failedPrecondition, GAPI.forbidden) as e:
entityActionFailedWarning([Ent.VAULT_MATTER, matterNameId], str(e))
break