in 5-app-infra/3-artifact-publish/docker/cdmc/tag_engine_api/helper_functions/inspect_datasets.py [0:0]
def start_job(region, inspect_project, inspect_dataset, table, result_project, result_dataset):
inspect_job_data = {
'storage_config': {
'big_query_options': {
'table_reference': {
'project_id': inspect_project,
'dataset_id': inspect_dataset,
'table_id': table
}
}
},
'inspect_config': {
"info_types": [
{
"name": "CREDIT_CARD_NUMBER"
},
{
"name": "EMAIL_ADDRESS"
},
{
"name": "STREET_ADDRESS"
},
{
"name": "PHONE_NUMBER"
},
{
"name": "PERSON_NAME"
},
{
"name": "FIRST_NAME"
},
{
"name": "LAST_NAME"
},
{
"name": "GENDER"
},
{
"name": "DATE_OF_BIRTH"
},
{
"name": "AGE"
},
{
"name": "ETHNIC_GROUP"
},
{
"name": "LOCATION_COORDINATES"
},
{
"name": "IP_ADDRESS"
}
],
"min_likelihood": "LIKELY",
},
'actions': [
{
'save_findings': {
'output_config':{
'table':{
'project_id': result_project,
'dataset_id': result_dataset,
'table_id': table
}
}
},
},
]
}
dlp_client = dlp.DlpServiceClient()
dlp_client.project_path(result_project)
parent = 'projects/' + result_project + '/locations/' + region
response = dlp_client.create_dlp_job(parent=parent, inspect_job=inspect_job_data)
print(response)