volcano-sdk-python 0.11.2__py3-none-any.whl → 0.11.3__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.
- volcano_sdk/_transport.py +195 -107
- volcano_sdk/connection_string.py +4 -3
- volcano_sdk/locks.py +9 -3
- volcano_sdk/realtime.py +147 -93
- volcano_sdk/storage.py +132 -53
- {volcano_sdk_python-0.11.2.dist-info → volcano_sdk_python-0.11.3.dist-info}/METADATA +2 -2
- {volcano_sdk_python-0.11.2.dist-info → volcano_sdk_python-0.11.3.dist-info}/RECORD +9 -9
- {volcano_sdk_python-0.11.2.dist-info → volcano_sdk_python-0.11.3.dist-info}/WHEEL +0 -0
- {volcano_sdk_python-0.11.2.dist-info → volcano_sdk_python-0.11.3.dist-info}/licenses/LICENSE +0 -0
volcano_sdk/_transport.py
CHANGED
|
@@ -9,11 +9,11 @@ from io import BytesIO
|
|
|
9
9
|
from pathlib import PurePosixPath
|
|
10
10
|
from typing import (
|
|
11
11
|
TYPE_CHECKING,
|
|
12
|
-
Any,
|
|
13
12
|
ParamSpec,
|
|
14
13
|
Protocol,
|
|
15
14
|
TypeVar,
|
|
16
15
|
cast,
|
|
16
|
+
overload,
|
|
17
17
|
runtime_checkable,
|
|
18
18
|
)
|
|
19
19
|
from uuid import UUID, uuid4
|
|
@@ -278,7 +278,7 @@ if TYPE_CHECKING:
|
|
|
278
278
|
from ._generated.models.refresh_o_auth_provider_token_provider import (
|
|
279
279
|
RefreshOAuthProviderTokenProvider,
|
|
280
280
|
)
|
|
281
|
-
from .models import JSONValue
|
|
281
|
+
from .models import DurableExecutionStatus, JSONValue
|
|
282
282
|
|
|
283
283
|
HTTP_CREATED = 201
|
|
284
284
|
HTTP_UNAUTHORIZED = 401
|
|
@@ -305,6 +305,14 @@ ERROR_TYPES_BY_STATUS: dict[int, type[VolcanoError]] = {
|
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
|
|
308
|
+
@overload
|
|
309
|
+
def _plain_json(value: Mapping[str, JSONValue]) -> dict[str, JSONValue]: ...
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
@overload
|
|
313
|
+
def _plain_json(value: JSONValue) -> JSONValue: ...
|
|
314
|
+
|
|
315
|
+
|
|
308
316
|
def _plain_json(value: JSONValue) -> JSONValue:
|
|
309
317
|
if isinstance(value, Mapping):
|
|
310
318
|
return {key: _plain_json(item) for key, item in value.items()}
|
|
@@ -338,11 +346,21 @@ class _RawHTTPResponse(Protocol):
|
|
|
338
346
|
def headers(self) -> Mapping[str, str]: ...
|
|
339
347
|
|
|
340
348
|
|
|
349
|
+
class _ParsedHTTPResponse(_RawHTTPResponse, Protocol):
|
|
350
|
+
@property
|
|
351
|
+
def parsed(self) -> object: ...
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
@runtime_checkable
|
|
355
|
+
class _ModelPayload(Protocol):
|
|
356
|
+
def to_dict(self) -> Mapping[str, object]: ...
|
|
357
|
+
|
|
358
|
+
|
|
341
359
|
@dataclass(frozen=True, slots=True)
|
|
342
360
|
class DurableExecutionListRequest:
|
|
343
361
|
"""Filters and paging for a durable execution listing."""
|
|
344
362
|
|
|
345
|
-
status:
|
|
363
|
+
status: DurableExecutionStatus | None = None
|
|
346
364
|
page: int | None = None
|
|
347
365
|
limit: int | None = None
|
|
348
366
|
|
|
@@ -618,7 +636,7 @@ class AuthCallOAuthAPITransport(Protocol):
|
|
|
618
636
|
provider: CallOAuthProviderAPIProvider,
|
|
619
637
|
endpoint: str,
|
|
620
638
|
method: str,
|
|
621
|
-
body: Mapping[str,
|
|
639
|
+
body: Mapping[str, JSONValue] | None,
|
|
622
640
|
) -> TransportResponse: ...
|
|
623
641
|
|
|
624
642
|
|
|
@@ -652,7 +670,7 @@ class Transport(Protocol):
|
|
|
652
670
|
*,
|
|
653
671
|
authorization: str,
|
|
654
672
|
database_name: str,
|
|
655
|
-
body: dict[str,
|
|
673
|
+
body: dict[str, object],
|
|
656
674
|
) -> TransportResponse: ...
|
|
657
675
|
|
|
658
676
|
def query_database_insert(
|
|
@@ -660,7 +678,7 @@ class Transport(Protocol):
|
|
|
660
678
|
*,
|
|
661
679
|
authorization: str,
|
|
662
680
|
database_name: str,
|
|
663
|
-
body: dict[str,
|
|
681
|
+
body: dict[str, object],
|
|
664
682
|
) -> TransportResponse: ...
|
|
665
683
|
|
|
666
684
|
def query_database_update(
|
|
@@ -668,7 +686,7 @@ class Transport(Protocol):
|
|
|
668
686
|
*,
|
|
669
687
|
authorization: str,
|
|
670
688
|
database_name: str,
|
|
671
|
-
body: dict[str,
|
|
689
|
+
body: dict[str, object],
|
|
672
690
|
) -> TransportResponse: ...
|
|
673
691
|
|
|
674
692
|
def query_database_delete(
|
|
@@ -676,7 +694,7 @@ class Transport(Protocol):
|
|
|
676
694
|
*,
|
|
677
695
|
authorization: str,
|
|
678
696
|
database_name: str,
|
|
679
|
-
body: dict[str,
|
|
697
|
+
body: dict[str, object],
|
|
680
698
|
) -> TransportResponse: ...
|
|
681
699
|
|
|
682
700
|
def upload_storage_object(
|
|
@@ -727,7 +745,7 @@ class AsyncDatabaseSelectTransport(Protocol):
|
|
|
727
745
|
*,
|
|
728
746
|
authorization: str,
|
|
729
747
|
database_name: str,
|
|
730
|
-
body: dict[str,
|
|
748
|
+
body: dict[str, object],
|
|
731
749
|
) -> TransportResponse: ...
|
|
732
750
|
|
|
733
751
|
|
|
@@ -772,13 +790,91 @@ def _error_type(status: int) -> type[VolcanoError]:
|
|
|
772
790
|
return VolcanoError
|
|
773
791
|
|
|
774
792
|
|
|
793
|
+
class _InvalidGeneratedRequestError(TypeError):
|
|
794
|
+
def __init__(self, field: str) -> None:
|
|
795
|
+
super().__init__(f"Invalid generated request field: {field}")
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
def _required_request_string(kwargs: Mapping[str, object], key: str) -> str:
|
|
799
|
+
value = kwargs.get(key)
|
|
800
|
+
if not isinstance(value, str):
|
|
801
|
+
raise _InvalidGeneratedRequestError(key)
|
|
802
|
+
return value
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
def _request_headers(kwargs: Mapping[str, object]) -> dict[str, str]:
|
|
806
|
+
raw_headers = kwargs.get("headers", {})
|
|
807
|
+
if not isinstance(raw_headers, Mapping):
|
|
808
|
+
field = "headers"
|
|
809
|
+
raise _InvalidGeneratedRequestError(field)
|
|
810
|
+
source = cast("Mapping[object, object]", raw_headers)
|
|
811
|
+
headers: dict[str, str] = {}
|
|
812
|
+
for key, value in source.items():
|
|
813
|
+
if not isinstance(key, str) or not isinstance(value, str):
|
|
814
|
+
field = "headers"
|
|
815
|
+
raise _InvalidGeneratedRequestError(field)
|
|
816
|
+
headers[key] = value
|
|
817
|
+
return headers
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
def _request_params(
|
|
821
|
+
kwargs: Mapping[str, object],
|
|
822
|
+
) -> dict[str, str | int | float | bool | None] | None:
|
|
823
|
+
raw_params = kwargs.get("params")
|
|
824
|
+
if raw_params is None:
|
|
825
|
+
return None
|
|
826
|
+
if not isinstance(raw_params, Mapping):
|
|
827
|
+
field = "params"
|
|
828
|
+
raise _InvalidGeneratedRequestError(field)
|
|
829
|
+
source = cast("Mapping[object, object]", raw_params)
|
|
830
|
+
params: dict[str, str | int | float | bool | None] = {}
|
|
831
|
+
for key, value in source.items():
|
|
832
|
+
if not isinstance(key, str) or (
|
|
833
|
+
value is not None and not isinstance(value, (str, int, float, bool))
|
|
834
|
+
):
|
|
835
|
+
field = "params"
|
|
836
|
+
raise _InvalidGeneratedRequestError(field)
|
|
837
|
+
params[key] = value
|
|
838
|
+
return params
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
def _generated_request(
|
|
842
|
+
client: AuthenticatedClient, kwargs: Mapping[str, object]
|
|
843
|
+
) -> httpx.Response:
|
|
844
|
+
if kwargs.keys() - {"method", "url", "headers", "json", "params"}:
|
|
845
|
+
field = "unsupported field"
|
|
846
|
+
raise _InvalidGeneratedRequestError(field)
|
|
847
|
+
return client.get_httpx_client().request(
|
|
848
|
+
method=_required_request_string(kwargs, "method"),
|
|
849
|
+
url=_required_request_string(kwargs, "url"),
|
|
850
|
+
headers=_request_headers(kwargs),
|
|
851
|
+
params=_request_params(kwargs),
|
|
852
|
+
json=kwargs.get("json"),
|
|
853
|
+
)
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
def _json_object(response: httpx.Response) -> dict[str, object]:
|
|
857
|
+
raw = cast("object", response.json())
|
|
858
|
+
if not isinstance(raw, dict):
|
|
859
|
+
field = "response body"
|
|
860
|
+
raise _InvalidGeneratedRequestError(field)
|
|
861
|
+
source = cast("Mapping[object, object]", raw)
|
|
862
|
+
payload: dict[str, object] = {}
|
|
863
|
+
for key, value in source.items():
|
|
864
|
+
if not isinstance(key, str):
|
|
865
|
+
field = "response body key"
|
|
866
|
+
raise _InvalidGeneratedRequestError(field)
|
|
867
|
+
payload[key] = value
|
|
868
|
+
return payload
|
|
869
|
+
|
|
870
|
+
|
|
775
871
|
def response_payload(response: TransportResponse, expected_status: int) -> object:
|
|
776
872
|
status = int(response.status_code)
|
|
777
873
|
if status != expected_status:
|
|
778
|
-
payload: Mapping[
|
|
874
|
+
payload: Mapping[object, object]
|
|
779
875
|
raw_payload = response.payload
|
|
780
876
|
if isinstance(raw_payload, dict):
|
|
781
|
-
payload = cast("Mapping[
|
|
877
|
+
payload = cast("Mapping[object, object]", raw_payload)
|
|
782
878
|
else:
|
|
783
879
|
payload = {}
|
|
784
880
|
message = str(
|
|
@@ -812,12 +908,12 @@ class GeneratedTransport:
|
|
|
812
908
|
timeout: float = 60.0,
|
|
813
909
|
httpx_transport: httpx.BaseTransport | None = None,
|
|
814
910
|
) -> None:
|
|
815
|
-
self._api_url = api_url.rstrip("/")
|
|
816
|
-
self._timeout = timeout
|
|
817
|
-
self._httpx_transport = httpx_transport
|
|
911
|
+
self._api_url: str = api_url.rstrip("/")
|
|
912
|
+
self._timeout: float = timeout
|
|
913
|
+
self._httpx_transport: httpx.BaseTransport | None = httpx_transport
|
|
818
914
|
|
|
819
915
|
def _client(self, authorization: str) -> AuthenticatedClient:
|
|
820
|
-
httpx_args: dict[str,
|
|
916
|
+
httpx_args: dict[str, object] = {}
|
|
821
917
|
if self._httpx_transport is not None:
|
|
822
918
|
httpx_args["transport"] = self._httpx_transport
|
|
823
919
|
return AuthenticatedClient(
|
|
@@ -828,15 +924,16 @@ class GeneratedTransport:
|
|
|
828
924
|
)
|
|
829
925
|
|
|
830
926
|
@staticmethod
|
|
831
|
-
def _response(response:
|
|
927
|
+
def _response(response: _ParsedHTTPResponse) -> TransportResponse:
|
|
832
928
|
parsed = response.parsed
|
|
833
|
-
if
|
|
834
|
-
payload = parsed.to_dict()
|
|
929
|
+
if isinstance(parsed, _ModelPayload):
|
|
930
|
+
payload: object = parsed.to_dict()
|
|
835
931
|
elif parsed is not None:
|
|
836
932
|
payload = parsed
|
|
837
933
|
else:
|
|
838
934
|
try:
|
|
839
|
-
|
|
935
|
+
raw = cast("object", json.loads(response.content))
|
|
936
|
+
payload = raw
|
|
840
937
|
except (json.JSONDecodeError, UnicodeDecodeError):
|
|
841
938
|
payload = None
|
|
842
939
|
return _GeneratedTransportResponse(
|
|
@@ -849,7 +946,7 @@ class GeneratedTransport:
|
|
|
849
946
|
@staticmethod
|
|
850
947
|
def _raw_response(response: _RawHTTPResponse) -> TransportResponse:
|
|
851
948
|
try:
|
|
852
|
-
payload = json.loads(response.content)
|
|
949
|
+
payload = cast("object", json.loads(response.content))
|
|
853
950
|
except (json.JSONDecodeError, UnicodeDecodeError):
|
|
854
951
|
payload = None
|
|
855
952
|
return _GeneratedTransportResponse(
|
|
@@ -900,9 +997,7 @@ class GeneratedTransport:
|
|
|
900
997
|
user_metadata=AuthSignupAnonymousBodyUserMetadata.from_dict(metadata)
|
|
901
998
|
)
|
|
902
999
|
with self._client(authorization) as client:
|
|
903
|
-
response = client
|
|
904
|
-
**signup_anonymous_kwargs(body=body)
|
|
905
|
-
)
|
|
1000
|
+
response = _generated_request(client, signup_anonymous_kwargs(body=body))
|
|
906
1001
|
return self._raw_response(response)
|
|
907
1002
|
|
|
908
1003
|
def auth_convert_anonymous(
|
|
@@ -920,8 +1015,8 @@ class GeneratedTransport:
|
|
|
920
1015
|
)
|
|
921
1016
|
try:
|
|
922
1017
|
with self._client(authorization) as client:
|
|
923
|
-
raw_response =
|
|
924
|
-
|
|
1018
|
+
raw_response = _generated_request(
|
|
1019
|
+
client, auth_convert_anonymous_kwargs(body=body)
|
|
925
1020
|
)
|
|
926
1021
|
if raw_response.status_code == HTTP_UNAUTHORIZED:
|
|
927
1022
|
return self._raw_response(raw_response)
|
|
@@ -952,8 +1047,8 @@ class GeneratedTransport:
|
|
|
952
1047
|
email: str,
|
|
953
1048
|
) -> TransportResponse:
|
|
954
1049
|
with self._client(authorization) as client:
|
|
955
|
-
response =
|
|
956
|
-
|
|
1050
|
+
response = _generated_request(
|
|
1051
|
+
client, forgot_password_kwargs(body=AuthForgotPasswordBody(email=email))
|
|
957
1052
|
)
|
|
958
1053
|
return self._raw_response(response)
|
|
959
1054
|
|
|
@@ -964,8 +1059,8 @@ class GeneratedTransport:
|
|
|
964
1059
|
token: str,
|
|
965
1060
|
) -> TransportResponse:
|
|
966
1061
|
with self._client(authorization) as client:
|
|
967
|
-
response =
|
|
968
|
-
|
|
1062
|
+
response = _generated_request(
|
|
1063
|
+
client, confirm_email_kwargs(body=AuthConfirmEmailBody(token=token))
|
|
969
1064
|
)
|
|
970
1065
|
return self._raw_response(response)
|
|
971
1066
|
|
|
@@ -978,9 +1073,7 @@ class GeneratedTransport:
|
|
|
978
1073
|
) -> TransportResponse:
|
|
979
1074
|
body = AuthResetPasswordBody(token=token, new_password=new_password)
|
|
980
1075
|
with self._client(authorization) as client:
|
|
981
|
-
response = client
|
|
982
|
-
**reset_password_kwargs(body=body)
|
|
983
|
-
)
|
|
1076
|
+
response = _generated_request(client, reset_password_kwargs(body=body))
|
|
984
1077
|
return self._raw_response(response)
|
|
985
1078
|
|
|
986
1079
|
def auth_resend_confirmation(
|
|
@@ -991,9 +1084,7 @@ class GeneratedTransport:
|
|
|
991
1084
|
) -> TransportResponse:
|
|
992
1085
|
body = AuthResendConfirmationBody(email=email)
|
|
993
1086
|
with self._client(authorization) as client:
|
|
994
|
-
response = client
|
|
995
|
-
**resend_confirmation_kwargs(body=body)
|
|
996
|
-
)
|
|
1087
|
+
response = _generated_request(client, resend_confirmation_kwargs(body=body))
|
|
997
1088
|
return self._raw_response(response)
|
|
998
1089
|
|
|
999
1090
|
def auth_request_email_change(
|
|
@@ -1004,14 +1095,14 @@ class GeneratedTransport:
|
|
|
1004
1095
|
) -> TransportResponse:
|
|
1005
1096
|
body = AuthRequestEmailChangeBody(new_email=new_email)
|
|
1006
1097
|
with self._client(authorization) as client:
|
|
1007
|
-
response =
|
|
1008
|
-
|
|
1098
|
+
response = _generated_request(
|
|
1099
|
+
client, request_email_change_kwargs(body=body)
|
|
1009
1100
|
)
|
|
1010
1101
|
return self._raw_response(response)
|
|
1011
1102
|
|
|
1012
1103
|
def auth_cancel_email_change(self, *, authorization: str) -> TransportResponse:
|
|
1013
1104
|
with self._client(authorization) as client:
|
|
1014
|
-
response = client
|
|
1105
|
+
response = _generated_request(client, cancel_email_change_kwargs())
|
|
1015
1106
|
return self._raw_response(response)
|
|
1016
1107
|
|
|
1017
1108
|
def auth_confirm_email_change(
|
|
@@ -1023,8 +1114,8 @@ class GeneratedTransport:
|
|
|
1023
1114
|
body = AuthConfirmEmailChangeBody(email_change_token=token)
|
|
1024
1115
|
try:
|
|
1025
1116
|
with self._client(authorization) as client:
|
|
1026
|
-
raw_response =
|
|
1027
|
-
|
|
1117
|
+
raw_response = _generated_request(
|
|
1118
|
+
client, auth_confirm_email_change_kwargs(body=body)
|
|
1028
1119
|
)
|
|
1029
1120
|
if raw_response.status_code == HTTP_UNAUTHORIZED:
|
|
1030
1121
|
return self._raw_response(raw_response)
|
|
@@ -1054,9 +1145,7 @@ class GeneratedTransport:
|
|
|
1054
1145
|
authorization: str,
|
|
1055
1146
|
) -> TransportResponse:
|
|
1056
1147
|
with self._client(authorization) as client:
|
|
1057
|
-
response = client
|
|
1058
|
-
**delete_all_my_sessions_kwargs()
|
|
1059
|
-
)
|
|
1148
|
+
response = _generated_request(client, delete_all_my_sessions_kwargs())
|
|
1060
1149
|
return self._raw_response(response)
|
|
1061
1150
|
|
|
1062
1151
|
def auth_delete_my_session(
|
|
@@ -1066,8 +1155,8 @@ class GeneratedTransport:
|
|
|
1066
1155
|
session_id: str,
|
|
1067
1156
|
) -> TransportResponse:
|
|
1068
1157
|
with self._client(authorization) as client:
|
|
1069
|
-
response =
|
|
1070
|
-
|
|
1158
|
+
response = _generated_request(
|
|
1159
|
+
client, delete_my_session_kwargs(session_id=cast("UUID", session_id))
|
|
1071
1160
|
)
|
|
1072
1161
|
return self._raw_response(response)
|
|
1073
1162
|
|
|
@@ -1079,13 +1168,13 @@ class GeneratedTransport:
|
|
|
1079
1168
|
limit: int,
|
|
1080
1169
|
) -> TransportResponse:
|
|
1081
1170
|
with self._client(authorization) as client:
|
|
1082
|
-
response =
|
|
1083
|
-
|
|
1171
|
+
response = _generated_request(
|
|
1172
|
+
client, get_my_sessions_kwargs(page=page, limit=limit)
|
|
1084
1173
|
)
|
|
1085
1174
|
if response.status_code != HTTP_OK:
|
|
1086
1175
|
return self._raw_response(response)
|
|
1087
1176
|
try:
|
|
1088
|
-
payload = AuthGetMySessionsResponse200.from_dict(response
|
|
1177
|
+
payload = AuthGetMySessionsResponse200.from_dict(_json_object(response))
|
|
1089
1178
|
except (
|
|
1090
1179
|
AttributeError,
|
|
1091
1180
|
KeyError,
|
|
@@ -1107,13 +1196,13 @@ class GeneratedTransport:
|
|
|
1107
1196
|
authorization: str,
|
|
1108
1197
|
) -> TransportResponse:
|
|
1109
1198
|
with self._client(authorization) as client:
|
|
1110
|
-
response = client
|
|
1111
|
-
**list_oauth_providers_kwargs()
|
|
1112
|
-
)
|
|
1199
|
+
response = _generated_request(client, list_oauth_providers_kwargs())
|
|
1113
1200
|
if response.status_code != HTTP_OK:
|
|
1114
1201
|
return self._raw_response(response)
|
|
1115
1202
|
try:
|
|
1116
|
-
payload = AuthListOAuthProvidersResponse200.from_dict(
|
|
1203
|
+
payload = AuthListOAuthProvidersResponse200.from_dict(
|
|
1204
|
+
_json_object(response)
|
|
1205
|
+
)
|
|
1117
1206
|
except (
|
|
1118
1207
|
AttributeError,
|
|
1119
1208
|
KeyError,
|
|
@@ -1172,13 +1261,11 @@ class GeneratedTransport:
|
|
|
1172
1261
|
provider: AuthLinkOAuthProviderProvider,
|
|
1173
1262
|
) -> TransportResponse:
|
|
1174
1263
|
with self._client(authorization) as client:
|
|
1175
|
-
response = client
|
|
1176
|
-
**link_oauth_provider_kwargs(provider)
|
|
1177
|
-
)
|
|
1264
|
+
response = _generated_request(client, link_oauth_provider_kwargs(provider))
|
|
1178
1265
|
if response.status_code != HTTP_OK:
|
|
1179
1266
|
return self._raw_response(response)
|
|
1180
1267
|
try:
|
|
1181
|
-
payload = AuthLinkOAuthProviderResponse200.from_dict(response
|
|
1268
|
+
payload = AuthLinkOAuthProviderResponse200.from_dict(_json_object(response))
|
|
1182
1269
|
except (
|
|
1183
1270
|
AttributeError,
|
|
1184
1271
|
KeyError,
|
|
@@ -1201,8 +1288,8 @@ class GeneratedTransport:
|
|
|
1201
1288
|
provider: AuthUnlinkOAuthProviderProvider,
|
|
1202
1289
|
) -> TransportResponse:
|
|
1203
1290
|
with self._client(authorization) as client:
|
|
1204
|
-
response =
|
|
1205
|
-
|
|
1291
|
+
response = _generated_request(
|
|
1292
|
+
client, unlink_oauth_provider_kwargs(provider)
|
|
1206
1293
|
)
|
|
1207
1294
|
return self._raw_response(response)
|
|
1208
1295
|
|
|
@@ -1213,13 +1300,13 @@ class GeneratedTransport:
|
|
|
1213
1300
|
provider: GetOAuthProviderTokenProvider,
|
|
1214
1301
|
) -> TransportResponse:
|
|
1215
1302
|
with self._client(authorization) as client:
|
|
1216
|
-
response =
|
|
1217
|
-
|
|
1303
|
+
response = _generated_request(
|
|
1304
|
+
client, get_oauth_provider_token_kwargs(provider)
|
|
1218
1305
|
)
|
|
1219
1306
|
if response.status_code != HTTP_OK:
|
|
1220
1307
|
return self._raw_response(response)
|
|
1221
1308
|
try:
|
|
1222
|
-
payload = GetOAuthProviderTokenResponse200.from_dict(response
|
|
1309
|
+
payload = GetOAuthProviderTokenResponse200.from_dict(_json_object(response))
|
|
1223
1310
|
except (
|
|
1224
1311
|
AttributeError,
|
|
1225
1312
|
KeyError,
|
|
@@ -1242,13 +1329,15 @@ class GeneratedTransport:
|
|
|
1242
1329
|
provider: RefreshOAuthProviderTokenProvider,
|
|
1243
1330
|
) -> TransportResponse:
|
|
1244
1331
|
with self._client(authorization) as client:
|
|
1245
|
-
response =
|
|
1246
|
-
|
|
1332
|
+
response = _generated_request(
|
|
1333
|
+
client, refresh_oauth_provider_token_kwargs(provider)
|
|
1247
1334
|
)
|
|
1248
1335
|
if response.status_code != HTTP_OK:
|
|
1249
1336
|
return self._raw_response(response)
|
|
1250
1337
|
try:
|
|
1251
|
-
payload = RefreshOAuthProviderTokenResponse200.from_dict(
|
|
1338
|
+
payload = RefreshOAuthProviderTokenResponse200.from_dict(
|
|
1339
|
+
_json_object(response)
|
|
1340
|
+
)
|
|
1252
1341
|
except (
|
|
1253
1342
|
AttributeError,
|
|
1254
1343
|
KeyError,
|
|
@@ -1271,20 +1360,20 @@ class GeneratedTransport:
|
|
|
1271
1360
|
provider: CallOAuthProviderAPIProvider,
|
|
1272
1361
|
endpoint: str,
|
|
1273
1362
|
method: str,
|
|
1274
|
-
body: Mapping[str,
|
|
1363
|
+
body: Mapping[str, JSONValue] | None,
|
|
1275
1364
|
) -> TransportResponse:
|
|
1276
|
-
request_values: dict[str,
|
|
1365
|
+
request_values: dict[str, object] = {"endpoint": endpoint, "method": method}
|
|
1277
1366
|
if body is not None:
|
|
1278
1367
|
request_values["body"] = _plain_json(body)
|
|
1279
1368
|
request_body = CallOAuthProviderAPIBody.from_dict(request_values)
|
|
1280
1369
|
with self._client(authorization) as client:
|
|
1281
|
-
response =
|
|
1282
|
-
|
|
1370
|
+
response = _generated_request(
|
|
1371
|
+
client, call_oauth_provider_api_kwargs(provider, body=request_body)
|
|
1283
1372
|
)
|
|
1284
1373
|
if response.status_code != HTTP_OK:
|
|
1285
1374
|
return self._raw_response(response)
|
|
1286
1375
|
try:
|
|
1287
|
-
payload = CallOAuthProviderAPIResponse200.from_dict(response
|
|
1376
|
+
payload = CallOAuthProviderAPIResponse200.from_dict(_json_object(response))
|
|
1288
1377
|
except (
|
|
1289
1378
|
AttributeError,
|
|
1290
1379
|
KeyError,
|
|
@@ -1303,9 +1392,7 @@ class GeneratedTransport:
|
|
|
1303
1392
|
def auth_get_user(self, *, authorization: str) -> TransportResponse:
|
|
1304
1393
|
try:
|
|
1305
1394
|
with self._client(authorization) as client:
|
|
1306
|
-
raw_response = client
|
|
1307
|
-
**auth_get_user_kwargs()
|
|
1308
|
-
)
|
|
1395
|
+
raw_response = _generated_request(client, auth_get_user_kwargs())
|
|
1309
1396
|
if raw_response.status_code == HTTP_UNAUTHORIZED:
|
|
1310
1397
|
return self._raw_response(raw_response)
|
|
1311
1398
|
response = build_auth_get_user_response(
|
|
@@ -1345,8 +1432,8 @@ class GeneratedTransport:
|
|
|
1345
1432
|
)
|
|
1346
1433
|
try:
|
|
1347
1434
|
with self._client(authorization) as client:
|
|
1348
|
-
raw_response =
|
|
1349
|
-
|
|
1435
|
+
raw_response = _generated_request(
|
|
1436
|
+
client, auth_update_user_kwargs(body=body)
|
|
1350
1437
|
)
|
|
1351
1438
|
if raw_response.status_code == HTTP_UNAUTHORIZED:
|
|
1352
1439
|
return self._raw_response(raw_response)
|
|
@@ -1401,14 +1488,15 @@ class GeneratedTransport:
|
|
|
1401
1488
|
*,
|
|
1402
1489
|
authorization: str,
|
|
1403
1490
|
database_name: str,
|
|
1404
|
-
body: dict[str,
|
|
1491
|
+
body: dict[str, object],
|
|
1405
1492
|
) -> TransportResponse:
|
|
1406
1493
|
with self._client(authorization) as client:
|
|
1407
|
-
response =
|
|
1408
|
-
|
|
1494
|
+
response = _generated_request(
|
|
1495
|
+
client,
|
|
1496
|
+
database_select_kwargs(
|
|
1409
1497
|
database_name,
|
|
1410
1498
|
body=DatabaseSelectRequest.from_dict(body),
|
|
1411
|
-
)
|
|
1499
|
+
),
|
|
1412
1500
|
)
|
|
1413
1501
|
if response.status_code == HTTP_UNAUTHORIZED:
|
|
1414
1502
|
return self._raw_response(response)
|
|
@@ -1420,7 +1508,7 @@ class GeneratedTransport:
|
|
|
1420
1508
|
*,
|
|
1421
1509
|
authorization: str,
|
|
1422
1510
|
database_name: str,
|
|
1423
|
-
body: dict[str,
|
|
1511
|
+
body: dict[str, object],
|
|
1424
1512
|
) -> TransportResponse:
|
|
1425
1513
|
async with self._client(authorization) as client:
|
|
1426
1514
|
response = await query_database_select.asyncio_detailed(
|
|
@@ -1435,13 +1523,14 @@ class GeneratedTransport:
|
|
|
1435
1523
|
*,
|
|
1436
1524
|
authorization: str,
|
|
1437
1525
|
database_name: str,
|
|
1438
|
-
body: dict[str,
|
|
1526
|
+
body: dict[str, object],
|
|
1439
1527
|
) -> TransportResponse:
|
|
1440
1528
|
with self._client(authorization) as client:
|
|
1441
|
-
response =
|
|
1442
|
-
|
|
1529
|
+
response = _generated_request(
|
|
1530
|
+
client,
|
|
1531
|
+
database_insert_kwargs(
|
|
1443
1532
|
database_name, body=DatabaseInsertRequest.from_dict(body)
|
|
1444
|
-
)
|
|
1533
|
+
),
|
|
1445
1534
|
)
|
|
1446
1535
|
if response.status_code == HTTP_UNAUTHORIZED:
|
|
1447
1536
|
return self._raw_response(response)
|
|
@@ -1453,13 +1542,14 @@ class GeneratedTransport:
|
|
|
1453
1542
|
*,
|
|
1454
1543
|
authorization: str,
|
|
1455
1544
|
database_name: str,
|
|
1456
|
-
body: dict[str,
|
|
1545
|
+
body: dict[str, object],
|
|
1457
1546
|
) -> TransportResponse:
|
|
1458
1547
|
with self._client(authorization) as client:
|
|
1459
|
-
response =
|
|
1460
|
-
|
|
1548
|
+
response = _generated_request(
|
|
1549
|
+
client,
|
|
1550
|
+
database_update_kwargs(
|
|
1461
1551
|
database_name, body=DatabaseUpdateRequest.from_dict(body)
|
|
1462
|
-
)
|
|
1552
|
+
),
|
|
1463
1553
|
)
|
|
1464
1554
|
if response.status_code == HTTP_UNAUTHORIZED:
|
|
1465
1555
|
return self._raw_response(response)
|
|
@@ -1471,13 +1561,14 @@ class GeneratedTransport:
|
|
|
1471
1561
|
*,
|
|
1472
1562
|
authorization: str,
|
|
1473
1563
|
database_name: str,
|
|
1474
|
-
body: dict[str,
|
|
1564
|
+
body: dict[str, object],
|
|
1475
1565
|
) -> TransportResponse:
|
|
1476
1566
|
with self._client(authorization) as client:
|
|
1477
|
-
response =
|
|
1478
|
-
|
|
1567
|
+
response = _generated_request(
|
|
1568
|
+
client,
|
|
1569
|
+
database_delete_kwargs(
|
|
1479
1570
|
database_name, body=DatabaseDeleteRequest.from_dict(body)
|
|
1480
|
-
)
|
|
1571
|
+
),
|
|
1481
1572
|
)
|
|
1482
1573
|
if response.status_code == HTTP_UNAUTHORIZED:
|
|
1483
1574
|
return self._raw_response(response)
|
|
@@ -1706,9 +1797,7 @@ class GeneratedTransport:
|
|
|
1706
1797
|
name: str,
|
|
1707
1798
|
) -> TransportResponse:
|
|
1708
1799
|
with self._client(authorization) as client:
|
|
1709
|
-
response = client
|
|
1710
|
-
**resolve_function_kwargs(name=name)
|
|
1711
|
-
)
|
|
1800
|
+
response = _generated_request(client, resolve_function_kwargs(name=name))
|
|
1712
1801
|
return self._raw_response(response)
|
|
1713
1802
|
|
|
1714
1803
|
def invoke_function(
|
|
@@ -1718,16 +1807,17 @@ class GeneratedTransport:
|
|
|
1718
1807
|
function_id: str,
|
|
1719
1808
|
payload: Mapping[str, JSONValue],
|
|
1720
1809
|
) -> TransportResponse:
|
|
1721
|
-
plain_payload =
|
|
1810
|
+
plain_payload = _plain_json(payload)
|
|
1722
1811
|
body = FunctionInvocationRequest(
|
|
1723
1812
|
payload=FunctionInvocationRequestPayload.from_dict(plain_payload)
|
|
1724
1813
|
)
|
|
1725
1814
|
with self._client(authorization) as client:
|
|
1726
|
-
response =
|
|
1727
|
-
|
|
1815
|
+
response = _generated_request(
|
|
1816
|
+
client,
|
|
1817
|
+
invoke_function_kwargs(
|
|
1728
1818
|
UUID(function_id),
|
|
1729
1819
|
body=body,
|
|
1730
|
-
)
|
|
1820
|
+
),
|
|
1731
1821
|
)
|
|
1732
1822
|
return self._raw_response(response)
|
|
1733
1823
|
|
|
@@ -1741,7 +1831,7 @@ class GeneratedTransport:
|
|
|
1741
1831
|
# The resolved endpoint is absolute and off the API host, so it cannot
|
|
1742
1832
|
# go through the generated client's base URL. The body still uses the
|
|
1743
1833
|
# invoke contract's { payload } envelope.
|
|
1744
|
-
plain_payload =
|
|
1834
|
+
plain_payload = _plain_json(payload)
|
|
1745
1835
|
with self._client(authorization) as client:
|
|
1746
1836
|
response = client.get_httpx_client().request(
|
|
1747
1837
|
method="POST",
|
|
@@ -1772,13 +1862,13 @@ class GeneratedTransport:
|
|
|
1772
1862
|
project_id: str,
|
|
1773
1863
|
request: Mapping[str, JSONValue],
|
|
1774
1864
|
) -> TransportResponse:
|
|
1775
|
-
plain_request =
|
|
1865
|
+
plain_request = _plain_json(request)
|
|
1776
1866
|
with self._client(authorization) as client:
|
|
1777
1867
|
request_kwargs = log_search_kwargs(
|
|
1778
1868
|
UUID(project_id), body=LogSearchRequest.from_dict(plain_request)
|
|
1779
1869
|
)
|
|
1780
1870
|
request_kwargs["json"] = plain_request
|
|
1781
|
-
raw_response = client
|
|
1871
|
+
raw_response = _generated_request(client, request_kwargs)
|
|
1782
1872
|
if raw_response.status_code == HTTP_UNAUTHORIZED:
|
|
1783
1873
|
return self._raw_response(raw_response)
|
|
1784
1874
|
self._validate_log_response(raw_response, search_metadata)
|
|
@@ -1795,13 +1885,13 @@ class GeneratedTransport:
|
|
|
1795
1885
|
project_id: str,
|
|
1796
1886
|
request: Mapping[str, JSONValue],
|
|
1797
1887
|
) -> TransportResponse:
|
|
1798
|
-
plain_request =
|
|
1888
|
+
plain_request = _plain_json(request)
|
|
1799
1889
|
with self._client(authorization) as client:
|
|
1800
1890
|
request_kwargs = log_activity_kwargs(
|
|
1801
1891
|
UUID(project_id), body=LogActivityRequest.from_dict(plain_request)
|
|
1802
1892
|
)
|
|
1803
1893
|
request_kwargs["json"] = plain_request
|
|
1804
|
-
raw_response = client
|
|
1894
|
+
raw_response = _generated_request(client, request_kwargs)
|
|
1805
1895
|
if raw_response.status_code == HTTP_UNAUTHORIZED:
|
|
1806
1896
|
return self._raw_response(raw_response)
|
|
1807
1897
|
self._validate_log_response(raw_response, activity_total)
|
|
@@ -1827,7 +1917,7 @@ class GeneratedTransport:
|
|
|
1827
1917
|
x_volcano_lock_token=cast("UUID", token),
|
|
1828
1918
|
x_volcano_request_id=cast("UUID", request_id or str(uuid4())),
|
|
1829
1919
|
)
|
|
1830
|
-
raw_response = client
|
|
1920
|
+
raw_response = _generated_request(client, request_kwargs)
|
|
1831
1921
|
if raw_response.status_code != HTTP_CREATED:
|
|
1832
1922
|
return self._raw_response(raw_response)
|
|
1833
1923
|
response = build_lock_acquire_response(client=client, response=raw_response)
|
|
@@ -1948,9 +2038,7 @@ class GeneratedTransport:
|
|
|
1948
2038
|
UUID(project_id),
|
|
1949
2039
|
function_id,
|
|
1950
2040
|
client=client,
|
|
1951
|
-
status=
|
|
1952
|
-
UNSET if request.status is None else cast("Any", request.status)
|
|
1953
|
-
),
|
|
2041
|
+
status=UNSET if request.status is None else request.status,
|
|
1954
2042
|
page=UNSET if request.page is None else request.page,
|
|
1955
2043
|
limit=UNSET if request.limit is None else request.limit,
|
|
1956
2044
|
)
|