beamlit 0.0.24rc20__py3-none-any.whl → 0.0.25__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beamlit/agents/chat.py +37 -11
- beamlit/agents/decorator.py +97 -65
- beamlit/api/agents/create_agent.py +9 -14
- beamlit/api/agents/delete_agent.py +22 -1
- beamlit/api/agents/delete_agent_history.py +2 -6
- beamlit/api/agents/get_agent.py +22 -1
- beamlit/api/agents/get_agent_environment_logs.py +11 -11
- beamlit/api/agents/get_agent_history.py +2 -6
- beamlit/api/agents/get_agent_metrics.py +22 -1
- beamlit/api/agents/list_agent_history.py +11 -11
- beamlit/api/agents/list_agents.py +36 -4
- beamlit/api/agents/put_agent_history.py +2 -6
- beamlit/api/agents/update_agent.py +9 -14
- beamlit/api/functions/create_function.py +9 -14
- beamlit/api/functions/delete_function.py +22 -1
- beamlit/api/functions/get_function.py +22 -1
- beamlit/api/functions/get_function_environment_logs.py +11 -11
- beamlit/api/functions/get_function_metrics.py +22 -1
- beamlit/api/functions/list_functions.py +36 -4
- beamlit/api/functions/update_function.py +9 -14
- beamlit/api/history/get_agents_history.py +12 -12
- beamlit/api/history/list_agents_history.py +12 -12
- beamlit/api/integrations/get_integration_connection.py +16 -12
- beamlit/api/integrations/get_integration_connection_model.py +8 -1
- beamlit/api/integrations/get_integration_model.py +8 -1
- beamlit/api/locations/list_locations.py +12 -12
- beamlit/api/models/create_model.py +13 -14
- beamlit/api/models/delete_model.py +22 -1
- beamlit/api/models/get_model.py +22 -1
- beamlit/api/models/get_model_environment_logs.py +11 -11
- beamlit/api/models/get_model_metrics.py +38 -13
- beamlit/api/models/list_models.py +36 -4
- beamlit/api/models/update_model.py +13 -14
- beamlit/api/privateclusters/__init__.py +0 -0
- beamlit/api/{agents/get_agent_deployment_metrics.py → privateclusters/create_private_cluster.py} +28 -55
- beamlit/api/{functions/list_function_deployments.py → privateclusters/delete_private_cluster.py} +38 -37
- beamlit/api/{agents/get_agent_deployment.py → privateclusters/get_private_cluster.py} +40 -44
- beamlit/api/privateclusters/get_private_cluster_health.py +97 -0
- beamlit/api/{agents/list_agent_deployments.py → privateclusters/list_private_clusters.py} +30 -45
- beamlit/api/{models/list_model_deployments.py → privateclusters/update_private_cluster.py} +38 -45
- beamlit/api/privateclusters/update_private_cluster_health.py +97 -0
- beamlit/authentication/device_mode.py +3 -9
- beamlit/common/generate.py +47 -34
- beamlit/common/settings.py +29 -27
- beamlit/deploy/deploy.py +101 -342
- beamlit/deploy/format.py +70 -0
- beamlit/deploy/parser.py +175 -0
- beamlit/functions/decorator.py +8 -11
- beamlit/models/__init__.py +64 -78
- beamlit/models/acl.py +4 -22
- beamlit/models/agent.py +34 -95
- beamlit/models/agent_history.py +7 -5
- beamlit/models/agent_history_event.py +11 -9
- beamlit/models/agent_metadata.py +5 -3
- beamlit/models/agent_spec.py +54 -45
- beamlit/models/api_key.py +14 -14
- beamlit/models/configuration.py +11 -0
- beamlit/models/core_spec.py +45 -32
- beamlit/models/{model_deployment_metrics_query_per_second_per_region_per_code.py → core_spec_configurations.py} +22 -22
- beamlit/models/environment.py +33 -105
- beamlit/models/environment_metadata.py +146 -0
- beamlit/models/environment_spec.py +8 -6
- beamlit/models/function.py +34 -95
- beamlit/models/function_metadata.py +5 -3
- beamlit/models/function_spec.py +53 -40
- beamlit/models/integration_connection.py +31 -137
- beamlit/models/integration_connection_spec.py +6 -4
- beamlit/models/metadata.py +5 -3
- beamlit/models/metadata_labels.py +4 -2
- beamlit/models/model.py +33 -94
- beamlit/models/model_metadata.py +5 -3
- beamlit/models/{function_provider_ref.py → model_private_cluster.py} +23 -14
- beamlit/models/model_provider.py +27 -43
- beamlit/models/model_spec.py +45 -32
- beamlit/models/owner_fields.py +4 -2
- beamlit/models/pending_invitation.py +14 -14
- beamlit/models/pod_template_spec.py +4 -2
- beamlit/models/policy.py +33 -159
- beamlit/models/policy_spec.py +24 -28
- beamlit/models/private_cluster.py +183 -0
- beamlit/models/{model_provider_ref.py → private_location.py} +7 -16
- beamlit/models/resource_deployment_metrics.py +0 -108
- beamlit/models/resource_environment_metrics.py +143 -71
- beamlit/models/{resource_deployment_metrics_inference_per_region.py → resource_environment_metrics_inference_per_region.py} +5 -5
- beamlit/models/resource_environment_metrics_inference_per_second_per_region.py +9 -11
- beamlit/models/{resource_deployment_metrics_query_per_region_per_code.py → resource_environment_metrics_query_per_region_per_code.py} +5 -5
- beamlit/models/resource_environment_metrics_query_per_second_per_region_per_code.py +5 -3
- beamlit/models/resource_log.py +4 -2
- beamlit/models/runtime.py +20 -2
- beamlit/models/serverless_config.py +28 -21
- beamlit/models/spec_configuration.py +7 -5
- beamlit/models/store_agent.py +14 -14
- beamlit/models/store_function.py +14 -14
- beamlit/models/time_fields.py +4 -2
- beamlit/models/websocket_channel.py +4 -2
- beamlit/models/workspace.py +23 -14
- beamlit/run.py +0 -1
- beamlit/serve/app.py +1 -0
- beamlit/serve/middlewares/accesslog.py +3 -1
- {beamlit-0.0.24rc20.dist-info → beamlit-0.0.25.dist-info}/METADATA +1 -1
- beamlit-0.0.25.dist-info/RECORD +243 -0
- beamlit/api/agents/delete_agent_deployment.py +0 -163
- beamlit/api/agents/delete_agent_deployment_history.py +0 -172
- beamlit/api/agents/get_agent_deployment_history.py +0 -172
- beamlit/api/agents/get_agent_deployment_logs.py +0 -164
- beamlit/api/agents/list_agent_deployment_history.py +0 -164
- beamlit/api/agents/put_agent_deployment.py +0 -185
- beamlit/api/agents/put_agent_deployment_history.py +0 -198
- beamlit/api/functions/delete_function_deployment.py +0 -163
- beamlit/api/functions/get_function_deployment.py +0 -163
- beamlit/api/functions/get_function_deployment_logs.py +0 -164
- beamlit/api/functions/get_function_deployment_metrics.py +0 -159
- beamlit/api/functions/put_function_deployment.py +0 -185
- beamlit/api/models/delete_model_deployment.py +0 -171
- beamlit/api/models/get_model_deployment.py +0 -171
- beamlit/api/models/get_model_deployment_logs.py +0 -168
- beamlit/api/models/get_model_deployment_metrics.py +0 -163
- beamlit/api/models/put_model_deployment.py +0 -193
- beamlit/models/agent_configuration.py +0 -70
- beamlit/models/agent_deployment.py +0 -340
- beamlit/models/agent_deployment_configuration.py +0 -45
- beamlit/models/agent_deployment_configuration_type_0.py +0 -43
- beamlit/models/agent_deployment_history.py +0 -185
- beamlit/models/agent_deployment_history_event.py +0 -133
- beamlit/models/agent_deployment_pod_template.py +0 -45
- beamlit/models/agent_deployment_pod_template_type_0.py +0 -43
- beamlit/models/agent_with_deployments.py +0 -176
- beamlit/models/authentication_provider_model.py +0 -144
- beamlit/models/authentication_provider_organization.py +0 -88
- beamlit/models/deployment_configuration.py +0 -70
- beamlit/models/deployment_configurations.py +0 -58
- beamlit/models/deployment_serverless_config.py +0 -131
- beamlit/models/deployment_serverless_config_type_0.py +0 -220
- beamlit/models/function_configuration.py +0 -70
- beamlit/models/function_deployment.py +0 -340
- beamlit/models/function_deployment_configuration.py +0 -45
- beamlit/models/function_deployment_configuration_type_0.py +0 -43
- beamlit/models/function_deployment_pod_template.py +0 -45
- beamlit/models/function_deployment_pod_template_type_0.py +0 -43
- beamlit/models/function_with_deployments.py +0 -176
- beamlit/models/integration.py +0 -198
- beamlit/models/integration_config.py +0 -45
- beamlit/models/integration_secret.py +0 -61
- beamlit/models/labels_type_0.py +0 -45
- beamlit/models/location.py +0 -122
- beamlit/models/model_deployment.py +0 -296
- beamlit/models/model_deployment_log.py +0 -70
- beamlit/models/model_deployment_metrics.py +0 -172
- beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +0 -77
- beamlit/models/model_deployment_pod_template.py +0 -45
- beamlit/models/model_deployment_pod_template_type_0.py +0 -43
- beamlit/models/model_metrics.py +0 -96
- beamlit/models/model_with_deployments.py +0 -176
- beamlit/models/resource_deployment_log.py +0 -70
- beamlit/models/resource_deployment_metrics_inference_per_region_type_0.py +0 -79
- beamlit/models/resource_deployment_metrics_inference_per_second_per_region_type_0.py +0 -79
- beamlit/models/resource_deployment_metrics_query_per_region_per_code_type_0.py +0 -73
- beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code_type_0.py +0 -73
- beamlit/models/runtime_readiness_probe_type_0.py +0 -43
- beamlit/models/runtime_type_0.py +0 -111
- beamlit/models/runtime_type_0_readiness_probe.py +0 -43
- beamlit/models/runtime_type_0_readiness_probe_type_0.py +0 -43
- beamlit/models/runtime_type_0_resources.py +0 -59
- beamlit/models/standard_fields_dynamo_db.py +0 -88
- beamlit/models/store_agent_configuration.py +0 -97
- beamlit/models/store_agent_labels_type_0.py +0 -43
- beamlit/models/store_function_configuration.py +0 -97
- beamlit/models/store_function_labels_type_0.py +0 -43
- beamlit-0.0.24rc20.dist-info/RECORD +0 -303
- {beamlit-0.0.24rc20.dist-info → beamlit-0.0.25.dist-info}/WHEEL +0 -0
@@ -0,0 +1,97 @@
|
|
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 ...types import Response
|
9
|
+
|
10
|
+
|
11
|
+
def _get_kwargs(
|
12
|
+
private_cluster_name: str,
|
13
|
+
) -> dict[str, Any]:
|
14
|
+
_kwargs: dict[str, Any] = {
|
15
|
+
"method": "get",
|
16
|
+
"url": f"/privateclusters/{private_cluster_name}/health",
|
17
|
+
}
|
18
|
+
|
19
|
+
return _kwargs
|
20
|
+
|
21
|
+
|
22
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
23
|
+
if response.status_code == 200:
|
24
|
+
return None
|
25
|
+
if response.status_code == 401:
|
26
|
+
return None
|
27
|
+
if response.status_code == 403:
|
28
|
+
return None
|
29
|
+
if client.raise_on_unexpected_status:
|
30
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
31
|
+
else:
|
32
|
+
return None
|
33
|
+
|
34
|
+
|
35
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
36
|
+
return Response(
|
37
|
+
status_code=HTTPStatus(response.status_code),
|
38
|
+
content=response.content,
|
39
|
+
headers=response.headers,
|
40
|
+
parsed=_parse_response(client=client, response=response),
|
41
|
+
)
|
42
|
+
|
43
|
+
|
44
|
+
def sync_detailed(
|
45
|
+
private_cluster_name: str,
|
46
|
+
*,
|
47
|
+
client: Union[AuthenticatedClient, Client],
|
48
|
+
) -> Response[Any]:
|
49
|
+
"""Get private cluster health
|
50
|
+
|
51
|
+
Args:
|
52
|
+
private_cluster_name (str):
|
53
|
+
|
54
|
+
Raises:
|
55
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
56
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
57
|
+
|
58
|
+
Returns:
|
59
|
+
Response[Any]
|
60
|
+
"""
|
61
|
+
|
62
|
+
kwargs = _get_kwargs(
|
63
|
+
private_cluster_name=private_cluster_name,
|
64
|
+
)
|
65
|
+
|
66
|
+
response = client.get_httpx_client().request(
|
67
|
+
**kwargs,
|
68
|
+
)
|
69
|
+
|
70
|
+
return _build_response(client=client, response=response)
|
71
|
+
|
72
|
+
|
73
|
+
async def asyncio_detailed(
|
74
|
+
private_cluster_name: str,
|
75
|
+
*,
|
76
|
+
client: Union[AuthenticatedClient, Client],
|
77
|
+
) -> Response[Any]:
|
78
|
+
"""Get private cluster health
|
79
|
+
|
80
|
+
Args:
|
81
|
+
private_cluster_name (str):
|
82
|
+
|
83
|
+
Raises:
|
84
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
85
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
86
|
+
|
87
|
+
Returns:
|
88
|
+
Response[Any]
|
89
|
+
"""
|
90
|
+
|
91
|
+
kwargs = _get_kwargs(
|
92
|
+
private_cluster_name=private_cluster_name,
|
93
|
+
)
|
94
|
+
|
95
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
96
|
+
|
97
|
+
return _build_response(client=client, response=response)
|
@@ -1,20 +1,18 @@
|
|
1
1
|
from http import HTTPStatus
|
2
|
-
from typing import Any, Optional, Union
|
2
|
+
from typing import Any, Optional, Union, cast
|
3
3
|
|
4
4
|
import httpx
|
5
5
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
|
-
from ...models.
|
8
|
+
from ...models.private_cluster import PrivateCluster
|
9
9
|
from ...types import Response
|
10
10
|
|
11
11
|
|
12
|
-
def _get_kwargs(
|
13
|
-
agent_name: str,
|
14
|
-
) -> dict[str, Any]:
|
12
|
+
def _get_kwargs() -> dict[str, Any]:
|
15
13
|
_kwargs: dict[str, Any] = {
|
16
14
|
"method": "get",
|
17
|
-
"url":
|
15
|
+
"url": "/privateclusters",
|
18
16
|
}
|
19
17
|
|
20
18
|
return _kwargs
|
@@ -22,16 +20,25 @@ def _get_kwargs(
|
|
22
20
|
|
23
21
|
def _parse_response(
|
24
22
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
25
|
-
) -> Optional[list["
|
23
|
+
) -> Optional[Union[Any, list["PrivateCluster"]]]:
|
26
24
|
if response.status_code == 200:
|
27
25
|
response_200 = []
|
28
26
|
_response_200 = response.json()
|
29
27
|
for response_200_item_data in _response_200:
|
30
|
-
response_200_item =
|
28
|
+
response_200_item = PrivateCluster.from_dict(response_200_item_data)
|
31
29
|
|
32
30
|
response_200.append(response_200_item)
|
33
31
|
|
34
32
|
return response_200
|
33
|
+
if response.status_code == 401:
|
34
|
+
response_401 = cast(Any, None)
|
35
|
+
return response_401
|
36
|
+
if response.status_code == 403:
|
37
|
+
response_403 = cast(Any, None)
|
38
|
+
return response_403
|
39
|
+
if response.status_code == 404:
|
40
|
+
response_404 = cast(Any, None)
|
41
|
+
return response_404
|
35
42
|
if client.raise_on_unexpected_status:
|
36
43
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
37
44
|
else:
|
@@ -40,7 +47,7 @@ def _parse_response(
|
|
40
47
|
|
41
48
|
def _build_response(
|
42
49
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
43
|
-
) -> Response[list["
|
50
|
+
) -> Response[Union[Any, list["PrivateCluster"]]]:
|
44
51
|
return Response(
|
45
52
|
status_code=HTTPStatus(response.status_code),
|
46
53
|
content=response.content,
|
@@ -50,26 +57,20 @@ def _build_response(
|
|
50
57
|
|
51
58
|
|
52
59
|
def sync_detailed(
|
53
|
-
agent_name: str,
|
54
60
|
*,
|
55
61
|
client: AuthenticatedClient,
|
56
|
-
) -> Response[list["
|
57
|
-
"""List all
|
58
|
-
|
59
|
-
Args:
|
60
|
-
agent_name (str):
|
62
|
+
) -> Response[Union[Any, list["PrivateCluster"]]]:
|
63
|
+
"""List all private clusters
|
61
64
|
|
62
65
|
Raises:
|
63
66
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
64
67
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
65
68
|
|
66
69
|
Returns:
|
67
|
-
Response[list['
|
70
|
+
Response[Union[Any, list['PrivateCluster']]]
|
68
71
|
"""
|
69
72
|
|
70
|
-
kwargs = _get_kwargs(
|
71
|
-
agent_name=agent_name,
|
72
|
-
)
|
73
|
+
kwargs = _get_kwargs()
|
73
74
|
|
74
75
|
response = client.get_httpx_client().request(
|
75
76
|
**kwargs,
|
@@ -79,50 +80,39 @@ def sync_detailed(
|
|
79
80
|
|
80
81
|
|
81
82
|
def sync(
|
82
|
-
agent_name: str,
|
83
83
|
*,
|
84
84
|
client: AuthenticatedClient,
|
85
|
-
) -> Optional[list["
|
86
|
-
"""List all
|
87
|
-
|
88
|
-
Args:
|
89
|
-
agent_name (str):
|
85
|
+
) -> Optional[Union[Any, list["PrivateCluster"]]]:
|
86
|
+
"""List all private clusters
|
90
87
|
|
91
88
|
Raises:
|
92
89
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
93
90
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
94
91
|
|
95
92
|
Returns:
|
96
|
-
list['
|
93
|
+
Union[Any, list['PrivateCluster']]
|
97
94
|
"""
|
98
95
|
|
99
96
|
return sync_detailed(
|
100
|
-
agent_name=agent_name,
|
101
97
|
client=client,
|
102
98
|
).parsed
|
103
99
|
|
104
100
|
|
105
101
|
async def asyncio_detailed(
|
106
|
-
agent_name: str,
|
107
102
|
*,
|
108
103
|
client: AuthenticatedClient,
|
109
|
-
) -> Response[list["
|
110
|
-
"""List all
|
111
|
-
|
112
|
-
Args:
|
113
|
-
agent_name (str):
|
104
|
+
) -> Response[Union[Any, list["PrivateCluster"]]]:
|
105
|
+
"""List all private clusters
|
114
106
|
|
115
107
|
Raises:
|
116
108
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
117
109
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
118
110
|
|
119
111
|
Returns:
|
120
|
-
Response[list['
|
112
|
+
Response[Union[Any, list['PrivateCluster']]]
|
121
113
|
"""
|
122
114
|
|
123
|
-
kwargs = _get_kwargs(
|
124
|
-
agent_name=agent_name,
|
125
|
-
)
|
115
|
+
kwargs = _get_kwargs()
|
126
116
|
|
127
117
|
response = await client.get_async_httpx_client().request(**kwargs)
|
128
118
|
|
@@ -130,26 +120,21 @@ async def asyncio_detailed(
|
|
130
120
|
|
131
121
|
|
132
122
|
async def asyncio(
|
133
|
-
agent_name: str,
|
134
123
|
*,
|
135
124
|
client: AuthenticatedClient,
|
136
|
-
) -> Optional[list["
|
137
|
-
"""List all
|
138
|
-
|
139
|
-
Args:
|
140
|
-
agent_name (str):
|
125
|
+
) -> Optional[Union[Any, list["PrivateCluster"]]]:
|
126
|
+
"""List all private clusters
|
141
127
|
|
142
128
|
Raises:
|
143
129
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
144
130
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
145
131
|
|
146
132
|
Returns:
|
147
|
-
list['
|
133
|
+
Union[Any, list['PrivateCluster']]
|
148
134
|
"""
|
149
135
|
|
150
136
|
return (
|
151
137
|
await asyncio_detailed(
|
152
|
-
agent_name=agent_name,
|
153
138
|
client=client,
|
154
139
|
)
|
155
140
|
).parsed
|
@@ -1,20 +1,20 @@
|
|
1
1
|
from http import HTTPStatus
|
2
|
-
from typing import Any, Optional, Union
|
2
|
+
from typing import Any, Optional, Union, cast
|
3
3
|
|
4
4
|
import httpx
|
5
5
|
|
6
6
|
from ... import errors
|
7
7
|
from ...client import AuthenticatedClient, Client
|
8
|
-
from ...models.
|
8
|
+
from ...models.private_cluster import PrivateCluster
|
9
9
|
from ...types import Response
|
10
10
|
|
11
11
|
|
12
12
|
def _get_kwargs(
|
13
|
-
|
13
|
+
private_cluster_name: str,
|
14
14
|
) -> dict[str, Any]:
|
15
15
|
_kwargs: dict[str, Any] = {
|
16
|
-
"method": "
|
17
|
-
"url": f"/
|
16
|
+
"method": "put",
|
17
|
+
"url": f"/privateclusters/{private_cluster_name}",
|
18
18
|
}
|
19
19
|
|
20
20
|
return _kwargs
|
@@ -22,16 +22,17 @@ def _get_kwargs(
|
|
22
22
|
|
23
23
|
def _parse_response(
|
24
24
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
25
|
-
) -> Optional[
|
25
|
+
) -> Optional[Union[Any, PrivateCluster]]:
|
26
26
|
if response.status_code == 200:
|
27
|
-
response_200 =
|
28
|
-
_response_200 = response.json()
|
29
|
-
for response_200_item_data in _response_200:
|
30
|
-
response_200_item = ModelDeployment.from_dict(response_200_item_data)
|
31
|
-
|
32
|
-
response_200.append(response_200_item)
|
27
|
+
response_200 = PrivateCluster.from_dict(response.json())
|
33
28
|
|
34
29
|
return response_200
|
30
|
+
if response.status_code == 401:
|
31
|
+
response_401 = cast(Any, None)
|
32
|
+
return response_401
|
33
|
+
if response.status_code == 403:
|
34
|
+
response_403 = cast(Any, None)
|
35
|
+
return response_403
|
35
36
|
if client.raise_on_unexpected_status:
|
36
37
|
raise errors.UnexpectedStatus(response.status_code, response.content)
|
37
38
|
else:
|
@@ -40,7 +41,7 @@ def _parse_response(
|
|
40
41
|
|
41
42
|
def _build_response(
|
42
43
|
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
43
|
-
) -> Response[
|
44
|
+
) -> Response[Union[Any, PrivateCluster]]:
|
44
45
|
return Response(
|
45
46
|
status_code=HTTPStatus(response.status_code),
|
46
47
|
content=response.content,
|
@@ -50,27 +51,25 @@ def _build_response(
|
|
50
51
|
|
51
52
|
|
52
53
|
def sync_detailed(
|
53
|
-
|
54
|
+
private_cluster_name: str,
|
54
55
|
*,
|
55
56
|
client: AuthenticatedClient,
|
56
|
-
) -> Response[
|
57
|
-
"""
|
58
|
-
|
59
|
-
Returns a list of all deployments for a model.
|
57
|
+
) -> Response[Union[Any, PrivateCluster]]:
|
58
|
+
"""Update private cluster
|
60
59
|
|
61
60
|
Args:
|
62
|
-
|
61
|
+
private_cluster_name (str):
|
63
62
|
|
64
63
|
Raises:
|
65
64
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
66
65
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
67
66
|
|
68
67
|
Returns:
|
69
|
-
Response[
|
68
|
+
Response[Union[Any, PrivateCluster]]
|
70
69
|
"""
|
71
70
|
|
72
71
|
kwargs = _get_kwargs(
|
73
|
-
|
72
|
+
private_cluster_name=private_cluster_name,
|
74
73
|
)
|
75
74
|
|
76
75
|
response = client.get_httpx_client().request(
|
@@ -81,53 +80,49 @@ def sync_detailed(
|
|
81
80
|
|
82
81
|
|
83
82
|
def sync(
|
84
|
-
|
83
|
+
private_cluster_name: str,
|
85
84
|
*,
|
86
85
|
client: AuthenticatedClient,
|
87
|
-
) -> Optional[
|
88
|
-
"""
|
89
|
-
|
90
|
-
Returns a list of all deployments for a model.
|
86
|
+
) -> Optional[Union[Any, PrivateCluster]]:
|
87
|
+
"""Update private cluster
|
91
88
|
|
92
89
|
Args:
|
93
|
-
|
90
|
+
private_cluster_name (str):
|
94
91
|
|
95
92
|
Raises:
|
96
93
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
97
94
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
98
95
|
|
99
96
|
Returns:
|
100
|
-
|
97
|
+
Union[Any, PrivateCluster]
|
101
98
|
"""
|
102
99
|
|
103
100
|
return sync_detailed(
|
104
|
-
|
101
|
+
private_cluster_name=private_cluster_name,
|
105
102
|
client=client,
|
106
103
|
).parsed
|
107
104
|
|
108
105
|
|
109
106
|
async def asyncio_detailed(
|
110
|
-
|
107
|
+
private_cluster_name: str,
|
111
108
|
*,
|
112
109
|
client: AuthenticatedClient,
|
113
|
-
) -> Response[
|
114
|
-
"""
|
115
|
-
|
116
|
-
Returns a list of all deployments for a model.
|
110
|
+
) -> Response[Union[Any, PrivateCluster]]:
|
111
|
+
"""Update private cluster
|
117
112
|
|
118
113
|
Args:
|
119
|
-
|
114
|
+
private_cluster_name (str):
|
120
115
|
|
121
116
|
Raises:
|
122
117
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
123
118
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
124
119
|
|
125
120
|
Returns:
|
126
|
-
Response[
|
121
|
+
Response[Union[Any, PrivateCluster]]
|
127
122
|
"""
|
128
123
|
|
129
124
|
kwargs = _get_kwargs(
|
130
|
-
|
125
|
+
private_cluster_name=private_cluster_name,
|
131
126
|
)
|
132
127
|
|
133
128
|
response = await client.get_async_httpx_client().request(**kwargs)
|
@@ -136,28 +131,26 @@ async def asyncio_detailed(
|
|
136
131
|
|
137
132
|
|
138
133
|
async def asyncio(
|
139
|
-
|
134
|
+
private_cluster_name: str,
|
140
135
|
*,
|
141
136
|
client: AuthenticatedClient,
|
142
|
-
) -> Optional[
|
143
|
-
"""
|
144
|
-
|
145
|
-
Returns a list of all deployments for a model.
|
137
|
+
) -> Optional[Union[Any, PrivateCluster]]:
|
138
|
+
"""Update private cluster
|
146
139
|
|
147
140
|
Args:
|
148
|
-
|
141
|
+
private_cluster_name (str):
|
149
142
|
|
150
143
|
Raises:
|
151
144
|
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
152
145
|
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
153
146
|
|
154
147
|
Returns:
|
155
|
-
|
148
|
+
Union[Any, PrivateCluster]
|
156
149
|
"""
|
157
150
|
|
158
151
|
return (
|
159
152
|
await asyncio_detailed(
|
160
|
-
|
153
|
+
private_cluster_name=private_cluster_name,
|
161
154
|
client=client,
|
162
155
|
)
|
163
156
|
).parsed
|
@@ -0,0 +1,97 @@
|
|
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 ...types import Response
|
9
|
+
|
10
|
+
|
11
|
+
def _get_kwargs(
|
12
|
+
private_cluster_name: str,
|
13
|
+
) -> dict[str, Any]:
|
14
|
+
_kwargs: dict[str, Any] = {
|
15
|
+
"method": "post",
|
16
|
+
"url": f"/privateclusters/{private_cluster_name}/health",
|
17
|
+
}
|
18
|
+
|
19
|
+
return _kwargs
|
20
|
+
|
21
|
+
|
22
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
23
|
+
if response.status_code == 200:
|
24
|
+
return None
|
25
|
+
if response.status_code == 401:
|
26
|
+
return None
|
27
|
+
if response.status_code == 403:
|
28
|
+
return None
|
29
|
+
if client.raise_on_unexpected_status:
|
30
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
31
|
+
else:
|
32
|
+
return None
|
33
|
+
|
34
|
+
|
35
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
36
|
+
return Response(
|
37
|
+
status_code=HTTPStatus(response.status_code),
|
38
|
+
content=response.content,
|
39
|
+
headers=response.headers,
|
40
|
+
parsed=_parse_response(client=client, response=response),
|
41
|
+
)
|
42
|
+
|
43
|
+
|
44
|
+
def sync_detailed(
|
45
|
+
private_cluster_name: str,
|
46
|
+
*,
|
47
|
+
client: Union[AuthenticatedClient, Client],
|
48
|
+
) -> Response[Any]:
|
49
|
+
"""Update private cluster health
|
50
|
+
|
51
|
+
Args:
|
52
|
+
private_cluster_name (str):
|
53
|
+
|
54
|
+
Raises:
|
55
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
56
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
57
|
+
|
58
|
+
Returns:
|
59
|
+
Response[Any]
|
60
|
+
"""
|
61
|
+
|
62
|
+
kwargs = _get_kwargs(
|
63
|
+
private_cluster_name=private_cluster_name,
|
64
|
+
)
|
65
|
+
|
66
|
+
response = client.get_httpx_client().request(
|
67
|
+
**kwargs,
|
68
|
+
)
|
69
|
+
|
70
|
+
return _build_response(client=client, response=response)
|
71
|
+
|
72
|
+
|
73
|
+
async def asyncio_detailed(
|
74
|
+
private_cluster_name: str,
|
75
|
+
*,
|
76
|
+
client: Union[AuthenticatedClient, Client],
|
77
|
+
) -> Response[Any]:
|
78
|
+
"""Update private cluster health
|
79
|
+
|
80
|
+
Args:
|
81
|
+
private_cluster_name (str):
|
82
|
+
|
83
|
+
Raises:
|
84
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
85
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
86
|
+
|
87
|
+
Returns:
|
88
|
+
Response[Any]
|
89
|
+
"""
|
90
|
+
|
91
|
+
kwargs = _get_kwargs(
|
92
|
+
private_cluster_name=private_cluster_name,
|
93
|
+
)
|
94
|
+
|
95
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
96
|
+
|
97
|
+
return _build_response(client=client, response=response)
|
@@ -61,9 +61,7 @@ class BearerToken(Auth):
|
|
61
61
|
return Exception("Invalid JWT token format")
|
62
62
|
|
63
63
|
try:
|
64
|
-
claims_bytes = base64.urlsafe_b64decode(
|
65
|
-
parts[1] + "=" * (-len(parts[1]) % 4)
|
66
|
-
)
|
64
|
+
claims_bytes = base64.urlsafe_b64decode(parts[1] + "=" * (-len(parts[1]) % 4))
|
67
65
|
claims = json.loads(claims_bytes)
|
68
66
|
except Exception as e:
|
69
67
|
return Exception(f"Failed to decode/parse JWT claims: {str(e)}")
|
@@ -80,9 +78,7 @@ class BearerToken(Auth):
|
|
80
78
|
if err:
|
81
79
|
return err
|
82
80
|
|
83
|
-
request.headers["X-Beamlit-Authorization"] =
|
84
|
-
f"Bearer {self.credentials.access_token}"
|
85
|
-
)
|
81
|
+
request.headers["X-Beamlit-Authorization"] = f"Bearer {self.credentials.access_token}"
|
86
82
|
request.headers["X-Beamlit-Workspace"] = self.workspace_name
|
87
83
|
yield request
|
88
84
|
|
@@ -99,9 +95,7 @@ class BearerToken(Auth):
|
|
99
95
|
}
|
100
96
|
|
101
97
|
try:
|
102
|
-
response = post(
|
103
|
-
url, json=refresh_data, headers={"Content-Type": "application/json"}
|
104
|
-
)
|
98
|
+
response = post(url, json=refresh_data, headers={"Content-Type": "application/json"})
|
105
99
|
response.raise_for_status()
|
106
100
|
finalize_response = DeviceLoginFinalizeResponse(**response.json())
|
107
101
|
|