| :py:mod:`airflow.providers.microsoft.azure.hooks.fileshare` |
| =========================================================== |
| |
| .. py:module:: airflow.providers.microsoft.azure.hooks.fileshare |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.providers.microsoft.azure.hooks.fileshare.AzureFileShareHook |
| |
| |
| |
| |
| .. py:class:: AzureFileShareHook(azure_fileshare_conn_id = 'azure_fileshare_default') |
| |
| Bases: :py:obj:`airflow.hooks.base.BaseHook` |
| |
| Interacts with Azure FileShare Storage. |
| |
| :param azure_fileshare_conn_id: Reference to the |
| :ref:`Azure Container Volume connection id<howto/connection:azure_fileshare>` |
| of an Azure account of which container volumes should be used. |
| |
| |
| .. py:attribute:: conn_name_attr |
| :annotation: = azure_fileshare_conn_id |
| |
| |
| |
| .. py:attribute:: default_conn_name |
| :annotation: = azure_fileshare_default |
| |
| |
| |
| .. py:attribute:: conn_type |
| :annotation: = azure_fileshare |
| |
| |
| |
| .. py:attribute:: hook_name |
| :annotation: = Azure FileShare |
| |
| |
| |
| .. py:method:: get_connection_form_widgets() |
| :staticmethod: |
| |
| Returns connection widgets to add to connection form |
| |
| |
| .. py:method:: get_ui_field_behaviour() |
| :staticmethod: |
| |
| Returns custom field behaviour |
| |
| |
| .. py:method:: get_conn(self) |
| |
| Return the FileService object. |
| |
| |
| .. py:method:: check_for_directory(self, share_name, directory_name, **kwargs) |
| |
| Check if a directory exists on Azure File Share. |
| |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param kwargs: Optional keyword arguments that |
| `FileService.exists()` takes. |
| :return: True if the file exists, False otherwise. |
| :rtype: bool |
| |
| |
| .. py:method:: check_for_file(self, share_name, directory_name, file_name, **kwargs) |
| |
| Check if a file exists on Azure File Share. |
| |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param file_name: Name of the file. |
| :param kwargs: Optional keyword arguments that |
| `FileService.exists()` takes. |
| :return: True if the file exists, False otherwise. |
| :rtype: bool |
| |
| |
| .. py:method:: list_directories_and_files(self, share_name, directory_name = None, **kwargs) |
| |
| Return the list of directories and files stored on a Azure File Share. |
| |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param kwargs: Optional keyword arguments that |
| `FileService.list_directories_and_files()` takes. |
| :return: A list of files and directories |
| :rtype: list |
| |
| |
| .. py:method:: list_files(self, share_name, directory_name = None, **kwargs) |
| |
| Return the list of files stored on a Azure File Share. |
| |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param kwargs: Optional keyword arguments that |
| `FileService.list_directories_and_files()` takes. |
| :return: A list of files |
| :rtype: list |
| |
| |
| .. py:method:: create_share(self, share_name, **kwargs) |
| |
| Create new Azure File Share. |
| |
| :param share_name: Name of the share. |
| :param kwargs: Optional keyword arguments that |
| `FileService.create_share()` takes. |
| :return: True if share is created, False if share already exists. |
| :rtype: bool |
| |
| |
| .. py:method:: delete_share(self, share_name, **kwargs) |
| |
| Delete existing Azure File Share. |
| |
| :param share_name: Name of the share. |
| :param kwargs: Optional keyword arguments that |
| `FileService.delete_share()` takes. |
| :return: True if share is deleted, False if share does not exist. |
| :rtype: bool |
| |
| |
| .. py:method:: create_directory(self, share_name, directory_name, **kwargs) |
| |
| Create a new directory on a Azure File Share. |
| |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param kwargs: Optional keyword arguments that |
| `FileService.create_directory()` takes. |
| :return: A list of files and directories |
| :rtype: list |
| |
| |
| .. py:method:: get_file(self, file_path, share_name, directory_name, file_name, **kwargs) |
| |
| Download a file from Azure File Share. |
| |
| :param file_path: Where to store the file. |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param file_name: Name of the file. |
| :param kwargs: Optional keyword arguments that |
| `FileService.get_file_to_path()` takes. |
| |
| |
| .. py:method:: get_file_to_stream(self, stream, share_name, directory_name, file_name, **kwargs) |
| |
| Download a file from Azure File Share. |
| |
| :param stream: A filehandle to store the file to. |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param file_name: Name of the file. |
| :param kwargs: Optional keyword arguments that |
| `FileService.get_file_to_stream()` takes. |
| |
| |
| .. py:method:: load_file(self, file_path, share_name, directory_name, file_name, **kwargs) |
| |
| Upload a file to Azure File Share. |
| |
| :param file_path: Path to the file to load. |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param file_name: Name of the file. |
| :param kwargs: Optional keyword arguments that |
| `FileService.create_file_from_path()` takes. |
| |
| |
| .. py:method:: load_string(self, string_data, share_name, directory_name, file_name, **kwargs) |
| |
| Upload a string to Azure File Share. |
| |
| :param string_data: String to load. |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param file_name: Name of the file. |
| :param kwargs: Optional keyword arguments that |
| `FileService.create_file_from_text()` takes. |
| |
| |
| .. py:method:: load_stream(self, stream, share_name, directory_name, file_name, count, **kwargs) |
| |
| Upload a stream to Azure File Share. |
| |
| :param stream: Opened file/stream to upload as the file content. |
| :param share_name: Name of the share. |
| :param directory_name: Name of the directory. |
| :param file_name: Name of the file. |
| :param count: Size of the stream in bytes |
| :param kwargs: Optional keyword arguments that |
| `FileService.create_file_from_stream()` takes. |
| |
| |
| |