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.
This commit is contained in:
Ross Scroggs
2024-01-10 16:46:04 -08:00
parent f935a6bdfc
commit 14eaa9f32f
6 changed files with 42 additions and 27 deletions

View File

@@ -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 <DomainName>` to handle the following error:

View File

@@ -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 <CustomerID> [customer_auth_token <String>] <ResoldCustomerAttribute>+
@@ -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 <CustomerID> [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 <CustomerID> <SKUID>
@@ -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)

View File

@@ -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]