This is an automated email from the ASF dual-hosted git repository.

eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 3f738d19ee Add docs and user-friendly connection form for Samba 
connection (#36543)
3f738d19ee is described below

commit 3f738d19ee8122eb81a4a410232f071547a8cb8f
Author: shohamy7 <[email protected]>
AuthorDate: Wed Jan 3 09:01:46 2024 +0200

    Add docs and user-friendly connection form for Samba connection (#36543)
---
 airflow/providers/samba/hooks/samba.py             | 10 ++++-
 .../apache-airflow-providers-samba/connections.rst | 44 ++++++++++++++++++++++
 docs/apache-airflow-providers-samba/index.rst      |  1 +
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/airflow/providers/samba/hooks/samba.py 
b/airflow/providers/samba/hooks/samba.py
index 5cce4c8d92..e4745be6ce 100644
--- a/airflow/providers/samba/hooks/samba.py
+++ b/airflow/providers/samba/hooks/samba.py
@@ -20,7 +20,7 @@ from __future__ import annotations
 import posixpath
 from functools import wraps
 from shutil import copyfileobj
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Any
 
 import smbclient
 
@@ -249,3 +249,11 @@ class SambaHook(BaseHook):
         """Push local file to samba server."""
         with open(local_filepath, "rb") as f, 
self.open_file(destination_filepath, mode="wb") as g:
             copyfileobj(f, g)
+
+    @classmethod
+    def get_ui_field_behaviour(cls) -> dict[str, Any]:
+        """Returns custom field behaviour."""
+        return {
+            "hidden_fields": ["extra"],
+            "relabeling": {"schema": "Share"},
+        }
diff --git a/docs/apache-airflow-providers-samba/connections.rst 
b/docs/apache-airflow-providers-samba/connections.rst
new file mode 100644
index 0000000000..e49477cc14
--- /dev/null
+++ b/docs/apache-airflow-providers-samba/connections.rst
@@ -0,0 +1,44 @@
+ .. Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+Samba Connection
+=================
+
+The Samba connection type enables connection to Samba server.
+
+Default Connection IDs
+----------------------
+
+Samba Hook uses parameter ``samba_conn_id`` for Connection IDs and the value 
of the
+parameter as ``samba_default`` by default.
+
+Configuring the Connection
+--------------------------
+Host
+    The host of the Samba server.
+
+Port
+    Specify the port to use for connecting the Samba server (default port is 
``445``).
+
+Share
+    The default share that will be used in case it is not specified in the 
``SambaHook``.
+
+Login
+    The user that will be used for authentication against the Samba server.
+
+Password
+    The password of the user that will be used for authentication against the 
Samba server.
diff --git a/docs/apache-airflow-providers-samba/index.rst 
b/docs/apache-airflow-providers-samba/index.rst
index f5393fb52f..56441d010b 100644
--- a/docs/apache-airflow-providers-samba/index.rst
+++ b/docs/apache-airflow-providers-samba/index.rst
@@ -34,6 +34,7 @@
     :maxdepth: 1
     :caption: Guides
 
+    Connection types <connections>
     GCSToSambaOperator types <transfer/gcs_to_samba>
 
 .. toctree::

Reply via email to