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

DescribeKeyPairs

最近更新时间2023.11.20 10:48:35

首次发布时间2022.07.01 09:25:35

调用 DescribeKeyPairs 接口查询密钥对列表信息。

调试

请求参数

名称类型是否必填示例值描述
ActionStringDescribeKeyPairs要执行的操作,取值:DescribeKeyPairs。
VersionString2020-04-01API的版本,取值:2020-04-01。
KeyPairNameStringssh-asfas密钥对名称,支持模糊搜索。

KeyPairNames.N

String

KeyPairNames.1=ssh_key_pair

密钥对名称,最多支持100个密钥对。

  • 参数 - N:表示密钥对的序号。
  • 多个密钥对之间用&分隔。

KeyPairIds.N

String

KeyPairIds.1=kp-ybp0x6i30gep29******

密钥对ID,最多支持100个ID。

  • 参数 - N:表示密钥对ID的序号。
  • 多个密钥对ID之间用&分隔。
FingerPrintString4158f40dbc0814eb04f0dcac4e******密钥对的指纹,根据RFC4716定义的公钥指纹格式,采用MD5信息摘要算法。

ProjectName

String

project_a

资源所属项目,一个资源只能归属于一个项目。

  • 只能包含字母、数字、下划线“_”、点“.”和中划线“-”。
  • 长度限制在64个字符以内。
NextTokenString-分页查询凭证,用于标记分页的位置,初次调用该接口时无需设置。下次查询时,取值为上一次API调用返回的NextToken参数值。

MaxResults

Integer

-

分页查询时设置的每页行数。

  • 默认值:10
  • 最大值:500

返回数据

名称
类型
示例值
描述
KeyPairs
Array of Struct
-
密钥对信息。
NextToken
String
bHpwdXJja2RxemU1eG5sb3NzdGcW1-RCEq******
本次调用返回的查询凭证值,返回为空表示该页为末页。

请求示例

GET /?Action=DescribeKeyPairs&Version=2020-04-01&MaxResults=1 HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
Service: ecs

返回示例

{
    "ResponseMetadata": {
        "RequestId": "202106111445100102252431000052****",
        "Action": "DescribeKeyPairs",
        "Version": "2020-04-01",
        "Service": "ecs",
        "Region": "cn-beijing"
    },
    "Result": {
        "NextToken": "eWJwMHd3MzE2dmVwMjkyMnk******",
        "KeyPairs": [
            {
                "KeyPairName": "ssh_key_pair",
                "KeyPairId": "kp-ybp0x6i30gep29******",
                "Description": "",
                "FingerPrint": "6f3c737485f6836b124648db49******",
                "CreatedAt": "2022-05-20T11:24:16+08:00",
                "UpdatedAt": "2022-05-20T11:24:16+08:00",
                "ProjectName": "project_a"
            }
        ]
    }
}

错误码

HttpCode错误码错误信息描述
400LimitExceeded.MaximumKeyPairNamesYou've reached the limit on the number of KeyPairNames that you can set.指定的密钥对数量超过了最大限制。
400LimitExceeded.MaximumKeyPairIdsYou've reached the limit on the number of KeyPairIds that you can set.指定的密钥对ID数量超过限制。
400InvalidArgumentThe specified argument is invalid.指定的参数不合法。
429FlowLimitExceededYou've reach the limit on request rate of resources.您已超过资源请求限速。
500InternalErrorAn internal error has occurred.内部错误,请重试。如果多次尝试失败,请提交工单。