beamlit 0.1.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- beamlit/__init__.py +8 -0
- beamlit/api/__init__.py +1 -0
- beamlit/api/agents/__init__.py +0 -0
- beamlit/api/agents/create_agent.py +155 -0
- beamlit/api/agents/create_agent_release.py +146 -0
- beamlit/api/agents/delete_agent.py +146 -0
- beamlit/api/agents/delete_agent_deployment.py +163 -0
- beamlit/api/agents/delete_agent_deployment_history.py +172 -0
- beamlit/api/agents/get_agent.py +146 -0
- beamlit/api/agents/get_agent_deployment.py +163 -0
- beamlit/api/agents/get_agent_deployment_history.py +172 -0
- beamlit/api/agents/get_agent_deployment_logs.py +164 -0
- beamlit/api/agents/get_agent_deployment_metrics.py +159 -0
- beamlit/api/agents/get_agent_metrics.py +150 -0
- beamlit/api/agents/list_agent_deployment_history.py +164 -0
- beamlit/api/agents/list_agent_deployments.py +155 -0
- beamlit/api/agents/list_agents.py +127 -0
- beamlit/api/agents/put_agent_deployment.py +185 -0
- beamlit/api/agents/put_agent_deployment_history.py +198 -0
- beamlit/api/agents/update_agent.py +168 -0
- beamlit/api/authentication_providers/__init__.py +0 -0
- beamlit/api/authentication_providers/get_model_with_repo_for_authentication_provider.py +184 -0
- beamlit/api/authentication_providers/list_models_for_authentication_provider.py +163 -0
- beamlit/api/authentication_providers/list_organizations_for_authentication_provider.py +163 -0
- beamlit/api/configurations/__init__.py +0 -0
- beamlit/api/configurations/get_configuration.py +122 -0
- beamlit/api/environments/__init__.py +0 -0
- beamlit/api/environments/create_environment.py +167 -0
- beamlit/api/environments/delete_environment.py +154 -0
- beamlit/api/environments/get_environment.py +154 -0
- beamlit/api/environments/get_environment_metrics.py +158 -0
- beamlit/api/environments/list_environments.py +139 -0
- beamlit/api/environments/update_environment.py +180 -0
- beamlit/api/functions/__init__.py +0 -0
- beamlit/api/functions/create_function.py +155 -0
- beamlit/api/functions/create_function_release.py +150 -0
- beamlit/api/functions/delete_function.py +146 -0
- beamlit/api/functions/delete_function_deployment.py +163 -0
- beamlit/api/functions/get_function.py +146 -0
- beamlit/api/functions/get_function_deployment.py +163 -0
- beamlit/api/functions/get_function_deployment_logs.py +164 -0
- beamlit/api/functions/get_function_deployment_metrics.py +159 -0
- beamlit/api/functions/get_function_metrics.py +150 -0
- beamlit/api/functions/list_function_deployments.py +155 -0
- beamlit/api/functions/list_functions.py +131 -0
- beamlit/api/functions/put_function_deployment.py +185 -0
- beamlit/api/functions/update_function.py +168 -0
- beamlit/api/history/__init__.py +0 -0
- beamlit/api/history/get_agents_history.py +155 -0
- beamlit/api/history/list_agents_history.py +131 -0
- beamlit/api/invitations/__init__.py +0 -0
- beamlit/api/invitations/list_all_pending_invitations.py +142 -0
- beamlit/api/locations/__init__.py +0 -0
- beamlit/api/locations/list_locations.py +139 -0
- beamlit/api/metrics/__init__.py +0 -0
- beamlit/api/metrics/get_metrics.py +130 -0
- beamlit/api/model_providers/__init__.py +0 -0
- beamlit/api/model_providers/create_model_provider.py +163 -0
- beamlit/api/model_providers/delete_model_provider.py +154 -0
- beamlit/api/model_providers/get_model_provider.py +154 -0
- beamlit/api/model_providers/list_model_providers.py +139 -0
- beamlit/api/model_providers/update_model_provider.py +176 -0
- beamlit/api/models/__init__.py +0 -0
- beamlit/api/models/create_model.py +168 -0
- beamlit/api/models/delete_model.py +154 -0
- beamlit/api/models/delete_model_deployment.py +171 -0
- beamlit/api/models/get_model.py +154 -0
- beamlit/api/models/get_model_deployment.py +171 -0
- beamlit/api/models/get_model_deployment_logs.py +168 -0
- beamlit/api/models/get_model_deployment_metrics.py +163 -0
- beamlit/api/models/get_model_metrics.py +154 -0
- beamlit/api/models/list_model_deployments.py +163 -0
- beamlit/api/models/list_models.py +135 -0
- beamlit/api/models/put_model_deployment.py +193 -0
- beamlit/api/models/release_model.py +154 -0
- beamlit/api/models/update_model.py +181 -0
- beamlit/api/policies/__init__.py +0 -0
- beamlit/api/policies/create_policy.py +167 -0
- beamlit/api/policies/delete_policy.py +154 -0
- beamlit/api/policies/get_policy.py +154 -0
- beamlit/api/policies/list_policies.py +139 -0
- beamlit/api/policies/update_policy.py +180 -0
- beamlit/api/service_accounts/__init__.py +0 -0
- beamlit/api/service_accounts/create_api_key_for_service_account.py +177 -0
- beamlit/api/service_accounts/create_workspace_service_account.py +168 -0
- beamlit/api/service_accounts/delete_api_key_for_service_account.py +104 -0
- beamlit/api/service_accounts/delete_workspace_service_account.py +158 -0
- beamlit/api/service_accounts/get_workspace_service_accounts.py +139 -0
- beamlit/api/service_accounts/list_api_keys_for_service_account.py +163 -0
- beamlit/api/service_accounts/update_workspace_service_account.py +181 -0
- beamlit/api/store/__init__.py +0 -0
- beamlit/api/store/get_store_agent.py +146 -0
- beamlit/api/store/get_store_function.py +146 -0
- beamlit/api/store/list_store_agents.py +131 -0
- beamlit/api/store/list_store_functions.py +131 -0
- beamlit/api/workspaces/__init__.py +0 -0
- beamlit/api/workspaces/accept_workspace_invitation.py +161 -0
- beamlit/api/workspaces/create_worspace.py +163 -0
- beamlit/api/workspaces/decline_workspace_invitation.py +158 -0
- beamlit/api/workspaces/delete_workspace.py +154 -0
- beamlit/api/workspaces/get_workspace.py +154 -0
- beamlit/api/workspaces/invite_workspace_user.py +174 -0
- beamlit/api/workspaces/leave_workspace.py +161 -0
- beamlit/api/workspaces/list_workspace_users.py +139 -0
- beamlit/api/workspaces/list_workspaces.py +139 -0
- beamlit/api/workspaces/remove_workspace_user.py +101 -0
- beamlit/api/workspaces/update_workspace.py +176 -0
- beamlit/api/workspaces/update_workspace_user_role.py +187 -0
- beamlit/authentication/__init__.py +24 -0
- beamlit/authentication/apikey.py +14 -0
- beamlit/authentication/authentication.py +35 -0
- beamlit/authentication/credentials.py +165 -0
- beamlit/authentication/device_mode.py +115 -0
- beamlit/client.py +270 -0
- beamlit/errors.py +16 -0
- beamlit/models/__init__.py +189 -0
- beamlit/models/acl.py +149 -0
- beamlit/models/agent.py +151 -0
- beamlit/models/agent_chain.py +77 -0
- beamlit/models/agent_configuration.py +68 -0
- beamlit/models/agent_deployment.py +327 -0
- beamlit/models/agent_deployment_configuration.py +43 -0
- beamlit/models/agent_deployment_history.py +183 -0
- beamlit/models/agent_deployment_history_event.py +131 -0
- beamlit/models/agent_deployment_pod_template.py +43 -0
- beamlit/models/agent_release.py +68 -0
- beamlit/models/api_key.py +140 -0
- beamlit/models/authentication_provider_model.py +142 -0
- beamlit/models/authentication_provider_organization.py +86 -0
- beamlit/models/configuration.py +72 -0
- beamlit/models/continent.py +68 -0
- beamlit/models/country.py +68 -0
- beamlit/models/create_api_key_for_service_account_body.py +67 -0
- beamlit/models/create_workspace_service_account_body.py +69 -0
- beamlit/models/create_workspace_service_account_response_200.py +103 -0
- beamlit/models/delete_workspace_service_account_response_200.py +94 -0
- beamlit/models/deployment_configuration.py +68 -0
- beamlit/models/deployment_configurations.py +43 -0
- beamlit/models/deployment_serverless_config.py +129 -0
- beamlit/models/environment.py +162 -0
- beamlit/models/environment_metrics.py +75 -0
- beamlit/models/flavor.py +68 -0
- beamlit/models/function.py +151 -0
- beamlit/models/function_configuration.py +68 -0
- beamlit/models/function_deployment.py +327 -0
- beamlit/models/function_deployment_configuration.py +43 -0
- beamlit/models/function_deployment_pod_template.py +43 -0
- beamlit/models/function_kit.py +95 -0
- beamlit/models/function_provider_ref.py +68 -0
- beamlit/models/function_release.py +68 -0
- beamlit/models/get_workspace_service_accounts_response_200_item.py +94 -0
- beamlit/models/invite_workspace_user_body.py +58 -0
- beamlit/models/labels.py +43 -0
- beamlit/models/labels_type_0.py +43 -0
- beamlit/models/location.py +120 -0
- beamlit/models/location_response.py +111 -0
- beamlit/models/metric.py +68 -0
- beamlit/models/metrics.py +111 -0
- beamlit/models/model.py +151 -0
- beamlit/models/model_deployment.py +283 -0
- beamlit/models/model_deployment_log.py +68 -0
- beamlit/models/model_deployment_metrics.py +170 -0
- beamlit/models/model_deployment_metrics_inference_per_second_per_region.py +75 -0
- beamlit/models/model_deployment_metrics_query_per_second_per_region_per_code.py +73 -0
- beamlit/models/model_deployment_pod_template.py +43 -0
- beamlit/models/model_metrics.py +94 -0
- beamlit/models/model_provider.py +187 -0
- beamlit/models/model_provider_ref.py +68 -0
- beamlit/models/model_release.py +68 -0
- beamlit/models/model_with_deployments.py +174 -0
- beamlit/models/pending_invitation.py +122 -0
- beamlit/models/pending_invitation_accept.py +81 -0
- beamlit/models/pending_invitation_render.py +135 -0
- beamlit/models/pending_invitation_render_invited_by.py +86 -0
- beamlit/models/pending_invitation_render_workspace.py +68 -0
- beamlit/models/pending_invitation_workspace_details.py +70 -0
- beamlit/models/policy.py +216 -0
- beamlit/models/policy_location.py +68 -0
- beamlit/models/provider_config.py +101 -0
- beamlit/models/qps.py +59 -0
- beamlit/models/resource_deployment_log.py +68 -0
- beamlit/models/resource_deployment_metrics.py +172 -0
- beamlit/models/resource_deployment_metrics_inference_per_second_per_region.py +75 -0
- beamlit/models/resource_deployment_metrics_query_per_second_per_region_per_code.py +73 -0
- beamlit/models/resource_metrics.py +94 -0
- beamlit/models/runtime.py +152 -0
- beamlit/models/runtime_readiness_probe.py +43 -0
- beamlit/models/runtime_resources.py +43 -0
- beamlit/models/serverless_config.py +122 -0
- beamlit/models/standard_fields_dynamo_db.py +86 -0
- beamlit/models/store_agent.py +165 -0
- beamlit/models/store_agent_configuration.py +95 -0
- beamlit/models/store_agent_labels.py +43 -0
- beamlit/models/store_configuration.py +149 -0
- beamlit/models/store_configuration_option.py +77 -0
- beamlit/models/store_function.py +207 -0
- beamlit/models/store_function_configuration.py +95 -0
- beamlit/models/store_function_kit.py +95 -0
- beamlit/models/store_function_labels.py +43 -0
- beamlit/models/store_function_parameter.py +86 -0
- beamlit/models/update_workspace_service_account_body.py +67 -0
- beamlit/models/update_workspace_service_account_response_200.py +94 -0
- beamlit/models/update_workspace_user_role_body.py +58 -0
- beamlit/models/workspace.py +126 -0
- beamlit/models/workspace_labels.py +43 -0
- beamlit/models/workspace_user.py +113 -0
- beamlit/py.typed +1 -0
- beamlit/types.py +46 -0
- beamlit-0.1.0.dist-info/METADATA +59 -0
- beamlit-0.1.0.dist-info/RECORD +211 -0
- beamlit-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,154 @@
|
|
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.policy import Policy
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
policy_name: str,
|
14
|
+
) -> dict[str, Any]:
|
15
|
+
_kwargs: dict[str, Any] = {
|
16
|
+
"method": "get",
|
17
|
+
"url": f"/policies/{policy_name}",
|
18
|
+
}
|
19
|
+
|
20
|
+
return _kwargs
|
21
|
+
|
22
|
+
|
23
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Policy]:
|
24
|
+
if response.status_code == 200:
|
25
|
+
response_200 = Policy.from_dict(response.json())
|
26
|
+
|
27
|
+
return response_200
|
28
|
+
if client.raise_on_unexpected_status:
|
29
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
30
|
+
else:
|
31
|
+
return None
|
32
|
+
|
33
|
+
|
34
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Policy]:
|
35
|
+
return Response(
|
36
|
+
status_code=HTTPStatus(response.status_code),
|
37
|
+
content=response.content,
|
38
|
+
headers=response.headers,
|
39
|
+
parsed=_parse_response(client=client, response=response),
|
40
|
+
)
|
41
|
+
|
42
|
+
|
43
|
+
def sync_detailed(
|
44
|
+
policy_name: str,
|
45
|
+
*,
|
46
|
+
client: AuthenticatedClient,
|
47
|
+
) -> Response[Policy]:
|
48
|
+
"""Get policy
|
49
|
+
|
50
|
+
Returns a policy by name.
|
51
|
+
|
52
|
+
Args:
|
53
|
+
policy_name (str):
|
54
|
+
|
55
|
+
Raises:
|
56
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
57
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
58
|
+
|
59
|
+
Returns:
|
60
|
+
Response[Policy]
|
61
|
+
"""
|
62
|
+
|
63
|
+
kwargs = _get_kwargs(
|
64
|
+
policy_name=policy_name,
|
65
|
+
)
|
66
|
+
|
67
|
+
response = client.get_httpx_client().request(
|
68
|
+
**kwargs,
|
69
|
+
)
|
70
|
+
|
71
|
+
return _build_response(client=client, response=response)
|
72
|
+
|
73
|
+
|
74
|
+
def sync(
|
75
|
+
policy_name: str,
|
76
|
+
*,
|
77
|
+
client: AuthenticatedClient,
|
78
|
+
) -> Optional[Policy]:
|
79
|
+
"""Get policy
|
80
|
+
|
81
|
+
Returns a policy by name.
|
82
|
+
|
83
|
+
Args:
|
84
|
+
policy_name (str):
|
85
|
+
|
86
|
+
Raises:
|
87
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
88
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
89
|
+
|
90
|
+
Returns:
|
91
|
+
Policy
|
92
|
+
"""
|
93
|
+
|
94
|
+
return sync_detailed(
|
95
|
+
policy_name=policy_name,
|
96
|
+
client=client,
|
97
|
+
).parsed
|
98
|
+
|
99
|
+
|
100
|
+
async def asyncio_detailed(
|
101
|
+
policy_name: str,
|
102
|
+
*,
|
103
|
+
client: AuthenticatedClient,
|
104
|
+
) -> Response[Policy]:
|
105
|
+
"""Get policy
|
106
|
+
|
107
|
+
Returns a policy by name.
|
108
|
+
|
109
|
+
Args:
|
110
|
+
policy_name (str):
|
111
|
+
|
112
|
+
Raises:
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
115
|
+
|
116
|
+
Returns:
|
117
|
+
Response[Policy]
|
118
|
+
"""
|
119
|
+
|
120
|
+
kwargs = _get_kwargs(
|
121
|
+
policy_name=policy_name,
|
122
|
+
)
|
123
|
+
|
124
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
125
|
+
|
126
|
+
return _build_response(client=client, response=response)
|
127
|
+
|
128
|
+
|
129
|
+
async def asyncio(
|
130
|
+
policy_name: str,
|
131
|
+
*,
|
132
|
+
client: AuthenticatedClient,
|
133
|
+
) -> Optional[Policy]:
|
134
|
+
"""Get policy
|
135
|
+
|
136
|
+
Returns a policy by name.
|
137
|
+
|
138
|
+
Args:
|
139
|
+
policy_name (str):
|
140
|
+
|
141
|
+
Raises:
|
142
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
143
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
144
|
+
|
145
|
+
Returns:
|
146
|
+
Policy
|
147
|
+
"""
|
148
|
+
|
149
|
+
return (
|
150
|
+
await asyncio_detailed(
|
151
|
+
policy_name=policy_name,
|
152
|
+
client=client,
|
153
|
+
)
|
154
|
+
).parsed
|
@@ -0,0 +1,139 @@
|
|
1
|
+
from http import HTTPStatus
|
2
|
+
from typing import Any, List, Optional, Union
|
3
|
+
|
4
|
+
import httpx
|
5
|
+
|
6
|
+
from ... import errors
|
7
|
+
from ...client import AuthenticatedClient, Client
|
8
|
+
from ...models.policy import Policy
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs() -> dict[str, Any]:
|
13
|
+
_kwargs: dict[str, Any] = {
|
14
|
+
"method": "get",
|
15
|
+
"url": "/policies",
|
16
|
+
}
|
17
|
+
|
18
|
+
return _kwargs
|
19
|
+
|
20
|
+
|
21
|
+
def _parse_response(
|
22
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
23
|
+
) -> Optional[List["Policy"]]:
|
24
|
+
if response.status_code == 200:
|
25
|
+
response_200 = []
|
26
|
+
_response_200 = response.json()
|
27
|
+
for response_200_item_data in _response_200:
|
28
|
+
response_200_item = Policy.from_dict(response_200_item_data)
|
29
|
+
|
30
|
+
response_200.append(response_200_item)
|
31
|
+
|
32
|
+
return response_200
|
33
|
+
if client.raise_on_unexpected_status:
|
34
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
35
|
+
else:
|
36
|
+
return None
|
37
|
+
|
38
|
+
|
39
|
+
def _build_response(
|
40
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
41
|
+
) -> Response[List["Policy"]]:
|
42
|
+
return Response(
|
43
|
+
status_code=HTTPStatus(response.status_code),
|
44
|
+
content=response.content,
|
45
|
+
headers=response.headers,
|
46
|
+
parsed=_parse_response(client=client, response=response),
|
47
|
+
)
|
48
|
+
|
49
|
+
|
50
|
+
def sync_detailed(
|
51
|
+
*,
|
52
|
+
client: AuthenticatedClient,
|
53
|
+
) -> Response[List["Policy"]]:
|
54
|
+
"""List policies
|
55
|
+
|
56
|
+
Returns a list of all policies in the workspace.
|
57
|
+
|
58
|
+
Raises:
|
59
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
60
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
61
|
+
|
62
|
+
Returns:
|
63
|
+
Response[List['Policy']]
|
64
|
+
"""
|
65
|
+
|
66
|
+
kwargs = _get_kwargs()
|
67
|
+
|
68
|
+
response = client.get_httpx_client().request(
|
69
|
+
**kwargs,
|
70
|
+
)
|
71
|
+
|
72
|
+
return _build_response(client=client, response=response)
|
73
|
+
|
74
|
+
|
75
|
+
def sync(
|
76
|
+
*,
|
77
|
+
client: AuthenticatedClient,
|
78
|
+
) -> Optional[List["Policy"]]:
|
79
|
+
"""List policies
|
80
|
+
|
81
|
+
Returns a list of all policies in the workspace.
|
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
|
+
List['Policy']
|
89
|
+
"""
|
90
|
+
|
91
|
+
return sync_detailed(
|
92
|
+
client=client,
|
93
|
+
).parsed
|
94
|
+
|
95
|
+
|
96
|
+
async def asyncio_detailed(
|
97
|
+
*,
|
98
|
+
client: AuthenticatedClient,
|
99
|
+
) -> Response[List["Policy"]]:
|
100
|
+
"""List policies
|
101
|
+
|
102
|
+
Returns a list of all policies in the workspace.
|
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
|
+
Response[List['Policy']]
|
110
|
+
"""
|
111
|
+
|
112
|
+
kwargs = _get_kwargs()
|
113
|
+
|
114
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
115
|
+
|
116
|
+
return _build_response(client=client, response=response)
|
117
|
+
|
118
|
+
|
119
|
+
async def asyncio(
|
120
|
+
*,
|
121
|
+
client: AuthenticatedClient,
|
122
|
+
) -> Optional[List["Policy"]]:
|
123
|
+
"""List policies
|
124
|
+
|
125
|
+
Returns a list of all policies in the workspace.
|
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
|
+
List['Policy']
|
133
|
+
"""
|
134
|
+
|
135
|
+
return (
|
136
|
+
await asyncio_detailed(
|
137
|
+
client=client,
|
138
|
+
)
|
139
|
+
).parsed
|
@@ -0,0 +1,180 @@
|
|
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.policy import Policy
|
9
|
+
from ...types import Response
|
10
|
+
|
11
|
+
|
12
|
+
def _get_kwargs(
|
13
|
+
policy_name: str,
|
14
|
+
*,
|
15
|
+
body: Policy,
|
16
|
+
) -> dict[str, Any]:
|
17
|
+
headers: dict[str, Any] = {}
|
18
|
+
|
19
|
+
_kwargs: dict[str, Any] = {
|
20
|
+
"method": "put",
|
21
|
+
"url": f"/policies/{policy_name}",
|
22
|
+
}
|
23
|
+
|
24
|
+
_body = body.to_dict()
|
25
|
+
|
26
|
+
_kwargs["json"] = _body
|
27
|
+
headers["Content-Type"] = "application/json"
|
28
|
+
|
29
|
+
_kwargs["headers"] = headers
|
30
|
+
return _kwargs
|
31
|
+
|
32
|
+
|
33
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Policy]:
|
34
|
+
if response.status_code == 200:
|
35
|
+
response_200 = Policy.from_dict(response.json())
|
36
|
+
|
37
|
+
return response_200
|
38
|
+
if client.raise_on_unexpected_status:
|
39
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
40
|
+
else:
|
41
|
+
return None
|
42
|
+
|
43
|
+
|
44
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Policy]:
|
45
|
+
return Response(
|
46
|
+
status_code=HTTPStatus(response.status_code),
|
47
|
+
content=response.content,
|
48
|
+
headers=response.headers,
|
49
|
+
parsed=_parse_response(client=client, response=response),
|
50
|
+
)
|
51
|
+
|
52
|
+
|
53
|
+
def sync_detailed(
|
54
|
+
policy_name: str,
|
55
|
+
*,
|
56
|
+
client: AuthenticatedClient,
|
57
|
+
body: Policy,
|
58
|
+
) -> Response[Policy]:
|
59
|
+
"""Update policy
|
60
|
+
|
61
|
+
Updates a policy.
|
62
|
+
|
63
|
+
Args:
|
64
|
+
policy_name (str):
|
65
|
+
body (Policy): Rule that controls how a deployment is made and served (e.g. location
|
66
|
+
restrictions)
|
67
|
+
|
68
|
+
Raises:
|
69
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
70
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
71
|
+
|
72
|
+
Returns:
|
73
|
+
Response[Policy]
|
74
|
+
"""
|
75
|
+
|
76
|
+
kwargs = _get_kwargs(
|
77
|
+
policy_name=policy_name,
|
78
|
+
body=body,
|
79
|
+
)
|
80
|
+
|
81
|
+
response = client.get_httpx_client().request(
|
82
|
+
**kwargs,
|
83
|
+
)
|
84
|
+
|
85
|
+
return _build_response(client=client, response=response)
|
86
|
+
|
87
|
+
|
88
|
+
def sync(
|
89
|
+
policy_name: str,
|
90
|
+
*,
|
91
|
+
client: AuthenticatedClient,
|
92
|
+
body: Policy,
|
93
|
+
) -> Optional[Policy]:
|
94
|
+
"""Update policy
|
95
|
+
|
96
|
+
Updates a policy.
|
97
|
+
|
98
|
+
Args:
|
99
|
+
policy_name (str):
|
100
|
+
body (Policy): Rule that controls how a deployment is made and served (e.g. location
|
101
|
+
restrictions)
|
102
|
+
|
103
|
+
Raises:
|
104
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
105
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
106
|
+
|
107
|
+
Returns:
|
108
|
+
Policy
|
109
|
+
"""
|
110
|
+
|
111
|
+
return sync_detailed(
|
112
|
+
policy_name=policy_name,
|
113
|
+
client=client,
|
114
|
+
body=body,
|
115
|
+
).parsed
|
116
|
+
|
117
|
+
|
118
|
+
async def asyncio_detailed(
|
119
|
+
policy_name: str,
|
120
|
+
*,
|
121
|
+
client: AuthenticatedClient,
|
122
|
+
body: Policy,
|
123
|
+
) -> Response[Policy]:
|
124
|
+
"""Update policy
|
125
|
+
|
126
|
+
Updates a policy.
|
127
|
+
|
128
|
+
Args:
|
129
|
+
policy_name (str):
|
130
|
+
body (Policy): Rule that controls how a deployment is made and served (e.g. location
|
131
|
+
restrictions)
|
132
|
+
|
133
|
+
Raises:
|
134
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
135
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
136
|
+
|
137
|
+
Returns:
|
138
|
+
Response[Policy]
|
139
|
+
"""
|
140
|
+
|
141
|
+
kwargs = _get_kwargs(
|
142
|
+
policy_name=policy_name,
|
143
|
+
body=body,
|
144
|
+
)
|
145
|
+
|
146
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
147
|
+
|
148
|
+
return _build_response(client=client, response=response)
|
149
|
+
|
150
|
+
|
151
|
+
async def asyncio(
|
152
|
+
policy_name: str,
|
153
|
+
*,
|
154
|
+
client: AuthenticatedClient,
|
155
|
+
body: Policy,
|
156
|
+
) -> Optional[Policy]:
|
157
|
+
"""Update policy
|
158
|
+
|
159
|
+
Updates a policy.
|
160
|
+
|
161
|
+
Args:
|
162
|
+
policy_name (str):
|
163
|
+
body (Policy): Rule that controls how a deployment is made and served (e.g. location
|
164
|
+
restrictions)
|
165
|
+
|
166
|
+
Raises:
|
167
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
168
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
169
|
+
|
170
|
+
Returns:
|
171
|
+
Policy
|
172
|
+
"""
|
173
|
+
|
174
|
+
return (
|
175
|
+
await asyncio_detailed(
|
176
|
+
policy_name=policy_name,
|
177
|
+
client=client,
|
178
|
+
body=body,
|
179
|
+
)
|
180
|
+
).parsed
|
File without changes
|
@@ -0,0 +1,177 @@
|
|
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.api_key import ApiKey
|
9
|
+
from ...models.create_api_key_for_service_account_body import CreateApiKeyForServiceAccountBody
|
10
|
+
from ...types import Response
|
11
|
+
|
12
|
+
|
13
|
+
def _get_kwargs(
|
14
|
+
client_id: str,
|
15
|
+
*,
|
16
|
+
body: CreateApiKeyForServiceAccountBody,
|
17
|
+
) -> dict[str, Any]:
|
18
|
+
headers: dict[str, Any] = {}
|
19
|
+
|
20
|
+
_kwargs: dict[str, Any] = {
|
21
|
+
"method": "post",
|
22
|
+
"url": f"/service_accounts/{client_id}/api_keys",
|
23
|
+
}
|
24
|
+
|
25
|
+
_body = body.to_dict()
|
26
|
+
|
27
|
+
_kwargs["json"] = _body
|
28
|
+
headers["Content-Type"] = "application/json"
|
29
|
+
|
30
|
+
_kwargs["headers"] = headers
|
31
|
+
return _kwargs
|
32
|
+
|
33
|
+
|
34
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[ApiKey]:
|
35
|
+
if response.status_code == 200:
|
36
|
+
response_200 = ApiKey.from_dict(response.json())
|
37
|
+
|
38
|
+
return response_200
|
39
|
+
if client.raise_on_unexpected_status:
|
40
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
41
|
+
else:
|
42
|
+
return None
|
43
|
+
|
44
|
+
|
45
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[ApiKey]:
|
46
|
+
return Response(
|
47
|
+
status_code=HTTPStatus(response.status_code),
|
48
|
+
content=response.content,
|
49
|
+
headers=response.headers,
|
50
|
+
parsed=_parse_response(client=client, response=response),
|
51
|
+
)
|
52
|
+
|
53
|
+
|
54
|
+
def sync_detailed(
|
55
|
+
client_id: str,
|
56
|
+
*,
|
57
|
+
client: AuthenticatedClient,
|
58
|
+
body: CreateApiKeyForServiceAccountBody,
|
59
|
+
) -> Response[ApiKey]:
|
60
|
+
"""Create API key for service account
|
61
|
+
|
62
|
+
Creates an API key for a service account.
|
63
|
+
|
64
|
+
Args:
|
65
|
+
client_id (str):
|
66
|
+
body (CreateApiKeyForServiceAccountBody):
|
67
|
+
|
68
|
+
Raises:
|
69
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
70
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
71
|
+
|
72
|
+
Returns:
|
73
|
+
Response[ApiKey]
|
74
|
+
"""
|
75
|
+
|
76
|
+
kwargs = _get_kwargs(
|
77
|
+
client_id=client_id,
|
78
|
+
body=body,
|
79
|
+
)
|
80
|
+
|
81
|
+
response = client.get_httpx_client().request(
|
82
|
+
**kwargs,
|
83
|
+
)
|
84
|
+
|
85
|
+
return _build_response(client=client, response=response)
|
86
|
+
|
87
|
+
|
88
|
+
def sync(
|
89
|
+
client_id: str,
|
90
|
+
*,
|
91
|
+
client: AuthenticatedClient,
|
92
|
+
body: CreateApiKeyForServiceAccountBody,
|
93
|
+
) -> Optional[ApiKey]:
|
94
|
+
"""Create API key for service account
|
95
|
+
|
96
|
+
Creates an API key for a service account.
|
97
|
+
|
98
|
+
Args:
|
99
|
+
client_id (str):
|
100
|
+
body (CreateApiKeyForServiceAccountBody):
|
101
|
+
|
102
|
+
Raises:
|
103
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
104
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
105
|
+
|
106
|
+
Returns:
|
107
|
+
ApiKey
|
108
|
+
"""
|
109
|
+
|
110
|
+
return sync_detailed(
|
111
|
+
client_id=client_id,
|
112
|
+
client=client,
|
113
|
+
body=body,
|
114
|
+
).parsed
|
115
|
+
|
116
|
+
|
117
|
+
async def asyncio_detailed(
|
118
|
+
client_id: str,
|
119
|
+
*,
|
120
|
+
client: AuthenticatedClient,
|
121
|
+
body: CreateApiKeyForServiceAccountBody,
|
122
|
+
) -> Response[ApiKey]:
|
123
|
+
"""Create API key for service account
|
124
|
+
|
125
|
+
Creates an API key for a service account.
|
126
|
+
|
127
|
+
Args:
|
128
|
+
client_id (str):
|
129
|
+
body (CreateApiKeyForServiceAccountBody):
|
130
|
+
|
131
|
+
Raises:
|
132
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
133
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
134
|
+
|
135
|
+
Returns:
|
136
|
+
Response[ApiKey]
|
137
|
+
"""
|
138
|
+
|
139
|
+
kwargs = _get_kwargs(
|
140
|
+
client_id=client_id,
|
141
|
+
body=body,
|
142
|
+
)
|
143
|
+
|
144
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
145
|
+
|
146
|
+
return _build_response(client=client, response=response)
|
147
|
+
|
148
|
+
|
149
|
+
async def asyncio(
|
150
|
+
client_id: str,
|
151
|
+
*,
|
152
|
+
client: AuthenticatedClient,
|
153
|
+
body: CreateApiKeyForServiceAccountBody,
|
154
|
+
) -> Optional[ApiKey]:
|
155
|
+
"""Create API key for service account
|
156
|
+
|
157
|
+
Creates an API key for a service account.
|
158
|
+
|
159
|
+
Args:
|
160
|
+
client_id (str):
|
161
|
+
body (CreateApiKeyForServiceAccountBody):
|
162
|
+
|
163
|
+
Raises:
|
164
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
165
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
166
|
+
|
167
|
+
Returns:
|
168
|
+
ApiKey
|
169
|
+
"""
|
170
|
+
|
171
|
+
return (
|
172
|
+
await asyncio_detailed(
|
173
|
+
client_id=client_id,
|
174
|
+
client=client,
|
175
|
+
body=body,
|
176
|
+
)
|
177
|
+
).parsed
|