Skip to content

Commit 26b9b6f

Browse files
committed
Add GetQuota to file.py
1 parent ed4c83e commit 26b9b6f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

cs3client/file.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,3 +690,21 @@ def unlock(self, auth_token: tuple, resource: Resource, app_name, lock_id: Union
690690
self._status_code_handler.handle_errors(res.status, "unlock", resource.get_file_ref_str())
691691
self._log.debug(f'msg="Invoked Unlock" {resource.get_file_ref_str()} result="{res.status.trace}" '
692692
f'value="{lock_id}"')
693+
694+
@handle_grpc_error
695+
def get_quota(self, auth_token: tuple, resource: Resource):
696+
"""
697+
Get the quota for a given path
698+
:param auth_token: tuple in the form ('x-access-token', <token>) (see auth.get_token/auth.check_token)
699+
:param resource: Resource to get the quota for.
700+
:return: The quota for the given resource.
701+
:raises: NotFoundException (File not found)
702+
:raises: AuthenticationException (Authentication Failed)
703+
:raises: UnknownException (Unknown Error)
704+
"""
705+
706+
get_quota_request = cs3spr.GetQuotaRequest(ref=resource.ref)
707+
res = self._gateway.GetQuota(request=get_quota_request, metadata=[auth_token])
708+
self._status_code_handler.handle_errors(res.status, "get quota", resource.get_file_ref_str())
709+
self._log.debug(f'msg="Invoked GetQuota" trace="{res.status.trace}"')
710+
return res

0 commit comments

Comments
 (0)