2525"""
2626
2727__author__ = 'GAM Team <
[email protected] >'
28- __version__ = '7.28.06 '
28+ __version__ = '7.28.07 '
2929__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
3030
3131#pylint: disable=wrong-import-position
@@ -13999,6 +13999,12 @@ def processCustomerUsage(usage, lastDate):
1399913999 csvPF.WriteRow(row)
1400014000 return (True, lastDate)
1400114001
14002+ def _computeUsedQuotaInPercentage(events):
14003+ if ('accounts:total_quota_in_mb' in events) and ('accounts:used_quota_in_mb' in events):
14004+ events['accounts:used_quota_in_percentage'] = int(events['accounts:used_quota_in_mb']/events['accounts:total_quota_in_mb']*100)
14005+ else:
14006+ events['accounts:used_quota_in_percentage'] = 0
14007+
1400214008 # dynamically extend our choices with other reports Google dynamically adds
1400314009 rep = buildGAPIObject(API.REPORTS)
1400414010 dyn_choices = rep._rootDesc \
@@ -14296,6 +14302,8 @@ def processCustomerUsage(usage, lastDate):
1429614302 row = {'date': usageDate}
1429714303 if addCSVData:
1429814304 row.update(addCSVData)
14305+ if 'accounts:used_quota_in_percentage' in events:
14306+ _computeUsedQuotaInPercentage(events)
1429914307 for event, count in events.items():
1430014308 if convertMbToGb and event.endswith('_in_gb'):
1430114309 count = f'{count/1024:.2f}'
@@ -14310,6 +14318,8 @@ def processCustomerUsage(usage, lastDate):
1431014318 row['orgUnitPath'] = userOrgUnits.get(email, UNKNOWN)
1431114319 if addCSVData:
1431214320 row.update(addCSVData)
14321+ if 'accounts:used_quota_in_percentage' in events:
14322+ _computeUsedQuotaInPercentage(events)
1431314323 for event, count in events.items():
1431414324 if convertMbToGb and event.endswith('_in_gb'):
1431514325 count = f'{count/1024:.2f}'
@@ -17164,17 +17174,18 @@ def _setNamesFromIds(admin, privileges):
1716417174 admin['condition'] = 'securitygroup'
1716517175 elif admin['condition'] == NONSECURITY_GROUP_CONDITION:
1716617176 admin['condition'] = 'nonsecuritygroup'
17167- if debug:
17168- print('******', admin['assignedTo'], admin.get('assigneeType', 'no type'),
17169- admin['assignedToField'], not typesSet or admin['assignedToField'] in typesSet)
17177+ # if debug:
17178+ # print('******', admin['assignedTo'], admin.get('assigneeType', 'no type'),
17179+ # admin['assignedToField'], not typesSet or admin['assignedToField'] in typesSet)
1717017180 return not typesSet or admin['assignedToField'] in typesSet
1717117181
1717217182 cd = buildGAPIObject(API.DIRECTORY)
1717317183 sal = buildGAPIObject(API.SERVICEACCOUNTLOOKUP)
1717417184 csvPF = CSVPrintFile(PRINT_ADMIN_TITLES) if Act.csvFormat() else None
1717517185 roleId = None
1717617186 userKey = None
17177- debug = oneItemPerRow = recursive = showPrivileges = False
17187+ # debug = False
17188+ oneItemPerRow = recursive = showPrivileges = False
1717817189 typesSet = set()
1717917190 kwargs = {}
1718017191 rolePrivileges = {}
@@ -17207,8 +17218,8 @@ def _setNamesFromIds(admin, privileges):
1720717218 showPrivileges = True
1720817219 elif myarg == 'oneitemperrow':
1720917220 oneItemPerRow = True
17210- elif myarg == 'debug':
17211- debug = True
17221+ # elif myarg == 'debug':
17222+ # debug = True
1721217223 else:
1721317224 unknownArgumentExit()
1721417225 if roleId and not kwargs:
0 commit comments