From 5e6f9353c2d810c7a58d2333c9ad9c1cc9e15e65 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Fri, 12 Mar 2021 16:20:20 -0500 Subject: [PATCH] explicity state customer format for new APIs and cleanup as necessary --- src/gam/gapi/cloudidentity/userinvitations.py | 7 +++++-- src/gam/gapi/directory/printers.py | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gam/gapi/cloudidentity/userinvitations.py b/src/gam/gapi/cloudidentity/userinvitations.py index 2ca132c6..db121c52 100644 --- a/src/gam/gapi/cloudidentity/userinvitations.py +++ b/src/gam/gapi/cloudidentity/userinvitations.py @@ -12,8 +12,11 @@ from gam.gapi import errors as gapi_errors from gam.gapi import cloudidentity as gapi_cloudidentity def _get_customerid(): - ''' returns customer in format needed for this API''' - return f'customers/{GC_Values[GC_CUSTOMER_ID]}' + ''' returns customer in "customers/(C){customer_id}' format needed for this API''' + customer = GC_Values[GC_CUSTOMER_ID] + if customer != MY_CUSTOMER and customer[0] != 'C': + customer = 'C' + customer + return f'customers/{customer}' def _reduce_name(name): ''' converts long name into email address''' diff --git a/src/gam/gapi/directory/printers.py b/src/gam/gapi/directory/printers.py index 856cbbce..ae887c9c 100644 --- a/src/gam/gapi/directory/printers.py +++ b/src/gam/gapi/directory/printers.py @@ -10,8 +10,10 @@ from gam.gapi.directory import orgunits as gapi_directory_orgunits def _get_customerid(): - ''' returns customer in format needed for this API''' + ''' returns customer in "customers/C{customer}" format needed for this API''' customer = GC_Values[GC_CUSTOMER_ID] + if customer != MY_CUSTOMER and customer[0] != 'C': + customer = 'C' + customer return f'customers/{customer}' def _get_printer_attributes(i, cdapi=None):