otdf-python 0.1.10__py3-none-any.whl → 0.3.5__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.
Files changed (144) hide show
  1. otdf_python/__init__.py +25 -0
  2. otdf_python/__main__.py +12 -0
  3. otdf_python/address_normalizer.py +84 -0
  4. otdf_python/aesgcm.py +55 -0
  5. otdf_python/assertion_config.py +84 -0
  6. otdf_python/asym_crypto.py +198 -0
  7. otdf_python/auth_headers.py +33 -0
  8. otdf_python/autoconfigure_utils.py +113 -0
  9. otdf_python/cli.py +569 -0
  10. otdf_python/collection_store.py +41 -0
  11. otdf_python/collection_store_impl.py +22 -0
  12. otdf_python/config.py +69 -0
  13. otdf_python/connect_client.py +0 -0
  14. otdf_python/constants.py +1 -0
  15. otdf_python/crypto_utils.py +78 -0
  16. otdf_python/dpop.py +81 -0
  17. otdf_python/ecc_constants.py +176 -0
  18. otdf_python/ecc_mode.py +83 -0
  19. otdf_python/ecdh.py +317 -0
  20. otdf_python/eckeypair.py +75 -0
  21. otdf_python/header.py +181 -0
  22. otdf_python/invalid_zip_exception.py +8 -0
  23. otdf_python/kas_client.py +709 -0
  24. otdf_python/kas_connect_rpc_client.py +213 -0
  25. otdf_python/kas_info.py +25 -0
  26. otdf_python/kas_key_cache.py +52 -0
  27. otdf_python/key_type.py +31 -0
  28. otdf_python/key_type_constants.py +43 -0
  29. otdf_python/manifest.py +215 -0
  30. otdf_python/nanotdf.py +863 -0
  31. otdf_python/nanotdf_ecdsa_struct.py +132 -0
  32. otdf_python/nanotdf_type.py +43 -0
  33. otdf_python/policy_binding_serializer.py +39 -0
  34. otdf_python/policy_info.py +55 -0
  35. otdf_python/policy_object.py +22 -0
  36. otdf_python/policy_stub.py +2 -0
  37. otdf_python/resource_locator.py +172 -0
  38. otdf_python/sdk.py +436 -0
  39. otdf_python/sdk_builder.py +416 -0
  40. otdf_python/sdk_exceptions.py +16 -0
  41. otdf_python/symmetric_and_payload_config.py +30 -0
  42. otdf_python/tdf.py +480 -0
  43. otdf_python/tdf_reader.py +153 -0
  44. otdf_python/tdf_writer.py +23 -0
  45. otdf_python/token_source.py +34 -0
  46. otdf_python/version.py +57 -0
  47. otdf_python/zip_reader.py +47 -0
  48. otdf_python/zip_writer.py +70 -0
  49. otdf_python-0.3.5.dist-info/METADATA +153 -0
  50. otdf_python-0.3.5.dist-info/RECORD +137 -0
  51. {otdf_python-0.1.10.dist-info → otdf_python-0.3.5.dist-info}/WHEEL +1 -2
  52. {otdf_python-0.1.10.dist-info → otdf_python-0.3.5.dist-info/licenses}/LICENSE +1 -1
  53. otdf_python_proto/__init__.py +37 -0
  54. otdf_python_proto/authorization/__init__.py +1 -0
  55. otdf_python_proto/authorization/authorization_pb2.py +80 -0
  56. otdf_python_proto/authorization/authorization_pb2.pyi +161 -0
  57. otdf_python_proto/authorization/authorization_pb2_connect.py +191 -0
  58. otdf_python_proto/authorization/v2/authorization_pb2.py +105 -0
  59. otdf_python_proto/authorization/v2/authorization_pb2.pyi +134 -0
  60. otdf_python_proto/authorization/v2/authorization_pb2_connect.py +233 -0
  61. otdf_python_proto/common/__init__.py +1 -0
  62. otdf_python_proto/common/common_pb2.py +52 -0
  63. otdf_python_proto/common/common_pb2.pyi +61 -0
  64. otdf_python_proto/entity/__init__.py +1 -0
  65. otdf_python_proto/entity/entity_pb2.py +47 -0
  66. otdf_python_proto/entity/entity_pb2.pyi +50 -0
  67. otdf_python_proto/entityresolution/__init__.py +1 -0
  68. otdf_python_proto/entityresolution/entity_resolution_pb2.py +57 -0
  69. otdf_python_proto/entityresolution/entity_resolution_pb2.pyi +55 -0
  70. otdf_python_proto/entityresolution/entity_resolution_pb2_connect.py +149 -0
  71. otdf_python_proto/entityresolution/v2/entity_resolution_pb2.py +55 -0
  72. otdf_python_proto/entityresolution/v2/entity_resolution_pb2.pyi +55 -0
  73. otdf_python_proto/entityresolution/v2/entity_resolution_pb2_connect.py +149 -0
  74. otdf_python_proto/kas/__init__.py +9 -0
  75. otdf_python_proto/kas/kas_pb2.py +103 -0
  76. otdf_python_proto/kas/kas_pb2.pyi +170 -0
  77. otdf_python_proto/kas/kas_pb2_connect.py +192 -0
  78. otdf_python_proto/legacy_grpc/__init__.py +1 -0
  79. otdf_python_proto/legacy_grpc/authorization/authorization_pb2_grpc.py +163 -0
  80. otdf_python_proto/legacy_grpc/authorization/v2/authorization_pb2_grpc.py +206 -0
  81. otdf_python_proto/legacy_grpc/common/common_pb2_grpc.py +4 -0
  82. otdf_python_proto/legacy_grpc/entity/entity_pb2_grpc.py +4 -0
  83. otdf_python_proto/legacy_grpc/entityresolution/entity_resolution_pb2_grpc.py +122 -0
  84. otdf_python_proto/legacy_grpc/entityresolution/v2/entity_resolution_pb2_grpc.py +120 -0
  85. otdf_python_proto/legacy_grpc/kas/kas_pb2_grpc.py +172 -0
  86. otdf_python_proto/legacy_grpc/logger/audit/test_pb2_grpc.py +4 -0
  87. otdf_python_proto/legacy_grpc/policy/actions/actions_pb2_grpc.py +249 -0
  88. otdf_python_proto/legacy_grpc/policy/attributes/attributes_pb2_grpc.py +873 -0
  89. otdf_python_proto/legacy_grpc/policy/kasregistry/key_access_server_registry_pb2_grpc.py +602 -0
  90. otdf_python_proto/legacy_grpc/policy/keymanagement/key_management_pb2_grpc.py +251 -0
  91. otdf_python_proto/legacy_grpc/policy/namespaces/namespaces_pb2_grpc.py +427 -0
  92. otdf_python_proto/legacy_grpc/policy/objects_pb2_grpc.py +4 -0
  93. otdf_python_proto/legacy_grpc/policy/registeredresources/registered_resources_pb2_grpc.py +524 -0
  94. otdf_python_proto/legacy_grpc/policy/resourcemapping/resource_mapping_pb2_grpc.py +516 -0
  95. otdf_python_proto/legacy_grpc/policy/selectors_pb2_grpc.py +4 -0
  96. otdf_python_proto/legacy_grpc/policy/subjectmapping/subject_mapping_pb2_grpc.py +551 -0
  97. otdf_python_proto/legacy_grpc/policy/unsafe/unsafe_pb2_grpc.py +485 -0
  98. otdf_python_proto/legacy_grpc/wellknownconfiguration/wellknown_configuration_pb2_grpc.py +77 -0
  99. otdf_python_proto/logger/__init__.py +1 -0
  100. otdf_python_proto/logger/audit/test_pb2.py +43 -0
  101. otdf_python_proto/logger/audit/test_pb2.pyi +45 -0
  102. otdf_python_proto/policy/__init__.py +1 -0
  103. otdf_python_proto/policy/actions/actions_pb2.py +75 -0
  104. otdf_python_proto/policy/actions/actions_pb2.pyi +87 -0
  105. otdf_python_proto/policy/actions/actions_pb2_connect.py +275 -0
  106. otdf_python_proto/policy/attributes/attributes_pb2.py +234 -0
  107. otdf_python_proto/policy/attributes/attributes_pb2.pyi +328 -0
  108. otdf_python_proto/policy/attributes/attributes_pb2_connect.py +863 -0
  109. otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2.py +266 -0
  110. otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2.pyi +450 -0
  111. otdf_python_proto/policy/kasregistry/key_access_server_registry_pb2_connect.py +611 -0
  112. otdf_python_proto/policy/keymanagement/key_management_pb2.py +79 -0
  113. otdf_python_proto/policy/keymanagement/key_management_pb2.pyi +87 -0
  114. otdf_python_proto/policy/keymanagement/key_management_pb2_connect.py +275 -0
  115. otdf_python_proto/policy/namespaces/namespaces_pb2.py +117 -0
  116. otdf_python_proto/policy/namespaces/namespaces_pb2.pyi +147 -0
  117. otdf_python_proto/policy/namespaces/namespaces_pb2_connect.py +443 -0
  118. otdf_python_proto/policy/objects_pb2.py +150 -0
  119. otdf_python_proto/policy/objects_pb2.pyi +464 -0
  120. otdf_python_proto/policy/registeredresources/registered_resources_pb2.py +139 -0
  121. otdf_python_proto/policy/registeredresources/registered_resources_pb2.pyi +196 -0
  122. otdf_python_proto/policy/registeredresources/registered_resources_pb2_connect.py +527 -0
  123. otdf_python_proto/policy/resourcemapping/resource_mapping_pb2.py +139 -0
  124. otdf_python_proto/policy/resourcemapping/resource_mapping_pb2.pyi +194 -0
  125. otdf_python_proto/policy/resourcemapping/resource_mapping_pb2_connect.py +527 -0
  126. otdf_python_proto/policy/selectors_pb2.py +57 -0
  127. otdf_python_proto/policy/selectors_pb2.pyi +90 -0
  128. otdf_python_proto/policy/subjectmapping/subject_mapping_pb2.py +127 -0
  129. otdf_python_proto/policy/subjectmapping/subject_mapping_pb2.pyi +189 -0
  130. otdf_python_proto/policy/subjectmapping/subject_mapping_pb2_connect.py +569 -0
  131. otdf_python_proto/policy/unsafe/unsafe_pb2.py +113 -0
  132. otdf_python_proto/policy/unsafe/unsafe_pb2.pyi +145 -0
  133. otdf_python_proto/policy/unsafe/unsafe_pb2_connect.py +485 -0
  134. otdf_python_proto/wellknownconfiguration/__init__.py +1 -0
  135. otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.py +51 -0
  136. otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2.pyi +32 -0
  137. otdf_python_proto/wellknownconfiguration/wellknown_configuration_pb2_connect.py +107 -0
  138. otdf_python/_gotdf_python.cpython-312-darwin.so +0 -0
  139. otdf_python/build.py +0 -190
  140. otdf_python/go.py +0 -1478
  141. otdf_python/gotdf_python.py +0 -383
  142. otdf_python-0.1.10.dist-info/METADATA +0 -149
  143. otdf_python-0.1.10.dist-info/RECORD +0 -10
  144. otdf_python-0.1.10.dist-info/top_level.txt +0 -1
@@ -0,0 +1,75 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: policy/actions/actions.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'policy/actions/actions.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from buf.validate import validate_pb2 as buf_dot_validate_dot_validate__pb2
26
+ from common import common_pb2 as common_dot_common__pb2
27
+ from policy import objects_pb2 as policy_dot_objects__pb2
28
+ from policy import selectors_pb2 as policy_dot_selectors__pb2
29
+
30
+
31
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cpolicy/actions/actions.proto\x12\x0epolicy.actions\x1a\x1b\x62uf/validate/validate.proto\x1a\x13\x63ommon/common.proto\x1a\x14policy/objects.proto\x1a\x16policy/selectors.proto\"\xeb\x02\n\x10GetActionRequest\x12\x1a\n\x02id\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01H\x00R\x02id\x12\xa5\x02\n\x04name\x18\x02 \x01(\tB\x8e\x02\xbaH\x8a\x02r\x03\x18\xfd\x01\xba\x01\x81\x02\n\x12\x61\x63tion_name_format\x12\xad\x01\x41\x63tion name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored action name will be normalized to lower case.\x1a;this.matches(\'^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$\')H\x00R\x04nameB\x13\n\nidentifier\x12\x05\xbaH\x02\x08\x01\"~\n\x11GetActionResponse\x12&\n\x06\x61\x63tion\x18\x01 \x01(\x0b\x32\x0e.policy.ActionR\x06\x61\x63tion\x12\x41\n\x10subject_mappings\x18\x02 \x03(\x0b\x32\x16.policy.SubjectMappingR\x0fsubjectMappings\"I\n\x12ListActionsRequest\x12\x33\n\npagination\x18\n \x01(\x0b\x32\x13.policy.PageRequestR\npagination\"\xbd\x01\n\x13ListActionsResponse\x12\x39\n\x10\x61\x63tions_standard\x18\x01 \x03(\x0b\x32\x0e.policy.ActionR\x0f\x61\x63tionsStandard\x12\x35\n\x0e\x61\x63tions_custom\x18\x02 \x03(\x0b\x32\x0e.policy.ActionR\ractionsCustom\x12\x34\n\npagination\x18\n \x01(\x0b\x32\x14.policy.PageResponseR\npagination\"\xf3\x02\n\x13\x43reateActionRequest\x12\xa6\x02\n\x04name\x18\x01 \x01(\tB\x91\x02\xbaH\x8d\x02r\x03\x18\xfd\x01\xba\x01\x81\x02\n\x12\x61\x63tion_name_format\x12\xad\x01\x41\x63tion name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored action name will be normalized to lower case.\x1a;this.matches(\'^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$\')\xc8\x01\x01R\x04name\x12\x33\n\x08metadata\x18\x64 \x01(\x0b\x32\x17.common.MetadataMutableR\x08metadata\">\n\x14\x43reateActionResponse\x12&\n\x06\x61\x63tion\x18\x01 \x01(\x0b\x32\x0e.policy.ActionR\x06\x61\x63tion\"\xf3\x03\n\x13UpdateActionRequest\x12\x18\n\x02id\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x02id\x12\xb6\x02\n\x04name\x18\x02 \x01(\tB\xa1\x02\xbaH\x9d\x02r\x03\x18\xfd\x01\xba\x01\x94\x02\n\x12\x61\x63tion_name_format\x12\xad\x01\x41\x63tion name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored action name will be normalized to lower case.\x1aNsize(this) == 0 || this.matches(\'^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$\')R\x04name\x12\x33\n\x08metadata\x18\x64 \x01(\x0b\x32\x17.common.MetadataMutableR\x08metadata\x12T\n\x18metadata_update_behavior\x18\x65 \x01(\x0e\x32\x1a.common.MetadataUpdateEnumR\x16metadataUpdateBehavior\">\n\x14UpdateActionResponse\x12&\n\x06\x61\x63tion\x18\x01 \x01(\x0b\x32\x0e.policy.ActionR\x06\x61\x63tion\"/\n\x13\x44\x65leteActionRequest\x12\x18\n\x02id\x18\x01 \x01(\tB\x08\xbaH\x05r\x03\xb0\x01\x01R\x02id\">\n\x14\x44\x65leteActionResponse\x12&\n\x06\x61\x63tion\x18\x01 \x01(\x0b\x32\x0e.policy.ActionR\x06\x61\x63tion2\xd4\x03\n\rActionService\x12R\n\tGetAction\x12 .policy.actions.GetActionRequest\x1a!.policy.actions.GetActionResponse\"\x00\x12X\n\x0bListActions\x12\".policy.actions.ListActionsRequest\x1a#.policy.actions.ListActionsResponse\"\x00\x12[\n\x0c\x43reateAction\x12#.policy.actions.CreateActionRequest\x1a$.policy.actions.CreateActionResponse\"\x00\x12[\n\x0cUpdateAction\x12#.policy.actions.UpdateActionRequest\x1a$.policy.actions.UpdateActionResponse\"\x00\x12[\n\x0c\x44\x65leteAction\x12#.policy.actions.DeleteActionRequest\x1a$.policy.actions.DeleteActionResponse\"\x00\x42{\n\x12\x63om.policy.actionsB\x0c\x41\x63tionsProtoP\x01\xa2\x02\x03PAX\xaa\x02\x0ePolicy.Actions\xca\x02\x0ePolicy\\Actions\xe2\x02\x1aPolicy\\Actions\\GPBMetadata\xea\x02\x0fPolicy::Actionsb\x06proto3')
32
+
33
+ _globals = globals()
34
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
35
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'policy.actions.actions_pb2', _globals)
36
+ if not _descriptor._USE_C_DESCRIPTORS:
37
+ _globals['DESCRIPTOR']._loaded_options = None
38
+ _globals['DESCRIPTOR']._serialized_options = b'\n\022com.policy.actionsB\014ActionsProtoP\001\242\002\003PAX\252\002\016Policy.Actions\312\002\016Policy\\Actions\342\002\032Policy\\Actions\\GPBMetadata\352\002\017Policy::Actions'
39
+ _globals['_GETACTIONREQUEST'].oneofs_by_name['identifier']._loaded_options = None
40
+ _globals['_GETACTIONREQUEST'].oneofs_by_name['identifier']._serialized_options = b'\272H\002\010\001'
41
+ _globals['_GETACTIONREQUEST'].fields_by_name['id']._loaded_options = None
42
+ _globals['_GETACTIONREQUEST'].fields_by_name['id']._serialized_options = b'\272H\005r\003\260\001\001'
43
+ _globals['_GETACTIONREQUEST'].fields_by_name['name']._loaded_options = None
44
+ _globals['_GETACTIONREQUEST'].fields_by_name['name']._serialized_options = b'\272H\212\002r\003\030\375\001\272\001\201\002\n\022action_name_format\022\255\001Action name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored action name will be normalized to lower case.\032;this.matches(\'^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$\')'
45
+ _globals['_CREATEACTIONREQUEST'].fields_by_name['name']._loaded_options = None
46
+ _globals['_CREATEACTIONREQUEST'].fields_by_name['name']._serialized_options = b'\272H\215\002r\003\030\375\001\272\001\201\002\n\022action_name_format\022\255\001Action name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored action name will be normalized to lower case.\032;this.matches(\'^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$\')\310\001\001'
47
+ _globals['_UPDATEACTIONREQUEST'].fields_by_name['id']._loaded_options = None
48
+ _globals['_UPDATEACTIONREQUEST'].fields_by_name['id']._serialized_options = b'\272H\005r\003\260\001\001'
49
+ _globals['_UPDATEACTIONREQUEST'].fields_by_name['name']._loaded_options = None
50
+ _globals['_UPDATEACTIONREQUEST'].fields_by_name['name']._serialized_options = b'\272H\235\002r\003\030\375\001\272\001\224\002\n\022action_name_format\022\255\001Action name must be an alphanumeric string, allowing hyphens and underscores but not as the first or last character. The stored action name will be normalized to lower case.\032Nsize(this) == 0 || this.matches(\'^[a-zA-Z0-9](?:[a-zA-Z0-9_-]*[a-zA-Z0-9])?$\')'
51
+ _globals['_DELETEACTIONREQUEST'].fields_by_name['id']._loaded_options = None
52
+ _globals['_DELETEACTIONREQUEST'].fields_by_name['id']._serialized_options = b'\272H\005r\003\260\001\001'
53
+ _globals['_GETACTIONREQUEST']._serialized_start=145
54
+ _globals['_GETACTIONREQUEST']._serialized_end=508
55
+ _globals['_GETACTIONRESPONSE']._serialized_start=510
56
+ _globals['_GETACTIONRESPONSE']._serialized_end=636
57
+ _globals['_LISTACTIONSREQUEST']._serialized_start=638
58
+ _globals['_LISTACTIONSREQUEST']._serialized_end=711
59
+ _globals['_LISTACTIONSRESPONSE']._serialized_start=714
60
+ _globals['_LISTACTIONSRESPONSE']._serialized_end=903
61
+ _globals['_CREATEACTIONREQUEST']._serialized_start=906
62
+ _globals['_CREATEACTIONREQUEST']._serialized_end=1277
63
+ _globals['_CREATEACTIONRESPONSE']._serialized_start=1279
64
+ _globals['_CREATEACTIONRESPONSE']._serialized_end=1341
65
+ _globals['_UPDATEACTIONREQUEST']._serialized_start=1344
66
+ _globals['_UPDATEACTIONREQUEST']._serialized_end=1843
67
+ _globals['_UPDATEACTIONRESPONSE']._serialized_start=1845
68
+ _globals['_UPDATEACTIONRESPONSE']._serialized_end=1907
69
+ _globals['_DELETEACTIONREQUEST']._serialized_start=1909
70
+ _globals['_DELETEACTIONREQUEST']._serialized_end=1956
71
+ _globals['_DELETEACTIONRESPONSE']._serialized_start=1958
72
+ _globals['_DELETEACTIONRESPONSE']._serialized_end=2020
73
+ _globals['_ACTIONSERVICE']._serialized_start=2023
74
+ _globals['_ACTIONSERVICE']._serialized_end=2491
75
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,87 @@
1
+ from buf.validate import validate_pb2 as _validate_pb2
2
+ from common import common_pb2 as _common_pb2
3
+ from policy import objects_pb2 as _objects_pb2
4
+ from policy import selectors_pb2 as _selectors_pb2
5
+ from google.protobuf.internal import containers as _containers
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import message as _message
8
+ from collections.abc import Iterable as _Iterable, Mapping as _Mapping
9
+ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
10
+
11
+ DESCRIPTOR: _descriptor.FileDescriptor
12
+
13
+ class GetActionRequest(_message.Message):
14
+ __slots__ = ("id", "name")
15
+ ID_FIELD_NUMBER: _ClassVar[int]
16
+ NAME_FIELD_NUMBER: _ClassVar[int]
17
+ id: str
18
+ name: str
19
+ def __init__(self, id: _Optional[str] = ..., name: _Optional[str] = ...) -> None: ...
20
+
21
+ class GetActionResponse(_message.Message):
22
+ __slots__ = ("action", "subject_mappings")
23
+ ACTION_FIELD_NUMBER: _ClassVar[int]
24
+ SUBJECT_MAPPINGS_FIELD_NUMBER: _ClassVar[int]
25
+ action: _objects_pb2.Action
26
+ subject_mappings: _containers.RepeatedCompositeFieldContainer[_objects_pb2.SubjectMapping]
27
+ def __init__(self, action: _Optional[_Union[_objects_pb2.Action, _Mapping]] = ..., subject_mappings: _Optional[_Iterable[_Union[_objects_pb2.SubjectMapping, _Mapping]]] = ...) -> None: ...
28
+
29
+ class ListActionsRequest(_message.Message):
30
+ __slots__ = ("pagination",)
31
+ PAGINATION_FIELD_NUMBER: _ClassVar[int]
32
+ pagination: _selectors_pb2.PageRequest
33
+ def __init__(self, pagination: _Optional[_Union[_selectors_pb2.PageRequest, _Mapping]] = ...) -> None: ...
34
+
35
+ class ListActionsResponse(_message.Message):
36
+ __slots__ = ("actions_standard", "actions_custom", "pagination")
37
+ ACTIONS_STANDARD_FIELD_NUMBER: _ClassVar[int]
38
+ ACTIONS_CUSTOM_FIELD_NUMBER: _ClassVar[int]
39
+ PAGINATION_FIELD_NUMBER: _ClassVar[int]
40
+ actions_standard: _containers.RepeatedCompositeFieldContainer[_objects_pb2.Action]
41
+ actions_custom: _containers.RepeatedCompositeFieldContainer[_objects_pb2.Action]
42
+ pagination: _selectors_pb2.PageResponse
43
+ def __init__(self, actions_standard: _Optional[_Iterable[_Union[_objects_pb2.Action, _Mapping]]] = ..., actions_custom: _Optional[_Iterable[_Union[_objects_pb2.Action, _Mapping]]] = ..., pagination: _Optional[_Union[_selectors_pb2.PageResponse, _Mapping]] = ...) -> None: ...
44
+
45
+ class CreateActionRequest(_message.Message):
46
+ __slots__ = ("name", "metadata")
47
+ NAME_FIELD_NUMBER: _ClassVar[int]
48
+ METADATA_FIELD_NUMBER: _ClassVar[int]
49
+ name: str
50
+ metadata: _common_pb2.MetadataMutable
51
+ def __init__(self, name: _Optional[str] = ..., metadata: _Optional[_Union[_common_pb2.MetadataMutable, _Mapping]] = ...) -> None: ...
52
+
53
+ class CreateActionResponse(_message.Message):
54
+ __slots__ = ("action",)
55
+ ACTION_FIELD_NUMBER: _ClassVar[int]
56
+ action: _objects_pb2.Action
57
+ def __init__(self, action: _Optional[_Union[_objects_pb2.Action, _Mapping]] = ...) -> None: ...
58
+
59
+ class UpdateActionRequest(_message.Message):
60
+ __slots__ = ("id", "name", "metadata", "metadata_update_behavior")
61
+ ID_FIELD_NUMBER: _ClassVar[int]
62
+ NAME_FIELD_NUMBER: _ClassVar[int]
63
+ METADATA_FIELD_NUMBER: _ClassVar[int]
64
+ METADATA_UPDATE_BEHAVIOR_FIELD_NUMBER: _ClassVar[int]
65
+ id: str
66
+ name: str
67
+ metadata: _common_pb2.MetadataMutable
68
+ metadata_update_behavior: _common_pb2.MetadataUpdateEnum
69
+ def __init__(self, id: _Optional[str] = ..., name: _Optional[str] = ..., metadata: _Optional[_Union[_common_pb2.MetadataMutable, _Mapping]] = ..., metadata_update_behavior: _Optional[_Union[_common_pb2.MetadataUpdateEnum, str]] = ...) -> None: ...
70
+
71
+ class UpdateActionResponse(_message.Message):
72
+ __slots__ = ("action",)
73
+ ACTION_FIELD_NUMBER: _ClassVar[int]
74
+ action: _objects_pb2.Action
75
+ def __init__(self, action: _Optional[_Union[_objects_pb2.Action, _Mapping]] = ...) -> None: ...
76
+
77
+ class DeleteActionRequest(_message.Message):
78
+ __slots__ = ("id",)
79
+ ID_FIELD_NUMBER: _ClassVar[int]
80
+ id: str
81
+ def __init__(self, id: _Optional[str] = ...) -> None: ...
82
+
83
+ class DeleteActionResponse(_message.Message):
84
+ __slots__ = ("action",)
85
+ ACTION_FIELD_NUMBER: _ClassVar[int]
86
+ action: _objects_pb2.Action
87
+ def __init__(self, action: _Optional[_Union[_objects_pb2.Action, _Mapping]] = ...) -> None: ...
@@ -0,0 +1,275 @@
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 policy.actions.actions_pb2
36
+
37
+ class ActionServiceClient:
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_action(
47
+ self, req: policy.actions.actions_pb2.GetActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
48
+ ) -> UnaryOutput[policy.actions.actions_pb2.GetActionResponse]:
49
+ """Low-level method to call GetAction, granting access to errors and metadata"""
50
+ url = self.base_url + "/policy.actions.ActionService/GetAction"
51
+ return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.GetActionResponse,extra_headers, timeout_seconds)
52
+
53
+
54
+ def get_action(
55
+ self, req: policy.actions.actions_pb2.GetActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
56
+ ) -> policy.actions.actions_pb2.GetActionResponse:
57
+ response = self.call_get_action(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_list_actions(
67
+ self, req: policy.actions.actions_pb2.ListActionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
68
+ ) -> UnaryOutput[policy.actions.actions_pb2.ListActionsResponse]:
69
+ """Low-level method to call ListActions, granting access to errors and metadata"""
70
+ url = self.base_url + "/policy.actions.ActionService/ListActions"
71
+ return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.ListActionsResponse,extra_headers, timeout_seconds)
72
+
73
+
74
+ def list_actions(
75
+ self, req: policy.actions.actions_pb2.ListActionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
76
+ ) -> policy.actions.actions_pb2.ListActionsResponse:
77
+ response = self.call_list_actions(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_create_action(
87
+ self, req: policy.actions.actions_pb2.CreateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
88
+ ) -> UnaryOutput[policy.actions.actions_pb2.CreateActionResponse]:
89
+ """Low-level method to call CreateAction, granting access to errors and metadata"""
90
+ url = self.base_url + "/policy.actions.ActionService/CreateAction"
91
+ return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.CreateActionResponse,extra_headers, timeout_seconds)
92
+
93
+
94
+ def create_action(
95
+ self, req: policy.actions.actions_pb2.CreateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
96
+ ) -> policy.actions.actions_pb2.CreateActionResponse:
97
+ response = self.call_create_action(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_update_action(
107
+ self, req: policy.actions.actions_pb2.UpdateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
108
+ ) -> UnaryOutput[policy.actions.actions_pb2.UpdateActionResponse]:
109
+ """Low-level method to call UpdateAction, granting access to errors and metadata"""
110
+ url = self.base_url + "/policy.actions.ActionService/UpdateAction"
111
+ return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.UpdateActionResponse,extra_headers, timeout_seconds)
112
+
113
+
114
+ def update_action(
115
+ self, req: policy.actions.actions_pb2.UpdateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
116
+ ) -> policy.actions.actions_pb2.UpdateActionResponse:
117
+ response = self.call_update_action(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
+ def call_delete_action(
127
+ self, req: policy.actions.actions_pb2.DeleteActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
128
+ ) -> UnaryOutput[policy.actions.actions_pb2.DeleteActionResponse]:
129
+ """Low-level method to call DeleteAction, granting access to errors and metadata"""
130
+ url = self.base_url + "/policy.actions.ActionService/DeleteAction"
131
+ return self._connect_client.call_unary(url, req, policy.actions.actions_pb2.DeleteActionResponse,extra_headers, timeout_seconds)
132
+
133
+
134
+ def delete_action(
135
+ self, req: policy.actions.actions_pb2.DeleteActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
136
+ ) -> policy.actions.actions_pb2.DeleteActionResponse:
137
+ response = self.call_delete_action(req, extra_headers, timeout_seconds)
138
+ err = response.error()
139
+ if err is not None:
140
+ raise err
141
+ msg = response.message()
142
+ if msg is None:
143
+ raise ConnectProtocolError('missing response message')
144
+ return msg
145
+
146
+
147
+ class AsyncActionServiceClient:
148
+ def __init__(
149
+ self,
150
+ base_url: str,
151
+ http_client: aiohttp.ClientSession,
152
+ protocol: ConnectProtocol = ConnectProtocol.CONNECT_PROTOBUF,
153
+ ):
154
+ self.base_url = base_url
155
+ self._connect_client = AsyncConnectClient(http_client, protocol)
156
+
157
+ async def call_get_action(
158
+ self, req: policy.actions.actions_pb2.GetActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
159
+ ) -> UnaryOutput[policy.actions.actions_pb2.GetActionResponse]:
160
+ """Low-level method to call GetAction, granting access to errors and metadata"""
161
+ url = self.base_url + "/policy.actions.ActionService/GetAction"
162
+ return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.GetActionResponse,extra_headers, timeout_seconds)
163
+
164
+ async def get_action(
165
+ self, req: policy.actions.actions_pb2.GetActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
166
+ ) -> policy.actions.actions_pb2.GetActionResponse:
167
+ response = await self.call_get_action(req, extra_headers, timeout_seconds)
168
+ err = response.error()
169
+ if err is not None:
170
+ raise err
171
+ msg = response.message()
172
+ if msg is None:
173
+ raise ConnectProtocolError('missing response message')
174
+ return msg
175
+
176
+ async def call_list_actions(
177
+ self, req: policy.actions.actions_pb2.ListActionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
178
+ ) -> UnaryOutput[policy.actions.actions_pb2.ListActionsResponse]:
179
+ """Low-level method to call ListActions, granting access to errors and metadata"""
180
+ url = self.base_url + "/policy.actions.ActionService/ListActions"
181
+ return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.ListActionsResponse,extra_headers, timeout_seconds)
182
+
183
+ async def list_actions(
184
+ self, req: policy.actions.actions_pb2.ListActionsRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
185
+ ) -> policy.actions.actions_pb2.ListActionsResponse:
186
+ response = await self.call_list_actions(req, extra_headers, timeout_seconds)
187
+ err = response.error()
188
+ if err is not None:
189
+ raise err
190
+ msg = response.message()
191
+ if msg is None:
192
+ raise ConnectProtocolError('missing response message')
193
+ return msg
194
+
195
+ async def call_create_action(
196
+ self, req: policy.actions.actions_pb2.CreateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
197
+ ) -> UnaryOutput[policy.actions.actions_pb2.CreateActionResponse]:
198
+ """Low-level method to call CreateAction, granting access to errors and metadata"""
199
+ url = self.base_url + "/policy.actions.ActionService/CreateAction"
200
+ return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.CreateActionResponse,extra_headers, timeout_seconds)
201
+
202
+ async def create_action(
203
+ self, req: policy.actions.actions_pb2.CreateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
204
+ ) -> policy.actions.actions_pb2.CreateActionResponse:
205
+ response = await self.call_create_action(req, extra_headers, timeout_seconds)
206
+ err = response.error()
207
+ if err is not None:
208
+ raise err
209
+ msg = response.message()
210
+ if msg is None:
211
+ raise ConnectProtocolError('missing response message')
212
+ return msg
213
+
214
+ async def call_update_action(
215
+ self, req: policy.actions.actions_pb2.UpdateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
216
+ ) -> UnaryOutput[policy.actions.actions_pb2.UpdateActionResponse]:
217
+ """Low-level method to call UpdateAction, granting access to errors and metadata"""
218
+ url = self.base_url + "/policy.actions.ActionService/UpdateAction"
219
+ return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.UpdateActionResponse,extra_headers, timeout_seconds)
220
+
221
+ async def update_action(
222
+ self, req: policy.actions.actions_pb2.UpdateActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
223
+ ) -> policy.actions.actions_pb2.UpdateActionResponse:
224
+ response = await self.call_update_action(req, extra_headers, timeout_seconds)
225
+ err = response.error()
226
+ if err is not None:
227
+ raise err
228
+ msg = response.message()
229
+ if msg is None:
230
+ raise ConnectProtocolError('missing response message')
231
+ return msg
232
+
233
+ async def call_delete_action(
234
+ self, req: policy.actions.actions_pb2.DeleteActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
235
+ ) -> UnaryOutput[policy.actions.actions_pb2.DeleteActionResponse]:
236
+ """Low-level method to call DeleteAction, granting access to errors and metadata"""
237
+ url = self.base_url + "/policy.actions.ActionService/DeleteAction"
238
+ return await self._connect_client.call_unary(url, req, policy.actions.actions_pb2.DeleteActionResponse,extra_headers, timeout_seconds)
239
+
240
+ async def delete_action(
241
+ self, req: policy.actions.actions_pb2.DeleteActionRequest,extra_headers: HeaderInput | None=None, timeout_seconds: float | None=None
242
+ ) -> policy.actions.actions_pb2.DeleteActionResponse:
243
+ response = await self.call_delete_action(req, extra_headers, timeout_seconds)
244
+ err = response.error()
245
+ if err is not None:
246
+ raise err
247
+ msg = response.message()
248
+ if msg is None:
249
+ raise ConnectProtocolError('missing response message')
250
+ return msg
251
+
252
+
253
+ @typing.runtime_checkable
254
+ class ActionServiceProtocol(typing.Protocol):
255
+ def get_action(self, req: ClientRequest[policy.actions.actions_pb2.GetActionRequest]) -> ServerResponse[policy.actions.actions_pb2.GetActionResponse]:
256
+ ...
257
+ def list_actions(self, req: ClientRequest[policy.actions.actions_pb2.ListActionsRequest]) -> ServerResponse[policy.actions.actions_pb2.ListActionsResponse]:
258
+ ...
259
+ def create_action(self, req: ClientRequest[policy.actions.actions_pb2.CreateActionRequest]) -> ServerResponse[policy.actions.actions_pb2.CreateActionResponse]:
260
+ ...
261
+ def update_action(self, req: ClientRequest[policy.actions.actions_pb2.UpdateActionRequest]) -> ServerResponse[policy.actions.actions_pb2.UpdateActionResponse]:
262
+ ...
263
+ def delete_action(self, req: ClientRequest[policy.actions.actions_pb2.DeleteActionRequest]) -> ServerResponse[policy.actions.actions_pb2.DeleteActionResponse]:
264
+ ...
265
+
266
+ ACTION_SERVICE_PATH_PREFIX = "/policy.actions.ActionService"
267
+
268
+ def wsgi_action_service(implementation: ActionServiceProtocol) -> WSGIApplication:
269
+ app = ConnectWSGI()
270
+ app.register_unary_rpc("/policy.actions.ActionService/GetAction", implementation.get_action, policy.actions.actions_pb2.GetActionRequest)
271
+ app.register_unary_rpc("/policy.actions.ActionService/ListActions", implementation.list_actions, policy.actions.actions_pb2.ListActionsRequest)
272
+ app.register_unary_rpc("/policy.actions.ActionService/CreateAction", implementation.create_action, policy.actions.actions_pb2.CreateActionRequest)
273
+ app.register_unary_rpc("/policy.actions.ActionService/UpdateAction", implementation.update_action, policy.actions.actions_pb2.UpdateActionRequest)
274
+ app.register_unary_rpc("/policy.actions.ActionService/DeleteAction", implementation.delete_action, policy.actions.actions_pb2.DeleteActionRequest)
275
+ return app