Debian Codegraph @

src/globus_sdk/services/gcs/data/user_credential.py

raw
1 from __future__ import annotations
2
3 import typing as t
4 import uuid
5
6 from globus_sdk._missing import MISSING, MissingType
7 from globus_sdk._payload import GlobusPayload
8
9
10 class UserCredentialDocument(GlobusPayload):
11 """
12 Convenience class for constructing a UserCredential document
13 to use as the `data` parameter to `create_user_credential` and
14 `update_user_credential`
15
16 :param DATA_TYPE: Versioned document type.
17 :param identity_id: UUID of the Globus identity this credential will
18 provide access for
19 :param connector_id: UUID of the connector this credential is for
20 :param username: Username of the local account this credential will provide
21 access to, format is connector specific
22 :param display_name: Display name for this credential
23 :param storage_gateway_id: UUID of the storage gateway this credential is for
24 :param policies: Connector specific policies for this credential
25 :param additional_fields: Additional data for inclusion in the document
26 """
27
28 def __init__(
29 self,
30 DATA_TYPE: str = "user_credential#1.0.0",
31 identity_id: uuid.UUID | str | MissingType = MISSING,
32 connector_id: uuid.UUID | str | MissingType = MISSING,
33 username: str | MissingType = MISSING,
34 display_name: str | MissingType = MISSING,
35 storage_gateway_id: uuid.UUID | str | MissingType = MISSING,
36 policies: dict[str, t.Any] | MissingType = MISSING,
37 additional_fields: dict[str, t.Any] | None = None,
38 ) -> None:
39 super().__init__()
40 self["DATA_TYPE"] = DATA_TYPE
41 self["identity_id"] = identity_id
42 self["connector_id"] = connector_id
43 self["username"] = username
44 self["display_name"] = display_name
45 self["storage_gateway_id"] = storage_gateway_id
46 self["policies"] = policies
47 self.update(additional_fields or {})