platform-api-python-client 4.28.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 (79) hide show
  1. platform_api_python_client/__init__.py +43 -10
  2. platform_api_python_client/api/external_api.py +6332 -1348
  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 +42 -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/cloud_provider.py +5 -0
  9. platform_api_python_client/models/cluster_credential.py +2 -2
  10. platform_api_python_client/models/create_compute_deployment_request.py +40 -7
  11. platform_api_python_client/models/create_dynamo_deployment_request.py +97 -6
  12. platform_api_python_client/models/create_inference_v3_deployment_request.py +59 -2
  13. platform_api_python_client/models/create_job_deployment_request.py +43 -10
  14. platform_api_python_client/models/create_object_volume_request.py +19 -19
  15. platform_api_python_client/models/deployment_response.py +23 -23
  16. platform_api_python_client/models/deployment_type.py +14 -0
  17. platform_api_python_client/models/{c_serve_recipe_perf.py → dynamo_communications_input.py} +12 -19
  18. platform_api_python_client/models/dynamo_communications_output.py +91 -0
  19. platform_api_python_client/models/dynamo_image.py +105 -0
  20. platform_api_python_client/models/dynamo_kv_transfer_configuration.py +88 -0
  21. platform_api_python_client/models/dynamo_kv_transfer_policy.py +37 -0
  22. platform_api_python_client/models/dynamo_weight_transfer_configuration.py +88 -0
  23. platform_api_python_client/models/dynamo_weight_transfer_policy.py +36 -0
  24. platform_api_python_client/models/dynamo_worker_pool_config.py +37 -17
  25. platform_api_python_client/models/dynamo_worker_pools.py +23 -16
  26. platform_api_python_client/models/env.py +89 -0
  27. platform_api_python_client/models/get_cluster_response.py +4 -2
  28. platform_api_python_client/models/get_compute_deployment_response.py +45 -4
  29. platform_api_python_client/models/get_deployment_response.py +26 -2
  30. platform_api_python_client/models/get_deployment_usage_response.py +19 -4
  31. platform_api_python_client/models/get_dynamo_deployment_response.py +89 -5
  32. platform_api_python_client/models/get_inference_deployment_response.py +25 -1
  33. platform_api_python_client/models/get_inference_v3_deployment_response.py +67 -2
  34. platform_api_python_client/models/get_job_deployment_response.py +52 -11
  35. platform_api_python_client/models/get_object_volume_response.py +2 -16
  36. platform_api_python_client/models/hardware_instance_response.py +6 -4
  37. platform_api_python_client/models/image.py +112 -0
  38. platform_api_python_client/models/ingress.py +103 -0
  39. platform_api_python_client/models/insight_list_item_response.py +108 -0
  40. platform_api_python_client/models/insight_resource.py +97 -0
  41. platform_api_python_client/models/insight_resource_type.py +37 -0
  42. platform_api_python_client/models/insight_response.py +133 -0
  43. platform_api_python_client/models/insight_severity.py +40 -0
  44. platform_api_python_client/models/insight_status.py +39 -0
  45. platform_api_python_client/models/{c_serve_recipe_response.py → insight_status_change_response.py} +28 -24
  46. platform_api_python_client/models/list_insights_response.py +95 -0
  47. platform_api_python_client/models/metric.py +13 -0
  48. platform_api_python_client/models/pool.py +116 -0
  49. platform_api_python_client/models/unified_get_compute_deployment_response.py +177 -0
  50. platform_api_python_client/models/unified_get_deployment_logs_response.py +95 -0
  51. platform_api_python_client/models/{create_c_serve_v3_deployment_response.py → unified_get_deployment_pods_response.py} +8 -13
  52. platform_api_python_client/models/unified_get_deployment_response.py +164 -0
  53. platform_api_python_client/models/unified_get_deployment_revision_response.py +109 -0
  54. platform_api_python_client/models/unified_get_deployment_rollout_response.py +90 -0
  55. platform_api_python_client/models/unified_get_deployment_usage_response.py +110 -0
  56. platform_api_python_client/models/unified_get_dynamo_deployment_response.py +218 -0
  57. platform_api_python_client/models/unified_get_inference_v3_deployment_response.py +228 -0
  58. platform_api_python_client/models/unified_get_job_deployment_response.py +204 -0
  59. platform_api_python_client/models/{list_c_serve_recipe_response.py → unified_list_deployment_revisions_response.py} +7 -7
  60. platform_api_python_client/models/unified_update_deployment_rollout_request.py +87 -0
  61. platform_api_python_client/models/unified_write_compute_deployment_request.py +154 -0
  62. platform_api_python_client/models/unified_write_deployment_request.py +164 -0
  63. platform_api_python_client/models/{c_serve_v2_recipe.py → unified_write_deployment_response.py} +27 -27
  64. platform_api_python_client/models/unified_write_dynamo_deployment_request.py +197 -0
  65. platform_api_python_client/models/unified_write_inference_v3_deployment_request.py +207 -0
  66. platform_api_python_client/models/unified_write_job_deployment_request.py +183 -0
  67. platform_api_python_client/models/update_insight_status_request.py +106 -0
  68. platform_api_python_client/models/upsert_user_vault_item_request.py +1 -1
  69. platform_api_python_client/models/usage_availability.py +40 -0
  70. platform_api_python_client/models/usage_component.py +39 -0
  71. platform_api_python_client/models/validation_error.py +12 -3
  72. platform_api_python_client/models/volume_mount.py +1 -1
  73. {platform_api_python_client-4.28.0.dist-info → platform_api_python_client-4.37.1.dist-info}/METADATA +1 -1
  74. {platform_api_python_client-4.28.0.dist-info → platform_api_python_client-4.37.1.dist-info}/RECORD +76 -43
  75. {platform_api_python_client-4.28.0.dist-info → platform_api_python_client-4.37.1.dist-info}/WHEEL +1 -1
  76. platform_api_python_client/models/create_c_serve_v3_deployment_request.py +0 -182
  77. platform_api_python_client/models/get_c_serve_v2_deployment_response.py +0 -169
  78. platform_api_python_client/models/get_c_serve_v3_deployment_response.py +0 -170
  79. {platform_api_python_client-4.28.0.dist-info → platform_api_python_client-4.37.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,197 @@
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, StrictBool, StrictInt, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from platform_api_python_client.models.ccl_dynamo_pools import CclDynamoPools
24
+ from platform_api_python_client.models.dynamo_communications_input import DynamoCommunicationsInput
25
+ from platform_api_python_client.models.dynamo_image import DynamoImage
26
+ from platform_api_python_client.models.dynamo_serving_mode import DynamoServingMode
27
+ from platform_api_python_client.models.env import Env
28
+ from platform_api_python_client.models.ingress import Ingress
29
+ from platform_api_python_client.models.volume_mount import VolumeMount
30
+ from typing import Optional, Set
31
+ from typing_extensions import Self
32
+
33
+ class UnifiedWriteDynamoDeploymentRequest(BaseModel):
34
+ """
35
+ UnifiedWriteDynamoDeploymentRequest
36
+ """ # noqa: E501
37
+ type: StrictStr
38
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=20)]
39
+ cluster_id: StrictInt
40
+ user_annotations: Optional[Dict[str, StrictStr]] = None
41
+ chart_revision: Optional[StrictStr] = None
42
+ volume_mounts: Optional[Annotated[List[VolumeMount], Field(max_length=10)]] = None
43
+ priority: Optional[Annotated[str, Field(strict=True, max_length=253)]] = None
44
+ pools: CclDynamoPools
45
+ env: Optional[Env] = None
46
+ image: Optional[DynamoImage] = None
47
+ ingress: Ingress
48
+ serving_mode: Optional[DynamoServingMode] = None
49
+ communications: Optional[DynamoCommunicationsInput] = None
50
+ model: StrictStr
51
+ served_model_name: Optional[StrictStr] = None
52
+ extra_args: Optional[StrictStr] = None
53
+ hf_token_ref: Optional[Annotated[int, Field(strict=True, ge=1)]] = None
54
+ enable_logging: Optional[StrictBool] = True
55
+ enable_node_model_cache: Optional[StrictBool] = False
56
+ __properties: ClassVar[List[str]] = ["type", "name", "cluster_id", "user_annotations", "chart_revision", "volume_mounts", "priority", "pools", "env", "image", "ingress", "serving_mode", "communications", "model", "served_model_name", "extra_args", "hf_token_ref", "enable_logging", "enable_node_model_cache"]
57
+
58
+ @field_validator('type')
59
+ def type_validate_enum(cls, value):
60
+ """Validates the enum"""
61
+ if value not in set(['ccl_dynamo']):
62
+ raise ValueError("must be one of enum values ('ccl_dynamo')")
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
71
+
72
+ model_config = ConfigDict(
73
+ populate_by_name=True,
74
+ validate_assignment=True,
75
+ protected_namespaces=(),
76
+ )
77
+
78
+
79
+ def to_str(self) -> str:
80
+ """Returns the string representation of the model using alias"""
81
+ return pprint.pformat(self.model_dump(by_alias=True))
82
+
83
+ def to_json(self) -> str:
84
+ """Returns the JSON representation of the model using alias"""
85
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
86
+ return json.dumps(self.to_dict())
87
+
88
+ @classmethod
89
+ def from_json(cls, json_str: str) -> Optional[Self]:
90
+ """Create an instance of UnifiedWriteDynamoDeploymentRequest from a JSON string"""
91
+ return cls.from_dict(json.loads(json_str))
92
+
93
+ def to_dict(self) -> Dict[str, Any]:
94
+ """Return the dictionary representation of the model using alias.
95
+
96
+ This has the following differences from calling pydantic's
97
+ `self.model_dump(by_alias=True)`:
98
+
99
+ * `None` is only added to the output dict for nullable fields that
100
+ were set at model initialization. Other fields with value `None`
101
+ are ignored.
102
+ """
103
+ excluded_fields: Set[str] = set([
104
+ ])
105
+
106
+ _dict = self.model_dump(
107
+ by_alias=True,
108
+ exclude=excluded_fields,
109
+ exclude_none=True,
110
+ )
111
+ # override the default output from pydantic by calling `to_dict()` of each item in volume_mounts (list)
112
+ _items = []
113
+ if self.volume_mounts:
114
+ for _item_volume_mounts in self.volume_mounts:
115
+ if _item_volume_mounts:
116
+ _items.append(_item_volume_mounts.to_dict())
117
+ _dict['volume_mounts'] = _items
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
+ # override the default output from pydantic by calling `to_dict()` of ingress
128
+ if self.ingress:
129
+ _dict['ingress'] = self.ingress.to_dict()
130
+ # override the default output from pydantic by calling `to_dict()` of communications
131
+ if self.communications:
132
+ _dict['communications'] = self.communications.to_dict()
133
+ # set to None if user_annotations (nullable) is None
134
+ # and model_fields_set contains the field
135
+ if self.user_annotations is None and "user_annotations" in self.model_fields_set:
136
+ _dict['user_annotations'] = None
137
+
138
+ # set to None if priority (nullable) is None
139
+ # and model_fields_set contains the field
140
+ if self.priority is None and "priority" in self.model_fields_set:
141
+ _dict['priority'] = None
142
+
143
+ # set to None if communications (nullable) is None
144
+ # and model_fields_set contains the field
145
+ if self.communications is None and "communications" in self.model_fields_set:
146
+ _dict['communications'] = None
147
+
148
+ # set to None if served_model_name (nullable) is None
149
+ # and model_fields_set contains the field
150
+ if self.served_model_name is None and "served_model_name" in self.model_fields_set:
151
+ _dict['served_model_name'] = None
152
+
153
+ # set to None if extra_args (nullable) is None
154
+ # and model_fields_set contains the field
155
+ if self.extra_args is None and "extra_args" in self.model_fields_set:
156
+ _dict['extra_args'] = None
157
+
158
+ # set to None if hf_token_ref (nullable) is None
159
+ # and model_fields_set contains the field
160
+ if self.hf_token_ref is None and "hf_token_ref" in self.model_fields_set:
161
+ _dict['hf_token_ref'] = None
162
+
163
+ return _dict
164
+
165
+ @classmethod
166
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
167
+ """Create an instance of UnifiedWriteDynamoDeploymentRequest from a dict"""
168
+ if obj is None:
169
+ return None
170
+
171
+ if not isinstance(obj, dict):
172
+ return cls.model_validate(obj)
173
+
174
+ _obj = cls.model_validate({
175
+ "type": obj.get("type"),
176
+ "name": obj.get("name"),
177
+ "cluster_id": obj.get("cluster_id"),
178
+ "user_annotations": obj.get("user_annotations"),
179
+ "chart_revision": obj.get("chart_revision"),
180
+ "volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None,
181
+ "priority": obj.get("priority"),
182
+ "pools": CclDynamoPools.from_dict(obj["pools"]) if obj.get("pools") is not None else None,
183
+ "env": Env.from_dict(obj["env"]) if obj.get("env") is not None else None,
184
+ "image": DynamoImage.from_dict(obj["image"]) if obj.get("image") is not None else None,
185
+ "ingress": Ingress.from_dict(obj["ingress"]) if obj.get("ingress") is not None else None,
186
+ "serving_mode": obj.get("serving_mode"),
187
+ "communications": DynamoCommunicationsInput.from_dict(obj["communications"]) if obj.get("communications") is not None else None,
188
+ "model": obj.get("model"),
189
+ "served_model_name": obj.get("served_model_name"),
190
+ "extra_args": obj.get("extra_args"),
191
+ "hf_token_ref": obj.get("hf_token_ref"),
192
+ "enable_logging": obj.get("enable_logging") if obj.get("enable_logging") is not None else True,
193
+ "enable_node_model_cache": obj.get("enable_node_model_cache") if obj.get("enable_node_model_cache") is not None else False
194
+ })
195
+ return _obj
196
+
197
+
@@ -0,0 +1,207 @@
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, StrictBool, StrictInt, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from platform_api_python_client.models.ccl_main_pools import CclMainPools
24
+ from platform_api_python_client.models.config_file_mount import ConfigFileMount
25
+ from platform_api_python_client.models.env import Env
26
+ from platform_api_python_client.models.image import Image
27
+ from platform_api_python_client.models.ingress import Ingress
28
+ from platform_api_python_client.models.metrics_config import MetricsConfig
29
+ from platform_api_python_client.models.volume_mount import VolumeMount
30
+ from typing import Optional, Set
31
+ from typing_extensions import Self
32
+
33
+ class UnifiedWriteInferenceV3DeploymentRequest(BaseModel):
34
+ """
35
+ UnifiedWriteInferenceV3DeploymentRequest
36
+ """ # noqa: E501
37
+ type: StrictStr
38
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=20)]
39
+ cluster_id: StrictInt
40
+ user_annotations: Optional[Dict[str, StrictStr]] = None
41
+ chart_revision: Optional[StrictStr] = None
42
+ volume_mounts: Optional[Annotated[List[VolumeMount], Field(max_length=10)]] = None
43
+ priority: Optional[Annotated[str, Field(strict=True, max_length=253)]] = None
44
+ pools: CclMainPools
45
+ env: Optional[Env] = None
46
+ image: Image
47
+ ingress: Ingress
48
+ port: Annotated[int, Field(le=65535, strict=True, ge=1)]
49
+ healthcheck: Optional[StrictStr] = None
50
+ command: Optional[StrictStr] = None
51
+ config_file: Optional[ConfigFileMount] = None
52
+ hf_token_ref: Optional[Annotated[int, Field(strict=True, ge=1)]] = None
53
+ session_affinity: Optional[StrictBool] = Field(default=False, description="Enable best-effort sticky routing via the `X-Session-Id` request header. Requests carrying the same header value land on the same pod, improving KV cache reuse for agentic workloads. Requests without the header are routed at random. Affinity is NOT durable: scaling, rollouts, restarts, or readiness-probe transitions will remap sessions to different pods. Do not use for irreplaceable in-pod state.")
54
+ metrics: Optional[MetricsConfig] = None
55
+ enable_logging: Optional[StrictBool] = False
56
+ enable_node_model_cache: Optional[StrictBool] = False
57
+ __properties: ClassVar[List[str]] = ["type", "name", "cluster_id", "user_annotations", "chart_revision", "volume_mounts", "priority", "pools", "env", "image", "ingress", "port", "healthcheck", "command", "config_file", "hf_token_ref", "session_affinity", "metrics", "enable_logging", "enable_node_model_cache"]
58
+
59
+ @field_validator('type')
60
+ def type_validate_enum(cls, value):
61
+ """Validates the enum"""
62
+ if value not in set(['ccl_inference']):
63
+ raise ValueError("must be one of enum values ('ccl_inference')")
64
+ return value
65
+
66
+ @field_validator('name')
67
+ def name_validate_regular_expression(cls, value):
68
+ """Validates the regular expression"""
69
+ if not re.match(r"^[a-z][a-z0-9-]*$", value):
70
+ raise ValueError(r"must validate the regular expression /^[a-z][a-z0-9-]*$/")
71
+ return value
72
+
73
+ model_config = ConfigDict(
74
+ populate_by_name=True,
75
+ validate_assignment=True,
76
+ protected_namespaces=(),
77
+ )
78
+
79
+
80
+ def to_str(self) -> str:
81
+ """Returns the string representation of the model using alias"""
82
+ return pprint.pformat(self.model_dump(by_alias=True))
83
+
84
+ def to_json(self) -> str:
85
+ """Returns the JSON representation of the model using alias"""
86
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
87
+ return json.dumps(self.to_dict())
88
+
89
+ @classmethod
90
+ def from_json(cls, json_str: str) -> Optional[Self]:
91
+ """Create an instance of UnifiedWriteInferenceV3DeploymentRequest from a JSON string"""
92
+ return cls.from_dict(json.loads(json_str))
93
+
94
+ def to_dict(self) -> Dict[str, Any]:
95
+ """Return the dictionary representation of the model using alias.
96
+
97
+ This has the following differences from calling pydantic's
98
+ `self.model_dump(by_alias=True)`:
99
+
100
+ * `None` is only added to the output dict for nullable fields that
101
+ were set at model initialization. Other fields with value `None`
102
+ are ignored.
103
+ """
104
+ excluded_fields: Set[str] = set([
105
+ ])
106
+
107
+ _dict = self.model_dump(
108
+ by_alias=True,
109
+ exclude=excluded_fields,
110
+ exclude_none=True,
111
+ )
112
+ # override the default output from pydantic by calling `to_dict()` of each item in volume_mounts (list)
113
+ _items = []
114
+ if self.volume_mounts:
115
+ for _item_volume_mounts in self.volume_mounts:
116
+ if _item_volume_mounts:
117
+ _items.append(_item_volume_mounts.to_dict())
118
+ _dict['volume_mounts'] = _items
119
+ # override the default output from pydantic by calling `to_dict()` of pools
120
+ if self.pools:
121
+ _dict['pools'] = self.pools.to_dict()
122
+ # override the default output from pydantic by calling `to_dict()` of env
123
+ if self.env:
124
+ _dict['env'] = self.env.to_dict()
125
+ # override the default output from pydantic by calling `to_dict()` of image
126
+ if self.image:
127
+ _dict['image'] = self.image.to_dict()
128
+ # override the default output from pydantic by calling `to_dict()` of ingress
129
+ if self.ingress:
130
+ _dict['ingress'] = self.ingress.to_dict()
131
+ # override the default output from pydantic by calling `to_dict()` of config_file
132
+ if self.config_file:
133
+ _dict['config_file'] = self.config_file.to_dict()
134
+ # override the default output from pydantic by calling `to_dict()` of metrics
135
+ if self.metrics:
136
+ _dict['metrics'] = self.metrics.to_dict()
137
+ # set to None if user_annotations (nullable) is None
138
+ # and model_fields_set contains the field
139
+ if self.user_annotations is None and "user_annotations" in self.model_fields_set:
140
+ _dict['user_annotations'] = None
141
+
142
+ # set to None if priority (nullable) is None
143
+ # and model_fields_set contains the field
144
+ if self.priority is None and "priority" in self.model_fields_set:
145
+ _dict['priority'] = None
146
+
147
+ # set to None if healthcheck (nullable) is None
148
+ # and model_fields_set contains the field
149
+ if self.healthcheck is None and "healthcheck" in self.model_fields_set:
150
+ _dict['healthcheck'] = None
151
+
152
+ # set to None if command (nullable) is None
153
+ # and model_fields_set contains the field
154
+ if self.command is None and "command" in self.model_fields_set:
155
+ _dict['command'] = None
156
+
157
+ # set to None if config_file (nullable) is None
158
+ # and model_fields_set contains the field
159
+ if self.config_file is None and "config_file" in self.model_fields_set:
160
+ _dict['config_file'] = None
161
+
162
+ # set to None if hf_token_ref (nullable) is None
163
+ # and model_fields_set contains the field
164
+ if self.hf_token_ref is None and "hf_token_ref" in self.model_fields_set:
165
+ _dict['hf_token_ref'] = None
166
+
167
+ # set to None if metrics (nullable) is None
168
+ # and model_fields_set contains the field
169
+ if self.metrics is None and "metrics" in self.model_fields_set:
170
+ _dict['metrics'] = None
171
+
172
+ return _dict
173
+
174
+ @classmethod
175
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
176
+ """Create an instance of UnifiedWriteInferenceV3DeploymentRequest from a dict"""
177
+ if obj is None:
178
+ return None
179
+
180
+ if not isinstance(obj, dict):
181
+ return cls.model_validate(obj)
182
+
183
+ _obj = cls.model_validate({
184
+ "type": obj.get("type"),
185
+ "name": obj.get("name"),
186
+ "cluster_id": obj.get("cluster_id"),
187
+ "user_annotations": obj.get("user_annotations"),
188
+ "chart_revision": obj.get("chart_revision"),
189
+ "volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None,
190
+ "priority": obj.get("priority"),
191
+ "pools": CclMainPools.from_dict(obj["pools"]) if obj.get("pools") is not None else None,
192
+ "env": Env.from_dict(obj["env"]) if obj.get("env") is not None else None,
193
+ "image": Image.from_dict(obj["image"]) if obj.get("image") is not None else None,
194
+ "ingress": Ingress.from_dict(obj["ingress"]) if obj.get("ingress") is not None else None,
195
+ "port": obj.get("port"),
196
+ "healthcheck": obj.get("healthcheck"),
197
+ "command": obj.get("command"),
198
+ "config_file": ConfigFileMount.from_dict(obj["config_file"]) if obj.get("config_file") is not None else None,
199
+ "hf_token_ref": obj.get("hf_token_ref"),
200
+ "session_affinity": obj.get("session_affinity") if obj.get("session_affinity") is not None else False,
201
+ "metrics": MetricsConfig.from_dict(obj["metrics"]) if obj.get("metrics") is not None else None,
202
+ "enable_logging": obj.get("enable_logging") if obj.get("enable_logging") is not None else False,
203
+ "enable_node_model_cache": obj.get("enable_node_model_cache") if obj.get("enable_node_model_cache") is not None else False
204
+ })
205
+ return _obj
206
+
207
+
@@ -0,0 +1,183 @@
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, StrictBool, StrictInt, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from platform_api_python_client.models.ccl_main_pools import CclMainPools
24
+ from platform_api_python_client.models.config_file_mount import ConfigFileMount
25
+ from platform_api_python_client.models.env import Env
26
+ from platform_api_python_client.models.image import Image
27
+ from platform_api_python_client.models.volume_mount import VolumeMount
28
+ from typing import Optional, Set
29
+ from typing_extensions import Self
30
+
31
+ class UnifiedWriteJobDeploymentRequest(BaseModel):
32
+ """
33
+ UnifiedWriteJobDeploymentRequest
34
+ """ # noqa: E501
35
+ type: StrictStr
36
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=20)]
37
+ cluster_id: StrictInt
38
+ user_annotations: Optional[Dict[str, StrictStr]] = None
39
+ chart_revision: Optional[StrictStr] = None
40
+ volume_mounts: Optional[Annotated[List[VolumeMount], Field(max_length=10)]] = None
41
+ priority: Optional[Annotated[str, Field(strict=True, max_length=253)]] = None
42
+ pools: CclMainPools
43
+ env: Optional[Env] = None
44
+ image: Image
45
+ command: Optional[StrictStr] = None
46
+ config_file: Optional[ConfigFileMount] = None
47
+ completions: Optional[Annotated[int, Field(strict=True, ge=1)]] = 1
48
+ parallelism: Optional[Annotated[int, Field(strict=True, ge=1)]] = 1
49
+ backoff_limit: Optional[Annotated[int, Field(strict=True, ge=0)]] = 3
50
+ active_deadline_seconds: Optional[Annotated[int, Field(strict=True, ge=1)]] = None
51
+ enable_logging: Optional[StrictBool] = True
52
+ __properties: ClassVar[List[str]] = ["type", "name", "cluster_id", "user_annotations", "chart_revision", "volume_mounts", "priority", "pools", "env", "image", "command", "config_file", "completions", "parallelism", "backoff_limit", "active_deadline_seconds", "enable_logging"]
53
+
54
+ @field_validator('type')
55
+ def type_validate_enum(cls, value):
56
+ """Validates the enum"""
57
+ if value not in set(['ccl_job']):
58
+ raise ValueError("must be one of enum values ('ccl_job')")
59
+ return value
60
+
61
+ @field_validator('name')
62
+ def name_validate_regular_expression(cls, value):
63
+ """Validates the regular expression"""
64
+ if not re.match(r"^[a-z][a-z0-9-]*$", value):
65
+ raise ValueError(r"must validate the regular expression /^[a-z][a-z0-9-]*$/")
66
+ return value
67
+
68
+ model_config = ConfigDict(
69
+ populate_by_name=True,
70
+ validate_assignment=True,
71
+ protected_namespaces=(),
72
+ )
73
+
74
+
75
+ def to_str(self) -> str:
76
+ """Returns the string representation of the model using alias"""
77
+ return pprint.pformat(self.model_dump(by_alias=True))
78
+
79
+ def to_json(self) -> str:
80
+ """Returns the JSON representation of the model using alias"""
81
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
82
+ return json.dumps(self.to_dict())
83
+
84
+ @classmethod
85
+ def from_json(cls, json_str: str) -> Optional[Self]:
86
+ """Create an instance of UnifiedWriteJobDeploymentRequest from a JSON string"""
87
+ return cls.from_dict(json.loads(json_str))
88
+
89
+ def to_dict(self) -> Dict[str, Any]:
90
+ """Return the dictionary representation of the model using alias.
91
+
92
+ This has the following differences from calling pydantic's
93
+ `self.model_dump(by_alias=True)`:
94
+
95
+ * `None` is only added to the output dict for nullable fields that
96
+ were set at model initialization. Other fields with value `None`
97
+ are ignored.
98
+ """
99
+ excluded_fields: Set[str] = set([
100
+ ])
101
+
102
+ _dict = self.model_dump(
103
+ by_alias=True,
104
+ exclude=excluded_fields,
105
+ exclude_none=True,
106
+ )
107
+ # override the default output from pydantic by calling `to_dict()` of each item in volume_mounts (list)
108
+ _items = []
109
+ if self.volume_mounts:
110
+ for _item_volume_mounts in self.volume_mounts:
111
+ if _item_volume_mounts:
112
+ _items.append(_item_volume_mounts.to_dict())
113
+ _dict['volume_mounts'] = _items
114
+ # override the default output from pydantic by calling `to_dict()` of pools
115
+ if self.pools:
116
+ _dict['pools'] = self.pools.to_dict()
117
+ # override the default output from pydantic by calling `to_dict()` of env
118
+ if self.env:
119
+ _dict['env'] = self.env.to_dict()
120
+ # override the default output from pydantic by calling `to_dict()` of image
121
+ if self.image:
122
+ _dict['image'] = self.image.to_dict()
123
+ # override the default output from pydantic by calling `to_dict()` of config_file
124
+ if self.config_file:
125
+ _dict['config_file'] = self.config_file.to_dict()
126
+ # set to None if user_annotations (nullable) is None
127
+ # and model_fields_set contains the field
128
+ if self.user_annotations is None and "user_annotations" in self.model_fields_set:
129
+ _dict['user_annotations'] = None
130
+
131
+ # set to None if priority (nullable) is None
132
+ # and model_fields_set contains the field
133
+ if self.priority is None and "priority" in self.model_fields_set:
134
+ _dict['priority'] = None
135
+
136
+ # set to None if command (nullable) is None
137
+ # and model_fields_set contains the field
138
+ if self.command is None and "command" in self.model_fields_set:
139
+ _dict['command'] = None
140
+
141
+ # set to None if config_file (nullable) is None
142
+ # and model_fields_set contains the field
143
+ if self.config_file is None and "config_file" in self.model_fields_set:
144
+ _dict['config_file'] = None
145
+
146
+ # set to None if active_deadline_seconds (nullable) is None
147
+ # and model_fields_set contains the field
148
+ if self.active_deadline_seconds is None and "active_deadline_seconds" in self.model_fields_set:
149
+ _dict['active_deadline_seconds'] = None
150
+
151
+ return _dict
152
+
153
+ @classmethod
154
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
155
+ """Create an instance of UnifiedWriteJobDeploymentRequest from a dict"""
156
+ if obj is None:
157
+ return None
158
+
159
+ if not isinstance(obj, dict):
160
+ return cls.model_validate(obj)
161
+
162
+ _obj = cls.model_validate({
163
+ "type": obj.get("type"),
164
+ "name": obj.get("name"),
165
+ "cluster_id": obj.get("cluster_id"),
166
+ "user_annotations": obj.get("user_annotations"),
167
+ "chart_revision": obj.get("chart_revision"),
168
+ "volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None,
169
+ "priority": obj.get("priority"),
170
+ "pools": CclMainPools.from_dict(obj["pools"]) if obj.get("pools") is not None else None,
171
+ "env": Env.from_dict(obj["env"]) if obj.get("env") is not None else None,
172
+ "image": Image.from_dict(obj["image"]) if obj.get("image") is not None else None,
173
+ "command": obj.get("command"),
174
+ "config_file": ConfigFileMount.from_dict(obj["config_file"]) if obj.get("config_file") is not None else None,
175
+ "completions": obj.get("completions") if obj.get("completions") is not None else 1,
176
+ "parallelism": obj.get("parallelism") if obj.get("parallelism") is not None else 1,
177
+ "backoff_limit": obj.get("backoff_limit") if obj.get("backoff_limit") is not None else 3,
178
+ "active_deadline_seconds": obj.get("active_deadline_seconds"),
179
+ "enable_logging": obj.get("enable_logging") if obj.get("enable_logging") is not None else True
180
+ })
181
+ return _obj
182
+
183
+