Added option wait <Integer> <Integer> to gam create datatransfer

This commit is contained in:
Ross Scroggs
2024-02-06 18:20:54 -08:00
parent e8b2dee02d
commit dcaf892e95
7 changed files with 58 additions and 12 deletions

View File

@@ -11,6 +11,13 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
### 6.67.39
Added option `wait <Integer> <Integer>` to `gam create datatransfer` that causes GAM to wait
for the transfer to complete. The first `<Integer>` must be in the range 5-60 and is the number
of seconds between checks to see if the transfer has completed. The second `<Integer>` is the maximum
number of checks to perform. By default, GAM does not wait for the transfer to complete.
### 6.67.38
Added option `tdnotify [<Boolean>]` to `<ToDriveAttribute>` that causes GAM to send notification

View File

@@ -37,6 +37,7 @@ gam create|add datatransfer|transfer <OldOwnerID> <DataTransferServiceList> <New
[private|shared|all] [privacy_level private|shared|private,shared]
[releaseresources [<Boolean>]]
(<ParameterKey> <ParameterValue>)*
[wait <Integer> <Integer>]
```
For`datastudio` and `drive`, there are options to control the privacy level of the files to be transferred.
* `private` or `privacy_level private` - Transfer files that are not shared with anyone
@@ -54,6 +55,10 @@ As of 2020-06-10, background transfers only transfer future non-private events w
The option `<ParameterKey> <ParameterValue>` is for future expansion.
By default, GAM does not wait for the transfer to complete. The option `wait <Integer> <Integer>` causes GAM to wait
for the transfer to complete. The first `<Integer>` must be in the range 5-60 and is the number
of seconds between checks to see if the transfer has completed. The second `<Integer>` is the maximum number of checks to perform.
## Display transfers
```
gam info datatransfer|transfer <TransferID>

View File

@@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./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.67.38 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.39 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 x86_64
@@ -1002,7 +1002,7 @@ writes the credentials into the file oauth2.txt.
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.67.38 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.39 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 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.67.38 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.39 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 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.67.38 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.39 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 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.67.38 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.67.39 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 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.67.38
Latest: 6.67.39
echo $?
1
```
@@ -72,7 +72,7 @@ echo $?
Print the current version number without details
```
gam version simple
6.67.38
6.67.39
```
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.67.38 - https://github.com/taers232c/GAMADV-XTD3
GAM 6.67.39 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.1 64-bit final
MacOS Sonoma 14.2.1 x86_64

View File

@@ -3142,7 +3142,7 @@ gam print|show transferapps
gam create|add datatransfer|transfer <OldOwnerID> <DataTransferServiceList> <NewOwnerID>
[private|shared|all] [release_resources]
(<ParameterKey> <ParameterValue>)*
[wait <Integer> <Integer>]
gam info datatransfer|transfer <TransferID>
gam print datatransfers|transfers [todrive <ToDriveAttribute>*]
[olduser|oldowner <UserItem>] [newuser|newowner <UserItem>]
@@ -3363,16 +3363,16 @@ gam show peoplecontacts
[allfields|(fields <PeopleFieldNameList>)] [showmetadata]
[formatjson]
gam info people <PeopleResourceNameEntity>
gam info people|peopleprofile <PeopleResourceNameEntity>
[allfields|(fields <PeopleFieldNameList>)] [showmetadata]
[formatjson]
gam print people [todrive <ToDriveAttribute>*]
gam print people|peopleprofile [todrive <ToDriveAttribute>*]
[query <String>]
[mergesources <PeopleMergeSourceName>]
[coountsonly]
[allfields|(fields <PeopleFieldNameList>)] [showmetadata]
[formatjson [quotechar <Character>]]
gam show people
gam show people|peopleprofile
[query <String>]
[mergesources <PeopleMergeSourceName>]
[coountsonly]

View File

@@ -2,6 +2,13 @@
Merged GAM-Team version
6.67.39
Added option `wait <Integer> <Integer>` to `gam create datatransfer` that causes GAM to wait
for the transfer to complete. The first `<Integer>` must be in the range 5-60 and is the number
of seconds between checks to see if the transfer has completed. The second `<Integer>` is the maximum
number of checks to perform. By default, GAM does not wait for the transfer to complete.
6.67.38
Added option `tdnotify [<Boolean>]` to `<ToDriveAttribute>` that causes GAM to send notification

View File

@@ -16351,6 +16351,7 @@ PRIVACY_LEVEL_CHOICE_MAP = {
# gam create datatransfer|transfer <OldOwnerID> <ServiceNameList> <NewOwnerID>
# [private|shared|all] [release_resources] (<ParameterKey> <ParameterValue>)*
# [wait <Integer> <Integer>]
def doCreateDataTransfer():
def _assignAppParameter(key, value, doubleBackup=False):
keyValid = False
@@ -16375,6 +16376,7 @@ def doCreateDataTransfer():
body = {'oldOwnerUserId': convertEmailAddressToUID(old_owner)}
appIndicies = {}
appNameList = []
waitInterval = waitRetries = 0
i = 0
body['applicationDataTransfers'] = []
for appName in getString(Cmd.OB_SERVICE_NAME_LIST).split(','):
@@ -16395,6 +16397,9 @@ def doCreateDataTransfer():
elif myarg == 'releaseresources':
if getBoolean():
_assignAppParameter('RELEASE_RESOURCES', ['TRUE'])
elif myarg == 'wait':
waitInterval = getInteger(minVal=5, maxVal=60)
waitRetries = getInteger(minVal=0)
else:
_assignAppParameter(Cmd.Previous().upper(), getString(Cmd.OB_PARAMETER_VALUE).upper().split(','), True)
try:
@@ -16410,6 +16415,28 @@ def doCreateDataTransfer():
printKeyValueList([Msg.FROM, old_owner])
printKeyValueList([Msg.TO, new_owner])
Ind.Decrement()
if waitRetries == 0:
return
retry = 0
status = 'inProgress'
dtId = result['id']
while True:
writeStderr(Ind.Spaces()+Msg.WAITING_FOR_DATA_TRANSFER_TO_COMPLETE_SLEEPING.format(waitInterval))
time.sleep(waitInterval)
try:
result = callGAPI(dt.transfers(), 'get',
throwReasons=[GAPI.NOT_FOUND],
dataTransferId=dtId, fields='overallTransferStatusCode')
if result['overallTransferStatusCode'] == 'completed':
status = result['overallTransferStatusCode']
break
retry += 1
if retry >= waitRetries:
break
except GAPI.notFound:
entityActionFailedWarning([Ent.TRANSFER_ID, dtId], Msg.DOES_NOT_EXIST)
break
printEntity([Ent.TRANSFER_ID, dtId, Ent.STATUS, status])
def _showTransfer(apps, transfer, i, count):
printEntity([Ent.TRANSFER_ID, transfer['id']], i, count)