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,47 +18,61 @@ import re # noqa: F401
18
18
  import json
19
19
 
20
20
  from datetime import datetime
21
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, 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
25
+ from platform_api_python_client.models.config_file_mount import ConfigFileMount
24
26
  from platform_api_python_client.models.deployment_status import DeploymentStatus
25
- from platform_api_python_client.models.deployment_type import DeploymentType
27
+ from platform_api_python_client.models.env import Env
28
+ from platform_api_python_client.models.image import Image
26
29
  from platform_api_python_client.models.volume_mount import VolumeMount
27
30
  from typing import Optional, Set
28
31
  from typing_extensions import Self
29
32
 
30
- class GetCServeV3DeploymentResponse(BaseModel):
33
+ class UnifiedGetJobDeploymentResponse(BaseModel):
31
34
  """
32
- GetCServeV3DeploymentResponse
35
+ UnifiedGetJobDeploymentResponse
33
36
  """ # noqa: E501
34
- creator_email: StrictStr
35
- cluster_id: StrictInt
36
37
  id: StrictInt
37
- name: StrictStr
38
- endpoint_url: StrictStr
39
- image_url: Optional[StrictStr] = None
40
- type: DeploymentType
41
38
  status: DeploymentStatus
39
+ creator_email: StrictStr
42
40
  created_at: datetime
43
- hardware_instance_id: StrictInt
41
+ updated_at: datetime
44
42
  revision_number: StrictInt
45
- chart_revision: Optional[StrictStr] = None
43
+ endpoint_url: Optional[StrictStr]
44
+ type: StrictStr
45
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=20)]
46
+ cluster_id: StrictInt
46
47
  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_replicas: StrictInt
52
- max_replicas: StrictInt
53
- endpoint_certificate_authority: Optional[StrictStr] = None
54
- endpoint_bearer_token: Optional[StrictStr] = None
55
- concurrency: Optional[StrictInt] = None
56
- cooldown_period: Optional[StrictInt] = 1800
57
- env_vars: Optional[Dict[str, StrictStr]] = None
48
+ chart_revision: Optional[StrictStr] = None
49
+ volume_mounts: Optional[Annotated[List[VolumeMount], Field(max_length=10)]] = None
50
+ priority: Optional[Annotated[str, Field(strict=True, max_length=253)]] = None
51
+ pools: CclMainPools
52
+ env: Optional[Env] = None
53
+ image: Image
54
+ command: Optional[StrictStr] = None
55
+ config_file: Optional[ConfigFileMount] = None
56
+ completions: Optional[Annotated[int, Field(strict=True, ge=1)]] = 1
57
+ parallelism: Optional[Annotated[int, Field(strict=True, ge=1)]] = 1
58
+ backoff_limit: Optional[Annotated[int, Field(strict=True, ge=0)]] = 3
59
+ active_deadline_seconds: Optional[Annotated[int, Field(strict=True, ge=1)]] = None
58
60
  enable_logging: Optional[StrictBool] = True
59
- enable_node_model_cache: Optional[StrictBool] = False
60
- 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.")
61
- __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_replicas", "max_replicas", "endpoint_certificate_authority", "endpoint_bearer_token", "concurrency", "cooldown_period", "env_vars", "enable_logging", "enable_node_model_cache", "session_affinity"]
61
+ __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", "command", "config_file", "completions", "parallelism", "backoff_limit", "active_deadline_seconds", "enable_logging"]
62
+
63
+ @field_validator('type')
64
+ def type_validate_enum(cls, value):
65
+ """Validates the enum"""
66
+ if value not in set(['ccl_job']):
67
+ raise ValueError("must be one of enum values ('ccl_job')")
68
+ return value
69
+
70
+ @field_validator('name')
71
+ def name_validate_regular_expression(cls, value):
72
+ """Validates the regular expression"""
73
+ if not re.match(r"^[a-z][a-z0-9-]*$", value):
74
+ raise ValueError(r"must validate the regular expression /^[a-z][a-z0-9-]*$/")
75
+ return value
62
76
 
63
77
  model_config = ConfigDict(
64
78
  populate_by_name=True,
@@ -78,7 +92,7 @@ class GetCServeV3DeploymentResponse(BaseModel):
78
92
 
79
93
  @classmethod
80
94
  def from_json(cls, json_str: str) -> Optional[Self]:
81
- """Create an instance of GetCServeV3DeploymentResponse from a JSON string"""
95
+ """Create an instance of UnifiedGetJobDeploymentResponse from a JSON string"""
82
96
  return cls.from_dict(json.loads(json_str))
83
97
 
84
98
  def to_dict(self) -> Dict[str, Any]:
@@ -106,18 +120,22 @@ class GetCServeV3DeploymentResponse(BaseModel):
106
120
  if _item_volume_mounts:
107
121
  _items.append(_item_volume_mounts.to_dict())
108
122
  _dict['volume_mounts'] = _items
109
- # override the default output from pydantic by calling `to_dict()` of recipe
110
- if self.recipe:
111
- _dict['recipe'] = self.recipe.to_dict()
112
- # set to None if image_url (nullable) is None
123
+ # override the default output from pydantic by calling `to_dict()` of pools
124
+ if self.pools:
125
+ _dict['pools'] = self.pools.to_dict()
126
+ # override the default output from pydantic by calling `to_dict()` of env
127
+ if self.env:
128
+ _dict['env'] = self.env.to_dict()
129
+ # override the default output from pydantic by calling `to_dict()` of image
130
+ if self.image:
131
+ _dict['image'] = self.image.to_dict()
132
+ # override the default output from pydantic by calling `to_dict()` of config_file
133
+ if self.config_file:
134
+ _dict['config_file'] = self.config_file.to_dict()
135
+ # set to None if endpoint_url (nullable) is None
113
136
  # and model_fields_set contains the field
114
- if self.image_url is None and "image_url" in self.model_fields_set:
115
- _dict['image_url'] = None
116
-
117
- # set to None if chart_revision (nullable) is None
118
- # and model_fields_set contains the field
119
- if self.chart_revision is None and "chart_revision" in self.model_fields_set:
120
- _dict['chart_revision'] = None
137
+ if self.endpoint_url is None and "endpoint_url" in self.model_fields_set:
138
+ _dict['endpoint_url'] = None
121
139
 
122
140
  # set to None if user_annotations (nullable) is None
123
141
  # and model_fields_set contains the field
@@ -129,31 +147,26 @@ class GetCServeV3DeploymentResponse(BaseModel):
129
147
  if self.priority is None and "priority" in self.model_fields_set:
130
148
  _dict['priority'] = None
131
149
 
132
- # set to None if cserve_version (nullable) is None
133
- # and model_fields_set contains the field
134
- if self.cserve_version is None and "cserve_version" in self.model_fields_set:
135
- _dict['cserve_version'] = None
136
-
137
- # set to None if endpoint_certificate_authority (nullable) is None
150
+ # set to None if command (nullable) is None
138
151
  # and model_fields_set contains the field
139
- if self.endpoint_certificate_authority is None and "endpoint_certificate_authority" in self.model_fields_set:
140
- _dict['endpoint_certificate_authority'] = None
152
+ if self.command is None and "command" in self.model_fields_set:
153
+ _dict['command'] = None
141
154
 
142
- # set to None if endpoint_bearer_token (nullable) is None
155
+ # set to None if config_file (nullable) is None
143
156
  # and model_fields_set contains the field
144
- if self.endpoint_bearer_token is None and "endpoint_bearer_token" in self.model_fields_set:
145
- _dict['endpoint_bearer_token'] = None
157
+ if self.config_file is None and "config_file" in self.model_fields_set:
158
+ _dict['config_file'] = None
146
159
 
147
- # set to None if concurrency (nullable) is None
160
+ # set to None if active_deadline_seconds (nullable) is None
148
161
  # and model_fields_set contains the field
149
- if self.concurrency is None and "concurrency" in self.model_fields_set:
150
- _dict['concurrency'] = None
162
+ if self.active_deadline_seconds is None and "active_deadline_seconds" in self.model_fields_set:
163
+ _dict['active_deadline_seconds'] = None
151
164
 
152
165
  return _dict
153
166
 
154
167
  @classmethod
155
168
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
156
- """Create an instance of GetCServeV3DeploymentResponse from a dict"""
169
+ """Create an instance of UnifiedGetJobDeploymentResponse from a dict"""
157
170
  if obj is None:
158
171
  return None
159
172
 
@@ -161,33 +174,30 @@ class GetCServeV3DeploymentResponse(BaseModel):
161
174
  return cls.model_validate(obj)
162
175
 
163
176
  _obj = cls.model_validate({
164
- "creator_email": obj.get("creator_email"),
165
- "cluster_id": obj.get("cluster_id"),
166
177
  "id": obj.get("id"),
167
- "name": obj.get("name"),
168
- "endpoint_url": obj.get("endpoint_url"),
169
- "image_url": obj.get("image_url"),
170
- "type": obj.get("type"),
171
178
  "status": obj.get("status"),
179
+ "creator_email": obj.get("creator_email"),
172
180
  "created_at": obj.get("created_at"),
173
- "hardware_instance_id": obj.get("hardware_instance_id"),
181
+ "updated_at": obj.get("updated_at"),
174
182
  "revision_number": obj.get("revision_number"),
175
- "chart_revision": obj.get("chart_revision"),
183
+ "endpoint_url": obj.get("endpoint_url"),
184
+ "type": obj.get("type"),
185
+ "name": obj.get("name"),
186
+ "cluster_id": obj.get("cluster_id"),
176
187
  "user_annotations": obj.get("user_annotations"),
177
- "priority": obj.get("priority"),
188
+ "chart_revision": obj.get("chart_revision"),
178
189
  "volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None,
179
- "recipe": CServeV2Recipe.from_dict(obj["recipe"]) if obj.get("recipe") is not None else None,
180
- "cserve_version": obj.get("cserve_version"),
181
- "min_replicas": obj.get("min_replicas"),
182
- "max_replicas": obj.get("max_replicas"),
183
- "endpoint_certificate_authority": obj.get("endpoint_certificate_authority"),
184
- "endpoint_bearer_token": obj.get("endpoint_bearer_token"),
185
- "concurrency": obj.get("concurrency"),
186
- "cooldown_period": obj.get("cooldown_period") if obj.get("cooldown_period") is not None else 1800,
187
- "env_vars": obj.get("env_vars"),
188
- "enable_logging": obj.get("enable_logging") if obj.get("enable_logging") is not None else True,
189
- "enable_node_model_cache": obj.get("enable_node_model_cache") if obj.get("enable_node_model_cache") is not None else False,
190
- "session_affinity": obj.get("session_affinity") if obj.get("session_affinity") is not None else False
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
+ "command": obj.get("command"),
195
+ "config_file": ConfigFileMount.from_dict(obj["config_file"]) if obj.get("config_file") is not None else None,
196
+ "completions": obj.get("completions") if obj.get("completions") is not None else 1,
197
+ "parallelism": obj.get("parallelism") if obj.get("parallelism") is not None else 1,
198
+ "backoff_limit": obj.get("backoff_limit") if obj.get("backoff_limit") is not None else 3,
199
+ "active_deadline_seconds": obj.get("active_deadline_seconds"),
200
+ "enable_logging": obj.get("enable_logging") if obj.get("enable_logging") is not None else True
191
201
  })
192
202
  return _obj
193
203
 
@@ -19,15 +19,15 @@ import json
19
19
 
20
20
  from pydantic import BaseModel, ConfigDict
21
21
  from typing import Any, ClassVar, Dict, List
22
- from platform_api_python_client.models.c_serve_recipe_response import CServeRecipeResponse
22
+ from platform_api_python_client.models.unified_get_deployment_revision_response import UnifiedGetDeploymentRevisionResponse
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
25
25
 
26
- class ListCServeRecipeResponse(BaseModel):
26
+ class UnifiedListDeploymentRevisionsResponse(BaseModel):
27
27
  """
28
- ListCServeRecipeResponse
28
+ UnifiedListDeploymentRevisionsResponse
29
29
  """ # noqa: E501
30
- results: List[CServeRecipeResponse]
30
+ results: List[UnifiedGetDeploymentRevisionResponse]
31
31
  __properties: ClassVar[List[str]] = ["results"]
32
32
 
33
33
  model_config = ConfigDict(
@@ -48,7 +48,7 @@ class ListCServeRecipeResponse(BaseModel):
48
48
 
49
49
  @classmethod
50
50
  def from_json(cls, json_str: str) -> Optional[Self]:
51
- """Create an instance of ListCServeRecipeResponse from a JSON string"""
51
+ """Create an instance of UnifiedListDeploymentRevisionsResponse from a JSON string"""
52
52
  return cls.from_dict(json.loads(json_str))
53
53
 
54
54
  def to_dict(self) -> Dict[str, Any]:
@@ -80,7 +80,7 @@ class ListCServeRecipeResponse(BaseModel):
80
80
 
81
81
  @classmethod
82
82
  def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
- """Create an instance of ListCServeRecipeResponse from a dict"""
83
+ """Create an instance of UnifiedListDeploymentRevisionsResponse from a dict"""
84
84
  if obj is None:
85
85
  return None
86
86
 
@@ -88,7 +88,7 @@ class ListCServeRecipeResponse(BaseModel):
88
88
  return cls.model_validate(obj)
89
89
 
90
90
  _obj = cls.model_validate({
91
- "results": [CServeRecipeResponse.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
91
+ "results": [UnifiedGetDeploymentRevisionResponse.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
92
92
  })
93
93
  return _obj
94
94
 
@@ -0,0 +1,87 @@
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, StrictBool
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class UnifiedUpdateDeploymentRolloutRequest(BaseModel):
26
+ """
27
+ UnifiedUpdateDeploymentRolloutRequest
28
+ """ # noqa: E501
29
+ paused: StrictBool
30
+ __properties: ClassVar[List[str]] = ["paused"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of UnifiedUpdateDeploymentRolloutRequest from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([
64
+ ])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of UnifiedUpdateDeploymentRolloutRequest from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({
83
+ "paused": obj.get("paused")
84
+ })
85
+ return _obj
86
+
87
+
@@ -0,0 +1,154 @@
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.env import Env
25
+ from platform_api_python_client.models.image import Image
26
+ from platform_api_python_client.models.volume_mount import VolumeMount
27
+ from typing import Optional, Set
28
+ from typing_extensions import Self
29
+
30
+ class UnifiedWriteComputeDeploymentRequest(BaseModel):
31
+ """
32
+ UnifiedWriteComputeDeploymentRequest
33
+ """ # noqa: E501
34
+ type: StrictStr
35
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=20)]
36
+ cluster_id: StrictInt
37
+ user_annotations: Optional[Dict[str, StrictStr]] = None
38
+ chart_revision: Optional[StrictStr] = None
39
+ volume_mounts: Optional[Annotated[List[VolumeMount], Field(max_length=10)]] = None
40
+ priority: Optional[Annotated[str, Field(strict=True, max_length=253)]] = None
41
+ pools: CclMainPools
42
+ env: Optional[Env] = None
43
+ image: Image
44
+ ssh_public_key: Annotated[str, Field(min_length=1, strict=True)]
45
+ enable_logging: Optional[StrictBool] = False
46
+ __properties: ClassVar[List[str]] = ["type", "name", "cluster_id", "user_annotations", "chart_revision", "volume_mounts", "priority", "pools", "env", "image", "ssh_public_key", "enable_logging"]
47
+
48
+ @field_validator('type')
49
+ def type_validate_enum(cls, value):
50
+ """Validates the enum"""
51
+ if value not in set(['ccl_compute']):
52
+ raise ValueError("must be one of enum values ('ccl_compute')")
53
+ return value
54
+
55
+ @field_validator('name')
56
+ def name_validate_regular_expression(cls, value):
57
+ """Validates the regular expression"""
58
+ if not re.match(r"^[a-z][a-z0-9-]*$", value):
59
+ raise ValueError(r"must validate the regular expression /^[a-z][a-z0-9-]*$/")
60
+ return value
61
+
62
+ model_config = ConfigDict(
63
+ populate_by_name=True,
64
+ validate_assignment=True,
65
+ protected_namespaces=(),
66
+ )
67
+
68
+
69
+ def to_str(self) -> str:
70
+ """Returns the string representation of the model using alias"""
71
+ return pprint.pformat(self.model_dump(by_alias=True))
72
+
73
+ def to_json(self) -> str:
74
+ """Returns the JSON representation of the model using alias"""
75
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
76
+ return json.dumps(self.to_dict())
77
+
78
+ @classmethod
79
+ def from_json(cls, json_str: str) -> Optional[Self]:
80
+ """Create an instance of UnifiedWriteComputeDeploymentRequest from a JSON string"""
81
+ return cls.from_dict(json.loads(json_str))
82
+
83
+ def to_dict(self) -> Dict[str, Any]:
84
+ """Return the dictionary representation of the model using alias.
85
+
86
+ This has the following differences from calling pydantic's
87
+ `self.model_dump(by_alias=True)`:
88
+
89
+ * `None` is only added to the output dict for nullable fields that
90
+ were set at model initialization. Other fields with value `None`
91
+ are ignored.
92
+ """
93
+ excluded_fields: Set[str] = set([
94
+ ])
95
+
96
+ _dict = self.model_dump(
97
+ by_alias=True,
98
+ exclude=excluded_fields,
99
+ exclude_none=True,
100
+ )
101
+ # override the default output from pydantic by calling `to_dict()` of each item in volume_mounts (list)
102
+ _items = []
103
+ if self.volume_mounts:
104
+ for _item_volume_mounts in self.volume_mounts:
105
+ if _item_volume_mounts:
106
+ _items.append(_item_volume_mounts.to_dict())
107
+ _dict['volume_mounts'] = _items
108
+ # override the default output from pydantic by calling `to_dict()` of pools
109
+ if self.pools:
110
+ _dict['pools'] = self.pools.to_dict()
111
+ # override the default output from pydantic by calling `to_dict()` of env
112
+ if self.env:
113
+ _dict['env'] = self.env.to_dict()
114
+ # override the default output from pydantic by calling `to_dict()` of image
115
+ if self.image:
116
+ _dict['image'] = self.image.to_dict()
117
+ # set to None if user_annotations (nullable) is None
118
+ # and model_fields_set contains the field
119
+ if self.user_annotations is None and "user_annotations" in self.model_fields_set:
120
+ _dict['user_annotations'] = None
121
+
122
+ # set to None if priority (nullable) is None
123
+ # and model_fields_set contains the field
124
+ if self.priority is None and "priority" in self.model_fields_set:
125
+ _dict['priority'] = None
126
+
127
+ return _dict
128
+
129
+ @classmethod
130
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
131
+ """Create an instance of UnifiedWriteComputeDeploymentRequest from a dict"""
132
+ if obj is None:
133
+ return None
134
+
135
+ if not isinstance(obj, dict):
136
+ return cls.model_validate(obj)
137
+
138
+ _obj = cls.model_validate({
139
+ "type": obj.get("type"),
140
+ "name": obj.get("name"),
141
+ "cluster_id": obj.get("cluster_id"),
142
+ "user_annotations": obj.get("user_annotations"),
143
+ "chart_revision": obj.get("chart_revision"),
144
+ "volume_mounts": [VolumeMount.from_dict(_item) for _item in obj["volume_mounts"]] if obj.get("volume_mounts") is not None else None,
145
+ "priority": obj.get("priority"),
146
+ "pools": CclMainPools.from_dict(obj["pools"]) if obj.get("pools") is not None else None,
147
+ "env": Env.from_dict(obj["env"]) if obj.get("env") is not None else None,
148
+ "image": Image.from_dict(obj["image"]) if obj.get("image") is not None else None,
149
+ "ssh_public_key": obj.get("ssh_public_key"),
150
+ "enable_logging": obj.get("enable_logging") if obj.get("enable_logging") is not None else False
151
+ })
152
+ return _obj
153
+
154
+