cosmotech-api 3.2.0__2-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.

Potentially problematic release.


This version of cosmotech-api might be problematic. Click here for more details.

Files changed (255) hide show
  1. cosmotech_api/__init__.py +153 -0
  2. cosmotech_api/api/__init__.py +14 -0
  3. cosmotech_api/api/connector_api.py +1351 -0
  4. cosmotech_api/api/dataset_api.py +9148 -0
  5. cosmotech_api/api/organization_api.py +4692 -0
  6. cosmotech_api/api/run_api.py +2227 -0
  7. cosmotech_api/api/runner_api.py +4551 -0
  8. cosmotech_api/api/scenario_api.py +6688 -0
  9. cosmotech_api/api/scenariorun_api.py +4092 -0
  10. cosmotech_api/api/scenariorunresult_api.py +704 -0
  11. cosmotech_api/api/solution_api.py +6472 -0
  12. cosmotech_api/api/twingraph_api.py +4201 -0
  13. cosmotech_api/api/user_api.py +1291 -0
  14. cosmotech_api/api/validator_api.py +2566 -0
  15. cosmotech_api/api/workspace_api.py +6123 -0
  16. cosmotech_api/api_client.py +759 -0
  17. cosmotech_api/api_response.py +21 -0
  18. cosmotech_api/apis/__init__.py +28 -0
  19. cosmotech_api/configuration.py +453 -0
  20. cosmotech_api/exceptions.py +200 -0
  21. cosmotech_api/model/__init__.py +5 -0
  22. cosmotech_api/model/component_role_permissions.py +260 -0
  23. cosmotech_api/model/connector.py +330 -0
  24. cosmotech_api/model/connector_parameter.py +284 -0
  25. cosmotech_api/model/connector_parameter_group.py +280 -0
  26. cosmotech_api/model/container_resource_size_info.py +268 -0
  27. cosmotech_api/model/container_resource_sizing.py +274 -0
  28. cosmotech_api/model/dataset.py +376 -0
  29. cosmotech_api/model/dataset_access_control.py +268 -0
  30. cosmotech_api/model/dataset_compatibility.py +270 -0
  31. cosmotech_api/model/dataset_connector.py +268 -0
  32. cosmotech_api/model/dataset_copy_parameters.py +264 -0
  33. cosmotech_api/model/dataset_role.py +262 -0
  34. cosmotech_api/model/dataset_search.py +262 -0
  35. cosmotech_api/model/dataset_security.py +274 -0
  36. cosmotech_api/model/dataset_source_type.py +287 -0
  37. cosmotech_api/model/dataset_twin_graph_hash.py +256 -0
  38. cosmotech_api/model/dataset_twin_graph_info.py +264 -0
  39. cosmotech_api/model/dataset_twin_graph_query.py +262 -0
  40. cosmotech_api/model/delete_historical_data.py +272 -0
  41. cosmotech_api/model/file_upload_metadata.py +260 -0
  42. cosmotech_api/model/file_upload_validation.py +266 -0
  43. cosmotech_api/model/graph_properties.py +272 -0
  44. cosmotech_api/model/organization.py +282 -0
  45. cosmotech_api/model/organization_access_control.py +268 -0
  46. cosmotech_api/model/organization_role.py +262 -0
  47. cosmotech_api/model/organization_security.py +274 -0
  48. cosmotech_api/model/organization_service.py +272 -0
  49. cosmotech_api/model/organization_services.py +270 -0
  50. cosmotech_api/model/organization_user.py +277 -0
  51. cosmotech_api/model/resource_size_info.py +268 -0
  52. cosmotech_api/model/run.py +351 -0
  53. cosmotech_api/model/run_container.py +318 -0
  54. cosmotech_api/model/run_container_artifact.py +260 -0
  55. cosmotech_api/model/run_container_logs.py +272 -0
  56. cosmotech_api/model/run_logs.py +268 -0
  57. cosmotech_api/model/run_resource_requested.py +260 -0
  58. cosmotech_api/model/run_search.py +296 -0
  59. cosmotech_api/model/run_start_containers.py +286 -0
  60. cosmotech_api/model/run_state.py +285 -0
  61. cosmotech_api/model/run_status.py +316 -0
  62. cosmotech_api/model/run_status_node.py +307 -0
  63. cosmotech_api/model/run_template.py +408 -0
  64. cosmotech_api/model/run_template_handler_id.py +287 -0
  65. cosmotech_api/model/run_template_orchestrator.py +283 -0
  66. cosmotech_api/model/run_template_parameter.py +296 -0
  67. cosmotech_api/model/run_template_parameter_group.py +288 -0
  68. cosmotech_api/model/run_template_parameter_value.py +273 -0
  69. cosmotech_api/model/run_template_resource_sizing.py +274 -0
  70. cosmotech_api/model/run_template_step_source.py +285 -0
  71. cosmotech_api/model/runner.py +379 -0
  72. cosmotech_api/model/runner_access_control.py +268 -0
  73. cosmotech_api/model/runner_changed_parameter_value.py +272 -0
  74. cosmotech_api/model/runner_comparison_result.py +273 -0
  75. cosmotech_api/model/runner_data_download_info.py +267 -0
  76. cosmotech_api/model/runner_data_download_job.py +257 -0
  77. cosmotech_api/model/runner_job_state.py +287 -0
  78. cosmotech_api/model/runner_last_run.py +268 -0
  79. cosmotech_api/model/runner_resource_sizing.py +274 -0
  80. cosmotech_api/model/runner_role.py +262 -0
  81. cosmotech_api/model/runner_run_template_parameter_value.py +277 -0
  82. cosmotech_api/model/runner_security.py +274 -0
  83. cosmotech_api/model/runner_validation_status.py +285 -0
  84. cosmotech_api/model/scenario.py +379 -0
  85. cosmotech_api/model/scenario_access_control.py +268 -0
  86. cosmotech_api/model/scenario_changed_parameter_value.py +272 -0
  87. cosmotech_api/model/scenario_comparison_result.py +273 -0
  88. cosmotech_api/model/scenario_data_download_info.py +267 -0
  89. cosmotech_api/model/scenario_data_download_job.py +257 -0
  90. cosmotech_api/model/scenario_job_state.py +287 -0
  91. cosmotech_api/model/scenario_last_run.py +268 -0
  92. cosmotech_api/model/scenario_resource_sizing.py +274 -0
  93. cosmotech_api/model/scenario_role.py +262 -0
  94. cosmotech_api/model/scenario_run.py +369 -0
  95. cosmotech_api/model/scenario_run_container.py +318 -0
  96. cosmotech_api/model/scenario_run_container_artifact.py +260 -0
  97. cosmotech_api/model/scenario_run_container_logs.py +272 -0
  98. cosmotech_api/model/scenario_run_logs.py +268 -0
  99. cosmotech_api/model/scenario_run_resource_requested.py +260 -0
  100. cosmotech_api/model/scenario_run_result.py +260 -0
  101. cosmotech_api/model/scenario_run_search.py +296 -0
  102. cosmotech_api/model/scenario_run_start_containers.py +286 -0
  103. cosmotech_api/model/scenario_run_state.py +287 -0
  104. cosmotech_api/model/scenario_run_status.py +308 -0
  105. cosmotech_api/model/scenario_run_status_node.py +307 -0
  106. cosmotech_api/model/scenario_run_template_parameter_value.py +277 -0
  107. cosmotech_api/model/scenario_security.py +274 -0
  108. cosmotech_api/model/scenario_user.py +277 -0
  109. cosmotech_api/model/scenario_validation_status.py +285 -0
  110. cosmotech_api/model/solution.py +335 -0
  111. cosmotech_api/model/solution_access_control.py +268 -0
  112. cosmotech_api/model/solution_role.py +262 -0
  113. cosmotech_api/model/solution_security.py +274 -0
  114. cosmotech_api/model/source_info.py +274 -0
  115. cosmotech_api/model/sub_dataset_graph_query.py +268 -0
  116. cosmotech_api/model/translated_labels.py +252 -0
  117. cosmotech_api/model/twin_graph_batch_result.py +274 -0
  118. cosmotech_api/model/twin_graph_hash.py +256 -0
  119. cosmotech_api/model/twin_graph_import.py +278 -0
  120. cosmotech_api/model/twin_graph_import_info.py +260 -0
  121. cosmotech_api/model/twin_graph_query.py +266 -0
  122. cosmotech_api/model/user.py +281 -0
  123. cosmotech_api/model/user_organization.py +275 -0
  124. cosmotech_api/model/user_workspace.py +266 -0
  125. cosmotech_api/model/validator.py +295 -0
  126. cosmotech_api/model/validator_run.py +302 -0
  127. cosmotech_api/model/workspace.py +351 -0
  128. cosmotech_api/model/workspace_access_control.py +268 -0
  129. cosmotech_api/model/workspace_file.py +256 -0
  130. cosmotech_api/model/workspace_role.py +262 -0
  131. cosmotech_api/model/workspace_secret.py +256 -0
  132. cosmotech_api/model/workspace_security.py +274 -0
  133. cosmotech_api/model/workspace_solution.py +264 -0
  134. cosmotech_api/model/workspace_user.py +278 -0
  135. cosmotech_api/model/workspace_web_app.py +270 -0
  136. cosmotech_api/model_utils.py +2038 -0
  137. cosmotech_api/models/__init__.py +127 -0
  138. cosmotech_api/models/component_role_permissions.py +90 -0
  139. cosmotech_api/models/connector.py +135 -0
  140. cosmotech_api/models/connector_parameter.py +98 -0
  141. cosmotech_api/models/connector_parameter_group.py +100 -0
  142. cosmotech_api/models/container_resource_size_info.py +90 -0
  143. cosmotech_api/models/container_resource_sizing.py +97 -0
  144. cosmotech_api/models/dataset.py +195 -0
  145. cosmotech_api/models/dataset_access_control.py +90 -0
  146. cosmotech_api/models/dataset_compatibility.py +92 -0
  147. cosmotech_api/models/dataset_connector.py +94 -0
  148. cosmotech_api/models/dataset_copy_parameters.py +92 -0
  149. cosmotech_api/models/dataset_role.py +88 -0
  150. cosmotech_api/models/dataset_search.py +88 -0
  151. cosmotech_api/models/dataset_security.py +98 -0
  152. cosmotech_api/models/dataset_source_type.py +42 -0
  153. cosmotech_api/models/dataset_twin_graph_hash.py +88 -0
  154. cosmotech_api/models/dataset_twin_graph_info.py +92 -0
  155. cosmotech_api/models/dataset_twin_graph_query.py +88 -0
  156. cosmotech_api/models/delete_historical_data.py +92 -0
  157. cosmotech_api/models/file_upload_metadata.py +90 -0
  158. cosmotech_api/models/file_upload_validation.py +105 -0
  159. cosmotech_api/models/graph_properties.py +96 -0
  160. cosmotech_api/models/organization.py +108 -0
  161. cosmotech_api/models/organization_access_control.py +90 -0
  162. cosmotech_api/models/organization_role.py +88 -0
  163. cosmotech_api/models/organization_security.py +98 -0
  164. cosmotech_api/models/organization_service.py +96 -0
  165. cosmotech_api/models/organization_services.py +99 -0
  166. cosmotech_api/models/query_result.py +88 -0
  167. cosmotech_api/models/resource_size_info.py +90 -0
  168. cosmotech_api/models/run.py +167 -0
  169. cosmotech_api/models/run_container.py +126 -0
  170. cosmotech_api/models/run_container_artifact.py +90 -0
  171. cosmotech_api/models/run_container_logs.py +102 -0
  172. cosmotech_api/models/run_data.py +92 -0
  173. cosmotech_api/models/run_data_query.py +88 -0
  174. cosmotech_api/models/run_logs.py +107 -0
  175. cosmotech_api/models/run_resource_requested.py +90 -0
  176. cosmotech_api/models/run_search.py +112 -0
  177. cosmotech_api/models/run_start_containers.py +104 -0
  178. cosmotech_api/models/run_state.py +40 -0
  179. cosmotech_api/models/run_status.py +123 -0
  180. cosmotech_api/models/run_status_node.py +116 -0
  181. cosmotech_api/models/run_template.py +164 -0
  182. cosmotech_api/models/run_template_handler_id.py +42 -0
  183. cosmotech_api/models/run_template_orchestrator.py +38 -0
  184. cosmotech_api/models/run_template_parameter.py +102 -0
  185. cosmotech_api/models/run_template_parameter_group.py +98 -0
  186. cosmotech_api/models/run_template_parameter_value.py +94 -0
  187. cosmotech_api/models/run_template_resource_sizing.py +97 -0
  188. cosmotech_api/models/run_template_step_source.py +40 -0
  189. cosmotech_api/models/runner.py +188 -0
  190. cosmotech_api/models/runner_access_control.py +90 -0
  191. cosmotech_api/models/runner_changed_parameter_value.py +102 -0
  192. cosmotech_api/models/runner_comparison_result.py +106 -0
  193. cosmotech_api/models/runner_data_download_info.py +93 -0
  194. cosmotech_api/models/runner_data_download_job.py +90 -0
  195. cosmotech_api/models/runner_job_state.py +42 -0
  196. cosmotech_api/models/runner_last_run.py +94 -0
  197. cosmotech_api/models/runner_parent_last_run.py +94 -0
  198. cosmotech_api/models/runner_resource_sizing.py +97 -0
  199. cosmotech_api/models/runner_role.py +88 -0
  200. cosmotech_api/models/runner_root_last_run.py +94 -0
  201. cosmotech_api/models/runner_run_template_parameter_value.py +96 -0
  202. cosmotech_api/models/runner_security.py +98 -0
  203. cosmotech_api/models/runner_validation_status.py +40 -0
  204. cosmotech_api/models/scenario.py +186 -0
  205. cosmotech_api/models/scenario_access_control.py +90 -0
  206. cosmotech_api/models/scenario_changed_parameter_value.py +102 -0
  207. cosmotech_api/models/scenario_comparison_result.py +106 -0
  208. cosmotech_api/models/scenario_data_download_info.py +93 -0
  209. cosmotech_api/models/scenario_data_download_job.py +90 -0
  210. cosmotech_api/models/scenario_job_state.py +42 -0
  211. cosmotech_api/models/scenario_last_run.py +94 -0
  212. cosmotech_api/models/scenario_resource_sizing.py +97 -0
  213. cosmotech_api/models/scenario_role.py +88 -0
  214. cosmotech_api/models/scenario_run.py +179 -0
  215. cosmotech_api/models/scenario_run_container.py +126 -0
  216. cosmotech_api/models/scenario_run_container_artifact.py +90 -0
  217. cosmotech_api/models/scenario_run_container_logs.py +102 -0
  218. cosmotech_api/models/scenario_run_logs.py +107 -0
  219. cosmotech_api/models/scenario_run_resource_requested.py +90 -0
  220. cosmotech_api/models/scenario_run_result.py +90 -0
  221. cosmotech_api/models/scenario_run_search.py +112 -0
  222. cosmotech_api/models/scenario_run_start_containers.py +104 -0
  223. cosmotech_api/models/scenario_run_state.py +42 -0
  224. cosmotech_api/models/scenario_run_status.py +119 -0
  225. cosmotech_api/models/scenario_run_status_node.py +116 -0
  226. cosmotech_api/models/scenario_run_template_parameter_value.py +96 -0
  227. cosmotech_api/models/scenario_security.py +98 -0
  228. cosmotech_api/models/scenario_validation_status.py +40 -0
  229. cosmotech_api/models/send_run_data_request.py +90 -0
  230. cosmotech_api/models/solution.py +154 -0
  231. cosmotech_api/models/solution_access_control.py +90 -0
  232. cosmotech_api/models/solution_role.py +88 -0
  233. cosmotech_api/models/solution_security.py +98 -0
  234. cosmotech_api/models/source_info.py +94 -0
  235. cosmotech_api/models/sub_dataset_graph_query.py +94 -0
  236. cosmotech_api/models/twin_graph_batch_result.py +92 -0
  237. cosmotech_api/models/twin_graph_hash.py +88 -0
  238. cosmotech_api/models/twin_graph_query.py +90 -0
  239. cosmotech_api/models/validator.py +106 -0
  240. cosmotech_api/models/validator_run.py +126 -0
  241. cosmotech_api/models/workspace.py +142 -0
  242. cosmotech_api/models/workspace_access_control.py +90 -0
  243. cosmotech_api/models/workspace_file.py +88 -0
  244. cosmotech_api/models/workspace_role.py +88 -0
  245. cosmotech_api/models/workspace_secret.py +88 -0
  246. cosmotech_api/models/workspace_security.py +98 -0
  247. cosmotech_api/models/workspace_solution.py +92 -0
  248. cosmotech_api/models/workspace_web_app.py +92 -0
  249. cosmotech_api/py.typed +0 -0
  250. cosmotech_api/rest.py +256 -0
  251. cosmotech_api-3.2.0.dist-info/LICENSE +17 -0
  252. cosmotech_api-3.2.0.dist-info/METADATA +18 -0
  253. cosmotech_api-3.2.0.dist-info/RECORD +255 -0
  254. cosmotech_api-3.2.0.dist-info/WHEEL +5 -0
  255. cosmotech_api-3.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ """API response object."""
2
+
3
+ from __future__ import annotations
4
+ from typing import Optional, Generic, Mapping, TypeVar
5
+ from pydantic import Field, StrictInt, StrictBytes, BaseModel
6
+
7
+ T = TypeVar("T")
8
+
9
+ class ApiResponse(BaseModel, Generic[T]):
10
+ """
11
+ API response object
12
+ """
13
+
14
+ status_code: StrictInt = Field(description="HTTP status code")
15
+ headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers")
16
+ data: T = Field(description="Deserialized data given the data type")
17
+ raw_data: StrictBytes = Field(description="Raw data (HTTP response body)")
18
+
19
+ model_config = {
20
+ "arbitrary_types_allowed": True
21
+ }
@@ -0,0 +1,28 @@
1
+
2
+ # flake8: noqa
3
+
4
+ # Import all APIs into this package.
5
+ # If you have many APIs here with many many models used in each API this may
6
+ # raise a `RecursionError`.
7
+ # In order to avoid this, import only the API that you directly need like:
8
+ #
9
+ # from .api.connector_api import ConnectorApi
10
+ #
11
+ # or import this package, but before doing it, use:
12
+ #
13
+ # import sys
14
+ # sys.setrecursionlimit(n)
15
+
16
+ # Import APIs into API package:
17
+ from cosmotech_api.api.connector_api import ConnectorApi
18
+ from cosmotech_api.api.dataset_api import DatasetApi
19
+ from cosmotech_api.api.organization_api import OrganizationApi
20
+ from cosmotech_api.api.run_api import RunApi
21
+ from cosmotech_api.api.runner_api import RunnerApi
22
+ from cosmotech_api.api.scenario_api import ScenarioApi
23
+ from cosmotech_api.api.scenariorun_api import ScenariorunApi
24
+ from cosmotech_api.api.scenariorunresult_api import ScenariorunresultApi
25
+ from cosmotech_api.api.solution_api import SolutionApi
26
+ from cosmotech_api.api.twingraph_api import TwingraphApi
27
+ from cosmotech_api.api.validator_api import ValidatorApi
28
+ from cosmotech_api.api.workspace_api import WorkspaceApi
@@ -0,0 +1,453 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Cosmo Tech Platform API
5
+
6
+ Cosmo Tech Platform API
7
+
8
+ The version of the OpenAPI document: 3.2.0
9
+ Contact: platform@cosmotech.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+
16
+ import copy
17
+ import logging
18
+ from logging import FileHandler
19
+ import multiprocessing
20
+ import sys
21
+ from typing import Optional
22
+ import urllib3
23
+
24
+ import http.client as httplib
25
+
26
+ JSON_SCHEMA_VALIDATION_KEYWORDS = {
27
+ 'multipleOf', 'maximum', 'exclusiveMaximum',
28
+ 'minimum', 'exclusiveMinimum', 'maxLength',
29
+ 'minLength', 'pattern', 'maxItems', 'minItems'
30
+ }
31
+
32
+ class Configuration:
33
+ """This class contains various settings of the API client.
34
+
35
+ :param host: Base url.
36
+ :param api_key: Dict to store API key(s).
37
+ Each entry in the dict specifies an API key.
38
+ The dict key is the name of the security scheme in the OAS specification.
39
+ The dict value is the API key secret.
40
+ :param api_key_prefix: Dict to store API prefix (e.g. Bearer).
41
+ The dict key is the name of the security scheme in the OAS specification.
42
+ The dict value is an API key prefix when generating the auth data.
43
+ :param username: Username for HTTP basic authentication.
44
+ :param password: Password for HTTP basic authentication.
45
+ :param access_token: Access token.
46
+ :param server_index: Index to servers configuration.
47
+ :param server_variables: Mapping with string values to replace variables in
48
+ templated server configuration. The validation of enums is performed for
49
+ variables with defined enum values before.
50
+ :param server_operation_index: Mapping from operation ID to an index to server
51
+ configuration.
52
+ :param server_operation_variables: Mapping from operation ID to a mapping with
53
+ string values to replace variables in templated server configuration.
54
+ The validation of enums is performed for variables with defined enum
55
+ values before.
56
+ :param ssl_ca_cert: str - the path to a file of concatenated CA certificates
57
+ in PEM format.
58
+
59
+ :Example:
60
+ """
61
+
62
+ _default = None
63
+
64
+ def __init__(self, host=None,
65
+ api_key=None, api_key_prefix=None,
66
+ username=None, password=None,
67
+ access_token=None,
68
+ server_index=None, server_variables=None,
69
+ server_operation_index=None, server_operation_variables=None,
70
+ ssl_ca_cert=None,
71
+ ) -> None:
72
+ """Constructor
73
+ """
74
+ self._base_path = "https://dev.api.cosmotech.com" if host is None else host
75
+ """Default Base url
76
+ """
77
+ self.server_index = 0 if server_index is None and host is None else server_index
78
+ self.server_operation_index = server_operation_index or {}
79
+ """Default server index
80
+ """
81
+ self.server_variables = server_variables or {}
82
+ self.server_operation_variables = server_operation_variables or {}
83
+ """Default server variables
84
+ """
85
+ self.temp_folder_path = None
86
+ """Temp file folder for downloading files
87
+ """
88
+ # Authentication Settings
89
+ self.api_key = {}
90
+ if api_key:
91
+ self.api_key = api_key
92
+ """dict to store API key(s)
93
+ """
94
+ self.api_key_prefix = {}
95
+ if api_key_prefix:
96
+ self.api_key_prefix = api_key_prefix
97
+ """dict to store API prefix (e.g. Bearer)
98
+ """
99
+ self.refresh_api_key_hook = None
100
+ """function hook to refresh API key if expired
101
+ """
102
+ self.username = username
103
+ """Username for HTTP basic authentication
104
+ """
105
+ self.password = password
106
+ """Password for HTTP basic authentication
107
+ """
108
+ self.access_token = access_token
109
+ """Access token
110
+ """
111
+ self.logger = {}
112
+ """Logging Settings
113
+ """
114
+ self.logger["package_logger"] = logging.getLogger("cosmotech_api")
115
+ self.logger["urllib3_logger"] = logging.getLogger("urllib3")
116
+ self.logger_format = '%(asctime)s %(levelname)s %(message)s'
117
+ """Log format
118
+ """
119
+ self.logger_stream_handler = None
120
+ """Log stream handler
121
+ """
122
+ self.logger_file_handler: Optional[FileHandler] = None
123
+ """Log file handler
124
+ """
125
+ self.logger_file = None
126
+ """Debug file location
127
+ """
128
+ self.debug = False
129
+ """Debug switch
130
+ """
131
+
132
+ self.verify_ssl = True
133
+ """SSL/TLS verification
134
+ Set this to false to skip verifying SSL certificate when calling API
135
+ from https server.
136
+ """
137
+ self.ssl_ca_cert = ssl_ca_cert
138
+ """Set this to customize the certificate file to verify the peer.
139
+ """
140
+ self.cert_file = None
141
+ """client certificate file
142
+ """
143
+ self.key_file = None
144
+ """client key file
145
+ """
146
+ self.assert_hostname = None
147
+ """Set this to True/False to enable/disable SSL hostname verification.
148
+ """
149
+ self.tls_server_name = None
150
+ """SSL/TLS Server Name Indication (SNI)
151
+ Set this to the SNI value expected by the server.
152
+ """
153
+
154
+ self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
155
+ """urllib3 connection pool's maximum number of connections saved
156
+ per pool. urllib3 uses 1 connection as default value, but this is
157
+ not the best value when you are making a lot of possibly parallel
158
+ requests to the same host, which is often the case here.
159
+ cpu_count * 5 is used as default value to increase performance.
160
+ """
161
+
162
+ self.proxy: Optional[str] = None
163
+ """Proxy URL
164
+ """
165
+ self.proxy_headers = None
166
+ """Proxy headers
167
+ """
168
+ self.safe_chars_for_path_param = ''
169
+ """Safe chars for path_param
170
+ """
171
+ self.retries = None
172
+ """Adding retries to override urllib3 default value 3
173
+ """
174
+ # Enable client side validation
175
+ self.client_side_validation = True
176
+
177
+ self.socket_options = None
178
+ """Options to pass down to the underlying urllib3 socket
179
+ """
180
+
181
+ self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
182
+ """datetime format
183
+ """
184
+
185
+ self.date_format = "%Y-%m-%d"
186
+ """date format
187
+ """
188
+
189
+ def __deepcopy__(self, memo):
190
+ cls = self.__class__
191
+ result = cls.__new__(cls)
192
+ memo[id(self)] = result
193
+ for k, v in self.__dict__.items():
194
+ if k not in ('logger', 'logger_file_handler'):
195
+ setattr(result, k, copy.deepcopy(v, memo))
196
+ # shallow copy of loggers
197
+ result.logger = copy.copy(self.logger)
198
+ # use setters to configure loggers
199
+ result.logger_file = self.logger_file
200
+ result.debug = self.debug
201
+ return result
202
+
203
+ def __setattr__(self, name, value):
204
+ object.__setattr__(self, name, value)
205
+
206
+ @classmethod
207
+ def set_default(cls, default):
208
+ """Set default instance of configuration.
209
+
210
+ It stores default configuration, which can be
211
+ returned by get_default_copy method.
212
+
213
+ :param default: object of Configuration
214
+ """
215
+ cls._default = default
216
+
217
+ @classmethod
218
+ def get_default_copy(cls):
219
+ """Deprecated. Please use `get_default` instead.
220
+
221
+ Deprecated. Please use `get_default` instead.
222
+
223
+ :return: The configuration object.
224
+ """
225
+ return cls.get_default()
226
+
227
+ @classmethod
228
+ def get_default(cls):
229
+ """Return the default configuration.
230
+
231
+ This method returns newly created, based on default constructor,
232
+ object of Configuration class or returns a copy of default
233
+ configuration.
234
+
235
+ :return: The configuration object.
236
+ """
237
+ if cls._default is None:
238
+ cls._default = Configuration()
239
+ return cls._default
240
+
241
+ @property
242
+ def logger_file(self):
243
+ """The logger file.
244
+
245
+ If the logger_file is None, then add stream handler and remove file
246
+ handler. Otherwise, add file handler and remove stream handler.
247
+
248
+ :param value: The logger_file path.
249
+ :type: str
250
+ """
251
+ return self.__logger_file
252
+
253
+ @logger_file.setter
254
+ def logger_file(self, value):
255
+ """The logger file.
256
+
257
+ If the logger_file is None, then add stream handler and remove file
258
+ handler. Otherwise, add file handler and remove stream handler.
259
+
260
+ :param value: The logger_file path.
261
+ :type: str
262
+ """
263
+ self.__logger_file = value
264
+ if self.__logger_file:
265
+ # If set logging file,
266
+ # then add file handler and remove stream handler.
267
+ self.logger_file_handler = logging.FileHandler(self.__logger_file)
268
+ self.logger_file_handler.setFormatter(self.logger_formatter)
269
+ for _, logger in self.logger.items():
270
+ logger.addHandler(self.logger_file_handler)
271
+
272
+ @property
273
+ def debug(self):
274
+ """Debug status
275
+
276
+ :param value: The debug status, True or False.
277
+ :type: bool
278
+ """
279
+ return self.__debug
280
+
281
+ @debug.setter
282
+ def debug(self, value):
283
+ """Debug status
284
+
285
+ :param value: The debug status, True or False.
286
+ :type: bool
287
+ """
288
+ self.__debug = value
289
+ if self.__debug:
290
+ # if debug status is True, turn on debug logging
291
+ for _, logger in self.logger.items():
292
+ logger.setLevel(logging.DEBUG)
293
+ # turn on httplib debug
294
+ httplib.HTTPConnection.debuglevel = 1
295
+ else:
296
+ # if debug status is False, turn off debug logging,
297
+ # setting log level to default `logging.WARNING`
298
+ for _, logger in self.logger.items():
299
+ logger.setLevel(logging.WARNING)
300
+ # turn off httplib debug
301
+ httplib.HTTPConnection.debuglevel = 0
302
+
303
+ @property
304
+ def logger_format(self):
305
+ """The logger format.
306
+
307
+ The logger_formatter will be updated when sets logger_format.
308
+
309
+ :param value: The format string.
310
+ :type: str
311
+ """
312
+ return self.__logger_format
313
+
314
+ @logger_format.setter
315
+ def logger_format(self, value):
316
+ """The logger format.
317
+
318
+ The logger_formatter will be updated when sets logger_format.
319
+
320
+ :param value: The format string.
321
+ :type: str
322
+ """
323
+ self.__logger_format = value
324
+ self.logger_formatter = logging.Formatter(self.__logger_format)
325
+
326
+ def get_api_key_with_prefix(self, identifier, alias=None):
327
+ """Gets API key (with prefix if set).
328
+
329
+ :param identifier: The identifier of apiKey.
330
+ :param alias: The alternative identifier of apiKey.
331
+ :return: The token for api key authentication.
332
+ """
333
+ if self.refresh_api_key_hook is not None:
334
+ self.refresh_api_key_hook(self)
335
+ key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None)
336
+ if key:
337
+ prefix = self.api_key_prefix.get(identifier)
338
+ if prefix:
339
+ return "%s %s" % (prefix, key)
340
+ else:
341
+ return key
342
+
343
+ def get_basic_auth_token(self):
344
+ """Gets HTTP basic authentication header (string).
345
+
346
+ :return: The token for basic HTTP authentication.
347
+ """
348
+ username = ""
349
+ if self.username is not None:
350
+ username = self.username
351
+ password = ""
352
+ if self.password is not None:
353
+ password = self.password
354
+ return urllib3.util.make_headers(
355
+ basic_auth=username + ':' + password
356
+ ).get('authorization')
357
+
358
+ def auth_settings(self):
359
+ """Gets Auth Settings dict for api client.
360
+
361
+ :return: The Auth Settings information dict.
362
+ """
363
+ auth = {}
364
+ if self.access_token is not None:
365
+ auth['oAuth2AuthCode'] = {
366
+ 'type': 'oauth2',
367
+ 'in': 'header',
368
+ 'key': 'Authorization',
369
+ 'value': 'Bearer ' + self.access_token
370
+ }
371
+ return auth
372
+
373
+ def to_debug_report(self):
374
+ """Gets the essential information for debugging.
375
+
376
+ :return: The report for debugging.
377
+ """
378
+ return "Python SDK Debug Report:\n"\
379
+ "OS: {env}\n"\
380
+ "Python Version: {pyversion}\n"\
381
+ "Version of the API: 3.2.0\n"\
382
+ "SDK Package Version: 1.0.0".\
383
+ format(env=sys.platform, pyversion=sys.version)
384
+
385
+ def get_host_settings(self):
386
+ """Gets an array of host settings
387
+
388
+ :return: An array of host settings
389
+ """
390
+ return [
391
+ {
392
+ 'url': "https://dev.api.cosmotech.com",
393
+ 'description': "Development",
394
+ },
395
+ {
396
+ 'url': "https://api.cosmotech.com",
397
+ 'description': "Production",
398
+ },
399
+ {
400
+ 'url': "https://staging.api.cosmotech.com",
401
+ 'description': "Staging",
402
+ }
403
+ ]
404
+
405
+ def get_host_from_settings(self, index, variables=None, servers=None):
406
+ """Gets host URL based on the index and variables
407
+ :param index: array index of the host settings
408
+ :param variables: hash of variable and the corresponding value
409
+ :param servers: an array of host settings or None
410
+ :return: URL based on host settings
411
+ """
412
+ if index is None:
413
+ return self._base_path
414
+
415
+ variables = {} if variables is None else variables
416
+ servers = self.get_host_settings() if servers is None else servers
417
+
418
+ try:
419
+ server = servers[index]
420
+ except IndexError:
421
+ raise ValueError(
422
+ "Invalid index {0} when selecting the host settings. "
423
+ "Must be less than {1}".format(index, len(servers)))
424
+
425
+ url = server['url']
426
+
427
+ # go through variables and replace placeholders
428
+ for variable_name, variable in server.get('variables', {}).items():
429
+ used_value = variables.get(
430
+ variable_name, variable['default_value'])
431
+
432
+ if 'enum_values' in variable \
433
+ and used_value not in variable['enum_values']:
434
+ raise ValueError(
435
+ "The variable `{0}` in the host URL has invalid value "
436
+ "{1}. Must be {2}.".format(
437
+ variable_name, variables[variable_name],
438
+ variable['enum_values']))
439
+
440
+ url = url.replace("{" + variable_name + "}", used_value)
441
+
442
+ return url
443
+
444
+ @property
445
+ def host(self):
446
+ """Return generated host."""
447
+ return self.get_host_from_settings(self.server_index, variables=self.server_variables)
448
+
449
+ @host.setter
450
+ def host(self, value):
451
+ """Fix base path."""
452
+ self._base_path = value
453
+ self.server_index = None
@@ -0,0 +1,200 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Cosmo Tech Platform API
5
+
6
+ Cosmo Tech Platform API
7
+
8
+ The version of the OpenAPI document: 3.2.0
9
+ Contact: platform@cosmotech.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ from typing import Any, Optional
16
+ from typing_extensions import Self
17
+
18
+ class OpenApiException(Exception):
19
+ """The base exception class for all OpenAPIExceptions"""
20
+
21
+
22
+ class ApiTypeError(OpenApiException, TypeError):
23
+ def __init__(self, msg, path_to_item=None, valid_classes=None,
24
+ key_type=None) -> None:
25
+ """ Raises an exception for TypeErrors
26
+
27
+ Args:
28
+ msg (str): the exception message
29
+
30
+ Keyword Args:
31
+ path_to_item (list): a list of keys an indices to get to the
32
+ current_item
33
+ None if unset
34
+ valid_classes (tuple): the primitive classes that current item
35
+ should be an instance of
36
+ None if unset
37
+ key_type (bool): False if our value is a value in a dict
38
+ True if it is a key in a dict
39
+ False if our item is an item in a list
40
+ None if unset
41
+ """
42
+ self.path_to_item = path_to_item
43
+ self.valid_classes = valid_classes
44
+ self.key_type = key_type
45
+ full_msg = msg
46
+ if path_to_item:
47
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
48
+ super(ApiTypeError, self).__init__(full_msg)
49
+
50
+
51
+ class ApiValueError(OpenApiException, ValueError):
52
+ def __init__(self, msg, path_to_item=None) -> None:
53
+ """
54
+ Args:
55
+ msg (str): the exception message
56
+
57
+ Keyword Args:
58
+ path_to_item (list) the path to the exception in the
59
+ received_data dict. None if unset
60
+ """
61
+
62
+ self.path_to_item = path_to_item
63
+ full_msg = msg
64
+ if path_to_item:
65
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
66
+ super(ApiValueError, self).__init__(full_msg)
67
+
68
+
69
+ class ApiAttributeError(OpenApiException, AttributeError):
70
+ def __init__(self, msg, path_to_item=None) -> None:
71
+ """
72
+ Raised when an attribute reference or assignment fails.
73
+
74
+ Args:
75
+ msg (str): the exception message
76
+
77
+ Keyword Args:
78
+ path_to_item (None/list) the path to the exception in the
79
+ received_data dict
80
+ """
81
+ self.path_to_item = path_to_item
82
+ full_msg = msg
83
+ if path_to_item:
84
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
85
+ super(ApiAttributeError, self).__init__(full_msg)
86
+
87
+
88
+ class ApiKeyError(OpenApiException, KeyError):
89
+ def __init__(self, msg, path_to_item=None) -> None:
90
+ """
91
+ Args:
92
+ msg (str): the exception message
93
+
94
+ Keyword Args:
95
+ path_to_item (None/list) the path to the exception in the
96
+ received_data dict
97
+ """
98
+ self.path_to_item = path_to_item
99
+ full_msg = msg
100
+ if path_to_item:
101
+ full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
102
+ super(ApiKeyError, self).__init__(full_msg)
103
+
104
+
105
+ class ApiException(OpenApiException):
106
+
107
+ def __init__(
108
+ self,
109
+ status=None,
110
+ reason=None,
111
+ http_resp=None,
112
+ *,
113
+ body: Optional[str] = None,
114
+ data: Optional[Any] = None,
115
+ ) -> None:
116
+ self.status = status
117
+ self.reason = reason
118
+ self.body = body
119
+ self.data = data
120
+ self.headers = None
121
+
122
+ if http_resp:
123
+ if self.status is None:
124
+ self.status = http_resp.status
125
+ if self.reason is None:
126
+ self.reason = http_resp.reason
127
+ if self.body is None:
128
+ try:
129
+ self.body = http_resp.data.decode('utf-8')
130
+ except Exception:
131
+ pass
132
+ self.headers = http_resp.getheaders()
133
+
134
+ @classmethod
135
+ def from_response(
136
+ cls,
137
+ *,
138
+ http_resp,
139
+ body: Optional[str],
140
+ data: Optional[Any],
141
+ ) -> Self:
142
+ if http_resp.status == 400:
143
+ raise BadRequestException(http_resp=http_resp, body=body, data=data)
144
+
145
+ if http_resp.status == 401:
146
+ raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
147
+
148
+ if http_resp.status == 403:
149
+ raise ForbiddenException(http_resp=http_resp, body=body, data=data)
150
+
151
+ if http_resp.status == 404:
152
+ raise NotFoundException(http_resp=http_resp, body=body, data=data)
153
+
154
+ if 500 <= http_resp.status <= 599:
155
+ raise ServiceException(http_resp=http_resp, body=body, data=data)
156
+ raise ApiException(http_resp=http_resp, body=body, data=data)
157
+
158
+ def __str__(self):
159
+ """Custom error messages for exception"""
160
+ error_message = "({0})\n"\
161
+ "Reason: {1}\n".format(self.status, self.reason)
162
+ if self.headers:
163
+ error_message += "HTTP response headers: {0}\n".format(
164
+ self.headers)
165
+
166
+ if self.data or self.body:
167
+ error_message += "HTTP response body: {0}\n".format(self.data or self.body)
168
+
169
+ return error_message
170
+
171
+
172
+ class BadRequestException(ApiException):
173
+ pass
174
+
175
+
176
+ class NotFoundException(ApiException):
177
+ pass
178
+
179
+
180
+ class UnauthorizedException(ApiException):
181
+ pass
182
+
183
+
184
+ class ForbiddenException(ApiException):
185
+ pass
186
+
187
+
188
+ class ServiceException(ApiException):
189
+ pass
190
+
191
+
192
+ def render_path(path_to_item):
193
+ """Returns a string representation of a path"""
194
+ result = ""
195
+ for pth in path_to_item:
196
+ if isinstance(pth, int):
197
+ result += "[{0}]".format(pth)
198
+ else:
199
+ result += "['{0}']".format(pth)
200
+ return result