Method: settings.datasources.update

更新数据源。

注意:必须使用管理员帐号才能执行此 API。

HTTP 请求

PUT https://cloudsearch.googleapis.com/v1/settings/{source.name=datasources/*}

网址采用 gRPC 转码语法。

路径参数

参数
source.name

string

数据源资源的名称。格式:datasources/{sourceId}。

创建数据源时,系统会忽略该名称。

请求正文

请求正文中包含结构如下的数据:

JSON 表示法
{
  "source": {
    "name": string,
    "displayName": string,
    "shortName": string,
    "indexingServiceAccounts": [
      string
    ],
    "disableServing": boolean,
    "disableModifications": boolean,
    "itemsVisibility": [
      {

        // Union field gsuite_principal can be only one of the following:
        "gsuiteUserEmail": string,
        "gsuiteGroupEmail": string,
        "gsuiteDomain": boolean
        // End of list of possible types for union field gsuite_principal.
      }
    ],
    "returnThumbnailUrls": boolean,
    "operationIds": [
      string
    ]
  },
  "debugOptions": {
    object (DebugOptions)
  },
  "updateMask": string
}
字段
source.displayName

string

必需。数据源的显示名称;长度上限为 300 个字符。

source.shortName

string

来源的简称或别名。此值将用于匹配“source”运算符。例如,如果简称为 <value>,则类似 source:<value> 的查询将仅返回此来源的结果。该值在所有数据源中必须是唯一的。该值只能包含字母数字字符 (a-zA-Z0-9)。该值不能以“google”开头,并且不能是下列类型之一:mail、gmail、docs、drive、groups、sites、calendar、hangouts、gplus、keep、people、team。其长度上限为 32 个字符。

source.indexingServiceAccounts[]

string

具有索引访问权限的服务账号的列表。

source.disableServing

boolean

禁止提供任何搜索或辅助结果。

source.disableModifications

boolean

如果为 true,则将数据源设置为只读模式。在只读模式下,Indexing API 会拒绝任何将此来源中的项编入索引或删除的请求。启用只读模式不会停止处理之前接受的数据。

source.itemsVisibility[]

object (GSuitePrincipal)

此字段限制对数据源级别的可见性。数据源中的项仅限于此字段中包含的用户和群组的并集。请注意,这无法保证可以访问特定项,因为用户需要对所含项拥有 ACL 权限。这样可以确保对整个数据源具有较高级别的访问权限,并且单个项不会共享到此公开范围之外。

source.returnThumbnailUrls

boolean

用户可以请求获取此数据源中编入索引的项的缩略图 URI。

source.operationIds[]

string

当前针对此架构运行的长时间运行的操作 (LRO) 的 ID。

debugOptions

object (DebugOptions)

常用的调试选项。

updateMask

string (FieldMask format)

仅适用于 settings.datasources.patch

更新掩码以控制要更新的字段。字段路径示例:namedisplayName

  • 如果 updateMask 不为空,则仅更新 updateMask 中指定的字段。
  • 如果您在 updateMask 中指定了一个字段,但未在来源中指定其值,系统将清除该字段。
  • 如果 updateMask 不存在、为空或值为 *,则所有字段都会更新。

响应正文

如果成功,则响应正文包含一个 Operation 实例。

授权范围

需要以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/cloud_search.settings.indexing
  • https://www.googleapis.com/auth/cloud_search.settings
  • https://www.googleapis.com/auth/cloud_search

有关详情,请参阅授权指南