Debian Codegraph @

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

raw
1 from __future__ import annotations
2
3 import typing as t
4
5 from globus_sdk._internal.remarshal import strseq_listify
6 from globus_sdk._missing import MISSING, MissingType
7 from globus_sdk._payload import GlobusPayload
8 from globus_sdk.services.gcs.data._common import DatatypeCallback, ensure_datatype
9
10
11 class EndpointDocument(GlobusPayload):
12 r"""
13
14 :param data_type: Explicitly set the ``DATA_TYPE`` value for this endpoint document.
15 Normally ``DATA_TYPE`` is deduced from the provided parameters and should not be
16 set. To maximize compatibility with different versions of GCS, only set this
17 value when necessary.
18
19 :param contact_email: Email address of the support contact for this endpoint. This
20 is visible to end users so that they may contact your organization for support.
21 :param contact_info: Other non-email contact information for the endpoint, e.g.
22 phone and mailing address. This is visible to end users for support.
23 :param department: Department within organization that runs the server(s).
24 Searchable. Unicode string, max 1024 characters, no new lines.
25 :param description: A description of the endpoint.
26 :param display_name: Friendly name for the endpoint, not unique. Unicode string, no
27 new lines (\r or \n). Searchable.
28 :param info_link: Link to a web page with more information about the endpoint. The
29 administrator is responsible for running a website at this URL and verifying
30 that it is accepting public connections.
31 :param network_use: Control how Globus interacts with this endpoint over the
32 network. Allowed values are:
33
34 * ``normal``: (Default) Uses an average level of concurrency and
35 parallelism. The levels depend on the number of physical servers in the
36 endpoint.
37 * ``minimal``: Uses a minimal level of concurrency and parallelism.
38 * ``aggressive``: Uses a high level of concurrency and parallelism.
39 * ``custom``: Uses custom values of concurrency and parallelism set by the
40 endpoint admin. When setting this level, you must also set the
41 ``max_concurrency``, ``preferred_concurrency``, ``max_parallelism``, and
42 ``preferred_parallelism`` properties.
43 :param organization: Organization that runs the server(s). Searchable. Unicode
44 string, max 1024 characters, no new lines.
45 :param subscription_id: The id of the subscription that is managing this endpoint.
46 This may be the special value DEFAULT when using this as input to PATCH or PUT
47 to use the caller’s default subscription id.
48
49 :param keywords: List of search keywords for the endpoint. Unicode string, max 1024
50 characters total across all strings.
51
52 :param allow_udt: Allow data transfer on this endpoint using the UDT protocol.
53 :param public: Flag indicating whether this endpoint is visible to all other Globus
54 users. If false, only users which have been granted a role on the endpoint or
55 one of its collections, or belong to a domain allowed access to any of its
56 storage gateways may view it.
57
58 :param gridftp_control_channel_port: TCP port for the Globus control channel to
59 listen on. By default, the control channel is passed through 443 with an ALPN
60 header containing the value "ftp".
61 :param max_concurrency: Admin-specified value when the ``network_use`` property’s
62 value is ``"custom"``; otherwise the preset value for the specified
63 ``network_use``.
64 :param max_parallelism: Admin-specified value when the ``network_use`` property’s
65 value is ``"custom"``; otherwise the preset value for the specified
66 ``network_use``.
67 :param preferred_concurrency: Admin-specified value when the ``network_use``
68 property’s value is ``"custom"``; otherwise the preset value for the specified
69 ``network_use``.
70 :param preferred_parallelism: Admin-specified value when the ``network_use``
71 property’s value is ``"custom"``; otherwise the preset value for the specified
72 ``network_use``.
73 """
74
75 DATATYPE_BASE = "endpoint"
76 DATATYPE_VERSION_IMPLICATIONS: dict[str, tuple[int, int, int]] = {
77 "gridftp_control_channel_port": (1, 1, 0),
78 }
79 DATATYPE_VERSION_CALLBACKS: tuple[DatatypeCallback, ...] = ()
80
81 # Note: The fields below represent the set of mutable endpoint fields in
82 # an Endpoint#1.2.0 document.
83 # https://docs.globus.org/globus-connect-server/v5.4/api/schemas/Endpoint_1_2_0_schema/
84 # Read-only fields (e.g. "gcs_manager_url", "endpoint_id", and
85 # "earliest_last_access") are intentionally omitted as this data class is designed
86 # for input construction not response parsing.
87 def __init__(
88 self,
89 *,
90 # data type
91 data_type: str | MissingType = MISSING,
92 # strs
93 contact_email: str | MissingType = MISSING,
94 contact_info: str | MissingType = MISSING,
95 department: str | MissingType = MISSING,
96 description: str | MissingType = MISSING,
97 display_name: str | MissingType = MISSING,
98 info_link: str | MissingType = MISSING,
99 network_use: (
100 t.Literal["normal", "minimal", "aggressive", "custom"] | MissingType
101 ) = MISSING,
102 organization: str | MissingType = MISSING,
103 # nullable strs
104 subscription_id: str | None | MissingType = MISSING,
105 # str lists
106 keywords: t.Iterable[str] | MissingType = MISSING,
107 # bools
108 allow_udt: bool | MissingType = MISSING,
109 public: bool | MissingType = MISSING,
110 # ints
111 max_concurrency: int | MissingType = MISSING,
112 max_parallelism: int | MissingType = MISSING,
113 preferred_concurrency: int | MissingType = MISSING,
114 preferred_parallelism: int | MissingType = MISSING,
115 # nullable ints
116 gridftp_control_channel_port: int | None | MissingType = MISSING,
117 # additional fields
118 additional_fields: dict[str, t.Any] | MissingType = MISSING,
119 ) -> None:
120 super().__init__()
121 self["DATA_TYPE"] = data_type
122 self["contact_email"] = contact_email
123 self["contact_info"] = contact_info
124 self["department"] = department
125 self["description"] = description
126 self["display_name"] = display_name
127 self["info_link"] = info_link
128 self["network_use"] = network_use
129 self["organization"] = organization
130 self["keywords"] = strseq_listify(keywords)
131 self["allow_udt"] = allow_udt
132 self["public"] = public
133 self["max_concurrency"] = max_concurrency
134 self["max_parallelism"] = max_parallelism
135 self["preferred_concurrency"] = preferred_concurrency
136 self["preferred_parallelism"] = preferred_parallelism
137 self["subscription_id"] = subscription_id
138 self["gridftp_control_channel_port"] = gridftp_control_channel_port
139
140 if additional_fields is not MISSING:
141 self.update(additional_fields)
142 ensure_datatype(self)