调用AssociateVpnGatewayWithCertificate接口为VPN网关绑定SSL证书。
使用说明
在将VPN网关和SSL证书进行绑定前,请先了解以下信息:
- 仅国密型VPN网关支持绑定SSL证书,您需要为国密型VPN网关绑定2个SSL证书,一个作为加密证书,一个作为签名证书。
- SSL证书需使用国密算法。
- 在同一个VPN网关实例下,不支持将同一个SSL证书同时指定为加密证书和签名证书。
- 首次绑定VPN网关和SSL证书时,系统会自动创建一个名称为AliyunServiceRoleForVPNCertificate的服务关联角色,并且为该角色添加名称AliyunServiceRolePolicyForVPNCertificate的权限策略,授予VPN网关拥有访问其他云资源的权限。更多信息,请参见AliyunServiceRoleForVPNCertificate。
- AssociateVpnGatewayWithCertificate接口属于异步接口,即系统先返回一个请求ID,但该VPN网关尚未成功绑定SSL证书,系统后台的绑定任务仍在进行。您可以调用DescribeVpnGateway接口查询SSL证书的绑定状态:
- 当VPN网关处于updating状态时,表示SSL证书正在绑定中。
- 当VPN网关处于active状态时,表示SSL证书绑定成功。
- AssociateVpnGatewayWithCertificate接口不支持为同一个VPN网关并发绑定SSL证书。
前提条件
请确保您已经在阿里云数字证书管理服务控制台拥有2个使用国密算法的SSL证书。关于SSL证书的更多信息,请参见什么是数字证书管理服务。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | AssociateVpnGatewayWithCertificate |
系统规定参数。取值:AssociateVpnGatewayWithCertificate。 |
RegionId | String | 是 | cn-hangzhou |
VPN网关所在的地域ID。 您可以通过调用DescribeRegions接口获取地域ID。 |
VpnGatewayId | String | 是 | vpn-bp1q8bgx4xnkm2ogj**** |
VPN网关实例ID。 说明 仅国密型VPN网关支持绑定证书。
|
CertificateType | String | 是 | Signature |
证书类型。取值:
|
CertificateId | String | 是 | 6bfe4218-ea1d**** |
证书ID。 |
ClientToken | String | 否 | 0c593ea1-3bea**** |
客户端Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。 说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId可能不一样。
|
DryRun | Boolean | 否 | false |
是否只预检此次请求。取值:
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | 4EC47282-1B74-4534-BD0E-403F3EE64CAF |
请求ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=AssociateVpnGatewayWithCertificate
&RegionId=cn-hangzhou
&VpnGatewayId=vpn-bp1q8bgx4xnkm2ogj****
&CertificateType=Signature
&CertificateId=6bfe4218-ea1d****
&ClientToken=0c593ea1-3bea****
&DryRun=false
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<AssociateVpnGatewayWithCertificateResponse>
<RequestId>4EC47282-1B74-4534-BD0E-403F3EE64CAF</RequestId>
</AssociateVpnGatewayWithCertificateResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "4EC47282-1B74-4534-BD0E-403F3EE64CAF"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | VpnGateway.Configuring | The specified service is configuring. | 服务正在配置中,请您稍后再试。 |
400 | OperationFailed.AssociationExist | The association already exists. | 当前证书已绑定。 |
400 | OperationFailed.AnotherAssociationExist | The VPN gateway has associated with %s. | 当前vpn实例已与同类证书绑定。 |
400 | SystemBusy | The system is busy. Please try again later. | 当前系统繁忙,请稍后重试。 |
403 | Forbidden | User not authorized to operate on the specified resource. | 您没有权限操作指定资源,请申请权限后再操作。 |
404 | InvalidVpnGatewayInstanceId.NotFound | The specified vpn gateway instance id does not exist. | 指定的 VPN 网关不存在,请您检查 VPN 网关是否正确。 |
409 | OperationConflict | The operation against this instance is too frequent, please try again later. | 对该实例的操作过于频繁,请稍后重试。 |
访问错误中心查看更多错误码。