def get_groups(self, customer_id='my_customer'):
"""Get all the groups for a given customer_id.
A note on customer_id='my_customer'. This is a magic string instead
of using the real customer id. See:
https://developers.google.com/admin-sdk/directory/v1/guides/manage-groups#get_all_domain_groups
Args:
customer_id (str): The customer id to scope the request to.
Returns:
list: A list of group objects returned from the API.
Raises:
api_errors.ApiExecutionError: If groups retrieval fails.
"""
try:
paged_results = self.repository.groups.list(customer=customer_id)
return api_helpers.flatten_list_results(paged_results, 'groups')
except (errors.HttpError, HttpLib2Error) as e:
raise api_errors.ApiExecutionError('groups', e)
admin_directory.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录