查询弹性云服务器详情列表
操作步骤
- 指定limit查询云服务器详情列表
- 接口相关信息
URI格式: GET /v1/{project_id}/cloudservers/detail
详情请参见“查询云服务器详情列表”。
- 请求示例
GET https://{endpoint}/v1/743b4c0428d945316666666666666666/cloudservers/detail?offset=1&limit=100
{endpoint}信息请从地区和终端节点获取。
limit值可根据云服务器数据调整。
- 响应示例
{ "count":2, "servers":[ { "fault":null, "id":"743b4c0428d945316666666666666666", "name":"ecs-5e70", "addresses":{ "140fd038-c4ae-4c32-ac07-34b525eb6b95":[ { "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":"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" } ] } ] }
- 接口相关信息
- 指定limit与marker查询云服务器详情列表
- 接口相关信息
URI格式: GET /v1/{project_id}/cloudservers/detail
接口与 步骤1 保持一致。
- 请求示例
GET https://{endpoint}/v1/743b4c0428d945316666666666666666/cloudservers/detail?limit=100&marker=f215afe8-b0c2-41cc-9191-585638166812
接口返回了下一页的接口URI,参考返回body体中的 servers_links 中的href字段,如果不存在该字段,表示已经不存在下一页。
- 响应示例
{ "servers":[ ..... { "fault":null, "id":"743b4c0428d945316666666666666666", "name":"ecs-1f30", "addresses":{ "140fd038-c4ae-4c32-ac07-34b525eb6b95":[ { "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" } ] } ] }
- 接口相关信息
- 汇总查询结果。
参考1持续调用,如果查询的云服务器列表为空,或者返回的body体中不存在servers_links 字段,表明所有云服务器查询完成。
汇总所有查询到的云服务器即当前查询条件下的所有云服务器。