otdf-python 0.4.0__py3-none-any.whl → 0.4.2__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.
- otdf_python/__init__.py +1 -2
- otdf_python/__main__.py +1 -2
- otdf_python/address_normalizer.py +8 -10
- otdf_python/aesgcm.py +8 -0
- otdf_python/assertion_config.py +21 -0
- otdf_python/asym_crypto.py +18 -22
- otdf_python/auth_headers.py +7 -6
- otdf_python/autoconfigure_utils.py +21 -7
- otdf_python/cli.py +5 -5
- otdf_python/collection_store.py +13 -1
- otdf_python/collection_store_impl.py +5 -0
- otdf_python/config.py +13 -0
- otdf_python/connect_client.py +1 -0
- otdf_python/constants.py +2 -0
- otdf_python/crypto_utils.py +4 -0
- otdf_python/dpop.py +3 -5
- otdf_python/ecc_constants.py +12 -14
- otdf_python/ecc_mode.py +7 -2
- otdf_python/ecdh.py +24 -31
- otdf_python/eckeypair.py +5 -0
- otdf_python/header.py +5 -0
- otdf_python/invalid_zip_exception.py +6 -2
- otdf_python/kas_client.py +66 -55
- otdf_python/kas_connect_rpc_client.py +75 -38
- otdf_python/kas_info.py +4 -3
- otdf_python/kas_key_cache.py +10 -9
- otdf_python/key_type.py +4 -0
- otdf_python/key_type_constants.py +4 -11
- otdf_python/manifest.py +24 -0
- otdf_python/nanotdf.py +30 -28
- otdf_python/nanotdf_ecdsa_struct.py +5 -11
- otdf_python/nanotdf_type.py +13 -1
- otdf_python/policy_binding_serializer.py +6 -4
- otdf_python/policy_info.py +6 -0
- otdf_python/policy_object.py +8 -0
- otdf_python/policy_stub.py +2 -0
- otdf_python/resource_locator.py +22 -13
- otdf_python/sdk.py +51 -73
- otdf_python/sdk_builder.py +60 -47
- otdf_python/sdk_exceptions.py +11 -1
- otdf_python/symmetric_and_payload_config.py +6 -0
- otdf_python/tdf.py +47 -10
- otdf_python/tdf_reader.py +10 -13
- otdf_python/tdf_writer.py +5 -0
- otdf_python/token_source.py +4 -3
- otdf_python/version.py +5 -0
- otdf_python/zip_reader.py +10 -2
- otdf_python/zip_writer.py +11 -0
- {otdf_python-0.4.0.dist-info → otdf_python-0.4.2.dist-info}/METADATA +3 -2
- {otdf_python-0.4.0.dist-info → otdf_python-0.4.2.dist-info}/RECORD +81 -72
- {otdf_python-0.4.0.dist-info → otdf_python-0.4.2.dist-info}/WHEEL +1 -1
- otdf_python_proto/__init__.py +2 -6
- otdf_python_proto/authorization/__init__.py +10 -0
- otdf_python_proto/authorization/authorization_connect.py +250 -0
- otdf_python_proto/authorization/v2/authorization_connect.py +315 -0
- otdf_python_proto/entityresolution/__init__.py +10 -0
- otdf_python_proto/entityresolution/entity_resolution_connect.py +185 -0
- otdf_python_proto/entityresolution/v2/entity_resolution_connect.py +185 -0
- otdf_python_proto/kas/__init__.py +2 -2
- otdf_python_proto/kas/kas_connect.py +259 -0
- otdf_python_proto/policy/actions/__init__.py +11 -0
- otdf_python_proto/policy/actions/actions_connect.py +380 -0
- otdf_python_proto/policy/attributes/__init__.py +11 -0
- otdf_python_proto/policy/attributes/attributes_connect.py +1310 -0
- otdf_python_proto/policy/kasregistry/__init__.py +11 -0
- otdf_python_proto/policy/kasregistry/key_access_server_registry_connect.py +912 -0
- otdf_python_proto/policy/keymanagement/__init__.py +11 -0
- otdf_python_proto/policy/keymanagement/key_management_connect.py +380 -0
- otdf_python_proto/policy/namespaces/__init__.py +11 -0
- otdf_python_proto/policy/namespaces/namespaces_connect.py +648 -0
- otdf_python_proto/policy/registeredresources/__init__.py +11 -0
- otdf_python_proto/policy/registeredresources/registered_resources_connect.py +770 -0
- otdf_python_proto/policy/resourcemapping/__init__.py +11 -0
- otdf_python_proto/policy/resourcemapping/resource_mapping_connect.py +790 -0
- otdf_python_proto/policy/subjectmapping/__init__.py +11 -0
- otdf_python_proto/policy/subjectmapping/subject_mapping_connect.py +851 -0
- otdf_python_proto/policy/unsafe/__init__.py +11 -0
- otdf_python_proto/policy/unsafe/unsafe_connect.py +705 -0
- otdf_python_proto/wellknownconfiguration/__init__.py +10 -0
- otdf_python_proto/wellknownconfiguration/wellknown_configuration_connect.py +124 -0
- otdf_python_proto/authorization/authorization_pb2_connect.py +0 -191
- otdf_python_proto/authorization/v2/authorization_pb2_connect.py +0 -233
- otdf_python_proto/entityresolution/entity_resolution_pb2_connect.py +0 -149
- otdf_python_proto/entityresolution/v2/entity_resolution_pb2_connect.py +0 -149
- otdf_python_proto/kas/kas_pb2_connect.py +0 -192
- otdf_python_proto/policy/actions/actions_pb2_connect.py +0 -275
- otdf_python_proto/policy/attributes/attributes_pb2_connect.py +0 -863
- otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2_connect.py +0 -611
- otdf_python_proto/policy/keymanagement/key_management_pb2_connect.py +0 -275
- otdf_python_proto/policy/namespaces/namespaces_pb2_connect.py +0 -443
- otdf_python_proto/policy/registeredresources/registered_resources_pb2_connect.py +0 -527
- otdf_python_proto/policy/resourcemapping/resource_mapping_pb2_connect.py +0 -527
- otdf_python_proto/policy/subjectmapping/subject_mapping_pb2_connect.py +0 -569
- otdf_python_proto/policy/unsafe/unsafe_pb2_connect.py +0 -485
- otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2_connect.py +0 -107
- {otdf_python-0.4.0.dist-info → otdf_python-0.4.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by https://github.com/connectrpc/connect-python. DO NOT EDIT!
|
|
3
|
+
# source: wellknownconfiguration/wellknown_configuration.proto
|
|
4
|
+
|
|
5
|
+
from collections.abc import AsyncGenerator, AsyncIterator, Iterable, Iterator, Mapping
|
|
6
|
+
from typing import Protocol
|
|
7
|
+
|
|
8
|
+
from connectrpc.client import ConnectClient, ConnectClientSync
|
|
9
|
+
from connectrpc.code import Code
|
|
10
|
+
from connectrpc.errors import ConnectError
|
|
11
|
+
from connectrpc.interceptor import Interceptor, InterceptorSync
|
|
12
|
+
from connectrpc.method import IdempotencyLevel, MethodInfo
|
|
13
|
+
from connectrpc.request import Headers, RequestContext
|
|
14
|
+
from connectrpc.server import ConnectASGIApplication, ConnectWSGIApplication, Endpoint, EndpointSync
|
|
15
|
+
from . import wellknown_configuration_pb2 as wellknownconfiguration_dot_wellknown__configuration__pb2
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class WellKnownService(Protocol):
|
|
19
|
+
async def get_well_known_configuration(self, request: wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationRequest, ctx: RequestContext) -> wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationResponse:
|
|
20
|
+
raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class WellKnownServiceASGIApplication(ConnectASGIApplication[WellKnownService]):
|
|
24
|
+
def __init__(self, service: WellKnownService | AsyncGenerator[WellKnownService], *, interceptors: Iterable[Interceptor]=(), read_max_bytes: int | None = None) -> None:
|
|
25
|
+
super().__init__(
|
|
26
|
+
service=service,
|
|
27
|
+
endpoints=lambda svc: {
|
|
28
|
+
"/wellknownconfiguration.WellKnownService/GetWellKnownConfiguration": Endpoint.unary(
|
|
29
|
+
method=MethodInfo(
|
|
30
|
+
name="GetWellKnownConfiguration",
|
|
31
|
+
service_name="wellknownconfiguration.WellKnownService",
|
|
32
|
+
input=wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationRequest,
|
|
33
|
+
output=wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationResponse,
|
|
34
|
+
idempotency_level=IdempotencyLevel.NO_SIDE_EFFECTS,
|
|
35
|
+
),
|
|
36
|
+
function=svc.get_well_known_configuration,
|
|
37
|
+
),
|
|
38
|
+
},
|
|
39
|
+
interceptors=interceptors,
|
|
40
|
+
read_max_bytes=read_max_bytes,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
@property
|
|
44
|
+
def path(self) -> str:
|
|
45
|
+
"""Returns the URL path to mount the application to when serving multiple applications."""
|
|
46
|
+
return "/wellknownconfiguration.WellKnownService"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class WellKnownServiceClient(ConnectClient):
|
|
50
|
+
async def get_well_known_configuration(
|
|
51
|
+
self,
|
|
52
|
+
request: wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationRequest,
|
|
53
|
+
*,
|
|
54
|
+
headers: Headers | Mapping[str, str] | None = None,
|
|
55
|
+
timeout_ms: int | None = None,
|
|
56
|
+
use_get: bool = False,
|
|
57
|
+
) -> wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationResponse:
|
|
58
|
+
return await self.execute_unary(
|
|
59
|
+
request=request,
|
|
60
|
+
method=MethodInfo(
|
|
61
|
+
name="GetWellKnownConfiguration",
|
|
62
|
+
service_name="wellknownconfiguration.WellKnownService",
|
|
63
|
+
input=wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationRequest,
|
|
64
|
+
output=wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationResponse,
|
|
65
|
+
idempotency_level=IdempotencyLevel.NO_SIDE_EFFECTS,
|
|
66
|
+
),
|
|
67
|
+
headers=headers,
|
|
68
|
+
timeout_ms=timeout_ms,
|
|
69
|
+
use_get=use_get,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class WellKnownServiceSync(Protocol):
|
|
74
|
+
def get_well_known_configuration(self, request: wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationRequest, ctx: RequestContext) -> wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationResponse:
|
|
75
|
+
raise ConnectError(Code.UNIMPLEMENTED, "Not implemented")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class WellKnownServiceWSGIApplication(ConnectWSGIApplication):
|
|
79
|
+
def __init__(self, service: WellKnownServiceSync, interceptors: Iterable[InterceptorSync]=(), read_max_bytes: int | None = None) -> None:
|
|
80
|
+
super().__init__(
|
|
81
|
+
endpoints={
|
|
82
|
+
"/wellknownconfiguration.WellKnownService/GetWellKnownConfiguration": EndpointSync.unary(
|
|
83
|
+
method=MethodInfo(
|
|
84
|
+
name="GetWellKnownConfiguration",
|
|
85
|
+
service_name="wellknownconfiguration.WellKnownService",
|
|
86
|
+
input=wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationRequest,
|
|
87
|
+
output=wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationResponse,
|
|
88
|
+
idempotency_level=IdempotencyLevel.NO_SIDE_EFFECTS,
|
|
89
|
+
),
|
|
90
|
+
function=service.get_well_known_configuration,
|
|
91
|
+
),
|
|
92
|
+
},
|
|
93
|
+
interceptors=interceptors,
|
|
94
|
+
read_max_bytes=read_max_bytes,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def path(self) -> str:
|
|
99
|
+
"""Returns the URL path to mount the application to when serving multiple applications."""
|
|
100
|
+
return "/wellknownconfiguration.WellKnownService"
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class WellKnownServiceClientSync(ConnectClientSync):
|
|
104
|
+
def get_well_known_configuration(
|
|
105
|
+
self,
|
|
106
|
+
request: wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationRequest,
|
|
107
|
+
*,
|
|
108
|
+
headers: Headers | Mapping[str, str] | None = None,
|
|
109
|
+
timeout_ms: int | None = None,
|
|
110
|
+
use_get: bool = False,
|
|
111
|
+
) -> wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationResponse:
|
|
112
|
+
return self.execute_unary(
|
|
113
|
+
request=request,
|
|
114
|
+
method=MethodInfo(
|
|
115
|
+
name="GetWellKnownConfiguration",
|
|
116
|
+
service_name="wellknownconfiguration.WellKnownService",
|
|
117
|
+
input=wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationRequest,
|
|
118
|
+
output=wellknownconfiguration_dot_wellknown__configuration__pb2.GetWellKnownConfigurationResponse,
|
|
119
|
+
idempotency_level=IdempotencyLevel.NO_SIDE_EFFECTS,
|
|
120
|
+
),
|
|
121
|
+
headers=headers,
|
|
122
|
+
timeout_ms=timeout_ms,
|
|
123
|
+
use_get=use_get,
|
|
124
|
+
)
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
# Generated Connect client code
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
from collections.abc import AsyncIterator
|
|
5
|
-
from collections.abc import Iterator
|
|
6
|
-
from collections.abc import Iterable
|
|
7
|
-
import aiohttp
|
|
8
|
-
import urllib3
|
|
9
|
-
import typing
|
|
10
|
-
import sys
|
|
11
|
-
|
|
12
|
-
from connectrpc.client_async import AsyncConnectClient
|
|
13
|
-
from connectrpc.client_sync import ConnectClient
|
|
14
|
-
from connectrpc.client_protocol import ConnectProtocol
|
|
15
|
-
from connectrpc.client_connect import ConnectProtocolError
|
|
16
|
-
from connectrpc.headers import HeaderInput
|
|
17
|
-
from connectrpc.server import ClientRequest
|
|
18
|
-
from connectrpc.server import ClientStream
|
|
19
|
-
from connectrpc.server import ServerResponse
|
|
20
|
-
from connectrpc.server import ServerStream
|
|
21
|
-
from connectrpc.server_sync import ConnectWSGI
|
|
22
|
-
from connectrpc.streams import StreamInput
|
|
23
|
-
from connectrpc.streams import AsyncStreamOutput
|
|
24
|
-
from connectrpc.streams import StreamOutput
|
|
25
|
-
from connectrpc.unary import UnaryOutput
|
|
26
|
-
from connectrpc.unary import ClientStreamingOutput
|
|
27
|
-
|
|
28
|
-
if typing.TYPE_CHECKING:
|
|
29
|
-
# wsgiref.types was added in Python 3.11.
|
|
30
|
-
if sys.version_info >= (3, 11):
|
|
31
|
-
from wsgiref.types import WSGIApplication
|
|
32
|
-
else:
|
|
33
|
-
from _typeshed.wsgi import WSGIApplication
|
|
34
|
-
|
|
35
|
-
import authorization.authorization_pb2
|
|
36
|
-
|
|
37
|
-
class AuthorizationServiceClient:
|
|
38
|
-
def __init__(
|
|
39
|
-
self,
|
|
40
|
-
base_url: str,
|
|
41
|
-
http_client: urllib3.PoolManager | None = None,
|
|
42
|
-
protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
|
|
43
|
-
):
|
|
44
|
-
self.base_url = base_url
|
|
45
|
-
self._connect_client = ConnectClient(http_client, protocol)
|
|
46
|
-
def call_get_decisions(
|
|
47
|
-
self, req: authorization.authorization_pb2.GetDecisionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
48
|
-
) -> UnaryOutput[authorization.authorization_pb2.GetDecisionsResponse]:
|
|
49
|
-
"""Low-level method to call GetDecisions, granting access to errors and metadata"""
|
|
50
|
-
url = self.base_url + "/authorization.AuthorizationService/GetDecisions"
|
|
51
|
-
return self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetDecisionsResponse,extra_headers, timeout_seconds)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def get_decisions(
|
|
55
|
-
self, req: authorization.authorization_pb2.GetDecisionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
56
|
-
) -> authorization.authorization_pb2.GetDecisionsResponse:
|
|
57
|
-
response = self.call_get_decisions(req, extra_headers, timeout_seconds)
|
|
58
|
-
err = response.error()
|
|
59
|
-
if err is not None:
|
|
60
|
-
raise err
|
|
61
|
-
msg = response.message()
|
|
62
|
-
if msg is None:
|
|
63
|
-
raise ConnectProtocolError('missing response message')
|
|
64
|
-
return msg
|
|
65
|
-
|
|
66
|
-
def call_get_decisions_by_token(
|
|
67
|
-
self, req: authorization.authorization_pb2.GetDecisionsByTokenRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
68
|
-
) -> UnaryOutput[authorization.authorization_pb2.GetDecisionsByTokenResponse]:
|
|
69
|
-
"""Low-level method to call GetDecisionsByToken, granting access to errors and metadata"""
|
|
70
|
-
url = self.base_url + "/authorization.AuthorizationService/GetDecisionsByToken"
|
|
71
|
-
return self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetDecisionsByTokenResponse,extra_headers, timeout_seconds)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def get_decisions_by_token(
|
|
75
|
-
self, req: authorization.authorization_pb2.GetDecisionsByTokenRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
76
|
-
) -> authorization.authorization_pb2.GetDecisionsByTokenResponse:
|
|
77
|
-
response = self.call_get_decisions_by_token(req, extra_headers, timeout_seconds)
|
|
78
|
-
err = response.error()
|
|
79
|
-
if err is not None:
|
|
80
|
-
raise err
|
|
81
|
-
msg = response.message()
|
|
82
|
-
if msg is None:
|
|
83
|
-
raise ConnectProtocolError('missing response message')
|
|
84
|
-
return msg
|
|
85
|
-
|
|
86
|
-
def call_get_entitlements(
|
|
87
|
-
self, req: authorization.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
88
|
-
) -> UnaryOutput[authorization.authorization_pb2.GetEntitlementsResponse]:
|
|
89
|
-
"""Low-level method to call GetEntitlements, granting access to errors and metadata"""
|
|
90
|
-
url = self.base_url + "/authorization.AuthorizationService/GetEntitlements"
|
|
91
|
-
return self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetEntitlementsResponse,extra_headers, timeout_seconds)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def get_entitlements(
|
|
95
|
-
self, req: authorization.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
96
|
-
) -> authorization.authorization_pb2.GetEntitlementsResponse:
|
|
97
|
-
response = self.call_get_entitlements(req, extra_headers, timeout_seconds)
|
|
98
|
-
err = response.error()
|
|
99
|
-
if err is not None:
|
|
100
|
-
raise err
|
|
101
|
-
msg = response.message()
|
|
102
|
-
if msg is None:
|
|
103
|
-
raise ConnectProtocolError('missing response message')
|
|
104
|
-
return msg
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
class AsyncAuthorizationServiceClient:
|
|
108
|
-
def __init__(
|
|
109
|
-
self,
|
|
110
|
-
base_url: str,
|
|
111
|
-
http_client: aiohttp.ClientSession,
|
|
112
|
-
protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
|
|
113
|
-
):
|
|
114
|
-
self.base_url = base_url
|
|
115
|
-
self._connect_client = AsyncConnectClient(http_client, protocol)
|
|
116
|
-
|
|
117
|
-
async def call_get_decisions(
|
|
118
|
-
self, req: authorization.authorization_pb2.GetDecisionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
119
|
-
) -> UnaryOutput[authorization.authorization_pb2.GetDecisionsResponse]:
|
|
120
|
-
"""Low-level method to call GetDecisions, granting access to errors and metadata"""
|
|
121
|
-
url = self.base_url + "/authorization.AuthorizationService/GetDecisions"
|
|
122
|
-
return await self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetDecisionsResponse,extra_headers, timeout_seconds)
|
|
123
|
-
|
|
124
|
-
async def get_decisions(
|
|
125
|
-
self, req: authorization.authorization_pb2.GetDecisionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
126
|
-
) -> authorization.authorization_pb2.GetDecisionsResponse:
|
|
127
|
-
response = await self.call_get_decisions(req, extra_headers, timeout_seconds)
|
|
128
|
-
err = response.error()
|
|
129
|
-
if err is not None:
|
|
130
|
-
raise err
|
|
131
|
-
msg = response.message()
|
|
132
|
-
if msg is None:
|
|
133
|
-
raise ConnectProtocolError('missing response message')
|
|
134
|
-
return msg
|
|
135
|
-
|
|
136
|
-
async def call_get_decisions_by_token(
|
|
137
|
-
self, req: authorization.authorization_pb2.GetDecisionsByTokenRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
138
|
-
) -> UnaryOutput[authorization.authorization_pb2.GetDecisionsByTokenResponse]:
|
|
139
|
-
"""Low-level method to call GetDecisionsByToken, granting access to errors and metadata"""
|
|
140
|
-
url = self.base_url + "/authorization.AuthorizationService/GetDecisionsByToken"
|
|
141
|
-
return await self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetDecisionsByTokenResponse,extra_headers, timeout_seconds)
|
|
142
|
-
|
|
143
|
-
async def get_decisions_by_token(
|
|
144
|
-
self, req: authorization.authorization_pb2.GetDecisionsByTokenRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
145
|
-
) -> authorization.authorization_pb2.GetDecisionsByTokenResponse:
|
|
146
|
-
response = await self.call_get_decisions_by_token(req, extra_headers, timeout_seconds)
|
|
147
|
-
err = response.error()
|
|
148
|
-
if err is not None:
|
|
149
|
-
raise err
|
|
150
|
-
msg = response.message()
|
|
151
|
-
if msg is None:
|
|
152
|
-
raise ConnectProtocolError('missing response message')
|
|
153
|
-
return msg
|
|
154
|
-
|
|
155
|
-
async def call_get_entitlements(
|
|
156
|
-
self, req: authorization.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
157
|
-
) -> UnaryOutput[authorization.authorization_pb2.GetEntitlementsResponse]:
|
|
158
|
-
"""Low-level method to call GetEntitlements, granting access to errors and metadata"""
|
|
159
|
-
url = self.base_url + "/authorization.AuthorizationService/GetEntitlements"
|
|
160
|
-
return await self._connect_client.call_unary(url, req, authorization.authorization_pb2.GetEntitlementsResponse,extra_headers, timeout_seconds)
|
|
161
|
-
|
|
162
|
-
async def get_entitlements(
|
|
163
|
-
self, req: authorization.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
164
|
-
) -> authorization.authorization_pb2.GetEntitlementsResponse:
|
|
165
|
-
response = await self.call_get_entitlements(req, extra_headers, timeout_seconds)
|
|
166
|
-
err = response.error()
|
|
167
|
-
if err is not None:
|
|
168
|
-
raise err
|
|
169
|
-
msg = response.message()
|
|
170
|
-
if msg is None:
|
|
171
|
-
raise ConnectProtocolError('missing response message')
|
|
172
|
-
return msg
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
@typing.runtime_checkable
|
|
176
|
-
class AuthorizationServiceProtocol(typing.Protocol):
|
|
177
|
-
def get_decisions(self, req: ClientRequest[authorization.authorization_pb2.GetDecisionsRequest]) -> ServerResponse[authorization.authorization_pb2.GetDecisionsResponse]:
|
|
178
|
-
...
|
|
179
|
-
def get_decisions_by_token(self, req: ClientRequest[authorization.authorization_pb2.GetDecisionsByTokenRequest]) -> ServerResponse[authorization.authorization_pb2.GetDecisionsByTokenResponse]:
|
|
180
|
-
...
|
|
181
|
-
def get_entitlements(self, req: ClientRequest[authorization.authorization_pb2.GetEntitlementsRequest]) -> ServerResponse[authorization.authorization_pb2.GetEntitlementsResponse]:
|
|
182
|
-
...
|
|
183
|
-
|
|
184
|
-
AUTHORIZATION_SERVICE_PATH_PREFIX = "/authorization.AuthorizationService"
|
|
185
|
-
|
|
186
|
-
def wsgi_authorization_service(implementation: AuthorizationServiceProtocol) -> WSGIApplication:
|
|
187
|
-
app = ConnectWSGI()
|
|
188
|
-
app.register_unary_rpc("/authorization.AuthorizationService/GetDecisions", implementation.get_decisions, authorization.authorization_pb2.GetDecisionsRequest)
|
|
189
|
-
app.register_unary_rpc("/authorization.AuthorizationService/GetDecisionsByToken", implementation.get_decisions_by_token, authorization.authorization_pb2.GetDecisionsByTokenRequest)
|
|
190
|
-
app.register_unary_rpc("/authorization.AuthorizationService/GetEntitlements", implementation.get_entitlements, authorization.authorization_pb2.GetEntitlementsRequest)
|
|
191
|
-
return app
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
# Generated Connect client code
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
from collections.abc import AsyncIterator
|
|
5
|
-
from collections.abc import Iterator
|
|
6
|
-
from collections.abc import Iterable
|
|
7
|
-
import aiohttp
|
|
8
|
-
import urllib3
|
|
9
|
-
import typing
|
|
10
|
-
import sys
|
|
11
|
-
|
|
12
|
-
from connectrpc.client_async import AsyncConnectClient
|
|
13
|
-
from connectrpc.client_sync import ConnectClient
|
|
14
|
-
from connectrpc.client_protocol import ConnectProtocol
|
|
15
|
-
from connectrpc.client_connect import ConnectProtocolError
|
|
16
|
-
from connectrpc.headers import HeaderInput
|
|
17
|
-
from connectrpc.server import ClientRequest
|
|
18
|
-
from connectrpc.server import ClientStream
|
|
19
|
-
from connectrpc.server import ServerResponse
|
|
20
|
-
from connectrpc.server import ServerStream
|
|
21
|
-
from connectrpc.server_sync import ConnectWSGI
|
|
22
|
-
from connectrpc.streams import StreamInput
|
|
23
|
-
from connectrpc.streams import AsyncStreamOutput
|
|
24
|
-
from connectrpc.streams import StreamOutput
|
|
25
|
-
from connectrpc.unary import UnaryOutput
|
|
26
|
-
from connectrpc.unary import ClientStreamingOutput
|
|
27
|
-
|
|
28
|
-
if typing.TYPE_CHECKING:
|
|
29
|
-
# wsgiref.types was added in Python 3.11.
|
|
30
|
-
if sys.version_info >= (3, 11):
|
|
31
|
-
from wsgiref.types import WSGIApplication
|
|
32
|
-
else:
|
|
33
|
-
from _typeshed.wsgi import WSGIApplication
|
|
34
|
-
|
|
35
|
-
import authorization.v2.authorization_pb2
|
|
36
|
-
|
|
37
|
-
class AuthorizationServiceClient:
|
|
38
|
-
def __init__(
|
|
39
|
-
self,
|
|
40
|
-
base_url: str,
|
|
41
|
-
http_client: urllib3.PoolManager | None = None,
|
|
42
|
-
protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
|
|
43
|
-
):
|
|
44
|
-
self.base_url = base_url
|
|
45
|
-
self._connect_client = ConnectClient(http_client, protocol)
|
|
46
|
-
def call_get_decision(
|
|
47
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
48
|
-
) -> UnaryOutput[authorization.v2.authorization_pb2.GetDecisionResponse]:
|
|
49
|
-
"""Low-level method to call GetDecision, granting access to errors and metadata"""
|
|
50
|
-
url = self.base_url + "/authorization.v2.AuthorizationService/GetDecision"
|
|
51
|
-
return self._connect_client.call_unary(url, req, authorization.v2.authorization_pb2.GetDecisionResponse,extra_headers, timeout_seconds)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def get_decision(
|
|
55
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
56
|
-
) -> authorization.v2.authorization_pb2.GetDecisionResponse:
|
|
57
|
-
response = self.call_get_decision(req, extra_headers, timeout_seconds)
|
|
58
|
-
err = response.error()
|
|
59
|
-
if err is not None:
|
|
60
|
-
raise err
|
|
61
|
-
msg = response.message()
|
|
62
|
-
if msg is None:
|
|
63
|
-
raise ConnectProtocolError('missing response message')
|
|
64
|
-
return msg
|
|
65
|
-
|
|
66
|
-
def call_get_decision_multi_resource(
|
|
67
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionMultiResourceRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
68
|
-
) -> UnaryOutput[authorization.v2.authorization_pb2.GetDecisionMultiResourceResponse]:
|
|
69
|
-
"""Low-level method to call GetDecisionMultiResource, granting access to errors and metadata"""
|
|
70
|
-
url = self.base_url + "/authorization.v2.AuthorizationService/GetDecisionMultiResource"
|
|
71
|
-
return self._connect_client.call_unary(url, req, authorization.v2.authorization_pb2.GetDecisionMultiResourceResponse,extra_headers, timeout_seconds)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def get_decision_multi_resource(
|
|
75
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionMultiResourceRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
76
|
-
) -> authorization.v2.authorization_pb2.GetDecisionMultiResourceResponse:
|
|
77
|
-
response = self.call_get_decision_multi_resource(req, extra_headers, timeout_seconds)
|
|
78
|
-
err = response.error()
|
|
79
|
-
if err is not None:
|
|
80
|
-
raise err
|
|
81
|
-
msg = response.message()
|
|
82
|
-
if msg is None:
|
|
83
|
-
raise ConnectProtocolError('missing response message')
|
|
84
|
-
return msg
|
|
85
|
-
|
|
86
|
-
def call_get_decision_bulk(
|
|
87
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionBulkRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
88
|
-
) -> UnaryOutput[authorization.v2.authorization_pb2.GetDecisionBulkResponse]:
|
|
89
|
-
"""Low-level method to call GetDecisionBulk, granting access to errors and metadata"""
|
|
90
|
-
url = self.base_url + "/authorization.v2.AuthorizationService/GetDecisionBulk"
|
|
91
|
-
return self._connect_client.call_unary(url, req, authorization.v2.authorization_pb2.GetDecisionBulkResponse,extra_headers, timeout_seconds)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def get_decision_bulk(
|
|
95
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionBulkRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
96
|
-
) -> authorization.v2.authorization_pb2.GetDecisionBulkResponse:
|
|
97
|
-
response = self.call_get_decision_bulk(req, extra_headers, timeout_seconds)
|
|
98
|
-
err = response.error()
|
|
99
|
-
if err is not None:
|
|
100
|
-
raise err
|
|
101
|
-
msg = response.message()
|
|
102
|
-
if msg is None:
|
|
103
|
-
raise ConnectProtocolError('missing response message')
|
|
104
|
-
return msg
|
|
105
|
-
|
|
106
|
-
def call_get_entitlements(
|
|
107
|
-
self, req: authorization.v2.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
108
|
-
) -> UnaryOutput[authorization.v2.authorization_pb2.GetEntitlementsResponse]:
|
|
109
|
-
"""Low-level method to call GetEntitlements, granting access to errors and metadata"""
|
|
110
|
-
url = self.base_url + "/authorization.v2.AuthorizationService/GetEntitlements"
|
|
111
|
-
return self._connect_client.call_unary(url, req, authorization.v2.authorization_pb2.GetEntitlementsResponse,extra_headers, timeout_seconds)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def get_entitlements(
|
|
115
|
-
self, req: authorization.v2.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
116
|
-
) -> authorization.v2.authorization_pb2.GetEntitlementsResponse:
|
|
117
|
-
response = self.call_get_entitlements(req, extra_headers, timeout_seconds)
|
|
118
|
-
err = response.error()
|
|
119
|
-
if err is not None:
|
|
120
|
-
raise err
|
|
121
|
-
msg = response.message()
|
|
122
|
-
if msg is None:
|
|
123
|
-
raise ConnectProtocolError('missing response message')
|
|
124
|
-
return msg
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
class AsyncAuthorizationServiceClient:
|
|
128
|
-
def __init__(
|
|
129
|
-
self,
|
|
130
|
-
base_url: str,
|
|
131
|
-
http_client: aiohttp.ClientSession,
|
|
132
|
-
protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
|
|
133
|
-
):
|
|
134
|
-
self.base_url = base_url
|
|
135
|
-
self._connect_client = AsyncConnectClient(http_client, protocol)
|
|
136
|
-
|
|
137
|
-
async def call_get_decision(
|
|
138
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
139
|
-
) -> UnaryOutput[authorization.v2.authorization_pb2.GetDecisionResponse]:
|
|
140
|
-
"""Low-level method to call GetDecision, granting access to errors and metadata"""
|
|
141
|
-
url = self.base_url + "/authorization.v2.AuthorizationService/GetDecision"
|
|
142
|
-
return await self._connect_client.call_unary(url, req, authorization.v2.authorization_pb2.GetDecisionResponse,extra_headers, timeout_seconds)
|
|
143
|
-
|
|
144
|
-
async def get_decision(
|
|
145
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
146
|
-
) -> authorization.v2.authorization_pb2.GetDecisionResponse:
|
|
147
|
-
response = await self.call_get_decision(req, extra_headers, timeout_seconds)
|
|
148
|
-
err = response.error()
|
|
149
|
-
if err is not None:
|
|
150
|
-
raise err
|
|
151
|
-
msg = response.message()
|
|
152
|
-
if msg is None:
|
|
153
|
-
raise ConnectProtocolError('missing response message')
|
|
154
|
-
return msg
|
|
155
|
-
|
|
156
|
-
async def call_get_decision_multi_resource(
|
|
157
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionMultiResourceRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
158
|
-
) -> UnaryOutput[authorization.v2.authorization_pb2.GetDecisionMultiResourceResponse]:
|
|
159
|
-
"""Low-level method to call GetDecisionMultiResource, granting access to errors and metadata"""
|
|
160
|
-
url = self.base_url + "/authorization.v2.AuthorizationService/GetDecisionMultiResource"
|
|
161
|
-
return await self._connect_client.call_unary(url, req, authorization.v2.authorization_pb2.GetDecisionMultiResourceResponse,extra_headers, timeout_seconds)
|
|
162
|
-
|
|
163
|
-
async def get_decision_multi_resource(
|
|
164
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionMultiResourceRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
165
|
-
) -> authorization.v2.authorization_pb2.GetDecisionMultiResourceResponse:
|
|
166
|
-
response = await self.call_get_decision_multi_resource(req, extra_headers, timeout_seconds)
|
|
167
|
-
err = response.error()
|
|
168
|
-
if err is not None:
|
|
169
|
-
raise err
|
|
170
|
-
msg = response.message()
|
|
171
|
-
if msg is None:
|
|
172
|
-
raise ConnectProtocolError('missing response message')
|
|
173
|
-
return msg
|
|
174
|
-
|
|
175
|
-
async def call_get_decision_bulk(
|
|
176
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionBulkRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
177
|
-
) -> UnaryOutput[authorization.v2.authorization_pb2.GetDecisionBulkResponse]:
|
|
178
|
-
"""Low-level method to call GetDecisionBulk, granting access to errors and metadata"""
|
|
179
|
-
url = self.base_url + "/authorization.v2.AuthorizationService/GetDecisionBulk"
|
|
180
|
-
return await self._connect_client.call_unary(url, req, authorization.v2.authorization_pb2.GetDecisionBulkResponse,extra_headers, timeout_seconds)
|
|
181
|
-
|
|
182
|
-
async def get_decision_bulk(
|
|
183
|
-
self, req: authorization.v2.authorization_pb2.GetDecisionBulkRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
184
|
-
) -> authorization.v2.authorization_pb2.GetDecisionBulkResponse:
|
|
185
|
-
response = await self.call_get_decision_bulk(req, extra_headers, timeout_seconds)
|
|
186
|
-
err = response.error()
|
|
187
|
-
if err is not None:
|
|
188
|
-
raise err
|
|
189
|
-
msg = response.message()
|
|
190
|
-
if msg is None:
|
|
191
|
-
raise ConnectProtocolError('missing response message')
|
|
192
|
-
return msg
|
|
193
|
-
|
|
194
|
-
async def call_get_entitlements(
|
|
195
|
-
self, req: authorization.v2.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
196
|
-
) -> UnaryOutput[authorization.v2.authorization_pb2.GetEntitlementsResponse]:
|
|
197
|
-
"""Low-level method to call GetEntitlements, granting access to errors and metadata"""
|
|
198
|
-
url = self.base_url + "/authorization.v2.AuthorizationService/GetEntitlements"
|
|
199
|
-
return await self._connect_client.call_unary(url, req, authorization.v2.authorization_pb2.GetEntitlementsResponse,extra_headers, timeout_seconds)
|
|
200
|
-
|
|
201
|
-
async def get_entitlements(
|
|
202
|
-
self, req: authorization.v2.authorization_pb2.GetEntitlementsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
|
|
203
|
-
) -> authorization.v2.authorization_pb2.GetEntitlementsResponse:
|
|
204
|
-
response = await self.call_get_entitlements(req, extra_headers, timeout_seconds)
|
|
205
|
-
err = response.error()
|
|
206
|
-
if err is not None:
|
|
207
|
-
raise err
|
|
208
|
-
msg = response.message()
|
|
209
|
-
if msg is None:
|
|
210
|
-
raise ConnectProtocolError('missing response message')
|
|
211
|
-
return msg
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
@typing.runtime_checkable
|
|
215
|
-
class AuthorizationServiceProtocol(typing.Protocol):
|
|
216
|
-
def get_decision(self, req: ClientRequest[authorization.v2.authorization_pb2.GetDecisionRequest]) -> ServerResponse[authorization.v2.authorization_pb2.GetDecisionResponse]:
|
|
217
|
-
...
|
|
218
|
-
def get_decision_multi_resource(self, req: ClientRequest[authorization.v2.authorization_pb2.GetDecisionMultiResourceRequest]) -> ServerResponse[authorization.v2.authorization_pb2.GetDecisionMultiResourceResponse]:
|
|
219
|
-
...
|
|
220
|
-
def get_decision_bulk(self, req: ClientRequest[authorization.v2.authorization_pb2.GetDecisionBulkRequest]) -> ServerResponse[authorization.v2.authorization_pb2.GetDecisionBulkResponse]:
|
|
221
|
-
...
|
|
222
|
-
def get_entitlements(self, req: ClientRequest[authorization.v2.authorization_pb2.GetEntitlementsRequest]) -> ServerResponse[authorization.v2.authorization_pb2.GetEntitlementsResponse]:
|
|
223
|
-
...
|
|
224
|
-
|
|
225
|
-
AUTHORIZATION_SERVICE_PATH_PREFIX = "/authorization.v2.AuthorizationService"
|
|
226
|
-
|
|
227
|
-
def wsgi_authorization_service(implementation: AuthorizationServiceProtocol) -> WSGIApplication:
|
|
228
|
-
app = ConnectWSGI()
|
|
229
|
-
app.register_unary_rpc("/authorization.v2.AuthorizationService/GetDecision", implementation.get_decision, authorization.v2.authorization_pb2.GetDecisionRequest)
|
|
230
|
-
app.register_unary_rpc("/authorization.v2.AuthorizationService/GetDecisionMultiResource", implementation.get_decision_multi_resource, authorization.v2.authorization_pb2.GetDecisionMultiResourceRequest)
|
|
231
|
-
app.register_unary_rpc("/authorization.v2.AuthorizationService/GetDecisionBulk", implementation.get_decision_bulk, authorization.v2.authorization_pb2.GetDecisionBulkRequest)
|
|
232
|
-
app.register_unary_rpc("/authorization.v2.AuthorizationService/GetEntitlements", implementation.get_entitlements, authorization.v2.authorization_pb2.GetEntitlementsRequest)
|
|
233
|
-
return app
|