From 92c83e76d59e02171df86b01e6ee4f2c27f3ce0a Mon Sep 17 00:00:00 2001 From: Robert Yokota Date: Tue, 7 Jan 2025 10:41:50 -0800 Subject: [PATCH] Add comments to CSFLE consumer examples (#1893) --- examples/avro_consumer_encryption.py | 7 ++++++- examples/json_consumer_encryption.py | 7 ++++++- examples/protobuf_consumer_encryption.py | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/examples/avro_consumer_encryption.py b/examples/avro_consumer_encryption.py index f5a931339..b49d7bdad 100644 --- a/examples/avro_consumer_encryption.py +++ b/examples/avro_consumer_encryption.py @@ -98,10 +98,15 @@ def main(args): sr_conf = {'url': args.schema_registry} schema_registry_client = SchemaRegistryClient(sr_conf) + rule_conf = None + # KMS credentials can be passed as follows + # rule_conf = {'secret.access.key': 'xxx', 'access.key.id': 'yyy'} + # Alternatively, the KMS credentials can be set via environment variables avro_deserializer = AvroDeserializer(schema_registry_client, schema_str, - dict_to_user) + dict_to_user, + rule_conf=rule_conf) consumer_conf = {'bootstrap.servers': args.bootstrap_servers, 'group.id': args.group, diff --git a/examples/json_consumer_encryption.py b/examples/json_consumer_encryption.py index 5b604b0dc..660fcc94e 100644 --- a/examples/json_consumer_encryption.py +++ b/examples/json_consumer_encryption.py @@ -95,10 +95,15 @@ def main(args): sr_conf = {'url': args.schema_registry} schema_registry_client = SchemaRegistryClient(sr_conf) + rule_conf = None + # KMS credentials can be passed as follows + # rule_conf = {'secret.access.key': 'xxx', 'access.key.id': 'yyy'} + # Alternatively, the KMS credentials can be set via environment variables json_deserializer = JSONDeserializer(schema_str, dict_to_user, - schema_registry_client) + schema_registry_client, + rule_conf=rule_conf) consumer_conf = {'bootstrap.servers': args.bootstrap_servers, 'group.id': args.group, diff --git a/examples/protobuf_consumer_encryption.py b/examples/protobuf_consumer_encryption.py index 94fc565a2..281868a13 100644 --- a/examples/protobuf_consumer_encryption.py +++ b/examples/protobuf_consumer_encryption.py @@ -69,10 +69,15 @@ def main(args): sr_conf = {'url': args.schema_registry} schema_registry_client = SchemaRegistryClient(sr_conf) + rule_conf = None + # KMS credentials can be passed as follows + # rule_conf = {'secret.access.key': 'xxx', 'access.key.id': 'yyy'} + # Alternatively, the KMS credentials can be set via environment variables protobuf_deserializer = ProtobufDeserializer(user_pb2.User, {'use.deprecated.format': False}, - schema_registry_client) + schema_registry_client, + rule_conf=rule_conf) consumer_conf = {'bootstrap.servers': args.bootstrap_servers, 'group.id': args.group,