MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / get_projects

Method get_projects

web/pgadmin/misc/cloud/google/__init__.py:526–547  ·  view source on GitHub ↗

List the google projects for authorised user :return:

(self)

Source from the content-addressed store, hash-verified

524 return self._credentials
525
526 def get_projects(self):
527 """
528 List the google projects for authorised user
529 :return:
530 """
531 projects = []
532 error = None
533 credentials = self._get_credentials(self._scopes)
534 service = discovery.build('cloudresourcemanager',
535 self._cloud_resource_manager_api_version,
536 credentials=credentials)
537 try:
538 req = service.projects().list()
539 res = req.execute()
540 for project in res.get('projects', []):
541 projects.append({'label': project['projectId'],
542 'value': project['projectId']})
543 except HttpError as e:
544 error = e.reason
545 except Exception as e:
546 error = str(e)
547 return projects, error
548
549 def get_regions(self, project):
550 """

Callers 1

get_projectsFunction · 0.80

Calls 6

_get_credentialsMethod · 0.95
buildMethod · 0.80
appendMethod · 0.80
listMethod · 0.45
executeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected