Globus Groups#
- class globus_sdk.GroupsClient(*, environment: str | None = None, base_url: str | None = None, authorizer: GlobusAuthorizer | None = None, app_name: str | None = None, transport_params: dict[str, Any] | None = None)[source]#
Bases:
BaseClient
Client for the Globus Groups API.
This provides a relatively low level client to public groups API endpoints. You may also consider looking at the GroupsManager as a simpler interface to more common actions.
Methods
- scopes: ScopeBuilder | None = <globus_sdk.scopes.builder.ScopeBuilder object>#
the scopes for this client may be present as a
ScopeBuilder
- get_my_groups(*, query_params: dict[str, Any] | None = None) ArrayResponse [source]#
Return a list of groups your identity belongs to.
- Parameters:
query_params (dict, optional) – Additional passthrough query parameters
GET /v2/groups/my_groups
See Retrieve your groups and membership in the API documentation for details.
- get_group(group_id: UUID | str, *, include: Iterable[str] | str | None = None, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Get details about a specific group
- Parameters:
GET /v2/groups/<group_id>
See Get Group in the API documentation for details.
- delete_group(group_id: UUID | str, *, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Delete a group.
- Parameters:
DELETE /v2/groups/<group_id>
See Delete a Group in the API documentation for details.
- create_group(data: dict[str, Any], *, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Create a group.
- Parameters:
POST /v2/groups
See Create a Group in the API documentation for details.
- update_group(group_id: UUID | str, data: dict[str, Any], *, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Update a given group.
- Parameters:
PUT /v2/groups/<group_id>
See Update a Group in the API documentation for details.
- get_group_policies(group_id: UUID | str, *, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Get policies for the given group
- Parameters:
GET /v2/groups/<group_id>/policies
See Get the policies for a group in the API documentation for details.
- set_group_policies(group_id: UUID | str, data: dict[str, Any] | GroupPolicies, *, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Set policies for the group.
- Parameters:
PUT /v2/groups/<group_id>/policies
See Set the policies for a group in the API documentation for details.
- get_identity_preferences(*, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Get identity preferences. Currently this only includes whether the user allows themselves to be added to groups.
- Parameters:
query_params (dict, optional) – additional passthrough query parameters
GET /v2/preferences
See Get the preferences for your identity set in the API documentation for details.
- set_identity_preferences(data: dict[str, Any], *, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Set identity preferences. Currently this only includes whether the user allows themselves to be added to groups.
- Parameters:
gc = globus_sdk.GroupsClient(...) gc.set_identity_preferences({"allow_add": False})
PUT /v2/preferences
See Set the preferences for your identity set in the API documentation for details.
- get_membership_fields(group_id: UUID | str, *, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Get membership fields for your identities.
- Parameters:
GET /v2/groups/<group_id>/membership_fields
See Get the membership fields for your identity set in the API documentation for details.
- set_membership_fields(group_id: UUID | str, data: dict[Any, str], *, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Set membership fields for your identities.
- Parameters:
PUT /v2/groups/<group_id>/membership_fields
See Set the membership fields for your identity set in the API documentation for details.
- batch_membership_action(group_id: UUID | str, actions: dict[str, Any] | BatchMembershipActions, *, query_params: dict[str, Any] | None = None) GlobusHTTPResponse [source]#
Execute a batch of actions against several group memberships.
- Parameters:
group_id (str or UUID) – the ID of the group
actions (dict or BatchMembershipActions) – the batch of membership actions to perform, modifying, creating, and removing memberships in the group
query_params (dict, optional) – additional passthrough query parameters
gc = globus_sdk.GroupsClient(...) group_id = ... batch = globus_sdk.BatchMembershipActions() batch.add_members("ae332d86-d274-11e5-b885-b31714a110e9") batch.invite_members("c699d42e-d274-11e5-bf75-1fc5bf53bb24") gc.batch_membership_action(group_id, batch)
PUT /v2/groups/<group_id>/membership_fields
See Perform actions on members of the group in the API documentation for details.
Helper Objects#
These helper objects make it easier to create and submit data to a GroupsClient
.
Additionally, they may be used in concert with the GroupsManager
to perform
operations.
These enums define values which can be passed to other helpers:
- class globus_sdk.GroupMemberVisibility(value)[source]#
An enumeration.
- managers = 'managers'#
- members = 'members'#
- class globus_sdk.GroupRequiredSignupFields(value)[source]#
An enumeration.
- address = 'address'#
- address1 = 'address1'#
- address2 = 'address2'#
- city = 'city'#
- country = 'country'#
- current_project_name = 'current_project_name'#
- department = 'department'#
- field_of_science = 'field_of_science'#
- institution = 'institution'#
- phone = 'phone'#
- state = 'state'#
- zip = 'zip'#
- class globus_sdk.GroupRole(value)[source]#
An enumeration.
- admin = 'admin'#
- manager = 'manager'#
- member = 'member'#
- class globus_sdk.GroupVisibility(value)[source]#
An enumeration.
- authenticated = 'authenticated'#
- private = 'private'#
Payload Types#
A BatchMembershipActions
defines how to formulate requests to add, remove, or modify
memberships in a group. It can be used to formulate multiple operations to submit in a single
request to the service.
- class globus_sdk.BatchMembershipActions(dict=None, /, **kwargs)[source]#
An object used to represent a batch action on memberships of a group. Perform actions on group members.
- accept_invites(identity_ids: Iterable[UUID | str]) BatchMembershipActions [source]#
Accept invites for identities. The identities must belong to the identity set of authenticated user.
- add_members(identity_ids: Iterable[UUID | str], *, role: GroupRole | Literal['member', 'manager', 'admin'] = 'member') BatchMembershipActions [source]#
Add a list of identities to a group with the given role.
- approve_pending(identity_ids: Iterable[UUID | str]) BatchMembershipActions [source]#
Approve a list of identities with pending join requests.
- decline_invites(identity_ids: Iterable[UUID | str]) BatchMembershipActions [source]#
Decline an invitation for a given set of identities.
- invite_members(identity_ids: Iterable[UUID | str], *, role: GroupRole | Literal['member', 'manager', 'admin'] = 'member') BatchMembershipActions [source]#
Invite a list of identities to a group with the given role.
- join(identity_ids: Iterable[UUID | str]) BatchMembershipActions [source]#
Join a group with the given identities. The identities must be in the authenticated users identity set.
- leave(identity_ids: Iterable[UUID | str]) BatchMembershipActions [source]#
Leave a group that one of the identities in the authenticated user’s identity set is a member of.
- reject_join_requests(identity_ids: Iterable[UUID | str]) BatchMembershipActions [source]#
Reject a members that have requested to join the group.
A GroupPolicies
object defines the various policies which can be set on a
group. It can be used with the GroupsClient
or the GroupsManager
.
- class globus_sdk.GroupPolicies(*, is_high_assurance: bool, group_visibility: GroupVisibility | Literal['authenticated', 'private'], group_members_visibility: GroupMemberVisibility | Literal['members', 'managers'], join_requests: bool, signup_fields: Iterable[GroupRequiredSignupFields | Literal['institution', 'current_project_name', 'address', 'city', 'state', 'country', 'address1', 'address2', 'zip', 'phone', 'department', 'field_of_science']], authentication_assurance_timeout: int | None = None)[source]#
An object used to represent the policy settings of a group. This may be used to set or modify group settings.
See also: API documentation on setting the policies for the group.
High-Level Client Wrappers#
The GroupsManager
is a high-level helper which wraps a GroupsClient
. Many common
operations which require assembling a BatchMembershipActions
and submitting the
result can be achieved with a single method-call on a GroupsManager
.
- class globus_sdk.GroupsManager(client: GroupsClient | None = None)[source]#
A wrapper for the groups client with common membership and group actions wrapped in convenient methods with parameters and type hints.
Methods
- accept_invite(group_id: UUID | str, identity_id: UUID | str) GlobusHTTPResponse [source]#
Accept invite for an identity. The identity must belong to the identity set of the authenticated user.
- add_member(group_id: UUID | str, identity_id: UUID | str, *, role: GroupRole | Literal['member', 'manager', 'admin'] = 'member') GlobusHTTPResponse [source]#
Add a list of identities to a group with the given role.
- approve_pending(group_id: UUID | str, identity_id: UUID | str) GlobusHTTPResponse [source]#
Approve a list of identities with pending join requests.
- create_group(name: str, description: str, *, parent_id: UUID | str | None = None) GlobusHTTPResponse [source]#
Create a group with the given name. If a parent id is included, the group will be a subgroup of the given parent group.
- decline_invite(group_id: UUID | str, identity_id: UUID | str) GlobusHTTPResponse [source]#
Decline an invitation for a given identity.
- invite_member(group_id: UUID | str, identity_id: UUID | str, *, role: GroupRole | Literal['member', 'manager', 'admin'] = 'member') GlobusHTTPResponse [source]#
Invite an identity to a group with the given role.
- join(group_id: UUID | str, identity_id: UUID | str) GlobusHTTPResponse [source]#
Join a group with the given identity. The identity must be in the authenticated users identity set.
- leave(group_id: UUID | str, identity_id: UUID | str) GlobusHTTPResponse [source]#
Leave a group that one of the identities in the authenticated user’s identity set is a member of.
- reject_join_request(group_id: UUID | str, identity_id: UUID | str) GlobusHTTPResponse [source]#
Reject a member that has requested to join the group.
- remove_member(group_id: UUID | str, identity_id: UUID | str) GlobusHTTPResponse [source]#
Remove members from a group. This must be done as an admin or manager of the group.
- request_join(group_id: UUID | str, identity_id: UUID | str) GlobusHTTPResponse [source]#
Request to join a group.
- set_group_policies(group_id: UUID | str, *, is_high_assurance: bool, group_visibility: GroupVisibility | Literal['authenticated', 'private'], group_members_visibility: GroupMemberVisibility | Literal['members', 'managers'], join_requests: bool, signup_fields: Iterable[GroupRequiredSignupFields | Literal['institution', 'current_project_name', 'address', 'city', 'state', 'country', 'address1', 'address2', 'zip', 'phone', 'department', 'field_of_science']], authentication_assurance_timeout: int | None = None) GlobusHTTPResponse [source]#
Set the group policies for the given group.
Client Errors#
When an error occurs, a GroupsClient
will raise this type of error:
- class globus_sdk.GroupsAPIError(r: Response, *args: Any, **kwargs: Any)[source]#
Bases:
GlobusAPIError
Error class for the Globus Groups Service.