diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index d623fdf7..b8146ef9 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -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.14 + +Updated reseller commands to handle the following error: +``` +ERROR: 400: invalid - Customer domain [domain.com] is linked to one or more email verified customers, please provide a customer id. +``` + ### 6.67.13 Updated `gam create domain ` to handle the following error: diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index 7a68a2f4..7ed25084 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -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.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs 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.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.1 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 4ad56aa7..23f5ba36 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -4,7 +4,7 @@ Print the current version of Gam with details ``` gam version -GAMADV-XTD3 6.67.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.1 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -16,7 +16,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.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.1 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -28,7 +28,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.13 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.67.14 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.1 64-bit final MacOS Sonoma 14.2.1 x86_64 @@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64 Path: /Users/Admin/bin/gamadv-xtd3 Version Check: Current: 5.35.08 - Latest: 6.67.13 + Latest: 6.67.14 echo $? 1 ``` @@ -73,7 +73,7 @@ echo $? Print the current version number without details ``` gam version simple -6.67.13 +6.67.14 ``` In Linux/MacOS you can do: ``` @@ -83,7 +83,7 @@ echo $VER Print the current version of Gam and address of this Wiki ``` gam help -GAM 6.67.13 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.67.14 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.12.1 64-bit final MacOS Sonoma 14.2.1 x86_64 diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index f1485390..297467a9 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,13 @@ Merged GAM-Team version +6.67.14 + +Updated reseller commands to handle the following error: +``` +ERROR: 400: invalid - Customer domain [domain.com] is linked to one or more email verified customers, please provide a customer id. +``` + 6.67.13 Updated `gam create domain ` to handle the following error: diff --git a/src/gam/__init__.py b/src/gam/__init__.py index e5eb5835..4cfa5845 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -3,7 +3,7 @@ # # GAM # -# Copyright 2023, All Rights Reserved. +# Copyright 2024, All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14579,10 +14579,10 @@ def doCreateResoldCustomer(): body['customerDomain'] = customerDomain try: result = callGAPI(res.customers(), 'insert', - throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=GAPI.RESELLER_THROW_REASONS, body=body, customerAuthToken=customerAuthToken, fields='customerId') entityActionPerformed([Ent.CUSTOMER_DOMAIN, body['customerDomain'], Ent.CUSTOMER_ID, result['customerId']]) - except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden) as e: + except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden, GAPI.invalid) as e: entityActionFailedWarning([Ent.CUSTOMER_DOMAIN, body['customerDomain']], str(e)) # gam update resoldcustomer [customer_auth_token ] + @@ -14592,10 +14592,10 @@ def doUpdateResoldCustomer(): customerAuthToken, body = _getResoldCustomerAttr() try: callGAPI(res.customers(), 'patch', - throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=GAPI.RESELLER_THROW_REASONS, customerId=customerId, body=body, customerAuthToken=customerAuthToken, fields='') entityActionPerformed([Ent.CUSTOMER_ID, customerId]) - except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden) as e: + except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden, GAPI.invalid) as e: entityActionFailedWarning([Ent.CUSTOMER_ID, customerId], str(e)) # gam info resoldcustomer [formatjson] @@ -14608,7 +14608,7 @@ def doInfoResoldCustomer(): FJQC.GetFormatJSON(myarg) try: customerInfo = callGAPI(res.customers(), 'get', - throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=GAPI.RESELLER_THROW_REASONS, customerId=customerId) if not FJQC.formatJSON: printKeyValueList(['Customer ID', customerInfo['customerId']]) @@ -14624,7 +14624,7 @@ def doInfoResoldCustomer(): printKeyValueList(['Customer Admin Console URL', customerInfo['resourceUiUrl']]) else: printLine(json.dumps(cleanJSON(customerInfo), ensure_ascii=False, sort_keys=False)) - except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden) as e: + except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden, GAPI.invalid) as e: entityActionFailedWarning([Ent.CUSTOMER_ID, customerId], str(e)) def getCustomerSubscription(res): @@ -14634,9 +14634,9 @@ def getCustomerSubscription(res): invalidChoiceExit(skuId, SKU.getSortedSKUList(), True) try: subscriptions = callGAPIpages(res.subscriptions(), 'list', 'subscriptions', - throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=GAPI.RESELLER_THROW_REASONS, customerId=customerId, fields='nextPageToken,subscriptions(skuId,subscriptionId,plan(planName))') - except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden) as e: + except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden, GAPI.invalid) as e: entityActionFailedWarning([Ent.SUBSCRIPTION, None], str(e)) sys.exit(GM.Globals[GM.SYSEXITRC]) for subscription in subscriptions: @@ -14712,11 +14712,11 @@ def doCreateResoldSubscription(): customerAuthToken, body = _getResoldSubscriptionAttr(customerId) try: subscription = callGAPI(res.subscriptions(), 'insert', - throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=GAPI.RESELLER_THROW_REASONS, customerId=customerId, customerAuthToken=customerAuthToken, body=body) entityActionPerformed([Ent.CUSTOMER_ID, customerId, Ent.SKU, subscription['skuId']]) _showSubscription(subscription) - except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden) as e: + except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden, GAPI.invalid) as e: entityActionFailedWarning([Ent.CUSTOMER_ID, customerId], str(e)) RENEWAL_TYPE_MAP = { @@ -14780,12 +14780,12 @@ def doUpdateResoldSubscription(): unknownArgumentExit() try: subscription = callGAPI(res.subscriptions(), function, - throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=GAPI.RESELLER_THROW_REASONS, customerId=customerId, subscriptionId=subscriptionId, **kwargs) entityActionPerformed([Ent.CUSTOMER_ID, customerId, Ent.SKU, skuId]) if subscription: _showSubscription(subscription) - except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden) as e: + except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden, GAPI.invalid) as e: entityActionFailedWarning([Ent.CUSTOMER_ID, customerId], str(e)) DELETION_TYPE_MAP = { @@ -14802,10 +14802,10 @@ def doDeleteResoldSubscription(): checkForExtraneousArguments() try: callGAPI(res.subscriptions(), 'delete', - throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=GAPI.RESELLER_THROW_REASONS, customerId=customerId, subscriptionId=subscriptionId, deletionType=deletionType) entityActionPerformed([Ent.CUSTOMER_ID, customerId, Ent.SKU, skuId]) - except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden) as e: + except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden, GAPI.invalid) as e: entityActionFailedWarning([Ent.CUSTOMER_ID, customerId, Ent.SKU, skuId], str(e)) # gam info resoldsubscription @@ -14818,12 +14818,12 @@ def doInfoResoldSubscription(): FJQC.GetFormatJSON(myarg) try: subscription = callGAPI(res.subscriptions(), 'get', - throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=GAPI.RESELLER_THROW_REASONS, customerId=customerId, subscriptionId=subscriptionId) if not FJQC.formatJSON: printEntity([Ent.CUSTOMER_ID, customerId, Ent.SKU, skuId]) _showSubscription(subscription, FJQC) - except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden) as e: + except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden, GAPI.invalid) as e: entityActionFailedWarning([Ent.CUSTOMER_ID, customerId, Ent.SKU, skuId], str(e)) PRINT_RESOLD_SUBSCRIPTIONS_TITLES = ['customerId', 'skuId', 'subscriptionId'] @@ -14857,9 +14857,9 @@ def doPrintShowResoldSubscriptions(): FJQC.GetFormatJSONQuoteChar(myarg, True) try: subscriptions = callGAPIpages(res.subscriptions(), 'list', 'subscriptions', - throwReasons=[GAPI.BAD_REQUEST, GAPI.RESOURCE_NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=GAPI.RESELLER_THROW_REASONS, fields='nextPageToken,subscriptions', **kwargs) - except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden) as e: + except (GAPI.badRequest, GAPI.resourceNotFound, GAPI.forbidden, GAPI.invalid) as e: entityActionFailedWarning([Ent.SUBSCRIPTION, None], str(e)) return jcount = len(subscriptions) diff --git a/src/gam/gamlib/glgapi.py b/src/gam/gamlib/glgapi.py index 64b5402a..b4d0b745 100644 --- a/src/gam/gamlib/glgapi.py +++ b/src/gam/gamlib/glgapi.py @@ -263,6 +263,7 @@ MEMBERS_THROW_REASONS = [GROUP_NOT_FOUND, DOMAIN_NOT_FOUND, DOMAIN_CANNOT_USE_AP 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] 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, BAD_REQUEST, INVALID, INVALID_ARGUMENT, FAILED_PRECONDITION] TASK_THROW_REASONS = [SERVICE_NOT_AVAILABLE, BAD_REQUEST, PERMISSION_DENIED, INVALID, NOT_FOUND, ACCESS_NOT_CONFIGURED]