cyberdesk 2.0.0__py3-none-any.whl → 2.1.0__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.

Potentially problematic release.


This version of cyberdesk might be problematic. Click here for more details.

Files changed (29) hide show
  1. cyberdesk/__init__.py +1 -1
  2. cyberdesk/client.py +358 -6
  3. {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/METADATA +1 -1
  4. {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/RECORD +29 -12
  5. openapi_client/cyberdesk_cloud_client/api/machines/get_machine_pools_v1_machines_machine_id_pools_get.py +169 -0
  6. openapi_client/cyberdesk_cloud_client/api/machines/update_machine_pools_v1_machines_machine_id_pools_put.py +190 -0
  7. openapi_client/cyberdesk_cloud_client/api/pools/__init__.py +1 -0
  8. openapi_client/cyberdesk_cloud_client/api/pools/add_machines_to_pool_v1_pools_pool_id_machines_post.py +186 -0
  9. openapi_client/cyberdesk_cloud_client/api/pools/create_pool_v1_pools_post.py +172 -0
  10. openapi_client/cyberdesk_cloud_client/api/pools/delete_pool_v1_pools_pool_id_delete.py +162 -0
  11. openapi_client/cyberdesk_cloud_client/api/pools/get_pool_v1_pools_pool_id_get.py +185 -0
  12. openapi_client/cyberdesk_cloud_client/api/pools/list_pools_v1_pools_get.py +186 -0
  13. openapi_client/cyberdesk_cloud_client/api/pools/remove_machines_from_pool_v1_pools_pool_id_machines_delete.py +184 -0
  14. openapi_client/cyberdesk_cloud_client/api/pools/update_pool_v1_pools_pool_id_patch.py +186 -0
  15. openapi_client/cyberdesk_cloud_client/models/__init__.py +14 -0
  16. openapi_client/cyberdesk_cloud_client/models/machine_pool_assignment.py +69 -0
  17. openapi_client/cyberdesk_cloud_client/models/machine_pool_update.py +69 -0
  18. openapi_client/cyberdesk_cloud_client/models/machine_response.py +46 -1
  19. openapi_client/cyberdesk_cloud_client/models/paginated_response_pool_response.py +97 -0
  20. openapi_client/cyberdesk_cloud_client/models/pool_create.py +82 -0
  21. openapi_client/cyberdesk_cloud_client/models/pool_response.py +137 -0
  22. openapi_client/cyberdesk_cloud_client/models/pool_update.py +92 -0
  23. openapi_client/cyberdesk_cloud_client/models/pool_with_machines.py +162 -0
  24. openapi_client/cyberdesk_cloud_client/models/run_bulk_create.py +40 -0
  25. openapi_client/cyberdesk_cloud_client/models/run_create.py +40 -0
  26. openapi_client/cyberdesk_cloud_client/models/run_response.py +39 -0
  27. {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/WHEEL +0 -0
  28. {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/licenses/LICENSE +0 -0
  29. {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,186 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+ from uuid import UUID
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.http_validation_error import HTTPValidationError
10
+ from ...models.pool_response import PoolResponse
11
+ from ...models.pool_update import PoolUpdate
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ pool_id: UUID,
17
+ *,
18
+ body: PoolUpdate,
19
+ ) -> dict[str, Any]:
20
+ headers: dict[str, Any] = {}
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "patch",
24
+ "url": f"/v1/pools/{pool_id}",
25
+ }
26
+
27
+ _kwargs["json"] = body.to_dict()
28
+
29
+ headers["Content-Type"] = "application/json"
30
+
31
+ _kwargs["headers"] = headers
32
+ return _kwargs
33
+
34
+
35
+ def _parse_response(
36
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
37
+ ) -> Optional[Union[HTTPValidationError, PoolResponse]]:
38
+ if response.status_code == 200:
39
+ response_200 = PoolResponse.from_dict(response.json())
40
+
41
+ return response_200
42
+ if response.status_code == 422:
43
+ response_422 = HTTPValidationError.from_dict(response.json())
44
+
45
+ return response_422
46
+ if client.raise_on_unexpected_status:
47
+ raise errors.UnexpectedStatus(response.status_code, response.content)
48
+ else:
49
+ return None
50
+
51
+
52
+ def _build_response(
53
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
54
+ ) -> Response[Union[HTTPValidationError, PoolResponse]]:
55
+ return Response(
56
+ status_code=HTTPStatus(response.status_code),
57
+ content=response.content,
58
+ headers=response.headers,
59
+ parsed=_parse_response(client=client, response=response),
60
+ )
61
+
62
+
63
+ def sync_detailed(
64
+ pool_id: UUID,
65
+ *,
66
+ client: AuthenticatedClient,
67
+ body: PoolUpdate,
68
+ ) -> Response[Union[HTTPValidationError, PoolResponse]]:
69
+ """Update Pool
70
+
71
+ Update a pool's details.
72
+
73
+ Args:
74
+ pool_id (UUID):
75
+ body (PoolUpdate): Schema for updating a pool
76
+
77
+ Raises:
78
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
79
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
80
+
81
+ Returns:
82
+ Response[Union[HTTPValidationError, PoolResponse]]
83
+ """
84
+
85
+ kwargs = _get_kwargs(
86
+ pool_id=pool_id,
87
+ body=body,
88
+ )
89
+
90
+ response = client.get_httpx_client().request(
91
+ **kwargs,
92
+ )
93
+
94
+ return _build_response(client=client, response=response)
95
+
96
+
97
+ def sync(
98
+ pool_id: UUID,
99
+ *,
100
+ client: AuthenticatedClient,
101
+ body: PoolUpdate,
102
+ ) -> Optional[Union[HTTPValidationError, PoolResponse]]:
103
+ """Update Pool
104
+
105
+ Update a pool's details.
106
+
107
+ Args:
108
+ pool_id (UUID):
109
+ body (PoolUpdate): Schema for updating a pool
110
+
111
+ Raises:
112
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
113
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
114
+
115
+ Returns:
116
+ Union[HTTPValidationError, PoolResponse]
117
+ """
118
+
119
+ return sync_detailed(
120
+ pool_id=pool_id,
121
+ client=client,
122
+ body=body,
123
+ ).parsed
124
+
125
+
126
+ async def asyncio_detailed(
127
+ pool_id: UUID,
128
+ *,
129
+ client: AuthenticatedClient,
130
+ body: PoolUpdate,
131
+ ) -> Response[Union[HTTPValidationError, PoolResponse]]:
132
+ """Update Pool
133
+
134
+ Update a pool's details.
135
+
136
+ Args:
137
+ pool_id (UUID):
138
+ body (PoolUpdate): Schema for updating a pool
139
+
140
+ Raises:
141
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
142
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
143
+
144
+ Returns:
145
+ Response[Union[HTTPValidationError, PoolResponse]]
146
+ """
147
+
148
+ kwargs = _get_kwargs(
149
+ pool_id=pool_id,
150
+ body=body,
151
+ )
152
+
153
+ response = await client.get_async_httpx_client().request(**kwargs)
154
+
155
+ return _build_response(client=client, response=response)
156
+
157
+
158
+ async def asyncio(
159
+ pool_id: UUID,
160
+ *,
161
+ client: AuthenticatedClient,
162
+ body: PoolUpdate,
163
+ ) -> Optional[Union[HTTPValidationError, PoolResponse]]:
164
+ """Update Pool
165
+
166
+ Update a pool's details.
167
+
168
+ Args:
169
+ pool_id (UUID):
170
+ body (PoolUpdate): Schema for updating a pool
171
+
172
+ Raises:
173
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
174
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
175
+
176
+ Returns:
177
+ Union[HTTPValidationError, PoolResponse]
178
+ """
179
+
180
+ return (
181
+ await asyncio_detailed(
182
+ pool_id=pool_id,
183
+ client=client,
184
+ body=body,
185
+ )
186
+ ).parsed
@@ -32,6 +32,8 @@ from .http_validation_error import HTTPValidationError
32
32
  from .keyboard_key_request import KeyboardKeyRequest
33
33
  from .keyboard_type_request import KeyboardTypeRequest
34
34
  from .machine_create import MachineCreate
35
+ from .machine_pool_assignment import MachinePoolAssignment
36
+ from .machine_pool_update import MachinePoolUpdate
35
37
  from .machine_response import MachineResponse
36
38
  from .machine_status import MachineStatus
37
39
  from .machine_update import MachineUpdate
@@ -41,10 +43,15 @@ from .mouse_position import MousePosition
41
43
  from .paginated_response import PaginatedResponse
42
44
  from .paginated_response_connection_response import PaginatedResponseConnectionResponse
43
45
  from .paginated_response_machine_response import PaginatedResponseMachineResponse
46
+ from .paginated_response_pool_response import PaginatedResponsePoolResponse
44
47
  from .paginated_response_run_attachment_response import PaginatedResponseRunAttachmentResponse
45
48
  from .paginated_response_run_response import PaginatedResponseRunResponse
46
49
  from .paginated_response_trajectory_response import PaginatedResponseTrajectoryResponse
47
50
  from .paginated_response_workflow_response import PaginatedResponseWorkflowResponse
51
+ from .pool_create import PoolCreate
52
+ from .pool_response import PoolResponse
53
+ from .pool_update import PoolUpdate
54
+ from .pool_with_machines import PoolWithMachines
48
55
  from .power_shell_exec_request import PowerShellExecRequest
49
56
  from .power_shell_session_request import PowerShellSessionRequest
50
57
  from .powershell_exec_v1_computer_machine_id_shell_powershell_exec_post_response_powershell_exec_v1_computer_machine_id_shell_powershell_exec_post import (
@@ -109,6 +116,8 @@ __all__ = (
109
116
  "KeyboardKeyRequest",
110
117
  "KeyboardTypeRequest",
111
118
  "MachineCreate",
119
+ "MachinePoolAssignment",
120
+ "MachinePoolUpdate",
112
121
  "MachineResponse",
113
122
  "MachineStatus",
114
123
  "MachineUpdate",
@@ -118,10 +127,15 @@ __all__ = (
118
127
  "PaginatedResponse",
119
128
  "PaginatedResponseConnectionResponse",
120
129
  "PaginatedResponseMachineResponse",
130
+ "PaginatedResponsePoolResponse",
121
131
  "PaginatedResponseRunAttachmentResponse",
122
132
  "PaginatedResponseRunResponse",
123
133
  "PaginatedResponseTrajectoryResponse",
124
134
  "PaginatedResponseWorkflowResponse",
135
+ "PoolCreate",
136
+ "PoolResponse",
137
+ "PoolUpdate",
138
+ "PoolWithMachines",
125
139
  "PowerShellExecRequest",
126
140
  "PowershellExecV1ComputerMachineIdShellPowershellExecPostResponsePowershellExecV1ComputerMachineIdShellPowershellExecPost",
127
141
  "PowerShellSessionRequest",
@@ -0,0 +1,69 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+ from uuid import UUID
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+
8
+ T = TypeVar("T", bound="MachinePoolAssignment")
9
+
10
+
11
+ @_attrs_define
12
+ class MachinePoolAssignment:
13
+ """Schema for assigning machines to pools
14
+
15
+ Attributes:
16
+ machine_ids (list[UUID]): List of machine IDs to assign to the pool
17
+ """
18
+
19
+ machine_ids: list[UUID]
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ machine_ids = []
24
+ for machine_ids_item_data in self.machine_ids:
25
+ machine_ids_item = str(machine_ids_item_data)
26
+ machine_ids.append(machine_ids_item)
27
+
28
+ field_dict: dict[str, Any] = {}
29
+ field_dict.update(self.additional_properties)
30
+ field_dict.update(
31
+ {
32
+ "machine_ids": machine_ids,
33
+ }
34
+ )
35
+
36
+ return field_dict
37
+
38
+ @classmethod
39
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
40
+ d = dict(src_dict)
41
+ machine_ids = []
42
+ _machine_ids = d.pop("machine_ids")
43
+ for machine_ids_item_data in _machine_ids:
44
+ machine_ids_item = UUID(machine_ids_item_data)
45
+
46
+ machine_ids.append(machine_ids_item)
47
+
48
+ machine_pool_assignment = cls(
49
+ machine_ids=machine_ids,
50
+ )
51
+
52
+ machine_pool_assignment.additional_properties = d
53
+ return machine_pool_assignment
54
+
55
+ @property
56
+ def additional_keys(self) -> list[str]:
57
+ return list(self.additional_properties.keys())
58
+
59
+ def __getitem__(self, key: str) -> Any:
60
+ return self.additional_properties[key]
61
+
62
+ def __setitem__(self, key: str, value: Any) -> None:
63
+ self.additional_properties[key] = value
64
+
65
+ def __delitem__(self, key: str) -> None:
66
+ del self.additional_properties[key]
67
+
68
+ def __contains__(self, key: str) -> bool:
69
+ return key in self.additional_properties
@@ -0,0 +1,69 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+ from uuid import UUID
4
+
5
+ from attrs import define as _attrs_define
6
+ from attrs import field as _attrs_field
7
+
8
+ T = TypeVar("T", bound="MachinePoolUpdate")
9
+
10
+
11
+ @_attrs_define
12
+ class MachinePoolUpdate:
13
+ """Schema for updating a machine's pool assignments
14
+
15
+ Attributes:
16
+ pool_ids (list[UUID]): List of pool IDs to assign the machine to
17
+ """
18
+
19
+ pool_ids: list[UUID]
20
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ pool_ids = []
24
+ for pool_ids_item_data in self.pool_ids:
25
+ pool_ids_item = str(pool_ids_item_data)
26
+ pool_ids.append(pool_ids_item)
27
+
28
+ field_dict: dict[str, Any] = {}
29
+ field_dict.update(self.additional_properties)
30
+ field_dict.update(
31
+ {
32
+ "pool_ids": pool_ids,
33
+ }
34
+ )
35
+
36
+ return field_dict
37
+
38
+ @classmethod
39
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
40
+ d = dict(src_dict)
41
+ pool_ids = []
42
+ _pool_ids = d.pop("pool_ids")
43
+ for pool_ids_item_data in _pool_ids:
44
+ pool_ids_item = UUID(pool_ids_item_data)
45
+
46
+ pool_ids.append(pool_ids_item)
47
+
48
+ machine_pool_update = cls(
49
+ pool_ids=pool_ids,
50
+ )
51
+
52
+ machine_pool_update.additional_properties = d
53
+ return machine_pool_update
54
+
55
+ @property
56
+ def additional_keys(self) -> list[str]:
57
+ return list(self.additional_properties.keys())
58
+
59
+ def __getitem__(self, key: str) -> Any:
60
+ return self.additional_properties[key]
61
+
62
+ def __setitem__(self, key: str, value: Any) -> None:
63
+ self.additional_properties[key] = value
64
+
65
+ def __delitem__(self, key: str) -> None:
66
+ del self.additional_properties[key]
67
+
68
+ def __contains__(self, key: str) -> bool:
69
+ return key in self.additional_properties
@@ -1,6 +1,6 @@
1
1
  import datetime
2
2
  from collections.abc import Mapping
3
- from typing import Any, TypeVar, Union, cast
3
+ from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
4
4
  from uuid import UUID
5
5
 
6
6
  from attrs import define as _attrs_define
@@ -10,6 +10,10 @@ from dateutil.parser import isoparse
10
10
  from ..models.machine_status import MachineStatus
11
11
  from ..types import UNSET, Unset
12
12
 
13
+ if TYPE_CHECKING:
14
+ from ..models.pool_response import PoolResponse
15
+
16
+
13
17
  T = TypeVar("T", bound="MachineResponse")
14
18
 
15
19
 
@@ -31,6 +35,7 @@ class MachineResponse:
31
35
  os_info (Union[None, Unset, str]):
32
36
  user_id (Union[None, UUID, Unset]):
33
37
  organization_id (Union[None, Unset, str]):
38
+ pools (Union[None, Unset, list['PoolResponse']]):
34
39
  """
35
40
 
36
41
  fingerprint: str
@@ -46,6 +51,7 @@ class MachineResponse:
46
51
  os_info: Union[None, Unset, str] = UNSET
47
52
  user_id: Union[None, UUID, Unset] = UNSET
48
53
  organization_id: Union[None, Unset, str] = UNSET
54
+ pools: Union[None, Unset, list["PoolResponse"]] = UNSET
49
55
  additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
50
56
 
51
57
  def to_dict(self) -> dict[str, Any]:
@@ -101,6 +107,18 @@ class MachineResponse:
101
107
  else:
102
108
  organization_id = self.organization_id
103
109
 
110
+ pools: Union[None, Unset, list[dict[str, Any]]]
111
+ if isinstance(self.pools, Unset):
112
+ pools = UNSET
113
+ elif isinstance(self.pools, list):
114
+ pools = []
115
+ for pools_type_0_item_data in self.pools:
116
+ pools_type_0_item = pools_type_0_item_data.to_dict()
117
+ pools.append(pools_type_0_item)
118
+
119
+ else:
120
+ pools = self.pools
121
+
104
122
  field_dict: dict[str, Any] = {}
105
123
  field_dict.update(self.additional_properties)
106
124
  field_dict.update(
@@ -126,11 +144,15 @@ class MachineResponse:
126
144
  field_dict["user_id"] = user_id
127
145
  if organization_id is not UNSET:
128
146
  field_dict["organization_id"] = organization_id
147
+ if pools is not UNSET:
148
+ field_dict["pools"] = pools
129
149
 
130
150
  return field_dict
131
151
 
132
152
  @classmethod
133
153
  def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
154
+ from ..models.pool_response import PoolResponse
155
+
134
156
  d = dict(src_dict)
135
157
  fingerprint = d.pop("fingerprint")
136
158
 
@@ -208,6 +230,28 @@ class MachineResponse:
208
230
 
209
231
  organization_id = _parse_organization_id(d.pop("organization_id", UNSET))
210
232
 
233
+ def _parse_pools(data: object) -> Union[None, Unset, list["PoolResponse"]]:
234
+ if data is None:
235
+ return data
236
+ if isinstance(data, Unset):
237
+ return data
238
+ try:
239
+ if not isinstance(data, list):
240
+ raise TypeError()
241
+ pools_type_0 = []
242
+ _pools_type_0 = data
243
+ for pools_type_0_item_data in _pools_type_0:
244
+ pools_type_0_item = PoolResponse.from_dict(pools_type_0_item_data)
245
+
246
+ pools_type_0.append(pools_type_0_item)
247
+
248
+ return pools_type_0
249
+ except: # noqa: E722
250
+ pass
251
+ return cast(Union[None, Unset, list["PoolResponse"]], data)
252
+
253
+ pools = _parse_pools(d.pop("pools", UNSET))
254
+
211
255
  machine_response = cls(
212
256
  fingerprint=fingerprint,
213
257
  id=id,
@@ -222,6 +266,7 @@ class MachineResponse:
222
266
  os_info=os_info,
223
267
  user_id=user_id,
224
268
  organization_id=organization_id,
269
+ pools=pools,
225
270
  )
226
271
 
227
272
  machine_response.additional_properties = d
@@ -0,0 +1,97 @@
1
+ from collections.abc import Mapping
2
+ from typing import TYPE_CHECKING, Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ if TYPE_CHECKING:
8
+ from ..models.pool_response import PoolResponse
9
+
10
+
11
+ T = TypeVar("T", bound="PaginatedResponsePoolResponse")
12
+
13
+
14
+ @_attrs_define
15
+ class PaginatedResponsePoolResponse:
16
+ """
17
+ Attributes:
18
+ items (list['PoolResponse']):
19
+ total (int):
20
+ skip (int):
21
+ limit (int):
22
+ """
23
+
24
+ items: list["PoolResponse"]
25
+ total: int
26
+ skip: int
27
+ limit: int
28
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ items = []
32
+ for items_item_data in self.items:
33
+ items_item = items_item_data.to_dict()
34
+ items.append(items_item)
35
+
36
+ total = self.total
37
+
38
+ skip = self.skip
39
+
40
+ limit = self.limit
41
+
42
+ field_dict: dict[str, Any] = {}
43
+ field_dict.update(self.additional_properties)
44
+ field_dict.update(
45
+ {
46
+ "items": items,
47
+ "total": total,
48
+ "skip": skip,
49
+ "limit": limit,
50
+ }
51
+ )
52
+
53
+ return field_dict
54
+
55
+ @classmethod
56
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
57
+ from ..models.pool_response import PoolResponse
58
+
59
+ d = dict(src_dict)
60
+ items = []
61
+ _items = d.pop("items")
62
+ for items_item_data in _items:
63
+ items_item = PoolResponse.from_dict(items_item_data)
64
+
65
+ items.append(items_item)
66
+
67
+ total = d.pop("total")
68
+
69
+ skip = d.pop("skip")
70
+
71
+ limit = d.pop("limit")
72
+
73
+ paginated_response_pool_response = cls(
74
+ items=items,
75
+ total=total,
76
+ skip=skip,
77
+ limit=limit,
78
+ )
79
+
80
+ paginated_response_pool_response.additional_properties = d
81
+ return paginated_response_pool_response
82
+
83
+ @property
84
+ def additional_keys(self) -> list[str]:
85
+ return list(self.additional_properties.keys())
86
+
87
+ def __getitem__(self, key: str) -> Any:
88
+ return self.additional_properties[key]
89
+
90
+ def __setitem__(self, key: str, value: Any) -> None:
91
+ self.additional_properties[key] = value
92
+
93
+ def __delitem__(self, key: str) -> None:
94
+ del self.additional_properties[key]
95
+
96
+ def __contains__(self, key: str) -> bool:
97
+ return key in self.additional_properties
@@ -0,0 +1,82 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar, Union, cast
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ from ..types import UNSET, Unset
8
+
9
+ T = TypeVar("T", bound="PoolCreate")
10
+
11
+
12
+ @_attrs_define
13
+ class PoolCreate:
14
+ """Schema for creating a pool
15
+
16
+ Attributes:
17
+ name (str):
18
+ description (Union[None, Unset, str]):
19
+ """
20
+
21
+ name: str
22
+ description: Union[None, Unset, str] = UNSET
23
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
24
+
25
+ def to_dict(self) -> dict[str, Any]:
26
+ name = self.name
27
+
28
+ description: Union[None, Unset, str]
29
+ if isinstance(self.description, Unset):
30
+ description = UNSET
31
+ else:
32
+ description = self.description
33
+
34
+ field_dict: dict[str, Any] = {}
35
+ field_dict.update(self.additional_properties)
36
+ field_dict.update(
37
+ {
38
+ "name": name,
39
+ }
40
+ )
41
+ if description is not UNSET:
42
+ field_dict["description"] = description
43
+
44
+ return field_dict
45
+
46
+ @classmethod
47
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
48
+ d = dict(src_dict)
49
+ name = d.pop("name")
50
+
51
+ def _parse_description(data: object) -> Union[None, Unset, str]:
52
+ if data is None:
53
+ return data
54
+ if isinstance(data, Unset):
55
+ return data
56
+ return cast(Union[None, Unset, str], data)
57
+
58
+ description = _parse_description(d.pop("description", UNSET))
59
+
60
+ pool_create = cls(
61
+ name=name,
62
+ description=description,
63
+ )
64
+
65
+ pool_create.additional_properties = d
66
+ return pool_create
67
+
68
+ @property
69
+ def additional_keys(self) -> list[str]:
70
+ return list(self.additional_properties.keys())
71
+
72
+ def __getitem__(self, key: str) -> Any:
73
+ return self.additional_properties[key]
74
+
75
+ def __setitem__(self, key: str, value: Any) -> None:
76
+ self.additional_properties[key] = value
77
+
78
+ def __delitem__(self, key: str) -> None:
79
+ del self.additional_properties[key]
80
+
81
+ def __contains__(self, key: str) -> bool:
82
+ return key in self.additional_properties