Esempio n. 1
0
 def test_update_job_trigger(self, mock_hook):
     mock_hook.return_value.update_job_trigger.return_value = {}
     operator = CloudDLPUpdateJobTriggerOperator(job_trigger_id=TRIGGER_ID,
                                                 task_id="id")
     operator.execute(context=None)
     mock_hook.assert_called_once_with(gcp_conn_id=GCP_CONN_ID)
     mock_hook.return_value.update_job_trigger.assert_called_once_with(
         job_trigger_id=TRIGGER_ID,
         project_id=None,
         job_trigger=None,
         update_mask=None,
         retry=None,
         timeout=None,
         metadata=None,
     )
Esempio n. 2
0
        project_id=GCP_PROJECT,
        job_trigger=JOB_TRIGGER,
        trigger_id=TRIGGER_ID,
        task_id="create_trigger",
    )
    # [END howto_operator_dlp_create_job_trigger]

    JOB_TRIGGER["triggers"] = [{
        "schedule": {
            "recurrence_period_duration": {
                "seconds": 2 * 60 * 60 * 24
            }
        }
    }]

    # [START howto_operator_dlp_update_job_trigger]
    update_trigger = CloudDLPUpdateJobTriggerOperator(
        project_id=GCP_PROJECT,
        job_trigger_id=TRIGGER_ID,
        job_trigger=JOB_TRIGGER,
        task_id="update_info_type",
    )
    # [END howto_operator_dlp_update_job_trigger]
    # [START howto_operator_dlp_delete_job_trigger]
    delete_trigger = CloudDLPDeleteJobTriggerOperator(
        project_id=GCP_PROJECT,
        job_trigger_id=TRIGGER_ID,
        task_id="delete_info_type")
    # [END howto_operator_dlp_delete_job_trigger]
    create_trigger >> update_trigger >> delete_trigger