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.
- cyberdesk/__init__.py +1 -1
- cyberdesk/client.py +358 -6
- {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/METADATA +1 -1
- {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/RECORD +29 -12
- openapi_client/cyberdesk_cloud_client/api/machines/get_machine_pools_v1_machines_machine_id_pools_get.py +169 -0
- openapi_client/cyberdesk_cloud_client/api/machines/update_machine_pools_v1_machines_machine_id_pools_put.py +190 -0
- openapi_client/cyberdesk_cloud_client/api/pools/__init__.py +1 -0
- openapi_client/cyberdesk_cloud_client/api/pools/add_machines_to_pool_v1_pools_pool_id_machines_post.py +186 -0
- openapi_client/cyberdesk_cloud_client/api/pools/create_pool_v1_pools_post.py +172 -0
- openapi_client/cyberdesk_cloud_client/api/pools/delete_pool_v1_pools_pool_id_delete.py +162 -0
- openapi_client/cyberdesk_cloud_client/api/pools/get_pool_v1_pools_pool_id_get.py +185 -0
- openapi_client/cyberdesk_cloud_client/api/pools/list_pools_v1_pools_get.py +186 -0
- openapi_client/cyberdesk_cloud_client/api/pools/remove_machines_from_pool_v1_pools_pool_id_machines_delete.py +184 -0
- openapi_client/cyberdesk_cloud_client/api/pools/update_pool_v1_pools_pool_id_patch.py +186 -0
- openapi_client/cyberdesk_cloud_client/models/__init__.py +14 -0
- openapi_client/cyberdesk_cloud_client/models/machine_pool_assignment.py +69 -0
- openapi_client/cyberdesk_cloud_client/models/machine_pool_update.py +69 -0
- openapi_client/cyberdesk_cloud_client/models/machine_response.py +46 -1
- openapi_client/cyberdesk_cloud_client/models/paginated_response_pool_response.py +97 -0
- openapi_client/cyberdesk_cloud_client/models/pool_create.py +82 -0
- openapi_client/cyberdesk_cloud_client/models/pool_response.py +137 -0
- openapi_client/cyberdesk_cloud_client/models/pool_update.py +92 -0
- openapi_client/cyberdesk_cloud_client/models/pool_with_machines.py +162 -0
- openapi_client/cyberdesk_cloud_client/models/run_bulk_create.py +40 -0
- openapi_client/cyberdesk_cloud_client/models/run_create.py +40 -0
- openapi_client/cyberdesk_cloud_client/models/run_response.py +39 -0
- {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/WHEEL +0 -0
- {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/licenses/LICENSE +0 -0
- {cyberdesk-2.0.0.dist-info → cyberdesk-2.1.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
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 ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
machine_id: UUID,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
_kwargs: dict[str, Any] = {
|
|
18
|
+
"method": "get",
|
|
19
|
+
"url": f"/v1/machines/{machine_id}/pools",
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return _kwargs
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _parse_response(
|
|
26
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
27
|
+
) -> Optional[Union[HTTPValidationError, list["PoolResponse"]]]:
|
|
28
|
+
if response.status_code == 200:
|
|
29
|
+
response_200 = []
|
|
30
|
+
_response_200 = response.json()
|
|
31
|
+
for response_200_item_data in _response_200:
|
|
32
|
+
response_200_item = PoolResponse.from_dict(response_200_item_data)
|
|
33
|
+
|
|
34
|
+
response_200.append(response_200_item)
|
|
35
|
+
|
|
36
|
+
return response_200
|
|
37
|
+
if response.status_code == 422:
|
|
38
|
+
response_422 = HTTPValidationError.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_422
|
|
41
|
+
if client.raise_on_unexpected_status:
|
|
42
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
43
|
+
else:
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _build_response(
|
|
48
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
49
|
+
) -> Response[Union[HTTPValidationError, list["PoolResponse"]]]:
|
|
50
|
+
return Response(
|
|
51
|
+
status_code=HTTPStatus(response.status_code),
|
|
52
|
+
content=response.content,
|
|
53
|
+
headers=response.headers,
|
|
54
|
+
parsed=_parse_response(client=client, response=response),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def sync_detailed(
|
|
59
|
+
machine_id: UUID,
|
|
60
|
+
*,
|
|
61
|
+
client: AuthenticatedClient,
|
|
62
|
+
) -> Response[Union[HTTPValidationError, list["PoolResponse"]]]:
|
|
63
|
+
"""Get Machine Pools
|
|
64
|
+
|
|
65
|
+
Get all pools that a machine belongs to.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
machine_id (UUID):
|
|
69
|
+
|
|
70
|
+
Raises:
|
|
71
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
72
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Response[Union[HTTPValidationError, list['PoolResponse']]]
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
kwargs = _get_kwargs(
|
|
79
|
+
machine_id=machine_id,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
response = client.get_httpx_client().request(
|
|
83
|
+
**kwargs,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return _build_response(client=client, response=response)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def sync(
|
|
90
|
+
machine_id: UUID,
|
|
91
|
+
*,
|
|
92
|
+
client: AuthenticatedClient,
|
|
93
|
+
) -> Optional[Union[HTTPValidationError, list["PoolResponse"]]]:
|
|
94
|
+
"""Get Machine Pools
|
|
95
|
+
|
|
96
|
+
Get all pools that a machine belongs to.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
machine_id (UUID):
|
|
100
|
+
|
|
101
|
+
Raises:
|
|
102
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
103
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
Union[HTTPValidationError, list['PoolResponse']]
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
return sync_detailed(
|
|
110
|
+
machine_id=machine_id,
|
|
111
|
+
client=client,
|
|
112
|
+
).parsed
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
async def asyncio_detailed(
|
|
116
|
+
machine_id: UUID,
|
|
117
|
+
*,
|
|
118
|
+
client: AuthenticatedClient,
|
|
119
|
+
) -> Response[Union[HTTPValidationError, list["PoolResponse"]]]:
|
|
120
|
+
"""Get Machine Pools
|
|
121
|
+
|
|
122
|
+
Get all pools that a machine belongs to.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
machine_id (UUID):
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
Response[Union[HTTPValidationError, list['PoolResponse']]]
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
kwargs = _get_kwargs(
|
|
136
|
+
machine_id=machine_id,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
140
|
+
|
|
141
|
+
return _build_response(client=client, response=response)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
async def asyncio(
|
|
145
|
+
machine_id: UUID,
|
|
146
|
+
*,
|
|
147
|
+
client: AuthenticatedClient,
|
|
148
|
+
) -> Optional[Union[HTTPValidationError, list["PoolResponse"]]]:
|
|
149
|
+
"""Get Machine Pools
|
|
150
|
+
|
|
151
|
+
Get all pools that a machine belongs to.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
machine_id (UUID):
|
|
155
|
+
|
|
156
|
+
Raises:
|
|
157
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
158
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
159
|
+
|
|
160
|
+
Returns:
|
|
161
|
+
Union[HTTPValidationError, list['PoolResponse']]
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
await asyncio_detailed(
|
|
166
|
+
machine_id=machine_id,
|
|
167
|
+
client=client,
|
|
168
|
+
)
|
|
169
|
+
).parsed
|
|
@@ -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
|
|
@@ -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
|