Skip to content

Commit

Permalink
[AIRFLOW-6924] Fix Google DLP operators return types (#7546)
Browse files Browse the repository at this point in the history
  • Loading branch information
turbaszek committed Feb 29, 2020
1 parent fae99e1 commit 3db4ade
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 163 deletions.
2 changes: 1 addition & 1 deletion airflow/providers/google/cloud/example_dags/example_dlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


GCP_PROJECT = os.environ.get("GCP_PROJECT_ID", "example-project")
TEMPLATE_ID = "dlp-inspect-8034856"
TEMPLATE_ID = "dlp-inspect-838746"
ITEM = ContentItem(
table={
"headers": [{"name": "column1"}],
Expand Down
30 changes: 0 additions & 30 deletions airflow/providers/google/cloud/hooks/dlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def get_conn(self) -> DlpServiceClient:
self._client = DlpServiceClient(credentials=self._get_credentials(), client_info=self.client_info)
return self._client

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def cancel_dlp_job(
self,
Expand Down Expand Up @@ -113,7 +112,6 @@ def cancel_dlp_job(
name = DlpServiceClient.dlp_job_path(project_id, dlp_job_id)
client.cancel_dlp_job(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
def create_deidentify_template(
self,
organization_id: Optional[str] = None,
Expand Down Expand Up @@ -171,7 +169,6 @@ def create_deidentify_template(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def create_dlp_job(
self,
Expand Down Expand Up @@ -254,7 +251,6 @@ def create_dlp_job(
)
return job

@CloudBaseHook.catch_http_exception
def create_inspect_template(
self,
organization_id: Optional[str] = None,
Expand Down Expand Up @@ -313,7 +309,6 @@ def create_inspect_template(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def create_job_trigger(
self,
Expand Down Expand Up @@ -360,7 +355,6 @@ def create_job_trigger(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
def create_stored_info_type(
self,
organization_id: Optional[str] = None,
Expand Down Expand Up @@ -418,7 +412,6 @@ def create_stored_info_type(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def deidentify_content(
self,
Expand Down Expand Up @@ -483,7 +476,6 @@ def deidentify_content(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
def delete_deidentify_template(
self, template_id, organization_id=None, project_id=None, retry=None, timeout=None, metadata=None
) -> None:
Expand Down Expand Up @@ -527,7 +519,6 @@ def delete_deidentify_template(

client.delete_deidentify_template(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def delete_dlp_job(
self,
Expand Down Expand Up @@ -566,7 +557,6 @@ def delete_dlp_job(
name = DlpServiceClient.dlp_job_path(project_id, dlp_job_id)
client.delete_dlp_job(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
def delete_inspect_template(
self,
template_id: str,
Expand Down Expand Up @@ -616,7 +606,6 @@ def delete_inspect_template(

client.delete_inspect_template(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def delete_job_trigger(
self,
Expand Down Expand Up @@ -654,7 +643,6 @@ def delete_job_trigger(
name = DlpServiceClient.project_job_trigger_path(project_id, job_trigger_id)
client.delete_job_trigger(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
def delete_stored_info_type(
self,
stored_info_type_id: str,
Expand Down Expand Up @@ -704,7 +692,6 @@ def delete_stored_info_type(

client.delete_stored_info_type(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
def get_deidentify_template(
self,
template_id: str,
Expand Down Expand Up @@ -755,7 +742,6 @@ def get_deidentify_template(

return client.get_deidentify_template(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def get_dlp_job(
self,
Expand Down Expand Up @@ -794,7 +780,6 @@ def get_dlp_job(
name = DlpServiceClient.dlp_job_path(project_id, dlp_job_id)
return client.get_dlp_job(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
def get_inspect_template(
self,
template_id: str,
Expand Down Expand Up @@ -845,7 +830,6 @@ def get_inspect_template(

return client.get_inspect_template(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def get_job_trigger(
self,
Expand Down Expand Up @@ -884,7 +868,6 @@ def get_job_trigger(
name = DlpServiceClient.project_job_trigger_path(project_id, job_trigger_id)
return client.get_job_trigger(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
def get_stored_info_type(
self,
stored_info_type_id: str,
Expand Down Expand Up @@ -935,7 +918,6 @@ def get_stored_info_type(

return client.get_stored_info_type(name=name, retry=retry, timeout=timeout, metadata=metadata)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def inspect_content(
self,
Expand Down Expand Up @@ -988,7 +970,6 @@ def inspect_content(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
def list_deidentify_templates(
self,
organization_id: Optional[str] = None,
Expand Down Expand Up @@ -1050,7 +1031,6 @@ def list_deidentify_templates(

return list(results)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def list_dlp_jobs(
self,
Expand Down Expand Up @@ -1107,7 +1087,6 @@ def list_dlp_jobs(
)
return list(results)

@CloudBaseHook.catch_http_exception
def list_info_types(
self,
language_code: Optional[str] = None,
Expand Down Expand Up @@ -1147,7 +1126,6 @@ def list_info_types(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
def list_inspect_templates(
self,
organization_id: Optional[str] = None,
Expand Down Expand Up @@ -1208,7 +1186,6 @@ def list_inspect_templates(
)
return list(results)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def list_job_triggers(
self,
Expand Down Expand Up @@ -1261,7 +1238,6 @@ def list_job_triggers(
)
return list(results)

@CloudBaseHook.catch_http_exception
def list_stored_info_types(
self,
organization_id: Optional[str] = None,
Expand Down Expand Up @@ -1322,7 +1298,6 @@ def list_stored_info_types(
)
return list(results)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def redact_image(
self,
Expand Down Expand Up @@ -1383,7 +1358,6 @@ def redact_image(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def reidentify_content(
self,
Expand Down Expand Up @@ -1445,7 +1419,6 @@ def reidentify_content(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
def update_deidentify_template(
self,
template_id: str,
Expand Down Expand Up @@ -1509,7 +1482,6 @@ def update_deidentify_template(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
def update_inspect_template(
self,
template_id: str,
Expand Down Expand Up @@ -1572,7 +1544,6 @@ def update_inspect_template(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
@CloudBaseHook.fallback_to_default_project_id
def update_job_trigger(
self,
Expand Down Expand Up @@ -1624,7 +1595,6 @@ def update_job_trigger(
metadata=metadata,
)

@CloudBaseHook.catch_http_exception
def update_stored_info_type(
self,
stored_info_type_id: str,
Expand Down
Loading

0 comments on commit 3db4ade

Please sign in to comment.
  翻译: