turbaszek commented on a change in pull request #10991: URL: https://github.com/apache/airflow/pull/10991#discussion_r497344161
########## File path: airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py ########## @@ -0,0 +1,191 @@ +# +# 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. + +from tempfile import NamedTemporaryFile +from typing import Optional, Union, Sequence, Iterable + +from airflow import AirflowException +from airflow.models import BaseOperator +from airflow.providers.google.cloud.hooks.gcs import _parse_gcs_url, GCSHook +from airflow.providers.microsoft.azure.hooks.azure_fileshare import AzureFileShareHook +from airflow.utils.decorators import apply_defaults + + +class AzureFileShareToGCSOperator(BaseOperator): + """ + Synchronizes a Azure FileShare directory content (excluding subdirectories), + possibly filtered by a prefix, with a Google Cloud Storage destination path. + + :param share_name: The Azure FileShare share where to find the objects. (templated) + :type share_name: str + :param directory_name: (Optional) Path to Azure FileShare directory which content is to be transferred. + Defaults to root directory (templated) + :type directory_name: str + :param prefix: Prefix string which filters objects whose name begin with + such prefix. (templated) + :type prefix: str + :param wasb_conn_id: The source WASB connection + :type wasb_conn_id: str + :param gcp_conn_id: (Optional) The connection ID used to connect to Google Cloud. + :type gcp_conn_id: str + :param dest_gcs_conn_id: (Deprecated) The connection ID used to connect to Google Cloud. + This parameter has been deprecated. You should pass the gcp_conn_id parameter instead. + :type dest_gcs_conn_id: str + :param dest_gcs: The destination Google Cloud Storage bucket and prefix + where you want to store the files. (templated) + :type dest_gcs: str + :param delegate_to: Google account to impersonate using domain-wide delegation of authority, + if any. For this to work, the service account making the request must have + domain-wide delegation enabled. + :type delegate_to: str + :param replace: Whether you want to replace existing destination files + or not. + :type replace: bool + :param gzip: Option to compress file for upload + :type gzip: bool + :param google_impersonation_chain: Optional Google service account to impersonate using + short-term credentials, or chained list of accounts required to get the access_token + of the last account in the list, which will be impersonated in the request. + If set as a string, the account must grant the originating account + the Service Account Token Creator IAM role. + If set as a sequence, the identities from the list must grant + Service Account Token Creator IAM role to the directly preceding identity, with first + account from the list granting this role to the originating account (templated). + :type google_impersonation_chain: Optional[Union[str, Sequence[str]]] + + Note that ``share_name``, ``directory_name``, ``prefix``, ``delimiter`` and ``dest_gcs`` are + templated, so you can use variables in them if you wish. + """ + + template_fields: Iterable[str] = ( + 'share_name', + 'directory_name', + 'prefix', + 'dest_gcs', + # 'google_impersonation_chain', + ) + + @apply_defaults + def __init__( + self, + *, + share_name: str, + directory_name: Optional[str] = None, + prefix: str = '', + wasb_conn_id: str = 'wasb_default', + gcp_conn_id: str = 'google_cloud_default', + dest_gcs: str, Review comment: A required argument should be before defaults ---------------------------------------------------------------- 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: us...@infra.apache.org