查询云服务器详情列表-九游平台
功能介绍
根据用户请求条件筛选、查询所有的弹性云服务器,并关联获取弹性云服务器的详细信息。
该接口支持查询弹性云服务器计费方式,以及是否被冻结。
接口约束
当前云服务器详情列表中未包含包年/包月云服务器到期时间,如需获取,可以通过客户运营能力相关接口进行查询,详细内容,请参见。
调试
您可以在中调试该接口。
uri
get /v1/{project_id}/cloudservers/detail?flavor={flavor}&name={name}&status={status}&limit={limit}&offset={offset}¬-tags={not-tags}&reservation_id={reservation_id}&enterprise_project_id={enterprise_project_id}&tags={tags}&ip={ip}
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
offset |
否 |
integer |
页码(废弃,不推荐使用,建议使用marker进行分页查询)。 当前页面数,默认值为1,取值范围大于等于0。 当取值为0时,系统默认返回第1页,与取值为1时相同。 建议设置该参数大于等于1。 |
marker |
否 |
string |
以单页最后一条server的id作为分页标记。 |
flavor |
否 |
string |
云服务器规格id。 已上线的规格请参见《弹性云服务器产品介绍》的“实例规格”章节。 |
name |
否 |
string |
云服务器名称,匹配规则为模糊匹配。 支持特殊字符,例如,"." 匹配除换行符(\n、\r)之外的任何单个字符,相等于 [^\n\r]。 |
status |
否 |
string |
云服务器状态。 取值范围: active、build、error、hard_reboot、migrating、reboot、rebuild、resize、revert_resize、shutoff、verify_resize、deleted、shelved、shelved_offloaded 、unknown 弹性云服务器状态说明请参考云服务器状态
说明:
当云服务器处于中间状态时,查询范围如下:
|
limit |
否 |
integer |
查询返回云服务器列表当前页面的数量。 每页默认值是25,最多返回1000台云服务器的信息,如果数据量过大建议设置成200。 |
tags |
否 |
string |
查询tag字段中包含该值的云服务器。 |
not-tags |
否 |
string |
查询tag字段中不包含该值的云服务器。 示例:查询的云服务器列表中不包含裸金属服务器,该字段设置如下:not-tags=__type_baremetal |
reservation_id |
否 |
string |
使用openstack nova 接口批量创建弹性云服务器时,会返回该id,用于查询本次批量创建的弹性云服务器。 |
enterprise_project_id |
否 |
string |
查询绑定某个企业项目的弹性云服务器。 若需要查询当前用户所有企业项目绑定的弹性云服务器,请传参all_granted_eps。
说明:
|
ip |
否 |
string |
ipv4地址过滤结果,匹配规则为模糊匹配。 此处ip为云服务器的私有ip。 |
ip_eq |
否 |
string |
ipv4地址过滤结果,匹配规则为精确匹配。 此处ip为云服务器的私有ip。 |
server_id |
否 |
string |
云服务器id,格式为uuid,匹配规则为精确匹配 示例:server_id={id1}&server_id={id2}
说明:
|
请求消息
无
响应消息
参数 |
参数类型 |
描述 |
---|---|---|
servers |
array of objects |
弹性云服务器详情列表,具体参照接口。 |
count |
integer |
弹性云服务器的总数。 |
请求示例
查询云服务器详情列表,每页返回10个记录,从第1页开始。
get https://{endpoint}/v1/{project_id}/cloudservers/detail?offset=1&limit=10
响应示例
{ "count":4, "servers":[ { "fault":null, "id":"b37fd80e-ac67-4d02-b9f1-9891c9c0fabf", "name":"ecs-5e70", "addresses":{ "164489f6-cbf7-45b4-b6d0-d407c48cf7fc":[ { "version":"4", "addr":"192.168.0.206", "os-ext-ips-mac:mac_addr":"fa:16:3e:95:88:3f", "os-ext-ips:port_id":"7b5d615c-186d-4646-9cb8-444addfe9b92", "os-ext-ips:type":"fixed" }, { "version":"4", "addr":"192.168.0.8", "os-ext-ips-mac:mac_addr":"fa:16:3e:1d:88:43", "os-ext-ips:port_id":"dda2027b-2f03-497b-8d42-620da2baacc3", "os-ext-ips:type":"fixed" } ] }, "flavor":{ "disk":"0", "vcpus":"2", "ram":"1024", "id":"c3.large.2", "name":"c3.large.2", "gpus": [], "asic_accelerators": [] }, "accessipv4":"", "accessipv6":"", "status":"shutoff", "image":{ "id":"1ce5800a-e487-4c1b-b264-3353a39e2b4b" }, "hostid":"f92345b97fd291f67a29ed735a82a8983f370175d2ba3d18d66893f4", "updated":"2018-08-14t07:26:49z", "created":"2018-08-13t13:46:09z", "metadata":{ "metering.image_id":"af60e0d5-6952-4f3d-b0ed-31bb19d4a692", "metering.resourcespeccode":"c3.large.2.linux", "image_name":"hec_public_cloudinit_centos_7.4_64bit", "metering.product_id":"00301-253164-0--0", "os_bit":"64", "locksourceid":"", "lockscene":"", "metering.order_id":"cs1808132145nrvre", "lockcheckendpoint":"", "metering.imagetype":"gold", "locksource":"", "metering.resourcetype":"1", "vpc_id":"164489f6-cbf7-45b4-b6d0-d407c48cf7fc", "os_type":"linux", "charging_mode":"1" }, "tags":[ ], "description":"ecs-4cff", "locked":false, "config_drive":"", "tenant_id":"edcb94a885a84ed3a3fdf8ea4d2741da", "user_id":"bb7f23e27e7e46f3aaceb5f53a158bdc", "os-extended-volumes:volumes_attached":[ { "device":"/dev/sda", "bootindex":"0", "id":"2edc879f-022e-4bd6-b079-95a27564d449", "delete_on_termination":"false" } ], "os-ext-sts:task_state":null, "os-ext-sts:power_state":4, "os-ext-sts:vm_state":"stopped", "os-ext-srv-attr:host":"az1.dc1", "os-ext-srv-attr:instance_name":"instance-00137941", "os-ext-srv-attr:hypervisor_hostname":"nova001@248", "os-dcf:diskconfig":"manual", "os-ext-az:availability_zone":"az1-dc1", "os:scheduler_hints":{ }, "os-ext-srv-attr:root_device_name":"/dev/sda", "os-ext-srv-attr:ramdisk_id":"8999878c-4a62-4014-89be-1743ff3a5daf", "enterprise_project_id":"441d5677-b76a-4dd4-a97a-ef7fd633c095", "os-ext-srv-attr:user_data":"iyevymlul2jhc2gkzwnobyancm9vddoknirkq2fzuwqkbm5wvmhjufzlnvmwc3pxbnjglnzvz1fcwk4xteo5vy8wd09wtmfzawpbrxdtrnhuqmzatllvzxhbwktvwfvtevheeerusumzv2jjzejyquvbzkzvly8nihwgy2hwyxnzd2qglwu7", "os-srv-usg:launched_at":"2018-08-13t13:46:46.000000", "os-ext-srv-attr:kernel_id":"", "os-ext-srv-attr:launch_index":0, "host_status":"up", "os-ext-srv-attr:reservation_id":"r-a8mg9vwr", "os-ext-srv-attr:hostname":"ecs-4cff", "sys_tags":[ { "key":"_sys_enterprise_project_id", "value":"441d5677-b76a-4dd4-a97a-ef7fd633c095" } ], "security_groups":[ { "id":"71846bf6-1cda-4515-8590-3707be295e76", "name":"sys-fullaccess" }, { "id":"b1786350-da65-11e7-b312-0255ac101b03", "name":"default" } ] }, { "fault":null, "id":"8380dcc9-0eac-4407-9f9e-df8c9eddeacd", "name":"ecs-f680", "addresses":{ "164489f6-cbf7-45b4-b6d0-d407c48cf7fc":[ { "version":"4", "addr":"192.168.0.218", "os-ext-ips-mac:mac_addr":"fa:16:3e:bb:b3:fe", "os-ext-ips:port_id":"240c696f-68d8-4f3f-941d-fecf2b375132", "os-ext-ips:type":"fixed" } ] }, "flavor":{ "disk":"0", "vcpus":"2", "ram":"1024", "id":"c3.large.2", "name":"c3.large.2", "gpus": [], "asic_accelerators": [] }, "accessipv4":"", "accessipv6":"", "status":"shutoff", "image":{ "id":"1ce5800a-e487-4c1b-b264-3353a39e2b4b" }, "hostid":"f92345b97fd291f67a29ed735a82a8983f370175d2ba3d18d66893f4", "updated":"2018-08-14t03:01:00z", "created":"2018-08-13t13:38:29z", "metadata":{ "metering.image_id":"af60e0d5-6952-4f3d-b0ed-31bb19d4a692", "metering.imagetype":"gold", "metering.resourcespeccode":"c3.large.2.linux", "image_name":"hec_public_cloudinit_centos_7.4_64bit", "metering.resourcetype":"1", "os_bit":"64", "vpc_id":"164489f6-cbf7-45b4-b6d0-d407c48cf7fc", "os_type":"linux", "charging_mode":"0" }, "tags":[ "_sys_root_resource_id=9d81b37c-455f-4528-b0ab-a6abcd0a330b", "_sys_root_resource_type=xxx.resource.type.vm" ], "description":"ecs-f680", "locked":false, "config_drive":"", "tenant_id":"edcb94a885a84ed3a3fdf8ea4d2741da", "user_id":"61ee747d36bf421fa25c51a3b9565046", "os-extended-volumes:volumes_attached":[ { "device":"/dev/sda", "bootindex":"0", "id":"3721b948-9c2f-4980-90ad-b2a16811f58c", "delete_on_termination":"false" } ], "os-ext-sts:task_state":null, "os-ext-sts:power_state":4, "os-ext-sts:vm_state":"stopped", "os-ext-srv-attr:host":"az1.dc1", "os-ext-srv-attr:instance_name":"instance-00137937", "os-ext-srv-attr:hypervisor_hostname":"nova001@248", "os-dcf:diskconfig":"manual", "os-ext-az:availability_zone":"az1-dc1", "os:scheduler_hints":{ }, "os-ext-srv-attr:root_device_name":"/dev/sda", "os-ext-srv-attr:ramdisk_id":"8999878c-4a62-4026-92be-1743ff3a5daf", "enterprise_project_id":"441d5677-b76a-4dd4-a97a-ef7fd633c095", "os-ext-srv-attr:user_data":"iyevymlul2jhc2gkzwnobyancm9vddoknir5ag9aefikve00owlwsgq2oefwcjltmtfxnezrzmfytenvbekvd0xvtmdsvjhob0dcem5wowfsu1len0znshc0vmtwdu9goerylncudguzvmrhlnvmy005elvzsdenihwgy2hwyxnzd2qglwu7", "os-srv-usg:launched_at":"2018-08-13t13:38:53.000000", "os-ext-srv-attr:kernel_id":"", "os-ext-srv-attr:launch_index":0, "host_status":"up", "os-ext-srv-attr:reservation_id":"r-7e2g78rq", "os-ext-srv-attr:hostname":"ecs-f680", "sys_tags":[ { "key":"_sys_enterprise_project_id", "value":"441d5677-b76a-4dd4-a97a-ef7fd633c095" } ], "security_groups":[ { "name":"test" } ] }, { "fault":null, "id":"fb70fed9-5774-44a7-ad4a-af3ea2c2da61", "name":"ecs-3993", "addresses":{ "00159d7d-b3c3-4108-8bc4-6658814e6422":[ { "version":"4", "addr":"192.168.20.83", "os-ext-ips-mac:mac_addr":"fa:16:3e:a9:8d:88", "os-ext-ips:port_id":"579ab762-bf89-435e-80ad-a8bdd25119c5", "os-ext-ips:type":"fixed" } ] }, "flavor":{ "disk":"0", "vcpus":"2", "ram":"1024", "id":"c3.large.2", "name":"c3.large.2", "gpus": [], "asic_accelerators": [] }, "accessipv4":"", "accessipv6":"", "status":"shutoff", "image":{ "id":"1ce5800a-e487-4c1b-b264-3353a39e2b4b" }, "hostid":"f92345b97fd291f67a29ed735a82a8983f370175d2ba3d18d66893f4", "updated":"2018-08-14t03:01:03z", "created":"2018-08-13t13:38:02z", "metadata":{ "metering.image_id":"af60e0d5-6952-4f3d-b0ed-31bb19d4a692", "metering.imagetype":"gold", "metering.resourcespeccode":"c3.large.2.linux", "image_name":"hec_public_cloudinit_centos_7.4_64bit", "metering.resourcetype":"1", "os_bit":"64", "vpc_id":"00159d7d-b3c3-4108-8bc4-6658814e6422", "os_type":"linux", "charging_mode":"0" }, "tags":[ "combined_order_id=cbrcs231010102024yl8962" ], "description":"ecs-3993", "locked":false, "config_drive":"", "tenant_id":"edcb94a885a84ed3a3fdf8ea4d2741da", "user_id":"eb4698fe015848e9a3e86cc9956e54fa", "key_name":"keypair-3b38", "os-extended-volumes:volumes_attached":[ { "device":"/dev/sda", "bootindex":"0", "id":"85bfbc4f-7733-419a-b171-c00585abf926", "delete_on_termination":"false" } ], "os-ext-sts:task_state":null, "os-ext-sts:power_state":4, "os-ext-sts:vm_state":"stopped", "os-ext-srv-attr:host":"az1.dc1", "os-ext-srv-attr:instance_name":"instance-00137936", "os-ext-srv-attr:hypervisor_hostname":"nova001@248", "os-dcf:diskconfig":"manual", "os-ext-az:availability_zone":"az1-dc1", "os:scheduler_hints":{ }, "os-ext-srv-attr:root_device_name":"/dev/sda", "os-ext-srv-attr:ramdisk_id":"8999878c-4a25-4014-92be-1743ff3a5daf", "enterprise_project_id":"441d5677-b76a-4dd4-a97a-ef7fd633c095", "os-srv-usg:launched_at":"2018-08-13t13:38:24.000000", "os-ext-srv-attr:kernel_id":"", "os-ext-srv-attr:launch_index":0, "host_status":"up", "os-ext-srv-attr:reservation_id":"r-uzsewxii", "os-ext-srv-attr:hostname":"ecs-3993", "sys_tags":[ { "key":"_sys_enterprise_project_id", "value":"441d5677-b76a-4dd4-a97a-ef7fd633c095" } ], "security_groups":[ { "name":"test" }, { "name":"default" } ] }, { "fault":null, "id":"e3d3f219-b445-4a7a-8f00-e31412481f8c", "name":"ecs-1f30", "addresses":{ "00159d7d-b3c3-4108-8bc4-6658814e6422":[ { "version":"4", "addr":"192.168.20.197", "os-ext-ips-mac:mac_addr":"fa:16:3e:41:5a:32", "os-ext-ips:port_id":"cfa2e055-54fb-427a-bde4-128bda47ae5c", "os-ext-ips:type":"fixed" } ] }, "flavor":{ "disk":"0", "vcpus":"2", "ram":"1024", "id":"c3.large.2", "name":"c3.large.2", "gpus": [], "asic_accelerators": [] }, "accessipv4":"", "accessipv6":"", "status":"active", "image":{ "id":"1ce5800a-e487-4c1b-b264-3353a39e2b4b" }, "progress":0, "hostid":"f92345b97fd291f67a29ed735a82a8983f370175d2ba3d18d66893f4", "updated":"2018-08-15t08:16:01z", "created":"2018-08-13t11:57:29z", "metadata":{ "sadfasfasf":"sdffffd", "metering.order_id":"cs180813193577oro", "metering.imagetype":"gold", "metering.resourcespeccode":"c3.large.2.win", "metering.image_id":"65cb40e6-f67e-4bef-a1e7-808166a5999d", "image_name":"hec_public_windows2008r2_ent_64bit40g_english", "aaaaaa":"0", "metering.resourcetype":"1", "aaaa":"0", "metering.product_id":"00301-146042-0--0", "os_bit":"64", "vpc_id":"00159d7d-b3c3-4108-8bc4-6658814e6422", "os_type":"windows", "charging_mode":"1" }, "tags":[ "_sys_root_resource_id=4514d9b0-d611-4744-bdf9-60802fd5198a", "_sys_root_resource_type=xxx.resource.type.vm" ], "description":"ecs-1f30", "locked":false, "config_drive":"", "tenant_id":"edcb94a885a84ed3a3fdf8ea4d2741da", "user_id":"bb7f23e27e7e46f3aaceb5f53a158bdc", "key_name":"autotest_init_tc_originalapi_create_keypairs_02_keypair", "os-extended-volumes:volumes_attached":[ { "device":"/dev/sda", "bootindex":"0", "id":"5043f66b-a0d8-4eb2-8c48-49976bcdc253", "delete_on_termination":"false" } ], "os-ext-sts:task_state":null, "os-ext-sts:power_state":1, "os-ext-sts:vm_state":"active", "os-ext-srv-attr:host":"az1.dc1", "os-ext-srv-attr:instance_name":"instance-0013772d", "os-ext-srv-attr:hypervisor_hostname":"nova001@248", "os-dcf:diskconfig":"manual", "os-ext-az:availability_zone":"az1-dc1", "os:scheduler_hints":{ }, "os-ext-srv-attr:root_device_name":"/dev/sda", "os-ext-srv-attr:ramdisk_id":"8999878c-4a62-4014-92be-1743ff3a5daf", "enterprise_project_id":"441d5677-b76a-4dd4-a97a-ef7fd633c095", "os-srv-usg:launched_at":"2018-08-13t11:57:53.576640", "os-ext-srv-attr:kernel_id":"", "os-ext-srv-attr:launch_index":0, "host_status":"up", "os-ext-srv-attr:reservation_id":"r-xmjj4pnm", "os-ext-srv-attr:hostname":"ecs-1f30", "sys_tags":[ { "key":"_sys_enterprise_project_id", "value":"441d5677-b76a-4dd4-a97a-ef7fd633c095" } ], "security_groups":[ { "name":"default" } ] } ] }
返回值
请参考通用请求返回值。
错误码
请参考。
相关文档
意见反馈
文档内容是否对您有帮助?
如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨