google.cloud.forseti.common.gcp_api.admin_directory module

Wrapper for Admin Directory API client.

class AdminDirectoryClient(global_configs, **kwargs)[source]

Bases: object

GSuite Admin Directory API Client.

get_group_members(group_key)[source]

Get all the members for specified groups.

Parameters:group_key (str) – The group’s unique id assigned by the Admin API.
Returns:A list of member objects from the API.
Return type:list
Raises:api_errors.ApiExecutionError – If group member retrieval fails.
get_groups(customer_id='my_customer')[source]

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

Parameters:

customer_id (str) – The customer id to scope the request to.

Returns:

A list of group objects returned from the API.

Return type:

list

Raises:
  • api_errors.ApiExecutionError – If groups retrieval fails.
  • RefreshError – If the authentication fails.
get_users(customer_id='my_customer')[source]

Get all the users 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

Parameters:

customer_id (str) – The customer id to scope the request to.

Returns:

A list of user objects returned from the API.

Return type:

list

Raises:
  • api_errors.ApiExecutionError – If groups retrieval fails.
  • RefreshError – If the authentication fails.
class AdminDirectoryRepositoryClient(credentials, quota_max_calls=None, quota_period=1.0, use_rate_limiter=True)[source]

Bases: google.cloud.forseti.common.gcp_api._base_repository.BaseRepositoryClient

Admin Directory API Respository Client.

groups

Returns an _AdminDirectoryGroupsRepository instance.

members

Returns an _AdminDirectoryMembersRepository instance.

users

Returns an _AdminDirectoryUsersRepository instance.

class _AdminDirectoryGroupsRepository(**kwargs)[source]

Bases: google.cloud.forseti.common.gcp_api.repository_mixins.ListQueryMixin, google.cloud.forseti.common.gcp_api._base_repository.GCPRepository

Implementation of Admin Directory Groups repository.

class _AdminDirectoryMembersRepository(**kwargs)[source]

Bases: google.cloud.forseti.common.gcp_api.repository_mixins.ListQueryMixin, google.cloud.forseti.common.gcp_api._base_repository.GCPRepository

Implementation of Admin Directory Members repository.

class _AdminDirectoryUsersRepository(**kwargs)[source]

Bases: google.cloud.forseti.common.gcp_api.repository_mixins.ListQueryMixin, google.cloud.forseti.common.gcp_api._base_repository.GCPRepository

Implementation of Admin Directory Users repository.