Skip to content

Commit

Permalink
change sasl paasword parameter type to PasswordParameterType
Browse files Browse the repository at this point in the history
  • Loading branch information
msaipraneeth committed Dec 30, 2023
1 parent 8c5dfee commit de230cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions cmem_plugin_kafka/workflow/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from cmem_plugin_base.dataintegration.description import Plugin, PluginParameter
from cmem_plugin_base.dataintegration.entity import Entities
from cmem_plugin_base.dataintegration.parameter.choice import ChoiceParameterType
from cmem_plugin_base.dataintegration.parameter.password import Password, PasswordParameterType
from cmem_plugin_base.dataintegration.plugins import WorkflowPlugin
from cmem_plugin_base.dataintegration.types import BoolParameterType, IntParameterType
from cmem_plugin_base.dataintegration.utils import setup_cmempy_user_access, split_task_id
Expand Down Expand Up @@ -98,6 +99,7 @@
PluginParameter(
name="sasl_password",
label="SASL Password",
param_type=PasswordParameterType(),
advanced=True,
default_value="",
description=SASL_PASSWORD_DESCRIPTION,
Expand Down Expand Up @@ -160,7 +162,7 @@ def __init__( # noqa: PLR0913
security_protocol: str,
sasl_mechanisms: str,
sasl_username: str,
sasl_password: str,
sasl_password: str | Password,
kafka_topic: str,
auto_offset_reset: str,
group_id: str = "",
Expand All @@ -176,7 +178,9 @@ def __init__( # noqa: PLR0913
self.security_protocol = security_protocol
self.sasl_mechanisms = sasl_mechanisms
self.sasl_username = sasl_username
self.sasl_password = sasl_password
self.sasl_password = (
sasl_password if isinstance(sasl_password, str) else sasl_password.decrypt()
)
self.kafka_topic = kafka_topic
self.group_id = group_id
self.auto_offset_reset = auto_offset_reset
Expand Down
8 changes: 6 additions & 2 deletions cmem_plugin_kafka/workflow/producer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from cmem_plugin_base.dataintegration.description import Plugin, PluginParameter
from cmem_plugin_base.dataintegration.entity import Entities
from cmem_plugin_base.dataintegration.parameter.choice import ChoiceParameterType
from cmem_plugin_base.dataintegration.parameter.password import Password, PasswordParameterType
from cmem_plugin_base.dataintegration.plugins import WorkflowPlugin
from cmem_plugin_base.dataintegration.types import IntParameterType
from confluent_kafka import KafkaError
Expand Down Expand Up @@ -122,6 +123,7 @@
PluginParameter(
name="sasl_password",
label="SASL Password",
param_type=PasswordParameterType(),
advanced=True,
default_value="",
description=SASL_PASSWORD_DESCRIPTION,
Expand Down Expand Up @@ -161,7 +163,7 @@ def __init__( # noqa: PLR0913
security_protocol: str,
sasl_mechanisms: str,
sasl_username: str,
sasl_password: str,
sasl_password: str | Password,
kafka_topic: str,
client_id: str = "",
message_max_bytes: str = "1048576",
Expand All @@ -174,7 +176,9 @@ def __init__( # noqa: PLR0913
self.security_protocol = security_protocol
self.sasl_mechanisms = sasl_mechanisms
self.sasl_username = sasl_username
self.sasl_password = sasl_password
self.sasl_password = (
sasl_password if isinstance(sasl_password, str) else sasl_password.decrypt()
)
self.kafka_topic = kafka_topic
self.client_id = client_id
self.message_max_bytes = message_max_bytes
Expand Down

0 comments on commit de230cc

Please sign in to comment.