You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/07 17:59:48 UTC

[GitHub] [airflow] ephraimbuddy commented on a change in pull request #15159: Add dynamic connection fields to Azure Connection

ephraimbuddy commented on a change in pull request #15159:
URL: https://github.com/apache/airflow/pull/15159#discussion_r608875129



##########
File path: airflow/providers/microsoft/azure/hooks/wasb.py
##########
@@ -57,6 +57,50 @@ class WasbHook(BaseHook):
     conn_type = 'wasb'
     hook_name = 'Azure Blob Storage'
 
+    @staticmethod
+    def get_connection_form_widgets() -> Dict[str, Any]:
+        """Returns connection widgets to add to connection form"""
+        from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
+        from flask_babel import lazy_gettext
+        from wtforms import StringField
+
+        return {
+            "extra__wasb__connection_string": StringField(
+                lazy_gettext('Blob Storage Connection String (optional)'), widget=BS3TextFieldWidget()
+            ),
+            "extra__wasb__shared_access_key": StringField(
+                lazy_gettext('Blob Storage Shared Access Key (optional)'), widget=BS3TextFieldWidget()
+            ),
+            "extra__wasb__tenant_id": StringField(
+                lazy_gettext('Tenant Id (Active Directory Auth)'), widget=BS3TextFieldWidget()
+            ),
+            "extra__wasb__sas_token": StringField(
+                lazy_gettext('SAS Token (optional)'), widget=BS3TextFieldWidget()
+            ),
+        }
+
+    @staticmethod
+    def get_ui_field_behaviour() -> Dict:
+        """Returns custom field behaviour"""
+        return {
+            "hidden_fields": ['schema', 'port', 'host'],
+            "relabeling": {
+                'login': 'Blob Storage Login (optional)',
+                'password': 'Blob Storage Token (optional)',

Review comment:
       ```suggestion
                   'password': 'Blob Storage Key (optional)',
   ```
   Should we use `Key` instead of `Token`? Considering that users might mistake it for SAS token?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org