Merge branch 'main' of https://github.com/jay0lee/GAM into main

This commit is contained in:
Jay Lee
2021-03-12 16:04:37 -05:00

View File

@@ -13,10 +13,7 @@ from gam.gapi import cloudidentity as gapi_cloudidentity
def _get_customerid():
''' returns customer in format needed for this API'''
customer = GC_Values[GC_CUSTOMER_ID]
if customer.startswith('C'):
customer = customer[1:]
return f'customers/{customer}'
return f'customers/{GC_Values[GC_CUSTOMER_ID]}'
def _reduce_name(name):
''' converts long name into email address'''
@@ -33,12 +30,9 @@ def _generic_action(action):
'send': 'Sending'
}
print_action = action_map[action]
kwargs = {}
if action != 'get':
kwargs['body'] = {}
print(f'{print_action} user invite...')
result = gapi.call(svc.customers().userinvitations(), action,
name=name, **kwargs)
name=name)
name = result.get('response', {}).get('name')
if name:
result['response']['name'] = _reduce_name(name)