mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 09:51:36 +00:00
Improved create shareddrive retries
This commit is contained in:
@@ -290,14 +290,18 @@ If an item contains spaces, it should be surrounded by ".
|
||||
wsbizplus | workspacebusinessplus | 1010020025 |
|
||||
wsbizplusarchived | workspacebusinessplusarchived | 1010340003 |
|
||||
wsbizstan | workspacebusinessstandard | 1010020028 |
|
||||
wsbizstanarchived | workspacebusinessstandardarchived | 1010340006 |
|
||||
wsbizstarter | workspacebusinessstarter | wsbizstart | 1010020027 |
|
||||
wsbizstarterarchived | workspacebusinessstarterarchived | 1010340005 |
|
||||
wsentess | workspaceenterpriseessentials | 1010060003 |
|
||||
wsentplus | workspaceenterpriseplus | gae | gse | enterprise | gsuiteenterprise | 1010020020 |
|
||||
wsentstan | workspaceenterprisestandard | 1010020026 |
|
||||
wsentstanarchived | workspaceenterprisestandardarchived | 1010340004 |
|
||||
wsentstarter | workspaceenterprisestarter | 1010020029 | wes |
|
||||
wsess | workspaceesentials | gsuiteessentials | essentials | d4e | driveenterprise | drive4enterprise | 1010060001 |
|
||||
wsflw | workspacefrontline | workspacefrontlineworker | 1010020030
|
||||
wsessplus | workspaceessentialsplus | 1010060005 |
|
||||
wsflw | workspacefrontline | workspacefrontlineworker | 1010020030 |
|
||||
wsflwstan | workspacefrontlinestan | workspacefrontlineworkerstan | 1010020031
|
||||
|
||||
## Items built from primitives
|
||||
|
||||
@@ -4410,7 +4414,7 @@ gam [<UserTypeEntity>] info siteacls <SiteEntity> <SiteACLScopeEntity>
|
||||
gam [<UserTypeEntity>] show siteacls <SiteEntity>
|
||||
gam [<UserTypeEntity>] print siteacls <SiteEntity> [todrive <ToDriveAttribute>*]
|
||||
|
||||
# Shared Drives
|
||||
# Shared Drives - Administrator
|
||||
|
||||
<SharedDriveFieldName> ::=
|
||||
backgroundimagefile|
|
||||
@@ -4442,30 +4446,31 @@ sharingfoldersrequiresorganizerpermission true
|
||||
|
||||
In these commands, the Google administrator named in oauth2.txt is used.
|
||||
|
||||
gam show teamdrivethemes
|
||||
gam create|add teamdrive <Name>
|
||||
gam show shareddrivethemes
|
||||
gam create shareddrive <Name>
|
||||
[(theme|themeid <String>) | ([customtheme <DriveFileID> <Float> <Float> <Float>] [color <ColorValue>])]
|
||||
(<SharedDriveRestrictionsSubfieldName> <Boolean>)*
|
||||
[hide|hidden <Boolean>] [ou|org|orgunit <OrgUnitItem>]
|
||||
[errorretries <Integer>] [updateinitialdelay <Integer>] [updateretrydelay <Integer>]
|
||||
[(csv [todrive <ToDriveAttribute>*] (addcsvdata <FieldName> <String>)*) | returnidonly]
|
||||
gam update teamdrive <SharedDriveEntity> [name <Name>]
|
||||
gam update shareddrive <SharedDriveEntity> [name <Name>]
|
||||
[(theme|themeid <String>) | ([customtheme <DriveFileID> <Float> <Float> <Float>] [color <ColorValue>])]
|
||||
(<SharedDriveRestrictionsFieldName> <Boolean>)*
|
||||
[hide|hidden <Boolean>] [ou|org|orgunit <OrgUnitItem>]
|
||||
gam delete teamdrive <SharedDriveEntity>
|
||||
gam delete shareddrive <SharedDriveEntity>
|
||||
[adminaccess|asadmin] [allowitemdeletion]
|
||||
gam hide teamdrive <SharedDriveEntity>
|
||||
gam unhide teamdrive <SharedDriveEntity>
|
||||
gam info teamdrive <SharedDriveEntity> [fields <SharedDriveFieldNameList>]
|
||||
gam hide shareddrive <SharedDriveEntity>
|
||||
gam unhide shareddrive <SharedDriveEntity>
|
||||
gam info shareddrive <SharedDriveEntity> [fields <SharedDriveFieldNameList>]
|
||||
[formatjson]
|
||||
gam show teamdriveinfo <SharedDriveEntity> [fields <SharedDriveFieldNameList>]
|
||||
gam show shareddriveinfo <SharedDriveEntity> [fields <SharedDriveFieldNameList>]
|
||||
[formatjson]
|
||||
gam print teamdrives [todrive <ToDriveAttribute>*]
|
||||
gam print shareddrives [todrive <ToDriveAttribute>*]
|
||||
[teamdriveadminquery|query <QueryTeamDrive>]
|
||||
[matchname <RegularExpression>] [orgunit|org|ou <OrgUnitPath>]
|
||||
[fields <SharedDriveFieldNameList>] [noorgunits [<Boolean>]]
|
||||
[formatjson [quotechar <Character>]]
|
||||
gam show teamdrives
|
||||
gam show shareddrives
|
||||
[teamdriveadminquery|query <QueryTeamDrive>]
|
||||
[matchname <RegularExpression>] [orgunit|org|ou <OrgUnitPath>]
|
||||
[fields <SharedDriveFieldNameList>] [noorgunits [<Boolean>]]
|
||||
@@ -4480,24 +4485,29 @@ gam show oushareddrives
|
||||
|
||||
In these commands, you specify an administrator and then indicate that you want domain administrator access with the adminaccess option.
|
||||
|
||||
gam <UserTypeEntity> create|add teamdrive <Name> adminaccess
|
||||
gam <UserTypeEntity> create shareddrive <Name> adminaccess
|
||||
[(theme|themeid <String>) | ([customtheme <DriveFileID> <Float> <Float> <Float>] [color <ColorValue>])]
|
||||
(<SharedDriveRestrictionsSubfieldName> <Boolean>)*
|
||||
[hide <Boolean>]
|
||||
[hide|hidden <Boolean>] [ou|org|orgunit <OrgUnitItem>]
|
||||
[errorretries <Integer>] [updateinitialdelay <Integer>] [updateretrydelay <Integer>]
|
||||
[(csv [todrive <ToDriveAttribute>*] (addcsvdata <FieldName> <String>)*) | returnidonly]
|
||||
gam <UserTypeEntity> delete teamdrive <SharedDriveEntity>
|
||||
gam update shareddrive <SharedDriveEntity> asadmin [name <Name>]
|
||||
[(theme|themeid <String>) | ([customtheme <DriveFileID> <Float> <Float> <Float>] [color <ColorValue>])]
|
||||
(<SharedDriveRestrictionsFieldName> <Boolean>)*
|
||||
[hide|hidden <Boolean>] [ou|org|orgunit <OrgUnitItem>]
|
||||
gam <UserTypeEntity> delete shareddrive <SharedDriveEntity>
|
||||
adminaccess [allowitemdeletion]
|
||||
gam <UserTypeEntity> info teamdrive <SharedDriveEntity> adminaccess [fields <SharedDriveFieldNameList>]
|
||||
gam <UserTypeEntity> info shareddrive <SharedDriveEntity> adminaccess [fields <SharedDriveFieldNameList>]
|
||||
[formatjson]
|
||||
gam <UserTypeEntity> show teamdriveinfo <SharedDriveEntity> adminaccess [fields <SharedDriveFieldNameList>]
|
||||
gam <UserTypeEntity> show shareddriveinfo <SharedDriveEntity> adminaccess [fields <SharedDriveFieldNameList>]
|
||||
[formatjson]
|
||||
gam <UserTypeEntity> print teamdrives [todrive <ToDriveAttribute>*]
|
||||
gam <UserTypeEntity> print shareddrives [todrive <ToDriveAttribute>*]
|
||||
adminaccess [teamdriveadminquery|query <QueryTeamDrive>]
|
||||
[matchname <RegularExpression>] [orgunit|org|ou <OrgUnitPath>]
|
||||
(role|roles <SharedDriveACLRoleList>)*
|
||||
[fields <SharedDriveFieldNameList>]
|
||||
[formatjson [quotechar <Character>]]
|
||||
gam <UserTypeEntity> show teamdrives
|
||||
gam <UserTypeEntity> show shareddrives
|
||||
adminaccess [teamdriveadminquery|query <QueryTeamDrive>]
|
||||
[matchname <RegularExpression>] [orgunit|org|ou <OrgUnitPath>]
|
||||
(role|roles <SharedDriveACLRoleList>)*
|
||||
@@ -7355,7 +7365,7 @@ gam <UserTypeEntity> show tasklists
|
||||
gam <UserTypeEntity> print tasklists [todrive <ToDriveAttribute>*]
|
||||
[countsonly | (formatjson [quotechar <Character>])]
|
||||
|
||||
# Users - Team Drives
|
||||
# Users - Shared Drives
|
||||
|
||||
<SharedDriveRestrictionsSubfieldName> ::=
|
||||
adminmanagedrestrictions|
|
||||
@@ -7373,32 +7383,32 @@ sharingfoldersrequiresorganizerpermission false
|
||||
allowcontentmanagerstosharefolders false
|
||||
sharingfoldersrequiresorganizerpermission true
|
||||
|
||||
gam <UserTypeEntity> show teamdrivethemes
|
||||
gam <UserTypeEntity> create|add teamdrive <Name> [adminaccess|asadmin]
|
||||
gam <UserTypeEntity> show shareddrivethemes
|
||||
gam <UserTypeEntity> create shareddrive <Name>
|
||||
[(theme|themeid <String>) | ([customtheme <DriveFileID> <Float> <Float> <Float>] [color <ColorValue>])]
|
||||
(<SharedDriveRestrictionsSubfieldName> <Boolean>)*
|
||||
[hide|hidden <Boolean>] [ou|org|orgunit <OrgUnitItem>]
|
||||
gam <UserTypeEntity> update teamdrive <SharedDriveEntity> [adminaccess|asadmin] [name <Name>]
|
||||
[hide|hidden <Boolean>]
|
||||
[errorretries <Integer>] [updateinitialdelay <Integer>] [updateretrydelay <Integer>]
|
||||
[(csv [todrive <ToDriveAttribute>*] (addcsvdata <FieldName> <String>)*) | returnidonly]
|
||||
gam <UserTypeEntity> update shareddrive <SharedDriveEntity> [name <Name>]
|
||||
[(theme|themeid <String>) | ([customtheme <DriveFileID> <Float> <Float> <Float>] [color <ColorValue>])]
|
||||
(<SharedDriveRestrictionsSubfieldName> <Boolean>)*
|
||||
[hide|hidden <Boolean>] [ou|org|orgunit <OrgUnitItem>]
|
||||
gam <UserTypeEntity> delete teamdrive <SharedDriveEntity>
|
||||
[adminaccess|asadmin] [allowitemdeletion]
|
||||
gam <UserTypeEntity> hide teamdrive <SharedDriveEntity>
|
||||
gam <UserTypeEntity> unhide teamdrive <SharedDriveEntity>
|
||||
gam <UserTypeEntity> info teamdrive <SharedDriveEntity> [fields <SharedDriveFieldNameList>]
|
||||
[hide|hidden <Boolean>]
|
||||
gam <UserTypeEntity> delete shareddrive <SharedDriveEntity>
|
||||
[allowitemdeletion]
|
||||
gam <UserTypeEntity> hide shareddrive <SharedDriveEntity>
|
||||
gam <UserTypeEntity> unhide shareddrive <SharedDriveEntity>
|
||||
gam <UserTypeEntity> info shareddrive <SharedDriveEntity> [fields <SharedDriveFieldNameList>]
|
||||
[formatjson]
|
||||
gam <UserTypeEntity> info teamdrive <SharedDriveEntity> [fields <SharedDriveFieldNameList>]
|
||||
gam <UserTypeEntity> show shareddriveinfo <SharedDriveEntity> [fields <SharedDriveFieldNameList>]
|
||||
[formatjson]
|
||||
gam <UserTypeEntity> show teamdriveinfo <SharedDriveEntity> [fields <SharedDriveFieldNameList>]
|
||||
[formatjson]
|
||||
gam <UserTypeEntity> print teamdrives [todrive <ToDriveAttribute>*]
|
||||
gam <UserTypeEntity> print shareddrives [todrive <ToDriveAttribute>*]
|
||||
[adminaccess|asadmin [teamdriveadminquery|query <QueryTeamDrive>]]
|
||||
[matchname <RegularExpression>] [orgunit|org|ou <OrgUnitPath>]
|
||||
(role|roles <SharedDriveACLRoleList>)*
|
||||
[fields <SharedDriveFieldNameList>] [noorgunits [<Boolean>]]
|
||||
[formatjson [quotechar <Character>]]
|
||||
gam <UserTypeEntity> show teamdrives
|
||||
gam <UserTypeEntity> show shareddrives
|
||||
[adminaccess|asadmin [teamdriveadminquery|query <QueryTeamDrive>]]
|
||||
[matchname <RegularExpression>] [orgunit|org|ou <OrgUnitPath>]
|
||||
(role|roles <SharedDriveACLRoleList>)*
|
||||
|
||||
@@ -2,6 +2,17 @@
|
||||
|
||||
Merged GAM-Team version
|
||||
|
||||
6.61.18
|
||||
|
||||
Added the following options to `gam [<UserTypeEntity>] create shareddrive` to allow better control
|
||||
of the create/update process when attributes other than `themeid` are specified.
|
||||
```
|
||||
errorretries <Integer> - Number of create/update error retries; default value 5, range 0-10
|
||||
updateinitialdelay <Integer> - Initial delay after create before update: default value 10, range 0-60
|
||||
updateretrydelay <Integer> - Retry delay when update fails; default value 10, range 0-60
|
||||
```
|
||||
* See: https://github.com/taers232c/GAMADV-XTD3/wiki/Shared-Drives#create-a-shared-drive
|
||||
|
||||
6.61.17
|
||||
|
||||
Updated `gam print|show vaultexports|vaultholds|vaultqueries` to not set a non-zero return code
|
||||
|
||||
@@ -59201,7 +59201,7 @@ def _getSharedDriveRestrictions(myarg, body):
|
||||
return True
|
||||
return False
|
||||
|
||||
def _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci=None):
|
||||
def _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci, returnIdOnly):
|
||||
action = Act.Get()
|
||||
name = f'orgUnits/-/memberships/shared_drive;{driveId}'
|
||||
if ci is None:
|
||||
@@ -59211,8 +59211,9 @@ def _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci=None):
|
||||
try:
|
||||
callGAPI(ci.orgUnits().memberships(), 'move',
|
||||
name=name, body=cibody)
|
||||
Act.Set(Act.MOVE)
|
||||
entityModifierNewValueActionPerformed([Ent.SHAREDDRIVE, driveId], Act.MODIFIER_TO, f'{Ent.Singular(Ent.ORGANIZATIONAL_UNIT)}: {orgUnit}', i, count)
|
||||
if not returnIdOnly:
|
||||
Act.Set(Act.MOVE)
|
||||
entityModifierNewValueActionPerformed([Ent.SHAREDDRIVE, driveId], Act.MODIFIER_TO, f'{Ent.Singular(Ent.ORGANIZATIONAL_UNIT)}: {orgUnit}', i, count)
|
||||
except (GAPI.notFound, GAPI.forbidden, GAPI.badRequest, GAPI.internalError,
|
||||
GAPI.noManageTeamDriveAdministratorPrivilege) as e:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], str(e), i, count)
|
||||
@@ -59225,10 +59226,11 @@ def _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci=None):
|
||||
# [(theme|themeid <String>) | ([customtheme <DriveFileID> <Float> <Float> <Float>] [color <ColorValue>])]
|
||||
# (<SharedDriveRestrictionsFieldName> <Boolean>)*
|
||||
# [hide|hidden <Boolean>] [ou|org|orgunit <OrgUnitItem>]
|
||||
# [errorretries <Integer>] [updateinitialdelay <Integer>] [updateretrydelay <Integer>]
|
||||
# [(csv [todrive <ToDriveAttribute>*] (addcsvdata <FieldName> <String>)*) | returnidonly]
|
||||
def createSharedDrive(users, useDomainAdminAccess=False):
|
||||
def waitingForCreationToComplete(sleep_time):
|
||||
writeStdout(Ind.Spaces()+Msg.WAITING_FOR_SHARED_DRIVE_CREATION_TO_COMPLETE_SLEEPING.format(sleep_time))
|
||||
writeStderr(Ind.Spaces()+Msg.WAITING_FOR_SHARED_DRIVE_CREATION_TO_COMPLETE_SLEEPING.format(sleep_time))
|
||||
time.sleep(sleep_time)
|
||||
|
||||
requestId = str(uuid.uuid4())
|
||||
@@ -59238,6 +59240,9 @@ def createSharedDrive(users, useDomainAdminAccess=False):
|
||||
addCSVData = {}
|
||||
hide = returnIdOnly = False
|
||||
orgUnit = orgUnitId = ci = None
|
||||
errorRetries = 5
|
||||
updateInitialDelay = 10
|
||||
updateRetryDelay = 10
|
||||
while Cmd.ArgumentsRemaining():
|
||||
myarg = getArgument()
|
||||
if _getSharedDriveTheme(myarg, body):
|
||||
@@ -59259,6 +59264,12 @@ def createSharedDrive(users, useDomainAdminAccess=False):
|
||||
addCSVData[k] = getString(Cmd.OB_STRING, minLen=0)
|
||||
elif myarg in ADMIN_ACCESS_OPTIONS:
|
||||
useDomainAdminAccess = True
|
||||
elif myarg == 'errorretries':
|
||||
errorRetries = getInteger(minVal=0, maxVal=10)
|
||||
elif myarg == 'updateinitialdelay':
|
||||
updateInitialDelay = getInteger(minVal=0, maxVal=60)
|
||||
elif myarg == 'updateretrydelay':
|
||||
updateRetryDelay = getInteger(minVal=0, maxVal=60)
|
||||
else:
|
||||
unknownArgumentExit()
|
||||
if csvPF:
|
||||
@@ -59299,7 +59310,7 @@ def createSharedDrive(users, useDomainAdminAccess=False):
|
||||
break
|
||||
except (GAPI.transientError, GAPI.teamDriveAlreadyExists) as e:
|
||||
retry += 1
|
||||
if retry > 3:
|
||||
if retry > errorRetries:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.REQUEST_ID, requestId], str(e), i, count)
|
||||
break
|
||||
requestId = str(uuid.uuid4())
|
||||
@@ -59313,7 +59324,8 @@ def createSharedDrive(users, useDomainAdminAccess=False):
|
||||
userSvcNotApplicableOrDriveDisabled(user, str(e), i, count)
|
||||
break
|
||||
if doUpdate and (updateBody or hide or orgUnit):
|
||||
waitingForCreationToComplete(30)
|
||||
if updateBody or hide:
|
||||
waitingForCreationToComplete(updateInitialDelay)
|
||||
try:
|
||||
if updateBody:
|
||||
Act.Set(Act.UPDATE)
|
||||
@@ -59332,10 +59344,10 @@ def createSharedDrive(users, useDomainAdminAccess=False):
|
||||
break
|
||||
except GAPI.notFound as e:
|
||||
retry += 1
|
||||
if retry > 3:
|
||||
if retry > errorRetries:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.REQUEST_ID, requestId], str(e), i, count)
|
||||
break
|
||||
waitingForCreationToComplete(retry*15)
|
||||
waitingForCreationToComplete(updateRetryDelay)
|
||||
except (GAPI.badRequest, GAPI.internalError, GAPI.permissionDenied) as e:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], str(e), i, count)
|
||||
break
|
||||
@@ -59357,12 +59369,12 @@ def createSharedDrive(users, useDomainAdminAccess=False):
|
||||
break
|
||||
except GAPI.notFound as e:
|
||||
retry += 1
|
||||
if retry > 3:
|
||||
if retry > errorRetries:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.REQUEST_ID, requestId], str(e), i, count)
|
||||
break
|
||||
time.sleep(retry*retry)
|
||||
waitingForCreationToComplete(updateRetryDelay)
|
||||
if orgUnit:
|
||||
ci = _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci)
|
||||
ci = _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci, returnIdOnly)
|
||||
except (GAPI.forbidden, GAPI.badRequest, GAPI.noManageTeamDriveAdministratorPrivilege) as e:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], str(e), i, count)
|
||||
except (GAPI.serviceNotAvailable, GAPI.authError, GAPI.domainPolicy) as e:
|
||||
@@ -59431,7 +59443,7 @@ def updateSharedDrive(users, useDomainAdminAccess=False):
|
||||
driveId=driveId)
|
||||
entityActionPerformed([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], i, count)
|
||||
if orgUnit:
|
||||
ci = _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci)
|
||||
ci = _moveSharedDriveToOU(orgUnit, orgUnitId, driveId, user, i, count, ci, False)
|
||||
except (GAPI.notFound, GAPI.forbidden, GAPI.badRequest, GAPI.internalError,
|
||||
GAPI.noManageTeamDriveAdministratorPrivilege) as e:
|
||||
entityActionFailedWarning([Ent.USER, user, Ent.SHAREDDRIVE_ID, driveId], str(e), i, count)
|
||||
|
||||
Reference in New Issue
Block a user