如需了解 API 功能,请参阅 Connectors API。
本页面上的所有请求均使用以下变量:
$TOKEN- OAuth 2.0 令牌$CUSTOMER- 客户的 ID 或字面值my_customer$PAGE_TOKEN- 从之前的页面响应中获取的页面令牌$CONNECTOR_CONFIG_ID- 连接器配置的 ID。生成的 ID 采用大写 UUID 格式(例如550E8400-E29B-41D4-A716-446655440000)。
列出连接器配置
如需列出客户网域的连接器配置,请使用 list 方法。在对结果进行分页时,您可以选择提供 page_size(或 pageSize)和 page_token(或 pageToken)查询参数:
page_size/pageSize:要返回的连接器配置数量上限。如果未指定,则默认页面大小为 50,最大值为 100。page_token/pageToken:从之前的list调用接收的页面令牌。
请求
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs?page_size=50&page_token=$PAGE_TOKEN"
响应
{
"connectorConfigs": [
{
"name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
"displayName": "Configuration 1",
"type": "REPORTING",
"details": {
"googleSecOpsConfig": {
"host": "example.googlesecops.com",
"reportingSettings": {
"enabledDefaultEvents": [
"ALL_DEFAULT_EVENTS"
],
"enabledOptInEvents": [
"PASSWORD_BREACH_EVENT",
"URL_NAVIGATION_EVENT"
],
"enabledDeviceEvents": [
"ALL_DEVICE_EVENTS"
]
}
}
},
"status": {
"state": "ENABLED"
}
}
],
"nextPageToken": "<next_page_token>"
}
获取连接器配置
如需按 ID 检索特定连接器配置,请使用 get 方法。
请求
curl -X GET \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs/$CONNECTOR_CONFIG_ID"
响应
{
"name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
"displayName": "Configuration 1",
"type": "REPORTING",
"details": {
"googleSecOpsConfig": {
"host": "example.googlesecops.com",
"reportingSettings": {
"enabledDefaultEvents": [
"ALL_DEFAULT_EVENTS"
],
"enabledOptInEvents": [
"PASSWORD_BREACH_EVENT",
"URL_NAVIGATION_EVENT"
],
"enabledDeviceEvents": [
"ALL_DEVICE_EVENTS"
]
}
}
},
"status": {
"state": "ENABLED"
}
}
创建连接器配置
如需为客户网域创建新的连接器配置,请使用 create 方法。您可以选择设置 connector_config_id(或 connectorConfigId)查询参数来提供自定义 ID。如果未提供 ID,服务器会生成一个大写的 UUID。
请求
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"displayName": "Configuration 1",
"type": "REPORTING",
"details": {
"googleSecOpsConfig": {
"apiKey": "api-key",
"host": "example.googlesecops.com",
"reportingSettings": {
"enabledDefaultEvents": [
"ALL_DEFAULT_EVENTS"
],
"enabledOptInEvents": [
"PASSWORD_BREACH_EVENT"
],
"enabledDeviceEvents": [
"ALL_DEVICE_EVENTS"
]
}
}
}
}' \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs?connector_config_id=$CONNECTOR_CONFIG_ID"
响应
{
"name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
"displayName": "Configuration 1",
"type": "REPORTING",
"details": {
"googleSecOpsConfig": {
"host": "example.googlesecops.com",
"reportingSettings": {
"enabledDefaultEvents": [
"ALL_DEFAULT_EVENTS"
],
"enabledOptInEvents": [
"PASSWORD_BREACH_EVENT"
],
"enabledDeviceEvents": [
"ALL_DEVICE_EVENTS"
]
}
}
},
"status": {
"state": "ENABLED"
}
}
更新连接器配置
您可以通过以下任一方式更新连接器配置:
- 无更新掩码:如果未提供
updateMask查询参数,则系统会更新请求中设置的所有字段。 - 使用更新掩码:如果指定了
updateMask查询参数,则只会更新掩码中列出的字段。 - 使用与
*对应的更新掩码:如果updateMask设置为*,则更新将被视为完全替换(相当于创建)。
示例 1:仅以 displayName 为目标的更新掩码
在这种情况下,提供 updateMask=displayName 可确保仅更新 displayName,即使正文中提供了其他字段也是如此。
请求
curl -X PATCH \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"displayName": "Updated name"
}' \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs/$CONNECTOR_CONFIG_ID?updateMask=displayName"
响应
{
"name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
"displayName": "Updated name",
"type": "REPORTING",
"details": {
"googleSecOpsConfig": {
"host": "example.googlesecops.com",
"reportingSettings": {
"enabledDefaultEvents": [
"BROWSER_EXTENSION_INSTALL_EVENT"
],
"enabledOptInEvents": [
"PASSWORD_BREACH_EVENT"
],
"enabledDeviceEvents": [
"LOGIN_LOGOUT_EVENT"
]
}
}
},
"status": {
"state": "ENABLED"
}
}
示例 2:无更新掩码(更新请求中的所有字段)
如果请求查询字符串中省略了 updateMask,则系统会更新 JSON 载荷中提供的所有字段。
请求
curl -X PATCH \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"displayName": "Updated again",
"details": {
"googleSecOpsConfig": {
"reportingSettings": {
"enabledDefaultEvents": [
"BROWSER_EXTENSION_INSTALL_EVENT",
"CONTENT_TRANSFER_EVENT",
"CONTENT_UNSCANNED_EVENT",
"DATA_ACCESS_CONTROL_EVENT",
"MALWARE_TRANSFER_EVENT"
]
}
}
}
}' \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs/$CONNECTOR_CONFIG_ID"
响应
{
"name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
"displayName": "Updated again",
"type": "REPORTING",
"details": {
"googleSecOpsConfig": {
"host": "example.googlesecops.com",
"reportingSettings": {
"enabledDefaultEvents": [
"BROWSER_EXTENSION_INSTALL_EVENT",
"CONTENT_TRANSFER_EVENT",
"CONTENT_UNSCANNED_EVENT",
"DATA_ACCESS_CONTROL_EVENT",
"MALWARE_TRANSFER_EVENT"
],
"enabledOptInEvents": [
"PASSWORD_BREACH_EVENT"
],
"enabledDeviceEvents": [
"ALL_DEVICE_EVENTS"
]
}
}
},
"status": {
"state": "ENABLED"
}
}
示例 3:更新掩码为 *(完全替换)
设置 updateMask=* 会将现有配置完全替换为请求正文中提供的载荷。
请求
curl -X PATCH \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"displayName": "New Updated Display Name",
"type": "REPORTING",
"details": {
"googleSecOpsConfig": {
"apiKey": "api-key",
"host": "example.googlesecops.com",
"reportingSettings": {
"enabledOptInEvents": [
"PASSWORD_BREACH_EVENT"
]
}
}
}
}' \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs/$CONNECTOR_CONFIG_ID?updateMask=*"
响应
{
"name": "customers/my_customer/connectorConfigs/550E8400-E29B-41D4-A716-446655440000",
"displayName": "New Updated Display Name",
"type": "REPORTING",
"details": {
"googleSecOpsConfig": {
"host": "example.googlesecops.com",
"reportingSettings": {
"enabledOptInEvents": [
"PASSWORD_BREACH_EVENT"
]
}
}
},
"status": {
"state": "ENABLED"
}
}
删除连接器配置
如需删除连接器配置,请使用 delete 方法。
请求
curl -X DELETE \
-H "Authorization: Bearer $TOKEN" \
"https://chromemanagement.googleapis.com/v1/customers/$CUSTOMER/connectorConfigs/$CONNECTOR_CONFIG_ID"
响应
{}