platform-api-python-client 4.31.0__py3-none-any.whl → 4.37.1__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 (70) hide show
  1. platform_api_python_client/__init__.py +39 -10
  2. platform_api_python_client/api/external_api.py +6460 -1203
  3. platform_api_python_client/api_client.py +1 -1
  4. platform_api_python_client/configuration.py +1 -1
  5. platform_api_python_client/models/__init__.py +38 -9
  6. platform_api_python_client/models/ccl_dynamo_pools.py +116 -0
  7. platform_api_python_client/models/{create_c_serve_v2_deployment_response.py → ccl_main_pools.py} +12 -13
  8. platform_api_python_client/models/cluster_credential.py +2 -2
  9. platform_api_python_client/models/create_compute_deployment_request.py +27 -1
  10. platform_api_python_client/models/create_dynamo_deployment_request.py +42 -1
  11. platform_api_python_client/models/create_filesystem_volume_request.py +0 -13
  12. platform_api_python_client/models/create_inference_v3_deployment_request.py +42 -2
  13. platform_api_python_client/models/create_job_deployment_request.py +27 -1
  14. platform_api_python_client/models/create_object_volume_request.py +0 -13
  15. platform_api_python_client/models/deployment_response.py +12 -27
  16. platform_api_python_client/models/deployment_type.py +14 -0
  17. platform_api_python_client/models/dynamo_communications_input.py +0 -13
  18. platform_api_python_client/models/dynamo_communications_output.py +0 -13
  19. platform_api_python_client/models/dynamo_image.py +105 -0
  20. platform_api_python_client/models/dynamo_kv_transfer_configuration.py +0 -13
  21. platform_api_python_client/models/dynamo_weight_transfer_configuration.py +88 -0
  22. platform_api_python_client/models/dynamo_weight_transfer_policy.py +36 -0
  23. platform_api_python_client/models/dynamo_worker_pool_config.py +1 -14
  24. platform_api_python_client/models/dynamo_worker_pools.py +0 -13
  25. platform_api_python_client/models/env.py +89 -0
  26. platform_api_python_client/models/get_cluster_response.py +4 -2
  27. platform_api_python_client/models/get_compute_deployment_response.py +29 -2
  28. platform_api_python_client/models/get_deployment_usage_response.py +19 -4
  29. platform_api_python_client/models/get_dynamo_deployment_response.py +43 -1
  30. platform_api_python_client/models/get_inference_v3_deployment_response.py +43 -2
  31. platform_api_python_client/models/get_job_deployment_response.py +29 -2
  32. platform_api_python_client/models/hardware_instance_response.py +6 -2
  33. platform_api_python_client/models/image.py +112 -0
  34. platform_api_python_client/models/ingress.py +103 -0
  35. platform_api_python_client/models/insight_list_item_response.py +108 -0
  36. platform_api_python_client/models/insight_resource.py +97 -0
  37. platform_api_python_client/models/insight_resource_type.py +37 -0
  38. platform_api_python_client/models/insight_response.py +133 -0
  39. platform_api_python_client/models/insight_severity.py +40 -0
  40. platform_api_python_client/models/insight_status.py +39 -0
  41. platform_api_python_client/models/{c_serve_recipe_response.py → insight_status_change_response.py} +28 -24
  42. platform_api_python_client/models/{c_serve_recipe_perf.py → list_insights_response.py} +16 -19
  43. platform_api_python_client/models/metric.py +13 -0
  44. platform_api_python_client/models/pool.py +116 -0
  45. platform_api_python_client/models/{get_c_serve_v2_deployment_response.py → unified_get_compute_deployment_response.py} +65 -81
  46. platform_api_python_client/models/unified_get_deployment_logs_response.py +95 -0
  47. platform_api_python_client/models/{create_c_serve_v3_deployment_response.py → unified_get_deployment_pods_response.py} +8 -13
  48. platform_api_python_client/models/unified_get_deployment_response.py +164 -0
  49. platform_api_python_client/models/unified_get_deployment_revision_response.py +109 -0
  50. platform_api_python_client/models/unified_get_deployment_rollout_response.py +90 -0
  51. platform_api_python_client/models/unified_get_deployment_usage_response.py +110 -0
  52. platform_api_python_client/models/unified_get_dynamo_deployment_response.py +218 -0
  53. platform_api_python_client/models/unified_get_inference_v3_deployment_response.py +228 -0
  54. platform_api_python_client/models/{get_c_serve_v3_deployment_response.py → unified_get_job_deployment_response.py} +85 -75
  55. platform_api_python_client/models/{list_c_serve_recipe_response.py → unified_list_deployment_revisions_response.py} +7 -7
  56. platform_api_python_client/models/unified_update_deployment_rollout_request.py +87 -0
  57. platform_api_python_client/models/unified_write_compute_deployment_request.py +154 -0
  58. platform_api_python_client/models/unified_write_deployment_request.py +164 -0
  59. platform_api_python_client/models/{c_serve_v2_recipe.py → unified_write_deployment_response.py} +27 -27
  60. platform_api_python_client/models/unified_write_dynamo_deployment_request.py +197 -0
  61. platform_api_python_client/models/{create_c_serve_v3_deployment_request.py → unified_write_inference_v3_deployment_request.py} +78 -70
  62. platform_api_python_client/models/unified_write_job_deployment_request.py +183 -0
  63. platform_api_python_client/models/update_insight_status_request.py +106 -0
  64. platform_api_python_client/models/upsert_user_vault_item_request.py +1 -1
  65. platform_api_python_client/models/usage_availability.py +40 -0
  66. platform_api_python_client/models/usage_component.py +39 -0
  67. {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.37.1.dist-info}/METADATA +1 -1
  68. {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.37.1.dist-info}/RECORD +70 -41
  69. {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.37.1.dist-info}/WHEEL +1 -1
  70. {platform_api_python_client-4.31.0.dist-info → platform_api_python_client-4.37.1.dist-info}/top_level.txt +0 -0
@@ -18,44 +18,56 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from datetime import datetime
21
- from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
22
22
  from typing import Any, ClassVar, Dict, List, Optional
23
- from platform_api_python_client.models.c_serve_v2_recipe import CServeV2Recipe
23
+ from typing_extensions import Annotated
24
+ from platform_api_python_client.models.ccl_main_pools import CclMainPools
24
25
  from platform_api_python_client.models.deployment_status import DeploymentStatus
25
- from platform_api_python_client.models.deployment_type import DeploymentType
26
+ from platform_api_python_client.models.env import Env
27
+ from platform_api_python_client.models.image import Image
26
28
  from platform_api_python_client.models.volume_mount import VolumeMount
27
29
  from typing import Optional, Set
28
30
  from typing_extensions import Self
29
31
 
30
- class GetCServeV2DeploymentResponse(BaseModel):
32
+ class UnifiedGetComputeDeploymentResponse(BaseModel):
31
33
  """
32
- GetCServeV2DeploymentResponse
34
+ UnifiedGetComputeDeploymentResponse
33
35
  """ # noqa: E501
34
- creator_email: StrictStr
35
- cluster_id: StrictInt
36
36
  id: StrictInt
37
- name: StrictStr
38
- endpoint_url: StrictStr
39
- image_url: Optional[StrictStr] = None
40
- type: DeploymentType
41
37
  status: DeploymentStatus
38
+ creator_email: StrictStr
42
39
  created_at: datetime
43
- hardware_instance_id: StrictInt
40
+ updated_at: datetime
44
41
  revision_number: StrictInt
45
- chart_revision: Optional[StrictStr] = None
42
+ endpoint_url: Optional[StrictStr]
43
+ type: StrictStr
44
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=20)]
45
+ cluster_id: StrictInt
46
46
  user_annotations: Optional[Dict[str, StrictStr]] = None
47
- priority: Optional[StrictStr] = None
48
- volume_mounts: Optional[List[VolumeMount]] = None
49
- recipe: CServeV2Recipe
50
- cserve_version: Optional[StrictStr] = None
51
- min_scale: StrictInt
52
- max_scale: StrictInt
53
- initial_scale: Optional[StrictInt] = None
54
- endpoint_certificate_authority: Optional[StrictStr] = None
55
- endpoint_bearer_token: Optional[StrictStr] = None
56
- concurrency: Optional[StrictInt] = None
57
- env_vars: Optional[Dict[str, StrictStr]] = None
58
- __properties: ClassVar[List[str]] = ["creator_email", "cluster_id", "id", "name", "endpoint_url", "image_url", "type", "status", "created_at", "hardware_instance_id", "revision_number", "chart_revision", "user_annotations", "priority", "volume_mounts", "recipe", "cserve_version", "min_scale", "max_scale", "initial_scale", "endpoint_certificate_authority", "endpoint_bearer_token", "concurrency", "env_vars"]
47
+ chart_revision: Optional[StrictStr] = None
48
+ volume_mounts: Optional[Annotated[List[VolumeMount], Field(max_length=10)]] = None
49
+ priority: Optional[Annotated[str, Field(strict=True, max_length=253)]] = None
50
+ pools: CclMainPools
51
+ env: Optional[Env] = None
52
+ image: Image
53
+ ssh_public_key: Annotated[str, Field(min_length=1, strict=True)]
54
+ enable_logging: Optional[StrictBool] = False
55
+ exposed_port: StrictInt
56
+ __properties: ClassVar[List[str]] = ["id", "status", "creator_email", "created_at", "updated_at", "revision_number", "endpoint_url", "type", "name", "cluster_id", "user_annotations", "chart_revision", "volume_mounts", "priority", "pools", "env", "image", "ssh_public_key", "enable_logging", "exposed_port"]
57
+
58
+ @field_validator('type')
59
+ def type_validate_enum(cls, value):
60
+ """Validates the enum"""
61
+ if value not in set(['ccl_compute']):
62
+ raise ValueError("must be one of enum values ('ccl_compute')")
63
+ return value
64
+
65
+ @field_validator('name')
66
+ def name_validate_regular_expression(cls, value):
67
+ """Validates the regular expression"""
68
+ if not re.match(r"^[a-z][a-z0-9-]*$", value):
69
+ raise ValueError(r"must validate the regular expression /^[a-z][a-z0-9-]*$/")
70
+ return value
59
71
 
60
72
  model_config = ConfigDict(
61
73
  populate_by_name=True,
@@ -75,7 +87,7 @@ class GetCServeV2DeploymentResponse(BaseModel):
75
87
 
76
88
  @classmethod
77
89
  def from_json(cls, json_str: str) -> Optional[Self]:
78
- """Create an instance of GetCServeV2DeploymentResponse from a JSON string"""
90
+ """Create an instance of UnifiedGetComputeDeploymentResponse from a JSON string"""
79
91
  return cls.from_dict(json.loads(json_str))
80
92
 
81
93
  def to_dict(self) -> Dict[str, Any]:
@@ -103,18 +115,19 @@ class GetCServeV2DeploymentResponse(BaseModel):
103
115
  if _item_volume_mounts:
104
116
  _items.append(_item_volume_mounts.to_dict())
105
117
  _dict['volume_mounts'] = _items
106
- # override the default output from pydantic by calling `to_dict()` of recipe
107
- if self.recipe:
108
- _dict['recipe'] = self.recipe.to_dict()
109
- # set to None if image_url (nullable) is None
110
- # and model_fields_set contains the field
111
- if self.image_url is None and "image_url" in self.model_fields_set:
112
- _dict['image_url'] = None
113
-
114
- # set to None if chart_revision (nullable) is None
118
+ # override the default output from pydantic by calling `to_dict()` of pools
119
+ if self.pools:
120
+ _dict['pools'] = self.pools.to_dict()
121
+ # override the default output from pydantic by calling `to_dict()` of env
122
+ if self.env:
123
+ _dict['env'] = self.env.to_dict()
124
+ # override the default output from pydantic by calling `to_dict()` of image
125
+ if self.image:
126
+ _dict['image'] = self.image.to_dict()
127
+ # set to None if endpoint_url (nullable) is None
115
128
  # and model_fields_set contains the field
116
- if self.chart_revision is None and "chart_revision" in self.model_fields_set:
117
- _dict['chart_revision'] = None
129
+ if self.endpoint_url is None and "endpoint_url" in self.model_fields_set:
130
+ _dict['endpoint_url'] = None
118
131
 
119
132
  # set to None if user_annotations (nullable) is None
120
133
  # and model_fields_set contains the field
@@ -126,36 +139,11 @@ class GetCServeV2DeploymentResponse(BaseModel):
126
139
  if self.priority is None and "priority" in self.model_fields_set:
127
140
  _dict['priority'] = None
128
141
 
129
- # set to None if cserve_version (nullable) is None
130
- # and model_fields_set contains the field
131
- if self.cserve_version is None and "cserve_version" in self.model_fields_set:
132
- _dict['cserve_version'] = None
133
-
134
- # set to None if initial_scale (nullable) is None
135
- # and model_fields_set contains the field
136
- if self.initial_scale is None and "initial_scale" in self.model_fields_set:
137
- _dict['initial_scale'] = None
138
-
139
- # set to None if endpoint_certificate_authority (nullable) is None
140
- # and model_fields_set contains the field
141
- if self.endpoint_certificate_authority is None and "endpoint_certificate_authority" in self.model_fields_set:
142
- _dict['endpoint_certificate_authority'] = None
143
-
144
- # set to None if endpoint_bearer_token (nullable) is None
145
- # and model_fields_set contains the field
146
- if self.endpoint_bearer_token is None and "endpoint_bearer_token" in self.model_fields_set:
147
- _dict['endpoint_bearer_token'] = None
148
-
149
- # set to None if concurrency (nullable) is None
150
- # and model_fields_set contains the field
151
- if self.concurrency is None and "concurrency" in self.model_fields_set:
152
- _dict['concurrency'] = None
153
-
154
142
  return _dict
155
143
 
156
144
  @classmethod
157
145
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
158
- """Create an instance of GetCServeV2DeploymentResponse from a dict"""
146
+ """Create an instance of UnifiedGetComputeDeploymentResponse from a dict"""
159
147
  if obj is None:
160
148
  return None
161
149
 
@@ -163,30 +151,26 @@ class GetCServeV2DeploymentResponse(BaseModel):
163
151
  return cls.model_validate(obj)
164
152
 
165
153
  _obj = cls.model_validate({
166
- "creator_email": obj.get("creator_email"),
167
- "cluster_id": obj.get("cluster_id"),
168
154
  "id": obj.get("id"),
169
- "name": obj.get("name"),
170
- "endpoint_url": obj.get("endpoint_url"),
171
- "image_url": obj.get("image_url"),
172
- "type": obj.get("type"),
173
155
  "status": obj.get("status"),
156
+ "creator_email": obj.get("creator_email"),
174
157
  "created_at": obj.get("created_at"),
175
- "hardware_instance_id": obj.get("hardware_instance_id"),
158
+ "updated_at": obj.get("updated_at"),
176
159
  "revision_number": obj.get("revision_number"),
177
- "chart_revision": obj.get("chart_revision"),
160
+ "endpoint_url": obj.get("endpoint_url"),
161
+ "type": obj.get("type"),
162
+ "name": obj.get("name"),
163
+ "cluster_id": obj.get("cluster_id"),
178
164
  "user_annotations": obj.get("user_annotations"),
179
- "priority": obj.get("priority"),
165
+ "chart_revision": obj.get("chart_revision"),
180
166
  "volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None,
181
- "recipe": CServeV2Recipe.from_dict(obj["recipe"]) if obj.get("recipe") is not None else None,
182
- "cserve_version": obj.get("cserve_version"),
183
- "min_scale": obj.get("min_scale"),
184
- "max_scale": obj.get("max_scale"),
185
- "initial_scale": obj.get("initial_scale"),
186
- "endpoint_certificate_authority": obj.get("endpoint_certificate_authority"),
187
- "endpoint_bearer_token": obj.get("endpoint_bearer_token"),
188
- "concurrency": obj.get("concurrency"),
189
- "env_vars": obj.get("env_vars")
167
+ "priority": obj.get("priority"),
168
+ "pools": CclMainPools.from_dict(obj["pools"]) if obj.get("pools") is not None else None,
169
+ "env": Env.from_dict(obj["env"]) if obj.get("env") is not None else None,
170
+ "image": Image.from_dict(obj["image"]) if obj.get("image") is not None else None,
171
+ "ssh_public_key": obj.get("ssh_public_key"),
172
+ "enable_logging": obj.get("enable_logging") if obj.get("enable_logging") is not None else False,
173
+ "exposed_port": obj.get("exposed_port")
190
174
  })
191
175
  return _obj
192
176
 
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field
21
+ from typing import Any, ClassVar, Dict, List
22
+ from platform_api_python_client.models.deployment_log_event_v4 import DeploymentLogEventV4
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class UnifiedGetDeploymentLogsResponse(BaseModel):
27
+ """
28
+ UnifiedGetDeploymentLogsResponse
29
+ """ # noqa: E501
30
+ events: List[DeploymentLogEventV4] = Field(description="Log events, oldest first. Page boundaries are minted client-side from the events' timestamp field (see the endpoint description): an empty fetch_newer=false page means history is exhausted; an empty fetch_newer=true page means nothing new yet.")
31
+ __properties: ClassVar[List[str]] = ["events"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of UnifiedGetDeploymentLogsResponse from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of each item in events (list)
73
+ _items = []
74
+ if self.events:
75
+ for _item_events in self.events:
76
+ if _item_events:
77
+ _items.append(_item_events.to_dict())
78
+ _dict['events'] = _items
79
+ return _dict
80
+
81
+ @classmethod
82
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
+ """Create an instance of UnifiedGetDeploymentLogsResponse from a dict"""
84
+ if obj is None:
85
+ return None
86
+
87
+ if not isinstance(obj, dict):
88
+ return cls.model_validate(obj)
89
+
90
+ _obj = cls.model_validate({
91
+ "events": [DeploymentLogEventV4.from_dict(_item) for _item in obj["events"]] if obj.get("events") is not None else None
92
+ })
93
+ return _obj
94
+
95
+
@@ -17,20 +17,17 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from datetime import datetime
21
- from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
22
21
  from typing import Any, ClassVar, Dict, List
23
22
  from typing import Optional, Set
24
23
  from typing_extensions import Self
25
24
 
26
- class CreateCServeV3DeploymentResponse(BaseModel):
25
+ class UnifiedGetDeploymentPodsResponse(BaseModel):
27
26
  """
28
- CreateCServeV3DeploymentResponse
27
+ UnifiedGetDeploymentPodsResponse
29
28
  """ # noqa: E501
30
- id: StrictInt
31
- created_at: datetime
32
- endpoint_url: StrictStr
33
- __properties: ClassVar[List[str]] = ["id", "created_at", "endpoint_url"]
29
+ pods: List[StrictStr]
30
+ __properties: ClassVar[List[str]] = ["pods"]
34
31
 
35
32
  model_config = ConfigDict(
36
33
  populate_by_name=True,
@@ -50,7 +47,7 @@ class CreateCServeV3DeploymentResponse(BaseModel):
50
47
 
51
48
  @classmethod
52
49
  def from_json(cls, json_str: str) -> Optional[Self]:
53
- """Create an instance of CreateCServeV3DeploymentResponse from a JSON string"""
50
+ """Create an instance of UnifiedGetDeploymentPodsResponse from a JSON string"""
54
51
  return cls.from_dict(json.loads(json_str))
55
52
 
56
53
  def to_dict(self) -> Dict[str, Any]:
@@ -75,7 +72,7 @@ class CreateCServeV3DeploymentResponse(BaseModel):
75
72
 
76
73
  @classmethod
77
74
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
- """Create an instance of CreateCServeV3DeploymentResponse from a dict"""
75
+ """Create an instance of UnifiedGetDeploymentPodsResponse from a dict"""
79
76
  if obj is None:
80
77
  return None
81
78
 
@@ -83,9 +80,7 @@ class CreateCServeV3DeploymentResponse(BaseModel):
83
80
  return cls.model_validate(obj)
84
81
 
85
82
  _obj = cls.model_validate({
86
- "id": obj.get("id"),
87
- "created_at": obj.get("created_at"),
88
- "endpoint_url": obj.get("endpoint_url")
83
+ "pods": obj.get("pods")
89
84
  })
90
85
  return _obj
91
86
 
@@ -0,0 +1,164 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ from inspect import getfullargspec
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
21
+ from typing import Optional
22
+ from platform_api_python_client.models.unified_get_compute_deployment_response import UnifiedGetComputeDeploymentResponse
23
+ from platform_api_python_client.models.unified_get_dynamo_deployment_response import UnifiedGetDynamoDeploymentResponse
24
+ from platform_api_python_client.models.unified_get_inference_v3_deployment_response import UnifiedGetInferenceV3DeploymentResponse
25
+ from platform_api_python_client.models.unified_get_job_deployment_response import UnifiedGetJobDeploymentResponse
26
+ from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
27
+ from typing_extensions import Literal, Self
28
+ from pydantic import Field
29
+
30
+ UNIFIEDGETDEPLOYMENTRESPONSE_ANY_OF_SCHEMAS = ["UnifiedGetComputeDeploymentResponse", "UnifiedGetDynamoDeploymentResponse", "UnifiedGetInferenceV3DeploymentResponse", "UnifiedGetJobDeploymentResponse"]
31
+
32
+ class UnifiedGetDeploymentResponse(BaseModel):
33
+ """
34
+ UnifiedGetDeploymentResponse
35
+ """
36
+
37
+ # data type: UnifiedGetComputeDeploymentResponse
38
+ anyof_schema_1_validator: Optional[UnifiedGetComputeDeploymentResponse] = None
39
+ # data type: UnifiedGetInferenceV3DeploymentResponse
40
+ anyof_schema_2_validator: Optional[UnifiedGetInferenceV3DeploymentResponse] = None
41
+ # data type: UnifiedGetJobDeploymentResponse
42
+ anyof_schema_3_validator: Optional[UnifiedGetJobDeploymentResponse] = None
43
+ # data type: UnifiedGetDynamoDeploymentResponse
44
+ anyof_schema_4_validator: Optional[UnifiedGetDynamoDeploymentResponse] = None
45
+ if TYPE_CHECKING:
46
+ actual_instance: Optional[Union[UnifiedGetComputeDeploymentResponse, UnifiedGetDynamoDeploymentResponse, UnifiedGetInferenceV3DeploymentResponse, UnifiedGetJobDeploymentResponse]] = None
47
+ else:
48
+ actual_instance: Any = None
49
+ any_of_schemas: Set[str] = { "UnifiedGetComputeDeploymentResponse", "UnifiedGetDynamoDeploymentResponse", "UnifiedGetInferenceV3DeploymentResponse", "UnifiedGetJobDeploymentResponse" }
50
+
51
+ model_config = {
52
+ "validate_assignment": True,
53
+ "protected_namespaces": (),
54
+ }
55
+
56
+ def __init__(self, *args, **kwargs) -> None:
57
+ if args:
58
+ if len(args) > 1:
59
+ raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
60
+ if kwargs:
61
+ raise ValueError("If a position argument is used, keyword arguments cannot be used.")
62
+ super().__init__(actual_instance=args[0])
63
+ else:
64
+ super().__init__(**kwargs)
65
+
66
+ @field_validator('actual_instance')
67
+ def actual_instance_must_validate_anyof(cls, v):
68
+ instance = UnifiedGetDeploymentResponse.model_construct()
69
+ error_messages = []
70
+ # validate data type: UnifiedGetComputeDeploymentResponse
71
+ if not isinstance(v, UnifiedGetComputeDeploymentResponse):
72
+ error_messages.append(f"Error! Input type `{type(v)}` is not `UnifiedGetComputeDeploymentResponse`")
73
+ else:
74
+ return v
75
+
76
+ # validate data type: UnifiedGetInferenceV3DeploymentResponse
77
+ if not isinstance(v, UnifiedGetInferenceV3DeploymentResponse):
78
+ error_messages.append(f"Error! Input type `{type(v)}` is not `UnifiedGetInferenceV3DeploymentResponse`")
79
+ else:
80
+ return v
81
+
82
+ # validate data type: UnifiedGetJobDeploymentResponse
83
+ if not isinstance(v, UnifiedGetJobDeploymentResponse):
84
+ error_messages.append(f"Error! Input type `{type(v)}` is not `UnifiedGetJobDeploymentResponse`")
85
+ else:
86
+ return v
87
+
88
+ # validate data type: UnifiedGetDynamoDeploymentResponse
89
+ if not isinstance(v, UnifiedGetDynamoDeploymentResponse):
90
+ error_messages.append(f"Error! Input type `{type(v)}` is not `UnifiedGetDynamoDeploymentResponse`")
91
+ else:
92
+ return v
93
+
94
+ if error_messages:
95
+ # no match
96
+ raise ValueError("No match found when setting the actual_instance in UnifiedGetDeploymentResponse with anyOf schemas: UnifiedGetComputeDeploymentResponse, UnifiedGetDynamoDeploymentResponse, UnifiedGetInferenceV3DeploymentResponse, UnifiedGetJobDeploymentResponse. Details: " + ", ".join(error_messages))
97
+ else:
98
+ return v
99
+
100
+ @classmethod
101
+ def from_dict(cls, obj: Dict[str, Any]) -> Self:
102
+ return cls.from_json(json.dumps(obj))
103
+
104
+ @classmethod
105
+ def from_json(cls, json_str: str) -> Self:
106
+ """Returns the object represented by the json string"""
107
+ instance = cls.model_construct()
108
+ error_messages = []
109
+ # anyof_schema_1_validator: Optional[UnifiedGetComputeDeploymentResponse] = None
110
+ try:
111
+ instance.actual_instance = UnifiedGetComputeDeploymentResponse.from_json(json_str)
112
+ return instance
113
+ except (ValidationError, ValueError) as e:
114
+ error_messages.append(str(e))
115
+ # anyof_schema_2_validator: Optional[UnifiedGetInferenceV3DeploymentResponse] = None
116
+ try:
117
+ instance.actual_instance = UnifiedGetInferenceV3DeploymentResponse.from_json(json_str)
118
+ return instance
119
+ except (ValidationError, ValueError) as e:
120
+ error_messages.append(str(e))
121
+ # anyof_schema_3_validator: Optional[UnifiedGetJobDeploymentResponse] = None
122
+ try:
123
+ instance.actual_instance = UnifiedGetJobDeploymentResponse.from_json(json_str)
124
+ return instance
125
+ except (ValidationError, ValueError) as e:
126
+ error_messages.append(str(e))
127
+ # anyof_schema_4_validator: Optional[UnifiedGetDynamoDeploymentResponse] = None
128
+ try:
129
+ instance.actual_instance = UnifiedGetDynamoDeploymentResponse.from_json(json_str)
130
+ return instance
131
+ except (ValidationError, ValueError) as e:
132
+ error_messages.append(str(e))
133
+
134
+ if error_messages:
135
+ # no match
136
+ raise ValueError("No match found when deserializing the JSON string into UnifiedGetDeploymentResponse with anyOf schemas: UnifiedGetComputeDeploymentResponse, UnifiedGetDynamoDeploymentResponse, UnifiedGetInferenceV3DeploymentResponse, UnifiedGetJobDeploymentResponse. Details: " + ", ".join(error_messages))
137
+ else:
138
+ return instance
139
+
140
+ def to_json(self) -> str:
141
+ """Returns the JSON representation of the actual instance"""
142
+ if self.actual_instance is None:
143
+ return "null"
144
+
145
+ if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
146
+ return self.actual_instance.to_json()
147
+ else:
148
+ return json.dumps(self.actual_instance)
149
+
150
+ def to_dict(self) -> Optional[Union[Dict[str, Any], UnifiedGetComputeDeploymentResponse, UnifiedGetDynamoDeploymentResponse, UnifiedGetInferenceV3DeploymentResponse, UnifiedGetJobDeploymentResponse]]:
151
+ """Returns the dict representation of the actual instance"""
152
+ if self.actual_instance is None:
153
+ return None
154
+
155
+ if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
156
+ return self.actual_instance.to_dict()
157
+ else:
158
+ return self.actual_instance
159
+
160
+ def to_str(self) -> str:
161
+ """Returns the string representation of the actual instance"""
162
+ return pprint.pformat(self.model_dump())
163
+
164
+
@@ -0,0 +1,109 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Platform External API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
+ from typing import Any, ClassVar, Dict, List, Optional
23
+ from platform_api_python_client.models.unified_get_deployment_response import UnifiedGetDeploymentResponse
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+
27
+ class UnifiedGetDeploymentRevisionResponse(BaseModel):
28
+ """
29
+ UnifiedGetDeploymentRevisionResponse
30
+ """ # noqa: E501
31
+ id: StrictInt
32
+ revision_number: StrictInt
33
+ deployment_id: StrictInt
34
+ deployment_response: UnifiedGetDeploymentResponse
35
+ notes: Optional[StrictStr] = None
36
+ created_at: datetime
37
+ updated_at: datetime
38
+ __properties: ClassVar[List[str]] = ["id", "revision_number", "deployment_id", "deployment_response", "notes", "created_at", "updated_at"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+
47
+ def to_str(self) -> str:
48
+ """Returns the string representation of the model using alias"""
49
+ return pprint.pformat(self.model_dump(by_alias=True))
50
+
51
+ def to_json(self) -> str:
52
+ """Returns the JSON representation of the model using alias"""
53
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
54
+ return json.dumps(self.to_dict())
55
+
56
+ @classmethod
57
+ def from_json(cls, json_str: str) -> Optional[Self]:
58
+ """Create an instance of UnifiedGetDeploymentRevisionResponse from a JSON string"""
59
+ return cls.from_dict(json.loads(json_str))
60
+
61
+ def to_dict(self) -> Dict[str, Any]:
62
+ """Return the dictionary representation of the model using alias.
63
+
64
+ This has the following differences from calling pydantic's
65
+ `self.model_dump(by_alias=True)`:
66
+
67
+ * `None` is only added to the output dict for nullable fields that
68
+ were set at model initialization. Other fields with value `None`
69
+ are ignored.
70
+ """
71
+ excluded_fields: Set[str] = set([
72
+ ])
73
+
74
+ _dict = self.model_dump(
75
+ by_alias=True,
76
+ exclude=excluded_fields,
77
+ exclude_none=True,
78
+ )
79
+ # override the default output from pydantic by calling `to_dict()` of deployment_response
80
+ if self.deployment_response:
81
+ _dict['deployment_response'] = self.deployment_response.to_dict()
82
+ # set to None if notes (nullable) is None
83
+ # and model_fields_set contains the field
84
+ if self.notes is None and "notes" in self.model_fields_set:
85
+ _dict['notes'] = None
86
+
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of UnifiedGetDeploymentRevisionResponse from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate({
99
+ "id": obj.get("id"),
100
+ "revision_number": obj.get("revision_number"),
101
+ "deployment_id": obj.get("deployment_id"),
102
+ "deployment_response": UnifiedGetDeploymentResponse.from_dict(obj["deployment_response"]) if obj.get("deployment_response") is not None else None,
103
+ "notes": obj.get("notes"),
104
+ "created_at": obj.get("created_at"),
105
+ "updated_at": obj.get("updated_at")
106
+ })
107
+ return _obj
108
+
109
+