openfeature-provider-flagd 0.1.2__py3-none-any.whl → 0.1.4__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.
- openfeature/contrib/provider/flagd/config.py +35 -0
- openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2.py +62 -0
- openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2_grpc.py +267 -0
- openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2.py +40 -0
- openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2_grpc.py +135 -0
- openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2.py +62 -0
- openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2_grpc.py +267 -0
- openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2.py +37 -0
- openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2_grpc.py +102 -0
- openfeature/contrib/provider/flagd/provider.py +52 -60
- {openfeature_provider_flagd-0.1.2.dist-info → openfeature_provider_flagd-0.1.4.dist-info}/METADATA +2 -2
- openfeature_provider_flagd-0.1.4.dist-info/RECORD +16 -0
- {openfeature_provider_flagd-0.1.2.dist-info → openfeature_provider_flagd-0.1.4.dist-info}/WHEEL +1 -1
- openfeature/contrib/provider/flagd/defaults.py +0 -5
- openfeature_provider_flagd-0.1.2.dist-info/RECORD +0 -8
- {openfeature_provider_flagd-0.1.2.dist-info → openfeature_provider_flagd-0.1.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import typing
|
|
3
|
+
|
|
4
|
+
T = typing.TypeVar("T")
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def str_to_bool(val: str) -> bool:
|
|
8
|
+
return val.lower() == "true"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def env_or_default(
|
|
12
|
+
env_var: str, default: T, cast: typing.Optional[typing.Callable[[str], T]] = None
|
|
13
|
+
) -> typing.Union[str, T]:
|
|
14
|
+
val = os.environ.get(env_var)
|
|
15
|
+
if val is None:
|
|
16
|
+
return default
|
|
17
|
+
return val if cast is None else cast(val)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Config:
|
|
21
|
+
def __init__(
|
|
22
|
+
self,
|
|
23
|
+
host: typing.Optional[str] = None,
|
|
24
|
+
port: typing.Optional[int] = None,
|
|
25
|
+
tls: typing.Optional[bool] = None,
|
|
26
|
+
timeout: typing.Optional[int] = None,
|
|
27
|
+
):
|
|
28
|
+
self.host = env_or_default("FLAGD_HOST", "localhost") if host is None else host
|
|
29
|
+
self.port = (
|
|
30
|
+
env_or_default("FLAGD_PORT", 8013, cast=int) if port is None else port
|
|
31
|
+
)
|
|
32
|
+
self.tls = (
|
|
33
|
+
env_or_default("FLAGD_TLS", False, cast=str_to_bool) if tls is None else tls
|
|
34
|
+
)
|
|
35
|
+
self.timeout = 5 if timeout is None else timeout
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: flagd/evaluation/v1/evaluation.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf import descriptor as _descriptor
|
|
6
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
7
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
8
|
+
from google.protobuf.internal import builder as _builder
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$flagd/evaluation/v1/evaluation.proto\x12\x13\x66lagd.evaluation.v1\x1a\x1cgoogle/protobuf/struct.proto\"F\n\x11ResolveAllRequest\x12\x31\n\x07\x63ontext\x18\x01 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\xb6\x01\n\x12ResolveAllResponse\x12H\n\x05\x66lags\x18\x01 \x03(\x0b\x32\x32.flagd.evaluation.v1.ResolveAllResponse.FlagsEntryR\x05\x66lags\x1aV\n\nFlagsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x32\n\x05value\x18\x02 \x01(\x0b\x32\x1c.flagd.evaluation.v1.AnyFlagR\x05value:\x02\x38\x01\"\xed\x01\n\x07\x41nyFlag\x12\x16\n\x06reason\x18\x01 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x02 \x01(\tR\x07variant\x12\x1f\n\nbool_value\x18\x03 \x01(\x08H\x00R\tboolValue\x12#\n\x0cstring_value\x18\x04 \x01(\tH\x00R\x0bstringValue\x12#\n\x0c\x64ouble_value\x18\x05 \x01(\x01H\x00R\x0b\x64oubleValue\x12<\n\x0cobject_value\x18\x06 \x01(\x0b\x32\x17.google.protobuf.StructH\x00R\x0bobjectValueB\x07\n\x05value\"e\n\x15ResolveBooleanRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\x95\x01\n\x16ResolveBooleanResponse\x12\x14\n\x05value\x18\x01 \x01(\x08R\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"d\n\x14ResolveStringRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\x94\x01\n\x15ResolveStringResponse\x12\x14\n\x05value\x18\x01 \x01(\tR\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"c\n\x13ResolveFloatRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\x93\x01\n\x14ResolveFloatResponse\x12\x14\n\x05value\x18\x01 \x01(\x01R\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"a\n\x11ResolveIntRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\x91\x01\n\x12ResolveIntResponse\x12\x14\n\x05value\x18\x01 \x01(\x03R\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"d\n\x14ResolveObjectRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\xad\x01\n\x15ResolveObjectResponse\x12-\n\x05value\x18\x01 \x01(\x0b\x32\x17.google.protobuf.StructR\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"V\n\x13\x45ventStreamResponse\x12\x12\n\x04type\x18\x01 \x01(\tR\x04type\x12+\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x04\x64\x61ta\"\x14\n\x12\x45ventStreamRequest2\xd9\x05\n\x07Service\x12_\n\nResolveAll\x12&.flagd.evaluation.v1.ResolveAllRequest\x1a\'.flagd.evaluation.v1.ResolveAllResponse\"\x00\x12k\n\x0eResolveBoolean\x12*.flagd.evaluation.v1.ResolveBooleanRequest\x1a+.flagd.evaluation.v1.ResolveBooleanResponse\"\x00\x12h\n\rResolveString\x12).flagd.evaluation.v1.ResolveStringRequest\x1a*.flagd.evaluation.v1.ResolveStringResponse\"\x00\x12\x65\n\x0cResolveFloat\x12(.flagd.evaluation.v1.ResolveFloatRequest\x1a).flagd.evaluation.v1.ResolveFloatResponse\"\x00\x12_\n\nResolveInt\x12&.flagd.evaluation.v1.ResolveIntRequest\x1a\'.flagd.evaluation.v1.ResolveIntResponse\"\x00\x12h\n\rResolveObject\x12).flagd.evaluation.v1.ResolveObjectRequest\x1a*.flagd.evaluation.v1.ResolveObjectResponse\"\x00\x12\x64\n\x0b\x45ventStream\x12\'.flagd.evaluation.v1.EventStreamRequest\x1a(.flagd.evaluation.v1.EventStreamResponse\"\x00\x30\x01\x42\xad\x01\n\x17\x63om.flagd.evaluation.v1B\x0f\x45valuationProtoP\x01Z\x13\x66lagd/evaluation/v1\xa2\x02\x03\x46\x45X\xaa\x02\x13\x46lagd.Evaluation.V1\xca\x02\x13\x46lagd\\Evaluation\\V1\xe2\x02\x1f\x46lagd\\Evaluation\\V1\\GPBMetadata\xea\x02\x15\x46lagd::Evaluation::V1b\x06proto3')
|
|
18
|
+
|
|
19
|
+
_globals = globals()
|
|
20
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flagd.evaluation.v1.evaluation_pb2', _globals)
|
|
22
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
23
|
+
|
|
24
|
+
DESCRIPTOR._options = None
|
|
25
|
+
DESCRIPTOR._serialized_options = b'\n\027com.flagd.evaluation.v1B\017EvaluationProtoP\001Z\023flagd/evaluation/v1\242\002\003FEX\252\002\023Flagd.Evaluation.V1\312\002\023Flagd\\Evaluation\\V1\342\002\037Flagd\\Evaluation\\V1\\GPBMetadata\352\002\025Flagd::Evaluation::V1'
|
|
26
|
+
_RESOLVEALLRESPONSE_FLAGSENTRY._options = None
|
|
27
|
+
_RESOLVEALLRESPONSE_FLAGSENTRY._serialized_options = b'8\001'
|
|
28
|
+
_globals['_RESOLVEALLREQUEST']._serialized_start=91
|
|
29
|
+
_globals['_RESOLVEALLREQUEST']._serialized_end=161
|
|
30
|
+
_globals['_RESOLVEALLRESPONSE']._serialized_start=164
|
|
31
|
+
_globals['_RESOLVEALLRESPONSE']._serialized_end=346
|
|
32
|
+
_globals['_RESOLVEALLRESPONSE_FLAGSENTRY']._serialized_start=260
|
|
33
|
+
_globals['_RESOLVEALLRESPONSE_FLAGSENTRY']._serialized_end=346
|
|
34
|
+
_globals['_ANYFLAG']._serialized_start=349
|
|
35
|
+
_globals['_ANYFLAG']._serialized_end=586
|
|
36
|
+
_globals['_RESOLVEBOOLEANREQUEST']._serialized_start=588
|
|
37
|
+
_globals['_RESOLVEBOOLEANREQUEST']._serialized_end=689
|
|
38
|
+
_globals['_RESOLVEBOOLEANRESPONSE']._serialized_start=692
|
|
39
|
+
_globals['_RESOLVEBOOLEANRESPONSE']._serialized_end=841
|
|
40
|
+
_globals['_RESOLVESTRINGREQUEST']._serialized_start=843
|
|
41
|
+
_globals['_RESOLVESTRINGREQUEST']._serialized_end=943
|
|
42
|
+
_globals['_RESOLVESTRINGRESPONSE']._serialized_start=946
|
|
43
|
+
_globals['_RESOLVESTRINGRESPONSE']._serialized_end=1094
|
|
44
|
+
_globals['_RESOLVEFLOATREQUEST']._serialized_start=1096
|
|
45
|
+
_globals['_RESOLVEFLOATREQUEST']._serialized_end=1195
|
|
46
|
+
_globals['_RESOLVEFLOATRESPONSE']._serialized_start=1198
|
|
47
|
+
_globals['_RESOLVEFLOATRESPONSE']._serialized_end=1345
|
|
48
|
+
_globals['_RESOLVEINTREQUEST']._serialized_start=1347
|
|
49
|
+
_globals['_RESOLVEINTREQUEST']._serialized_end=1444
|
|
50
|
+
_globals['_RESOLVEINTRESPONSE']._serialized_start=1447
|
|
51
|
+
_globals['_RESOLVEINTRESPONSE']._serialized_end=1592
|
|
52
|
+
_globals['_RESOLVEOBJECTREQUEST']._serialized_start=1594
|
|
53
|
+
_globals['_RESOLVEOBJECTREQUEST']._serialized_end=1694
|
|
54
|
+
_globals['_RESOLVEOBJECTRESPONSE']._serialized_start=1697
|
|
55
|
+
_globals['_RESOLVEOBJECTRESPONSE']._serialized_end=1870
|
|
56
|
+
_globals['_EVENTSTREAMRESPONSE']._serialized_start=1872
|
|
57
|
+
_globals['_EVENTSTREAMRESPONSE']._serialized_end=1958
|
|
58
|
+
_globals['_EVENTSTREAMREQUEST']._serialized_start=1960
|
|
59
|
+
_globals['_EVENTSTREAMREQUEST']._serialized_end=1980
|
|
60
|
+
_globals['_SERVICE']._serialized_start=1983
|
|
61
|
+
_globals['_SERVICE']._serialized_end=2712
|
|
62
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
|
|
5
|
+
from flagd.evaluation.v1 import evaluation_pb2 as flagd_dot_evaluation_dot_v1_dot_evaluation__pb2
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ServiceStub(object):
|
|
9
|
+
"""Service defines the exposed rpcs of flagd
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, channel):
|
|
13
|
+
"""Constructor.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
channel: A grpc.Channel.
|
|
17
|
+
"""
|
|
18
|
+
self.ResolveAll = channel.unary_unary(
|
|
19
|
+
'/flagd.evaluation.v1.Service/ResolveAll',
|
|
20
|
+
request_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveAllRequest.SerializeToString,
|
|
21
|
+
response_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveAllResponse.FromString,
|
|
22
|
+
)
|
|
23
|
+
self.ResolveBoolean = channel.unary_unary(
|
|
24
|
+
'/flagd.evaluation.v1.Service/ResolveBoolean',
|
|
25
|
+
request_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveBooleanRequest.SerializeToString,
|
|
26
|
+
response_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveBooleanResponse.FromString,
|
|
27
|
+
)
|
|
28
|
+
self.ResolveString = channel.unary_unary(
|
|
29
|
+
'/flagd.evaluation.v1.Service/ResolveString',
|
|
30
|
+
request_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveStringRequest.SerializeToString,
|
|
31
|
+
response_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveStringResponse.FromString,
|
|
32
|
+
)
|
|
33
|
+
self.ResolveFloat = channel.unary_unary(
|
|
34
|
+
'/flagd.evaluation.v1.Service/ResolveFloat',
|
|
35
|
+
request_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveFloatRequest.SerializeToString,
|
|
36
|
+
response_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveFloatResponse.FromString,
|
|
37
|
+
)
|
|
38
|
+
self.ResolveInt = channel.unary_unary(
|
|
39
|
+
'/flagd.evaluation.v1.Service/ResolveInt',
|
|
40
|
+
request_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveIntRequest.SerializeToString,
|
|
41
|
+
response_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveIntResponse.FromString,
|
|
42
|
+
)
|
|
43
|
+
self.ResolveObject = channel.unary_unary(
|
|
44
|
+
'/flagd.evaluation.v1.Service/ResolveObject',
|
|
45
|
+
request_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveObjectRequest.SerializeToString,
|
|
46
|
+
response_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveObjectResponse.FromString,
|
|
47
|
+
)
|
|
48
|
+
self.EventStream = channel.unary_stream(
|
|
49
|
+
'/flagd.evaluation.v1.Service/EventStream',
|
|
50
|
+
request_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.EventStreamRequest.SerializeToString,
|
|
51
|
+
response_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.EventStreamResponse.FromString,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ServiceServicer(object):
|
|
56
|
+
"""Service defines the exposed rpcs of flagd
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
def ResolveAll(self, request, context):
|
|
60
|
+
"""Missing associated documentation comment in .proto file."""
|
|
61
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
62
|
+
context.set_details('Method not implemented!')
|
|
63
|
+
raise NotImplementedError('Method not implemented!')
|
|
64
|
+
|
|
65
|
+
def ResolveBoolean(self, request, context):
|
|
66
|
+
"""Missing associated documentation comment in .proto file."""
|
|
67
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
68
|
+
context.set_details('Method not implemented!')
|
|
69
|
+
raise NotImplementedError('Method not implemented!')
|
|
70
|
+
|
|
71
|
+
def ResolveString(self, request, context):
|
|
72
|
+
"""Missing associated documentation comment in .proto file."""
|
|
73
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
74
|
+
context.set_details('Method not implemented!')
|
|
75
|
+
raise NotImplementedError('Method not implemented!')
|
|
76
|
+
|
|
77
|
+
def ResolveFloat(self, request, context):
|
|
78
|
+
"""Missing associated documentation comment in .proto file."""
|
|
79
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
80
|
+
context.set_details('Method not implemented!')
|
|
81
|
+
raise NotImplementedError('Method not implemented!')
|
|
82
|
+
|
|
83
|
+
def ResolveInt(self, request, context):
|
|
84
|
+
"""Missing associated documentation comment in .proto file."""
|
|
85
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
86
|
+
context.set_details('Method not implemented!')
|
|
87
|
+
raise NotImplementedError('Method not implemented!')
|
|
88
|
+
|
|
89
|
+
def ResolveObject(self, request, context):
|
|
90
|
+
"""Missing associated documentation comment in .proto file."""
|
|
91
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
92
|
+
context.set_details('Method not implemented!')
|
|
93
|
+
raise NotImplementedError('Method not implemented!')
|
|
94
|
+
|
|
95
|
+
def EventStream(self, request, context):
|
|
96
|
+
"""Missing associated documentation comment in .proto file."""
|
|
97
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
98
|
+
context.set_details('Method not implemented!')
|
|
99
|
+
raise NotImplementedError('Method not implemented!')
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def add_ServiceServicer_to_server(servicer, server):
|
|
103
|
+
rpc_method_handlers = {
|
|
104
|
+
'ResolveAll': grpc.unary_unary_rpc_method_handler(
|
|
105
|
+
servicer.ResolveAll,
|
|
106
|
+
request_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveAllRequest.FromString,
|
|
107
|
+
response_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveAllResponse.SerializeToString,
|
|
108
|
+
),
|
|
109
|
+
'ResolveBoolean': grpc.unary_unary_rpc_method_handler(
|
|
110
|
+
servicer.ResolveBoolean,
|
|
111
|
+
request_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveBooleanRequest.FromString,
|
|
112
|
+
response_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveBooleanResponse.SerializeToString,
|
|
113
|
+
),
|
|
114
|
+
'ResolveString': grpc.unary_unary_rpc_method_handler(
|
|
115
|
+
servicer.ResolveString,
|
|
116
|
+
request_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveStringRequest.FromString,
|
|
117
|
+
response_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveStringResponse.SerializeToString,
|
|
118
|
+
),
|
|
119
|
+
'ResolveFloat': grpc.unary_unary_rpc_method_handler(
|
|
120
|
+
servicer.ResolveFloat,
|
|
121
|
+
request_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveFloatRequest.FromString,
|
|
122
|
+
response_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveFloatResponse.SerializeToString,
|
|
123
|
+
),
|
|
124
|
+
'ResolveInt': grpc.unary_unary_rpc_method_handler(
|
|
125
|
+
servicer.ResolveInt,
|
|
126
|
+
request_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveIntRequest.FromString,
|
|
127
|
+
response_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveIntResponse.SerializeToString,
|
|
128
|
+
),
|
|
129
|
+
'ResolveObject': grpc.unary_unary_rpc_method_handler(
|
|
130
|
+
servicer.ResolveObject,
|
|
131
|
+
request_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveObjectRequest.FromString,
|
|
132
|
+
response_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveObjectResponse.SerializeToString,
|
|
133
|
+
),
|
|
134
|
+
'EventStream': grpc.unary_stream_rpc_method_handler(
|
|
135
|
+
servicer.EventStream,
|
|
136
|
+
request_deserializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.EventStreamRequest.FromString,
|
|
137
|
+
response_serializer=flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.EventStreamResponse.SerializeToString,
|
|
138
|
+
),
|
|
139
|
+
}
|
|
140
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
141
|
+
'flagd.evaluation.v1.Service', rpc_method_handlers)
|
|
142
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# This class is part of an EXPERIMENTAL API.
|
|
146
|
+
class Service(object):
|
|
147
|
+
"""Service defines the exposed rpcs of flagd
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
@staticmethod
|
|
151
|
+
def ResolveAll(request,
|
|
152
|
+
target,
|
|
153
|
+
options=(),
|
|
154
|
+
channel_credentials=None,
|
|
155
|
+
call_credentials=None,
|
|
156
|
+
insecure=False,
|
|
157
|
+
compression=None,
|
|
158
|
+
wait_for_ready=None,
|
|
159
|
+
timeout=None,
|
|
160
|
+
metadata=None):
|
|
161
|
+
return grpc.experimental.unary_unary(request, target, '/flagd.evaluation.v1.Service/ResolveAll',
|
|
162
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveAllRequest.SerializeToString,
|
|
163
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveAllResponse.FromString,
|
|
164
|
+
options, channel_credentials,
|
|
165
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
166
|
+
|
|
167
|
+
@staticmethod
|
|
168
|
+
def ResolveBoolean(request,
|
|
169
|
+
target,
|
|
170
|
+
options=(),
|
|
171
|
+
channel_credentials=None,
|
|
172
|
+
call_credentials=None,
|
|
173
|
+
insecure=False,
|
|
174
|
+
compression=None,
|
|
175
|
+
wait_for_ready=None,
|
|
176
|
+
timeout=None,
|
|
177
|
+
metadata=None):
|
|
178
|
+
return grpc.experimental.unary_unary(request, target, '/flagd.evaluation.v1.Service/ResolveBoolean',
|
|
179
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveBooleanRequest.SerializeToString,
|
|
180
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveBooleanResponse.FromString,
|
|
181
|
+
options, channel_credentials,
|
|
182
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
183
|
+
|
|
184
|
+
@staticmethod
|
|
185
|
+
def ResolveString(request,
|
|
186
|
+
target,
|
|
187
|
+
options=(),
|
|
188
|
+
channel_credentials=None,
|
|
189
|
+
call_credentials=None,
|
|
190
|
+
insecure=False,
|
|
191
|
+
compression=None,
|
|
192
|
+
wait_for_ready=None,
|
|
193
|
+
timeout=None,
|
|
194
|
+
metadata=None):
|
|
195
|
+
return grpc.experimental.unary_unary(request, target, '/flagd.evaluation.v1.Service/ResolveString',
|
|
196
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveStringRequest.SerializeToString,
|
|
197
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveStringResponse.FromString,
|
|
198
|
+
options, channel_credentials,
|
|
199
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
200
|
+
|
|
201
|
+
@staticmethod
|
|
202
|
+
def ResolveFloat(request,
|
|
203
|
+
target,
|
|
204
|
+
options=(),
|
|
205
|
+
channel_credentials=None,
|
|
206
|
+
call_credentials=None,
|
|
207
|
+
insecure=False,
|
|
208
|
+
compression=None,
|
|
209
|
+
wait_for_ready=None,
|
|
210
|
+
timeout=None,
|
|
211
|
+
metadata=None):
|
|
212
|
+
return grpc.experimental.unary_unary(request, target, '/flagd.evaluation.v1.Service/ResolveFloat',
|
|
213
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveFloatRequest.SerializeToString,
|
|
214
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveFloatResponse.FromString,
|
|
215
|
+
options, channel_credentials,
|
|
216
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
217
|
+
|
|
218
|
+
@staticmethod
|
|
219
|
+
def ResolveInt(request,
|
|
220
|
+
target,
|
|
221
|
+
options=(),
|
|
222
|
+
channel_credentials=None,
|
|
223
|
+
call_credentials=None,
|
|
224
|
+
insecure=False,
|
|
225
|
+
compression=None,
|
|
226
|
+
wait_for_ready=None,
|
|
227
|
+
timeout=None,
|
|
228
|
+
metadata=None):
|
|
229
|
+
return grpc.experimental.unary_unary(request, target, '/flagd.evaluation.v1.Service/ResolveInt',
|
|
230
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveIntRequest.SerializeToString,
|
|
231
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveIntResponse.FromString,
|
|
232
|
+
options, channel_credentials,
|
|
233
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
234
|
+
|
|
235
|
+
@staticmethod
|
|
236
|
+
def ResolveObject(request,
|
|
237
|
+
target,
|
|
238
|
+
options=(),
|
|
239
|
+
channel_credentials=None,
|
|
240
|
+
call_credentials=None,
|
|
241
|
+
insecure=False,
|
|
242
|
+
compression=None,
|
|
243
|
+
wait_for_ready=None,
|
|
244
|
+
timeout=None,
|
|
245
|
+
metadata=None):
|
|
246
|
+
return grpc.experimental.unary_unary(request, target, '/flagd.evaluation.v1.Service/ResolveObject',
|
|
247
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveObjectRequest.SerializeToString,
|
|
248
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.ResolveObjectResponse.FromString,
|
|
249
|
+
options, channel_credentials,
|
|
250
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
251
|
+
|
|
252
|
+
@staticmethod
|
|
253
|
+
def EventStream(request,
|
|
254
|
+
target,
|
|
255
|
+
options=(),
|
|
256
|
+
channel_credentials=None,
|
|
257
|
+
call_credentials=None,
|
|
258
|
+
insecure=False,
|
|
259
|
+
compression=None,
|
|
260
|
+
wait_for_ready=None,
|
|
261
|
+
timeout=None,
|
|
262
|
+
metadata=None):
|
|
263
|
+
return grpc.experimental.unary_stream(request, target, '/flagd.evaluation.v1.Service/EventStream',
|
|
264
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.EventStreamRequest.SerializeToString,
|
|
265
|
+
flagd_dot_evaluation_dot_v1_dot_evaluation__pb2.EventStreamResponse.FromString,
|
|
266
|
+
options, channel_credentials,
|
|
267
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: flagd/sync/v1/sync.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf import descriptor as _descriptor
|
|
6
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
7
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
8
|
+
from google.protobuf.internal import builder as _builder
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18\x66lagd/sync/v1/sync.proto\x12\rflagd.sync.v1\x1a\x1cgoogle/protobuf/struct.proto\"O\n\x10SyncFlagsRequest\x12\x1f\n\x0bprovider_id\x18\x01 \x01(\tR\nproviderId\x12\x1a\n\x08selector\x18\x02 \x01(\tR\x08selector\"B\n\x11SyncFlagsResponse\x12-\n\x12\x66lag_configuration\x18\x01 \x01(\tR\x11\x66lagConfiguration\"S\n\x14\x46\x65tchAllFlagsRequest\x12\x1f\n\x0bprovider_id\x18\x01 \x01(\tR\nproviderId\x12\x1a\n\x08selector\x18\x02 \x01(\tR\x08selector\"F\n\x15\x46\x65tchAllFlagsResponse\x12-\n\x12\x66lag_configuration\x18\x01 \x01(\tR\x11\x66lagConfiguration\"\x14\n\x12GetMetadataRequest\"P\n\x13GetMetadataResponse\x12\x33\n\x08metadata\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadataJ\x04\x08\x01\x10\x02\x32\x9b\x02\n\x0f\x46lagSyncService\x12R\n\tSyncFlags\x12\x1f.flagd.sync.v1.SyncFlagsRequest\x1a .flagd.sync.v1.SyncFlagsResponse\"\x00\x30\x01\x12\\\n\rFetchAllFlags\x12#.flagd.sync.v1.FetchAllFlagsRequest\x1a$.flagd.sync.v1.FetchAllFlagsResponse\"\x00\x12V\n\x0bGetMetadata\x12!.flagd.sync.v1.GetMetadataRequest\x1a\".flagd.sync.v1.GetMetadataResponse\"\x00\x42\x83\x01\n\x11\x63om.flagd.sync.v1B\tSyncProtoP\x01Z\rflagd/sync/v1\xa2\x02\x03\x46SX\xaa\x02\rFlagd.Sync.V1\xca\x02\rFlagd\\Sync\\V1\xe2\x02\x19\x46lagd\\Sync\\V1\\GPBMetadata\xea\x02\x0f\x46lagd::Sync::V1b\x06proto3')
|
|
18
|
+
|
|
19
|
+
_globals = globals()
|
|
20
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'flagd.sync.v1.sync_pb2', _globals)
|
|
22
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
23
|
+
|
|
24
|
+
DESCRIPTOR._options = None
|
|
25
|
+
DESCRIPTOR._serialized_options = b'\n\021com.flagd.sync.v1B\tSyncProtoP\001Z\rflagd/sync/v1\242\002\003FSX\252\002\rFlagd.Sync.V1\312\002\rFlagd\\Sync\\V1\342\002\031Flagd\\Sync\\V1\\GPBMetadata\352\002\017Flagd::Sync::V1'
|
|
26
|
+
_globals['_SYNCFLAGSREQUEST']._serialized_start=73
|
|
27
|
+
_globals['_SYNCFLAGSREQUEST']._serialized_end=152
|
|
28
|
+
_globals['_SYNCFLAGSRESPONSE']._serialized_start=154
|
|
29
|
+
_globals['_SYNCFLAGSRESPONSE']._serialized_end=220
|
|
30
|
+
_globals['_FETCHALLFLAGSREQUEST']._serialized_start=222
|
|
31
|
+
_globals['_FETCHALLFLAGSREQUEST']._serialized_end=305
|
|
32
|
+
_globals['_FETCHALLFLAGSRESPONSE']._serialized_start=307
|
|
33
|
+
_globals['_FETCHALLFLAGSRESPONSE']._serialized_end=377
|
|
34
|
+
_globals['_GETMETADATAREQUEST']._serialized_start=379
|
|
35
|
+
_globals['_GETMETADATAREQUEST']._serialized_end=399
|
|
36
|
+
_globals['_GETMETADATARESPONSE']._serialized_start=401
|
|
37
|
+
_globals['_GETMETADATARESPONSE']._serialized_end=481
|
|
38
|
+
_globals['_FLAGSYNCSERVICE']._serialized_start=484
|
|
39
|
+
_globals['_FLAGSYNCSERVICE']._serialized_end=767
|
|
40
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
|
|
5
|
+
from flagd.sync.v1 import sync_pb2 as flagd_dot_sync_dot_v1_dot_sync__pb2
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FlagSyncServiceStub(object):
|
|
9
|
+
"""FlagService implements a server streaming to provide realtime flag configurations
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, channel):
|
|
13
|
+
"""Constructor.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
channel: A grpc.Channel.
|
|
17
|
+
"""
|
|
18
|
+
self.SyncFlags = channel.unary_stream(
|
|
19
|
+
'/flagd.sync.v1.FlagSyncService/SyncFlags',
|
|
20
|
+
request_serializer=flagd_dot_sync_dot_v1_dot_sync__pb2.SyncFlagsRequest.SerializeToString,
|
|
21
|
+
response_deserializer=flagd_dot_sync_dot_v1_dot_sync__pb2.SyncFlagsResponse.FromString,
|
|
22
|
+
)
|
|
23
|
+
self.FetchAllFlags = channel.unary_unary(
|
|
24
|
+
'/flagd.sync.v1.FlagSyncService/FetchAllFlags',
|
|
25
|
+
request_serializer=flagd_dot_sync_dot_v1_dot_sync__pb2.FetchAllFlagsRequest.SerializeToString,
|
|
26
|
+
response_deserializer=flagd_dot_sync_dot_v1_dot_sync__pb2.FetchAllFlagsResponse.FromString,
|
|
27
|
+
)
|
|
28
|
+
self.GetMetadata = channel.unary_unary(
|
|
29
|
+
'/flagd.sync.v1.FlagSyncService/GetMetadata',
|
|
30
|
+
request_serializer=flagd_dot_sync_dot_v1_dot_sync__pb2.GetMetadataRequest.SerializeToString,
|
|
31
|
+
response_deserializer=flagd_dot_sync_dot_v1_dot_sync__pb2.GetMetadataResponse.FromString,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class FlagSyncServiceServicer(object):
|
|
36
|
+
"""FlagService implements a server streaming to provide realtime flag configurations
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
def SyncFlags(self, request, context):
|
|
40
|
+
"""Missing associated documentation comment in .proto file."""
|
|
41
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
42
|
+
context.set_details('Method not implemented!')
|
|
43
|
+
raise NotImplementedError('Method not implemented!')
|
|
44
|
+
|
|
45
|
+
def FetchAllFlags(self, request, context):
|
|
46
|
+
"""Missing associated documentation comment in .proto file."""
|
|
47
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
48
|
+
context.set_details('Method not implemented!')
|
|
49
|
+
raise NotImplementedError('Method not implemented!')
|
|
50
|
+
|
|
51
|
+
def GetMetadata(self, request, context):
|
|
52
|
+
"""Missing associated documentation comment in .proto file."""
|
|
53
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
54
|
+
context.set_details('Method not implemented!')
|
|
55
|
+
raise NotImplementedError('Method not implemented!')
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def add_FlagSyncServiceServicer_to_server(servicer, server):
|
|
59
|
+
rpc_method_handlers = {
|
|
60
|
+
'SyncFlags': grpc.unary_stream_rpc_method_handler(
|
|
61
|
+
servicer.SyncFlags,
|
|
62
|
+
request_deserializer=flagd_dot_sync_dot_v1_dot_sync__pb2.SyncFlagsRequest.FromString,
|
|
63
|
+
response_serializer=flagd_dot_sync_dot_v1_dot_sync__pb2.SyncFlagsResponse.SerializeToString,
|
|
64
|
+
),
|
|
65
|
+
'FetchAllFlags': grpc.unary_unary_rpc_method_handler(
|
|
66
|
+
servicer.FetchAllFlags,
|
|
67
|
+
request_deserializer=flagd_dot_sync_dot_v1_dot_sync__pb2.FetchAllFlagsRequest.FromString,
|
|
68
|
+
response_serializer=flagd_dot_sync_dot_v1_dot_sync__pb2.FetchAllFlagsResponse.SerializeToString,
|
|
69
|
+
),
|
|
70
|
+
'GetMetadata': grpc.unary_unary_rpc_method_handler(
|
|
71
|
+
servicer.GetMetadata,
|
|
72
|
+
request_deserializer=flagd_dot_sync_dot_v1_dot_sync__pb2.GetMetadataRequest.FromString,
|
|
73
|
+
response_serializer=flagd_dot_sync_dot_v1_dot_sync__pb2.GetMetadataResponse.SerializeToString,
|
|
74
|
+
),
|
|
75
|
+
}
|
|
76
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
77
|
+
'flagd.sync.v1.FlagSyncService', rpc_method_handlers)
|
|
78
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# This class is part of an EXPERIMENTAL API.
|
|
82
|
+
class FlagSyncService(object):
|
|
83
|
+
"""FlagService implements a server streaming to provide realtime flag configurations
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
@staticmethod
|
|
87
|
+
def SyncFlags(request,
|
|
88
|
+
target,
|
|
89
|
+
options=(),
|
|
90
|
+
channel_credentials=None,
|
|
91
|
+
call_credentials=None,
|
|
92
|
+
insecure=False,
|
|
93
|
+
compression=None,
|
|
94
|
+
wait_for_ready=None,
|
|
95
|
+
timeout=None,
|
|
96
|
+
metadata=None):
|
|
97
|
+
return grpc.experimental.unary_stream(request, target, '/flagd.sync.v1.FlagSyncService/SyncFlags',
|
|
98
|
+
flagd_dot_sync_dot_v1_dot_sync__pb2.SyncFlagsRequest.SerializeToString,
|
|
99
|
+
flagd_dot_sync_dot_v1_dot_sync__pb2.SyncFlagsResponse.FromString,
|
|
100
|
+
options, channel_credentials,
|
|
101
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
102
|
+
|
|
103
|
+
@staticmethod
|
|
104
|
+
def FetchAllFlags(request,
|
|
105
|
+
target,
|
|
106
|
+
options=(),
|
|
107
|
+
channel_credentials=None,
|
|
108
|
+
call_credentials=None,
|
|
109
|
+
insecure=False,
|
|
110
|
+
compression=None,
|
|
111
|
+
wait_for_ready=None,
|
|
112
|
+
timeout=None,
|
|
113
|
+
metadata=None):
|
|
114
|
+
return grpc.experimental.unary_unary(request, target, '/flagd.sync.v1.FlagSyncService/FetchAllFlags',
|
|
115
|
+
flagd_dot_sync_dot_v1_dot_sync__pb2.FetchAllFlagsRequest.SerializeToString,
|
|
116
|
+
flagd_dot_sync_dot_v1_dot_sync__pb2.FetchAllFlagsResponse.FromString,
|
|
117
|
+
options, channel_credentials,
|
|
118
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
119
|
+
|
|
120
|
+
@staticmethod
|
|
121
|
+
def GetMetadata(request,
|
|
122
|
+
target,
|
|
123
|
+
options=(),
|
|
124
|
+
channel_credentials=None,
|
|
125
|
+
call_credentials=None,
|
|
126
|
+
insecure=False,
|
|
127
|
+
compression=None,
|
|
128
|
+
wait_for_ready=None,
|
|
129
|
+
timeout=None,
|
|
130
|
+
metadata=None):
|
|
131
|
+
return grpc.experimental.unary_unary(request, target, '/flagd.sync.v1.FlagSyncService/GetMetadata',
|
|
132
|
+
flagd_dot_sync_dot_v1_dot_sync__pb2.GetMetadataRequest.SerializeToString,
|
|
133
|
+
flagd_dot_sync_dot_v1_dot_sync__pb2.GetMetadataResponse.FromString,
|
|
134
|
+
options, channel_credentials,
|
|
135
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: schema/v1/schema.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf import descriptor as _descriptor
|
|
6
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
7
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
8
|
+
from google.protobuf.internal import builder as _builder
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x16schema/v1/schema.proto\x12\tschema.v1\x1a\x1cgoogle/protobuf/struct.proto\"F\n\x11ResolveAllRequest\x12\x31\n\x07\x63ontext\x18\x01 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\xa2\x01\n\x12ResolveAllResponse\x12>\n\x05\x66lags\x18\x01 \x03(\x0b\x32(.schema.v1.ResolveAllResponse.FlagsEntryR\x05\x66lags\x1aL\n\nFlagsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12(\n\x05value\x18\x02 \x01(\x0b\x32\x12.schema.v1.AnyFlagR\x05value:\x02\x38\x01\"\xed\x01\n\x07\x41nyFlag\x12\x16\n\x06reason\x18\x01 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x02 \x01(\tR\x07variant\x12\x1f\n\nbool_value\x18\x03 \x01(\x08H\x00R\tboolValue\x12#\n\x0cstring_value\x18\x04 \x01(\tH\x00R\x0bstringValue\x12#\n\x0c\x64ouble_value\x18\x05 \x01(\x01H\x00R\x0b\x64oubleValue\x12<\n\x0cobject_value\x18\x06 \x01(\x0b\x32\x17.google.protobuf.StructH\x00R\x0bobjectValueB\x07\n\x05value\"e\n\x15ResolveBooleanRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\x95\x01\n\x16ResolveBooleanResponse\x12\x14\n\x05value\x18\x01 \x01(\x08R\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"d\n\x14ResolveStringRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\x94\x01\n\x15ResolveStringResponse\x12\x14\n\x05value\x18\x01 \x01(\tR\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"c\n\x13ResolveFloatRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\x93\x01\n\x14ResolveFloatResponse\x12\x14\n\x05value\x18\x01 \x01(\x01R\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"a\n\x11ResolveIntRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\x91\x01\n\x12ResolveIntResponse\x12\x14\n\x05value\x18\x01 \x01(\x03R\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"d\n\x14ResolveObjectRequest\x12\x19\n\x08\x66lag_key\x18\x01 \x01(\tR\x07\x66lagKey\x12\x31\n\x07\x63ontext\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x07\x63ontext\"\xad\x01\n\x15ResolveObjectResponse\x12-\n\x05value\x18\x01 \x01(\x0b\x32\x17.google.protobuf.StructR\x05value\x12\x16\n\x06reason\x18\x02 \x01(\tR\x06reason\x12\x18\n\x07variant\x18\x03 \x01(\tR\x07variant\x12\x33\n\x08metadata\x18\x04 \x01(\x0b\x32\x17.google.protobuf.StructR\x08metadata\"V\n\x13\x45ventStreamResponse\x12\x12\n\x04type\x18\x01 \x01(\tR\x04type\x12+\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x17.google.protobuf.StructR\x04\x64\x61ta\"\x14\n\x12\x45ventStreamRequest2\xcd\x04\n\x07Service\x12K\n\nResolveAll\x12\x1c.schema.v1.ResolveAllRequest\x1a\x1d.schema.v1.ResolveAllResponse\"\x00\x12W\n\x0eResolveBoolean\x12 .schema.v1.ResolveBooleanRequest\x1a!.schema.v1.ResolveBooleanResponse\"\x00\x12T\n\rResolveString\x12\x1f.schema.v1.ResolveStringRequest\x1a .schema.v1.ResolveStringResponse\"\x00\x12Q\n\x0cResolveFloat\x12\x1e.schema.v1.ResolveFloatRequest\x1a\x1f.schema.v1.ResolveFloatResponse\"\x00\x12K\n\nResolveInt\x12\x1c.schema.v1.ResolveIntRequest\x1a\x1d.schema.v1.ResolveIntResponse\"\x00\x12T\n\rResolveObject\x12\x1f.schema.v1.ResolveObjectRequest\x1a .schema.v1.ResolveObjectResponse\"\x00\x12P\n\x0b\x45ventStream\x12\x1d.schema.v1.EventStreamRequest\x1a\x1e.schema.v1.EventStreamResponse\"\x00\x30\x01\x42t\n\rcom.schema.v1B\x0bSchemaProtoP\x01Z\x11schema/service/v1\xa2\x02\x03SXX\xaa\x02\tSchema.V1\xca\x02\tSchema\\V1\xe2\x02\x15Schema\\V1\\GPBMetadata\xea\x02\nSchema::V1b\x06proto3')
|
|
18
|
+
|
|
19
|
+
_globals = globals()
|
|
20
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
21
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'schema.v1.schema_pb2', _globals)
|
|
22
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
23
|
+
|
|
24
|
+
DESCRIPTOR._options = None
|
|
25
|
+
DESCRIPTOR._serialized_options = b'\n\rcom.schema.v1B\013SchemaProtoP\001Z\021schema/service/v1\242\002\003SXX\252\002\tSchema.V1\312\002\tSchema\\V1\342\002\025Schema\\V1\\GPBMetadata\352\002\nSchema::V1'
|
|
26
|
+
_RESOLVEALLRESPONSE_FLAGSENTRY._options = None
|
|
27
|
+
_RESOLVEALLRESPONSE_FLAGSENTRY._serialized_options = b'8\001'
|
|
28
|
+
_globals['_RESOLVEALLREQUEST']._serialized_start=67
|
|
29
|
+
_globals['_RESOLVEALLREQUEST']._serialized_end=137
|
|
30
|
+
_globals['_RESOLVEALLRESPONSE']._serialized_start=140
|
|
31
|
+
_globals['_RESOLVEALLRESPONSE']._serialized_end=302
|
|
32
|
+
_globals['_RESOLVEALLRESPONSE_FLAGSENTRY']._serialized_start=226
|
|
33
|
+
_globals['_RESOLVEALLRESPONSE_FLAGSENTRY']._serialized_end=302
|
|
34
|
+
_globals['_ANYFLAG']._serialized_start=305
|
|
35
|
+
_globals['_ANYFLAG']._serialized_end=542
|
|
36
|
+
_globals['_RESOLVEBOOLEANREQUEST']._serialized_start=544
|
|
37
|
+
_globals['_RESOLVEBOOLEANREQUEST']._serialized_end=645
|
|
38
|
+
_globals['_RESOLVEBOOLEANRESPONSE']._serialized_start=648
|
|
39
|
+
_globals['_RESOLVEBOOLEANRESPONSE']._serialized_end=797
|
|
40
|
+
_globals['_RESOLVESTRINGREQUEST']._serialized_start=799
|
|
41
|
+
_globals['_RESOLVESTRINGREQUEST']._serialized_end=899
|
|
42
|
+
_globals['_RESOLVESTRINGRESPONSE']._serialized_start=902
|
|
43
|
+
_globals['_RESOLVESTRINGRESPONSE']._serialized_end=1050
|
|
44
|
+
_globals['_RESOLVEFLOATREQUEST']._serialized_start=1052
|
|
45
|
+
_globals['_RESOLVEFLOATREQUEST']._serialized_end=1151
|
|
46
|
+
_globals['_RESOLVEFLOATRESPONSE']._serialized_start=1154
|
|
47
|
+
_globals['_RESOLVEFLOATRESPONSE']._serialized_end=1301
|
|
48
|
+
_globals['_RESOLVEINTREQUEST']._serialized_start=1303
|
|
49
|
+
_globals['_RESOLVEINTREQUEST']._serialized_end=1400
|
|
50
|
+
_globals['_RESOLVEINTRESPONSE']._serialized_start=1403
|
|
51
|
+
_globals['_RESOLVEINTRESPONSE']._serialized_end=1548
|
|
52
|
+
_globals['_RESOLVEOBJECTREQUEST']._serialized_start=1550
|
|
53
|
+
_globals['_RESOLVEOBJECTREQUEST']._serialized_end=1650
|
|
54
|
+
_globals['_RESOLVEOBJECTRESPONSE']._serialized_start=1653
|
|
55
|
+
_globals['_RESOLVEOBJECTRESPONSE']._serialized_end=1826
|
|
56
|
+
_globals['_EVENTSTREAMRESPONSE']._serialized_start=1828
|
|
57
|
+
_globals['_EVENTSTREAMRESPONSE']._serialized_end=1914
|
|
58
|
+
_globals['_EVENTSTREAMREQUEST']._serialized_start=1916
|
|
59
|
+
_globals['_EVENTSTREAMREQUEST']._serialized_end=1936
|
|
60
|
+
_globals['_SERVICE']._serialized_start=1939
|
|
61
|
+
_globals['_SERVICE']._serialized_end=2528
|
|
62
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
|
|
5
|
+
from . import schema_pb2 as schema_dot_v1_dot_schema__pb2
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ServiceStub(object):
|
|
9
|
+
"""Service defines the exposed rpcs of flagd
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, channel):
|
|
13
|
+
"""Constructor.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
channel: A grpc.Channel.
|
|
17
|
+
"""
|
|
18
|
+
self.ResolveAll = channel.unary_unary(
|
|
19
|
+
'/schema.v1.Service/ResolveAll',
|
|
20
|
+
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveAllRequest.SerializeToString,
|
|
21
|
+
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveAllResponse.FromString,
|
|
22
|
+
)
|
|
23
|
+
self.ResolveBoolean = channel.unary_unary(
|
|
24
|
+
'/schema.v1.Service/ResolveBoolean',
|
|
25
|
+
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveBooleanRequest.SerializeToString,
|
|
26
|
+
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveBooleanResponse.FromString,
|
|
27
|
+
)
|
|
28
|
+
self.ResolveString = channel.unary_unary(
|
|
29
|
+
'/schema.v1.Service/ResolveString',
|
|
30
|
+
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveStringRequest.SerializeToString,
|
|
31
|
+
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveStringResponse.FromString,
|
|
32
|
+
)
|
|
33
|
+
self.ResolveFloat = channel.unary_unary(
|
|
34
|
+
'/schema.v1.Service/ResolveFloat',
|
|
35
|
+
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveFloatRequest.SerializeToString,
|
|
36
|
+
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveFloatResponse.FromString,
|
|
37
|
+
)
|
|
38
|
+
self.ResolveInt = channel.unary_unary(
|
|
39
|
+
'/schema.v1.Service/ResolveInt',
|
|
40
|
+
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveIntRequest.SerializeToString,
|
|
41
|
+
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveIntResponse.FromString,
|
|
42
|
+
)
|
|
43
|
+
self.ResolveObject = channel.unary_unary(
|
|
44
|
+
'/schema.v1.Service/ResolveObject',
|
|
45
|
+
request_serializer=schema_dot_v1_dot_schema__pb2.ResolveObjectRequest.SerializeToString,
|
|
46
|
+
response_deserializer=schema_dot_v1_dot_schema__pb2.ResolveObjectResponse.FromString,
|
|
47
|
+
)
|
|
48
|
+
self.EventStream = channel.unary_stream(
|
|
49
|
+
'/schema.v1.Service/EventStream',
|
|
50
|
+
request_serializer=schema_dot_v1_dot_schema__pb2.EventStreamRequest.SerializeToString,
|
|
51
|
+
response_deserializer=schema_dot_v1_dot_schema__pb2.EventStreamResponse.FromString,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ServiceServicer(object):
|
|
56
|
+
"""Service defines the exposed rpcs of flagd
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
def ResolveAll(self, request, context):
|
|
60
|
+
"""Missing associated documentation comment in .proto file."""
|
|
61
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
62
|
+
context.set_details('Method not implemented!')
|
|
63
|
+
raise NotImplementedError('Method not implemented!')
|
|
64
|
+
|
|
65
|
+
def ResolveBoolean(self, request, context):
|
|
66
|
+
"""Missing associated documentation comment in .proto file."""
|
|
67
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
68
|
+
context.set_details('Method not implemented!')
|
|
69
|
+
raise NotImplementedError('Method not implemented!')
|
|
70
|
+
|
|
71
|
+
def ResolveString(self, request, context):
|
|
72
|
+
"""Missing associated documentation comment in .proto file."""
|
|
73
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
74
|
+
context.set_details('Method not implemented!')
|
|
75
|
+
raise NotImplementedError('Method not implemented!')
|
|
76
|
+
|
|
77
|
+
def ResolveFloat(self, request, context):
|
|
78
|
+
"""Missing associated documentation comment in .proto file."""
|
|
79
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
80
|
+
context.set_details('Method not implemented!')
|
|
81
|
+
raise NotImplementedError('Method not implemented!')
|
|
82
|
+
|
|
83
|
+
def ResolveInt(self, request, context):
|
|
84
|
+
"""Missing associated documentation comment in .proto file."""
|
|
85
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
86
|
+
context.set_details('Method not implemented!')
|
|
87
|
+
raise NotImplementedError('Method not implemented!')
|
|
88
|
+
|
|
89
|
+
def ResolveObject(self, request, context):
|
|
90
|
+
"""Missing associated documentation comment in .proto file."""
|
|
91
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
92
|
+
context.set_details('Method not implemented!')
|
|
93
|
+
raise NotImplementedError('Method not implemented!')
|
|
94
|
+
|
|
95
|
+
def EventStream(self, request, context):
|
|
96
|
+
"""Missing associated documentation comment in .proto file."""
|
|
97
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
98
|
+
context.set_details('Method not implemented!')
|
|
99
|
+
raise NotImplementedError('Method not implemented!')
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def add_ServiceServicer_to_server(servicer, server):
|
|
103
|
+
rpc_method_handlers = {
|
|
104
|
+
'ResolveAll': grpc.unary_unary_rpc_method_handler(
|
|
105
|
+
servicer.ResolveAll,
|
|
106
|
+
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveAllRequest.FromString,
|
|
107
|
+
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveAllResponse.SerializeToString,
|
|
108
|
+
),
|
|
109
|
+
'ResolveBoolean': grpc.unary_unary_rpc_method_handler(
|
|
110
|
+
servicer.ResolveBoolean,
|
|
111
|
+
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveBooleanRequest.FromString,
|
|
112
|
+
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveBooleanResponse.SerializeToString,
|
|
113
|
+
),
|
|
114
|
+
'ResolveString': grpc.unary_unary_rpc_method_handler(
|
|
115
|
+
servicer.ResolveString,
|
|
116
|
+
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveStringRequest.FromString,
|
|
117
|
+
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveStringResponse.SerializeToString,
|
|
118
|
+
),
|
|
119
|
+
'ResolveFloat': grpc.unary_unary_rpc_method_handler(
|
|
120
|
+
servicer.ResolveFloat,
|
|
121
|
+
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveFloatRequest.FromString,
|
|
122
|
+
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveFloatResponse.SerializeToString,
|
|
123
|
+
),
|
|
124
|
+
'ResolveInt': grpc.unary_unary_rpc_method_handler(
|
|
125
|
+
servicer.ResolveInt,
|
|
126
|
+
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveIntRequest.FromString,
|
|
127
|
+
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveIntResponse.SerializeToString,
|
|
128
|
+
),
|
|
129
|
+
'ResolveObject': grpc.unary_unary_rpc_method_handler(
|
|
130
|
+
servicer.ResolveObject,
|
|
131
|
+
request_deserializer=schema_dot_v1_dot_schema__pb2.ResolveObjectRequest.FromString,
|
|
132
|
+
response_serializer=schema_dot_v1_dot_schema__pb2.ResolveObjectResponse.SerializeToString,
|
|
133
|
+
),
|
|
134
|
+
'EventStream': grpc.unary_stream_rpc_method_handler(
|
|
135
|
+
servicer.EventStream,
|
|
136
|
+
request_deserializer=schema_dot_v1_dot_schema__pb2.EventStreamRequest.FromString,
|
|
137
|
+
response_serializer=schema_dot_v1_dot_schema__pb2.EventStreamResponse.SerializeToString,
|
|
138
|
+
),
|
|
139
|
+
}
|
|
140
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
141
|
+
'schema.v1.Service', rpc_method_handlers)
|
|
142
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# This class is part of an EXPERIMENTAL API.
|
|
146
|
+
class Service(object):
|
|
147
|
+
"""Service defines the exposed rpcs of flagd
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
@staticmethod
|
|
151
|
+
def ResolveAll(request,
|
|
152
|
+
target,
|
|
153
|
+
options=(),
|
|
154
|
+
channel_credentials=None,
|
|
155
|
+
call_credentials=None,
|
|
156
|
+
insecure=False,
|
|
157
|
+
compression=None,
|
|
158
|
+
wait_for_ready=None,
|
|
159
|
+
timeout=None,
|
|
160
|
+
metadata=None):
|
|
161
|
+
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveAll',
|
|
162
|
+
schema_dot_v1_dot_schema__pb2.ResolveAllRequest.SerializeToString,
|
|
163
|
+
schema_dot_v1_dot_schema__pb2.ResolveAllResponse.FromString,
|
|
164
|
+
options, channel_credentials,
|
|
165
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
166
|
+
|
|
167
|
+
@staticmethod
|
|
168
|
+
def ResolveBoolean(request,
|
|
169
|
+
target,
|
|
170
|
+
options=(),
|
|
171
|
+
channel_credentials=None,
|
|
172
|
+
call_credentials=None,
|
|
173
|
+
insecure=False,
|
|
174
|
+
compression=None,
|
|
175
|
+
wait_for_ready=None,
|
|
176
|
+
timeout=None,
|
|
177
|
+
metadata=None):
|
|
178
|
+
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveBoolean',
|
|
179
|
+
schema_dot_v1_dot_schema__pb2.ResolveBooleanRequest.SerializeToString,
|
|
180
|
+
schema_dot_v1_dot_schema__pb2.ResolveBooleanResponse.FromString,
|
|
181
|
+
options, channel_credentials,
|
|
182
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
183
|
+
|
|
184
|
+
@staticmethod
|
|
185
|
+
def ResolveString(request,
|
|
186
|
+
target,
|
|
187
|
+
options=(),
|
|
188
|
+
channel_credentials=None,
|
|
189
|
+
call_credentials=None,
|
|
190
|
+
insecure=False,
|
|
191
|
+
compression=None,
|
|
192
|
+
wait_for_ready=None,
|
|
193
|
+
timeout=None,
|
|
194
|
+
metadata=None):
|
|
195
|
+
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveString',
|
|
196
|
+
schema_dot_v1_dot_schema__pb2.ResolveStringRequest.SerializeToString,
|
|
197
|
+
schema_dot_v1_dot_schema__pb2.ResolveStringResponse.FromString,
|
|
198
|
+
options, channel_credentials,
|
|
199
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
200
|
+
|
|
201
|
+
@staticmethod
|
|
202
|
+
def ResolveFloat(request,
|
|
203
|
+
target,
|
|
204
|
+
options=(),
|
|
205
|
+
channel_credentials=None,
|
|
206
|
+
call_credentials=None,
|
|
207
|
+
insecure=False,
|
|
208
|
+
compression=None,
|
|
209
|
+
wait_for_ready=None,
|
|
210
|
+
timeout=None,
|
|
211
|
+
metadata=None):
|
|
212
|
+
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveFloat',
|
|
213
|
+
schema_dot_v1_dot_schema__pb2.ResolveFloatRequest.SerializeToString,
|
|
214
|
+
schema_dot_v1_dot_schema__pb2.ResolveFloatResponse.FromString,
|
|
215
|
+
options, channel_credentials,
|
|
216
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
217
|
+
|
|
218
|
+
@staticmethod
|
|
219
|
+
def ResolveInt(request,
|
|
220
|
+
target,
|
|
221
|
+
options=(),
|
|
222
|
+
channel_credentials=None,
|
|
223
|
+
call_credentials=None,
|
|
224
|
+
insecure=False,
|
|
225
|
+
compression=None,
|
|
226
|
+
wait_for_ready=None,
|
|
227
|
+
timeout=None,
|
|
228
|
+
metadata=None):
|
|
229
|
+
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveInt',
|
|
230
|
+
schema_dot_v1_dot_schema__pb2.ResolveIntRequest.SerializeToString,
|
|
231
|
+
schema_dot_v1_dot_schema__pb2.ResolveIntResponse.FromString,
|
|
232
|
+
options, channel_credentials,
|
|
233
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
234
|
+
|
|
235
|
+
@staticmethod
|
|
236
|
+
def ResolveObject(request,
|
|
237
|
+
target,
|
|
238
|
+
options=(),
|
|
239
|
+
channel_credentials=None,
|
|
240
|
+
call_credentials=None,
|
|
241
|
+
insecure=False,
|
|
242
|
+
compression=None,
|
|
243
|
+
wait_for_ready=None,
|
|
244
|
+
timeout=None,
|
|
245
|
+
metadata=None):
|
|
246
|
+
return grpc.experimental.unary_unary(request, target, '/schema.v1.Service/ResolveObject',
|
|
247
|
+
schema_dot_v1_dot_schema__pb2.ResolveObjectRequest.SerializeToString,
|
|
248
|
+
schema_dot_v1_dot_schema__pb2.ResolveObjectResponse.FromString,
|
|
249
|
+
options, channel_credentials,
|
|
250
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
251
|
+
|
|
252
|
+
@staticmethod
|
|
253
|
+
def EventStream(request,
|
|
254
|
+
target,
|
|
255
|
+
options=(),
|
|
256
|
+
channel_credentials=None,
|
|
257
|
+
call_credentials=None,
|
|
258
|
+
insecure=False,
|
|
259
|
+
compression=None,
|
|
260
|
+
wait_for_ready=None,
|
|
261
|
+
timeout=None,
|
|
262
|
+
metadata=None):
|
|
263
|
+
return grpc.experimental.unary_stream(request, target, '/schema.v1.Service/EventStream',
|
|
264
|
+
schema_dot_v1_dot_schema__pb2.EventStreamRequest.SerializeToString,
|
|
265
|
+
schema_dot_v1_dot_schema__pb2.EventStreamResponse.FromString,
|
|
266
|
+
options, channel_credentials,
|
|
267
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: sync/v1/sync_service.proto
|
|
4
|
+
"""Generated protocol buffer code."""
|
|
5
|
+
from google.protobuf import descriptor as _descriptor
|
|
6
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
7
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
8
|
+
from google.protobuf.internal import builder as _builder
|
|
9
|
+
# @@protoc_insertion_point(imports)
|
|
10
|
+
|
|
11
|
+
_sym_db = _symbol_database.Default()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1async/v1/sync_service.proto\x12\x07sync.v1\"O\n\x10SyncFlagsRequest\x12\x1f\n\x0bprovider_id\x18\x01 \x01(\tR\nproviderId\x12\x1a\n\x08selector\x18\x02 \x01(\tR\x08selector\"l\n\x11SyncFlagsResponse\x12-\n\x12\x66lag_configuration\x18\x01 \x01(\tR\x11\x66lagConfiguration\x12(\n\x05state\x18\x02 \x01(\x0e\x32\x12.sync.v1.SyncStateR\x05state\"S\n\x14\x46\x65tchAllFlagsRequest\x12\x1f\n\x0bprovider_id\x18\x01 \x01(\tR\nproviderId\x12\x1a\n\x08selector\x18\x02 \x01(\tR\x08selector\"F\n\x15\x46\x65tchAllFlagsResponse\x12-\n\x12\x66lag_configuration\x18\x01 \x01(\tR\x11\x66lagConfiguration*\x92\x01\n\tSyncState\x12\x1a\n\x16SYNC_STATE_UNSPECIFIED\x10\x00\x12\x12\n\x0eSYNC_STATE_ALL\x10\x01\x12\x12\n\x0eSYNC_STATE_ADD\x10\x02\x12\x15\n\x11SYNC_STATE_UPDATE\x10\x03\x12\x15\n\x11SYNC_STATE_DELETE\x10\x04\x12\x13\n\x0fSYNC_STATE_PING\x10\x05\x32\xab\x01\n\x0f\x46lagSyncService\x12\x46\n\tSyncFlags\x12\x19.sync.v1.SyncFlagsRequest\x1a\x1a.sync.v1.SyncFlagsResponse\"\x00\x30\x01\x12P\n\rFetchAllFlags\x12\x1d.sync.v1.FetchAllFlagsRequest\x1a\x1e.sync.v1.FetchAllFlagsResponse\"\x00\x42l\n\x0b\x63om.sync.v1B\x10SyncServiceProtoP\x01Z\x0e\x66lagd/grpcsync\xa2\x02\x03SXX\xaa\x02\x07Sync.V1\xca\x02\x07Sync\\V1\xe2\x02\x13Sync\\V1\\GPBMetadata\xea\x02\x08Sync::V1b\x06proto3')
|
|
17
|
+
|
|
18
|
+
_globals = globals()
|
|
19
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
20
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'sync.v1.sync_service_pb2', _globals)
|
|
21
|
+
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
22
|
+
|
|
23
|
+
DESCRIPTOR._options = None
|
|
24
|
+
DESCRIPTOR._serialized_options = b'\n\013com.sync.v1B\020SyncServiceProtoP\001Z\016flagd/grpcsync\242\002\003SXX\252\002\007Sync.V1\312\002\007Sync\\V1\342\002\023Sync\\V1\\GPBMetadata\352\002\010Sync::V1'
|
|
25
|
+
_globals['_SYNCSTATE']._serialized_start=388
|
|
26
|
+
_globals['_SYNCSTATE']._serialized_end=534
|
|
27
|
+
_globals['_SYNCFLAGSREQUEST']._serialized_start=39
|
|
28
|
+
_globals['_SYNCFLAGSREQUEST']._serialized_end=118
|
|
29
|
+
_globals['_SYNCFLAGSRESPONSE']._serialized_start=120
|
|
30
|
+
_globals['_SYNCFLAGSRESPONSE']._serialized_end=228
|
|
31
|
+
_globals['_FETCHALLFLAGSREQUEST']._serialized_start=230
|
|
32
|
+
_globals['_FETCHALLFLAGSREQUEST']._serialized_end=313
|
|
33
|
+
_globals['_FETCHALLFLAGSRESPONSE']._serialized_start=315
|
|
34
|
+
_globals['_FETCHALLFLAGSRESPONSE']._serialized_end=385
|
|
35
|
+
_globals['_FLAGSYNCSERVICE']._serialized_start=537
|
|
36
|
+
_globals['_FLAGSYNCSERVICE']._serialized_end=708
|
|
37
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
|
|
5
|
+
from sync.v1 import sync_service_pb2 as sync_dot_v1_dot_sync__service__pb2
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FlagSyncServiceStub(object):
|
|
9
|
+
"""FlagService implements a server streaming to provide realtime flag configurations
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
def __init__(self, channel):
|
|
13
|
+
"""Constructor.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
channel: A grpc.Channel.
|
|
17
|
+
"""
|
|
18
|
+
self.SyncFlags = channel.unary_stream(
|
|
19
|
+
'/sync.v1.FlagSyncService/SyncFlags',
|
|
20
|
+
request_serializer=sync_dot_v1_dot_sync__service__pb2.SyncFlagsRequest.SerializeToString,
|
|
21
|
+
response_deserializer=sync_dot_v1_dot_sync__service__pb2.SyncFlagsResponse.FromString,
|
|
22
|
+
)
|
|
23
|
+
self.FetchAllFlags = channel.unary_unary(
|
|
24
|
+
'/sync.v1.FlagSyncService/FetchAllFlags',
|
|
25
|
+
request_serializer=sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsRequest.SerializeToString,
|
|
26
|
+
response_deserializer=sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsResponse.FromString,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class FlagSyncServiceServicer(object):
|
|
31
|
+
"""FlagService implements a server streaming to provide realtime flag configurations
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def SyncFlags(self, request, context):
|
|
35
|
+
"""Missing associated documentation comment in .proto file."""
|
|
36
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
37
|
+
context.set_details('Method not implemented!')
|
|
38
|
+
raise NotImplementedError('Method not implemented!')
|
|
39
|
+
|
|
40
|
+
def FetchAllFlags(self, request, context):
|
|
41
|
+
"""Missing associated documentation comment in .proto file."""
|
|
42
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
43
|
+
context.set_details('Method not implemented!')
|
|
44
|
+
raise NotImplementedError('Method not implemented!')
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def add_FlagSyncServiceServicer_to_server(servicer, server):
|
|
48
|
+
rpc_method_handlers = {
|
|
49
|
+
'SyncFlags': grpc.unary_stream_rpc_method_handler(
|
|
50
|
+
servicer.SyncFlags,
|
|
51
|
+
request_deserializer=sync_dot_v1_dot_sync__service__pb2.SyncFlagsRequest.FromString,
|
|
52
|
+
response_serializer=sync_dot_v1_dot_sync__service__pb2.SyncFlagsResponse.SerializeToString,
|
|
53
|
+
),
|
|
54
|
+
'FetchAllFlags': grpc.unary_unary_rpc_method_handler(
|
|
55
|
+
servicer.FetchAllFlags,
|
|
56
|
+
request_deserializer=sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsRequest.FromString,
|
|
57
|
+
response_serializer=sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsResponse.SerializeToString,
|
|
58
|
+
),
|
|
59
|
+
}
|
|
60
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
61
|
+
'sync.v1.FlagSyncService', rpc_method_handlers)
|
|
62
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# This class is part of an EXPERIMENTAL API.
|
|
66
|
+
class FlagSyncService(object):
|
|
67
|
+
"""FlagService implements a server streaming to provide realtime flag configurations
|
|
68
|
+
"""
|
|
69
|
+
|
|
70
|
+
@staticmethod
|
|
71
|
+
def SyncFlags(request,
|
|
72
|
+
target,
|
|
73
|
+
options=(),
|
|
74
|
+
channel_credentials=None,
|
|
75
|
+
call_credentials=None,
|
|
76
|
+
insecure=False,
|
|
77
|
+
compression=None,
|
|
78
|
+
wait_for_ready=None,
|
|
79
|
+
timeout=None,
|
|
80
|
+
metadata=None):
|
|
81
|
+
return grpc.experimental.unary_stream(request, target, '/sync.v1.FlagSyncService/SyncFlags',
|
|
82
|
+
sync_dot_v1_dot_sync__service__pb2.SyncFlagsRequest.SerializeToString,
|
|
83
|
+
sync_dot_v1_dot_sync__service__pb2.SyncFlagsResponse.FromString,
|
|
84
|
+
options, channel_credentials,
|
|
85
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
86
|
+
|
|
87
|
+
@staticmethod
|
|
88
|
+
def FetchAllFlags(request,
|
|
89
|
+
target,
|
|
90
|
+
options=(),
|
|
91
|
+
channel_credentials=None,
|
|
92
|
+
call_credentials=None,
|
|
93
|
+
insecure=False,
|
|
94
|
+
compression=None,
|
|
95
|
+
wait_for_ready=None,
|
|
96
|
+
timeout=None,
|
|
97
|
+
metadata=None):
|
|
98
|
+
return grpc.experimental.unary_unary(request, target, '/sync.v1.FlagSyncService/FetchAllFlags',
|
|
99
|
+
sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsRequest.SerializeToString,
|
|
100
|
+
sync_dot_v1_dot_sync__service__pb2.FetchAllFlagsResponse.FromString,
|
|
101
|
+
options, channel_credentials,
|
|
102
|
+
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
24
|
import typing
|
|
25
|
-
from numbers import Number
|
|
26
25
|
|
|
27
26
|
import grpc
|
|
28
27
|
from google.protobuf.struct_pb2 import Struct
|
|
@@ -35,137 +34,128 @@ from openfeature.exception import (
|
|
|
35
34
|
ParseError,
|
|
36
35
|
TypeMismatchError,
|
|
37
36
|
)
|
|
38
|
-
from openfeature.flag_evaluation import
|
|
37
|
+
from openfeature.flag_evaluation import FlagResolutionDetails
|
|
38
|
+
from openfeature.provider.metadata import Metadata
|
|
39
39
|
from openfeature.provider.provider import AbstractProvider
|
|
40
40
|
|
|
41
|
-
from .
|
|
41
|
+
from .config import Config
|
|
42
42
|
from .flag_type import FlagType
|
|
43
43
|
from .proto.schema.v1 import schema_pb2, schema_pb2_grpc
|
|
44
44
|
|
|
45
|
+
T = typing.TypeVar("T")
|
|
46
|
+
|
|
45
47
|
|
|
46
48
|
class FlagdProvider(AbstractProvider):
|
|
47
49
|
"""Flagd OpenFeature Provider"""
|
|
48
50
|
|
|
49
51
|
def __init__(
|
|
50
52
|
self,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
timeout: int = Defaults.TIMEOUT,
|
|
53
|
+
host: typing.Optional[str] = None,
|
|
54
|
+
port: typing.Optional[int] = None,
|
|
55
|
+
tls: typing.Optional[bool] = None,
|
|
56
|
+
timeout: typing.Optional[int] = None,
|
|
56
57
|
):
|
|
57
58
|
"""
|
|
58
59
|
Create an instance of the FlagdProvider
|
|
59
60
|
|
|
60
|
-
:param name: the name of the provider to be stored in metadata
|
|
61
|
-
:param schema: the schema for the transport protocol, e.g. 'http', 'https'
|
|
62
61
|
:param host: the host to make requests to
|
|
63
62
|
:param port: the port the flagd service is available on
|
|
63
|
+
:param tls: enable/disable secure TLS connectivity
|
|
64
64
|
:param timeout: the maximum to wait before a request times out
|
|
65
65
|
"""
|
|
66
|
-
self.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
channel_factory = (
|
|
73
|
-
grpc.insecure_channel if schema == "http" else grpc.secure_channel
|
|
66
|
+
self.config = Config(
|
|
67
|
+
host=host,
|
|
68
|
+
port=port,
|
|
69
|
+
tls=tls,
|
|
70
|
+
timeout=timeout,
|
|
74
71
|
)
|
|
75
|
-
|
|
72
|
+
|
|
73
|
+
channel_factory = grpc.secure_channel if tls else grpc.insecure_channel
|
|
74
|
+
self.channel = channel_factory(f"{self.config.host}:{self.config.port}")
|
|
76
75
|
self.stub = schema_pb2_grpc.ServiceStub(self.channel)
|
|
77
76
|
|
|
78
|
-
def shutdown(self):
|
|
77
|
+
def shutdown(self) -> None:
|
|
79
78
|
self.channel.close()
|
|
80
79
|
|
|
81
|
-
def get_metadata(self):
|
|
80
|
+
def get_metadata(self) -> Metadata:
|
|
82
81
|
"""Returns provider metadata"""
|
|
83
|
-
return
|
|
84
|
-
"name": self.get_name(),
|
|
85
|
-
"schema": self.schema,
|
|
86
|
-
"host": self.host,
|
|
87
|
-
"port": self.port,
|
|
88
|
-
"timeout": self.timeout,
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
def get_name(self) -> str:
|
|
92
|
-
"""Returns provider name"""
|
|
93
|
-
return self.provider_name
|
|
82
|
+
return Metadata(name="FlagdProvider")
|
|
94
83
|
|
|
95
84
|
def resolve_boolean_details(
|
|
96
85
|
self,
|
|
97
86
|
key: str,
|
|
98
87
|
default_value: bool,
|
|
99
|
-
evaluation_context: EvaluationContext = None,
|
|
100
|
-
):
|
|
88
|
+
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
89
|
+
) -> FlagResolutionDetails[bool]:
|
|
101
90
|
return self._resolve(key, FlagType.BOOLEAN, default_value, evaluation_context)
|
|
102
91
|
|
|
103
92
|
def resolve_string_details(
|
|
104
93
|
self,
|
|
105
94
|
key: str,
|
|
106
95
|
default_value: str,
|
|
107
|
-
evaluation_context: EvaluationContext = None,
|
|
108
|
-
):
|
|
96
|
+
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
97
|
+
) -> FlagResolutionDetails[str]:
|
|
109
98
|
return self._resolve(key, FlagType.STRING, default_value, evaluation_context)
|
|
110
99
|
|
|
111
100
|
def resolve_float_details(
|
|
112
101
|
self,
|
|
113
102
|
key: str,
|
|
114
|
-
default_value:
|
|
115
|
-
evaluation_context: EvaluationContext = None,
|
|
116
|
-
):
|
|
103
|
+
default_value: float,
|
|
104
|
+
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
105
|
+
) -> FlagResolutionDetails[float]:
|
|
117
106
|
return self._resolve(key, FlagType.FLOAT, default_value, evaluation_context)
|
|
118
107
|
|
|
119
108
|
def resolve_integer_details(
|
|
120
109
|
self,
|
|
121
110
|
key: str,
|
|
122
|
-
default_value:
|
|
123
|
-
evaluation_context: EvaluationContext = None,
|
|
124
|
-
):
|
|
111
|
+
default_value: int,
|
|
112
|
+
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
113
|
+
) -> FlagResolutionDetails[int]:
|
|
125
114
|
return self._resolve(key, FlagType.INTEGER, default_value, evaluation_context)
|
|
126
115
|
|
|
127
116
|
def resolve_object_details(
|
|
128
117
|
self,
|
|
129
118
|
key: str,
|
|
130
119
|
default_value: typing.Union[dict, list],
|
|
131
|
-
evaluation_context: EvaluationContext = None,
|
|
132
|
-
):
|
|
120
|
+
evaluation_context: typing.Optional[EvaluationContext] = None,
|
|
121
|
+
) -> FlagResolutionDetails[typing.Union[dict, list]]:
|
|
133
122
|
return self._resolve(key, FlagType.OBJECT, default_value, evaluation_context)
|
|
134
123
|
|
|
135
124
|
def _resolve(
|
|
136
125
|
self,
|
|
137
126
|
flag_key: str,
|
|
138
127
|
flag_type: FlagType,
|
|
139
|
-
default_value:
|
|
140
|
-
evaluation_context: EvaluationContext,
|
|
141
|
-
):
|
|
128
|
+
default_value: T,
|
|
129
|
+
evaluation_context: typing.Optional[EvaluationContext],
|
|
130
|
+
) -> FlagResolutionDetails[T]:
|
|
142
131
|
context = self._convert_context(evaluation_context)
|
|
132
|
+
call_args = {"timeout": self.config.timeout}
|
|
143
133
|
try:
|
|
144
134
|
if flag_type == FlagType.BOOLEAN:
|
|
145
|
-
request = schema_pb2.ResolveBooleanRequest(
|
|
135
|
+
request = schema_pb2.ResolveBooleanRequest( # type:ignore[attr-defined]
|
|
146
136
|
flag_key=flag_key, context=context
|
|
147
137
|
)
|
|
148
|
-
response = self.stub.ResolveBoolean(request)
|
|
138
|
+
response = self.stub.ResolveBoolean(request, **call_args)
|
|
149
139
|
elif flag_type == FlagType.STRING:
|
|
150
|
-
request = schema_pb2.ResolveStringRequest(
|
|
140
|
+
request = schema_pb2.ResolveStringRequest( # type:ignore[attr-defined]
|
|
151
141
|
flag_key=flag_key, context=context
|
|
152
142
|
)
|
|
153
|
-
response = self.stub.ResolveString(request)
|
|
143
|
+
response = self.stub.ResolveString(request, **call_args)
|
|
154
144
|
elif flag_type == FlagType.OBJECT:
|
|
155
|
-
request = schema_pb2.ResolveObjectRequest(
|
|
145
|
+
request = schema_pb2.ResolveObjectRequest( # type:ignore[attr-defined]
|
|
156
146
|
flag_key=flag_key, context=context
|
|
157
147
|
)
|
|
158
|
-
response = self.stub.ResolveObject(request)
|
|
148
|
+
response = self.stub.ResolveObject(request, **call_args)
|
|
159
149
|
elif flag_type == FlagType.FLOAT:
|
|
160
|
-
request = schema_pb2.ResolveFloatRequest(
|
|
150
|
+
request = schema_pb2.ResolveFloatRequest( # type:ignore[attr-defined]
|
|
161
151
|
flag_key=flag_key, context=context
|
|
162
152
|
)
|
|
163
|
-
response = self.stub.ResolveFloat(request)
|
|
153
|
+
response = self.stub.ResolveFloat(request, **call_args)
|
|
164
154
|
elif flag_type == FlagType.INTEGER:
|
|
165
|
-
request = schema_pb2.ResolveIntRequest(
|
|
155
|
+
request = schema_pb2.ResolveIntRequest( # type:ignore[attr-defined]
|
|
166
156
|
flag_key=flag_key, context=context
|
|
167
157
|
)
|
|
168
|
-
response = self.stub.ResolveInt(request)
|
|
158
|
+
response = self.stub.ResolveInt(request, **call_args)
|
|
169
159
|
else:
|
|
170
160
|
raise ValueError(f"Unknown flag type: {flag_type}")
|
|
171
161
|
|
|
@@ -182,17 +172,19 @@ class FlagdProvider(AbstractProvider):
|
|
|
182
172
|
raise GeneralError(message) from e
|
|
183
173
|
|
|
184
174
|
# Got a valid flag and valid type. Return it.
|
|
185
|
-
return
|
|
186
|
-
flag_key=flag_key,
|
|
175
|
+
return FlagResolutionDetails(
|
|
187
176
|
value=response.value,
|
|
188
177
|
reason=response.reason,
|
|
189
178
|
variant=response.variant,
|
|
190
179
|
)
|
|
191
180
|
|
|
192
|
-
def _convert_context(
|
|
181
|
+
def _convert_context(
|
|
182
|
+
self, evaluation_context: typing.Optional[EvaluationContext]
|
|
183
|
+
) -> Struct:
|
|
193
184
|
s = Struct()
|
|
194
185
|
if evaluation_context:
|
|
195
186
|
try:
|
|
187
|
+
s["targetingKey"] = evaluation_context.targeting_key
|
|
196
188
|
s.update(evaluation_context.attributes)
|
|
197
189
|
except ValueError as exc:
|
|
198
190
|
message = (
|
{openfeature_provider_flagd-0.1.2.dist-info → openfeature_provider_flagd-0.1.4.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: openfeature-provider-flagd
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: OpenFeature provider for the flagd flag evaluation engine
|
|
5
5
|
Project-URL: Homepage, https://github.com/open-feature/python-sdk-contrib
|
|
6
6
|
Author-email: OpenFeature <openfeature-core@groups.io>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
openfeature/contrib/provider/flagd/__init__.py,sha256=WlrcPaCH31dEG1IvrvpeuhAaQ8Ni8LEzDpNM_x-qKOA,65
|
|
2
|
+
openfeature/contrib/provider/flagd/config.py,sha256=8Oguwoe4V6FffdNNBfhWev2G8UjKsNYCuc_j3SGEb0Y,987
|
|
3
|
+
openfeature/contrib/provider/flagd/flag_type.py,sha256=rZYfmqQEmtqVVTb8e-d8Wt8ZCnHtf7xPSmYxyU8w0R0,158
|
|
4
|
+
openfeature/contrib/provider/flagd/provider.py,sha256=0hXxolWFUVue-6OgrC1kXa64B-bbmvc6ZtqAyexDHIc,7093
|
|
5
|
+
openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2.py,sha256=W0Vgg8z7nEg_HTlAJkO6pu5nBcR8Ls3yoIykboavLRI,7704
|
|
6
|
+
openfeature/contrib/provider/flagd/proto/flagd/evaluation/v1/evaluation_pb2_grpc.py,sha256=GTKQXbUfRrquUG5o11N7ymhFnOuzh9_hcToZ9-cjOtA,13339
|
|
7
|
+
openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2.py,sha256=zUu_-V6DhHH5ZekWVsxKjGkUwkJrRrhqyXj8oX-Jo_g,3205
|
|
8
|
+
openfeature/contrib/provider/flagd/proto/flagd/sync/v1/sync_pb2_grpc.py,sha256=JNBei4U6aYtxeWU7h9s57yA4DL9ECnOyEbR9iGLoXmE,6155
|
|
9
|
+
openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2.py,sha256=onIastnVdAUCc8ez1zwniq6yJj-zeLEdllet_kX1qn8,7337
|
|
10
|
+
openfeature/contrib/provider/flagd/proto/schema/v1/schema_pb2_grpc.py,sha256=nllthJYfwhDBZHH_eGfSHesNbO6rJEZ0vXKyTFFy4AA,12393
|
|
11
|
+
openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2.py,sha256=uKBjB_lpfHN3r8wsjmqnQEBLtN9gw8zPmvWfWKsOYAE,2954
|
|
12
|
+
openfeature/contrib/provider/flagd/proto/sync/v1/sync_service_pb2_grpc.py,sha256=v5MSyyIOpE68EYWjsbdAq677gnD4jdNeLhMAB7EveNQ,4424
|
|
13
|
+
openfeature_provider_flagd-0.1.4.dist-info/METADATA,sha256=wtW6iavradbR6Y1d66M-SFcsMv8zjwQ5ylY4udCd8fs,14518
|
|
14
|
+
openfeature_provider_flagd-0.1.4.dist-info/WHEEL,sha256=uNdcs2TADwSd5pVaP0Z_kcjcvvTUklh2S7bxZMF8Uj0,87
|
|
15
|
+
openfeature_provider_flagd-0.1.4.dist-info/licenses/LICENSE,sha256=h8jwqxShIeVkc8vOo9ynxGYW16f4fVPxLhZKZs0H5U8,11350
|
|
16
|
+
openfeature_provider_flagd-0.1.4.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
openfeature/contrib/provider/flagd/__init__.py,sha256=WlrcPaCH31dEG1IvrvpeuhAaQ8Ni8LEzDpNM_x-qKOA,65
|
|
2
|
-
openfeature/contrib/provider/flagd/defaults.py,sha256=OeTt08wp_GUzpUetEJQvhSBGk9u4gTzACILQVqicbUw,102
|
|
3
|
-
openfeature/contrib/provider/flagd/flag_type.py,sha256=rZYfmqQEmtqVVTb8e-d8Wt8ZCnHtf7xPSmYxyU8w0R0,158
|
|
4
|
-
openfeature/contrib/provider/flagd/provider.py,sha256=2CZxQNJfcP8S5UJgDfwp6Q-znHRRaBpP7W7sGNS5lqk,6779
|
|
5
|
-
openfeature_provider_flagd-0.1.2.dist-info/METADATA,sha256=r0nrl0I3ZUvlCpEDzXd8Mk-t9UPaFrp_jN7GrWO47tw,14518
|
|
6
|
-
openfeature_provider_flagd-0.1.2.dist-info/WHEEL,sha256=TJPnKdtrSue7xZ_AVGkp9YXcvDrobsjBds1du3Nx6dc,87
|
|
7
|
-
openfeature_provider_flagd-0.1.2.dist-info/licenses/LICENSE,sha256=h8jwqxShIeVkc8vOo9ynxGYW16f4fVPxLhZKZs0H5U8,11350
|
|
8
|
-
openfeature_provider_flagd-0.1.2.dist-info/RECORD,,
|
|
File without changes
|