diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 8d977a8e..b9baa954 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -7168,6 +7168,20 @@ def getGAMProjectFile(filepath): return c.decode(UTF8) +def signjwt_enable_apis(): + try: + creds, project_id = google.auth.default() + except google.auth.exceptions.DefaultCredentialsError as e: + controlflow.system_error_exit(2, e) + httpObj = transport.AuthorizedHttp( + creds, transport.create_http(cache=GM_Globals[GM_CACHE_DIR])) + GAMProjectAPIs = getGAMProjectFile('project-apis.txt').splitlines() + enableGAMProjectAPIs(GAMProjectAPIs, + httpObj, + projectID=project_id, + checkEnabled=True) + + def enableGAMProjectAPIs(GAMProjectAPIs, httpObj, projectId, @@ -12132,6 +12146,11 @@ def ProcessGAMCommand(args): yk.serial_number = yk.get_serial_number() yk.reset_piv() sys.exit(0) + elif command == 'enable': + enable_what = sys.argv[2].lower().replace('_', '') + if enable_what in ['api', 'apis']: + signjwt_enable_apis() + sys.exit(0) users = getUsersToModify() command = sys.argv[3].lower() if command == 'print' and len(sys.argv) == 4: