public async Task <OpenStackFlavorsListResponse> GetFlavors()
        {
            OpenStackFlavorsListResponse resp = new OpenStackFlavorsListResponse();

            resp = await OpenStackListFlavors(this.computeUrl, this.tenantId, this.Username, this.Token.id);

            this.flavors = resp.flavors;
            return(resp);
        }
        private async Task <OpenStackFlavorsListResponse> OpenStackListFlavors(string uri = null, string tenantId = null, string username = null, string tokenId = null)
        {
            OpenStackFlavorsListResponse flavors = new OpenStackFlavorsListResponse();

            using (var clientFlavors = new HttpClient())
            {
                clientFlavors.BaseAddress = new Uri(uri);
                clientFlavors.DefaultRequestHeaders.Accept.Clear();
                clientFlavors.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                //add token to header
                clientFlavors.DefaultRequestHeaders.Add("X-Auth-Token", tokenId);

                HttpResponseMessage response = await clientFlavors.GetAsync(tenantId + "/flavors");

                if (response.IsSuccessStatusCode)
                {
                    flavors = response.Content.ReadAsAsync <OpenStackFlavorsListResponse>().Result;
                }
            }
            return(flavors);
        }
        public async Task <string> GetFlavorRefByFlavorId(string flavorId)
        {
            OpenStackFlavorsListResponse obj = await GetFlavors();

            string flavorRef = "";

            foreach (Flavor flv in flavors)
            {
                if (flv.id == flavorId)
                {
                    foreach (Link lnk in flv.links)
                    {
                        if (lnk.rel == "self")
                        {
                            flavorRef = lnk.href;
                            break;
                        }
                    }
                    break;
                }
            }
            return(flavorRef);
        }