[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-19。"],[],[],null,["# Templates\n\nYou can use *templates* to create and persist configuration information to use\nwith Sensitive Data Protection. Templates are useful for decoupling configuration\ninformation such as what you inspect for and how you de-identify it from the\nimplementation of your requests. Templates provide a robust\nway to manage large scale rollouts of Sensitive Data Protection capabilities.\n\nSensitive Data Protection supports two types of templates:\n\n- [*Inspection templates*](/sensitive-data-protection/docs/creating-templates): Templates for saving configuration information for inspection scan jobs, including what predefined or custom detectors to use.\n- [*De-identification templates*](/sensitive-data-protection/docs/creating-templates-deid): Templates for saving configuration information for de-identification jobs, including both infoType and structured dataset transformations.\n\nAdvantages of templates\n-----------------------\n\nTemplates enable you to use a single source for your job configuration\ninformation. Consider a typical inspection scan request to\nSensitive Data Protection. Whether you're inspecting text, an image, or\nstructured data in a Google Cloud storage repository, your inspection request\nwill include two basic pieces of information:\n\n- The data to scan: Either the data itself or information about the location of the data.\n- What to scan for: The predefined or custom infoTypes to turn on, likelihood limits, and so on.\n\nSay you scheduled several storage inspection jobs to run, all of which scanned a\nGoogle Cloud storage repository for phone numbers and then created a\nreport of the findings. The following are conceptual summary descriptions of\nthese jobs. Note that `\"inspectJob\"` represents the data to scan, and\n`\"inspectConfig\"` represents what to scan for.\n\u003e\n\u003e **Inspection job #1:**\n\u003e\n\u003e - `\"inspectJob\"`: *Q2 2017 marketing database.*\n\u003e - `\"inspectConfig\"`: *PHONE_NUMBER infoType.*\n\u003e\n\u003e \u003cbr /\u003e\n\u003e\n\u003e\n\u003e **Inspection job #2:**\n\u003e\n\u003e - `\"inspectJob\"`: *Customer alert contact\n\u003e database.*\n\u003e - `\"inspectConfig\"`: *PHONE_NUMBER infoType.*\n\u003e\n\u003e \u003cbr /\u003e\n\u003e\n\u003e\n\u003e **Inspection job #3:**\n\u003e\n\u003e - `\"inspectJob\"`: *Top secret VIP partner strategy\n\u003e database.*\n\u003e - `\"inspectConfig\"`: *PHONE_NUMBER infoType.*\n\u003e\n\u003e \u003cbr /\u003e\n\u003e\n\u003e\n\u003e **Inspection job #4:**\n\u003e\n\u003e - `\"inspectJob\"`: *Government contract database.*\n\u003e - `\"inspectConfig\"`: *PHONE_NUMBER infoType.*\n\u003e\n\u003e \u003cbr /\u003e\n\u003e\nEach job's data source is different, but its instructions for what to scan for\nis identical. Now suppose that we want to also scan for email addresses. In this\ncase, you would have to edit each job's configuration and add email addresses to\n`\"inspectConfig\"`. If instead you had used a template to configure what to scan\nfor, you would only have to edit one configuration---that of the template. The\nnext time any of these jobs ran, it would know to scan for both phone numbers\nand email addresses, because the `\"inspectConfig\"` had been set to a template.\n\nThe InspectTemplate and DeidentifyTemplate objects\n--------------------------------------------------\n\nTemplates are represented in Sensitive Data Protection by the\n[`InspectTemplate`](/sensitive-data-protection/docs/reference/rest/v2/organizations.inspectTemplates)\nand\n[`DeidentifyTemplate`](/sensitive-data-protection/docs/reference/rest/v2/organizations.deidentifyTemplates)\nobjects. Both template objects contain a configuration---a set of infoType\ndetectors---to be used anywhere you otherwise would normally specify the [`InspectConfig`](/sensitive-data-protection/docs/reference/rest/v2/InspectConfig) or\n[`DeidentifyConfig`](/sensitive-data-protection/docs/reference/rest/v2/organizations.deidentifyTemplates#DeidentifyTemplate.DeidentifyConfig)\nobjects.\n\n### Template configuration fields\n\nEach template object contains the configuration object that the template\nimplements, plus several additional configuration fields:\n\n- The template's name and display name, and a description.\n- The [`InspectConfig`](/sensitive-data-protection/docs/reference/rest/v2/InspectConfig) or [`DeidentifyConfig`](/sensitive-data-protection/docs/reference/rest/v2/organizations.deidentifyTemplates#DeidentifyTemplate.DeidentifyConfig) object: The configuration information for the inspection or de-identification job.\n- Read-only timestamps for creation time (`\"createTime\"`) and a last updated time (`\"updateTime\"`).\n\n### Template methods\n\nEach template object also includes several built-in management methods.\nThese enable you to maintain the template without having to update every request\nor integration. Each management method is linked in the following table,\nand is organized by whether the template applies organization-wide\nor project-wide, and whether the template is a de-identification template or an\ninspection template:\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nUsing templates\n---------------\n\nTemplates are available for both inspection and de-identification configuration\ninformation, and can be used in both content API calls (text and images)\nSensitive Data Protection jobs (storage repositories).\n\nTemplates have powerful Identity and Access Management (IAM) controls so you can\nrestrict management of them to only approved users. For more information, see:\n\n- [Sensitive Data Protection IAM roles](/sensitive-data-protection/docs/iam-roles)\n- [Sensitive Data Protection IAM permissions](/sensitive-data-protection/docs/iam-permissions)\n\nResources\n---------\n\nTo learn how to create and use templates with Sensitive Data Protection, see:\n\n- [Creating Sensitive Data Protection inspection\n templates](/sensitive-data-protection/docs/creating-templates)\n- [Creating Sensitive Data Protection de-identification\n templates](/sensitive-data-protection/docs/creating-templates-deid)"]]