Subham-KRLX commented on code in PR #64591:
URL: https://github.com/apache/airflow/pull/64591#discussion_r3213293587
##########
providers/zendesk/src/airflow/providers/zendesk/hooks/zendesk.py:
##########
@@ -43,54 +60,159 @@ class ZendeskHook(BaseHook):
@classmethod
def get_ui_field_behaviour(cls) -> dict[str, Any]:
+ """Relabel fields for the Connection UI."""
return {
"hidden_fields": ["schema", "port", "extra"],
- "relabeling": {"host": "Zendesk domain", "login": "Zendesk email"},
+ "relabeling": {
+ "host": "Zendesk domain",
+ "login": "Zendesk email",
+ "password": "Password / API token",
+ },
+ }
+
+ @classmethod
+ def get_connection_form_widgets(cls) -> dict[str, Any]:
+ """Add custom widgets for the Connection UI."""
+ from flask_appbuilder.fieldwidgets import BS3PasswordFieldWidget
+ from wtforms import BooleanField, StringField
+
+ return {
+ "use_token": BooleanField(
+ "Use Token", description="If enabled, the password field is
treated as an API token."
+ ),
+ "token": StringField(
+ "API Token",
+ widget=BS3PasswordFieldWidget(),
+ description="Zendesk API token (alternative to password
field).",
+ ),
+ "oauth_token": StringField(
+ "OAuth Token",
+ widget=BS3PasswordFieldWidget(),
+ description="Zendesk OAuth token.",
+ ),
}
def __init__(self, zendesk_conn_id: str = default_conn_name) -> None:
super().__init__()
self.zendesk_conn_id = zendesk_conn_id
self.base_api: BaseApi | None = None
- zenpy_client, url = self._init_conn()
- self.zenpy_client = zenpy_client
- self.__url = url
- self.get = self.zenpy_client.users._get
+ self._url: str = ""
Review Comment:
@Lee-W
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]