yunify / qingcloud-sdk-go

The official QingCloud SDK for the Go programming language.
Apache License 2.0
29 stars 42 forks source link

Get zone in DescribeInstancesOutput and DescribeVolumesOutput #132

Closed wnxn closed 5 years ago

wnxn commented 5 years ago

We can get the zone ID of a instance through describe-instances command of QingCloud CLI.

# qingcloud iaas describe-instances -i i-bgvzf0a2 -z ap2a -V 1
{
  "action": "DescribeInstancesResponse", 
  "instance_set": [
    {
      "logic_volumes": [
        {
          "device": "vda2", 
          "volume_id": "os"
        }, 
        {
          "device": "vda2", 
          "volume_id": "os"
        }
      ], 
      "vxnets": [
        {
          "ipv6_address": "", 
          "vxnet_type": 1, 
          "vxnet_id": "vxnet-dh0mgel", 
          "vxnet_name": "k8s cluster vxnet", 
          "role": 1, 
          "private_ip": "192.168.0.21", 
          "nic_id": "52:54:22:2b:f5:a2"
        }
      ], 
      "keypair_ids": [], 
      "fence": null, 
      "extra": {
        "iops": 900, 
        "nic_mqueue": 0, 
        "read_throughput": 0, 
        "ivshmem": [], 
        "gpu_pci_nums": "", 
        "cpu_max": 0, 
        "cpu_model": "", 
        "bandwidth": 800, 
        "mem_max": 0, 
        "throughput": 44544, 
        "read_iops": 0, 
        "hypervisor": "kvm", 
        "gpu": 0, 
        "os_disk_size": 50, 
        "gpu_class": 0, 
        "features": 4
      }, 
      "image": {
        "ui_type": "tui", 
        "processor_type": "64bit", 
        "image_id": "bionic1x64c", 
        "features_supported": {
          "set_keypair": 1, 
          "disk_hot_plug": 1, 
          "user_data": 1, 
          "set_pwd": 1, 
          "join_multiple_managed_vxnets": 0, 
          "root_fs_rw_online": 1, 
          "nic_hot_plug": 1, 
          "root_fs_rw_offline": 1, 
          "reset_fstab": 1
        }, 
        "provider": "system", 
        "image_name": "Ubuntu Server 18.04.1 LTS 64bit", 
        "platform": "linux", 
        "os_family": "ubuntu", 
        "image_size": 20, 
        "features": 0
      }, 
      "graphics_passwd": "3F25RUDMrdf0y9LTGskK2em5FY5WtDYK", 
      "dns_aliases": [], 
      "alarm_status": "", 
      "owner": "usr-XqlPq3qV", 
      "memory_current": 4096, 
      "vcpus_current": 4, 
      "instance_name": "qke-image", 
      "sub_code": 0, 
      "graphics_protocol": "vnc", 
      "platform": "linux", 
      "instance_class": 101, 
      "status_time": "2019-07-23T02:21:49Z", 
      "status": "stopped", 
      "description": null, 
      "cpu_topology": "", 
      "tags": [], 
      "transition_status": "", 
      "eips": [], 
      "repl": "rpp-00000002", 
      "volume_ids": [], 
      "zone_id": "ap2a", 
      "lastest_snapshot_time": null, 
      "instance_group": null, 
      "instance_id": "i-bgvzf0a2", 
      "instance_type": "s1.xlarge.r1", 
      "create_time": "2019-07-08T09:39:57Z", 
      "volumes": [], 
      "resource_project_info": []
    }
  ], 
  "ret_code": 0, 
  "total_count": 1
}

But QingCloud Go SDK does not support get instance's zone ID in DescribeInstancesOutput.

https://github.com/yunify/qingcloud-sdk-go/blob/ac222d4999629785bf5ca28344fadd65d9d5efb3/service/types.go#L997-L1027

For describe volume output, we also need to get the zone ID info. Would you please support it?

huyujie commented 5 years ago

136 has support.