mik-laj commented on a change in pull request #5539: [AIRFLOW-4811] Implement 
GCP DLP' Hook and Operators
URL: https://github.com/apache/airflow/pull/5539#discussion_r303120668
 
 

 ##########
 File path: airflow/contrib/example_dags/example_gcp_dlp_operator.py
 ##########
 @@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+#
+# 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.
+
+"""
+Example Airflow DAG that execute the following tasks using
+Cloud DLP service in the Google Cloud Platform:
+1) Creating a content inspect template;
+2) Using the created template to inspect content;
+3) Deleting the template from GCP .
+"""
+
+from google.cloud.dlp_v2.types import (ContentItem, InspectConfig,
+                                       InspectTemplate)
+
+import airflow
+from airflow.models import DAG
+from airflow.contrib.operators.gcp_dlp_operator import (
+    CloudDLPCreateInspectTemplateOperator,
+    CloudDLPDeleteInspectTemplateOperator, CloudDLPInspectContentOperator)
+
+
+default_args = {"start_date": airflow.utils.dates.days_ago(1)}
+
+
+GCP_PROJECT = "gcp-example-project"
 
 Review comment:
   ```suggestion
   GCP_PROJECT =  os.environ.get('GCP_PROJECT_ID', 'example-project')
   ```
   Similarly, it is worth doing in other variables that are environment 
dependent. This allows you to set variables during the initialization of the 
environment, and then easy to run system tests automatically.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to