leopardslab / gocloud

☁️ Go API for open cloud
Apache License 2.0
118 stars 142 forks source link

Vultr parse response : compute, dns, storage, bare metal #111

Closed OddCN closed 5 years ago

OddCN commented 5 years ago

user can use code below, to parse the result of listdDns()

the func ParseListDnsResp(response["body"]) will return a slice of BareMetalInfo

BareMetalInfo is a struct

    listDnsResp, err := vultrdns.ParseListDnsResp(response["body"])
    if err != nil {
        fmt.Println(err)
        return
    }

    for _, dns := range listDnsResp {
        fmt.Printf("%+v\n", dns)
    }

    fmt.Println(listDnsResp[0].Data)
    fmt.Println(listDnsResp[0].Name)
    fmt.Println(listDnsResp[0].Priority)
    fmt.Println(listDnsResp[0].RecordID)

int this PR, implemented

and updated examples doc