Updated gam <UserTypeEntity> archive messages to handle the followong error:
Some checks failed
Build and test GAM / build (Win64, build, 8, VC-WIN64A, windows-2022) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 2, linux-aarch64, [self-hosted linux arm64]) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 4, linux-aarch64, [self-hosted linux arm64], yes) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 6, darwin64-arm64, macos-14) (push) Has been cancelled
Build and test GAM / build (universal2, build, 7, darwin64-arm64 darwin64-x86_64, macos-14) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-20.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 3, linux-x86_64, ubuntu-20.04, yes) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 5, darwin64-x86_64, macos-12) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 10, ubuntu-22.04, 3.9) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 11, ubuntu-22.04, 3.10) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 12, ubuntu-22.04, 3.11) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 9, ubuntu-22.04, 3.8) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-apis (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled

googleapiclient.errors.MediaUploadSizeError: Media larger than: 26214400
This commit is contained in:
Ross Scroggs
2024-09-09 08:38:04 -07:00
parent 72ca010a5f
commit 6043411825
6 changed files with 41 additions and 23 deletions

View File

@@ -10,6 +10,13 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads-Installs](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads-Installs) for Windows or other options, including manual installation
### 6.80.21
Updated `gam <UserTypeEntity> archive messages` to handle the followong error:
```
googleapiclient.errors.MediaUploadSizeError: Media larger than: 26214400
```
### 6.80.20
Updated `gam report usage user` and `gam report users` to handle the followong error:

View File

@@ -251,7 +251,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin$ gam version
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAMADV-XTD3 6.80.20 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.80.21 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.5 64-bit final
MacOS Sonoma 14.5 x86_64
@@ -923,7 +923,7 @@ writes the credentials into the file oauth2.txt.
C:\>del C:\GAMConfig\oauth2.txt
C:\>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.80.20 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.80.21 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.5 64-bit final
Windows-10-10.0.17134 AMD64

View File

@@ -3,7 +3,7 @@
Print the current version of Gam with details
```
gam version
GAMADV-XTD3 6.80.20 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.80.21 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.5 64-bit final
MacOS Sonoma 14.5 x86_64
@@ -15,7 +15,7 @@ Time: 2023-06-02T21:10:00-07:00
Print the current version of Gam with details and time offset information
```
gam version timeoffset
GAMADV-XTD3 6.80.20 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.80.21 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.5 64-bit final
MacOS Sonoma 14.5 x86_64
@@ -27,7 +27,7 @@ Your system time differs from www.googleapis.com by less than 1 second
Print the current version of Gam with extended details and SSL information
```
gam version extended
GAMADV-XTD3 6.80.20 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.80.21 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.5 64-bit final
MacOS Sonoma 14.5 x86_64
@@ -64,7 +64,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3
Version Check:
Current: 5.35.08
Latest: 6.80.20
Latest: 6.80.21
echo $?
1
```
@@ -72,7 +72,7 @@ echo $?
Print the current version number without details
```
gam version simple
6.80.20
6.80.21
```
In Linux/MacOS you can do:
```
@@ -82,7 +82,7 @@ echo $VER
Print the current version of Gam and address of this Wiki
```
gam help
GAM 6.80.20 - https://github.com/taers232c/GAMADV-XTD3
GAM 6.80.21 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.5 64-bit final
MacOS Sonoma 14.5 x86_64

View File

@@ -2,9 +2,16 @@
Merged GAM-Team version
6.80.21
Updated `gam <UserTypeEntity> archive messages` to handle the followong error:
```
googleapiclient.errors.MediaUploadSizeError: Media larger than: 26214400
```
6.80.20
Updated `gam report usage user` and `gam report users` to handle the followong error:
Updated `gam report usage user` and `gam report users` to handle the followong error:
```
ERROR: 503: serviceNotAvailable - The service is currently unavailable.
```

View File

@@ -1589,7 +1589,7 @@ def getOrgUnitItem(pathOnly=False, absolutePath=True, cd=None):
return makeOrgUnitPathAbsolute(result['orgUnitPath'])
return makeOrgUnitPathRelative(result['orgUnitPath'])
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError,
GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
checkEntityAFDNEorAccessErrorExit(cd, Ent.ORGANIZATIONAL_UNIT, path)
invalidArgumentExit(Cmd.OB_ORGUNIT_PATH)
Cmd.Advance()
@@ -1608,7 +1608,7 @@ def getTopLevelOrgId(cd, parentOrgUnitPath):
return result['orgUnitId']
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError):
return None
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
checkEntityAFDNEorAccessErrorExit(cd, Ent.ORGANIZATIONAL_UNIT, parentOrgUnitPath)
return None
try:
@@ -1650,7 +1650,7 @@ def getOrgUnitId(cd=None, orgUnit=None):
return (result['orgUnitPath'], result['orgUnitId'])
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError):
entityDoesNotExistExit(Ent.ORGANIZATIONAL_UNIT, orgUnit)
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
accessErrorExit(cd)
def getAllParentOrgUnitsForUser(cd, user):
@@ -1680,7 +1680,7 @@ def getAllParentOrgUnitsForUser(cd, user):
parentPath = result['parentOrgUnitId']
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError):
entityDoesNotExistExit(Ent.ORGANIZATIONAL_UNIT, parentPath)
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
accessErrorExit(cd)
return orgUnits
@@ -5289,6 +5289,8 @@ def callGAPI(service, function,
if reason == GAPI.INSUFFICIENT_PERMISSIONS:
APIAccessDeniedExit()
systemErrorExit(HTTP_ERROR_RC, formatHTTPError(http_status, reason, message))
except googleapiclient.errors.MediaUploadSizeError as e:
raise e
except (httplib2.HttpLib2Error, google.auth.exceptions.TransportError, RuntimeError) as e:
if n != triesLimit:
service._http.connections = {}
@@ -5796,7 +5798,8 @@ def convertOrgUnitIDtoPath(cd, orgUnitId):
orgUnitPath = callGAPI(cd.orgunits(), 'get',
throwReasons=GAPI.ORGUNIT_GET_THROW_REASONS,
customerId=GC.Values[GC.CUSTOMER_ID], orgUnitPath=orgUnitId, fields='orgUnitPath')['orgUnitPath']
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError, GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError,
GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
orgUnitPath = orgUnitId
GM.Globals[GM.MAP_ORGUNIT_ID_TO_NAME][orgUnitId] = orgUnitPath
return orgUnitPath
@@ -6326,7 +6329,7 @@ def getItemsToModify(entityType, entity, memberRoles=None, isSuspended=None, isA
customerId=GC.Values[GC.CUSTOMER_ID],
orgUnitPath=ou, fields='orgUnitPath')['orgUnitPath']
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError, GAPI.badRequest,
GAPI.invalidCustomerId, GAPI.loginRequired):
GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
checkEntityDNEorAccessErrorExit(cd, Ent.ORGANIZATIONAL_UNIT, ou)
_incrEntityDoesNotExist(Ent.ORGANIZATIONAL_UNIT)
continue
@@ -13073,7 +13076,7 @@ def getUserOrgUnits(cd, orgUnit, orgUnitId):
userOrgUnits[user['primaryEmail']] = user['orgUnitPath']
return userOrgUnits
except (GAPI.badRequest, GAPI.invalidInput, GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError,
GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.resourceNotFound, GAPI.forbidden):
GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.resourceNotFound, GAPI.forbidden, GAPI.permissionDenied):
checkEntityDNEorAccessErrorExit(cd, Ent.ORGANIZATIONAL_UNIT, orgUnit)
# Convert report mb item to gb
@@ -17012,7 +17015,7 @@ def doCreateOrg():
customerId=GC.Values[GC.CUSTOMER_ID], orgUnitPath=parent, fields='orgUnitPath')['orgUnitPath']
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError):
pass
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
errMsg = accessErrorMessage(cd)
if errMsg:
systemErrorExit(INVALID_DOMAIN_RC, errMsg)
@@ -17056,7 +17059,7 @@ def doCreateOrg():
body['description'] = description
if not _createOrg(body, body['parentOrgUnitPath'], fullPath):
return
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
checkEntityAFDNEorAccessErrorExit(cd, Ent.ORGANIZATIONAL_UNIT, fullPath)
def checkOrgUnitPathExists(cd, orgUnitPath, i=0, count=0, showError=False):
@@ -17071,7 +17074,7 @@ def checkOrgUnitPathExists(cd, orgUnitPath, i=0, count=0, showError=False):
return (True, orgUnit['orgUnitPath'], orgUnit['orgUnitId'])
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError):
pass
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
errMsg = accessErrorMessage(cd)
if errMsg:
systemErrorExit(INVALID_DOMAIN_RC, errMsg)
@@ -17419,7 +17422,7 @@ def _doInfoOrgs(entityList):
Ind.Decrement()
except (GAPI.invalidInput, GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError):
entityActionFailedWarning([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], Msg.DOES_NOT_EXIST, i, count)
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.resourceNotFound, GAPI.forbidden):
except (GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.resourceNotFound, GAPI.forbidden, GAPI.permissionDenied):
checkEntityAFDNEorAccessErrorExit(cd, Ent.ORGANIZATIONAL_UNIT, orgUnitPath)
# gam info orgs|ous <OrgUnitEntity> [nousers|notsuspended|suspended] [children|child]
@@ -17551,7 +17554,7 @@ def _getOrgUnits(cd, orgUnitPath, fieldsList, listType, showParent, batchSubOrgs
customerId=GC.Values[GC.CUSTOMER_ID], orgUnitPath=missing_parent, fields=fields)
orgUnits.append(result)
except (GAPI.invalidOrgunit, GAPI.orgunitNotFound, GAPI.backendError,
GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired):
GAPI.badRequest, GAPI.invalidCustomerId, GAPI.loginRequired, GAPI.permissionDenied):
pass
if listType == 'all' and orgUnitPath == '/':
printGotAccountEntities(len(orgUnits))
@@ -68281,7 +68284,8 @@ def archiveMessages(users):
except GAPI.serviceNotAvailable:
entityServiceNotApplicableWarning(Ent.USER, user, i, count)
break
except (GAPI.badRequest, GAPI.invalid, GAPI.failedPrecondition, GAPI.forbidden) as e:
except (GAPI.badRequest, GAPI.invalid, GAPI.failedPrecondition, GAPI.forbidden,
googleapiclient.errors.MediaUploadSizeError) as e:
_processMessageFailed(user, messageId, str(e), j, jcount)
except (GAPI.serviceNotAvailable, GAPI.badRequest):
entityServiceNotApplicableWarning(Ent.USER, user, i, count)

View File

@@ -272,7 +272,7 @@ KEEP_THROW_REASONS = [SERVICE_NOT_AVAILABLE, BAD_REQUEST, PERMISSION_DENIED, INV
LOOKERSTUDIO_THROW_REASONS = [INVALID_ARGUMENT, SERVICE_NOT_AVAILABLE, BAD_REQUEST, NOT_FOUND, PERMISSION_DENIED, INTERNAL_ERROR]
MEMBERS_THROW_REASONS = [GROUP_NOT_FOUND, DOMAIN_NOT_FOUND, DOMAIN_CANNOT_USE_APIS, INVALID, FORBIDDEN, SERVICE_NOT_AVAILABLE]
MEMBERS_RETRY_REASONS = [SYSTEM_ERROR, SERVICE_NOT_AVAILABLE]
ORGUNIT_GET_THROW_REASONS = [INVALID_ORGUNIT, ORGUNIT_NOT_FOUND, BACKEND_ERROR, BAD_REQUEST, INVALID_CUSTOMER_ID, LOGIN_REQUIRED]
ORGUNIT_GET_THROW_REASONS = [INVALID_ORGUNIT, ORGUNIT_NOT_FOUND, BACKEND_ERROR, BAD_REQUEST, INVALID_CUSTOMER_ID, LOGIN_REQUIRED, PERMISSION_DENIED]
PEOPLE_ACCESS_THROW_REASONS = [SERVICE_NOT_AVAILABLE, FORBIDDEN, PERMISSION_DENIED]
RESELLER_THROW_REASONS = [BAD_REQUEST, RESOURCE_NOT_FOUND, FORBIDDEN, INVALID]
SHEETS_ACCESS_THROW_REASONS = DRIVE_USER_THROW_REASONS+[NOT_FOUND, PERMISSION_DENIED, FORBIDDEN, INTERNAL_ERROR, INSUFFICIENT_FILE_PERMISSIONS,