Search code examples
pythongoogle-cloud-platformgoogle-cloud-dlp

Using Google Cloud DLP Stored infotype and getting 400 Invalid built-in info type name


I have a stored infotype in the ready state on my DLP dashboard. Its name is Federal_Income_Tax.

Using the python example at https://cloud.google.com/dlp/docs/concepts-infotypes I see the following:

info_types = [{"name": info_type} for info_type in info_types]

I have changed it to look for my stored infotype

info_types_to_locate = [{"name": "Federal_Income_Tax"}]

I have also provided my google_application_credentials and an active project ID.

When called it returns 400 Invalid built-in info type name Federal_Income_Tax.

What is the syntax to indicate I wish to use a stored infotype rather than a built-in infotype?


Solution

  • Make sure to add the stored infoTypes you want to use to the customInfoTypes array. See documentation: https://cloud.google.com/dlp/docs/creating-stored-infotypes#scan_content_using_stored_custom_dictionary_detectors

    inspectConfig.infoTypes is for built-in infoTypes only.