Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion airflow/providers/samba/hooks/samba.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import posixpath
from functools import wraps
from shutil import copyfileobj
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any

import smbclient

Expand Down Expand Up @@ -249,3 +249,11 @@ def push_from_local(self, destination_filepath: str, local_filepath: str):
"""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"},
}
44 changes: 44 additions & 0 deletions docs/apache-airflow-providers-samba/connections.rst
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions docs/apache-airflow-providers-samba/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
:maxdepth: 1
:caption: Guides

Connection types <connections>
GCSToSambaOperator types <transfer/gcs_to_samba>

.. toctree::
Expand Down