cyberdesk 1.11.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 (66) hide show
  1. cyberdesk/__init__.py +1 -1
  2. cyberdesk/client.py +358 -6
  3. {cyberdesk-1.11.0.dist-info → cyberdesk-2.1.0.dist-info}/METADATA +1 -1
  4. {cyberdesk-1.11.0.dist-info → cyberdesk-2.1.0.dist-info}/RECORD +66 -49
  5. openapi_client/cyberdesk_cloud_client/api/connections/create_connection_v1_connections_post.py +4 -4
  6. openapi_client/cyberdesk_cloud_client/api/connections/delete_connection_v1_connections_connection_id_delete.py +4 -4
  7. openapi_client/cyberdesk_cloud_client/api/connections/get_connection_v1_connections_connection_id_get.py +4 -4
  8. openapi_client/cyberdesk_cloud_client/api/connections/list_connections_v1_connections_get.py +4 -4
  9. openapi_client/cyberdesk_cloud_client/api/connections/update_connection_v1_connections_connection_id_patch.py +4 -4
  10. openapi_client/cyberdesk_cloud_client/api/machines/create_machine_v1_machines_post.py +4 -4
  11. openapi_client/cyberdesk_cloud_client/api/machines/delete_machine_v1_machines_machine_id_delete.py +4 -4
  12. openapi_client/cyberdesk_cloud_client/api/machines/get_machine_pools_v1_machines_machine_id_pools_get.py +169 -0
  13. openapi_client/cyberdesk_cloud_client/api/machines/get_machine_v1_machines_machine_id_get.py +4 -4
  14. openapi_client/cyberdesk_cloud_client/api/machines/list_machines_v1_machines_get.py +4 -4
  15. openapi_client/cyberdesk_cloud_client/api/machines/update_machine_pools_v1_machines_machine_id_pools_put.py +190 -0
  16. openapi_client/cyberdesk_cloud_client/api/machines/update_machine_v1_machines_machine_id_patch.py +4 -4
  17. openapi_client/cyberdesk_cloud_client/api/pools/__init__.py +1 -0
  18. openapi_client/cyberdesk_cloud_client/api/pools/add_machines_to_pool_v1_pools_pool_id_machines_post.py +186 -0
  19. openapi_client/cyberdesk_cloud_client/api/pools/create_pool_v1_pools_post.py +172 -0
  20. openapi_client/cyberdesk_cloud_client/api/pools/delete_pool_v1_pools_pool_id_delete.py +162 -0
  21. openapi_client/cyberdesk_cloud_client/api/pools/get_pool_v1_pools_pool_id_get.py +185 -0
  22. openapi_client/cyberdesk_cloud_client/api/pools/list_pools_v1_pools_get.py +186 -0
  23. openapi_client/cyberdesk_cloud_client/api/pools/remove_machines_from_pool_v1_pools_pool_id_machines_delete.py +184 -0
  24. openapi_client/cyberdesk_cloud_client/api/pools/update_pool_v1_pools_pool_id_patch.py +186 -0
  25. openapi_client/cyberdesk_cloud_client/api/request_logs/create_request_log_v1_request_logs_post.py +4 -4
  26. openapi_client/cyberdesk_cloud_client/api/request_logs/delete_request_log_v1_request_logs_log_id_delete.py +4 -4
  27. openapi_client/cyberdesk_cloud_client/api/request_logs/get_request_log_v1_request_logs_log_id_get.py +4 -4
  28. openapi_client/cyberdesk_cloud_client/api/request_logs/list_request_logs_v1_request_logs_get.py +4 -4
  29. openapi_client/cyberdesk_cloud_client/api/request_logs/update_request_log_v1_request_logs_log_id_patch.py +4 -4
  30. openapi_client/cyberdesk_cloud_client/api/run_attachments/list_run_attachments_v1_run_attachments_get.py +4 -4
  31. openapi_client/cyberdesk_cloud_client/api/runs/create_run_v1_runs_post.py +12 -8
  32. openapi_client/cyberdesk_cloud_client/api/runs/delete_run_v1_runs_run_id_delete.py +8 -4
  33. openapi_client/cyberdesk_cloud_client/api/runs/get_run_v1_runs_run_id_get.py +4 -4
  34. openapi_client/cyberdesk_cloud_client/api/runs/list_runs_v1_runs_get.py +4 -4
  35. openapi_client/cyberdesk_cloud_client/api/runs/update_run_v1_runs_run_id_patch.py +8 -12
  36. openapi_client/cyberdesk_cloud_client/api/trajectories/create_trajectory_v1_trajectories_post.py +4 -4
  37. openapi_client/cyberdesk_cloud_client/api/trajectories/delete_trajectory_v1_trajectories_trajectory_id_delete.py +4 -4
  38. openapi_client/cyberdesk_cloud_client/api/trajectories/get_latest_trajectory_for_workflow_v1_workflows_workflow_id_latest_trajectory_get.py +4 -4
  39. openapi_client/cyberdesk_cloud_client/api/trajectories/get_trajectory_v1_trajectories_trajectory_id_get.py +4 -4
  40. openapi_client/cyberdesk_cloud_client/api/trajectories/list_trajectories_v1_trajectories_get.py +4 -4
  41. openapi_client/cyberdesk_cloud_client/api/trajectories/update_trajectory_v1_trajectories_trajectory_id_patch.py +4 -4
  42. openapi_client/cyberdesk_cloud_client/api/workflows/create_workflow_v1_workflows_post.py +4 -4
  43. openapi_client/cyberdesk_cloud_client/api/workflows/delete_workflow_v1_workflows_workflow_id_delete.py +4 -4
  44. openapi_client/cyberdesk_cloud_client/api/workflows/get_workflow_v1_workflows_workflow_id_get.py +4 -4
  45. openapi_client/cyberdesk_cloud_client/api/workflows/get_workflow_versions_v1_workflows_workflow_id_versions_get.py +4 -4
  46. openapi_client/cyberdesk_cloud_client/api/workflows/list_workflows_v1_workflows_get.py +4 -4
  47. openapi_client/cyberdesk_cloud_client/api/workflows/update_workflow_v1_workflows_workflow_id_patch.py +4 -4
  48. openapi_client/cyberdesk_cloud_client/models/__init__.py +14 -0
  49. openapi_client/cyberdesk_cloud_client/models/machine_pool_assignment.py +69 -0
  50. openapi_client/cyberdesk_cloud_client/models/machine_pool_update.py +69 -0
  51. openapi_client/cyberdesk_cloud_client/models/machine_response.py +96 -9
  52. openapi_client/cyberdesk_cloud_client/models/paginated_response_pool_response.py +97 -0
  53. openapi_client/cyberdesk_cloud_client/models/pool_create.py +82 -0
  54. openapi_client/cyberdesk_cloud_client/models/pool_response.py +137 -0
  55. openapi_client/cyberdesk_cloud_client/models/pool_update.py +92 -0
  56. openapi_client/cyberdesk_cloud_client/models/pool_with_machines.py +162 -0
  57. openapi_client/cyberdesk_cloud_client/models/request_log_response.py +20 -0
  58. openapi_client/cyberdesk_cloud_client/models/run_attachment_response.py +50 -8
  59. openapi_client/cyberdesk_cloud_client/models/run_bulk_create.py +40 -0
  60. openapi_client/cyberdesk_cloud_client/models/run_create.py +40 -0
  61. openapi_client/cyberdesk_cloud_client/models/run_response.py +90 -8
  62. openapi_client/cyberdesk_cloud_client/models/trajectory_response.py +50 -8
  63. openapi_client/cyberdesk_cloud_client/models/workflow_response.py +50 -8
  64. {cyberdesk-1.11.0.dist-info → cyberdesk-2.1.0.dist-info}/WHEEL +0 -0
  65. {cyberdesk-1.11.0.dist-info → cyberdesk-2.1.0.dist-info}/licenses/LICENSE +0 -0
  66. {cyberdesk-1.11.0.dist-info → cyberdesk-2.1.0.dist-info}/top_level.txt +0 -0
@@ -59,7 +59,7 @@ def sync_detailed(
59
59
 
60
60
  Get a specific machine by ID.
61
61
 
62
- The machine must belong to the authenticated user.
62
+ The machine must belong to the authenticated organization.
63
63
 
64
64
  Args:
65
65
  machine_id (UUID):
@@ -92,7 +92,7 @@ def sync(
92
92
 
93
93
  Get a specific machine by ID.
94
94
 
95
- The machine must belong to the authenticated user.
95
+ The machine must belong to the authenticated organization.
96
96
 
97
97
  Args:
98
98
  machine_id (UUID):
@@ -120,7 +120,7 @@ async def asyncio_detailed(
120
120
 
121
121
  Get a specific machine by ID.
122
122
 
123
- The machine must belong to the authenticated user.
123
+ The machine must belong to the authenticated organization.
124
124
 
125
125
  Args:
126
126
  machine_id (UUID):
@@ -151,7 +151,7 @@ async def asyncio(
151
151
 
152
152
  Get a specific machine by ID.
153
153
 
154
- The machine must belong to the authenticated user.
154
+ The machine must belong to the authenticated organization.
155
155
 
156
156
  Args:
157
157
  machine_id (UUID):
@@ -80,7 +80,7 @@ def sync_detailed(
80
80
  ) -> Response[Union[HTTPValidationError, PaginatedResponseMachineResponse]]:
81
81
  """List Machines
82
82
 
83
- List all machines for the authenticated user.
83
+ List all machines for the authenticated organization.
84
84
 
85
85
  Supports pagination and filtering by status.
86
86
 
@@ -119,7 +119,7 @@ def sync(
119
119
  ) -> Optional[Union[HTTPValidationError, PaginatedResponseMachineResponse]]:
120
120
  """List Machines
121
121
 
122
- List all machines for the authenticated user.
122
+ List all machines for the authenticated organization.
123
123
 
124
124
  Supports pagination and filtering by status.
125
125
 
@@ -153,7 +153,7 @@ async def asyncio_detailed(
153
153
  ) -> Response[Union[HTTPValidationError, PaginatedResponseMachineResponse]]:
154
154
  """List Machines
155
155
 
156
- List all machines for the authenticated user.
156
+ List all machines for the authenticated organization.
157
157
 
158
158
  Supports pagination and filtering by status.
159
159
 
@@ -190,7 +190,7 @@ async def asyncio(
190
190
  ) -> Optional[Union[HTTPValidationError, PaginatedResponseMachineResponse]]:
191
191
  """List Machines
192
192
 
193
- List all machines for the authenticated user.
193
+ List all machines for the authenticated organization.
194
194
 
195
195
  Supports pagination and filtering by status.
196
196
 
@@ -0,0 +1,190 @@
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.machine_pool_update import MachinePoolUpdate
11
+ from ...models.machine_response import MachineResponse
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ machine_id: UUID,
17
+ *,
18
+ body: MachinePoolUpdate,
19
+ ) -> dict[str, Any]:
20
+ headers: dict[str, Any] = {}
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "put",
24
+ "url": f"/v1/machines/{machine_id}/pools",
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, MachineResponse]]:
38
+ if response.status_code == 200:
39
+ response_200 = MachineResponse.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, MachineResponse]]:
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
+ machine_id: UUID,
65
+ *,
66
+ client: AuthenticatedClient,
67
+ body: MachinePoolUpdate,
68
+ ) -> Response[Union[HTTPValidationError, MachineResponse]]:
69
+ """Update Machine Pools
70
+
71
+ Update a machine's pool assignments.
72
+ This replaces all existing pool assignments with the new ones.
73
+
74
+ Args:
75
+ machine_id (UUID):
76
+ body (MachinePoolUpdate): Schema for updating a machine's pool assignments
77
+
78
+ Raises:
79
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
80
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
81
+
82
+ Returns:
83
+ Response[Union[HTTPValidationError, MachineResponse]]
84
+ """
85
+
86
+ kwargs = _get_kwargs(
87
+ machine_id=machine_id,
88
+ body=body,
89
+ )
90
+
91
+ response = client.get_httpx_client().request(
92
+ **kwargs,
93
+ )
94
+
95
+ return _build_response(client=client, response=response)
96
+
97
+
98
+ def sync(
99
+ machine_id: UUID,
100
+ *,
101
+ client: AuthenticatedClient,
102
+ body: MachinePoolUpdate,
103
+ ) -> Optional[Union[HTTPValidationError, MachineResponse]]:
104
+ """Update Machine Pools
105
+
106
+ Update a machine's pool assignments.
107
+ This replaces all existing pool assignments with the new ones.
108
+
109
+ Args:
110
+ machine_id (UUID):
111
+ body (MachinePoolUpdate): Schema for updating a machine's pool assignments
112
+
113
+ Raises:
114
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
115
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
116
+
117
+ Returns:
118
+ Union[HTTPValidationError, MachineResponse]
119
+ """
120
+
121
+ return sync_detailed(
122
+ machine_id=machine_id,
123
+ client=client,
124
+ body=body,
125
+ ).parsed
126
+
127
+
128
+ async def asyncio_detailed(
129
+ machine_id: UUID,
130
+ *,
131
+ client: AuthenticatedClient,
132
+ body: MachinePoolUpdate,
133
+ ) -> Response[Union[HTTPValidationError, MachineResponse]]:
134
+ """Update Machine Pools
135
+
136
+ Update a machine's pool assignments.
137
+ This replaces all existing pool assignments with the new ones.
138
+
139
+ Args:
140
+ machine_id (UUID):
141
+ body (MachinePoolUpdate): Schema for updating a machine's pool assignments
142
+
143
+ Raises:
144
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
145
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
146
+
147
+ Returns:
148
+ Response[Union[HTTPValidationError, MachineResponse]]
149
+ """
150
+
151
+ kwargs = _get_kwargs(
152
+ machine_id=machine_id,
153
+ body=body,
154
+ )
155
+
156
+ response = await client.get_async_httpx_client().request(**kwargs)
157
+
158
+ return _build_response(client=client, response=response)
159
+
160
+
161
+ async def asyncio(
162
+ machine_id: UUID,
163
+ *,
164
+ client: AuthenticatedClient,
165
+ body: MachinePoolUpdate,
166
+ ) -> Optional[Union[HTTPValidationError, MachineResponse]]:
167
+ """Update Machine Pools
168
+
169
+ Update a machine's pool assignments.
170
+ This replaces all existing pool assignments with the new ones.
171
+
172
+ Args:
173
+ machine_id (UUID):
174
+ body (MachinePoolUpdate): Schema for updating a machine's pool assignments
175
+
176
+ Raises:
177
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
178
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
179
+
180
+ Returns:
181
+ Union[HTTPValidationError, MachineResponse]
182
+ """
183
+
184
+ return (
185
+ await asyncio_detailed(
186
+ machine_id=machine_id,
187
+ client=client,
188
+ body=body,
189
+ )
190
+ ).parsed
@@ -71,7 +71,7 @@ def sync_detailed(
71
71
  Update a machine's information.
72
72
 
73
73
  Only the fields provided in the request body will be updated.
74
- The machine must belong to the authenticated user.
74
+ The machine must belong to the authenticated organization.
75
75
 
76
76
  Args:
77
77
  machine_id (UUID):
@@ -108,7 +108,7 @@ def sync(
108
108
  Update a machine's information.
109
109
 
110
110
  Only the fields provided in the request body will be updated.
111
- The machine must belong to the authenticated user.
111
+ The machine must belong to the authenticated organization.
112
112
 
113
113
  Args:
114
114
  machine_id (UUID):
@@ -140,7 +140,7 @@ async def asyncio_detailed(
140
140
  Update a machine's information.
141
141
 
142
142
  Only the fields provided in the request body will be updated.
143
- The machine must belong to the authenticated user.
143
+ The machine must belong to the authenticated organization.
144
144
 
145
145
  Args:
146
146
  machine_id (UUID):
@@ -175,7 +175,7 @@ async def asyncio(
175
175
  Update a machine's information.
176
176
 
177
177
  Only the fields provided in the request body will be updated.
178
- The machine must belong to the authenticated user.
178
+ The machine must belong to the authenticated organization.
179
179
 
180
180
  Args:
181
181
  machine_id (UUID):
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -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.machine_pool_assignment import MachinePoolAssignment
11
+ from ...models.pool_with_machines import PoolWithMachines
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ pool_id: UUID,
17
+ *,
18
+ body: MachinePoolAssignment,
19
+ ) -> dict[str, Any]:
20
+ headers: dict[str, Any] = {}
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "post",
24
+ "url": f"/v1/pools/{pool_id}/machines",
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, PoolWithMachines]]:
38
+ if response.status_code == 200:
39
+ response_200 = PoolWithMachines.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, PoolWithMachines]]:
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: MachinePoolAssignment,
68
+ ) -> Response[Union[HTTPValidationError, PoolWithMachines]]:
69
+ """Add Machines To Pool
70
+
71
+ Add machines to a pool.
72
+
73
+ Args:
74
+ pool_id (UUID):
75
+ body (MachinePoolAssignment): Schema for assigning machines to pools
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, PoolWithMachines]]
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: MachinePoolAssignment,
102
+ ) -> Optional[Union[HTTPValidationError, PoolWithMachines]]:
103
+ """Add Machines To Pool
104
+
105
+ Add machines to a pool.
106
+
107
+ Args:
108
+ pool_id (UUID):
109
+ body (MachinePoolAssignment): Schema for assigning machines to pools
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, PoolWithMachines]
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: MachinePoolAssignment,
131
+ ) -> Response[Union[HTTPValidationError, PoolWithMachines]]:
132
+ """Add Machines To Pool
133
+
134
+ Add machines to a pool.
135
+
136
+ Args:
137
+ pool_id (UUID):
138
+ body (MachinePoolAssignment): Schema for assigning machines to pools
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, PoolWithMachines]]
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: MachinePoolAssignment,
163
+ ) -> Optional[Union[HTTPValidationError, PoolWithMachines]]:
164
+ """Add Machines To Pool
165
+
166
+ Add machines to a pool.
167
+
168
+ Args:
169
+ pool_id (UUID):
170
+ body (MachinePoolAssignment): Schema for assigning machines to pools
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, PoolWithMachines]
178
+ """
179
+
180
+ return (
181
+ await asyncio_detailed(
182
+ pool_id=pool_id,
183
+ client=client,
184
+ body=body,
185
+ )
186
+ ).parsed
@@ -0,0 +1,172 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.http_validation_error import HTTPValidationError
9
+ from ...models.pool_create import PoolCreate
10
+ from ...models.pool_response import PoolResponse
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ body: PoolCreate,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "post",
22
+ "url": "/v1/pools",
23
+ }
24
+
25
+ _kwargs["json"] = body.to_dict()
26
+
27
+ headers["Content-Type"] = "application/json"
28
+
29
+ _kwargs["headers"] = headers
30
+ return _kwargs
31
+
32
+
33
+ def _parse_response(
34
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
35
+ ) -> Optional[Union[HTTPValidationError, PoolResponse]]:
36
+ if response.status_code == 201:
37
+ response_201 = PoolResponse.from_dict(response.json())
38
+
39
+ return response_201
40
+ if response.status_code == 422:
41
+ response_422 = HTTPValidationError.from_dict(response.json())
42
+
43
+ return response_422
44
+ if client.raise_on_unexpected_status:
45
+ raise errors.UnexpectedStatus(response.status_code, response.content)
46
+ else:
47
+ return None
48
+
49
+
50
+ def _build_response(
51
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
52
+ ) -> Response[Union[HTTPValidationError, PoolResponse]]:
53
+ return Response(
54
+ status_code=HTTPStatus(response.status_code),
55
+ content=response.content,
56
+ headers=response.headers,
57
+ parsed=_parse_response(client=client, response=response),
58
+ )
59
+
60
+
61
+ def sync_detailed(
62
+ *,
63
+ client: AuthenticatedClient,
64
+ body: PoolCreate,
65
+ ) -> Response[Union[HTTPValidationError, PoolResponse]]:
66
+ """Create Pool
67
+
68
+ Create a new pool for organizing machines.
69
+
70
+ Args:
71
+ body (PoolCreate): Schema for creating a pool
72
+
73
+ Raises:
74
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
75
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
76
+
77
+ Returns:
78
+ Response[Union[HTTPValidationError, PoolResponse]]
79
+ """
80
+
81
+ kwargs = _get_kwargs(
82
+ body=body,
83
+ )
84
+
85
+ response = client.get_httpx_client().request(
86
+ **kwargs,
87
+ )
88
+
89
+ return _build_response(client=client, response=response)
90
+
91
+
92
+ def sync(
93
+ *,
94
+ client: AuthenticatedClient,
95
+ body: PoolCreate,
96
+ ) -> Optional[Union[HTTPValidationError, PoolResponse]]:
97
+ """Create Pool
98
+
99
+ Create a new pool for organizing machines.
100
+
101
+ Args:
102
+ body (PoolCreate): Schema for creating a pool
103
+
104
+ Raises:
105
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
106
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
107
+
108
+ Returns:
109
+ Union[HTTPValidationError, PoolResponse]
110
+ """
111
+
112
+ return sync_detailed(
113
+ client=client,
114
+ body=body,
115
+ ).parsed
116
+
117
+
118
+ async def asyncio_detailed(
119
+ *,
120
+ client: AuthenticatedClient,
121
+ body: PoolCreate,
122
+ ) -> Response[Union[HTTPValidationError, PoolResponse]]:
123
+ """Create Pool
124
+
125
+ Create a new pool for organizing machines.
126
+
127
+ Args:
128
+ body (PoolCreate): Schema for creating a pool
129
+
130
+ Raises:
131
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
132
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
133
+
134
+ Returns:
135
+ Response[Union[HTTPValidationError, PoolResponse]]
136
+ """
137
+
138
+ kwargs = _get_kwargs(
139
+ body=body,
140
+ )
141
+
142
+ response = await client.get_async_httpx_client().request(**kwargs)
143
+
144
+ return _build_response(client=client, response=response)
145
+
146
+
147
+ async def asyncio(
148
+ *,
149
+ client: AuthenticatedClient,
150
+ body: PoolCreate,
151
+ ) -> Optional[Union[HTTPValidationError, PoolResponse]]:
152
+ """Create Pool
153
+
154
+ Create a new pool for organizing machines.
155
+
156
+ Args:
157
+ body (PoolCreate): Schema for creating a pool
158
+
159
+ Raises:
160
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
161
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
162
+
163
+ Returns:
164
+ Union[HTTPValidationError, PoolResponse]
165
+ """
166
+
167
+ return (
168
+ await asyncio_detailed(
169
+ client=client,
170
+ body=body,
171
+ )
172
+ ).parsed