volcano-sdk-python 0.9.0__py3-none-any.whl → 0.9.1__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/auth.py +117 -91
- {volcano_sdk_python-0.9.0.dist-info → volcano_sdk_python-0.9.1.dist-info}/METADATA +1 -1
- {volcano_sdk_python-0.9.0.dist-info → volcano_sdk_python-0.9.1.dist-info}/RECORD +5 -5
- {volcano_sdk_python-0.9.0.dist-info → volcano_sdk_python-0.9.1.dist-info}/WHEEL +0 -0
- {volcano_sdk_python-0.9.0.dist-info → volcano_sdk_python-0.9.1.dist-info}/licenses/LICENSE +0 -0
volcano_sdk/auth.py
CHANGED
|
@@ -590,33 +590,37 @@ class Auth:
|
|
|
590
590
|
|
|
591
591
|
def request_email_change(self, *, new_email: str) -> EmailChangeResult:
|
|
592
592
|
"""Request a confirmation email without changing the current session."""
|
|
593
|
-
|
|
594
|
-
if
|
|
593
|
+
binding = self._client._capture_session_binding()
|
|
594
|
+
if binding[2] is None:
|
|
595
595
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
596
596
|
transport = cast("AuthRequestEmailChangeTransport", self._client._transport)
|
|
597
|
-
response =
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
597
|
+
response = self._session_request(
|
|
598
|
+
lambda access_token: invoke(
|
|
599
|
+
transport.auth_request_email_change,
|
|
600
|
+
authorization=access_token,
|
|
601
|
+
new_email=new_email,
|
|
602
|
+
),
|
|
603
|
+
binding=binding,
|
|
601
604
|
)
|
|
602
605
|
result = _email_change_result_from_payload(response_payload(response, 200))
|
|
603
|
-
|
|
604
|
-
raise SessionChangedError
|
|
606
|
+
self._owned_refresh_session(binding)
|
|
605
607
|
return result
|
|
606
608
|
|
|
607
609
|
def cancel_email_change(self) -> None:
|
|
608
610
|
"""Cancel a pending email change without changing the current session."""
|
|
609
|
-
|
|
610
|
-
if
|
|
611
|
+
binding = self._client._capture_session_binding()
|
|
612
|
+
if binding[2] is None:
|
|
611
613
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
612
614
|
transport = cast("AuthCancelEmailChangeTransport", self._client._transport)
|
|
613
|
-
response =
|
|
614
|
-
|
|
615
|
-
|
|
615
|
+
response = self._session_request(
|
|
616
|
+
lambda access_token: invoke(
|
|
617
|
+
transport.auth_cancel_email_change,
|
|
618
|
+
authorization=access_token,
|
|
619
|
+
),
|
|
620
|
+
binding=binding,
|
|
616
621
|
)
|
|
617
622
|
response_payload(response, 200)
|
|
618
|
-
|
|
619
|
-
raise SessionChangedError
|
|
623
|
+
self._owned_refresh_session(binding)
|
|
620
624
|
|
|
621
625
|
def confirm_email_change(self, *, token: str) -> User:
|
|
622
626
|
"""Confirm a pending email change and return the updated user."""
|
|
@@ -636,48 +640,54 @@ class Auth:
|
|
|
636
640
|
|
|
637
641
|
def delete_all_other_sessions(self) -> None:
|
|
638
642
|
"""Delete every other session while preserving the current session."""
|
|
639
|
-
|
|
640
|
-
if
|
|
643
|
+
binding = self._client._capture_session_binding()
|
|
644
|
+
if binding[2] is None:
|
|
641
645
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
642
646
|
transport = cast("AuthDeleteAllMySessionsTransport", self._client._transport)
|
|
643
|
-
response =
|
|
644
|
-
|
|
645
|
-
|
|
647
|
+
response = self._session_request(
|
|
648
|
+
lambda access_token: invoke(
|
|
649
|
+
transport.auth_delete_all_my_sessions,
|
|
650
|
+
authorization=access_token,
|
|
651
|
+
),
|
|
652
|
+
binding=binding,
|
|
646
653
|
)
|
|
647
654
|
response_payload(response, 204)
|
|
648
|
-
|
|
649
|
-
raise SessionChangedError
|
|
655
|
+
self._owned_refresh_session(binding)
|
|
650
656
|
|
|
651
657
|
def list_sessions(self, *, page: int = 1, limit: int = 20) -> SessionPage:
|
|
652
658
|
"""List sessions in the stable offset-paginated activity order."""
|
|
653
|
-
|
|
654
|
-
if
|
|
659
|
+
binding = self._client._capture_session_binding()
|
|
660
|
+
if binding[2] is None:
|
|
655
661
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
656
662
|
transport = cast("AuthGetMySessionsTransport", self._client._transport)
|
|
657
|
-
response =
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
663
|
+
response = self._session_request(
|
|
664
|
+
lambda access_token: invoke(
|
|
665
|
+
transport.auth_get_my_sessions,
|
|
666
|
+
authorization=access_token,
|
|
667
|
+
page=page,
|
|
668
|
+
limit=limit,
|
|
669
|
+
),
|
|
670
|
+
binding=binding,
|
|
662
671
|
)
|
|
663
672
|
result = _session_page_from_payload(response_payload(response, 200))
|
|
664
|
-
|
|
665
|
-
raise SessionChangedError
|
|
673
|
+
self._owned_refresh_session(binding)
|
|
666
674
|
return result
|
|
667
675
|
|
|
668
676
|
def list_linked_oauth_providers(self) -> tuple[LinkedOAuthProvider, ...]:
|
|
669
677
|
"""List OAuth providers linked to the current account."""
|
|
670
|
-
|
|
671
|
-
if
|
|
678
|
+
binding = self._client._capture_session_binding()
|
|
679
|
+
if binding[2] is None:
|
|
672
680
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
673
681
|
transport = cast("AuthListOAuthProvidersTransport", self._client._transport)
|
|
674
|
-
response =
|
|
675
|
-
|
|
676
|
-
|
|
682
|
+
response = self._session_request(
|
|
683
|
+
lambda access_token: invoke(
|
|
684
|
+
transport.auth_list_oauth_providers,
|
|
685
|
+
authorization=access_token,
|
|
686
|
+
),
|
|
687
|
+
binding=binding,
|
|
677
688
|
)
|
|
678
689
|
result = _linked_oauth_providers_from_payload(response_payload(response, 200))
|
|
679
|
-
|
|
680
|
-
raise SessionChangedError
|
|
690
|
+
self._owned_refresh_session(binding)
|
|
681
691
|
return result
|
|
682
692
|
|
|
683
693
|
def get_hosted_auth_url(
|
|
@@ -763,38 +773,42 @@ class Auth:
|
|
|
763
773
|
def link_oauth_provider(self, *, provider: OAuthProviderName) -> str:
|
|
764
774
|
"""Return the authorization URL for linking an OAuth provider."""
|
|
765
775
|
provider_name = _oauth_provider_name(provider)
|
|
766
|
-
|
|
767
|
-
if
|
|
776
|
+
binding = self._client._capture_session_binding()
|
|
777
|
+
if binding[2] is None:
|
|
768
778
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
769
779
|
transport = cast("AuthLinkOAuthProviderTransport", self._client._transport)
|
|
770
|
-
response =
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
780
|
+
response = self._session_request(
|
|
781
|
+
lambda access_token: invoke(
|
|
782
|
+
transport.auth_link_oauth_provider,
|
|
783
|
+
authorization=access_token,
|
|
784
|
+
provider=provider_name,
|
|
785
|
+
),
|
|
786
|
+
binding=binding,
|
|
774
787
|
)
|
|
775
788
|
result = _oauth_link_from_payload(response_payload(response, 200))
|
|
776
|
-
|
|
777
|
-
raise SessionChangedError
|
|
789
|
+
self._owned_refresh_session(binding)
|
|
778
790
|
return result
|
|
779
791
|
|
|
780
792
|
def unlink_oauth_provider(self, *, provider: OAuthProviderName) -> None:
|
|
781
793
|
"""Unlink an OAuth provider from the current account."""
|
|
782
794
|
provider_name = _oauth_provider_name(provider)
|
|
783
|
-
|
|
784
|
-
if
|
|
795
|
+
binding = self._client._capture_session_binding()
|
|
796
|
+
if binding[2] is None:
|
|
785
797
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
786
798
|
transport = cast(
|
|
787
799
|
"AuthUnlinkOAuthProviderTransport",
|
|
788
800
|
self._client._transport,
|
|
789
801
|
)
|
|
790
|
-
response =
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
802
|
+
response = self._session_request(
|
|
803
|
+
lambda access_token: invoke(
|
|
804
|
+
transport.auth_unlink_oauth_provider,
|
|
805
|
+
authorization=access_token,
|
|
806
|
+
provider=provider_name,
|
|
807
|
+
),
|
|
808
|
+
binding=binding,
|
|
794
809
|
)
|
|
795
810
|
response_payload(response, 204)
|
|
796
|
-
|
|
797
|
-
raise SessionChangedError
|
|
811
|
+
self._owned_refresh_session(binding)
|
|
798
812
|
|
|
799
813
|
def get_oauth_provider_token(
|
|
800
814
|
self,
|
|
@@ -803,23 +817,25 @@ class Auth:
|
|
|
803
817
|
) -> OAuthProviderTokenStatus:
|
|
804
818
|
"""Return validity metadata for a server-held OAuth provider token."""
|
|
805
819
|
provider_name = _oauth_provider_name(provider)
|
|
806
|
-
|
|
807
|
-
if
|
|
820
|
+
binding = self._client._capture_session_binding()
|
|
821
|
+
if binding[2] is None:
|
|
808
822
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
809
823
|
transport = cast(
|
|
810
824
|
"AuthGetOAuthProviderTokenTransport",
|
|
811
825
|
self._client._transport,
|
|
812
826
|
)
|
|
813
|
-
response =
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
827
|
+
response = self._session_request(
|
|
828
|
+
lambda access_token: invoke(
|
|
829
|
+
transport.auth_get_oauth_provider_token,
|
|
830
|
+
authorization=access_token,
|
|
831
|
+
provider=provider_name,
|
|
832
|
+
),
|
|
833
|
+
binding=binding,
|
|
817
834
|
)
|
|
818
835
|
result = _oauth_provider_token_status_from_payload(
|
|
819
836
|
response_payload(response, 200)
|
|
820
837
|
)
|
|
821
|
-
|
|
822
|
-
raise SessionChangedError
|
|
838
|
+
self._owned_refresh_session(binding)
|
|
823
839
|
return result
|
|
824
840
|
|
|
825
841
|
def refresh_oauth_provider_token(
|
|
@@ -829,23 +845,25 @@ class Auth:
|
|
|
829
845
|
) -> OAuthProviderTokenStatus:
|
|
830
846
|
"""Refresh a server-held OAuth provider token and return its status."""
|
|
831
847
|
provider_name = _oauth_provider_name(provider)
|
|
832
|
-
|
|
833
|
-
if
|
|
848
|
+
binding = self._client._capture_session_binding()
|
|
849
|
+
if binding[2] is None:
|
|
834
850
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
835
851
|
transport = cast(
|
|
836
852
|
"AuthRefreshOAuthProviderTokenTransport",
|
|
837
853
|
self._client._transport,
|
|
838
854
|
)
|
|
839
|
-
response =
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
855
|
+
response = self._session_request(
|
|
856
|
+
lambda access_token: invoke(
|
|
857
|
+
transport.auth_refresh_oauth_provider_token,
|
|
858
|
+
authorization=access_token,
|
|
859
|
+
provider=provider_name,
|
|
860
|
+
),
|
|
861
|
+
binding=binding,
|
|
843
862
|
)
|
|
844
863
|
result = _oauth_provider_token_status_from_payload(
|
|
845
864
|
response_payload(response, 200)
|
|
846
865
|
)
|
|
847
|
-
|
|
848
|
-
raise SessionChangedError
|
|
866
|
+
self._owned_refresh_session(binding)
|
|
849
867
|
return result
|
|
850
868
|
|
|
851
869
|
def call_oauth_api(
|
|
@@ -859,26 +877,30 @@ class Auth:
|
|
|
859
877
|
"""Call a provider API through Volcano's fixed-host server proxy."""
|
|
860
878
|
provider_name = _oauth_provider_name(provider)
|
|
861
879
|
request_method = _oauth_api_method(method)
|
|
862
|
-
|
|
863
|
-
if
|
|
880
|
+
binding = self._client._capture_session_binding()
|
|
881
|
+
if binding[2] is None:
|
|
864
882
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
865
883
|
transport = cast("AuthCallOAuthAPITransport", self._client._transport)
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
884
|
+
request_body = deepcopy(dict(body)) if body is not None else None
|
|
885
|
+
response = self._session_request(
|
|
886
|
+
lambda access_token: invoke(
|
|
887
|
+
transport.auth_call_oauth_api,
|
|
888
|
+
authorization=access_token,
|
|
889
|
+
provider=provider_name,
|
|
890
|
+
endpoint=endpoint,
|
|
891
|
+
method=request_method,
|
|
892
|
+
body=request_body,
|
|
893
|
+
),
|
|
894
|
+
binding=binding,
|
|
873
895
|
)
|
|
874
896
|
result = _oauth_api_data_from_payload(response_payload(response, 200))
|
|
875
|
-
|
|
876
|
-
raise SessionChangedError
|
|
897
|
+
self._owned_refresh_session(binding)
|
|
877
898
|
return result
|
|
878
899
|
|
|
879
900
|
def delete_session(self, *, session_id: str) -> None:
|
|
880
901
|
"""Delete one session and clear local state when it is current."""
|
|
881
|
-
|
|
902
|
+
binding = self._client._capture_session_binding()
|
|
903
|
+
generation, lineage, current = binding
|
|
882
904
|
if current is None:
|
|
883
905
|
raise AuthenticationError(_NO_ACTIVE_SESSION)
|
|
884
906
|
current_session_id = session_id_from_access_token(current.access_token)
|
|
@@ -888,24 +910,28 @@ class Auth:
|
|
|
888
910
|
)
|
|
889
911
|
transport = cast("AuthDeleteMySessionTransport", self._client._transport)
|
|
890
912
|
try:
|
|
891
|
-
response =
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
913
|
+
response = self._session_request(
|
|
914
|
+
lambda access_token: invoke(
|
|
915
|
+
transport.auth_delete_my_session,
|
|
916
|
+
authorization=access_token,
|
|
917
|
+
session_id=session_id,
|
|
918
|
+
),
|
|
919
|
+
binding=binding,
|
|
895
920
|
)
|
|
896
921
|
response_payload(response, 204)
|
|
897
922
|
except TransportError as error:
|
|
898
923
|
if deletes_current and not self._client._clear_session_if_current(
|
|
899
|
-
generation
|
|
924
|
+
generation, lineage=lineage
|
|
900
925
|
):
|
|
901
926
|
raise SessionChangedError from error
|
|
902
927
|
raise
|
|
903
928
|
if deletes_current:
|
|
904
|
-
|
|
929
|
+
if not self._client._clear_session_if_current(generation, lineage=lineage):
|
|
930
|
+
raise SessionChangedError
|
|
905
931
|
else:
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
932
|
+
_, active_lineage, active_session = self._client._capture_session_binding()
|
|
933
|
+
if active_lineage is not lineage or active_session is None:
|
|
934
|
+
raise SessionChangedError
|
|
909
935
|
|
|
910
936
|
def confirm_email(self, *, token: str) -> None:
|
|
911
937
|
"""Confirm an email with its token without changing local state."""
|
|
@@ -7,7 +7,7 @@ volcano_sdk/_realtime_fetch_worker.py,sha256=zQTgFF4cIUBeAL4J2OpWAlz_sIynv2BLfu5
|
|
|
7
7
|
volcano_sdk/_session.py,sha256=LYCv2NCDlL5Slh2YLEG8VQ8z-kDaKDYWW4vGdMvUf1U,2474
|
|
8
8
|
volcano_sdk/_session_operations.py,sha256=1vI9gtwjxG2eUGT-nIYnMEgRldJqgIj2lRLukBbG64E,5518
|
|
9
9
|
volcano_sdk/_transport.py,sha256=AFd47C3X1WAHwq3f9V2ux0WNzwGIn4NBxrwgaIN-xl0,58296
|
|
10
|
-
volcano_sdk/auth.py,sha256=
|
|
10
|
+
volcano_sdk/auth.py,sha256=iKq8o0K8geVKXrnLzhvOjAQoX_Nd0yQDJqDH4bemWaM,47366
|
|
11
11
|
volcano_sdk/client.py,sha256=CJJnf_iTcXnyY2Y57LXJVAn39mTUsepblUg9op-Thzo,12283
|
|
12
12
|
volcano_sdk/connection_string.py,sha256=LlTZigsrCF4IfAqQ8SDTWJv35hnnzNu1MfeVv5JW-Kk,2331
|
|
13
13
|
volcano_sdk/database.py,sha256=p_5OaqlBjKAtIUfKQCflXM_CGqokrVmpOMsp6KHiJ8A,9493
|
|
@@ -775,7 +775,7 @@ volcano_sdk/_generated/models/usage_data_point.py,sha256=d4U08JbVTiIMM_l2BmRILL1
|
|
|
775
775
|
volcano_sdk/_generated/models/variable.py,sha256=tvGDOMv77gW6j5skufnfrlNAhzCzA1F7nuPCQWx79yY,5926
|
|
776
776
|
volcano_sdk/_generated/models/variable_deploy_source.py,sha256=G_aCiFHzQx8WhJFs0GvYZEFclfTrfkDvd3kT1e3vty8,463
|
|
777
777
|
volcano_sdk/_generated/models/variable_status.py,sha256=THSsKBSiAYG4kAtBzGA4TZqxjgx8hdL0Q4qCdZfOj00,391
|
|
778
|
-
volcano_sdk_python-0.9.
|
|
779
|
-
volcano_sdk_python-0.9.
|
|
780
|
-
volcano_sdk_python-0.9.
|
|
781
|
-
volcano_sdk_python-0.9.
|
|
778
|
+
volcano_sdk_python-0.9.1.dist-info/METADATA,sha256=zPhzqaYqvRyeIoZlgMAlmRbvskDedIxy6kclHDME__4,35125
|
|
779
|
+
volcano_sdk_python-0.9.1.dist-info/WHEEL,sha256=THafob7ofN-NsuMN7Mg4qZyHaQI7KkD-QlcQatYhXPo,87
|
|
780
|
+
volcano_sdk_python-0.9.1.dist-info/licenses/LICENSE,sha256=AIHJy-5MFqM8fHfuGFTTb9a8rvJGypcVgN4aZ-7XTWw,11387
|
|
781
|
+
volcano_sdk_python-0.9.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|