wallaroo.wallaroo_ml_ops_api_client.models.pipelines_create_json_body

 1from typing import Any, Dict, List, Type, TypeVar, Union
 2
 3import attr
 4
 5from ..models.pipelines_create_json_body_definition import \
 6    PipelinesCreateJsonBodyDefinition
 7from ..types import UNSET, Unset
 8
 9T = TypeVar("T", bound="PipelinesCreateJsonBody")
10
11@attr.s(auto_attribs=True)
12class PipelinesCreateJsonBody:
13    """ Request to create a new pipeline in a workspace.
14
15    Attributes:
16        pipeline_id (str):  Pipeline identifier.
17        workspace_id (int):  Workspace identifier.
18        definition (Union[Unset, None, PipelinesCreateJsonBodyDefinition]):  Pipeline definition.
19    """
20
21    pipeline_id: str
22    workspace_id: int
23    definition: Union[Unset, None, PipelinesCreateJsonBodyDefinition] = UNSET
24    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
25
26
27    def to_dict(self) -> Dict[str, Any]:
28        pipeline_id = self.pipeline_id
29        workspace_id = self.workspace_id
30        definition: Union[Unset, None, Dict[str, Any]] = UNSET
31        if not isinstance(self.definition, Unset):
32            definition = self.definition.to_dict() if self.definition else None
33
34
35        field_dict: Dict[str, Any] = {}
36        field_dict.update(self.additional_properties)
37        field_dict.update({
38            "pipeline_id": pipeline_id,
39            "workspace_id": workspace_id,
40        })
41        if definition is not UNSET:
42            field_dict["definition"] = definition
43
44        return field_dict
45
46
47
48    @classmethod
49    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
50        d = src_dict.copy()
51        pipeline_id = d.pop("pipeline_id")
52
53        workspace_id = d.pop("workspace_id")
54
55        _definition = d.pop("definition", UNSET)
56        definition: Union[Unset, None, PipelinesCreateJsonBodyDefinition]
57        if _definition is None:
58            definition = None
59        elif isinstance(_definition,  Unset):
60            definition = UNSET
61        else:
62            definition = PipelinesCreateJsonBodyDefinition.from_dict(_definition)
63
64
65
66
67        pipelines_create_json_body = cls(
68            pipeline_id=pipeline_id,
69            workspace_id=workspace_id,
70            definition=definition,
71        )
72
73        pipelines_create_json_body.additional_properties = d
74        return pipelines_create_json_body
75
76    @property
77    def additional_keys(self) -> List[str]:
78        return list(self.additional_properties.keys())
79
80    def __getitem__(self, key: str) -> Any:
81        return self.additional_properties[key]
82
83    def __setitem__(self, key: str, value: Any) -> None:
84        self.additional_properties[key] = value
85
86    def __delitem__(self, key: str) -> None:
87        del self.additional_properties[key]
88
89    def __contains__(self, key: str) -> bool:
90        return key in self.additional_properties
@attr.s(auto_attribs=True)
class PipelinesCreateJsonBody:
12@attr.s(auto_attribs=True)
13class PipelinesCreateJsonBody:
14    """ Request to create a new pipeline in a workspace.
15
16    Attributes:
17        pipeline_id (str):  Pipeline identifier.
18        workspace_id (int):  Workspace identifier.
19        definition (Union[Unset, None, PipelinesCreateJsonBodyDefinition]):  Pipeline definition.
20    """
21
22    pipeline_id: str
23    workspace_id: int
24    definition: Union[Unset, None, PipelinesCreateJsonBodyDefinition] = UNSET
25    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
26
27
28    def to_dict(self) -> Dict[str, Any]:
29        pipeline_id = self.pipeline_id
30        workspace_id = self.workspace_id
31        definition: Union[Unset, None, Dict[str, Any]] = UNSET
32        if not isinstance(self.definition, Unset):
33            definition = self.definition.to_dict() if self.definition else None
34
35
36        field_dict: Dict[str, Any] = {}
37        field_dict.update(self.additional_properties)
38        field_dict.update({
39            "pipeline_id": pipeline_id,
40            "workspace_id": workspace_id,
41        })
42        if definition is not UNSET:
43            field_dict["definition"] = definition
44
45        return field_dict
46
47
48
49    @classmethod
50    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
51        d = src_dict.copy()
52        pipeline_id = d.pop("pipeline_id")
53
54        workspace_id = d.pop("workspace_id")
55
56        _definition = d.pop("definition", UNSET)
57        definition: Union[Unset, None, PipelinesCreateJsonBodyDefinition]
58        if _definition is None:
59            definition = None
60        elif isinstance(_definition,  Unset):
61            definition = UNSET
62        else:
63            definition = PipelinesCreateJsonBodyDefinition.from_dict(_definition)
64
65
66
67
68        pipelines_create_json_body = cls(
69            pipeline_id=pipeline_id,
70            workspace_id=workspace_id,
71            definition=definition,
72        )
73
74        pipelines_create_json_body.additional_properties = d
75        return pipelines_create_json_body
76
77    @property
78    def additional_keys(self) -> List[str]:
79        return list(self.additional_properties.keys())
80
81    def __getitem__(self, key: str) -> Any:
82        return self.additional_properties[key]
83
84    def __setitem__(self, key: str, value: Any) -> None:
85        self.additional_properties[key] = value
86
87    def __delitem__(self, key: str) -> None:
88        del self.additional_properties[key]
89
90    def __contains__(self, key: str) -> bool:
91        return key in self.additional_properties

Request to create a new pipeline in a workspace.

Attributes: pipeline_id (str): Pipeline identifier. workspace_id (int): Workspace identifier. definition (Union[Unset, None, PipelinesCreateJsonBodyDefinition]): Pipeline definition.

PipelinesCreateJsonBody( pipeline_id: str, workspace_id: int, definition: Union[wallaroo.wallaroo_ml_ops_api_client.types.Unset, NoneType, wallaroo.wallaroo_ml_ops_api_client.models.pipelines_create_json_body_definition.PipelinesCreateJsonBodyDefinition] = <wallaroo.wallaroo_ml_ops_api_client.types.Unset object>)
2def __init__(self, pipeline_id, workspace_id, definition=attr_dict['definition'].default):
3    self.pipeline_id = pipeline_id
4    self.workspace_id = workspace_id
5    self.definition = definition
6    self.additional_properties = __attr_factory_additional_properties()

Method generated by attrs for class PipelinesCreateJsonBody.

def to_dict(self) -> Dict[str, Any]:
28    def to_dict(self) -> Dict[str, Any]:
29        pipeline_id = self.pipeline_id
30        workspace_id = self.workspace_id
31        definition: Union[Unset, None, Dict[str, Any]] = UNSET
32        if not isinstance(self.definition, Unset):
33            definition = self.definition.to_dict() if self.definition else None
34
35
36        field_dict: Dict[str, Any] = {}
37        field_dict.update(self.additional_properties)
38        field_dict.update({
39            "pipeline_id": pipeline_id,
40            "workspace_id": workspace_id,
41        })
42        if definition is not UNSET:
43            field_dict["definition"] = definition
44
45        return field_dict
@classmethod
def from_dict(cls: Type[~T], src_dict: Dict[str, Any]) -> ~T:
49    @classmethod
50    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
51        d = src_dict.copy()
52        pipeline_id = d.pop("pipeline_id")
53
54        workspace_id = d.pop("workspace_id")
55
56        _definition = d.pop("definition", UNSET)
57        definition: Union[Unset, None, PipelinesCreateJsonBodyDefinition]
58        if _definition is None:
59            definition = None
60        elif isinstance(_definition,  Unset):
61            definition = UNSET
62        else:
63            definition = PipelinesCreateJsonBodyDefinition.from_dict(_definition)
64
65
66
67
68        pipelines_create_json_body = cls(
69            pipeline_id=pipeline_id,
70            workspace_id=workspace_id,
71            definition=definition,
72        )
73
74        pipelines_create_json_body.additional_properties = d
75        return pipelines_create_json_body
additional_keys: List[str]