Convert team to shared in vault export; prepare for the future (#971)

* Convert team to shared in vault export

Restore _getValidCourseStates(croom), it is used by _getCourseStates in print courses/course-participants

* Update GamCommands.txt

* Fix typo

* Update gam.py
This commit is contained in:
Ross Scroggs
2019-07-10 12:35:06 -07:00
committed by Jay Lee
parent 3877f8309b
commit 54eb59c27b
2 changed files with 13 additions and 11 deletions

View File

@@ -1176,7 +1176,7 @@ gam create vaultexport|export matter <MatterItem> [name <name>] corpus <drive|ma
[terms <terms>] [start|starttime <Date>|<Time>] [end|endtime <Date>|<Time>] [timezone <TimeZone>]
[excludedrafts <Boolean>] [format mbox|pst] [showconfidentialmodecontent <Boolean>]
[includerooms]
[driveversiondate <Date>|<Time>] [includeteamdrives] [includeaccessinfo <Boolean>]
[driveversiondate <Date>|<Time>] [includeshareddrives|includeteamdrives] [includeaccessinfo <Boolean>]
[region any|europe|us]
gam delete export <MatterItem> <ExportItem>
gam info export <MatterItem> <ExportItem>

View File

@@ -2000,7 +2000,7 @@ def getCourseAttribute(myarg, value, body, croom, function):
systemErrorExit(2, '%s is not a valid argument to "gam %s course"' % (myarg, function))
def _getCourseStates(croom, value, courseStates):
validStates = _getValidCourseStates(croom)
validStates = _getEnumValuesMinusUnspecified(croom._rootDesc['schemas']['Course']['properties']['courseState']['enum'])
for state in value.replace(',', ' ').split():
courseStates.append(_getValidatedState(state, validStates))
@@ -8217,10 +8217,12 @@ VAULT_SEARCH_METHODS_MAP = {
'ou': 'ORG_UNIT',
'room': 'ROOM',
'rooms': 'ROOM',
'teamdrive': 'TEAM_DRIVE',
'teamdrives': 'TEAM_DRIVE',
'shareddrive': 'SHARED_DRIVE',
'shareddrives': 'SHARED_DRIVE',
'teamdrive': 'SHARED_DRIVE',
'teamdrives': 'SHARED_DRIVE',
}
VAULT_SEARCH_METHODS_LIST = ['accounts', 'orgunit', 'teamdrives', 'rooms', 'everyone']
VAULT_SEARCH_METHODS_LIST = ['accounts', 'orgunit', 'shareddrives', 'rooms', 'everyone']
def doCreateVaultExport():
v = buildGAPIObject('vault')
@@ -8228,7 +8230,7 @@ def doCreateVaultExport():
allowed_scopes = _getEnumValuesMinusUnspecified(v._rootDesc['schemas']['Query']['properties']['dataScope']['enum'])
allowed_formats = _getEnumValuesMinusUnspecified(v._rootDesc['schemas']['MailExportOptions']['properties']['exportFormat']['enum'])
export_format = 'MBOX'
showConfidentialModeContent = None # default to not even set
showConfidentialModeContent = None # default to not even set
matterId = None
body = {'query': {'dataScope': 'ALL_DATA'}, 'exportOptions': {}}
i = 3
@@ -8257,8 +8259,8 @@ def doCreateVaultExport():
elif searchMethod == 'ORG_UNIT':
body['query']['orgUnitInfo'] = {'orgUnitId': getOrgUnitId(sys.argv[i+1])[1]}
i += 2
elif searchMethod == 'TEAM_DRIVE':
body['query']['teamDriveInfo'] = {'teamDriveIds': sys.argv[i+1].split(',')}
elif searchMethod == 'SHARED_DRIVE':
body['query']['sharedDriveInfo'] = {'sharedDriveIds': sys.argv[i+1].split(',')}
i += 2
elif searchMethod == 'ROOM':
body['query']['hangoutsChatInfo'] = {'roomId': sys.argv[i+1].split(',')}
@@ -8288,8 +8290,8 @@ def doCreateVaultExport():
elif myarg in ['driveversiondate']:
body['query'].setdefault('driveOptions', {})['versionDate'] = getDateZeroTimeOrFullTime(sys.argv[i+1])
i += 2
elif myarg in ['includeteamdrives']:
body['query'].setdefault('driveOptions', {})['includeTeamDrives'] = getBoolean(sys.argv[i+1], myarg)
elif myarg in ['includeshareddrives', 'includeteamdrives']:
body['query'].setdefault('driveOptions', {})['includeSharedDrives'] = getBoolean(sys.argv[i+1], myarg)
i += 2
elif myarg in ['includerooms']:
body['query']['hangoutsChatOptions'] = {'includeRooms': getBoolean(sys.argv[i+1], myarg)}
@@ -11444,7 +11446,7 @@ def doPrintShowAlertFeedback():
print(feedbac)
def _getEnumValuesMinusUnspecified(values):
return [a_type for a_type in values if '_UNSPECIFIED' not in a_type]
return [a_type for a_type in values if '_UNSPECIFIED' not in a_type]
def doCreateAlertFeedback():
_, ac = buildAlertCenterGAPIObject(_getValueFromOAuth('email'))