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

来源的简称或别名。此值将用于匹配“来源”运算符。例如,如果短名称为 <value>,则 source:<value> 等查询将仅返回此来源的结果。此值在所有数据源中都必须是唯一的。该值只能包含字母数字字符 (a-zA-Z0-9)。此值不能以“google”开头,也不能是以下各项之一:mail、gmail、docs、drive、groups、sites、calendar、hangouts、gplus、keep、people、teams。长度不得超过 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

如需了解详情,请参阅授权指南