langflow-control-plane-sdk 0.0.0.dev0__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 (26) hide show
  1. langflow_control_plane_sdk/__init__.py +72 -0
  2. langflow_control_plane_sdk/api/__init__.py +5 -0
  3. langflow_control_plane_sdk/api/deployments_api.py +1846 -0
  4. langflow_control_plane_sdk/api_client.py +822 -0
  5. langflow_control_plane_sdk/api_response.py +21 -0
  6. langflow_control_plane_sdk/configuration.py +625 -0
  7. langflow_control_plane_sdk/exceptions.py +218 -0
  8. langflow_control_plane_sdk/models/__init__.py +28 -0
  9. langflow_control_plane_sdk/models/create_deployment.py +108 -0
  10. langflow_control_plane_sdk/models/deployment_detail.py +105 -0
  11. langflow_control_plane_sdk/models/deployment_list.py +103 -0
  12. langflow_control_plane_sdk/models/deployment_list_item.py +103 -0
  13. langflow_control_plane_sdk/models/error_body.py +96 -0
  14. langflow_control_plane_sdk/models/error_code.py +57 -0
  15. langflow_control_plane_sdk/models/error_envelope.py +92 -0
  16. langflow_control_plane_sdk/models/flow_input.py +104 -0
  17. langflow_control_plane_sdk/models/flow_payload.py +105 -0
  18. langflow_control_plane_sdk/models/flow_payload_data.py +103 -0
  19. langflow_control_plane_sdk/models/patch_deployment.py +89 -0
  20. langflow_control_plane_sdk/models/replace_deployment.py +99 -0
  21. langflow_control_plane_sdk/py.typed +0 -0
  22. langflow_control_plane_sdk/rest.py +201 -0
  23. langflow_control_plane_sdk-0.0.0.dev0.dist-info/METADATA +142 -0
  24. langflow_control_plane_sdk-0.0.0.dev0.dist-info/RECORD +26 -0
  25. langflow_control_plane_sdk-0.0.0.dev0.dist-info/WHEEL +4 -0
  26. langflow_control_plane_sdk-0.0.0.dev0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,96 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Langflow Control Plane API
5
+
6
+ Manage Langflow Runtime Deployments.
7
+
8
+ The version of the OpenAPI document: 0.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, StrictStr
21
+ from typing import Any, ClassVar, Dict, Optional
22
+ from uuid import UUID
23
+ from langflow_control_plane_sdk.models.error_code import ErrorCode
24
+ from typing import Optional, Set
25
+ from typing_extensions import Self
26
+ from pydantic_core import to_jsonable_python
27
+
28
+ class ErrorBody(BaseModel):
29
+ """
30
+ ErrorBody
31
+ """ # noqa: E501
32
+ code: ErrorCode
33
+ message: StrictStr
34
+ deployment_id: Optional[UUID] = Field(default=None, alias="deploymentId")
35
+ flow_id: Optional[UUID] = Field(default=None, alias="flowId")
36
+ __properties: ClassVar[List[str]] = ["code", "message", "deploymentId", "flowId"]
37
+
38
+ model_config = ConfigDict(
39
+ validate_by_name=True,
40
+ validate_by_alias=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ return json.dumps(to_jsonable_python(self.to_dict()))
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of ErrorBody from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ ])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of ErrorBody from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate({
89
+ "code": obj.get("code"),
90
+ "message": obj.get("message"),
91
+ "deploymentId": obj.get("deploymentId"),
92
+ "flowId": obj.get("flowId")
93
+ })
94
+ return _obj
95
+
96
+
@@ -0,0 +1,57 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Langflow Control Plane API
5
+
6
+ Manage Langflow Runtime Deployments.
7
+
8
+ The version of the OpenAPI document: 0.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 json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class ErrorCode(str, Enum):
22
+ """
23
+ ErrorCode
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ INVALID_REQUEST = 'INVALID_REQUEST'
30
+ INVALID_FLOW_GRAPH = 'INVALID_FLOW_GRAPH'
31
+ UNSUPPORTED_API_SURFACE = 'UNSUPPORTED_API_SURFACE'
32
+ UNAUTHENTICATED = 'UNAUTHENTICATED'
33
+ FORBIDDEN = 'FORBIDDEN'
34
+ DEPLOYMENT_NOT_FOUND = 'DEPLOYMENT_NOT_FOUND'
35
+ DEPLOYMENT_SLUG_CONFLICT = 'DEPLOYMENT_SLUG_CONFLICT'
36
+ FLOW_ID_CONFLICT = 'FLOW_ID_CONFLICT'
37
+ VALIDATION_FAILED = 'VALIDATION_FAILED'
38
+ REQUEST_TOO_LARGE = 'REQUEST_TOO_LARGE'
39
+ LANGFLOW_ERROR = 'LANGFLOW_ERROR'
40
+ LANGFLOW_INVALID_REQUEST = 'LANGFLOW_INVALID_REQUEST'
41
+ LANGFLOW_VALIDATION_FAILED = 'LANGFLOW_VALIDATION_FAILED'
42
+ LANGFLOW_UNAUTHENTICATED = 'LANGFLOW_UNAUTHENTICATED'
43
+ LANGFLOW_FORBIDDEN = 'LANGFLOW_FORBIDDEN'
44
+ LANGFLOW_PROJECT_CLEANUP_FAILED = 'LANGFLOW_PROJECT_CLEANUP_FAILED'
45
+ LANGFLOW_RATE_LIMITED = 'LANGFLOW_RATE_LIMITED'
46
+ LANGFLOW_SERVICE_ERROR = 'LANGFLOW_SERVICE_ERROR'
47
+ LANGFLOW_UNAVAILABLE = 'LANGFLOW_UNAVAILABLE'
48
+ INTERNAL_ERROR = 'INTERNAL_ERROR'
49
+ NOT_FOUND = 'NOT_FOUND'
50
+ METHOD_NOT_ALLOWED = 'METHOD_NOT_ALLOWED'
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Self:
54
+ """Create an instance of ErrorCode from a JSON string"""
55
+ return cls(json.loads(json_str))
56
+
57
+
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Langflow Control Plane API
5
+
6
+ Manage Langflow Runtime Deployments.
7
+
8
+ The version of the OpenAPI document: 0.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
21
+ from typing import Any, ClassVar, Dict
22
+ from langflow_control_plane_sdk.models.error_body import ErrorBody
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class ErrorEnvelope(BaseModel):
28
+ """
29
+ ErrorEnvelope
30
+ """ # noqa: E501
31
+ error: ErrorBody
32
+ __properties: ClassVar[List[str]] = ["error"]
33
+
34
+ model_config = ConfigDict(
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of ErrorEnvelope from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ # override the default output from pydantic by calling `to_dict()` of error
74
+ if self.error:
75
+ _dict['error'] = self.error.to_dict()
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of ErrorEnvelope from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate({
88
+ "error": ErrorBody.from_dict(obj["error"]) if obj.get("error") is not None else None
89
+ })
90
+ return _obj
91
+
92
+
@@ -0,0 +1,104 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Langflow Control Plane API
5
+
6
+ Manage Langflow Runtime Deployments.
7
+
8
+ The version of the OpenAPI document: 0.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, Optional
22
+ from typing_extensions import Annotated
23
+ from uuid import UUID
24
+ from langflow_control_plane_sdk.models.flow_payload import FlowPayload
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+ from pydantic_core import to_jsonable_python
28
+
29
+ class FlowInput(BaseModel):
30
+ """
31
+ FlowInput
32
+ """ # noqa: E501
33
+ flow_id: UUID = Field(description="Stable Control Plane Flow ID.", alias="flowId")
34
+ author_flow_id: UUID = Field(description="Authoring-plane ID used as the Serving Plane Flow UUID in this API version.", alias="authorFlowId")
35
+ author_flow_version_id: UUID = Field(alias="authorFlowVersionId")
36
+ name: Annotated[str, Field(min_length=1, strict=True, max_length=255)]
37
+ description: Optional[Annotated[str, Field(strict=True, max_length=4096)]] = None
38
+ payload: FlowPayload
39
+ __properties: ClassVar[List[str]] = ["flowId", "authorFlowId", "authorFlowVersionId", "name", "description", "payload"]
40
+
41
+ model_config = ConfigDict(
42
+ validate_by_name=True,
43
+ validate_by_alias=True,
44
+ validate_assignment=True,
45
+ protected_namespaces=(),
46
+ )
47
+
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ return json.dumps(to_jsonable_python(self.to_dict()))
56
+
57
+ @classmethod
58
+ def from_json(cls, json_str: str) -> Optional[Self]:
59
+ """Create an instance of FlowInput from a JSON string"""
60
+ return cls.from_dict(json.loads(json_str))
61
+
62
+ def to_dict(self) -> Dict[str, Any]:
63
+ """Return the dictionary representation of the model using alias.
64
+
65
+ This has the following differences from calling pydantic's
66
+ `self.model_dump(by_alias=True)`:
67
+
68
+ * `None` is only added to the output dict for nullable fields that
69
+ were set at model initialization. Other fields with value `None`
70
+ are ignored.
71
+ """
72
+ excluded_fields: Set[str] = set([
73
+ ])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of payload
81
+ if self.payload:
82
+ _dict['payload'] = self.payload.to_dict()
83
+ return _dict
84
+
85
+ @classmethod
86
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
+ """Create an instance of FlowInput from a dict"""
88
+ if obj is None:
89
+ return None
90
+
91
+ if not isinstance(obj, dict):
92
+ return cls.model_validate(obj)
93
+
94
+ _obj = cls.model_validate({
95
+ "flowId": obj.get("flowId"),
96
+ "authorFlowId": obj.get("authorFlowId"),
97
+ "authorFlowVersionId": obj.get("authorFlowVersionId"),
98
+ "name": obj.get("name"),
99
+ "description": obj.get("description"),
100
+ "payload": FlowPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None
101
+ })
102
+ return _obj
103
+
104
+
@@ -0,0 +1,105 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Langflow Control Plane API
5
+
6
+ Manage Langflow Runtime Deployments.
7
+
8
+ The version of the OpenAPI document: 0.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
21
+ from typing import Any, ClassVar, Dict, List
22
+ from langflow_control_plane_sdk.models.flow_payload_data import FlowPayloadData
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class FlowPayload(BaseModel):
28
+ """
29
+ Langflow's flow graph. Unknown graph fields are preserved so newer Langflow graph shapes remain forward-compatible.
30
+ """ # noqa: E501
31
+ data: FlowPayloadData
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["data"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of FlowPayload from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ * Fields in `self.additional_properties` are added to the output dict.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ "additional_properties",
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # override the default output from pydantic by calling `to_dict()` of data
77
+ if self.data:
78
+ _dict['data'] = self.data.to_dict()
79
+ # puts key-value pairs in additional_properties in the top level
80
+ if self.additional_properties is not None:
81
+ for _key, _value in self.additional_properties.items():
82
+ _dict[_key] = _value
83
+
84
+ return _dict
85
+
86
+ @classmethod
87
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
88
+ """Create an instance of FlowPayload from a dict"""
89
+ if obj is None:
90
+ return None
91
+
92
+ if not isinstance(obj, dict):
93
+ return cls.model_validate(obj)
94
+
95
+ _obj = cls.model_validate({
96
+ "data": FlowPayloadData.from_dict(obj["data"]) if obj.get("data") is not None else None
97
+ })
98
+ # store additional fields in additional_properties
99
+ for _key in obj.keys():
100
+ if _key not in cls.__properties:
101
+ _obj.additional_properties[_key] = obj.get(_key)
102
+
103
+ return _obj
104
+
105
+
@@ -0,0 +1,103 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Langflow Control Plane API
5
+
6
+ Manage Langflow Runtime Deployments.
7
+
8
+ The version of the OpenAPI document: 0.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
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+ from pydantic_core import to_jsonable_python
25
+
26
+ class FlowPayloadData(BaseModel):
27
+ """
28
+ FlowPayloadData
29
+ """ # noqa: E501
30
+ nodes: List[Dict[str, Any]]
31
+ edges: List[Dict[str, Any]]
32
+ additional_properties: Dict[str, Any] = {}
33
+ __properties: ClassVar[List[str]] = ["nodes", "edges"]
34
+
35
+ model_config = ConfigDict(
36
+ validate_by_name=True,
37
+ validate_by_alias=True,
38
+ validate_assignment=True,
39
+ protected_namespaces=(),
40
+ )
41
+
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ return json.dumps(to_jsonable_python(self.to_dict()))
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of FlowPayloadData from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ * Fields in `self.additional_properties` are added to the output dict.
66
+ """
67
+ excluded_fields: Set[str] = set([
68
+ "additional_properties",
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ # puts key-value pairs in additional_properties in the top level
77
+ if self.additional_properties is not None:
78
+ for _key, _value in self.additional_properties.items():
79
+ _dict[_key] = _value
80
+
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of FlowPayloadData from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate({
93
+ "nodes": obj.get("nodes"),
94
+ "edges": obj.get("edges")
95
+ })
96
+ # store additional fields in additional_properties
97
+ for _key in obj.keys():
98
+ if _key not in cls.__properties:
99
+ _obj.additional_properties[_key] = obj.get(_key)
100
+
101
+ return _obj
102
+
103
+
@@ -0,0 +1,89 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Langflow Control Plane API
5
+
6
+ Manage Langflow Runtime Deployments.
7
+
8
+ The version of the OpenAPI document: 0.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
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+ from pydantic_core import to_jsonable_python
26
+
27
+ class PatchDeployment(BaseModel):
28
+ """
29
+ PatchDeployment
30
+ """ # noqa: E501
31
+ description: Annotated[str, Field(strict=True, max_length=4096)]
32
+ __properties: ClassVar[List[str]] = ["description"]
33
+
34
+ model_config = ConfigDict(
35
+ validate_by_name=True,
36
+ validate_by_alias=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ return json.dumps(to_jsonable_python(self.to_dict()))
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of PatchDeployment from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of PatchDeployment from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({
85
+ "description": obj.get("description")
86
+ })
87
+ return _obj
88
+
89
+