Skip to content

Commit a6df3c0

Browse files
committed
sdk working prototype
1 parent 42f67cc commit a6df3c0

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

azure_functions_worker/bindings/datumdef.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ def from_typed_data(cls, td: protos.TypedData):
9393
val = td.collection_string
9494
elif tt == 'collection_sint64':
9595
val = td.collection_sint64
96+
elif tt == 'model_binding_data':
97+
val = td.model_binding_data
9698
elif tt is None:
9799
return None
98100
else:

azure_functions_worker/bindings/generic.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ def decode(cls, data: datumdef.Datum, *, trigger_metadata) -> typing.Any:
4242
result = data.value
4343
elif data_type == 'json':
4444
result = data.value
45+
elif data_type == 'model_binding_data':
46+
result = data.value
4547
else:
4648
raise ValueError(
4749
f'unexpected type of data received for the "generic" binding '

azure_functions_worker/loader.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,18 @@ def uninstall() -> None:
5858
def build_binding_protos(indexed_function) -> Dict:
5959
binding_protos = {}
6060
for binding in indexed_function.get_bindings():
61-
binding_protos[binding.name] = protos.BindingInfo(
62-
type=binding.type,
63-
data_type=binding.data_type,
64-
direction=binding.direction)
61+
if binding.type == "blob":
62+
binding_protos[binding.name] = protos.BindingInfo(
63+
type=binding.type,
64+
data_type=binding.data_type,
65+
direction=binding.direction,
66+
properties={"SupportsDeferredBinding": "true"})
67+
else:
68+
binding_protos[binding.name] = protos.BindingInfo(
69+
type=binding.type,
70+
data_type=binding.data_type,
71+
direction=binding.direction,
72+
properties={"SupportsDeferredBinding": "false"})
6573

6674
return binding_protos
6775

0 commit comments

Comments
 (0)