

# 敏感数据检测 API
<a name="aws-glue-api-sensitive-data-api"></a>

敏感数据检测 API 描述了用于在结构化数据的列和行中检测敏感数据的 API。

## 数据类型
<a name="aws-glue-api-sensitive-data-api-objects"></a>
+ [CustomEntityType 结构](#aws-glue-api-sensitive-data-api-CustomEntityType)

## CustomEntityType 结构
<a name="aws-glue-api-sensitive-data-api-CustomEntityType"></a>

表示用于在结构化数据的列和行中检测敏感数据的自定义模式的对象。

**字段**
+ `Name` – *必填：*UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  允许稍后检索或删除的自定义模式的名称。对于每个 AWS 账户来说，该名称必须是唯一的。
+ `RegexString` – *必填：*UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  用于检测自定义模式中敏感数据的正则表达式字符串。
+ `ContextWords` – UTF-8 字符串数组，不少于 1 个字符串，不超过 20 个字符串。

  上下文字词列表。如果在正则表达式附近找不到这些上下文字词，则数据将不会被检测为敏感数据。

  如果没有传递上下文字词，则只检查正则表达式。

## 操作
<a name="aws-glue-api-sensitive-data-api-actions"></a>
+ [CreateCustomEntityType 操作（Python：create\$1custom\$1entity\$1type）](#aws-glue-api-sensitive-data-api-CreateCustomEntityType)
+ [DeleteCustomEntityType 操作（Python：delete\$1custom\$1entity\$1type）](#aws-glue-api-sensitive-data-api-DeleteCustomEntityType)
+ [GetCustomEntityType 操作（Python：get\$1custom\$1entity\$1type）](#aws-glue-api-sensitive-data-api-GetCustomEntityType)
+ [BatchGetCustomEntityTypes 操作（Python：batch\$1get\$1ustom\$1entity\$1type）](#aws-glue-api-sensitive-data-api-BatchGetCustomEntityTypes)
+ [ListCustomEntityTypes 操作（Python：list\$1custom\$1entity\$1type）](#aws-glue-api-sensitive-data-api-ListCustomEntityTypes)

## CreateCustomEntityType 操作（Python：create\$1custom\$1entity\$1type）
<a name="aws-glue-api-sensitive-data-api-CreateCustomEntityType"></a>

创建自定义模式，用于在结构化数据的列和行中检测敏感数据。

您创建的每个自定义模式都会指定一个正则表达式和上下文字词的可选列表。如果没有传递上下文字词，则只检查正则表达式。

**请求**
+ `Name` – *必填：*UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  允许稍后检索或删除的自定义模式的名称。对于每个 AWS 账户来说，该名称必须是唯一的。
+ `RegexString` – *必填：*UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  用于检测自定义模式中敏感数据的正则表达式字符串。
+ `ContextWords` – UTF-8 字符串数组，不少于 1 个字符串，不超过 20 个字符串。

  上下文字词列表。如果在正则表达式附近找不到这些上下文字词，则数据将不会被检测为敏感数据。

  如果没有传递上下文字词，则只检查正则表达式。
+ `Tags` – 键值对的映射数组，不超过 50 对。

  每个键都是一个 UTF-8 字符串，长度不少于 1 个字节或超过 128 个字节。

  每个值是一个 UTF-8 字符串，不超过 256 个字节。

  应用于自定义实体类型的标签列表。

**响应**
+ `Name` – UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  您创建的自定义模式的名称。

**错误**
+ `AccessDeniedException`
+ `AlreadyExistsException`
+ `IdempotentParameterMismatchException`
+ `InternalServiceException`
+ `InvalidInputException`
+ `OperationTimeoutException`
+ `ResourceNumberLimitExceededException`

## DeleteCustomEntityType 操作（Python：delete\$1custom\$1entity\$1type）
<a name="aws-glue-api-sensitive-data-api-DeleteCustomEntityType"></a>

通过指定自定义模式名称来将其删除。

**请求**
+ `Name` – *必填：*UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  要删除的自定义模式的名称。

**响应**
+ `Name` – UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  已删除的自定义模式的名称。

**错误**
+ `EntityNotFoundException`
+ `AccessDeniedException`
+ `InternalServiceException`
+ `InvalidInputException`
+ `OperationTimeoutException`

## GetCustomEntityType 操作（Python：get\$1custom\$1entity\$1type）
<a name="aws-glue-api-sensitive-data-api-GetCustomEntityType"></a>

通过指定自定义模式名称来检索其详细信息。

**请求**
+ `Name` – *必填：*UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  要检索的自定义模式的名称。

**响应**
+ `Name` – UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  已检索的自定义模式的名称。
+ `RegexString` – UTF-8 字符串，长度不少于 1 个字节或超过 255 个字节，与 [Single-line string pattern](aws-glue-api-common.md#aws-glue-api-regex-oneLine) 匹配。

  用于检测自定义模式中敏感数据的正则表达式字符串。
+ `ContextWords` – UTF-8 字符串数组，不少于 1 个字符串，不超过 20 个字符串。

  上下文字词列表（如在创建自定义模式时指定）。如果在正则表达式附近找不到这些上下文字词，则数据将不会被检测为敏感数据。

**错误**
+ `EntityNotFoundException`
+ `AccessDeniedException`
+ `InternalServiceException`
+ `InvalidInputException`
+ `OperationTimeoutException`

## BatchGetCustomEntityTypes 操作（Python：batch\$1get\$1ustom\$1entity\$1type）
<a name="aws-glue-api-sensitive-data-api-BatchGetCustomEntityTypes"></a>

检索名称列表指定的自定义模式的详细信息。

**请求**
+ `Names` – *必填：*UTF-8 字符串数组，不少于 1 个或不超过 50 个字符串。

  要检索的自定义模式的名称列表。

**响应**
+ `CustomEntityTypes` – [CustomEntityType](#aws-glue-api-sensitive-data-api-CustomEntityType) 对象的数组。

  表示已创建的自定义模式的 `CustomEntityType` 对象列表。
+ `CustomEntityTypesNotFound` – UTF-8 字符串数组，不少于 1 个字符串，不超过 50 个字符串。

  未找到的自定义模式名称列表。

**错误**
+ `InvalidInputException`
+ `InternalServiceException`
+ `OperationTimeoutException`

## ListCustomEntityTypes 操作（Python：list\$1custom\$1entity\$1type）
<a name="aws-glue-api-sensitive-data-api-ListCustomEntityTypes"></a>

列出所有已创建的自定义模式。

**请求**
+ `NextToken` – UTF-8 字符串。

  用于偏移结果的分页令牌。
+ `MaxResults` – 数字（整数），不小于 1 或大于 1000。

  要返回的最大结果数量。
+ `Tags` – 键值对的映射数组，不超过 50 对。

  每个键都是一个 UTF-8 字符串，长度不少于 1 个字节或超过 128 个字节。

  每个值是一个 UTF-8 字符串，不超过 256 个字节。

  键值对标签的列表。

**响应**
+ `CustomEntityTypes` – [CustomEntityType](#aws-glue-api-sensitive-data-api-CustomEntityType) 对象的数组。

  表示自定义模式的 `CustomEntityType` 对象列表。
+ `NextToken` – UTF-8 字符串。

  分页令牌（如果有更多结果可用）。

**错误**
+ `InvalidInputException`
+ `OperationTimeoutException`
+ `InternalServiceException`