latitudesh-python-sdk 2.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. latitudesh_python_sdk/__init__.py +18 -0
  2. latitudesh_python_sdk/_hooks/__init__.py +5 -0
  3. latitudesh_python_sdk/_hooks/registration.py +13 -0
  4. latitudesh_python_sdk/_hooks/sdkhooks.py +76 -0
  5. latitudesh_python_sdk/_hooks/types.py +113 -0
  6. latitudesh_python_sdk/_version.py +17 -0
  7. latitudesh_python_sdk/apikeys.py +703 -0
  8. latitudesh_python_sdk/basesdk.py +374 -0
  9. latitudesh_python_sdk/billing.py +197 -0
  10. latitudesh_python_sdk/events_sdk.py +298 -0
  11. latitudesh_python_sdk/firewalls_sdk.py +1786 -0
  12. latitudesh_python_sdk/httpclient.py +125 -0
  13. latitudesh_python_sdk/ipaddresses_sdk.py +470 -0
  14. latitudesh_python_sdk/models/__init__.py +3581 -0
  15. latitudesh_python_sdk/models/api_key.py +81 -0
  16. latitudesh_python_sdk/models/apierror.py +40 -0
  17. latitudesh_python_sdk/models/assign_server_virtual_networkop.py +43 -0
  18. latitudesh_python_sdk/models/bandwidth_packages.py +67 -0
  19. latitudesh_python_sdk/models/bandwidth_plan_data.py +72 -0
  20. latitudesh_python_sdk/models/bandwidth_plans.py +26 -0
  21. latitudesh_python_sdk/models/billing_usage.py +249 -0
  22. latitudesh_python_sdk/models/container_plan_data.py +163 -0
  23. latitudesh_python_sdk/models/create_api_key.py +40 -0
  24. latitudesh_python_sdk/models/create_firewall_assignmentop.py +61 -0
  25. latitudesh_python_sdk/models/create_firewallop.py +73 -0
  26. latitudesh_python_sdk/models/create_ipmi_sessionop.py +16 -0
  27. latitudesh_python_sdk/models/create_projectop.py +79 -0
  28. latitudesh_python_sdk/models/create_server_actionop.py +69 -0
  29. latitudesh_python_sdk/models/create_server_out_of_bandop.py +61 -0
  30. latitudesh_python_sdk/models/create_server_reinstallop.py +140 -0
  31. latitudesh_python_sdk/models/create_serverop.py +173 -0
  32. latitudesh_python_sdk/models/create_tagop.py +50 -0
  33. latitudesh_python_sdk/models/create_virtual_machine_actionop.py +63 -0
  34. latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
  35. latitudesh_python_sdk/models/custom_tag.py +26 -0
  36. latitudesh_python_sdk/models/custom_tag_data.py +54 -0
  37. latitudesh_python_sdk/models/custom_tags.py +26 -0
  38. latitudesh_python_sdk/models/delete_api_keyop.py +16 -0
  39. latitudesh_python_sdk/models/delete_firewall_assignmentop.py +25 -0
  40. latitudesh_python_sdk/models/delete_firewallop.py +18 -0
  41. latitudesh_python_sdk/models/delete_project_ssh_keyop.py +23 -0
  42. latitudesh_python_sdk/models/delete_project_user_dataop.py +23 -0
  43. latitudesh_python_sdk/models/delete_projectop.py +18 -0
  44. latitudesh_python_sdk/models/delete_ssh_keyop.py +16 -0
  45. latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
  46. latitudesh_python_sdk/models/delete_storage_volumesop.py +16 -0
  47. latitudesh_python_sdk/models/delete_user_dataop.py +16 -0
  48. latitudesh_python_sdk/models/delete_virtual_networks_assignmentsop.py +16 -0
  49. latitudesh_python_sdk/models/delete_vpn_sessionop.py +16 -0
  50. latitudesh_python_sdk/models/deploy_config.py +62 -0
  51. latitudesh_python_sdk/models/destroy_serverop.py +31 -0
  52. latitudesh_python_sdk/models/destroy_tagop.py +16 -0
  53. latitudesh_python_sdk/models/destroy_team_memberop.py +18 -0
  54. latitudesh_python_sdk/models/destroy_virtual_machineop.py +16 -0
  55. latitudesh_python_sdk/models/destroy_virtual_networkop.py +18 -0
  56. latitudesh_python_sdk/models/event_data.py +98 -0
  57. latitudesh_python_sdk/models/events.py +26 -0
  58. latitudesh_python_sdk/models/filesystem_data.py +57 -0
  59. latitudesh_python_sdk/models/firewall.py +26 -0
  60. latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
  61. latitudesh_python_sdk/models/firewall_assignments.py +29 -0
  62. latitudesh_python_sdk/models/firewall_data.py +75 -0
  63. latitudesh_python_sdk/models/firewall_server.py +36 -0
  64. latitudesh_python_sdk/models/firewalls.py +26 -0
  65. latitudesh_python_sdk/models/get_all_firewall_assignmentsop.py +51 -0
  66. latitudesh_python_sdk/models/get_bandwidth_plansop.py +62 -0
  67. latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
  68. latitudesh_python_sdk/models/get_containers_planop.py +18 -0
  69. latitudesh_python_sdk/models/get_eventsop.py +126 -0
  70. latitudesh_python_sdk/models/get_firewall_assignmentsop.py +53 -0
  71. latitudesh_python_sdk/models/get_firewallop.py +18 -0
  72. latitudesh_python_sdk/models/get_ipop.py +33 -0
  73. latitudesh_python_sdk/models/get_ipsop.py +120 -0
  74. latitudesh_python_sdk/models/get_planop.py +16 -0
  75. latitudesh_python_sdk/models/get_plans_operating_systemop.py +54 -0
  76. latitudesh_python_sdk/models/get_plansop.py +125 -0
  77. latitudesh_python_sdk/models/get_project_ssh_keyop.py +37 -0
  78. latitudesh_python_sdk/models/get_project_ssh_keysop.py +33 -0
  79. latitudesh_python_sdk/models/get_project_user_dataop.py +38 -0
  80. latitudesh_python_sdk/models/get_project_users_dataop.py +46 -0
  81. latitudesh_python_sdk/models/get_projectsop.py +105 -0
  82. latitudesh_python_sdk/models/get_regionop.py +18 -0
  83. latitudesh_python_sdk/models/get_regionsop.py +42 -0
  84. latitudesh_python_sdk/models/get_role_idop.py +16 -0
  85. latitudesh_python_sdk/models/get_rolesop.py +54 -0
  86. latitudesh_python_sdk/models/get_server_deploy_configop.py +18 -0
  87. latitudesh_python_sdk/models/get_server_out_of_bandop.py +18 -0
  88. latitudesh_python_sdk/models/get_serverop.py +33 -0
  89. latitudesh_python_sdk/models/get_serversop.py +185 -0
  90. latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
  91. latitudesh_python_sdk/models/get_ssh_keysop.py +31 -0
  92. latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
  93. latitudesh_python_sdk/models/get_storage_volumeop.py +32 -0
  94. latitudesh_python_sdk/models/get_storage_volumesop.py +35 -0
  95. latitudesh_python_sdk/models/get_team_membersop.py +42 -0
  96. latitudesh_python_sdk/models/get_traffic_consumptionop.py +49 -0
  97. latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
  98. latitudesh_python_sdk/models/get_user_dataop.py +31 -0
  99. latitudesh_python_sdk/models/get_user_profileop.py +19 -0
  100. latitudesh_python_sdk/models/get_users_dataop.py +44 -0
  101. latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
  102. latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +72 -0
  103. latitudesh_python_sdk/models/get_virtual_networksop.py +69 -0
  104. latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
  105. latitudesh_python_sdk/models/index_virtual_machineop.py +31 -0
  106. latitudesh_python_sdk/models/ip_address.py +122 -0
  107. latitudesh_python_sdk/models/ip_addresses.py +15 -0
  108. latitudesh_python_sdk/models/ipmi_session.py +53 -0
  109. latitudesh_python_sdk/models/latitudesherror.py +30 -0
  110. latitudesh_python_sdk/models/list_firewallsop.py +49 -0
  111. latitudesh_python_sdk/models/membership.py +63 -0
  112. latitudesh_python_sdk/models/no_response_error.py +17 -0
  113. latitudesh_python_sdk/models/operating_system_data.py +65 -0
  114. latitudesh_python_sdk/models/operating_systems.py +26 -0
  115. latitudesh_python_sdk/models/out_of_band_connection.py +88 -0
  116. latitudesh_python_sdk/models/patch_current_teamop.py +91 -0
  117. latitudesh_python_sdk/models/patch_storage_filesystemsop.py +79 -0
  118. latitudesh_python_sdk/models/patch_user_dataop.py +69 -0
  119. latitudesh_python_sdk/models/patch_user_profileop.py +88 -0
  120. latitudesh_python_sdk/models/plan.py +15 -0
  121. latitudesh_python_sdk/models/plan_data.py +210 -0
  122. latitudesh_python_sdk/models/post_api_keyop.py +19 -0
  123. latitudesh_python_sdk/models/post_project_ssh_keyop.py +81 -0
  124. latitudesh_python_sdk/models/post_project_user_dataop.py +68 -0
  125. latitudesh_python_sdk/models/post_ssh_keyop.py +63 -0
  126. latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
  127. latitudesh_python_sdk/models/post_storage_volumes_mountop.py +62 -0
  128. latitudesh_python_sdk/models/post_storage_volumesop.py +63 -0
  129. latitudesh_python_sdk/models/post_team_membersop.py +54 -0
  130. latitudesh_python_sdk/models/post_teamop.py +67 -0
  131. latitudesh_python_sdk/models/post_user_dataop.py +50 -0
  132. latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
  133. latitudesh_python_sdk/models/project.py +131 -0
  134. latitudesh_python_sdk/models/project_include.py +75 -0
  135. latitudesh_python_sdk/models/projects.py +15 -0
  136. latitudesh_python_sdk/models/put_project_ssh_keyop.py +87 -0
  137. latitudesh_python_sdk/models/put_project_user_dataop.py +76 -0
  138. latitudesh_python_sdk/models/put_ssh_keyop.py +80 -0
  139. latitudesh_python_sdk/models/put_vpn_sessionop.py +16 -0
  140. latitudesh_python_sdk/models/region.py +50 -0
  141. latitudesh_python_sdk/models/region_resource_data.py +37 -0
  142. latitudesh_python_sdk/models/regions.py +50 -0
  143. latitudesh_python_sdk/models/responsevalidationerror.py +27 -0
  144. latitudesh_python_sdk/models/role.py +26 -0
  145. latitudesh_python_sdk/models/role_data.py +35 -0
  146. latitudesh_python_sdk/models/security.py +25 -0
  147. latitudesh_python_sdk/models/server.py +26 -0
  148. latitudesh_python_sdk/models/server_action.py +52 -0
  149. latitudesh_python_sdk/models/server_data.py +280 -0
  150. latitudesh_python_sdk/models/server_exit_rescue_modeop.py +16 -0
  151. latitudesh_python_sdk/models/server_lockop.py +16 -0
  152. latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
  153. latitudesh_python_sdk/models/server_rescue.py +22 -0
  154. latitudesh_python_sdk/models/server_schedule_deletion.py +44 -0
  155. latitudesh_python_sdk/models/server_schedule_deletionop.py +16 -0
  156. latitudesh_python_sdk/models/server_start_rescue_modeop.py +16 -0
  157. latitudesh_python_sdk/models/server_unlockop.py +16 -0
  158. latitudesh_python_sdk/models/server_unschedule_deletionop.py +16 -0
  159. latitudesh_python_sdk/models/servers.py +26 -0
  160. latitudesh_python_sdk/models/show_virtual_machineop.py +16 -0
  161. latitudesh_python_sdk/models/ssh_key_data.py +55 -0
  162. latitudesh_python_sdk/models/ssh_keys.py +26 -0
  163. latitudesh_python_sdk/models/storage_plan_data.py +47 -0
  164. latitudesh_python_sdk/models/storage_plans.py +26 -0
  165. latitudesh_python_sdk/models/team.py +74 -0
  166. latitudesh_python_sdk/models/team_include.py +43 -0
  167. latitudesh_python_sdk/models/team_members.py +51 -0
  168. latitudesh_python_sdk/models/teams.py +26 -0
  169. latitudesh_python_sdk/models/traffic.py +133 -0
  170. latitudesh_python_sdk/models/traffic_quota.py +106 -0
  171. latitudesh_python_sdk/models/update_api_key.py +48 -0
  172. latitudesh_python_sdk/models/update_api_keyop.py +41 -0
  173. latitudesh_python_sdk/models/update_firewallop.py +89 -0
  174. latitudesh_python_sdk/models/update_plans_bandwidthop.py +50 -0
  175. latitudesh_python_sdk/models/update_projectop.py +95 -0
  176. latitudesh_python_sdk/models/update_server_deploy_configop.py +122 -0
  177. latitudesh_python_sdk/models/update_serverop.py +85 -0
  178. latitudesh_python_sdk/models/update_tagop.py +74 -0
  179. latitudesh_python_sdk/models/update_virtual_networkop.py +67 -0
  180. latitudesh_python_sdk/models/user.py +59 -0
  181. latitudesh_python_sdk/models/user_data.py +26 -0
  182. latitudesh_python_sdk/models/user_data_properties.py +46 -0
  183. latitudesh_python_sdk/models/user_include.py +52 -0
  184. latitudesh_python_sdk/models/user_team.py +61 -0
  185. latitudesh_python_sdk/models/user_teams.py +26 -0
  186. latitudesh_python_sdk/models/user_update.py +37 -0
  187. latitudesh_python_sdk/models/virtual_machine.py +29 -0
  188. latitudesh_python_sdk/models/virtual_machine_attributes.py +115 -0
  189. latitudesh_python_sdk/models/virtual_machine_payload.py +47 -0
  190. latitudesh_python_sdk/models/virtual_machine_plans.py +181 -0
  191. latitudesh_python_sdk/models/virtual_network.py +26 -0
  192. latitudesh_python_sdk/models/virtual_network_assignment.py +29 -0
  193. latitudesh_python_sdk/models/virtual_network_assignment_data.py +65 -0
  194. latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
  195. latitudesh_python_sdk/models/virtual_network_data.py +114 -0
  196. latitudesh_python_sdk/models/virtual_networks.py +26 -0
  197. latitudesh_python_sdk/models/volume_data.py +111 -0
  198. latitudesh_python_sdk/models/vpn_session_data_with_password.py +77 -0
  199. latitudesh_python_sdk/models/vpn_session_with_password.py +18 -0
  200. latitudesh_python_sdk/operatingsystems_sdk.py +238 -0
  201. latitudesh_python_sdk/plans.py +1304 -0
  202. latitudesh_python_sdk/privatenetworks.py +1612 -0
  203. latitudesh_python_sdk/projects_sdk.py +830 -0
  204. latitudesh_python_sdk/py.typed +1 -0
  205. latitudesh_python_sdk/regions_sdk.py +398 -0
  206. latitudesh_python_sdk/roles.py +398 -0
  207. latitudesh_python_sdk/sdk.py +264 -0
  208. latitudesh_python_sdk/sdkconfiguration.py +50 -0
  209. latitudesh_python_sdk/servers_sdk.py +3414 -0
  210. latitudesh_python_sdk/sshkeys_sdk.py +1882 -0
  211. latitudesh_python_sdk/storage.py +1651 -0
  212. latitudesh_python_sdk/tags.py +715 -0
  213. latitudesh_python_sdk/teams_sdk.py +527 -0
  214. latitudesh_python_sdk/teamsmembers.py +576 -0
  215. latitudesh_python_sdk/traffic_sdk.py +357 -0
  216. latitudesh_python_sdk/types/__init__.py +21 -0
  217. latitudesh_python_sdk/types/basemodel.py +39 -0
  218. latitudesh_python_sdk/userdata_sdk.py +1888 -0
  219. latitudesh_python_sdk/userprofile.py +531 -0
  220. latitudesh_python_sdk/utils/__init__.py +200 -0
  221. latitudesh_python_sdk/utils/annotations.py +79 -0
  222. latitudesh_python_sdk/utils/datetimes.py +23 -0
  223. latitudesh_python_sdk/utils/enums.py +74 -0
  224. latitudesh_python_sdk/utils/eventstreaming.py +248 -0
  225. latitudesh_python_sdk/utils/forms.py +234 -0
  226. latitudesh_python_sdk/utils/headers.py +136 -0
  227. latitudesh_python_sdk/utils/logger.py +27 -0
  228. latitudesh_python_sdk/utils/metadata.py +118 -0
  229. latitudesh_python_sdk/utils/queryparams.py +217 -0
  230. latitudesh_python_sdk/utils/requestbodies.py +66 -0
  231. latitudesh_python_sdk/utils/retries.py +281 -0
  232. latitudesh_python_sdk/utils/security.py +192 -0
  233. latitudesh_python_sdk/utils/serializers.py +249 -0
  234. latitudesh_python_sdk/utils/unmarshal_json_response.py +38 -0
  235. latitudesh_python_sdk/utils/url.py +155 -0
  236. latitudesh_python_sdk/utils/values.py +137 -0
  237. latitudesh_python_sdk/virtualmachines.py +941 -0
  238. latitudesh_python_sdk/vpnsessions.py +715 -0
  239. latitudesh_python_sdk-2.3.0.dist-info/METADATA +787 -0
  240. latitudesh_python_sdk-2.3.0.dist-info/RECORD +242 -0
  241. latitudesh_python_sdk-2.3.0.dist-info/WHEEL +4 -0
  242. latitudesh_python_sdk-2.3.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,1888 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from latitudesh_python_sdk import models, utils
5
+ from latitudesh_python_sdk._hooks import HookContext
6
+ from latitudesh_python_sdk.types import OptionalNullable, UNSET
7
+ from latitudesh_python_sdk.utils import get_security_from_env
8
+ from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
9
+ from typing import Mapping, Optional, Union
10
+ from typing_extensions import deprecated
11
+
12
+
13
+ class UserDataSDK(BaseSDK):
14
+ @deprecated(
15
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
16
+ )
17
+ def list_project_user_data(
18
+ self,
19
+ *,
20
+ project_id: str,
21
+ extra_fields_user_data: Optional[str] = "decoded_content",
22
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
23
+ server_url: Optional[str] = None,
24
+ timeout_ms: Optional[int] = None,
25
+ http_headers: Optional[Mapping[str, str]] = None,
26
+ ) -> models.GetProjectUsersDataResponseBody:
27
+ r"""List all Project User Data
28
+
29
+ List all Users Data in the project. These scripts can be used to configure servers with user data.
30
+
31
+
32
+ :param project_id: Project ID or Slug
33
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
34
+ :param retries: Override the default retry configuration for this method
35
+ :param server_url: Override the default server URL for this method
36
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
37
+ :param http_headers: Additional headers to set or replace on requests.
38
+ """
39
+ base_url = None
40
+ url_variables = None
41
+ if timeout_ms is None:
42
+ timeout_ms = self.sdk_configuration.timeout_ms
43
+
44
+ if server_url is not None:
45
+ base_url = server_url
46
+ else:
47
+ base_url = self._get_url(base_url, url_variables)
48
+
49
+ request = models.GetProjectUsersDataRequest(
50
+ project_id=project_id,
51
+ extra_fields_user_data=extra_fields_user_data,
52
+ )
53
+
54
+ req = self._build_request(
55
+ method="GET",
56
+ path="/projects/{project_id}/user_data",
57
+ base_url=base_url,
58
+ url_variables=url_variables,
59
+ request=request,
60
+ request_body_required=False,
61
+ request_has_path_params=True,
62
+ request_has_query_params=True,
63
+ user_agent_header="user-agent",
64
+ accept_header_value="application/vnd.api+json",
65
+ http_headers=http_headers,
66
+ security=self.sdk_configuration.security,
67
+ allow_empty_value=None,
68
+ timeout_ms=timeout_ms,
69
+ )
70
+
71
+ if retries == UNSET:
72
+ if self.sdk_configuration.retry_config is not UNSET:
73
+ retries = self.sdk_configuration.retry_config
74
+
75
+ retry_config = None
76
+ if isinstance(retries, utils.RetryConfig):
77
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
78
+
79
+ http_res = self.do_request(
80
+ hook_ctx=HookContext(
81
+ config=self.sdk_configuration,
82
+ base_url=base_url or "",
83
+ operation_id="get-project-users-data",
84
+ oauth2_scopes=None,
85
+ security_source=get_security_from_env(
86
+ self.sdk_configuration.security, models.Security
87
+ ),
88
+ ),
89
+ request=req,
90
+ error_status_codes=["4XX", "5XX"],
91
+ retry_config=retry_config,
92
+ )
93
+
94
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
95
+ return unmarshal_json_response(
96
+ models.GetProjectUsersDataResponseBody, http_res
97
+ )
98
+ if utils.match_response(http_res, "4XX", "*"):
99
+ http_res_text = utils.stream_to_text(http_res)
100
+ raise models.APIError("API error occurred", http_res, http_res_text)
101
+ if utils.match_response(http_res, "5XX", "*"):
102
+ http_res_text = utils.stream_to_text(http_res)
103
+ raise models.APIError("API error occurred", http_res, http_res_text)
104
+
105
+ raise models.APIError("Unexpected response received", http_res)
106
+
107
+ @deprecated(
108
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
109
+ )
110
+ async def list_project_user_data_async(
111
+ self,
112
+ *,
113
+ project_id: str,
114
+ extra_fields_user_data: Optional[str] = "decoded_content",
115
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
116
+ server_url: Optional[str] = None,
117
+ timeout_ms: Optional[int] = None,
118
+ http_headers: Optional[Mapping[str, str]] = None,
119
+ ) -> models.GetProjectUsersDataResponseBody:
120
+ r"""List all Project User Data
121
+
122
+ List all Users Data in the project. These scripts can be used to configure servers with user data.
123
+
124
+
125
+ :param project_id: Project ID or Slug
126
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
127
+ :param retries: Override the default retry configuration for this method
128
+ :param server_url: Override the default server URL for this method
129
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
130
+ :param http_headers: Additional headers to set or replace on requests.
131
+ """
132
+ base_url = None
133
+ url_variables = None
134
+ if timeout_ms is None:
135
+ timeout_ms = self.sdk_configuration.timeout_ms
136
+
137
+ if server_url is not None:
138
+ base_url = server_url
139
+ else:
140
+ base_url = self._get_url(base_url, url_variables)
141
+
142
+ request = models.GetProjectUsersDataRequest(
143
+ project_id=project_id,
144
+ extra_fields_user_data=extra_fields_user_data,
145
+ )
146
+
147
+ req = self._build_request_async(
148
+ method="GET",
149
+ path="/projects/{project_id}/user_data",
150
+ base_url=base_url,
151
+ url_variables=url_variables,
152
+ request=request,
153
+ request_body_required=False,
154
+ request_has_path_params=True,
155
+ request_has_query_params=True,
156
+ user_agent_header="user-agent",
157
+ accept_header_value="application/vnd.api+json",
158
+ http_headers=http_headers,
159
+ security=self.sdk_configuration.security,
160
+ allow_empty_value=None,
161
+ timeout_ms=timeout_ms,
162
+ )
163
+
164
+ if retries == UNSET:
165
+ if self.sdk_configuration.retry_config is not UNSET:
166
+ retries = self.sdk_configuration.retry_config
167
+
168
+ retry_config = None
169
+ if isinstance(retries, utils.RetryConfig):
170
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
171
+
172
+ http_res = await self.do_request_async(
173
+ hook_ctx=HookContext(
174
+ config=self.sdk_configuration,
175
+ base_url=base_url or "",
176
+ operation_id="get-project-users-data",
177
+ oauth2_scopes=None,
178
+ security_source=get_security_from_env(
179
+ self.sdk_configuration.security, models.Security
180
+ ),
181
+ ),
182
+ request=req,
183
+ error_status_codes=["4XX", "5XX"],
184
+ retry_config=retry_config,
185
+ )
186
+
187
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
188
+ return unmarshal_json_response(
189
+ models.GetProjectUsersDataResponseBody, http_res
190
+ )
191
+ if utils.match_response(http_res, "4XX", "*"):
192
+ http_res_text = await utils.stream_to_text_async(http_res)
193
+ raise models.APIError("API error occurred", http_res, http_res_text)
194
+ if utils.match_response(http_res, "5XX", "*"):
195
+ http_res_text = await utils.stream_to_text_async(http_res)
196
+ raise models.APIError("API error occurred", http_res, http_res_text)
197
+
198
+ raise models.APIError("Unexpected response received", http_res)
199
+
200
+ @deprecated(
201
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
202
+ )
203
+ def create(
204
+ self,
205
+ *,
206
+ project_id: str,
207
+ data: Union[
208
+ models.PostProjectUserDataUserDataData,
209
+ models.PostProjectUserDataUserDataDataTypedDict,
210
+ ],
211
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
212
+ server_url: Optional[str] = None,
213
+ timeout_ms: Optional[int] = None,
214
+ http_headers: Optional[Mapping[str, str]] = None,
215
+ ) -> models.UserData:
216
+ r"""Create a Project User Data
217
+
218
+ Allows you to create User Data in a project, which can be used to perform custom setup on your servers after deploy and reinstall.
219
+
220
+
221
+ :param project_id: Project ID or Slug
222
+ :param data:
223
+ :param retries: Override the default retry configuration for this method
224
+ :param server_url: Override the default server URL for this method
225
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
226
+ :param http_headers: Additional headers to set or replace on requests.
227
+ """
228
+ base_url = None
229
+ url_variables = None
230
+ if timeout_ms is None:
231
+ timeout_ms = self.sdk_configuration.timeout_ms
232
+
233
+ if server_url is not None:
234
+ base_url = server_url
235
+ else:
236
+ base_url = self._get_url(base_url, url_variables)
237
+
238
+ request = models.PostProjectUserDataRequest(
239
+ project_id=project_id,
240
+ request_body=models.PostProjectUserDataUserDataRequestBody(
241
+ data=utils.get_pydantic_model(
242
+ data, models.PostProjectUserDataUserDataData
243
+ ),
244
+ ),
245
+ )
246
+
247
+ req = self._build_request(
248
+ method="POST",
249
+ path="/projects/{project_id}/user_data",
250
+ base_url=base_url,
251
+ url_variables=url_variables,
252
+ request=request,
253
+ request_body_required=True,
254
+ request_has_path_params=True,
255
+ request_has_query_params=True,
256
+ user_agent_header="user-agent",
257
+ accept_header_value="application/vnd.api+json",
258
+ http_headers=http_headers,
259
+ security=self.sdk_configuration.security,
260
+ get_serialized_body=lambda: utils.serialize_request_body(
261
+ request.request_body,
262
+ False,
263
+ False,
264
+ "json",
265
+ models.PostProjectUserDataUserDataRequestBody,
266
+ ),
267
+ allow_empty_value=None,
268
+ timeout_ms=timeout_ms,
269
+ )
270
+
271
+ if retries == UNSET:
272
+ if self.sdk_configuration.retry_config is not UNSET:
273
+ retries = self.sdk_configuration.retry_config
274
+
275
+ retry_config = None
276
+ if isinstance(retries, utils.RetryConfig):
277
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
278
+
279
+ http_res = self.do_request(
280
+ hook_ctx=HookContext(
281
+ config=self.sdk_configuration,
282
+ base_url=base_url or "",
283
+ operation_id="post-project-user-data",
284
+ oauth2_scopes=None,
285
+ security_source=get_security_from_env(
286
+ self.sdk_configuration.security, models.Security
287
+ ),
288
+ ),
289
+ request=req,
290
+ error_status_codes=["4XX", "5XX"],
291
+ retry_config=retry_config,
292
+ )
293
+
294
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
295
+ return unmarshal_json_response(models.UserData, http_res)
296
+ if utils.match_response(http_res, "4XX", "*"):
297
+ http_res_text = utils.stream_to_text(http_res)
298
+ raise models.APIError("API error occurred", http_res, http_res_text)
299
+ if utils.match_response(http_res, "5XX", "*"):
300
+ http_res_text = utils.stream_to_text(http_res)
301
+ raise models.APIError("API error occurred", http_res, http_res_text)
302
+
303
+ raise models.APIError("Unexpected response received", http_res)
304
+
305
+ @deprecated(
306
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
307
+ )
308
+ async def create_async(
309
+ self,
310
+ *,
311
+ project_id: str,
312
+ data: Union[
313
+ models.PostProjectUserDataUserDataData,
314
+ models.PostProjectUserDataUserDataDataTypedDict,
315
+ ],
316
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
317
+ server_url: Optional[str] = None,
318
+ timeout_ms: Optional[int] = None,
319
+ http_headers: Optional[Mapping[str, str]] = None,
320
+ ) -> models.UserData:
321
+ r"""Create a Project User Data
322
+
323
+ Allows you to create User Data in a project, which can be used to perform custom setup on your servers after deploy and reinstall.
324
+
325
+
326
+ :param project_id: Project ID or Slug
327
+ :param data:
328
+ :param retries: Override the default retry configuration for this method
329
+ :param server_url: Override the default server URL for this method
330
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
331
+ :param http_headers: Additional headers to set or replace on requests.
332
+ """
333
+ base_url = None
334
+ url_variables = None
335
+ if timeout_ms is None:
336
+ timeout_ms = self.sdk_configuration.timeout_ms
337
+
338
+ if server_url is not None:
339
+ base_url = server_url
340
+ else:
341
+ base_url = self._get_url(base_url, url_variables)
342
+
343
+ request = models.PostProjectUserDataRequest(
344
+ project_id=project_id,
345
+ request_body=models.PostProjectUserDataUserDataRequestBody(
346
+ data=utils.get_pydantic_model(
347
+ data, models.PostProjectUserDataUserDataData
348
+ ),
349
+ ),
350
+ )
351
+
352
+ req = self._build_request_async(
353
+ method="POST",
354
+ path="/projects/{project_id}/user_data",
355
+ base_url=base_url,
356
+ url_variables=url_variables,
357
+ request=request,
358
+ request_body_required=True,
359
+ request_has_path_params=True,
360
+ request_has_query_params=True,
361
+ user_agent_header="user-agent",
362
+ accept_header_value="application/vnd.api+json",
363
+ http_headers=http_headers,
364
+ security=self.sdk_configuration.security,
365
+ get_serialized_body=lambda: utils.serialize_request_body(
366
+ request.request_body,
367
+ False,
368
+ False,
369
+ "json",
370
+ models.PostProjectUserDataUserDataRequestBody,
371
+ ),
372
+ allow_empty_value=None,
373
+ timeout_ms=timeout_ms,
374
+ )
375
+
376
+ if retries == UNSET:
377
+ if self.sdk_configuration.retry_config is not UNSET:
378
+ retries = self.sdk_configuration.retry_config
379
+
380
+ retry_config = None
381
+ if isinstance(retries, utils.RetryConfig):
382
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
383
+
384
+ http_res = await self.do_request_async(
385
+ hook_ctx=HookContext(
386
+ config=self.sdk_configuration,
387
+ base_url=base_url or "",
388
+ operation_id="post-project-user-data",
389
+ oauth2_scopes=None,
390
+ security_source=get_security_from_env(
391
+ self.sdk_configuration.security, models.Security
392
+ ),
393
+ ),
394
+ request=req,
395
+ error_status_codes=["4XX", "5XX"],
396
+ retry_config=retry_config,
397
+ )
398
+
399
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
400
+ return unmarshal_json_response(models.UserData, http_res)
401
+ if utils.match_response(http_res, "4XX", "*"):
402
+ http_res_text = await utils.stream_to_text_async(http_res)
403
+ raise models.APIError("API error occurred", http_res, http_res_text)
404
+ if utils.match_response(http_res, "5XX", "*"):
405
+ http_res_text = await utils.stream_to_text_async(http_res)
406
+ raise models.APIError("API error occurred", http_res, http_res_text)
407
+
408
+ raise models.APIError("Unexpected response received", http_res)
409
+
410
+ @deprecated(
411
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
412
+ )
413
+ def get_project_user_data(
414
+ self,
415
+ *,
416
+ project_id: str,
417
+ user_data_id: str,
418
+ extra_fields_user_data: Optional[str] = "decoded_content",
419
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
420
+ server_url: Optional[str] = None,
421
+ timeout_ms: Optional[int] = None,
422
+ http_headers: Optional[Mapping[str, str]] = None,
423
+ ) -> models.UserData:
424
+ r"""Retrieve a Project User Data
425
+
426
+ Get User Data in the project. These scripts can be used to configure servers with user data.
427
+
428
+
429
+ :param project_id: Project ID or Slug
430
+ :param user_data_id:
431
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
432
+ :param retries: Override the default retry configuration for this method
433
+ :param server_url: Override the default server URL for this method
434
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
435
+ :param http_headers: Additional headers to set or replace on requests.
436
+ """
437
+ base_url = None
438
+ url_variables = None
439
+ if timeout_ms is None:
440
+ timeout_ms = self.sdk_configuration.timeout_ms
441
+
442
+ if server_url is not None:
443
+ base_url = server_url
444
+ else:
445
+ base_url = self._get_url(base_url, url_variables)
446
+
447
+ request = models.GetProjectUserDataRequest(
448
+ project_id=project_id,
449
+ user_data_id=user_data_id,
450
+ extra_fields_user_data=extra_fields_user_data,
451
+ )
452
+
453
+ req = self._build_request(
454
+ method="GET",
455
+ path="/projects/{project_id}/user_data/{user_data_id}",
456
+ base_url=base_url,
457
+ url_variables=url_variables,
458
+ request=request,
459
+ request_body_required=False,
460
+ request_has_path_params=True,
461
+ request_has_query_params=True,
462
+ user_agent_header="user-agent",
463
+ accept_header_value="application/vnd.api+json",
464
+ http_headers=http_headers,
465
+ security=self.sdk_configuration.security,
466
+ allow_empty_value=None,
467
+ timeout_ms=timeout_ms,
468
+ )
469
+
470
+ if retries == UNSET:
471
+ if self.sdk_configuration.retry_config is not UNSET:
472
+ retries = self.sdk_configuration.retry_config
473
+
474
+ retry_config = None
475
+ if isinstance(retries, utils.RetryConfig):
476
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
477
+
478
+ http_res = self.do_request(
479
+ hook_ctx=HookContext(
480
+ config=self.sdk_configuration,
481
+ base_url=base_url or "",
482
+ operation_id="get-project-user-data",
483
+ oauth2_scopes=None,
484
+ security_source=get_security_from_env(
485
+ self.sdk_configuration.security, models.Security
486
+ ),
487
+ ),
488
+ request=req,
489
+ error_status_codes=["4XX", "5XX"],
490
+ retry_config=retry_config,
491
+ )
492
+
493
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
494
+ return unmarshal_json_response(models.UserData, http_res)
495
+ if utils.match_response(http_res, "4XX", "*"):
496
+ http_res_text = utils.stream_to_text(http_res)
497
+ raise models.APIError("API error occurred", http_res, http_res_text)
498
+ if utils.match_response(http_res, "5XX", "*"):
499
+ http_res_text = utils.stream_to_text(http_res)
500
+ raise models.APIError("API error occurred", http_res, http_res_text)
501
+
502
+ raise models.APIError("Unexpected response received", http_res)
503
+
504
+ @deprecated(
505
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
506
+ )
507
+ async def get_project_user_data_async(
508
+ self,
509
+ *,
510
+ project_id: str,
511
+ user_data_id: str,
512
+ extra_fields_user_data: Optional[str] = "decoded_content",
513
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
514
+ server_url: Optional[str] = None,
515
+ timeout_ms: Optional[int] = None,
516
+ http_headers: Optional[Mapping[str, str]] = None,
517
+ ) -> models.UserData:
518
+ r"""Retrieve a Project User Data
519
+
520
+ Get User Data in the project. These scripts can be used to configure servers with user data.
521
+
522
+
523
+ :param project_id: Project ID or Slug
524
+ :param user_data_id:
525
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
526
+ :param retries: Override the default retry configuration for this method
527
+ :param server_url: Override the default server URL for this method
528
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
529
+ :param http_headers: Additional headers to set or replace on requests.
530
+ """
531
+ base_url = None
532
+ url_variables = None
533
+ if timeout_ms is None:
534
+ timeout_ms = self.sdk_configuration.timeout_ms
535
+
536
+ if server_url is not None:
537
+ base_url = server_url
538
+ else:
539
+ base_url = self._get_url(base_url, url_variables)
540
+
541
+ request = models.GetProjectUserDataRequest(
542
+ project_id=project_id,
543
+ user_data_id=user_data_id,
544
+ extra_fields_user_data=extra_fields_user_data,
545
+ )
546
+
547
+ req = self._build_request_async(
548
+ method="GET",
549
+ path="/projects/{project_id}/user_data/{user_data_id}",
550
+ base_url=base_url,
551
+ url_variables=url_variables,
552
+ request=request,
553
+ request_body_required=False,
554
+ request_has_path_params=True,
555
+ request_has_query_params=True,
556
+ user_agent_header="user-agent",
557
+ accept_header_value="application/vnd.api+json",
558
+ http_headers=http_headers,
559
+ security=self.sdk_configuration.security,
560
+ allow_empty_value=None,
561
+ timeout_ms=timeout_ms,
562
+ )
563
+
564
+ if retries == UNSET:
565
+ if self.sdk_configuration.retry_config is not UNSET:
566
+ retries = self.sdk_configuration.retry_config
567
+
568
+ retry_config = None
569
+ if isinstance(retries, utils.RetryConfig):
570
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
571
+
572
+ http_res = await self.do_request_async(
573
+ hook_ctx=HookContext(
574
+ config=self.sdk_configuration,
575
+ base_url=base_url or "",
576
+ operation_id="get-project-user-data",
577
+ oauth2_scopes=None,
578
+ security_source=get_security_from_env(
579
+ self.sdk_configuration.security, models.Security
580
+ ),
581
+ ),
582
+ request=req,
583
+ error_status_codes=["4XX", "5XX"],
584
+ retry_config=retry_config,
585
+ )
586
+
587
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
588
+ return unmarshal_json_response(models.UserData, http_res)
589
+ if utils.match_response(http_res, "4XX", "*"):
590
+ http_res_text = await utils.stream_to_text_async(http_res)
591
+ raise models.APIError("API error occurred", http_res, http_res_text)
592
+ if utils.match_response(http_res, "5XX", "*"):
593
+ http_res_text = await utils.stream_to_text_async(http_res)
594
+ raise models.APIError("API error occurred", http_res, http_res_text)
595
+
596
+ raise models.APIError("Unexpected response received", http_res)
597
+
598
+ @deprecated(
599
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
600
+ )
601
+ def update(
602
+ self,
603
+ *,
604
+ project_id: str,
605
+ user_data_id: str,
606
+ data: Union[
607
+ models.PutProjectUserDataUserDataData,
608
+ models.PutProjectUserDataUserDataDataTypedDict,
609
+ ],
610
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
611
+ server_url: Optional[str] = None,
612
+ timeout_ms: Optional[int] = None,
613
+ http_headers: Optional[Mapping[str, str]] = None,
614
+ ) -> models.UserData:
615
+ r"""Update a Project User Data
616
+
617
+ Allow you update User Data in a project.
618
+
619
+
620
+ :param project_id: Project ID or Slug
621
+ :param user_data_id:
622
+ :param data:
623
+ :param retries: Override the default retry configuration for this method
624
+ :param server_url: Override the default server URL for this method
625
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
626
+ :param http_headers: Additional headers to set or replace on requests.
627
+ """
628
+ base_url = None
629
+ url_variables = None
630
+ if timeout_ms is None:
631
+ timeout_ms = self.sdk_configuration.timeout_ms
632
+
633
+ if server_url is not None:
634
+ base_url = server_url
635
+ else:
636
+ base_url = self._get_url(base_url, url_variables)
637
+
638
+ request = models.PutProjectUserDataRequest(
639
+ project_id=project_id,
640
+ user_data_id=user_data_id,
641
+ request_body=models.PutProjectUserDataUserDataRequestBody(
642
+ data=utils.get_pydantic_model(
643
+ data, models.PutProjectUserDataUserDataData
644
+ ),
645
+ ),
646
+ )
647
+
648
+ req = self._build_request(
649
+ method="PATCH",
650
+ path="/projects/{project_id}/user_data/{user_data_id}",
651
+ base_url=base_url,
652
+ url_variables=url_variables,
653
+ request=request,
654
+ request_body_required=False,
655
+ request_has_path_params=True,
656
+ request_has_query_params=True,
657
+ user_agent_header="user-agent",
658
+ accept_header_value="application/vnd.api+json",
659
+ http_headers=http_headers,
660
+ security=self.sdk_configuration.security,
661
+ get_serialized_body=lambda: utils.serialize_request_body(
662
+ request.request_body,
663
+ False,
664
+ True,
665
+ "json",
666
+ Optional[models.PutProjectUserDataUserDataRequestBody],
667
+ ),
668
+ allow_empty_value=None,
669
+ timeout_ms=timeout_ms,
670
+ )
671
+
672
+ if retries == UNSET:
673
+ if self.sdk_configuration.retry_config is not UNSET:
674
+ retries = self.sdk_configuration.retry_config
675
+
676
+ retry_config = None
677
+ if isinstance(retries, utils.RetryConfig):
678
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
679
+
680
+ http_res = self.do_request(
681
+ hook_ctx=HookContext(
682
+ config=self.sdk_configuration,
683
+ base_url=base_url or "",
684
+ operation_id="put-project-user-data",
685
+ oauth2_scopes=None,
686
+ security_source=get_security_from_env(
687
+ self.sdk_configuration.security, models.Security
688
+ ),
689
+ ),
690
+ request=req,
691
+ error_status_codes=["4XX", "5XX"],
692
+ retry_config=retry_config,
693
+ )
694
+
695
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
696
+ return unmarshal_json_response(models.UserData, http_res)
697
+ if utils.match_response(http_res, "4XX", "*"):
698
+ http_res_text = utils.stream_to_text(http_res)
699
+ raise models.APIError("API error occurred", http_res, http_res_text)
700
+ if utils.match_response(http_res, "5XX", "*"):
701
+ http_res_text = utils.stream_to_text(http_res)
702
+ raise models.APIError("API error occurred", http_res, http_res_text)
703
+
704
+ raise models.APIError("Unexpected response received", http_res)
705
+
706
+ @deprecated(
707
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
708
+ )
709
+ async def update_async(
710
+ self,
711
+ *,
712
+ project_id: str,
713
+ user_data_id: str,
714
+ data: Union[
715
+ models.PutProjectUserDataUserDataData,
716
+ models.PutProjectUserDataUserDataDataTypedDict,
717
+ ],
718
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
719
+ server_url: Optional[str] = None,
720
+ timeout_ms: Optional[int] = None,
721
+ http_headers: Optional[Mapping[str, str]] = None,
722
+ ) -> models.UserData:
723
+ r"""Update a Project User Data
724
+
725
+ Allow you update User Data in a project.
726
+
727
+
728
+ :param project_id: Project ID or Slug
729
+ :param user_data_id:
730
+ :param data:
731
+ :param retries: Override the default retry configuration for this method
732
+ :param server_url: Override the default server URL for this method
733
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
734
+ :param http_headers: Additional headers to set or replace on requests.
735
+ """
736
+ base_url = None
737
+ url_variables = None
738
+ if timeout_ms is None:
739
+ timeout_ms = self.sdk_configuration.timeout_ms
740
+
741
+ if server_url is not None:
742
+ base_url = server_url
743
+ else:
744
+ base_url = self._get_url(base_url, url_variables)
745
+
746
+ request = models.PutProjectUserDataRequest(
747
+ project_id=project_id,
748
+ user_data_id=user_data_id,
749
+ request_body=models.PutProjectUserDataUserDataRequestBody(
750
+ data=utils.get_pydantic_model(
751
+ data, models.PutProjectUserDataUserDataData
752
+ ),
753
+ ),
754
+ )
755
+
756
+ req = self._build_request_async(
757
+ method="PATCH",
758
+ path="/projects/{project_id}/user_data/{user_data_id}",
759
+ base_url=base_url,
760
+ url_variables=url_variables,
761
+ request=request,
762
+ request_body_required=False,
763
+ request_has_path_params=True,
764
+ request_has_query_params=True,
765
+ user_agent_header="user-agent",
766
+ accept_header_value="application/vnd.api+json",
767
+ http_headers=http_headers,
768
+ security=self.sdk_configuration.security,
769
+ get_serialized_body=lambda: utils.serialize_request_body(
770
+ request.request_body,
771
+ False,
772
+ True,
773
+ "json",
774
+ Optional[models.PutProjectUserDataUserDataRequestBody],
775
+ ),
776
+ allow_empty_value=None,
777
+ timeout_ms=timeout_ms,
778
+ )
779
+
780
+ if retries == UNSET:
781
+ if self.sdk_configuration.retry_config is not UNSET:
782
+ retries = self.sdk_configuration.retry_config
783
+
784
+ retry_config = None
785
+ if isinstance(retries, utils.RetryConfig):
786
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
787
+
788
+ http_res = await self.do_request_async(
789
+ hook_ctx=HookContext(
790
+ config=self.sdk_configuration,
791
+ base_url=base_url or "",
792
+ operation_id="put-project-user-data",
793
+ oauth2_scopes=None,
794
+ security_source=get_security_from_env(
795
+ self.sdk_configuration.security, models.Security
796
+ ),
797
+ ),
798
+ request=req,
799
+ error_status_codes=["4XX", "5XX"],
800
+ retry_config=retry_config,
801
+ )
802
+
803
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
804
+ return unmarshal_json_response(models.UserData, http_res)
805
+ if utils.match_response(http_res, "4XX", "*"):
806
+ http_res_text = await utils.stream_to_text_async(http_res)
807
+ raise models.APIError("API error occurred", http_res, http_res_text)
808
+ if utils.match_response(http_res, "5XX", "*"):
809
+ http_res_text = await utils.stream_to_text_async(http_res)
810
+ raise models.APIError("API error occurred", http_res, http_res_text)
811
+
812
+ raise models.APIError("Unexpected response received", http_res)
813
+
814
+ @deprecated(
815
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
816
+ )
817
+ def delete(
818
+ self,
819
+ *,
820
+ project_id: str,
821
+ user_data_id: str,
822
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
823
+ server_url: Optional[str] = None,
824
+ timeout_ms: Optional[int] = None,
825
+ http_headers: Optional[Mapping[str, str]] = None,
826
+ ):
827
+ r"""Delete a Project User Data
828
+
829
+ Allow you remove User Data in a project.
830
+
831
+
832
+ :param project_id: Project ID or Slug
833
+ :param user_data_id:
834
+ :param retries: Override the default retry configuration for this method
835
+ :param server_url: Override the default server URL for this method
836
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
837
+ :param http_headers: Additional headers to set or replace on requests.
838
+ """
839
+ base_url = None
840
+ url_variables = None
841
+ if timeout_ms is None:
842
+ timeout_ms = self.sdk_configuration.timeout_ms
843
+
844
+ if server_url is not None:
845
+ base_url = server_url
846
+ else:
847
+ base_url = self._get_url(base_url, url_variables)
848
+
849
+ request = models.DeleteProjectUserDataRequest(
850
+ project_id=project_id,
851
+ user_data_id=user_data_id,
852
+ )
853
+
854
+ req = self._build_request(
855
+ method="DELETE",
856
+ path="/projects/{project_id}/user_data/{user_data_id}",
857
+ base_url=base_url,
858
+ url_variables=url_variables,
859
+ request=request,
860
+ request_body_required=False,
861
+ request_has_path_params=True,
862
+ request_has_query_params=True,
863
+ user_agent_header="user-agent",
864
+ accept_header_value="*/*",
865
+ http_headers=http_headers,
866
+ security=self.sdk_configuration.security,
867
+ allow_empty_value=None,
868
+ timeout_ms=timeout_ms,
869
+ )
870
+
871
+ if retries == UNSET:
872
+ if self.sdk_configuration.retry_config is not UNSET:
873
+ retries = self.sdk_configuration.retry_config
874
+
875
+ retry_config = None
876
+ if isinstance(retries, utils.RetryConfig):
877
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
878
+
879
+ http_res = self.do_request(
880
+ hook_ctx=HookContext(
881
+ config=self.sdk_configuration,
882
+ base_url=base_url or "",
883
+ operation_id="delete-project-user-data",
884
+ oauth2_scopes=None,
885
+ security_source=get_security_from_env(
886
+ self.sdk_configuration.security, models.Security
887
+ ),
888
+ ),
889
+ request=req,
890
+ error_status_codes=["4XX", "5XX"],
891
+ retry_config=retry_config,
892
+ )
893
+
894
+ if utils.match_response(http_res, "204", "*"):
895
+ return
896
+ if utils.match_response(http_res, "4XX", "*"):
897
+ http_res_text = utils.stream_to_text(http_res)
898
+ raise models.APIError("API error occurred", http_res, http_res_text)
899
+ if utils.match_response(http_res, "5XX", "*"):
900
+ http_res_text = utils.stream_to_text(http_res)
901
+ raise models.APIError("API error occurred", http_res, http_res_text)
902
+
903
+ raise models.APIError("Unexpected response received", http_res)
904
+
905
+ @deprecated(
906
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
907
+ )
908
+ async def delete_async(
909
+ self,
910
+ *,
911
+ project_id: str,
912
+ user_data_id: str,
913
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
914
+ server_url: Optional[str] = None,
915
+ timeout_ms: Optional[int] = None,
916
+ http_headers: Optional[Mapping[str, str]] = None,
917
+ ):
918
+ r"""Delete a Project User Data
919
+
920
+ Allow you remove User Data in a project.
921
+
922
+
923
+ :param project_id: Project ID or Slug
924
+ :param user_data_id:
925
+ :param retries: Override the default retry configuration for this method
926
+ :param server_url: Override the default server URL for this method
927
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
928
+ :param http_headers: Additional headers to set or replace on requests.
929
+ """
930
+ base_url = None
931
+ url_variables = None
932
+ if timeout_ms is None:
933
+ timeout_ms = self.sdk_configuration.timeout_ms
934
+
935
+ if server_url is not None:
936
+ base_url = server_url
937
+ else:
938
+ base_url = self._get_url(base_url, url_variables)
939
+
940
+ request = models.DeleteProjectUserDataRequest(
941
+ project_id=project_id,
942
+ user_data_id=user_data_id,
943
+ )
944
+
945
+ req = self._build_request_async(
946
+ method="DELETE",
947
+ path="/projects/{project_id}/user_data/{user_data_id}",
948
+ base_url=base_url,
949
+ url_variables=url_variables,
950
+ request=request,
951
+ request_body_required=False,
952
+ request_has_path_params=True,
953
+ request_has_query_params=True,
954
+ user_agent_header="user-agent",
955
+ accept_header_value="*/*",
956
+ http_headers=http_headers,
957
+ security=self.sdk_configuration.security,
958
+ allow_empty_value=None,
959
+ timeout_ms=timeout_ms,
960
+ )
961
+
962
+ if retries == UNSET:
963
+ if self.sdk_configuration.retry_config is not UNSET:
964
+ retries = self.sdk_configuration.retry_config
965
+
966
+ retry_config = None
967
+ if isinstance(retries, utils.RetryConfig):
968
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
969
+
970
+ http_res = await self.do_request_async(
971
+ hook_ctx=HookContext(
972
+ config=self.sdk_configuration,
973
+ base_url=base_url or "",
974
+ operation_id="delete-project-user-data",
975
+ oauth2_scopes=None,
976
+ security_source=get_security_from_env(
977
+ self.sdk_configuration.security, models.Security
978
+ ),
979
+ ),
980
+ request=req,
981
+ error_status_codes=["4XX", "5XX"],
982
+ retry_config=retry_config,
983
+ )
984
+
985
+ if utils.match_response(http_res, "204", "*"):
986
+ return
987
+ if utils.match_response(http_res, "4XX", "*"):
988
+ http_res_text = await utils.stream_to_text_async(http_res)
989
+ raise models.APIError("API error occurred", http_res, http_res_text)
990
+ if utils.match_response(http_res, "5XX", "*"):
991
+ http_res_text = await utils.stream_to_text_async(http_res)
992
+ raise models.APIError("API error occurred", http_res, http_res_text)
993
+
994
+ raise models.APIError("Unexpected response received", http_res)
995
+
996
+ def get_users_data(
997
+ self,
998
+ *,
999
+ filter_project: Optional[str] = None,
1000
+ extra_fields_user_data: Optional[str] = "decoded_content",
1001
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1002
+ server_url: Optional[str] = None,
1003
+ timeout_ms: Optional[int] = None,
1004
+ http_headers: Optional[Mapping[str, str]] = None,
1005
+ ) -> models.GetUsersDataResponseBody:
1006
+ r"""List all User Data
1007
+
1008
+ List all Users Data in the project. These scripts can be used to configure servers with user data.
1009
+
1010
+
1011
+ :param filter_project: Project ID or slug
1012
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
1013
+ :param retries: Override the default retry configuration for this method
1014
+ :param server_url: Override the default server URL for this method
1015
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1016
+ :param http_headers: Additional headers to set or replace on requests.
1017
+ """
1018
+ base_url = None
1019
+ url_variables = None
1020
+ if timeout_ms is None:
1021
+ timeout_ms = self.sdk_configuration.timeout_ms
1022
+
1023
+ if server_url is not None:
1024
+ base_url = server_url
1025
+ else:
1026
+ base_url = self._get_url(base_url, url_variables)
1027
+
1028
+ request = models.GetUsersDataRequest(
1029
+ filter_project=filter_project,
1030
+ extra_fields_user_data=extra_fields_user_data,
1031
+ )
1032
+
1033
+ req = self._build_request(
1034
+ method="GET",
1035
+ path="/user_data",
1036
+ base_url=base_url,
1037
+ url_variables=url_variables,
1038
+ request=request,
1039
+ request_body_required=False,
1040
+ request_has_path_params=False,
1041
+ request_has_query_params=True,
1042
+ user_agent_header="user-agent",
1043
+ accept_header_value="application/vnd.api+json",
1044
+ http_headers=http_headers,
1045
+ security=self.sdk_configuration.security,
1046
+ allow_empty_value=None,
1047
+ timeout_ms=timeout_ms,
1048
+ )
1049
+
1050
+ if retries == UNSET:
1051
+ if self.sdk_configuration.retry_config is not UNSET:
1052
+ retries = self.sdk_configuration.retry_config
1053
+
1054
+ retry_config = None
1055
+ if isinstance(retries, utils.RetryConfig):
1056
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1057
+
1058
+ http_res = self.do_request(
1059
+ hook_ctx=HookContext(
1060
+ config=self.sdk_configuration,
1061
+ base_url=base_url or "",
1062
+ operation_id="get-users-data",
1063
+ oauth2_scopes=None,
1064
+ security_source=get_security_from_env(
1065
+ self.sdk_configuration.security, models.Security
1066
+ ),
1067
+ ),
1068
+ request=req,
1069
+ error_status_codes=["4XX", "5XX"],
1070
+ retry_config=retry_config,
1071
+ )
1072
+
1073
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1074
+ return unmarshal_json_response(models.GetUsersDataResponseBody, http_res)
1075
+ if utils.match_response(http_res, "4XX", "*"):
1076
+ http_res_text = utils.stream_to_text(http_res)
1077
+ raise models.APIError("API error occurred", http_res, http_res_text)
1078
+ if utils.match_response(http_res, "5XX", "*"):
1079
+ http_res_text = utils.stream_to_text(http_res)
1080
+ raise models.APIError("API error occurred", http_res, http_res_text)
1081
+
1082
+ raise models.APIError("Unexpected response received", http_res)
1083
+
1084
+ async def get_users_data_async(
1085
+ self,
1086
+ *,
1087
+ filter_project: Optional[str] = None,
1088
+ extra_fields_user_data: Optional[str] = "decoded_content",
1089
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1090
+ server_url: Optional[str] = None,
1091
+ timeout_ms: Optional[int] = None,
1092
+ http_headers: Optional[Mapping[str, str]] = None,
1093
+ ) -> models.GetUsersDataResponseBody:
1094
+ r"""List all User Data
1095
+
1096
+ List all Users Data in the project. These scripts can be used to configure servers with user data.
1097
+
1098
+
1099
+ :param filter_project: Project ID or slug
1100
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
1101
+ :param retries: Override the default retry configuration for this method
1102
+ :param server_url: Override the default server URL for this method
1103
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1104
+ :param http_headers: Additional headers to set or replace on requests.
1105
+ """
1106
+ base_url = None
1107
+ url_variables = None
1108
+ if timeout_ms is None:
1109
+ timeout_ms = self.sdk_configuration.timeout_ms
1110
+
1111
+ if server_url is not None:
1112
+ base_url = server_url
1113
+ else:
1114
+ base_url = self._get_url(base_url, url_variables)
1115
+
1116
+ request = models.GetUsersDataRequest(
1117
+ filter_project=filter_project,
1118
+ extra_fields_user_data=extra_fields_user_data,
1119
+ )
1120
+
1121
+ req = self._build_request_async(
1122
+ method="GET",
1123
+ path="/user_data",
1124
+ base_url=base_url,
1125
+ url_variables=url_variables,
1126
+ request=request,
1127
+ request_body_required=False,
1128
+ request_has_path_params=False,
1129
+ request_has_query_params=True,
1130
+ user_agent_header="user-agent",
1131
+ accept_header_value="application/vnd.api+json",
1132
+ http_headers=http_headers,
1133
+ security=self.sdk_configuration.security,
1134
+ allow_empty_value=None,
1135
+ timeout_ms=timeout_ms,
1136
+ )
1137
+
1138
+ if retries == UNSET:
1139
+ if self.sdk_configuration.retry_config is not UNSET:
1140
+ retries = self.sdk_configuration.retry_config
1141
+
1142
+ retry_config = None
1143
+ if isinstance(retries, utils.RetryConfig):
1144
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1145
+
1146
+ http_res = await self.do_request_async(
1147
+ hook_ctx=HookContext(
1148
+ config=self.sdk_configuration,
1149
+ base_url=base_url or "",
1150
+ operation_id="get-users-data",
1151
+ oauth2_scopes=None,
1152
+ security_source=get_security_from_env(
1153
+ self.sdk_configuration.security, models.Security
1154
+ ),
1155
+ ),
1156
+ request=req,
1157
+ error_status_codes=["4XX", "5XX"],
1158
+ retry_config=retry_config,
1159
+ )
1160
+
1161
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1162
+ return unmarshal_json_response(models.GetUsersDataResponseBody, http_res)
1163
+ if utils.match_response(http_res, "4XX", "*"):
1164
+ http_res_text = await utils.stream_to_text_async(http_res)
1165
+ raise models.APIError("API error occurred", http_res, http_res_text)
1166
+ if utils.match_response(http_res, "5XX", "*"):
1167
+ http_res_text = await utils.stream_to_text_async(http_res)
1168
+ raise models.APIError("API error occurred", http_res, http_res_text)
1169
+
1170
+ raise models.APIError("Unexpected response received", http_res)
1171
+
1172
+ def post_user_data(
1173
+ self,
1174
+ *,
1175
+ data: Union[
1176
+ models.PostUserDataUserDataData, models.PostUserDataUserDataDataTypedDict
1177
+ ],
1178
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1179
+ server_url: Optional[str] = None,
1180
+ timeout_ms: Optional[int] = None,
1181
+ http_headers: Optional[Mapping[str, str]] = None,
1182
+ ) -> models.UserData:
1183
+ r"""Create an User Data
1184
+
1185
+ Allows you to create User Data in a team, which can be used to perform custom setup on your servers after deploy and reinstall.
1186
+
1187
+
1188
+ :param data:
1189
+ :param retries: Override the default retry configuration for this method
1190
+ :param server_url: Override the default server URL for this method
1191
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1192
+ :param http_headers: Additional headers to set or replace on requests.
1193
+ """
1194
+ base_url = None
1195
+ url_variables = None
1196
+ if timeout_ms is None:
1197
+ timeout_ms = self.sdk_configuration.timeout_ms
1198
+
1199
+ if server_url is not None:
1200
+ base_url = server_url
1201
+ else:
1202
+ base_url = self._get_url(base_url, url_variables)
1203
+
1204
+ request = models.PostUserDataUserDataRequestBody(
1205
+ data=utils.get_pydantic_model(data, models.PostUserDataUserDataData),
1206
+ )
1207
+
1208
+ req = self._build_request(
1209
+ method="POST",
1210
+ path="/user_data",
1211
+ base_url=base_url,
1212
+ url_variables=url_variables,
1213
+ request=request,
1214
+ request_body_required=True,
1215
+ request_has_path_params=False,
1216
+ request_has_query_params=True,
1217
+ user_agent_header="user-agent",
1218
+ accept_header_value="application/vnd.api+json",
1219
+ http_headers=http_headers,
1220
+ security=self.sdk_configuration.security,
1221
+ get_serialized_body=lambda: utils.serialize_request_body(
1222
+ request, False, False, "json", models.PostUserDataUserDataRequestBody
1223
+ ),
1224
+ allow_empty_value=None,
1225
+ timeout_ms=timeout_ms,
1226
+ )
1227
+
1228
+ if retries == UNSET:
1229
+ if self.sdk_configuration.retry_config is not UNSET:
1230
+ retries = self.sdk_configuration.retry_config
1231
+
1232
+ retry_config = None
1233
+ if isinstance(retries, utils.RetryConfig):
1234
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1235
+
1236
+ http_res = self.do_request(
1237
+ hook_ctx=HookContext(
1238
+ config=self.sdk_configuration,
1239
+ base_url=base_url or "",
1240
+ operation_id="post-user-data",
1241
+ oauth2_scopes=None,
1242
+ security_source=get_security_from_env(
1243
+ self.sdk_configuration.security, models.Security
1244
+ ),
1245
+ ),
1246
+ request=req,
1247
+ error_status_codes=["4XX", "5XX"],
1248
+ retry_config=retry_config,
1249
+ )
1250
+
1251
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
1252
+ return unmarshal_json_response(models.UserData, http_res)
1253
+ if utils.match_response(http_res, "4XX", "*"):
1254
+ http_res_text = utils.stream_to_text(http_res)
1255
+ raise models.APIError("API error occurred", http_res, http_res_text)
1256
+ if utils.match_response(http_res, "5XX", "*"):
1257
+ http_res_text = utils.stream_to_text(http_res)
1258
+ raise models.APIError("API error occurred", http_res, http_res_text)
1259
+
1260
+ raise models.APIError("Unexpected response received", http_res)
1261
+
1262
+ async def post_user_data_async(
1263
+ self,
1264
+ *,
1265
+ data: Union[
1266
+ models.PostUserDataUserDataData, models.PostUserDataUserDataDataTypedDict
1267
+ ],
1268
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1269
+ server_url: Optional[str] = None,
1270
+ timeout_ms: Optional[int] = None,
1271
+ http_headers: Optional[Mapping[str, str]] = None,
1272
+ ) -> models.UserData:
1273
+ r"""Create an User Data
1274
+
1275
+ Allows you to create User Data in a team, which can be used to perform custom setup on your servers after deploy and reinstall.
1276
+
1277
+
1278
+ :param data:
1279
+ :param retries: Override the default retry configuration for this method
1280
+ :param server_url: Override the default server URL for this method
1281
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1282
+ :param http_headers: Additional headers to set or replace on requests.
1283
+ """
1284
+ base_url = None
1285
+ url_variables = None
1286
+ if timeout_ms is None:
1287
+ timeout_ms = self.sdk_configuration.timeout_ms
1288
+
1289
+ if server_url is not None:
1290
+ base_url = server_url
1291
+ else:
1292
+ base_url = self._get_url(base_url, url_variables)
1293
+
1294
+ request = models.PostUserDataUserDataRequestBody(
1295
+ data=utils.get_pydantic_model(data, models.PostUserDataUserDataData),
1296
+ )
1297
+
1298
+ req = self._build_request_async(
1299
+ method="POST",
1300
+ path="/user_data",
1301
+ base_url=base_url,
1302
+ url_variables=url_variables,
1303
+ request=request,
1304
+ request_body_required=True,
1305
+ request_has_path_params=False,
1306
+ request_has_query_params=True,
1307
+ user_agent_header="user-agent",
1308
+ accept_header_value="application/vnd.api+json",
1309
+ http_headers=http_headers,
1310
+ security=self.sdk_configuration.security,
1311
+ get_serialized_body=lambda: utils.serialize_request_body(
1312
+ request, False, False, "json", models.PostUserDataUserDataRequestBody
1313
+ ),
1314
+ allow_empty_value=None,
1315
+ timeout_ms=timeout_ms,
1316
+ )
1317
+
1318
+ if retries == UNSET:
1319
+ if self.sdk_configuration.retry_config is not UNSET:
1320
+ retries = self.sdk_configuration.retry_config
1321
+
1322
+ retry_config = None
1323
+ if isinstance(retries, utils.RetryConfig):
1324
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1325
+
1326
+ http_res = await self.do_request_async(
1327
+ hook_ctx=HookContext(
1328
+ config=self.sdk_configuration,
1329
+ base_url=base_url or "",
1330
+ operation_id="post-user-data",
1331
+ oauth2_scopes=None,
1332
+ security_source=get_security_from_env(
1333
+ self.sdk_configuration.security, models.Security
1334
+ ),
1335
+ ),
1336
+ request=req,
1337
+ error_status_codes=["4XX", "5XX"],
1338
+ retry_config=retry_config,
1339
+ )
1340
+
1341
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
1342
+ return unmarshal_json_response(models.UserData, http_res)
1343
+ if utils.match_response(http_res, "4XX", "*"):
1344
+ http_res_text = await utils.stream_to_text_async(http_res)
1345
+ raise models.APIError("API error occurred", http_res, http_res_text)
1346
+ if utils.match_response(http_res, "5XX", "*"):
1347
+ http_res_text = await utils.stream_to_text_async(http_res)
1348
+ raise models.APIError("API error occurred", http_res, http_res_text)
1349
+
1350
+ raise models.APIError("Unexpected response received", http_res)
1351
+
1352
+ def get_user_data(
1353
+ self,
1354
+ *,
1355
+ user_data_id: str,
1356
+ extra_fields_user_data: Optional[str] = "decoded_content",
1357
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1358
+ server_url: Optional[str] = None,
1359
+ timeout_ms: Optional[int] = None,
1360
+ http_headers: Optional[Mapping[str, str]] = None,
1361
+ ) -> models.UserData:
1362
+ r"""Retrieve an User Data
1363
+
1364
+ Get User Data in the project. These scripts can be used to configure servers with user data.
1365
+
1366
+
1367
+ :param user_data_id:
1368
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
1369
+ :param retries: Override the default retry configuration for this method
1370
+ :param server_url: Override the default server URL for this method
1371
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1372
+ :param http_headers: Additional headers to set or replace on requests.
1373
+ """
1374
+ base_url = None
1375
+ url_variables = None
1376
+ if timeout_ms is None:
1377
+ timeout_ms = self.sdk_configuration.timeout_ms
1378
+
1379
+ if server_url is not None:
1380
+ base_url = server_url
1381
+ else:
1382
+ base_url = self._get_url(base_url, url_variables)
1383
+
1384
+ request = models.GetUserDataRequest(
1385
+ user_data_id=user_data_id,
1386
+ extra_fields_user_data=extra_fields_user_data,
1387
+ )
1388
+
1389
+ req = self._build_request(
1390
+ method="GET",
1391
+ path="/user_data/{user_data_id}",
1392
+ base_url=base_url,
1393
+ url_variables=url_variables,
1394
+ request=request,
1395
+ request_body_required=False,
1396
+ request_has_path_params=True,
1397
+ request_has_query_params=True,
1398
+ user_agent_header="user-agent",
1399
+ accept_header_value="application/vnd.api+json",
1400
+ http_headers=http_headers,
1401
+ security=self.sdk_configuration.security,
1402
+ allow_empty_value=None,
1403
+ timeout_ms=timeout_ms,
1404
+ )
1405
+
1406
+ if retries == UNSET:
1407
+ if self.sdk_configuration.retry_config is not UNSET:
1408
+ retries = self.sdk_configuration.retry_config
1409
+
1410
+ retry_config = None
1411
+ if isinstance(retries, utils.RetryConfig):
1412
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1413
+
1414
+ http_res = self.do_request(
1415
+ hook_ctx=HookContext(
1416
+ config=self.sdk_configuration,
1417
+ base_url=base_url or "",
1418
+ operation_id="get-user-data",
1419
+ oauth2_scopes=None,
1420
+ security_source=get_security_from_env(
1421
+ self.sdk_configuration.security, models.Security
1422
+ ),
1423
+ ),
1424
+ request=req,
1425
+ error_status_codes=["4XX", "5XX"],
1426
+ retry_config=retry_config,
1427
+ )
1428
+
1429
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1430
+ return unmarshal_json_response(models.UserData, http_res)
1431
+ if utils.match_response(http_res, "4XX", "*"):
1432
+ http_res_text = utils.stream_to_text(http_res)
1433
+ raise models.APIError("API error occurred", http_res, http_res_text)
1434
+ if utils.match_response(http_res, "5XX", "*"):
1435
+ http_res_text = utils.stream_to_text(http_res)
1436
+ raise models.APIError("API error occurred", http_res, http_res_text)
1437
+
1438
+ raise models.APIError("Unexpected response received", http_res)
1439
+
1440
+ async def get_user_data_async(
1441
+ self,
1442
+ *,
1443
+ user_data_id: str,
1444
+ extra_fields_user_data: Optional[str] = "decoded_content",
1445
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1446
+ server_url: Optional[str] = None,
1447
+ timeout_ms: Optional[int] = None,
1448
+ http_headers: Optional[Mapping[str, str]] = None,
1449
+ ) -> models.UserData:
1450
+ r"""Retrieve an User Data
1451
+
1452
+ Get User Data in the project. These scripts can be used to configure servers with user data.
1453
+
1454
+
1455
+ :param user_data_id:
1456
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
1457
+ :param retries: Override the default retry configuration for this method
1458
+ :param server_url: Override the default server URL for this method
1459
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1460
+ :param http_headers: Additional headers to set or replace on requests.
1461
+ """
1462
+ base_url = None
1463
+ url_variables = None
1464
+ if timeout_ms is None:
1465
+ timeout_ms = self.sdk_configuration.timeout_ms
1466
+
1467
+ if server_url is not None:
1468
+ base_url = server_url
1469
+ else:
1470
+ base_url = self._get_url(base_url, url_variables)
1471
+
1472
+ request = models.GetUserDataRequest(
1473
+ user_data_id=user_data_id,
1474
+ extra_fields_user_data=extra_fields_user_data,
1475
+ )
1476
+
1477
+ req = self._build_request_async(
1478
+ method="GET",
1479
+ path="/user_data/{user_data_id}",
1480
+ base_url=base_url,
1481
+ url_variables=url_variables,
1482
+ request=request,
1483
+ request_body_required=False,
1484
+ request_has_path_params=True,
1485
+ request_has_query_params=True,
1486
+ user_agent_header="user-agent",
1487
+ accept_header_value="application/vnd.api+json",
1488
+ http_headers=http_headers,
1489
+ security=self.sdk_configuration.security,
1490
+ allow_empty_value=None,
1491
+ timeout_ms=timeout_ms,
1492
+ )
1493
+
1494
+ if retries == UNSET:
1495
+ if self.sdk_configuration.retry_config is not UNSET:
1496
+ retries = self.sdk_configuration.retry_config
1497
+
1498
+ retry_config = None
1499
+ if isinstance(retries, utils.RetryConfig):
1500
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1501
+
1502
+ http_res = await self.do_request_async(
1503
+ hook_ctx=HookContext(
1504
+ config=self.sdk_configuration,
1505
+ base_url=base_url or "",
1506
+ operation_id="get-user-data",
1507
+ oauth2_scopes=None,
1508
+ security_source=get_security_from_env(
1509
+ self.sdk_configuration.security, models.Security
1510
+ ),
1511
+ ),
1512
+ request=req,
1513
+ error_status_codes=["4XX", "5XX"],
1514
+ retry_config=retry_config,
1515
+ )
1516
+
1517
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1518
+ return unmarshal_json_response(models.UserData, http_res)
1519
+ if utils.match_response(http_res, "4XX", "*"):
1520
+ http_res_text = await utils.stream_to_text_async(http_res)
1521
+ raise models.APIError("API error occurred", http_res, http_res_text)
1522
+ if utils.match_response(http_res, "5XX", "*"):
1523
+ http_res_text = await utils.stream_to_text_async(http_res)
1524
+ raise models.APIError("API error occurred", http_res, http_res_text)
1525
+
1526
+ raise models.APIError("Unexpected response received", http_res)
1527
+
1528
+ def patch_user_data(
1529
+ self,
1530
+ *,
1531
+ user_data_id: str,
1532
+ data: Union[
1533
+ models.PatchUserDataUserDataData, models.PatchUserDataUserDataDataTypedDict
1534
+ ],
1535
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1536
+ server_url: Optional[str] = None,
1537
+ timeout_ms: Optional[int] = None,
1538
+ http_headers: Optional[Mapping[str, str]] = None,
1539
+ ) -> models.UserData:
1540
+ r"""Update an User Data
1541
+
1542
+ Allow you update User Data in a team.
1543
+
1544
+
1545
+ :param user_data_id:
1546
+ :param data:
1547
+ :param retries: Override the default retry configuration for this method
1548
+ :param server_url: Override the default server URL for this method
1549
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1550
+ :param http_headers: Additional headers to set or replace on requests.
1551
+ """
1552
+ base_url = None
1553
+ url_variables = None
1554
+ if timeout_ms is None:
1555
+ timeout_ms = self.sdk_configuration.timeout_ms
1556
+
1557
+ if server_url is not None:
1558
+ base_url = server_url
1559
+ else:
1560
+ base_url = self._get_url(base_url, url_variables)
1561
+
1562
+ request = models.PatchUserDataRequest(
1563
+ user_data_id=user_data_id,
1564
+ request_body=models.PatchUserDataUserDataRequestBody(
1565
+ data=utils.get_pydantic_model(data, models.PatchUserDataUserDataData),
1566
+ ),
1567
+ )
1568
+
1569
+ req = self._build_request(
1570
+ method="PATCH",
1571
+ path="/user_data/{user_data_id}",
1572
+ base_url=base_url,
1573
+ url_variables=url_variables,
1574
+ request=request,
1575
+ request_body_required=False,
1576
+ request_has_path_params=True,
1577
+ request_has_query_params=True,
1578
+ user_agent_header="user-agent",
1579
+ accept_header_value="application/vnd.api+json",
1580
+ http_headers=http_headers,
1581
+ security=self.sdk_configuration.security,
1582
+ get_serialized_body=lambda: utils.serialize_request_body(
1583
+ request.request_body,
1584
+ False,
1585
+ True,
1586
+ "json",
1587
+ Optional[models.PatchUserDataUserDataRequestBody],
1588
+ ),
1589
+ allow_empty_value=None,
1590
+ timeout_ms=timeout_ms,
1591
+ )
1592
+
1593
+ if retries == UNSET:
1594
+ if self.sdk_configuration.retry_config is not UNSET:
1595
+ retries = self.sdk_configuration.retry_config
1596
+
1597
+ retry_config = None
1598
+ if isinstance(retries, utils.RetryConfig):
1599
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1600
+
1601
+ http_res = self.do_request(
1602
+ hook_ctx=HookContext(
1603
+ config=self.sdk_configuration,
1604
+ base_url=base_url or "",
1605
+ operation_id="patch-user-data",
1606
+ oauth2_scopes=None,
1607
+ security_source=get_security_from_env(
1608
+ self.sdk_configuration.security, models.Security
1609
+ ),
1610
+ ),
1611
+ request=req,
1612
+ error_status_codes=["4XX", "5XX"],
1613
+ retry_config=retry_config,
1614
+ )
1615
+
1616
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1617
+ return unmarshal_json_response(models.UserData, http_res)
1618
+ if utils.match_response(http_res, "4XX", "*"):
1619
+ http_res_text = utils.stream_to_text(http_res)
1620
+ raise models.APIError("API error occurred", http_res, http_res_text)
1621
+ if utils.match_response(http_res, "5XX", "*"):
1622
+ http_res_text = utils.stream_to_text(http_res)
1623
+ raise models.APIError("API error occurred", http_res, http_res_text)
1624
+
1625
+ raise models.APIError("Unexpected response received", http_res)
1626
+
1627
+ async def patch_user_data_async(
1628
+ self,
1629
+ *,
1630
+ user_data_id: str,
1631
+ data: Union[
1632
+ models.PatchUserDataUserDataData, models.PatchUserDataUserDataDataTypedDict
1633
+ ],
1634
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1635
+ server_url: Optional[str] = None,
1636
+ timeout_ms: Optional[int] = None,
1637
+ http_headers: Optional[Mapping[str, str]] = None,
1638
+ ) -> models.UserData:
1639
+ r"""Update an User Data
1640
+
1641
+ Allow you update User Data in a team.
1642
+
1643
+
1644
+ :param user_data_id:
1645
+ :param data:
1646
+ :param retries: Override the default retry configuration for this method
1647
+ :param server_url: Override the default server URL for this method
1648
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1649
+ :param http_headers: Additional headers to set or replace on requests.
1650
+ """
1651
+ base_url = None
1652
+ url_variables = None
1653
+ if timeout_ms is None:
1654
+ timeout_ms = self.sdk_configuration.timeout_ms
1655
+
1656
+ if server_url is not None:
1657
+ base_url = server_url
1658
+ else:
1659
+ base_url = self._get_url(base_url, url_variables)
1660
+
1661
+ request = models.PatchUserDataRequest(
1662
+ user_data_id=user_data_id,
1663
+ request_body=models.PatchUserDataUserDataRequestBody(
1664
+ data=utils.get_pydantic_model(data, models.PatchUserDataUserDataData),
1665
+ ),
1666
+ )
1667
+
1668
+ req = self._build_request_async(
1669
+ method="PATCH",
1670
+ path="/user_data/{user_data_id}",
1671
+ base_url=base_url,
1672
+ url_variables=url_variables,
1673
+ request=request,
1674
+ request_body_required=False,
1675
+ request_has_path_params=True,
1676
+ request_has_query_params=True,
1677
+ user_agent_header="user-agent",
1678
+ accept_header_value="application/vnd.api+json",
1679
+ http_headers=http_headers,
1680
+ security=self.sdk_configuration.security,
1681
+ get_serialized_body=lambda: utils.serialize_request_body(
1682
+ request.request_body,
1683
+ False,
1684
+ True,
1685
+ "json",
1686
+ Optional[models.PatchUserDataUserDataRequestBody],
1687
+ ),
1688
+ allow_empty_value=None,
1689
+ timeout_ms=timeout_ms,
1690
+ )
1691
+
1692
+ if retries == UNSET:
1693
+ if self.sdk_configuration.retry_config is not UNSET:
1694
+ retries = self.sdk_configuration.retry_config
1695
+
1696
+ retry_config = None
1697
+ if isinstance(retries, utils.RetryConfig):
1698
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1699
+
1700
+ http_res = await self.do_request_async(
1701
+ hook_ctx=HookContext(
1702
+ config=self.sdk_configuration,
1703
+ base_url=base_url or "",
1704
+ operation_id="patch-user-data",
1705
+ oauth2_scopes=None,
1706
+ security_source=get_security_from_env(
1707
+ self.sdk_configuration.security, models.Security
1708
+ ),
1709
+ ),
1710
+ request=req,
1711
+ error_status_codes=["4XX", "5XX"],
1712
+ retry_config=retry_config,
1713
+ )
1714
+
1715
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1716
+ return unmarshal_json_response(models.UserData, http_res)
1717
+ if utils.match_response(http_res, "4XX", "*"):
1718
+ http_res_text = await utils.stream_to_text_async(http_res)
1719
+ raise models.APIError("API error occurred", http_res, http_res_text)
1720
+ if utils.match_response(http_res, "5XX", "*"):
1721
+ http_res_text = await utils.stream_to_text_async(http_res)
1722
+ raise models.APIError("API error occurred", http_res, http_res_text)
1723
+
1724
+ raise models.APIError("Unexpected response received", http_res)
1725
+
1726
+ def delete_user_data(
1727
+ self,
1728
+ *,
1729
+ user_data_id: str,
1730
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1731
+ server_url: Optional[str] = None,
1732
+ timeout_ms: Optional[int] = None,
1733
+ http_headers: Optional[Mapping[str, str]] = None,
1734
+ ):
1735
+ r"""Delete an User Data
1736
+
1737
+ :param user_data_id:
1738
+ :param retries: Override the default retry configuration for this method
1739
+ :param server_url: Override the default server URL for this method
1740
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1741
+ :param http_headers: Additional headers to set or replace on requests.
1742
+ """
1743
+ base_url = None
1744
+ url_variables = None
1745
+ if timeout_ms is None:
1746
+ timeout_ms = self.sdk_configuration.timeout_ms
1747
+
1748
+ if server_url is not None:
1749
+ base_url = server_url
1750
+ else:
1751
+ base_url = self._get_url(base_url, url_variables)
1752
+
1753
+ request = models.DeleteUserDataRequest(
1754
+ user_data_id=user_data_id,
1755
+ )
1756
+
1757
+ req = self._build_request(
1758
+ method="DELETE",
1759
+ path="/user_data/{user_data_id}",
1760
+ base_url=base_url,
1761
+ url_variables=url_variables,
1762
+ request=request,
1763
+ request_body_required=False,
1764
+ request_has_path_params=True,
1765
+ request_has_query_params=True,
1766
+ user_agent_header="user-agent",
1767
+ accept_header_value="*/*",
1768
+ http_headers=http_headers,
1769
+ security=self.sdk_configuration.security,
1770
+ allow_empty_value=None,
1771
+ timeout_ms=timeout_ms,
1772
+ )
1773
+
1774
+ if retries == UNSET:
1775
+ if self.sdk_configuration.retry_config is not UNSET:
1776
+ retries = self.sdk_configuration.retry_config
1777
+
1778
+ retry_config = None
1779
+ if isinstance(retries, utils.RetryConfig):
1780
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1781
+
1782
+ http_res = self.do_request(
1783
+ hook_ctx=HookContext(
1784
+ config=self.sdk_configuration,
1785
+ base_url=base_url or "",
1786
+ operation_id="delete-user-data",
1787
+ oauth2_scopes=None,
1788
+ security_source=get_security_from_env(
1789
+ self.sdk_configuration.security, models.Security
1790
+ ),
1791
+ ),
1792
+ request=req,
1793
+ error_status_codes=["4XX", "5XX"],
1794
+ retry_config=retry_config,
1795
+ )
1796
+
1797
+ if utils.match_response(http_res, "204", "*"):
1798
+ return
1799
+ if utils.match_response(http_res, "4XX", "*"):
1800
+ http_res_text = utils.stream_to_text(http_res)
1801
+ raise models.APIError("API error occurred", http_res, http_res_text)
1802
+ if utils.match_response(http_res, "5XX", "*"):
1803
+ http_res_text = utils.stream_to_text(http_res)
1804
+ raise models.APIError("API error occurred", http_res, http_res_text)
1805
+
1806
+ raise models.APIError("Unexpected response received", http_res)
1807
+
1808
+ async def delete_user_data_async(
1809
+ self,
1810
+ *,
1811
+ user_data_id: str,
1812
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1813
+ server_url: Optional[str] = None,
1814
+ timeout_ms: Optional[int] = None,
1815
+ http_headers: Optional[Mapping[str, str]] = None,
1816
+ ):
1817
+ r"""Delete an User Data
1818
+
1819
+ :param user_data_id:
1820
+ :param retries: Override the default retry configuration for this method
1821
+ :param server_url: Override the default server URL for this method
1822
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1823
+ :param http_headers: Additional headers to set or replace on requests.
1824
+ """
1825
+ base_url = None
1826
+ url_variables = None
1827
+ if timeout_ms is None:
1828
+ timeout_ms = self.sdk_configuration.timeout_ms
1829
+
1830
+ if server_url is not None:
1831
+ base_url = server_url
1832
+ else:
1833
+ base_url = self._get_url(base_url, url_variables)
1834
+
1835
+ request = models.DeleteUserDataRequest(
1836
+ user_data_id=user_data_id,
1837
+ )
1838
+
1839
+ req = self._build_request_async(
1840
+ method="DELETE",
1841
+ path="/user_data/{user_data_id}",
1842
+ base_url=base_url,
1843
+ url_variables=url_variables,
1844
+ request=request,
1845
+ request_body_required=False,
1846
+ request_has_path_params=True,
1847
+ request_has_query_params=True,
1848
+ user_agent_header="user-agent",
1849
+ accept_header_value="*/*",
1850
+ http_headers=http_headers,
1851
+ security=self.sdk_configuration.security,
1852
+ allow_empty_value=None,
1853
+ timeout_ms=timeout_ms,
1854
+ )
1855
+
1856
+ if retries == UNSET:
1857
+ if self.sdk_configuration.retry_config is not UNSET:
1858
+ retries = self.sdk_configuration.retry_config
1859
+
1860
+ retry_config = None
1861
+ if isinstance(retries, utils.RetryConfig):
1862
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1863
+
1864
+ http_res = await self.do_request_async(
1865
+ hook_ctx=HookContext(
1866
+ config=self.sdk_configuration,
1867
+ base_url=base_url or "",
1868
+ operation_id="delete-user-data",
1869
+ oauth2_scopes=None,
1870
+ security_source=get_security_from_env(
1871
+ self.sdk_configuration.security, models.Security
1872
+ ),
1873
+ ),
1874
+ request=req,
1875
+ error_status_codes=["4XX", "5XX"],
1876
+ retry_config=retry_config,
1877
+ )
1878
+
1879
+ if utils.match_response(http_res, "204", "*"):
1880
+ return
1881
+ if utils.match_response(http_res, "4XX", "*"):
1882
+ http_res_text = await utils.stream_to_text_async(http_res)
1883
+ raise models.APIError("API error occurred", http_res, http_res_text)
1884
+ if utils.match_response(http_res, "5XX", "*"):
1885
+ http_res_text = await utils.stream_to_text_async(http_res)
1886
+ raise models.APIError("API error occurred", http_res, http_res_text)
1887
+
1888
+ raise models.APIError("Unexpected response received", http_res)