provenaclient.clients.auth_client ================================= .. py:module:: provenaclient.clients.auth_client .. autoapi-nested-parse:: Created Date: Friday May 31st 2024 +1000 Author: Peter Baker ----- Last Modified: Friday May 31st 2024 9:50:26 am +1000 Modified By: Peter Baker ----- Description: The Auth API L2 Client ----- HISTORY: Date By Comments ---------- --- --------------------------------------------------------- 18-06-2024 | Peter Baker | Some issues with admin remove members interfaces - blocked on this Classes ------- .. autoapisummary:: provenaclient.clients.auth_client.AuthEndpoints provenaclient.clients.auth_client.AuthAdminSubClient provenaclient.clients.auth_client.AuthClient Module Contents --------------- .. py:class:: AuthEndpoints Bases: :py:obj:`str`, :py:obj:`enum.Enum` str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'. .. py:attribute:: GET_CHECK_ACCESS_PUBLIC :value: '/check-access/public' .. py:attribute:: GET_CHECK_ACCESS_GENERAL :value: '/check-access/general' .. py:attribute:: GET_ADMIN_CONFIG :value: '/admin/config' .. py:attribute:: GET_ADMIN_SENTRY_DEBUG :value: '/admin/sentry-debug' .. py:attribute:: GET_ACCESS_CONTROL_ADMIN_ALL_PENDING_REQUEST_HISTORY :value: '/access-control/admin/all-pending-request-history' .. py:attribute:: GET_ACCESS_CONTROL_ADMIN_ALL_REQUEST_HISTORY :value: '/access-control/admin/all-request-history' .. py:attribute:: GET_ACCESS_CONTROL_ADMIN_USER_PENDING_REQUEST_HISTORY :value: '/access-control/admin/user-pending-request-history' .. py:attribute:: GET_ACCESS_CONTROL_ADMIN_USER_REQUEST_HISTORY :value: '/access-control/admin/user-request-history' .. py:attribute:: POST_ACCESS_CONTROL_ADMIN_ADD_NOTE :value: '/access-control/admin/add-note' .. py:attribute:: POST_ACCESS_CONTROL_ADMIN_CHANGE_REQUEST_STATE :value: '/access-control/admin/change-request-state' .. py:attribute:: POST_ACCESS_CONTROL_ADMIN_DELETE_REQUEST :value: '/access-control/admin/delete-request' .. py:attribute:: POST_ACCESS_CONTROL_USER_REQUEST_CHANGE :value: '/access-control/user/request-change' .. py:attribute:: GET_ACCESS_CONTROL_USER_REQUEST_HISTORY :value: '/access-control/user/request-history' .. py:attribute:: GET_ACCESS_CONTROL_USER_PENDING_REQUEST_HISTORY :value: '/access-control/user/pending-request-history' .. py:attribute:: GET_ACCESS_CONTROL_USER_GENERATE_ACCESS_REPORT :value: '/access-control/user/generate-access-report' .. py:attribute:: GET_GROUPS_ADMIN_LIST_GROUPS :value: '/groups/admin/list_groups' .. py:attribute:: GET_GROUPS_ADMIN_DESCRIBE_GROUP :value: '/groups/admin/describe_group' .. py:attribute:: GET_GROUPS_ADMIN_LIST_MEMBERS :value: '/groups/admin/list_members' .. py:attribute:: GET_GROUPS_ADMIN_LIST_USER_MEMBERSHIP :value: '/groups/admin/list_user_membership' .. py:attribute:: GET_GROUPS_ADMIN_CHECK_MEMBERSHIP :value: '/groups/admin/check_membership' .. py:attribute:: POST_GROUPS_ADMIN_ADD_MEMBER :value: '/groups/admin/add_member' .. py:attribute:: DELETE_GROUPS_ADMIN_REMOVE_MEMBER :value: '/groups/admin/remove_member' .. py:attribute:: POST_GROUPS_ADMIN_ADD_GROUP :value: '/groups/admin/add_group' .. py:attribute:: DELETE_GROUPS_ADMIN_REMOVE_GROUP :value: '/groups/admin/remove_group' .. py:attribute:: PUT_GROUPS_ADMIN_UPDATE_GROUP :value: '/groups/admin/update_group' .. py:attribute:: GET_GROUPS_ADMIN_EXPORT :value: '/groups/admin/export' .. py:attribute:: POST_GROUPS_ADMIN_IMPORT :value: '/groups/admin/import' .. py:attribute:: POST_GROUPS_ADMIN_RESTORE_FROM_TABLE :value: '/groups/admin/restore_from_table' .. py:attribute:: GET_GROUPS_USER_LIST_GROUPS :value: '/groups/user/list_groups' .. py:attribute:: GET_GROUPS_USER_DESCRIBE_GROUP :value: '/groups/user/describe_group' .. py:attribute:: GET_GROUPS_USER_LIST_USER_MEMBERSHIP :value: '/groups/user/list_user_membership' .. py:attribute:: GET_GROUPS_USER_LIST_MEMBERS :value: '/groups/user/list_members' .. py:attribute:: GET_GROUPS_USER_CHECK_MEMBERSHIP :value: '/groups/user/check_membership' .. py:attribute:: GET_LINK_USER_LOOKUP :value: '/link/user/lookup' .. py:attribute:: POST_LINK_USER_ASSIGN :value: '/link/user/assign' .. py:attribute:: POST_LINK_USER_VALIDATE :value: '/link/user/validate' .. py:attribute:: GET_LINK_ADMIN_LOOKUP :value: '/link/admin/lookup' .. py:attribute:: POST_LINK_ADMIN_ASSIGN :value: '/link/admin/assign' .. py:attribute:: DELETE_LINK_ADMIN_CLEAR :value: '/link/admin/clear' .. py:attribute:: GET_LINK_ADMIN_REVERSE_LOOKUP :value: '/link/admin/reverse_lookup' .. py:attribute:: GET_HEALTH_CHECK :value: '/' .. py:attribute:: DELETE_GROUPS_ADMIN_REMOVE_MEMBERS :value: '/groups/admin/remove_members' .. py:class:: AuthAdminSubClient(auth: provenaclient.clients.client_helpers.AuthManager, config: provenaclient.clients.client_helpers.Config) Bases: :py:obj:`provenaclient.clients.client_helpers.ClientService` This class interface just captures that the client has an instantiated auth manager which allows for helper functions abstracted for L2 clients. .. py:attribute:: _auth .. py:attribute:: _config .. py:method:: _build_endpoint(endpoint: AuthEndpoints) -> str .. py:method:: get_all_pending_request_history() -> ProvenaInterfaces.AuthAPI.AccessRequestList :async: Gets all requests with pending status :returns: The response object :rtype: AccessRequestList .. py:method:: get_all_request_history() -> ProvenaInterfaces.AuthAPI.AccessRequestList :async: Gets all requests :returns: The response object :rtype: AccessRequestList .. py:method:: get_user_pending_request_history(username: str) -> ProvenaInterfaces.AuthAPI.AccessRequestList :async: Gets pending requests for specified user :param username: Username to query :type username: str :returns: The response list :rtype: AccessRequestList .. py:method:: get_user_request_history(username: str) -> ProvenaInterfaces.AuthAPI.AccessRequestList :async: Gets all requests for specified user :param username: Username to query :type username: str :returns: The response list :rtype: AccessRequestList .. py:method:: post_add_note(note: ProvenaInterfaces.AuthAPI.RequestAddNote) -> None :async: Adds a note to an existing request :param note: Payload incl note info :type note: RequestAddNote .. py:method:: post_change_request_state(send_email_alert: bool, change: ProvenaInterfaces.AuthAPI.AccessRequestStatusChange) -> ProvenaInterfaces.AuthAPI.ChangeStateStatus :async: Change state of a request. :param send_email_alert: Should trigger email alert? :type send_email_alert: bool :param change: The details of change :type change: AccessRequestStatusChange :returns: The response object :rtype: ChangeStateStatus .. py:method:: get_list_groups() -> ProvenaInterfaces.AuthAPI.ListGroupsResponse :async: Gets a list of groups :returns: List of groups :rtype: ListGroupsResponse .. py:method:: get_describe_group(group_id: str) -> ProvenaInterfaces.AuthAPI.DescribeGroupResponse :async: Describes a group by ID :param group_id: The group :type group_id: str :returns: Description :rtype: DescribeGroupResponse .. py:method:: get_list_members(group_id: str) -> ProvenaInterfaces.AuthAPI.ListMembersResponse :async: Lists members of group :param group_id: The gruop :type group_id: str :returns: The list of members :rtype: ListMembersResponse .. py:method:: get_list_group_membership(username: str) -> ProvenaInterfaces.AuthAPI.ListUserMembershipResponse :async: Gets list of groups a user is in :param username: The username :type username: str :returns: The list of groups :rtype: ListUserMembershipResponse .. py:method:: get_check_user_membership(username: str, group_id: str) -> ProvenaInterfaces.AuthAPI.CheckMembershipResponse :async: Checks user membership within a group :param username: The username to target :type username: str :param group_id: The group to check :type group_id: str :returns: Response :rtype: CheckMembershipResponse .. py:method:: post_groups_add_member(group_id: str, user: ProvenaInterfaces.AuthAPI.GroupUser) -> ProvenaInterfaces.AuthAPI.AddMemberResponse :async: Adds a member to a group :param group_id: Id of group :type group_id: str :param user: The user to add :type user: GroupUser :returns: The response :rtype: AddMemberResponse .. py:method:: delete_remove_member(group_id: str, username: str) -> ProvenaInterfaces.AuthAPI.RemoveMemberResponse :async: Removes member from group :param group_id: The id of group :type group_id: str :param username: The user to remove :type username: str :returns: The response :rtype: RemoveMemberResponse .. py:method:: post_add_group(group: ProvenaInterfaces.AuthAPI.UserGroupMetadata) -> ProvenaInterfaces.AuthAPI.AddGroupResponse :async: Adds a group/creates group :param group: The group details :type group: UserGroupMetadata :returns: The response :rtype: AddGroupResponse .. py:method:: put_update_group(group: ProvenaInterfaces.AuthAPI.UserGroupMetadata) -> ProvenaInterfaces.AuthAPI.UpdateGroupResponse :async: Updates group details :param group: The group metadata :type group: UserGroupMetadata :returns: The response :rtype: UpdateGroupResponse .. py:method:: get_export_groups() -> ProvenaInterfaces.AuthAPI.GroupsExportResponse :async: Exports all group details in specified format. :returns: The data dump :rtype: GroupsExportResponse .. py:method:: post_import_groups(body: ProvenaInterfaces.AuthAPI.GroupsImportRequest) -> ProvenaInterfaces.AuthAPI.GroupsImportResponse :async: Imports groups from data dump back in :param body: The import request incl. dump :type body: GroupsImportRequest :returns: The response :rtype: GroupsImportResponse .. py:method:: post_restore_groups_from_table(table_name: str, body: ProvenaInterfaces.AuthAPI.GroupsRestoreRequest) -> ProvenaInterfaces.AuthAPI.GroupsImportResponse :async: Restores groups by first dumping from valid group table. Needs permissions to table. :param table_name: The table name :type table_name: str :param body: The request :type body: GroupsRestoreRequest :returns: The response details :rtype: GroupsImportResponse .. py:method:: get_link_lookup_username(username: str) -> ProvenaInterfaces.AuthAPI.AdminLinkUserLookupResponse :async: Gets the linked person for user :param username: User to lookup :type username: str :returns: Response :rtype: AdminLinkUserLookupResponse .. py:method:: get_link_reverse_lookup_username(person_id: str) -> ProvenaInterfaces.AuthAPI.UserLinkReverseLookupResponse :async: Looks up reverse by person ID :param person_id: The person to lookup :type person_id: str :returns: The response :rtype: UserLinkReverseLookupResponse .. py:method:: post_link_assign(body: ProvenaInterfaces.AuthAPI.AdminLinkUserAssignRequest) -> ProvenaInterfaces.AuthAPI.AdminLinkUserAssignResponse :async: Assigns a person to a given user :param body: The request :type body: AdminLinkUserAssignRequest :returns: The response :rtype: AdminLinkUserAssignResponse .. py:method:: delete_clear_link(username: str) -> ProvenaInterfaces.AuthAPI.AdminLinkUserClearResponse :async: Deletes an existing link :param username: The user to unlink :type username: str :returns: The response :rtype: AdminLinkUserClearResponse .. py:class:: AuthClient(auth: provenaclient.clients.client_helpers.AuthManager, config: provenaclient.clients.client_helpers.Config) Bases: :py:obj:`provenaclient.clients.client_helpers.ClientService` This class interface just captures that the client has an instantiated auth manager which allows for helper functions abstracted for L2 clients. .. py:attribute:: admin :type: AuthAdminSubClient .. py:attribute:: _auth .. py:attribute:: _config .. py:method:: _build_endpoint(endpoint: AuthEndpoints) -> str .. py:method:: get_health_check() -> provenaclient.models.HealthCheckResponse :async: Health check the API :returns: Response :rtype: HealthCheckResponse .. py:method:: get_user_request_history() -> ProvenaInterfaces.AuthAPI.AccessRequestList :async: Gets the users access request history :returns: The list of requests :rtype: AccessRequestList .. py:method:: post_user_request_change(body: ProvenaInterfaces.AuthAPI.AccessReport, send_email: bool) -> provenaclient.utils.helpers.StatusResponse :async: Requests a change by diffing access models :param body: The new access desired :type body: AccessReport :param send_email: Email alert :type send_email: bool :returns: Ok? :rtype: StatusResponse .. py:method:: get_user_pending_request_history() -> ProvenaInterfaces.AuthAPI.AccessRequestList :async: Gets only pending requests from history :returns: The list :rtype: AccessRequestList .. py:method:: get_user_generate_access_report() -> ProvenaInterfaces.AuthAPI.AccessReportResponse :async: Generates an access report detailing system access. :returns: The response :rtype: AccessReportResponse .. py:method:: get_list_groups() -> ProvenaInterfaces.AuthAPI.ListGroupsResponse :async: Lists all groups :returns: List of groups :rtype: ListGroupsResponse .. py:method:: get_describe_group(group_id: str) -> ProvenaInterfaces.AuthAPI.DescribeGroupResponse :async: Describes a specific gruop :param group_id: The id of group :type group_id: str :returns: Response with details :rtype: DescribeGroupResponse .. py:method:: get_list_membership() -> ProvenaInterfaces.AuthAPI.ListUserMembershipResponse :async: Gets the list of groups user is member of :returns: List and details :rtype: ListUserMembershipResponse .. py:method:: get_list_group_members(group_id: str) -> ProvenaInterfaces.AuthAPI.ListMembersResponse :async: Lists the members of a given group :param group_id: The group to lookup :type group_id: str :returns: Members :rtype: ListMembersResponse .. py:method:: get_check_membership(group_id: str) -> ProvenaInterfaces.AuthAPI.CheckMembershipResponse :async: Checks if user is in specific group :param group_id: The group to check :type group_id: str :returns: In group? :rtype: CheckMembershipResponse .. py:method:: get_link_lookup_username(username: provenaclient.utils.helpers.Optional[str] = None) -> ProvenaInterfaces.AuthAPI.UserLinkUserLookupResponse :async: Looks up either current user or specified user :param username: The username if not current user. Defaults to None. :type username: Optional[str], optional :returns: The response indicating link :rtype: UserLinkUserLookupResponse .. py:method:: post_link_assign(body: ProvenaInterfaces.AuthAPI.UserLinkUserAssignRequest) -> ProvenaInterfaces.AuthAPI.UserLinkUserAssignResponse :async: Assigns link to current user. :param body: The link to assign :type body: UserLinkUserAssignRequest :returns: The response indicating success :rtype: UserLinkUserAssignResponse .. py:method:: post_link_validate(body: ProvenaInterfaces.AuthAPI.UserLinkUserAssignRequest) -> ProvenaInterfaces.AuthAPI.UserLinkUserValidateResponse :async: Validates link before making it. :param body: The link to assign :type body: UserLinkUserAssignRequest :returns: Valid? :rtype: UserLinkUserValidateResponse