Updated gam create vaultexport to include corpus gemini.

This commit is contained in:
Ross Scroggs
2025-02-08 09:38:37 -08:00
parent 8cd378ff8f
commit 8d9f5689f3
3 changed files with 52 additions and 35 deletions

View File

@@ -2092,7 +2092,7 @@ gam move browsers ou|org|orgunit <OrgUnitPath>
gam info browser <DeviceID> gam info browser <DeviceID>
(basic|full|annotated | (basic|full|annotated |
(<BrowserFieldName>* [fields <BrowserFieldNameList>]) | (<BrowserFieldName>* [fields <BrowserFieldNameList>]) |
(rawfields <BrowserFieldNameList>)) (rawfields "<BrowserFieldNameList>"))
[formatjson] [formatjson]
gam show browsers gam show browsers
([ou|org|orgunit|browserou <OrgUnitPath>] [(query <QueryBrowser>)|(queries <QueryBrowserList>))|(select <BrowserEntity>)) ([ou|org|orgunit|browserou <OrgUnitPath>] [(query <QueryBrowser>)|(queries <QueryBrowserList>))|(select <BrowserEntity>))
@@ -2100,7 +2100,7 @@ gam show browsers
[orderby <BrowserOrderByFieldName> [ascending|descending]] [orderby <BrowserOrderByFieldName> [ascending|descending]]
(basic|full|annotated | (basic|full|annotated |
(<BrowserFieldName>* [fields <BrowserFieldNameList>]) | (<BrowserFieldName>* [fields <BrowserFieldNameList>]) |
(rawfields <BrowserFieldNameList>)) (rawfields "<BrowserFieldNameList>"))
[formatjson] [formatjson]
gam print browsers [todrive <ToDriveAttribute>*] gam print browsers [todrive <ToDriveAttribute>*]
([ou|org|orgunit|browserou <OrgUnitPath>] [(query <QueryBrowser>)|(queries <QueryBrowserList>))|(select <BrowserEntity>)) ([ou|org|orgunit|browserou <OrgUnitPath>] [(query <QueryBrowser>)|(queries <QueryBrowserList>))|(select <BrowserEntity>))
@@ -2108,7 +2108,7 @@ gam print browsers [todrive <ToDriveAttribute>*]
[orderby <BrowserOrderByFieldName> [ascending|descending]] [orderby <BrowserOrderByFieldName> [ascending|descending]]
(basic|full|annotated | (basic|full|annotated |
(<BrowserFieldName>* [fields <BrowserFieldNameList>]) | (<BrowserFieldName>* [fields <BrowserFieldNameList>]) |
(rawfields <BrowserFieldNameList>)) (rawfields "<BrowserFieldNameList>"))
[sortheaders] [sortheaders]
[formatjson [quotechar <Character>]] [formatjson [quotechar <Character>]]
@@ -5270,7 +5270,7 @@ gam print vaultcounts [todrive <ToDriveAttributes>*]
gam print vaultcounts [todrive <ToDriveAttributes>*] gam print vaultcounts [todrive <ToDriveAttributes>*]
matter <MatterItem> operation <String> [wait <Integer>] matter <MatterItem> operation <String> [wait <Integer>]
gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|mail|groups|hangouts_chat|voice gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|gemini|groups|hangouts_chat|mail|voice
(accounts <EmailAddressEntity>) | (orgunit|org|ou <OrgUnitPath>) | everyone (accounts <EmailAddressEntity>) | (orgunit|org|ou <OrgUnitPath>) | everyone
(shareddrives|teamdrives <SharedDriveIDList>) | (rooms <RoomList>) | (sitesurl <URLList>) (shareddrives|teamdrives <SharedDriveIDList>) | (rooms <RoomList>) | (sitesurl <URLList>)
[scope all_data|held_data|unprocessed_data] [scope all_data|held_data|unprocessed_data]
@@ -5278,10 +5278,12 @@ gam create vaultexport|export matter <MatterItem> [name <String>] corpus calenda
[locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>] [locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>]
[responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>] [responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>]
[includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>] [includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
[driveclientsideencryption any|encrypted|unencrypted]
[includerooms <Boolean>] [includerooms <Boolean>]
[excludedrafts <Boolean>] [format mbox|pst] [excludedrafts <Boolean>] [mailclientsideencryption any|encrypted|unencrypted]
[showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>] [exportlinkeddrivefiles <Boolean>] [showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>] [exportlinkeddrivefiles <Boolean>]
[covereddata calllogs|textmessages|voicemails] [covereddata calllogs|textmessages|voicemails]
[format ics|mbox|pst|xml]
[region any|europe|us] [showdetails|returnidonly] [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>

View File

@@ -1,8 +1,16 @@
7.03.07
Updated `gam create vaultexport` to include `corpus gemini`.
* See: https://workspaceupdates.googleblog.com/2025/02/google-vault-now-supports-gemini.html
7.03.06 7.03.06
Added option `rawfields <BrowserFieldNameList>` to `gam info|print|show browsers` that allows Added option `rawfields "<BrowserFieldNameList>"` to `gam info|print|show browsers` that allows
specification of complex field lists with selected subfields. specification of complex field lists with selected subfields.
* See: https://github.com/GAM-team/GAM/wiki/Chrome-Browser-Cloud-Management#raw-fields
7.03.05 7.03.05
Make GAM pip-installable: "pip install gam7" Make GAM pip-installable: "pip install gam7"

View File

@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
""" """
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>' __author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
__version__ = '7.03.06' __version__ = '7.03.07'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
#pylint: disable=wrong-import-position #pylint: disable=wrong-import-position
@@ -7356,11 +7356,11 @@ def addFieldToFieldsList(fieldName, fieldsChoiceMap, fieldsList):
def _getFieldsList(): def _getFieldsList():
return getString(Cmd.OB_FIELD_NAME_LIST).lower().replace('_', '').replace(',', ' ').split() return getString(Cmd.OB_FIELD_NAME_LIST).lower().replace('_', '').replace(',', ' ').split()
def _getRawFieldsList(requiredField=None): def _getRawFields(requiredField=None):
rawFieldsList = getString(Cmd.OB_FIELDS) rawFields = getString(Cmd.OB_FIELDS)
if requiredField is not None and requiredField not in rawFieldsList: if requiredField is None or requiredField in rawFields:
rawFieldsList = f'{requiredField},{rawFieldsList}' return rawFields
return rawFieldsList return f'{requiredField},{rawFields}'
def _addInitialField(fieldsList, initialField): def _addInitialField(fieldsList, initialField):
if isinstance(initialField, list): if isinstance(initialField, list):
@@ -25133,7 +25133,7 @@ def doInfoBrowsers():
deviceId = getString(Cmd.OB_DEVICE_ID) deviceId = getString(Cmd.OB_DEVICE_ID)
projection = 'BASIC' projection = 'BASIC'
fieldsList = [] fieldsList = []
rawFieldsList = None rawFields = None
FJQC = FormatJSONQuoteChar() FJQC = FormatJSONQuoteChar()
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
myarg = getArgument() myarg = getArgument()
@@ -25147,15 +25147,12 @@ def doInfoBrowsers():
pass pass
elif myarg == 'rawfields': elif myarg == 'rawfields':
projection = 'FULL' projection = 'FULL'
rawFieldsList = _getRawFieldsList('deviceId') rawFields = _getRawFields('deviceId')
else: else:
FJQC.GetFormatJSON(myarg) FJQC.GetFormatJSON(myarg)
if projection == 'BASIC' and set(fieldsList).intersection(BROWSER_FULL_ACCESS_FIELDS): if projection == 'BASIC' and set(fieldsList).intersection(BROWSER_FULL_ACCESS_FIELDS):
projection = 'FULL' projection = 'FULL'
if not rawFieldsList: fields = getFieldsFromFieldsList(fieldsList) if not rawFields else rawFields
fields = getFieldsFromFieldsList(fieldsList)
else:
fields = rawFieldsList
try: try:
browser = callGAPI(cbcm.chromebrowsers(), 'get', browser = callGAPI(cbcm.chromebrowsers(), 'get',
throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.FORBIDDEN], throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.INVALID_ARGUMENT, GAPI.FORBIDDEN],
@@ -25524,7 +25521,7 @@ def doPrintShowBrowsers():
csvPF = CSVPrintFile(['deviceId']) if Act.csvFormat() else None csvPF = CSVPrintFile(['deviceId']) if Act.csvFormat() else None
FJQC = FormatJSONQuoteChar(csvPF) FJQC = FormatJSONQuoteChar(csvPF)
fieldsList = [] fieldsList = []
rawFieldsList = None rawFields = None
projection = 'BASIC' projection = 'BASIC'
orderBy = 'id' orderBy = 'id'
sortOrder = 'ASCENDING' sortOrder = 'ASCENDING'
@@ -25565,7 +25562,7 @@ def doPrintShowBrowsers():
pass pass
elif myarg == 'rawfields': elif myarg == 'rawfields':
projection = 'FULL' projection = 'FULL'
rawFieldsList = _getRawFieldsList('deviceId') rawFields = _getRawFields('deviceId')
else: else:
FJQC.GetFormatJSONQuoteChar(myarg, True) FJQC.GetFormatJSONQuoteChar(myarg, True)
if projection == 'BASIC' and set(fieldsList).intersection(BROWSER_FULL_ACCESS_FIELDS): if projection == 'BASIC' and set(fieldsList).intersection(BROWSER_FULL_ACCESS_FIELDS):
@@ -25574,10 +25571,7 @@ def doPrintShowBrowsers():
sortHeaders = False sortHeaders = False
substituteQueryTimes(queries, queryTimes) substituteQueryTimes(queries, queryTimes)
if entityList is None: if entityList is None:
if not rawFieldsList: fields = getItemFieldsFromFieldsList('browsers', fieldsList) if not rawFields else f'nextPageToken,browsers({rawFields})'
fields = getItemFieldsFromFieldsList('browsers', fieldsList)
else:
fields = f'nextPageToken,browsers({rawFieldsList})'
for query in queries: for query in queries:
printGettingAllAccountEntities(Ent.CHROME_BROWSER, query) printGettingAllAccountEntities(Ent.CHROME_BROWSER, query)
pageMessage = getPageMessage() pageMessage = getPageMessage()
@@ -25616,10 +25610,7 @@ def doPrintShowBrowsers():
else: else:
sortRows = True sortRows = True
jcount = len(entityList) jcount = len(entityList)
if not rawFieldsList: fields = getFieldsFromFieldsList(fieldsList) if not rawFields else rawFields
fields = getFieldsFromFieldsList(fieldsList)
else:
fields = rawFieldsList
j = 0 j = 0
for deviceId in entityList: for deviceId in entityList:
j += 1 j += 1
@@ -40464,9 +40455,10 @@ VAULT_SEARCH_METHODS_MAP = {
VAULT_CORPUS_ARGUMENT_MAP = { VAULT_CORPUS_ARGUMENT_MAP = {
'calendar': 'CALENDAR', 'calendar': 'CALENDAR',
'drive': 'DRIVE', 'drive': 'DRIVE',
'mail': 'MAIL', 'gemini': 'GEMINI',
'groups': 'GROUPS', 'groups': 'GROUPS',
'hangoutschat': 'HANGOUTS_CHAT', 'hangoutschat': 'HANGOUTS_CHAT',
'mail': 'MAIL',
'voice': 'VOICE', 'voice': 'VOICE',
} }
VAULT_COUNTS_CORPUS_ARGUMENT_MAP = { VAULT_COUNTS_CORPUS_ARGUMENT_MAP = {
@@ -40493,15 +40485,22 @@ VAULT_EXPORT_FORMAT_MAP = {
'ics': 'ICS', 'ics': 'ICS',
'mbox': 'MBOX', 'mbox': 'MBOX',
'pst': 'PST', 'pst': 'PST',
'xml': 'XML',
} }
VAULT_CORPUS_EXPORT_FORMATS = { VAULT_CORPUS_EXPORT_FORMATS = {
'CALENDAR': ['ICS', 'PST'], 'CALENDAR': ['ICS', 'PST'],
'DRIVE': [], 'DRIVE': [],
'GEMINI': ['XML'],
'GROUPS': ['MBOX', 'PST'], 'GROUPS': ['MBOX', 'PST'],
'HANGOUTS_CHAT': ['MBOX', 'PST'], 'HANGOUTS_CHAT': ['MBOX', 'PST'],
'MAIL': ['MBOX', 'PST'], 'MAIL': ['MBOX', 'PST'],
'VOICE' : ['MBOX', 'PST'], 'VOICE' : ['MBOX', 'PST'],
} }
VAULT_CSE_OPTION_MAP = {
'any': 'CLIENT_SIDE_ENCRYPTED_OPTION_ANY',
'encrypted': 'CLIENT_SIDE_ENCRYPTED_OPTION_ENCRYPTED',
'unencrypted': 'CLIENT_SIDE_ENCRYPTED_OPTION_UNENCRYPTED',
}
VAULT_EXPORT_REGION_MAP = { VAULT_EXPORT_REGION_MAP = {
'any': 'ANY', 'any': 'ANY',
'europe': 'EUROPE', 'europe': 'EUROPE',
@@ -40510,16 +40509,18 @@ VAULT_EXPORT_REGION_MAP = {
VAULT_CORPUS_OPTIONS_MAP = { VAULT_CORPUS_OPTIONS_MAP = {
'CALENDAR': 'calendarOptions', 'CALENDAR': 'calendarOptions',
'DRIVE': 'driveOptions', 'DRIVE': 'driveOptions',
'MAIL': 'mailOptions', 'GEMINI': 'geminiOptions',
'GROUPS': 'groupsOptions', 'GROUPS': 'groupsOptions',
'HANGOUTS_CHAT': 'hangoutsChatOptions', 'HANGOUTS_CHAT': 'hangoutsChatOptions',
'MAIL': 'mailOptions',
'VOICE': 'voiceOptions', 'VOICE': 'voiceOptions',
} }
VAULT_CORPUS_QUERY_MAP = { VAULT_CORPUS_QUERY_MAP = {
'CALENDAR': None, 'CALENDAR': None,
'DRIVE': 'driveQuery', 'DRIVE': 'driveQuery',
'MAIL': 'mailQuery', 'GEMINI': None,
'GROUPS': 'groupsQuery', 'GROUPS': 'groupsQuery',
'MAIL': 'mailQuery',
'HANGOUTS_CHAT': 'hangoutsChatQuery', 'HANGOUTS_CHAT': 'hangoutsChatQuery',
'VOICE': 'voiceQuery', 'VOICE': 'voiceQuery',
} }
@@ -40528,11 +40529,11 @@ VAULT_QUERY_ARGS = [
# calendar # calendar
'locationquery', 'peoplequery', 'minuswords', 'responsestatuses', 'caldendarversiondate', 'locationquery', 'peoplequery', 'minuswords', 'responsestatuses', 'caldendarversiondate',
# drive # drive
'driveversiondate', 'includeshareddrives', 'includeteamdrives', 'driveclientsideencryption', 'driveversiondate', 'includeshareddrives', 'includeteamdrives',
# hangoutsChat # hangoutsChat
'includerooms', 'includerooms',
# mail # mail
'excludedrafts', 'mailclientsideencryption', 'excludedrafts',
# voice # voice
'covereddata', 'covereddata',
] + list(VAULT_SEARCH_METHODS_MAP.keys()) ] + list(VAULT_SEARCH_METHODS_MAP.keys())
@@ -40589,12 +40590,16 @@ def _buildVaultQuery(myarg, query, corpusArgumentMap):
query.setdefault('driveOptions', {})['versionDate'] = getTimeOrDeltaFromNow() query.setdefault('driveOptions', {})['versionDate'] = getTimeOrDeltaFromNow()
elif myarg in {'includeshareddrives', 'includeteamdrives'}: elif myarg in {'includeshareddrives', 'includeteamdrives'}:
query.setdefault('driveOptions', {})['includeSharedDrives'] = getBoolean() query.setdefault('driveOptions', {})['includeSharedDrives'] = getBoolean()
elif myarg == 'driveclientsideencryption':
query.setdefault('driveOptions', {})['clientSideEncryptedOption'] = getChoice(VAULT_CSE_OPTION_MAP, mapChoice=True)
# hangoutsChat # hangoutsChat
elif myarg == 'includerooms': elif myarg == 'includerooms':
query['hangoutsChatOptions'] = {'includeRooms': getBoolean()} query['hangoutsChatOptions'] = {'includeRooms': getBoolean()}
# mail # mail
elif myarg == 'excludedrafts': elif myarg == 'excludedrafts':
query['mailOptions'] = {'excludeDrafts': getBoolean()} query['mailOptions'] = {'excludeDrafts': getBoolean()}
elif myarg == 'mailclientsideencryption':
query.setdefault('mailOptions', {})['clientSideEncryptedOption'] = getChoice(VAULT_CSE_OPTION_MAP, mapChoice=True)
# voice # voice
elif myarg == 'covereddata': elif myarg == 'covereddata':
query['voiceOptions'] = {'coveredData': getChoice(VAULT_VOICE_COVERED_DATA_MAP, mapChoice=True)} query['voiceOptions'] = {'coveredData': getChoice(VAULT_VOICE_COVERED_DATA_MAP, mapChoice=True)}
@@ -40609,7 +40614,7 @@ def _validateVaultQuery(body, corpusArgumentMap):
if body['query']['corpus'] != corpus: if body['query']['corpus'] != corpus:
body['exportOptions'].pop(options, None) body['exportOptions'].pop(options, None)
# gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|mail|groups|hangouts_chat|voice # gam create vaultexport|export matter <MatterItem> [name <String>] corpus calendar|drive|gemini|groups|hangouts_chat|mail|voice
# (accounts <EmailAddressEntity>) | (orgunit|org|ou <OrgUnitPath>) | everyone # (accounts <EmailAddressEntity>) | (orgunit|org|ou <OrgUnitPath>) | everyone
# (shareddrives|teamdrives <TeamDriveIDList>) | (rooms <RoomList>) | (sitesurl <URLList>) # (shareddrives|teamdrives <TeamDriveIDList>) | (rooms <RoomList>) | (sitesurl <URLList>)
# [scope <all_data|held_data|unprocessed_data>] # [scope <all_data|held_data|unprocessed_data>]
@@ -40617,10 +40622,12 @@ def _validateVaultQuery(body, corpusArgumentMap):
# [locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>] # [locationquery <StringList>] [peoplequery <StringList>] [minuswords <StringList>]
# [responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>] # [responsestatuses <AttendeeStatus>(,<AttendeeStatus>)*] [calendarversiondate <Date>|<Time>]
# [includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>] # [includeshareddrives <Boolean>] [driveversiondate <Date>|<Time>] [includeaccessinfo <Boolean>]
# [driveclientsideencryption any|encrypted|unencrypted]
# [includerooms <Boolean>] # [includerooms <Boolean>]
# [excludedrafts <Boolean>] [format mbox|pst] # [excludedrafts <Boolean>] [mailclientsideencryption any|encrypted|unencrypted]
# [showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>] [exportlinkeddrivefiles <Boolean>] # [showconfidentialmodecontent <Boolean>] [usenewexport <Boolean>] [exportlinkeddrivefiles <Boolean>]
# [covereddata calllogs|textmessages|voicemails] # [covereddata calllogs|textmessages|voicemails]
# [format ics|mbox|pst|xml]
# [region any|europe|us] [showdetails|returnidonly] # [region any|europe|us] [showdetails|returnidonly]
def doCreateVaultExport(): def doCreateVaultExport():
v = buildGAPIObject(API.VAULT) v = buildGAPIObject(API.VAULT)