airflow.providers.google.cloud.hooks.cloud_storage_transfer_service
¶
This module contains a Google Storage Transfer Service Hook.
Module Contents¶
Classes¶
Google Cloud Transfer job status. |
|
Google Cloud Transfer operation status. |
|
Google Storage Transfer Service functionalities. |
|
Asynchronous hook for Google Storage Transfer Service. |
Functions¶
|
Add a unique suffix to the job name. |
Attributes¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.TIME_TO_SLEEP_IN_SECONDS = 10[source]¶
- class airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.GcpTransferJobsStatus[source]¶
Google Cloud Transfer job status.
- class airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.GcpTransferOperationStatus[source]¶
Google Cloud Transfer operation status.
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.ACCESS_KEY_ID = 'accessKeyId'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.ALREADY_EXISTING_IN_SINK = 'overwriteObjectsAlreadyExistingInSink'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.AWS_ACCESS_KEY = 'awsAccessKey'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.AWS_SECRET_ACCESS_KEY = 'secretAccessKey'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.AWS_S3_DATA_SOURCE = 'awsS3DataSource'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.AWS_ROLE_ARN = 'roleArn'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.BUCKET_NAME = 'bucketName'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.DESCRIPTION = 'description'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.FILTER_JOB_NAMES = 'job_names'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.FILTER_PROJECT_ID = 'project_id'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.GCS_DATA_SINK = 'gcsDataSink'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.GCS_DATA_SOURCE = 'gcsDataSource'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.HTTP_DATA_SOURCE = 'httpDataSource'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.INCLUDE_PREFIXES = 'includePrefixes'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.OBJECT_CONDITIONS = 'object_conditions'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.OPERATIONS = 'operations'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.OVERWRITE_OBJECTS_ALREADY_EXISTING_IN_SINK = 'overwriteObjectsAlreadyExistingInSink'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.PROJECT_ID = 'projectId'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.SCHEDULE_END_DATE = 'scheduleEndDate'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.SCHEDULE_START_DATE = 'scheduleStartDate'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.SECRET_ACCESS_KEY = 'secretAccessKey'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.START_TIME_OF_DAY = 'startTimeOfDay'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.TRANSFER_JOB = 'transfer_job'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.TRANSFER_JOBS = 'transferJobs'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.TRANSFER_JOB_FIELD_MASK = 'update_transfer_job_field_mask'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.TRANSFER_OPERATIONS = 'transferOperations'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.TRANSFER_OPTIONS = 'transfer_options'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.TRANSFER_SPEC = 'transferSpec'[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.ALREADY_EXIST_CODE = 409[source]¶
- airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.gen_job_name(job_name)[source]¶
Add a unique suffix to the job name.
- class airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.CloudDataTransferServiceHook(api_version='v1', gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
Google Storage Transfer Service functionalities.
All methods in the hook with project_id in the signature must be called with keyword arguments rather than positional.
- get_conn()[source]¶
Retrieve connection to Google Storage Transfer service.
- Returns
Google Storage Transfer service object
- Return type
googleapiclient.discovery.Resource
- create_transfer_job(body)[source]¶
Create a transfer job that runs periodically.
- Parameters
body (dict) – (Required) The request body, as described in https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/patch#request-body
- Returns
The transfer job. See: https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs#TransferJob
- Return type
- get_transfer_job(job_name, project_id)[source]¶
Get latest state of a long-running Google Storage Transfer Service job.
- list_transfer_job(request_filter=None, **kwargs)[source]¶
List long-running operations in Google Storage Transfer Service.
A filter can be specified to match only certain entries.
- Parameters
request_filter (dict | None) – (Required) A request filter, as described in https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/list#body.QUERY_PARAMETERS.filter
- Returns
List of Transfer Jobs
- Return type
- enable_transfer_job(job_name, project_id)[source]¶
Make new transfers be performed based on the schedule.
- update_transfer_job(job_name, body)[source]¶
Update a transfer job that runs periodically.
- Parameters
job_name (str) – (Required) Name of the job to be updated
body (dict) – A request body, as described in https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/patch#request-body
- Returns
If successful, TransferJob.
- Return type
- delete_transfer_job(job_name, project_id)[source]¶
Delete a transfer job.
This is a soft delete. After a transfer job is deleted, the job and all the transfer executions are subject to garbage collection. Transfer jobs become eligible for garbage collection 30 days after soft delete.
- run_transfer_job(job_name, project_id)[source]¶
Run Google Storage Transfer Service job.
- Parameters
- Returns
If successful, Operation. See: https://cloud.google.com/storage-transfer/docs/reference/rest/v1/Operation
- Return type
- cancel_transfer_operation(operation_name)[source]¶
Cancel a transfer operation in Google Storage Transfer Service.
- Parameters
operation_name (str) – Name of the transfer operation.
- get_transfer_operation(operation_name)[source]¶
Get a transfer operation in Google Storage Transfer Service.
- list_transfer_operations(request_filter=None, **kwargs)[source]¶
Get a transfer operation in Google Storage Transfer Service.
- Parameters
request_filter (dict | None) – (Required) A request filter, as described in https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs/list#body.QUERY_PARAMETERS.filter With one additional improvement:
- Returns
transfer operation
- Return type
The
project_id
parameter is optional if you have a project ID defined in the connection. See: Google Cloud Connection
- pause_transfer_operation(operation_name)[source]¶
Pause a transfer operation in Google Storage Transfer Service.
- Parameters
operation_name (str) – (Required) Name of the transfer operation.
- resume_transfer_operation(operation_name)[source]¶
Resume a transfer operation in Google Storage Transfer Service.
- Parameters
operation_name (str) – (Required) Name of the transfer operation.
- wait_for_transfer_job(job, expected_statuses=None, timeout=None)[source]¶
Wait until the job reaches the expected state.
- Parameters
job (dict) – The transfer job to wait for. See: https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs#TransferJob
expected_statuses (set[str] | None) – The expected state. See: https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations#Status
timeout (float | datetime.timedelta | None) – Time in which the operation must end in seconds. If not specified, defaults to 60 seconds.
- static operations_contain_expected_statuses(operations, expected_statuses)[source]¶
Check whether an operation exists with the expected status.
- Parameters
- Returns
If there is an operation with the expected state in the operation list, returns true,
- Raises
AirflowException – If it encounters operations with state FAILED or ABORTED in the list.
- Return type
- class airflow.providers.google.cloud.hooks.cloud_storage_transfer_service.CloudDataTransferServiceAsyncHook(project_id=PROVIDE_PROJECT_ID, **kwargs)[source]¶
Bases:
airflow.providers.google.common.hooks.base_google.GoogleBaseAsyncHook
Asynchronous hook for Google Storage Transfer Service.
- async get_conn()[source]¶
Return async connection to the Storage Transfer Service.
- Returns
Google Storage Transfer asynchronous client.
- Return type
google.cloud.storage_transfer_v1.StorageTransferServiceAsyncClient