You need to enable JavaScript to run this app.
导航

ReplaceCertificate

最近更新时间2024.04.16 15:18:49

首次发布时间2023.03.22 11:33:29

ReplaceCertificate

API 说明
API 名称:ReplaceCertificate。
API 域名:open.volcengineapi.com 。
API 描述:替换服务器证书。
使用限制
节流限制:每秒最多提交 5 个 API 请求。

快速调试

URI 参数

在使用该部分 API 提交请求时必须包含以下 URI 参数。

除了 URI 参数,该 API 请求还需要包含签名参数。关于更多签名参数的信息,参见公共请求参数

名称类型是否必选格式说明
Action
string
[a-zA-Z]+
API 名称,如 ReplaceCertificate。
VersionstringYYYY-MM-DDAPI 版本信息。该参数的取值是 2020-04-01 。
X-Expiresint900表示签名的有效时间,单位是秒,默认值是900。

请求正文

在使用该 API 提交请求时,请求正文中可以包含的参数如下。

参数类型是否必选参数说明示例值
OldCertificateId
String
需要被替换的服务器证书的ID。
cert-123***765

UpdateMode

String

替换证书的模式,支持:

  • new:上传新证书替换

  • stock:使用已有证书替换。

new

CertificateSource

String

新服务器证书的来源,当替换模式为使用已有证书替换,即UpdateMode取值为 stock 时本参数必填且生效。不填时,默认值为 alb 。支持取值如下:

  • alb:表示通过 ALB上传的证书。

  • cert_center:表示通过火山证书中心上传的证书。

cert_center

CertificateIdString来自ALB上传的新证书 ID。选择已有证书替换时,即UpdateMode为stock,并且CertificateSource为alb时,本参数必填且生效。cert-123***765

CertCenterCertificateId

String

来自证书中心的新证书 ID。选择已有证书替换时,即UpdateMode为stock,并且CertificateSource为cert_center,本参数必填且生效。

cert-123***765

CertificateNameString证书的名称。test
DescriptionString证书的描述。test

PublicKey

String

证书公钥,当UpdateMode为new时,本字段必填且生效,格式如下:
-----BEGIN CERTIFICATE-----
服务器公钥证书(BASE64编码)
-----END CERTIFICATE-----
!!!中间不可有空行!!!
-----BEGIN CERTIFICATE-----
中级签发机构公钥证书(BASE64编码)
-----END CERTIFICATE-----

public

PrivateKey

String

证书私钥,当UpdateMode为new时,本字段必填且生效,格式如下:

  • 格式1:

-----BEGIN RSA PRIVATE KEY-----
证书私钥(BASE64编码)
-----END RSA PRIVATE KEY-----

  • 格式2:

-----BEGIN EC PARAMETERS-----
证书私钥(BASE64编码)
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
证书私钥(BASE64编码)
-----END EC PRIVATE KEY-----

private

ProjectNameString证书所属项目。当UpdateMode为new时,本字段生效。test

响应正文

参数类型参数说明示例值
RequestId
String
请求ID。
20210816110638****2514606306AF947C
CertificateIdString新证书ID。cert-*****

示例

请求示例

GET /?Action=ReplaceCertificate&OldCertificateId=cert-2jqh****hsx&PublicKey=***&PrivateKey=***&CertificateName=test&Version=2020-04-01 HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
ServiceName: alb

响应示例

{
    "ResponseMetadata": {
        "RequestId": "20210816110638****2514606306AF947C",
        "Action": "ReplaceCertificate",
        "Version": "2020-04-01",
        "Service": "alb",
        "Region": "cn-beijing"
    },
    "Result": {
        "RequestId": "202108161106****22514606306AF947C",
        "CertificateId": "cert-****"
    }
}

错误码

如果响应正文包含 Error 字段,则表示 API 请求失败。此处仅展示当前 API 的错误码,更多错误码请参见公共错误码

HTTP Code错误码错误信息错误描述
400MissingParameterThe request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, 'CertificateId'.该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如: CertificateId。

400

MissingParameter

The request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, 'CertCenterCertificateId'.

该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如: CertCenterCertificateId。

400

InvalidOldServerCertificate.InvalidStatus

The specified Old Server Certificate is not in the correct status for the request.

指定的旧服务器证书所处状态无法响应该请求。

400InvalidCertificateType.FunctionMismatchThe specified Certificate's type and Function do not match.指定的证书的类型与预期功能不匹配。
400OperationDenied.NoListenerBoundThe request on the specified certificate is denied due to no listener bound on the specified old certificate.因该旧证书未绑定任何监听器,对于该证书的操作请求被拒绝。

400

OperationDenied.ListenersBoundCountExceed

The request on the specified certificate is denied due to the count of listeners bound on the specified old certificate exceeding limit.

因该旧证书绑定的监听器数量超过上限,对于该证书的操作请求被拒绝。

400InvalidCertificateName.MalformedThe specified CertificateName is malformed.指定的 CertificateName 参数格式不合法。
400InvalidDescription.MalformedThe specified Description is malformed.指定的 Description 参数格式不合法。
400InvalidCertificateType.MalformedThe specified CertificateType is malformed.指定的 CertificateType 参数格式不合法。
400InvalidPublicKey.MalformedThe specified PublicKey is malformed. The PublicKey's length is too long.指定的 PublicKey 参数格式不合法。公钥长度太长。
400InvalidPublicKey.MalformedThe specified PublicKey is malformed.指定的 PublicKey 参数格式不合法。
400InvalidPrivateKey.MalformedThe specified PrivateKey is malformed.指定的 PrivateKey 参数格式不合法。
400InvalidPublicKey.PrivateKeyMismatchThe specified PublicKey and PrivateKey do not match.指定的公钥和私钥不匹配。

400

OperationFailed.QueryProject

The request on the specified resource failed due to the query on project failed.

因查询项目失败,对于该资源的操作请求失败。

400

InvalidCertificate.Duplicated

The specified Certificate is duplicated. The specified new certificate is not allowed to be similar to the old certificate.

指定的证书重复。新证书不能与旧证书相同。

400

InvalidCertificateSource.Malformed

The specified CertificateSource is malformed.

指定的 CertificateSource 参数格式不合法。

400

InvalidServerCertificate.InvalidStatus

The specified Server Certificate is not in the correct status for the request.

指定的服务器证书所处状态无法响应该请求。

400InvalidCertificateServiceSSLCertificate.InvalidStatusThe specified Certificate Service SSL Certificate is not in the correct status for the request. Please check if the certificate has been issued.指定的证书中心 SSL 证书所处状态无法响应该请求。请确认证书处于已签发状态。

400

InvalidOldCertificateType.CertificateTypeMismatch

The specified new certificate type and old certificate type do not match. The specified new certificate must be the same type as the old one.

指定的新证书类型和旧证书类型不匹配。指定的新证书必须与旧证书的类型相同。

400OperationFailed.QueryIAMThe request on the specified resource failed due to the query on IAM failed.因请求 IAM 失败,对于该资源的操作请求失败。
400OperationFailed.QueryCertificateServiceThe request on the specified resource failed due to the query on Certificate Service failed.因请求证书中心服务失败,对于该资源的操作请求失败。
400InvalidUpdateMode.MalformedThe specified UpdateMode is malformed.指定的 UpdateMode 参数格式不合法。
400QuotaExceed.CertPerRegionYou've reached the limit on the number of server certificates the current region you can create in, usage xx/xx.已达到当前地域可创建的服务器证书的数量上限。目前已使用xxx,配额为xxx。

400

OperationFailed.AddIntoProjectFailed

The request on the specified resource failed due to adding it into the project failed.

因将资源加入至项目中失败,对于该资源的操作请求失败。

400InvalidCertificate.InvalidStatusThe specified Certificate is not in the correct status for the request.指定的证书所处状态无法响应该请求。

400

InvalidLoadBalancer.InvalidStatus

The related LoadBalancer is not in the correct status for the request.

关联的 ALB 实例所处状态无法响应该请求。

404InvalidOldServerCertificate.NotFoundThe specified Old Server Certificate does not exist.指定的旧服务器证书不存在。
404InvalidProject.NotFoundThe specified Project does not exist.指定的项目不存在。

404

InvalidServerCertificate.NotFound

The specified Server Certificate does not exist.

指定的服务器证书不存在。