Skip to main content
Astra Automation
简体中文版经机器翻译而成,仅供参考。如与英语版出现任何冲突,应以英语版为准。

修改凭据

PUT /accounts/{account_id}/core/v1/credentials/{credential_id}

将整个存储资源替换为提供的 JSON 请求正文,同时保留不可由用户修改的键值。

参数

名称 Type Required Description

account_id

string

path

True

包含帐户资源的 ID

  • 示例:{{.Account}}

凭证 ID

string

path

True

要列出的凭据集合的 ID

请求正文

将整个存储资源替换为提供的 JSON 请求正文,同时保留不可由用户修改的键值。

名称 Type Required Description

type

string

True

资源的媒体类型。定义的值为:

  • "application/astra-credential"

version

string

True

资源的版本。定义的值为:

  • "1.0"

  • "1.1"

id

string

False

资源的全局唯一标识符。定义的值为:

  • 符合 UUIDv4 架构

name

string

True

包含用户指定名称的 JSON 字符串。为用户创建凭据时,名称将设置为该用户的 UUID。定义的值为:

  • 最小长度:1

  • 最大长度:127

keyType

string

False

包含可选的用户指定的数据验证类型描述符的 JSON 字符串,用于 keyStore 的内容。扩展更新约束:

  • 如果资源中不存在 keyType 且未在更新中指定,则 keyType 不得在更新的资源中继续存在。

  • 如果资源中不存在 keyType,但在更新时指定了 keyType,则必须将 keyType 添加到资源中并执行验证。如果验证失败,更新将失败。

  • 如果资源中存在 keyType 且未在更新中指定,则必须保留 keyType。

  • 如果资源中存在 keyType 并且在更新中指定了,并且指定的 keyType 与现有的 keyType 匹配,则必须保留 keyType。

  • 如果资源中存在 keyType 并在更新中指定了,并且指定的 keyType 与现有的 keyType 不同,则更新将失败。定义的值为:

  • "generic" - 凭据是一个通用的数据集合。这相当于不包括 keyType。

  • 扩展验证按以下方式执行:

  • 一个或多个字符串必须存在于 keyStore 中。

  • keyStore 中的每个字符串都必须有一个在 base64 中编码的值。

  • "passwordHash" - 凭据是密码哈希。

  • 扩展验证按以下方式执行:

  • 凭据的名称必须是唯一的。

  • 凭据名称必须等于有效的用户资源 ID。

  • 不得更改凭据的名称。

  • 相应的用户资源必须具有 "authProvider" 为 "local"。

  • 在 keyStore 中必须存在一个"明文"字符串,其值包含 base64 编码的明文密码:

  • 此密码明文必须符合该帐户的密码策略。

  • 密码以哈希的形式存储。

  • "change" 字符串必须存在于 keyStore 中,其值包含 base64 编码的字符串 "true" 或 "false"。

  • 只有当名称指示的用户 ID 不存在时,才能删除类型为 passwordHash 的凭据。

  • "apikey" - 凭据是 API 密钥。

  • 扩展验证按以下方式执行:

  • "apikey" 字符串必须存在于 keyStore 中,其值包含 base64 编码的任意字符串。

  • "kubeconfig" - 凭据是 kubeconfig。

  • 扩展验证按以下方式执行:

  • "base64" 字符串必须存在于 keyStore 中,其值包含 base64 编码的 JSON kubeconfig 文件。

  • kubeconfig 文件只能描述单个集群。

  • keyStore 中不能存在其他字段。

  • "certificate" - 凭据是 PEM 编码的证书

  • 扩展验证按以下方式执行:

  • "certificate" 字符串必须存在于 keyStore 中,其值包含 base64 编码的 PEM 证书。

  • "privkey" - 凭据是 PEM 编码的私钥。

  • 扩展验证按以下方式执行:

  • "privkey" 字符串必须存在于 keyStore 中,其值包含 base64 编码的 PEM 私钥。

  • "s3" - 表示用于 Simple Storage Service (S3) 访问的凭据。

  • 扩展验证按以下方式执行:

  • "accessKey" 字符串必须存在于 keyStore 中,其值包含 base64 编码的 S3 访问密钥。

  • "accessSecret" 字符串必须存在于 keyStore 中,其值包含 base64 编码的 S3 访问密钥。

keyStore

"keyStore"

True

包含 JSON 字符串的 JSON 对象。keyStore 中的每个字符串代表凭据的一部分。每个字符串的名称表示凭据部分,相应的 key-value 以 base64 格式存储凭据该部分的值。定义的值为:

  • 符合 base64 编码数据架构,对字符串的长度没有限制。

valid

string

False

描述凭据是否可以使用的 JSON 字符串。默认值(如果省略)为"true"。定义的值为:

  • "true" - 凭据有资格使用。

  • "false" - 不得使用凭据。

validFromTimestamp

string

False

包含指示凭据何时有效的时间戳的 JSON 字符串。这些用于凭据轮换。定义的值为:

  • 符合 ISO-8601 日期时间方案

validUntilTimestamp

string

False

包含指示凭据何时不再有效的时间戳的 JSON 字符串。这些用于凭据轮换。定义的值是:

  • 符合 ISO-8601 日期时间方案

元数据

"type_astra_metadata_update"

False

与资源关联的客户端和服务指定的元数据。定义的值为:

  • 符合 Astra 元数据架构如果在创建时未指定,则将创建没有标签的元数据对象。如果在更新时未指定,则元数据对象的标签、creationTimestamp 和 createdBy 将保留而不进行修改。

请求示例
{
  "type": "application/astra-credential",
  "version": "1.1",
  "name": "oldCert",
  "keyStore": {
    "privKey": "SGkh",
    "pubKey": "VGhpcyBpcyBhbiBleGFtcGxlLg=="
  }
}

响应

Status: 204, Indicates if the credential resource was updated.

响应

Status: 403, Forbidden
名称 Type Required Description

type

string

True

标题

string

True

详细信息

string

True

状态

string

True

correlationID

string

False

响应示例
{
  "type": "https://astra.netapp.io/problems/11",
  "title": "Operation not permitted",
  "detail": "The requested operation isn't permitted.",
  "status": "403"
}

响应

Status: 406, Not acceptable
名称 Type Required Description

type

string

True

标题

string

True

详细信息

string

True

状态

string

True

correlationID

string

False

响应示例
{
  "type": "https://astra.netapp.io/problems/32",
  "title": "Unsupported content type",
  "detail": "The response can't be returned in the requested format.",
  "status": "406"
}

响应

Status: 500, Internal server error
名称 Type Required Description

type

string

True

标题

string

True

详细信息

string

True

状态

string

True

correlationID

string

False

响应示例
{
  "type": "https://astra.netapp.io/problems/34",
  "title": "Internal server error",
  "detail": "The server was unable to process this request.",
  "status": "500"
}

响应

Status: 412, Precondition failed
名称 Type Required Description

type

string

True

标题

string

True

详细信息

string

True

状态

string

True

correlationID

string

False

响应示例
{
  "type": "https://astra.netapp.io/problems/38",
  "title": "Precondition not met",
  "detail": "The conditional headers aren't satisfied.",
  "status": "412"
}

响应

Status: 409, Conflict
名称 Type Required Description

type

string

True

标题

string

True

详细信息

string

True

状态

string

True

correlationID

string

False

响应示例
{
  "type": "https://astra.netapp.io/problems/39",
  "title": "Credential exists",
  "detail": "A credential of this type already exists.",
  "status": "409"
}

响应

Status: 502, Bad gateway
名称 Type Required Description

type

string

True

标题

string

True

详细信息

string

True

状态

string

True

correlationID

string

False

响应示例
{
  "type": "https://astra.netapp.io/problems/40",
  "title": "Communication failed",
  "detail": "Communication wasn't made with downstream services.",
  "status": "502"
}

响应

Status: 503, Service unavailable
名称 Type Required Description

type

string

True

标题

string

True

详细信息

string

True

状态

string

True

correlationID

string

False

响应示例
{
  "type": "https://astra.netapp.io/problems/41",
  "title": "Service not ready",
  "detail": "Currently, the service can't respond to this request.",
  "status": "503"
}

错误

Status: 400, Bad request
名称 Type Required Description

type

string

True

标题

string

True

详细信息

string

True

状态

string

True

correlationID

string

False

invalidParams

数组["invalidParams"]

False

无效查询参数列表

错误响应示例
{
  "type": "https://astra.netapp.io/problems/7",
  "title": "Invalid JSON payload",
  "detail": "The request body is not valid JSON.",
  "status": "400"
}

定义

查看定义

keyStore

包含 JSON 字符串的 JSON 对象。keyStore 中的每个字符串代表凭据的一部分。每个字符串的名称表示凭据部分,相应的 key-value 以 base64 格式存储凭据该部分的值。定义的值为:

  • 符合 base64 编码数据架构,对字符串的长度没有限制。

将字符串映射到字符串的哈希

类型 Astra 标签

名称 Type Required Description

name

string

True

value

string

True

type_astra_metadata_update

与资源关联的客户端和服务指定的元数据。定义的值为:

  • 符合 Astra 元数据架构如果在创建时未指定,则将创建没有标签的元数据对象。如果在更新时未指定,则元数据对象的标签、creationTimestamp 和 createdBy 将保留而不进行修改。

名称 Type Required Description

labels

数组["类型 Astra 标签"]

False

creationTimestamp

string

False

modificationTimestamp

string

False

已创建

string

False

modifiedBy

string

False

invalidFields

名称 Type Required Description

name

string

True

无效请求正文字段的名称

原因

string

True

请求正文字段无效的原因

invalidParams

名称 Type Required Description

name

string

True

无效查询参数的名称

原因

string

True

查询参数无效的原因