sdevani commented on a change in pull request #4792: [AIRFLOW-3659] Create
Google Cloud Transfer Service Operators
URL: https://github.com/apache/airflow/pull/4792#discussion_r260973882
##########
File path: airflow/contrib/hooks/gcp_transfer_hook.py
##########
@@ -52,56 +76,277 @@ def get_conn(self):
"""
if not self._conn:
http_authorized = self._authorize()
- self._conn = build('storagetransfer', self.api_version,
- http=http_authorized, cache_discovery=False)
+ self._conn = build(
+ 'storagetransfer', self.api_version, http=http_authorized,
cache_discovery=False
+ )
return self._conn
- def create_transfer_job(self, description, schedule, transfer_spec,
project_id=None):
- transfer_job = {
- 'status': 'ENABLED',
- 'projectId': project_id or self.project_id,
- 'description': description,
- 'transferSpec': transfer_spec,
- 'schedule': schedule or self._schedule_once_now(),
- }
- return
self.get_conn().transferJobs().create(body=transfer_job).execute()
-
- def wait_for_transfer_job(self, job):
+ @GoogleCloudBaseHook.catch_http_exception
+ def create_transfer_job(self, body):
+ """
+ Creates a transfer job that runs periodically.
+
+ :param body: (Required) A request body, as described in
+
https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/patch#request-body
+ :type body: dict
+ :return: transfer job.
+ See:
+
https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs#TransferJob
+ :rtype: dict
+ """
+ body = self._inject_project_id(body, 'body project_id')
Review comment:
What is "body project_id"?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services