Debian Codegraph @

src/globus_sdk/services/gcs/client.py

raw
1 from __future__ import annotations
2
3 import typing as t
4 import uuid
5
6 from globus_sdk import client, paging, response
7 from globus_sdk._internal.classprop import classproperty
8 from globus_sdk._internal.remarshal import commajoin
9 from globus_sdk._internal.utils import slash_join
10 from globus_sdk._missing import MISSING, MissingType
11 from globus_sdk.authorizers import GlobusAuthorizer
12 from globus_sdk.globus_app import GlobusApp
13 from globus_sdk.scopes import GCSCollectionScopes, GCSEndpointScopes, Scope
14 from globus_sdk.transport import RequestsTransport, RetryConfig
15
16 from .data import (
17 CollectionDocument,
18 EndpointDocument,
19 GCSRoleDocument,
20 StorageGatewayDocument,
21 UserCredentialDocument,
22 )
23 from .errors import GCSAPIError
24 from .response import IterableGCSResponse, UnpackingGCSResponse
25
26 C = t.TypeVar("C", bound=t.Callable[..., t.Any])
27
28
29 class GCSClient(client.BaseClient):
30 """
31 A GCSClient provides communication with the GCS Manager API of a Globus Connect
32 Server instance.
33 For full reference, see the `documentation for the GCS Manager API
34 <https://docs.globus.org/globus-connect-server/v5/api/>`_.
35
36 Unlike other client types, this must be provided with an address for the GCS
37 Manager. All other arguments are the same as those for
38 :class:`~globus_sdk.BaseClient`.
39
40 .. sdk-sphinx-copy-params:: BaseClient
41
42 :param gcs_address: The FQDN (DNS name) or HTTPS URL for the GCS Manager API.
43
44 .. automethodlist:: globus_sdk.GCSClient
45 """
46
47 # TODO: under SDK v4.0, service_name should not be set
48 service_name = "globus_connect_server"
49 error_class = GCSAPIError
50
51 def __init__(
52 self,
53 gcs_address: str,
54 *,
55 app: GlobusApp | None = None,
56 app_scopes: list[Scope] | None = None,
57 environment: str | None = None,
58 authorizer: GlobusAuthorizer | None = None,
59 app_name: str | None = None,
60 transport: RequestsTransport | None = None,
61 retry_config: RetryConfig | None = None,
62 ) -> None:
63 # check if the provided address was a DNS name or an HTTPS URL
64 if not gcs_address.startswith("https://"):
65 # if it's a DNS name format it accordingly
66 gcs_address = f"https://{gcs_address}/api/"
67 # if it was an HTTPS URL, check that it ends with /api/
68 elif not gcs_address.endswith(("/api/", "/api")):
69 # if it doesn't, add it
70 gcs_address = slash_join(gcs_address, "/api/")
71
72 self._endpoint_client_id: str | None = None
73
74 super().__init__(
75 base_url=gcs_address,
76 environment=environment,
77 app=app,
78 app_scopes=app_scopes,
79 authorizer=authorizer,
80 app_name=app_name,
81 transport=transport,
82 retry_config=retry_config,
83 )
84
85 @staticmethod
86 def get_gcs_endpoint_scopes(
87 endpoint_id: uuid.UUID | str,
88 ) -> GCSEndpointScopes:
89 """Given a GCS Endpoint ID, this helper constructs an object containing the
90 scopes for that Endpoint.
91
92 :param endpoint_id: The ID of the Endpoint
93
94 See documentation for :class:`globus_sdk.scopes.GCSEndpointScopes` for
95 more information.
96 """
97 return GCSEndpointScopes(str(endpoint_id))
98
99 @staticmethod
100 def get_gcs_collection_scopes(
101 collection_id: uuid.UUID | str,
102 ) -> GCSCollectionScopes:
103 """Given a GCS Collection ID, this helper constructs an object containing the
104 scopes for that Collection.
105
106 :param collection_id: The ID of the Collection
107
108 See documentation for :class:`globus_sdk.scopes.GCSCollectionScopes` for
109 more information.
110 """
111 return GCSCollectionScopes(str(collection_id))
112
113 @property
114 def default_scope_requirements(self) -> list[Scope]:
115 return [
116 GCSClient.get_gcs_endpoint_scopes(
117 self.endpoint_client_id
118 ).manage_collections
119 ]
120
121 @classproperty
122 def resource_server( # pylint: disable=missing-param-doc
123 self_or_cls: client.BaseClient | type[client.BaseClient],
124 ) -> str | None:
125 """
126 The resource server for a GCS endpoint is the ID of its GCS Manager Client.
127
128 This will return None if called as a classmethod as an instantiated
129 ``GCSClient`` is required to look up the client ID from the endpoint.
130 """
131 if not isinstance(self_or_cls, GCSClient):
132 return None
133
134 return self_or_cls.endpoint_client_id
135
136 @property
137 def endpoint_client_id(self) -> str:
138 """
139 The UUID of the GCS Manager client of the endpoint this client is configured
140 for. This will be equal to the ``endpoint_id`` in most cases, but when they
141 differ the ``client_id`` is the canonical value for the endpoint's resource
142 server and scopes.
143 """
144 if self._endpoint_client_id:
145 return self._endpoint_client_id
146
147 else:
148 data = self.get_gcs_info()
149 try:
150 endpoint_id = str(data["client_id"])
151 except KeyError:
152 print(data)
153 self._endpoint_client_id = endpoint_id
154 return endpoint_id
155
156 #
157 # endpoint methods
158 #
159
160 def get_gcs_info(
161 self, query_params: dict[str, t.Any] | None = None
162 ) -> UnpackingGCSResponse:
163 """
164 Get information about the GCS Manager service this client is configured for.
165 This call is made unauthenticated.
166
167 :param query_params: Additional passthrough query parameters
168
169 .. tab-set::
170
171 .. tab-item:: API Info
172
173 ``GET /info``
174
175 .. extdoclink:: Get Endpoint
176 :ref: openapi/#getInfo
177 :service: gcs
178 """
179 return UnpackingGCSResponse(
180 self.get("/info", query_params=query_params, automatic_authorization=False),
181 "info",
182 )
183
184 def get_endpoint(
185 self, query_params: dict[str, t.Any] | None = None
186 ) -> UnpackingGCSResponse:
187 """
188 Get the details of the Endpoint that this client is configured to talk to.
189
190 :param query_params: Additional passthrough query parameters
191
192 .. tab-set::
193
194 .. tab-item:: API Info
195
196 ``GET /endpoint``
197
198 .. extdoclink:: Get Endpoint
199 :ref: openapi_Endpoint/#getEndpoint
200 :service: gcs
201 """
202 return UnpackingGCSResponse(
203 self.get("/endpoint", query_params=query_params),
204 "endpoint",
205 )
206
207 def update_endpoint(
208 self,
209 endpoint_data: dict[str, t.Any] | EndpointDocument,
210 *,
211 include: (
212 t.Iterable[t.Literal["endpoint"]] | t.Literal["endpoint"] | MissingType
213 ) = MISSING,
214 query_params: dict[str, t.Any] | None = None,
215 ) -> UnpackingGCSResponse:
216 """
217 Update a GCSv5 Endpoint
218
219 :param endpoint_data: The endpoint document for the modified endpoint
220 :param include: Optional list of document types to include in the response
221 (currently only supports the value ``["endpoint"]``)
222 :param query_params: Additional passthrough query parameters
223
224 .. tab-set::
225
226 .. tab-item:: API Info
227
228 ``PATCH /endpoint``
229
230 .. extdoclink:: Update Endpoint
231 :ref: openapi_Endpoint/#patchEndpoint
232 :service: gcs
233 """
234 query_params = {"include": commajoin(include), **(query_params or {})}
235 return UnpackingGCSResponse(
236 self.patch(
237 "/endpoint",
238 data=endpoint_data,
239 query_params=query_params,
240 ),
241 "endpoint",
242 )
243
244 #
245 # collection methods
246 #
247
248 @paging.has_paginator(
249 paging.MarkerPaginator,
250 items_key="data",
251 )
252 def get_collection_list(
253 self,
254 *,
255 mapped_collection_id: uuid.UUID | str | MissingType = MISSING,
256 filter: ( # pylint: disable=redefined-builtin
257 str | t.Iterable[str] | MissingType
258 ) = MISSING,
259 include: str | t.Iterable[str] | MissingType = MISSING,
260 page_size: int | MissingType = MISSING,
261 marker: str | MissingType = MISSING,
262 query_params: dict[str, t.Any] | None = None,
263 ) -> IterableGCSResponse:
264 """
265 List the Collections on an Endpoint
266
267 :param mapped_collection_id: Filter collections which were created using this
268 mapped collection ID.
269 :param filter: Filter the returned set to any combination of the following:
270 ``mapped_collections``, ``guest_collections``, ``managed_by_me``,
271 ``created_by_me``.
272 :param include: Names of additional documents to include in the response
273 :param page_size: Number of results to return per page
274 :param marker: Pagination marker supplied by previous API calls in the event
275 a request returns more values than the page size
276 :param query_params: Additional passthrough query parameters
277
278 .. tab-set::
279
280 .. tab-item:: API Info
281
282 ``GET /collections``
283
284 .. extdoclink:: List Collections
285 :ref: openapi_Collections/#ListCollections
286 :service: gcs
287 """
288 query_params = {
289 "include": commajoin(include),
290 "page_size": page_size,
291 "marker": marker,
292 "mapped_collection_id": mapped_collection_id,
293 "filter": commajoin(filter),
294 **(query_params or {}),
295 }
296 return IterableGCSResponse(self.get("collections", query_params=query_params))
297
298 def get_collection(
299 self,
300 collection_id: uuid.UUID | str,
301 *,
302 query_params: dict[str, t.Any] | None = None,
303 ) -> UnpackingGCSResponse:
304 """
305 Lookup a Collection on an Endpoint
306
307 :param collection_id: The ID of the collection to lookup
308 :param query_params: Additional passthrough query parameters
309
310 .. tab-set::
311
312 .. tab-item:: API Info
313
314 ``GET /collections/{collection_id}``
315
316 .. extdoclink:: Get Collection
317 :ref: openapi_Collections/#getCollection
318 :service: gcs
319 """
320 return UnpackingGCSResponse(
321 self.get(f"/collections/{collection_id}", query_params=query_params),
322 "collection",
323 )
324
325 def create_collection(
326 self,
327 collection_data: dict[str, t.Any] | CollectionDocument,
328 ) -> UnpackingGCSResponse:
329 """
330 Create a collection. This is used to create either a mapped or a guest
331 collection. When created, a ``collection:administrator`` role for that
332 collection will be created using the caller’s identity.
333
334 In order to create a guest collection, the caller must have an identity that
335 matches the Storage Gateway policies.
336
337 In order to create a mapped collection, the caller must have an
338 ``endpoint:administrator`` or ``endpoint:owner`` role.
339
340 :param collection_data: The collection document for the new collection
341
342 .. tab-set::
343
344 .. tab-item:: API Info
345
346 ``POST /collections``
347
348 .. extdoclink:: Create Collection
349 :ref: openapi_Collections/#createCollection
350 :service: gcs
351 """
352 return UnpackingGCSResponse(
353 self.post("/collections", data=collection_data), "collection"
354 )
355
356 def update_collection(
357 self,
358 collection_id: uuid.UUID | str,
359 collection_data: dict[str, t.Any] | CollectionDocument,
360 *,
361 query_params: dict[str, t.Any] | None = None,
362 ) -> UnpackingGCSResponse:
363 """
364 Update a Collection
365
366 :param collection_id: The ID of the collection to update
367 :param collection_data: The collection document for the modified collection
368 :param query_params: Additional passthrough query parameters
369
370 .. tab-set::
371
372 .. tab-item:: API Info
373
374 ``PATCH /collections/{collection_id}``
375
376 .. extdoclink:: Update Collection
377 :ref: openapi_Collections/#patchCollection
378 :service: gcs
379 """
380 return UnpackingGCSResponse(
381 self.patch(
382 f"/collections/{collection_id}",
383 data=collection_data,
384 query_params=query_params,
385 ),
386 "collection",
387 )
388
389 def delete_collection(
390 self,
391 collection_id: uuid.UUID | str,
392 *,
393 query_params: dict[str, t.Any] | None = None,
394 ) -> response.GlobusHTTPResponse:
395 """
396 Delete a Collection
397
398 :param collection_id: The ID of the collection to delete
399 :param query_params: Additional passthrough query parameters
400
401 .. tab-set::
402
403 .. tab-item:: API Info
404
405 ``DELETE /collections/{collection_id}``
406
407 .. extdoclink:: Delete Collection
408 :ref: openapi_Collections/#deleteCollection
409 :service: gcs
410 """
411 return self.delete(f"/collections/{collection_id}", query_params=query_params)
412
413 #
414 # storage gateway methods
415 #
416
417 @paging.has_paginator(
418 paging.MarkerPaginator,
419 items_key="data",
420 )
421 def get_storage_gateway_list(
422 self,
423 *,
424 include: str | t.Iterable[str] | MissingType = MISSING,
425 page_size: int | MissingType = MISSING,
426 marker: str | MissingType = MISSING,
427 query_params: dict[str, t.Any] | None = None,
428 ) -> IterableGCSResponse:
429 """
430 List Storage Gateways
431
432 :param include: Optional document types to include in the response. If
433 'private_policies' is included, then include private storage gateway
434 policies in the attached storage_gateways document. This requires an
435 ``administrator`` role on the Endpoint.
436 :param page_size: Number of results to return per page
437 :param marker: Pagination marker supplied by previous API calls in the event
438 a request returns more values than the page size
439 :param query_params: Additional passthrough query parameters
440
441 .. tab-set::
442
443 .. tab-item:: Paginated Usage
444
445 .. paginatedusage:: get_storage_gateway_list
446
447 .. tab-item:: API Info
448
449 ``GET /storage_gateways``
450
451 .. extdoclink:: Delete Collection
452 :ref: openapi_Storage_Gateways/#getStorageGateways
453 :service: gcs
454 """
455 query_params = {
456 "include": commajoin(include),
457 "page_size": page_size,
458 "marker": marker,
459 **(query_params or {}),
460 }
461 return IterableGCSResponse(
462 self.get("/storage_gateways", query_params=query_params)
463 )
464
465 def create_storage_gateway(
466 self,
467 data: dict[str, t.Any] | StorageGatewayDocument,
468 *,
469 query_params: dict[str, t.Any] | None = None,
470 ) -> UnpackingGCSResponse:
471 """
472 Create a Storage Gateway
473
474 :param data: Data in the format of a Storage Gateway document, it is recommended
475 to use the ``StorageGatewayDocument`` class to construct this data.
476 :param query_params: Additional passthrough query parameters
477
478 .. tab-set::
479
480 .. tab-item:: API Info
481
482 ``POST /storage_gateways``
483
484 .. extdoclink:: Create Storage Gateway
485 :ref: openapi_Storage_Gateways/#postStorageGateway
486 :service: gcs
487 """
488 return UnpackingGCSResponse(
489 self.post("/storage_gateways", data=data, query_params=query_params),
490 "storage_gateway",
491 )
492
493 def get_storage_gateway(
494 self,
495 storage_gateway_id: uuid.UUID | str,
496 *,
497 include: str | t.Iterable[str] | MissingType = MISSING,
498 query_params: dict[str, t.Any] | None = None,
499 ) -> UnpackingGCSResponse:
500 """
501 Lookup a Storage Gateway by ID
502
503 :param storage_gateway_id: UUID for the Storage Gateway to be gotten
504 :param include: Optional document types to include in the response. If
505 'private_policies' is included, then include private storage gateway
506 policies in the attached storage_gateways document. This requires an
507 ``administrator`` role on the Endpoint.
508 :param query_params: Additional passthrough query parameters
509
510 .. tab-set::
511
512 .. tab-item:: API Info
513
514 ``GET /storage_gateways/<storage_gateway_id>``
515
516 .. extdoclink:: Get a Storage Gateway
517 :ref: openapi_Storage_Gateways/#getStorageGateway
518 :service: gcs
519 """
520 query_params = {"include": commajoin(include), **(query_params or {})}
521 return UnpackingGCSResponse(
522 self.get(
523 f"/storage_gateways/{storage_gateway_id}",
524 query_params=query_params,
525 ),
526 "storage_gateway",
527 )
528
529 def update_storage_gateway(
530 self,
531 storage_gateway_id: uuid.UUID | str,
532 data: dict[str, t.Any] | StorageGatewayDocument,
533 *,
534 query_params: dict[str, t.Any] | None = None,
535 ) -> response.GlobusHTTPResponse:
536 """
537 Update a Storage Gateway
538
539 :param storage_gateway_id: UUID for the Storage Gateway to be updated
540 :param data: Data in the format of a Storage Gateway document, it is recommended
541 to use the ``StorageGatewayDocument`` class to construct this data.
542 :param query_params: Additional passthrough query parameters
543
544 .. tab-set::
545
546 .. tab-item:: API Info
547
548 ``PATCH /storage_gateways/<storage_gateway_id>``
549
550 .. extdoclink:: Update a Storage Gateway
551 :ref: openapi_Storage_Gateways/#patchStorageGateway
552 :service: gcs
553 """
554 return self.patch(
555 f"/storage_gateways/{storage_gateway_id}",
556 data=data,
557 query_params=query_params,
558 )
559
560 def delete_storage_gateway(
561 self,
562 storage_gateway_id: str | uuid.UUID,
563 *,
564 query_params: dict[str, t.Any] | None = None,
565 ) -> response.GlobusHTTPResponse:
566 """
567 Delete a Storage Gateway
568
569 :param storage_gateway_id: UUID for the Storage Gateway to be deleted
570 :param query_params: Additional passthrough query parameters
571
572 .. tab-set::
573
574 .. tab-item:: API Info
575
576 ``DELETE /storage_gateways/<storage_gateway_id>``
577
578 .. extdoclink:: Delete a Storage Gateway
579 :ref: openapi_Storage_Gateways/#deleteStorageGateway
580 :service: gcs
581 """
582 return self.delete(
583 f"/storage_gateways/{storage_gateway_id}", query_params=query_params
584 )
585
586 #
587 # role methods
588 #
589
590 @paging.has_paginator(
591 paging.MarkerPaginator,
592 items_key="data",
593 )
594 def get_role_list(
595 self,
596 collection_id: uuid.UUID | str | MissingType = MISSING,
597 include: str | MissingType = MISSING,
598 page_size: int | MissingType = MISSING,
599 marker: str | MissingType = MISSING,
600 query_params: dict[str, t.Any] | None = None,
601 ) -> IterableGCSResponse:
602 """
603 List Roles
604
605 :param collection_id: UUID of a Collection. If given then only roles
606 related to that Collection are returned, otherwise only Endpoint
607 roles are returned.
608 :param include: Pass "all_roles" to request all roles
609 relevant to the resource instead of only those the caller has on
610 the resource
611 :param page_size: Number of results to return per page
612 :param marker: Pagination marker supplied by previous API calls in the event
613 a request returns more values than the page size
614 :param query_params: Additional passthrough query parameters
615
616 .. tab-set::
617
618 .. tab-item:: API Info
619
620 ``GET /roles``
621
622 .. extdoclink:: Delete a Storage Gateway
623 :ref: openapi_Roles/#listRoles
624 :service: gcs
625 """
626 query_params = {
627 "include": include,
628 "page_size": page_size,
629 "marker": marker,
630 "collection_id": collection_id,
631 **(query_params or {}),
632 }
633 path = "/roles"
634 return IterableGCSResponse(self.get(path, query_params=query_params))
635
636 def create_role(
637 self,
638 data: dict[str, t.Any] | GCSRoleDocument,
639 query_params: dict[str, t.Any] | None = None,
640 ) -> UnpackingGCSResponse:
641 """
642 Create a Role
643
644 :param data: Data in the format of a Role document, it is recommended
645 to use the `GCSRoleDocument` class to construct this data.
646 :param query_params: Additional passthrough query parameters
647
648 .. tab-set::
649
650 .. tab-item:: API Info
651
652 ``POST /roles``
653
654 .. extdoclink:: Create Role
655 :ref: openapi_Roles/#postRole
656 :service: gcs
657 """
658 path = "/roles"
659 return UnpackingGCSResponse(
660 self.post(path, data=data, query_params=query_params),
661 "role",
662 )
663
664 def get_role(
665 self,
666 role_id: uuid.UUID | str,
667 query_params: dict[str, t.Any] | None = None,
668 ) -> UnpackingGCSResponse:
669 """
670 Get a Role by ID
671
672 :param role_id: UUID for the Role to be gotten
673 :param query_params: Additional passthrough query parameters
674
675 .. tab-set::
676
677 .. tab-item:: API Info
678
679 ``GET /roles/{role_id}``
680
681 .. extdoclink:: Get Role
682 :ref: openapi_Roles/#getRole
683 :service: gcs
684 """
685 path = f"/roles/{role_id}"
686 return UnpackingGCSResponse(self.get(path, query_params=query_params), "role")
687
688 def delete_role(
689 self,
690 role_id: uuid.UUID | str,
691 query_params: dict[str, t.Any] | None = None,
692 ) -> response.GlobusHTTPResponse:
693 """
694 Delete a Role
695
696 :param role_id: UUID for the Role to be deleted
697 :param query_params: Additional passthrough query parameters
698
699 .. tab-set::
700
701 .. tab-item:: API Info
702
703 ``DELETE /roles/{role_id}``
704
705 .. extdoclink:: Delete Role
706 :ref: openapi_Roles/#deleteRole
707 :service: gcs
708 """
709 path = f"/roles/{role_id}"
710 return self.delete(path, query_params=query_params)
711
712 @paging.has_paginator(
713 paging.MarkerPaginator,
714 items_key="data",
715 )
716 def get_user_credential_list(
717 self,
718 storage_gateway: uuid.UUID | str | MissingType = MISSING,
719 page_size: int | MissingType = MISSING,
720 marker: str | MissingType = MISSING,
721 query_params: dict[str, t.Any] | None = None,
722 ) -> IterableGCSResponse:
723 """
724 List User Credentials
725
726 :param storage_gateway: UUID of a storage gateway to limit results to
727 :param query_params: Additional passthrough query parameters
728 :param page_size: Number of results to return per page
729 :param marker: Pagination marker supplied by previous API calls in the event
730 a request returns more values than the page size
731
732 .. tab-set::
733
734 .. tab-item:: API Info
735
736 ``GET /user_credentials``
737
738 .. extdoclink:: Get User Credential List
739 :ref: openapi_User_Credentials/#getUserCredentials
740 :service: gcs
741 """
742 query_params = {
743 "storage_gateway": storage_gateway,
744 "page_size": page_size,
745 "marker": marker,
746 **(query_params or {}),
747 }
748 path = "/user_credentials"
749 return IterableGCSResponse(self.get(path, query_params=query_params))
750
751 def create_user_credential(
752 self,
753 data: dict[str, t.Any] | UserCredentialDocument,
754 query_params: dict[str, t.Any] | None = None,
755 ) -> UnpackingGCSResponse:
756 """
757 Create a User Credential
758
759 :param data: Data in the format of a UserCredential document, it is
760 recommended to use the `UserCredential` class to construct this
761 :param query_params: Additional passthrough query parameters
762
763 .. tab-set::
764
765 .. tab-item:: API Info
766
767 ``POST /user_credentials``
768
769 .. extdoclink:: Create User Credential
770 :ref: openapi_User_Credentials/#postUserCredential
771 :service: gcs
772 """
773 path = "/user_credentials"
774 return UnpackingGCSResponse(
775 self.post(path, data=data, query_params=query_params),
776 "user_credential",
777 )
778
779 def get_user_credential(
780 self,
781 user_credential_id: uuid.UUID | str,
782 query_params: dict[str, t.Any] | None = None,
783 ) -> UnpackingGCSResponse:
784 """
785 Get a User Credential by ID
786
787 :param user_credential_id: UUID for the UserCredential to be gotten
788 :param query_params: Additional passthrough query parameters
789
790 .. tab-set::
791
792 .. tab-item:: API Info
793
794 ``GET /user_credentials/{user_credential_id}``
795
796 .. extdoclink:: Get a User Credential
797 :ref: openapi_User_Credentials/#getUserCredential
798 :service: gcs
799 """
800 path = f"/user_credentials/{user_credential_id}"
801 return UnpackingGCSResponse(
802 self.get(path, query_params=query_params), "user_credential"
803 )
804
805 def update_user_credential(
806 self,
807 user_credential_id: uuid.UUID | str,
808 data: dict[str, t.Any] | UserCredentialDocument,
809 query_params: dict[str, t.Any] | None = None,
810 ) -> UnpackingGCSResponse:
811 """
812 Update a User Credential
813
814 :param user_credential_id: UUID for the UserCredential to be updated
815 :param data: Data in the format of a UserCredential document, it is
816 recommended to use the `UserCredential` class to construct this
817 :param query_params: Additional passthrough query parameters
818
819 .. tab-set::
820
821 .. tab-item:: API Info
822
823 ``PATCH /user_credentials/{user_credential_id}``
824
825 .. extdoclink:: Update a User Credential
826 :ref: openapi_User_Credentials/#patchUserCredential
827 :service: gcs
828 """
829 path = f"/user_credentials/{user_credential_id}"
830 return UnpackingGCSResponse(
831 self.patch(path, data=data, query_params=query_params), "user_credential"
832 )
833
834 def delete_user_credential(
835 self,
836 user_credential_id: uuid.UUID | str,
837 query_params: dict[str, t.Any] | None = None,
838 ) -> response.GlobusHTTPResponse:
839 """
840 Delete a User Credential
841
842 :param user_credential_id: UUID for the UserCredential to be deleted
843 :param query_params: Additional passthrough query parameters
844
845 .. tab-set::
846
847 .. tab-item:: API Info
848
849 ``DELETE /user_credentials/{user_credential_id}``
850
851 .. extdoclink:: Delete User Credential
852 :ref: openapi_User_Credentials/#deleteUserCredential
853 :service: gcs
854 """
855 path = f"/user_credentials/{user_credential_id}"
856 return self.delete(path, query_params=query_params)