查询vpc终端节点接口版本列表-凯发k8国际娱乐官网入口
功能介绍
查询vpc终端节点接口版本列表。
调用方法
请参见。
uri
get /
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
content-type |
否 |
string |
发送的实体的mime类型。推荐用户默认使用application/json, 如果api是对象、镜像上传等接口,媒体类型可按照流类型的不同进行确定。 缺省值:application/json |
响应参数
状态码: 200
参数 |
参数类型 |
描述 |
---|---|---|
versions |
array of versionobject objects |
vpc终端节点版本信息列表。 |
参数 |
参数类型 |
描述 |
---|---|---|
status |
string |
版本状态。 - current:表示该版本为主推版本。 - support:表示为老版本,但是现在还在继续支持。 -deprecated:表示为废弃版本,存在后续删除的可能。 |
id |
string |
版本id。
最小长度:1 最大长度:16 |
updated |
string |
版本发布时间。采用utc时间格式,格式为:yyyy-mmddthh:mm:ssz |
version |
string |
支持的版本号。 |
min_version |
string |
支持的微版本号。若该版本api不支持微版本,则为空。 |
links |
array of link objects |
api的url地址 |
参数 |
参数类型 |
描述 |
---|---|---|
href |
string |
当前api版本的引用地址。 |
type |
string |
发送的实体的mime类型,取值为application/json。 |
rel |
string |
当前api版本和被引用地址的关系。 |
请求示例
查询vpc终端节点接口版本列表
get https://{endpoint}/
响应示例
状态码: 200
服务器已成功处理了请求
{ "versions" : [ { "updated" : "2018-09-30t00:00:00z", "version" : "1", "min_version" : "", "status" : "current", "id" : "v1", "links" : [ { "href" : "https://{vpcep_uri}/v1", "type" : "application/json", "rel" : "self" } ] } ] }
sdk代码示例
sdk代码示例如下。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package com.huaweicloud.sdk.test;
import com.huaweicloud.sdk.core.auth.icredential;
import com.huaweicloud.sdk.core.auth.basiccredentials;
import com.huaweicloud.sdk.core.exception.connectionexception;
import com.huaweicloud.sdk.core.exception.requesttimeoutexception;
import com.huaweicloud.sdk.core.exception.serviceresponseexception;
import com.huaweicloud.sdk.vpcep.v1.region.vpcepregion;
import com.huaweicloud.sdk.vpcep.v1.*;
import com.huaweicloud.sdk.vpcep.v1.model.*;
public class listversiondetailssolution {
public static void main(string[] args) {
// the ak and sk used for authentication are hard-coded or stored in plaintext, which has great security risks. it is recommended that the ak and sk be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
// in this example, ak and sk are stored in environment variables for authentication. before running this example, set environment variables cloud_sdk_ak and cloud_sdk_sk in the local environment
string ak = system.getenv("cloud_sdk_ak");
string sk = system.getenv("cloud_sdk_sk");
icredential auth = new basiccredentials()
.withak(ak)
.withsk(sk);
vpcepclient client = vpcepclient.newbuilder()
.withcredential(auth)
.withregion(vpcepregion.valueof("cn-north-4"))
.build();
listversiondetailsrequest request = new listversiondetailsrequest();
try {
listversiondetailsresponse response = client.listversiondetails(request);
system.out.println(response.tostring());
} catch (connectionexception e) {
e.printstacktrace();
} catch (requesttimeoutexception e) {
e.printstacktrace();
} catch (serviceresponseexception e) {
e.printstacktrace();
system.out.println(e.gethttpstatuscode());
system.out.println(e.getrequestid());
system.out.println(e.geterrorcode());
system.out.println(e.geterrormsg());
}
}
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# coding: utf-8
from huaweicloudsdkcore.auth.credentials import basiccredentials
from huaweicloudsdkvpcep.v1.region.vpcep_region import vpcepregion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkvpcep.v1 import *
if __name__ == "__main__":
# the ak and sk used for authentication are hard-coded or stored in plaintext, which has great security risks. it is recommended that the ak and sk be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
# in this example, ak and sk are stored in environment variables for authentication. before running this example, set environment variables cloud_sdk_ak and cloud_sdk_sk in the local environment
ak = os.getenv("cloud_sdk_ak")
sk = os.getenv("cloud_sdk_sk")
credentials = basiccredentials(ak, sk) \
client = vpcepclient.new_builder() \
.with_credentials(credentials) \
.with_region(vpcepregion.value_of("cn-north-4")) \
.build()
try:
request = listversiondetailsrequest()
response = client.list_version_details(request)
print(response)
except exceptions.clientrequestexception as e:
print(e.status_code)
print(e.request_id)
print(e.error_code)
print(e.error_msg)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
package main
import (
"fmt"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
vpcep "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpcep/v1"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpcep/v1/model"
region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/vpcep/v1/region"
)
func main() {
// the ak and sk used for authentication are hard-coded or stored in plaintext, which has great security risks. it is recommended that the ak and sk be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
// in this example, ak and sk are stored in environment variables for authentication. before running this example, set environment variables cloud_sdk_ak and cloud_sdk_sk in the local environment
ak := os.getenv("cloud_sdk_ak")
sk := os.getenv("cloud_sdk_sk")
auth := basic.newcredentialsbuilder().
withak(ak).
withsk(sk).
build()
client := vpcep.newvpcepclient(
vpcep.vpcepclientbuilder().
withregion(region.valueof("cn-north-4")).
withcredential(auth).
build())
request := &model.listversiondetailsrequest{}
response, err := client.listversiondetails(request)
if err == nil {
fmt.printf("% v\n", response)
} else {
fmt.println(err)
}
}
|
更多编程语言的sdk代码示例,请参见的代码示例页签,可生成自动对应的sdk代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
服务器已成功处理了请求 |
错误码
请参见。
意见反馈
文档内容是否对您有帮助?
如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨