def delete_inspect_template(project, template_id): """Deletes a Data Loss Prevention API template. Args: project: The id of the Google Cloud project which owns the template. template_id: The id of the template to delete. Returns: None; the response from the API is printed to the terminal. """ # Import the client library import google.cloud.dlp # Instantiate a client. dlp = google.cloud.dlp.DlpServiceClient() # Convert the project id into a full resource id. parent = dlp.project_path(project) # Combine the template id with the parent id. template_resource = '{}/inspectTemplates/{}'.format(parent, template_id) # Call the API. dlp.delete_inspect_template(template_resource) print('Template {} successfully deleted.'.format(template_resource))