Added option returnidonly to gam create vaultexport|vaulthold|vaultmatter

This commit is contained in:
Ross Scroggs
2023-07-24 08:14:35 -07:00
parent ff6364c77b
commit 3eea0cea08
3 changed files with 50 additions and 18 deletions

View File

@@ -4785,7 +4785,7 @@ gam <UserTypeEntity> show teamdriveacls
gam create|add vaultmatter|matter [name <String>] [description <string>] gam create|add vaultmatter|matter [name <String>] [description <string>]
[collaborator|collaborators <EmailItemList>] [sendemails <Boolean>] [ccme <Boolean>] [collaborator|collaborators <EmailItemList>] [sendemails <Boolean>] [ccme <Boolean>]
[showdetails] [showdetails|returnidonly]
gam update vaultmatter|matter <MatterItem> [name <String>] [description <string>] gam update vaultmatter|matter <MatterItem> [name <String>] [description <string>]
[addcollaborator|addcollaborators <EmailItemList>] [removecollaborator|removecollaborators <EmailItemList>] [addcollaborator|addcollaborators <EmailItemList>] [removecollaborator|removecollaborators <EmailItemList>]
gam update vaultmatter|matter <MatterItem> action close|reopen|delete|undelete gam update vaultmatter|matter <MatterItem> action close|reopen|delete|undelete
@@ -4834,7 +4834,7 @@ gam create vaultexport|export matter <MatterItem> [name <String>] corpus drive|m
[showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>] [showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>]
[includerooms <Boolean>] [covereddata calllogs|textmessages|voicemails] [includerooms <Boolean>] [covereddata calllogs|textmessages|voicemails]
[includeshareddrives|includeteamdrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>] [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 <ExportItem> matter <MatterItem>
gam delete vaultexport|export <MatterItem> <ExportItem> gam delete vaultexport|export <MatterItem> <ExportItem>
gam download vaultexport|export <ExportItem> matter <MatterItem> gam download vaultexport|export <ExportItem> matter <MatterItem>
@@ -4894,7 +4894,7 @@ gam create vaulthold|hold matter <MatterItem> [name <String>] corpus drive|mail|
[terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>] [terms <String>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>]
[includerooms <Boolean>] [covereddata calllogs|textmessages|voicemails] [includerooms <Boolean>] [covereddata calllogs|textmessages|voicemails]
[includeshareddrives|includeteamdrives <Boolean>] [includeshareddrives|includeteamdrives <Boolean>]
[showdetails] [showdetails|returnidonly]
gam update vaulthold|hold <HoldItem> matter <MatterItem> gam update vaulthold|hold <HoldItem> matter <MatterItem>
[([addaccounts|addgroups|addusers <EmailItemList>] [removeaccounts|removegroups|removeusers <EmailItemList>]) | (orgunit|org|ou <OrgUnit>)] [([addaccounts|addgroups|addusers <EmailItemList>] [removeaccounts|removegroups|removeusers <EmailItemList>]) | (orgunit|org|ou <OrgUnit>)]
[query <QueryVaultCorpus>] [query <QueryVaultCorpus>]

View File

@@ -2,6 +2,15 @@
Merged GAM-Team version Merged GAM-Team version
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 6.61.09
Updated `gam oauth create` to handle case where Google takes a very long time to respond Updated `gam oauth create` to handle case where Google takes a very long time to respond

View File

@@ -36895,14 +36895,14 @@ def _validateVaultQuery(query):
# [includerooms <Boolean>] # [includerooms <Boolean>]
# [covereddata calllogs|textmessages|voicemails] # [covereddata calllogs|textmessages|voicemails]
# [includeshareddrives|includeteamdrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>] # [includeshareddrives|includeteamdrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
# [region any|europe|us] [showdetails] # [region any|europe|us] [showdetails|returnidonly]
def doCreateVaultExport(): def doCreateVaultExport():
v = buildGAPIObject(API.VAULT) v = buildGAPIObject(API.VAULT)
matterId = None matterId = None
body = {'query': {'dataScope': 'ALL_DATA'}, 'exportOptions': {}} body = {'query': {'dataScope': 'ALL_DATA'}, 'exportOptions': {}}
exportFormat = 'MBOX' exportFormat = 'MBOX'
showConfidentialModeContent = None showConfidentialModeContent = None
showDetails = False returnIdOnly = showDetails = False
useNewExport = None useNewExport = None
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
myarg = getArgument() myarg = getArgument()
@@ -36927,6 +36927,10 @@ def doCreateVaultExport():
body['exportOptions'].setdefault('voiceOptions', {})['coveredData'] = getChoice(VAULT_VOICE_COVERED_DATA_MAP, mapChoice=True) body['exportOptions'].setdefault('voiceOptions', {})['coveredData'] = getChoice(VAULT_VOICE_COVERED_DATA_MAP, mapChoice=True)
elif myarg == 'showdetails': elif myarg == 'showdetails':
showDetails = True showDetails = True
returnIdOnly = False
elif myarg == 'returnidonly':
returnIdOnly = True
showDetails = False
else: else:
unknownArgumentExit() unknownArgumentExit()
if not matterId: if not matterId:
@@ -36950,9 +36954,12 @@ def doCreateVaultExport():
throwReasons=[GAPI.ALREADY_EXISTS, GAPI.BAD_REQUEST, GAPI.BACKEND_ERROR, GAPI.INVALID_ARGUMENT, throwReasons=[GAPI.ALREADY_EXISTS, GAPI.BAD_REQUEST, GAPI.BACKEND_ERROR, GAPI.INVALID_ARGUMENT,
GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN, GAPI.QUOTA_EXCEEDED], GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN, GAPI.QUOTA_EXCEEDED],
matterId=matterId, body=body) matterId=matterId, body=body)
if not returnIdOnly:
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_EXPORT, formatVaultNameId(export['name'], export['id'])]) entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_EXPORT, formatVaultNameId(export['name'], export['id'])])
if showDetails: if showDetails:
_showVaultExport(None, export, None, None) _showVaultExport(None, export, None, None)
else:
writeStdout(f'{export["id"]}\n')
except (GAPI.alreadyExists, GAPI.badRequest, GAPI.backendError, GAPI.invalidArgument, except (GAPI.alreadyExists, GAPI.badRequest, GAPI.backendError, GAPI.invalidArgument,
GAPI.failedPrecondition, GAPI.forbidden, GAPI.quotaExceeded) as e: GAPI.failedPrecondition, GAPI.forbidden, GAPI.quotaExceeded) as e:
entityActionFailedWarning([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_EXPORT, body.get('name')], str(e)) entityActionFailedWarning([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_EXPORT, body.get('name')], str(e))
@@ -37467,14 +37474,14 @@ def _setHoldQuery(body, queryParameters):
# [includerooms <Boolean>] # [includerooms <Boolean>]
# [covereddata calllogs|textmessages|voicemails] # [covereddata calllogs|textmessages|voicemails]
# [includeshareddrives|includeteamdrives <Boolean>] # [includeshareddrives|includeteamdrives <Boolean>]
# [showdetails] # [showdetails|returnidonly]
def doCreateVaultHold(): def doCreateVaultHold():
v = buildGAPIObject(API.VAULT) v = buildGAPIObject(API.VAULT)
body = {} body = {}
matterId = None matterId = None
accounts = [] accounts = []
queryParameters = {} queryParameters = {}
showDetails = False returnIdOnly = showDetails = False
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
myarg = getArgument() myarg = getArgument()
if myarg == 'matter': if myarg == 'matter':
@@ -37492,6 +37499,10 @@ def doCreateVaultHold():
pass pass
elif myarg == 'showdetails': elif myarg == 'showdetails':
showDetails = True showDetails = True
returnIdOnly = False
elif myarg == 'returnidonly':
returnIdOnly = True
showDetails = False
else: else:
unknownArgumentExit() unknownArgumentExit()
if matterId is None: if matterId is None:
@@ -37511,9 +37522,12 @@ def doCreateVaultHold():
hold = callGAPI(v.matters().holds(), 'create', hold = callGAPI(v.matters().holds(), 'create',
throwReasons=[GAPI.ALREADY_EXISTS, GAPI.BAD_REQUEST, GAPI.BACKEND_ERROR, GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN], throwReasons=[GAPI.ALREADY_EXISTS, GAPI.BAD_REQUEST, GAPI.BACKEND_ERROR, GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN],
matterId=matterId, body=body) matterId=matterId, body=body)
if not returnIdOnly:
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_HOLD, formatVaultNameId(hold['name'], hold['holdId'])]) entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_HOLD, formatVaultNameId(hold['name'], hold['holdId'])])
if showDetails: if showDetails:
_showVaultHold(None, hold, None, None) _showVaultHold(None, hold, None, None)
else:
writeStdout(f'{hold["holdId"]}\n')
except (GAPI.alreadyExists, GAPI.badRequest, GAPI.backendError, GAPI.failedPrecondition, GAPI.forbidden) as e: 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)) entityActionFailedWarning([Ent.VAULT_MATTER, matterNameId, Ent.VAULT_HOLD, body.get('name')], str(e))
@@ -38092,14 +38106,14 @@ def _showVaultMatter(matter, cd, FJQC, j=0, jcount=0):
# gam create vaultmatter|matter [name <String>] [description <string>] # gam create vaultmatter|matter [name <String>] [description <string>]
# [collaborator|collaborators <CollaboratorItemList>] [sendemails <Boolean>] [ccme <Boolean>] # [collaborator|collaborators <CollaboratorItemList>] [sendemails <Boolean>] [ccme <Boolean>]
# [showdetails] # [showdetails|returnidonly]
def doCreateVaultMatter(): def doCreateVaultMatter():
v = buildGAPIObject(API.VAULT) v = buildGAPIObject(API.VAULT)
body = {} body = {}
cbody = {'matterPermission': {'role': 'COLLABORATOR', 'accountId': ''}, 'sendEmails': False, 'ccMe': False} cbody = {'matterPermission': {'role': 'COLLABORATOR', 'accountId': ''}, 'sendEmails': False, 'ccMe': False}
collaborators = [] collaborators = []
cd = None cd = None
showDetails = False returnIdOnly = showDetails = False
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
myarg = getArgument() myarg = getArgument()
if myarg == 'name': if myarg == 'name':
@@ -38116,6 +38130,10 @@ def doCreateVaultMatter():
cbody['ccMe'] = getBoolean() cbody['ccMe'] = getBoolean()
elif myarg == 'showdetails': elif myarg == 'showdetails':
showDetails = True showDetails = True
returnIdOnly = False
elif myarg == 'returnidonly':
returnIdOnly = True
showDetails = False
else: else:
unknownArgumentExit() unknownArgumentExit()
if 'name' not in body: if 'name' not in body:
@@ -38126,13 +38144,17 @@ def doCreateVaultMatter():
body=body) body=body)
matterId = matter['matterId'] matterId = matter['matterId']
matterNameId = formatVaultNameId(matter['name'], matterId) matterNameId = formatVaultNameId(matter['name'], matterId)
if not returnIdOnly:
entityActionPerformed([Ent.VAULT_MATTER, matterNameId]) entityActionPerformed([Ent.VAULT_MATTER, matterNameId])
else:
writeStdout(f'{matterId}\n')
except (GAPI.alreadyExists, GAPI.forbidden) as e: except (GAPI.alreadyExists, GAPI.forbidden) as e:
entityActionFailedWarning([Ent.VAULT_MATTER, body['name']], str(e)) entityActionFailedWarning([Ent.VAULT_MATTER, body['name']], str(e))
return return
jcount = len(collaborators) jcount = len(collaborators)
if jcount > 0: if jcount > 0:
Act.Set(Act.ADD) Act.Set(Act.ADD)
if not returnIdOnly:
entityPerformActionNumItems([Ent.VAULT_MATTER, matterNameId], jcount, Ent.COLLABORATOR) entityPerformActionNumItems([Ent.VAULT_MATTER, matterNameId], jcount, Ent.COLLABORATOR)
Ind.Increment() Ind.Increment()
j = 0 j = 0
@@ -38143,6 +38165,7 @@ def doCreateVaultMatter():
callGAPI(v.matters(), 'addPermissions', callGAPI(v.matters(), 'addPermissions',
throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN], throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN],
matterId=matterId, body=cbody) matterId=matterId, body=cbody)
if not returnIdOnly:
entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.COLLABORATOR, collaborator['email']], j, jcount) entityActionPerformed([Ent.VAULT_MATTER, matterNameId, Ent.COLLABORATOR, collaborator['email']], j, jcount)
except (GAPI.failedPrecondition, GAPI.forbidden) as e: except (GAPI.failedPrecondition, GAPI.forbidden) as e:
entityActionFailedWarning([Ent.VAULT_MATTER, matterNameId], str(e)) entityActionFailedWarning([Ent.VAULT_MATTER, matterNameId], str(e))