Forráskód Böngészése

1: Implement Invoice {Create , List , Show}
2: ResetPassword
3: ForgetPassword
4: Resolve Conflict of VMNames
5: Fix Dashboards Lists

torabkheslat 4 éve
szülő
commit
1ccbdbba75
4 módosított fájl, 1013 hozzáadás és 48 törlés
  1. 317 0
      Billing.go
  2. 36 9
      handler.go
  3. 4 0
      main.go
  4. 656 39
      ovirt.go

+ 317 - 0
Billing.go

@@ -0,0 +1,317 @@
+package main
+
+import (
+	"crypto/sha256"
+	"encoding/json"
+	"fmt"
+	"github.com/dgrijalva/jwt-go"
+	"github.com/labstack/echo"
+	"io/ioutil"
+	"net/http"
+	"strconv"
+	"strings"
+	"time"
+)
+
+type billing struct {
+}
+
+func (b billing) list(c echo.Context) error {
+
+	type InvoiceLists struct {
+		Embedded struct {
+			IaaSInvoices []struct {
+				CreatedAt       time.Time `json:"createdAt"`
+				UpdatedAt       time.Time `json:"updatedAt"`
+				UUID            string    `json:"uuid"`
+				CustomerID      string    `json:"customerId"`
+				Plan            string    `json:"plan"`
+				DurationDay     int       `json:"durationDay"`
+				VcoreQuantity   int       `json:"vcoreQuantity"`
+				VcoreCost       float64   `json:"vcoreCost"`
+				RAMQuantity     int       `json:"ramQuantity"`
+				RAMCost         float64   `json:"ramCost"`
+				StorageQuantity int       `json:"storageQuantity"`
+				StorageCost     float64   `json:"storageCost"`
+				ExtraIPCount    int       `json:"extraIpCount"`
+				ExtraIPCost     float64   `json:"extraIpCost"`
+				ExtraBwQuantity int       `json:"extraBwQuantity"`
+				ExtraBwCost     float64   `json:"extraBwCost"`
+				Sum             float64   `json:"sum"`
+				Links           struct {
+					Self struct {
+						Href string `json:"href"`
+					} `json:"self"`
+					IaaSInvoice struct {
+						Href string `json:"href"`
+					} `json:"iaaSInvoice"`
+				} `json:"_links"`
+			} `json:"iaaSInvoices"`
+		} `json:"_embedded"`
+		Links struct {
+			Self struct {
+				Href string `json:"href"`
+			} `json:"self"`
+		} `json:"_links"`
+	}
+	type InvoiceListsResponse struct {
+		Data []struct {
+			SUM          float64   `json:"sum"`
+			PaidState    bool      `json:"paidstate"`
+			DueDate      time.Time `json:"duedate"`
+			RemainedDays int64     `json:"remaineddays"`
+			InvoiceUUID  string    `json:"invoiceUUID"`
+		} `json:"data"`
+		Message string `json:"message"`
+		Origin  string `json:"origin"`
+		Code    int    `json:"code"`
+	}
+	user := c.Get("user").(*jwt.Token)
+	claims := user.Claims.(jwt.MapClaims)
+	_sha256 := sha256.Sum256([]byte(string(claims["name"].(string))))
+	var hashChannel_ = make(chan []byte, 1)
+	hashChannel_ <- _sha256[:]
+	token := decrypt(<-hashChannel_, claims["IPAToken"].(string))
+	_BA := strings.Split(token, ";")
+	BA := _BA[len(_BA)-2]
+	UserUUID := login(BA).AuthenticatedUser.ID
+	url := "http://172.20.15.24/iaaSInvoices/search/findByCustomerIdEquals?customerId=" + UserUUID
+	method := "GET"
+
+	client := &http.Client{
+	}
+	req, err := http.NewRequest(method, url, nil)
+
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	res, err := client.Do(req)
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	defer res.Body.Close()
+
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	//fmt.Println(string(body))
+	_InvoiceList := InvoiceLists{}
+	err = json.Unmarshal(body, &_InvoiceList)
+	if err != nil {
+		fmt.Println(err)
+		//return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice
+	}
+	//fmt.Println("Length: ", len(_InvoiceList.Embedded.IaaSInvoices))
+	_InvoiceListsResponse := InvoiceListsResponse{
+		Data:    nil,
+		Message: "Done",
+		Origin:  "Billing-listInvoices",
+		Code:    1000,
+	}
+	_Data := _InvoiceListsResponse.Data
+	x := struct {
+		SUM          float64   `json:"sum"`
+		PaidState    bool      `json:"paidstate"`
+		DueDate      time.Time `json:"duedate"`
+		RemainedDays int64     `json:"remaineddays"`
+		InvoiceUUID  string    `json:"invoiceUUID"`
+	}{}
+
+	y := x
+	for _, i := range _InvoiceList.Embedded.IaaSInvoices {
+		y.SUM = i.Sum
+		y.InvoiceUUID = i.UUID
+		y.PaidState = false
+		y.DueDate = i.CreatedAt
+		y.RemainedDays = (i.CreatedAt.Unix() - time.Now().Unix()) / 3600 / 24
+		_Data = append(_Data, y)
+	}
+
+	//fmt.Println("length of data: ",len(_Data))
+
+	_InvoiceListsResponse.Data = _Data
+	return c.JSON(http.StatusOK, _InvoiceListsResponse)
+}
+
+func (b billing) Show(c echo.Context) error {
+	type Invoice struct {
+		CreatedAt       time.Time `json:"createdAt"`
+		UpdatedAt       time.Time `json:"updatedAt"`
+		ID              int       `json:"id"`
+		UUID            string    `json:"uuid"`
+		CustomerID      string    `json:"customerId"`
+		Plan            string    `json:"plan"`
+		DurationDay     int       `json:"durationDay"`
+		VcoreQuantity   int       `json:"vcoreQuantity"`
+		VcoreCost       float64   `json:"vcoreCost"`
+		RAMQuantity     int       `json:"ramQuantity"`
+		RAMCost         float64   `json:"ramCost"`
+		StorageQuantity int       `json:"storageQuantity"`
+		StorageCost     float64   `json:"storageCost"`
+		ExtraIPCount    int       `json:"extraIpCount"`
+		ExtraIPCost     float64   `json:"extraIpCost"`
+		ExtraBwQuantity int       `json:"extraBwQuantity"`
+		ExtraBwCost     float64   `json:"extraBwCost"`
+		Sum             float64   `json:"sum"`
+	}
+	type InvoiceResponse struct {
+		Data struct {
+			CreatedAt       time.Time `json:"createdAt"`
+			UpdatedAt       time.Time `json:"updatedAt"`
+			ID              int       `json:"id"`
+			UUID            string    `json:"uuid"`
+			CustomerID      string    `json:"customerId"`
+			Plan            string    `json:"plan"`
+			DurationDay     int       `json:"durationDay"`
+			VcoreQuantity   int       `json:"vcoreQuantity"`
+			VcoreCost       float64   `json:"vcoreCost"`
+			RAMQuantity     int       `json:"ramQuantity"`
+			RAMCost         float64   `json:"ramCost"`
+			StorageQuantity int       `json:"storageQuantity"`
+			StorageCost     float64   `json:"storageCost"`
+			ExtraIPCount    int       `json:"extraIpCount"`
+			ExtraIPCost     float64   `json:"extraIpCost"`
+			ExtraBwQuantity int       `json:"extraBwQuantity"`
+			ExtraBwCost     float64   `json:"extraBwCost"`
+			Sum             float64   `json:"sum"`
+		} `json:"data"`
+		Message string `json:"message"`
+		Origin  string `json:"origin"`
+		Code    int    `json:"code"`
+	}
+	user := c.Get("user").(*jwt.Token)
+	claims := user.Claims.(jwt.MapClaims)
+	_sha256 := sha256.Sum256([]byte(string(claims["name"].(string))))
+	var hashChannel_ = make(chan []byte, 1)
+	hashChannel_ <- _sha256[:]
+	token := decrypt(<-hashChannel_, claims["IPAToken"].(string))
+	_BA := strings.Split(token, ";")
+	BA := _BA[len(_BA)-2]
+	UserUUID := login(BA).AuthenticatedUser.ID
+	InvoiceUUID := c.FormValue("InvoiceUUID")
+	url := "http://172.20.15.24/invoice/iaas/get?uuid=" + InvoiceUUID
+	method := "GET"
+	client := &http.Client{
+	}
+	req, err := http.NewRequest(method, url, nil)
+
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	res, err := client.Do(req)
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	defer res.Body.Close()
+
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	_Invoice := Invoice{}
+	err = json.Unmarshal(body, &_Invoice)
+	if err != nil {
+		fmt.Println(err)
+		//return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice
+	}
+	if _Invoice.CustomerID != UserUUID {
+		resp := _response{
+			Origin:  "Billing-ShowInvoice",
+			Message: "Unauthorized Access",
+			Code:    1001,
+		}
+		return c.JSON(403, resp)
+	}
+	_InvoiceResponse := InvoiceResponse{
+		Data:    _Invoice,
+		Message: "Done",
+		Origin:  "Billing-ShowInvoice",
+		Code:    1000,
+	}
+	return c.JSON(http.StatusOK, _InvoiceResponse)
+}
+
+func IaaSCreate(UserUUID string, period string, CPU string, memory string, storageVolume string, extraIP string, extraBW string) (CPUPrice float64, memPrice float64, StoragePrice float64, IPPrice float64, extraBWPrice float64, sum float64, InvoiceID string) {
+	type CreateResponse struct {
+		CreatedAt       time.Time `json:"createdAt"`
+		UpdatedAt       time.Time `json:"updatedAt"`
+		ID              int       `json:"id"`
+		UUID            string    `json:"uuid"`
+		CustomerID      string    `json:"customerId"`
+		Plan            string    `json:"plan"`
+		DurationDay     int       `json:"durationDay"`
+		VcoreQuantity   int       `json:"vcoreQuantity"`
+		VcoreCost       float64   `json:"vcoreCost"`
+		RAMQuantity     int       `json:"ramQuantity"`
+		RAMCost         float64   `json:"ramCost"`
+		StorageQuantity int       `json:"storageQuantity"`
+		StorageCost     float64   `json:"storageCost"`
+		ExtraIPCount    int       `json:"extraIpCount"`
+		ExtraIPCost     float64   `json:"extraIpCost"`
+		ExtraBwQuantity int       `json:"extraBwQuantity"`
+		ExtraBwCost     float64   `json:"extraBwCost"`
+		Sum             float64   `json:"sum"`
+	}
+	url := "http://172.20.15.24:80/invoice/iaas/create"
+	method := "POST"
+	_period, _ := strconv.Atoi(period)
+	_CPU, _ := strconv.Atoi(CPU)
+	_memory, _ := strconv.Atoi(memory)
+	_storageVolume, _ := strconv.Atoi(storageVolume)
+	_extraIP, _ := strconv.Atoi(extraIP)
+	_extraBW, _ := strconv.Atoi(extraBW)
+	payload := strings.NewReader(fmt.Sprintf(`{
+    "customerId": "%s",
+    "durationDay": "%d",
+    "vCoreCount": "%d",
+    "ramVolume": "%d",
+    "storageVolume": "%d",
+    "extraIPCount": "%d",
+    "extraBW": "%d"
+}`, UserUUID, _period*30, _CPU, _memory/1024/1024/1024, _storageVolume/1024/1024/1024, _extraIP, _extraBW))
+	//fmt.Println("Mem1 :",memory," Mem2:",_memory,"Array: ",payload)
+
+	client := &http.Client{
+	}
+	req, err := http.NewRequest(method, url, payload)
+
+	if err != nil {
+		fmt.Println(err)
+		return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice, sum, InvoiceID
+	}
+	req.Header.Add("Content-Type", "application/json")
+
+	res, err := client.Do(req)
+	if err != nil {
+		fmt.Println(err)
+		return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice, sum, InvoiceID
+	}
+	defer res.Body.Close()
+
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		fmt.Println(err)
+		return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice, sum, InvoiceID
+	}
+	//fmt.Println(string(body))
+	//return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice
+	_CreateResponse := CreateResponse{}
+	err = json.Unmarshal(body, &_CreateResponse)
+	if err != nil {
+		fmt.Println(err)
+		//return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice
+	}
+	CPUPrice = _CreateResponse.VcoreCost
+	memPrice = _CreateResponse.RAMCost
+	extraBWPrice = _CreateResponse.ExtraBwCost
+	IPPrice = _CreateResponse.ExtraIPCost
+	StoragePrice = _CreateResponse.StorageCost
+	return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice, _CreateResponse.Sum, _CreateResponse.UUID
+}

+ 36 - 9
handler.go

@@ -11,6 +11,7 @@ import (
 	"net/url"
 	"strconv"
 	"strings"
+	"sync"
 	"time"
 
 	"github.com/dchest/uniuri"
@@ -110,6 +111,7 @@ type user_findResult struct {
 	} `json:"result"`
 	Version string `json:"version"`
 }
+
 var User = userInfo{}
 
 func (h *handler) login(c echo.Context) error {
@@ -878,13 +880,15 @@ func (h *handler) ListServices(c echo.Context) error {
 	_BA := strings.Split(token, ";")
 	BA := _BA[len(_BA)-2]
 	db, _ := sql.Open("mysql", MySQLUSER+":"+MySQLPASS+"@tcp(127.0.0.1:3306)/zicloud")
-	results, _ := db.Query("SELECT `type` as `type`, uuid as Service_uuid , active , objectName FROM service_profile where uid=" + claims["IPAUid"].(string))
+	results, _ := db.Query("SELECT `type` as `type`, uuid as Service_uuid , active , objectName FROM service_profile where uid=" + claims["IPAUid"].(string) + " and active!='-1'")
 	activeCount := 0
 	totalCount := 0
 	activeVMCount := 0
 	totalVMCount := 0
 	var cpu, mem float64
 	var _type, service_uuid, active, objectName string
+	///TODO: too SLOW
+	var wg sync.WaitGroup
 	for results.Next() {
 		err := results.Scan(&_type, &service_uuid, &active, &objectName)
 		if err != nil {
@@ -894,21 +898,44 @@ func (h *handler) ListServices(c echo.Context) error {
 				Code:    1001,
 			}
 			//b, _ := json.MarshalIndent(resp, "", "  ")
-			return c.JSON(http.StatusOK, resp)
+			return c.JSON(http.StatusInternalServerError, resp)
 		}
 		if _type == "VM" {
 			if active == "1" {
-				activeCount++
-				activeVMCount++
+				wg.Add(1)
+				go func(activeCount *int, activeVMCount *int, cpu *float64, mem *float64 ,totalCount *int, totalVMCount *int,suid string) {
+					_, _cpu, _mem, err := vmStatistics(BA, suid)
+					defer wg.Done()
+					//fmt.Println("Service UUID: ",suid)
+					if err != nil {
+						//fmt.Println("Error in vmDetails : ", err)
+						//continue
+						*totalVMCount--
+						*totalCount--
+						return
+					}
+					*activeCount++
+					*activeVMCount++
+					*cpu += _cpu
+					*mem += _mem
+				}(&activeCount, &activeVMCount, &cpu, &mem,&totalCount,&totalVMCount,service_uuid)
+				//_, _cpu, _mem, err := vmStatistics(BA, service_uuid)
+				//if err != nil {
+				//	fmt.Println("Error in vmDetails : ", err)
+				//	continue
+				//}
+				//activeCount++
+				//fmt.Println("activeCount:", activeCount)
 				//fmt.Println(vmStatistics(BA,service_uuid))
-				_, _cpu, _mem := vmStatistics(BA, service_uuid)
-				cpu += _cpu
-				mem += _mem
+				//activeVMCount++
+				//cpu += _cpu
+				//mem += _mem
 			}
 			totalCount++
 			totalVMCount++
 		}
 	}
+	wg.Wait()
 	//fmt.Println(activeVMCount)
 	//fmt.Println(activeCount)
 	//fmt.Println(totalCount)
@@ -954,7 +981,7 @@ func (h *handler) ListServices(c echo.Context) error {
 }
 func (h *handler) PriceCalc(c echo.Context) error {
 	user := c.Get("user").(*jwt.Token)
-	db, _:= sql.Open("mysql", MySQLUSER+":"+MySQLPASS+"@tcp(127.0.0.1:3306)/zicloud")
+	db, _ := sql.Open("mysql", MySQLUSER+":"+MySQLPASS+"@tcp(127.0.0.1:3306)/zicloud")
 	_, _ = db.Query("SELECT uuid as UUID ,task_apiCall as TaskAPICall , cron_expression as CronExpression , related_uuid as Ruuid, type FROM scheduler where active=1")
 	_, _ = db.Query("SELECT uuid as UUID ,task_apiCall as TaskAPICall , cron_expression as CronExpression , related_uuid as Ruuid, type FROM scheduler where active=1")
 	_, _ = db.Query("SELECT uuid as UUID ,task_apiCall as TaskAPICall , cron_expression as CronExpression , related_uuid as Ruuid, type FROM scheduler where active=1")
@@ -979,7 +1006,7 @@ func (h *handler) PriceCalc(c echo.Context) error {
 	resp := PriceCalculator{
 		Data: struct {
 			TotalPrice string `json:"TotalPrice"`
-		}{TotalPrice: strconv.Itoa((cpu*500 + mem + 10 + hdd*19 + nic*10000)*period)},
+		}{TotalPrice: strconv.Itoa((cpu*500 + mem + 10 + hdd*19 + nic*10000) * period)},
 		Origin: "PriceCalc",
 		Code:   1000,
 	}

+ 4 - 0
main.go

@@ -150,6 +150,10 @@ func main() {
 	echoHandler.POST("/vmDetails", iaas.vmDetails, isLoggedIn)
 	echoHandler.POST("/ovirtPayment", iaas.ovirtPayment, isLoggedIn )
 
+	billing:=billing{}
+	echoHandler.POST("/billingList", billing.list, isLoggedIn)
+	echoHandler.POST("/billingShow", billing.Show, isLoggedIn)
+
 	echoHandler.Logger.Fatal(echoHandler.Start(os.Args[1] + ":" + os.Args[2]))
 }
 func encrypt(key []byte, text string) string {

+ 656 - 39
ovirt.go

@@ -4,6 +4,7 @@ import (
 	"crypto/sha256"
 	"database/sql"
 	"encoding/json"
+	"errors"
 	"fmt"
 	"github.com/dgrijalva/jwt-go"
 	_ "github.com/go-sql-driver/mysql"
@@ -318,11 +319,13 @@ func (o ovirt) addvm(c echo.Context) error {
 	type AddVMPayment struct {
 		Data struct {
 			Price struct {
-				CPU    string `json:"cpu"`
-				Mem    string `json:"mem"`
-				Disk   string `json:"disk"`
-				Nic    string `json:"nic"`
-				Period string `json:"period"`
+				CPU    float64 `json:"cpu"`
+				Mem    float64 `json:"mem"`
+				Disk   float64 `json:"disk"`
+				Nic    float64 `json:"nic"`
+				BW     float64 `json:"bw"`
+				SUM    float64 `json:"sum"`
+				Period string  `json:"period"`
 			} `json:"price"`
 			InvoiceUUID string `json:"invoiceUUID"`
 		} `json:"data"`
@@ -338,8 +341,8 @@ func (o ovirt) addvm(c echo.Context) error {
 	token := decrypt(<-hashChannel_, claims["IPAToken"].(string))
 	_BA := strings.Split(token, ";")
 	BA := _BA[len(_BA)-2]
-	var vmname, vmdescr, vmcomment, templatename, cpuSock, cpuCore, cpuThread, mem, Disk, nic, period string
-	vmname = c.FormValue("VmName")
+	var vmname, vmdescr, vmcomment, templatename, cpuSock, cpuCore, cpuThread, mem, Disk, nic, period, extraBW string
+	vmname = login(BA).AuthenticatedUser.ID + "_" + c.FormValue("VmName")
 	vmdescr = c.FormValue("VmDescr")
 	vmcomment = c.FormValue("VmComment")
 	templatename = c.FormValue("VmTempl")
@@ -347,6 +350,7 @@ func (o ovirt) addvm(c echo.Context) error {
 	Disk = c.FormValue("VmDisk")
 	period = c.FormValue("VmPeriod")
 	nic = c.FormValue("VmNIC")
+	extraBW = c.FormValue("extraBW")
 	sshKey := c.FormValue("sshKey")
 	rootpass := c.FormValue("rootpass")
 	cpuCore = "1"
@@ -506,29 +510,36 @@ func (o ovirt) addvm(c echo.Context) error {
 		Value: "application/json",
 	})
 	uuid, _ := uuidgen("APIGW-Ovirt-addVMTask")
-	invoiceUUID, _ := uuidgen("APIGW-FakeInvoice")
+	//invoiceUUID, _ := uuidgen("APIGW-FakeInvoice")
+	CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice, SUM, invoiceUUID := IaaSCreate(login(BA).AuthenticatedUser.ID, period, cpuThread, mem, Disk, nic, extraBW)
 	responseInvoiece := AddVMPayment{
 		Data: struct {
 			Price struct {
-				CPU    string `json:"cpu"`
-				Mem    string `json:"mem"`
-				Disk   string `json:"disk"`
-				Nic    string `json:"nic"`
-				Period string `json:"period"`
+				CPU    float64 `json:"cpu"`
+				Mem    float64 `json:"mem"`
+				Disk   float64 `json:"disk"`
+				Nic    float64 `json:"nic"`
+				BW     float64 `json:"bw"`
+				SUM    float64 `json:"sum"`
+				Period string  `json:"period"`
 			} `json:"price"`
 			InvoiceUUID string `json:"invoiceUUID"`
 		}{
 			Price: struct {
-				CPU    string `json:"cpu"`
-				Mem    string `json:"mem"`
-				Disk   string `json:"disk"`
-				Nic    string `json:"nic"`
-				Period string `json:"period"`
+				CPU    float64 `json:"cpu"`
+				Mem    float64 `json:"mem"`
+				Disk   float64 `json:"disk"`
+				Nic    float64 `json:"nic"`
+				BW     float64 `json:"bw"`
+				SUM    float64 `json:"sum"`
+				Period string  `json:"period"`
 			}{
-				CPU:    cpuThread,
-				Mem:    mem,
-				Disk:   Disk,
-				Nic:    nic,
+				CPU:    CPUPrice,
+				Mem:    memPrice,
+				Disk:   StoragePrice,
+				Nic:    IPPrice,
+				BW:     extraBWPrice,
+				SUM:    SUM,
 				Period: period,
 			},
 			InvoiceUUID: invoiceUUID,
@@ -537,6 +548,16 @@ func (o ovirt) addvm(c echo.Context) error {
 		Origin:  "AddVM",
 		Code:    1000,
 	}
+	if len(invoiceUUID) < 5 {
+		resp := _response{
+			Origin:  "ovirt-addvm",
+			Message: "Error on Invoice Calculation",
+			Code:    1001,
+		}
+		b, _ := json.MarshalIndent(resp, "", "  ")
+		return c.String(http.StatusBadRequest, string(b))
+	}
+	//fmt.Println("Invoice: ",invoiceUUID)
 	__createVM, _ := json.MarshalIndent(newvm, "", "  ")
 	// Add VM Task
 	addTask(uuid, string(__createVM), "", "APIGW", "VM Creation for "+claims["name"].(string), invoiceUUID, "0", "0")
@@ -560,7 +581,7 @@ func (o ovirt) addvm(c echo.Context) error {
 			"'" + login(BA).AuthenticatedUser.ID + "'," +
 			"NOW()" + "," +
 			"NOW() ," +
-			"false" + "," +
+			"-1" + "," +
 			"'" + vmname + "'," +
 			"'" + invoiceUUID + "' )")
 		defer insert.Close()
@@ -635,6 +656,212 @@ func (o ovirt) addvm(c echo.Context) error {
 	return c.JSON(http.StatusOK, responseInvoiece)
 }
 func (o ovirt) listVM(c echo.Context) error {
+	type listVMs struct {
+		VM []struct {
+			Fqdn                 string `json:"fqdn,omitempty"`
+			GuestOperatingSystem struct {
+				Architecture string `json:"architecture"`
+				Codename     string `json:"codename"`
+				Distribution string `json:"distribution"`
+				Family       string `json:"family"`
+				Kernel       struct {
+					Version struct {
+						Build       string `json:"build"`
+						FullVersion string `json:"full_version"`
+						Major       string `json:"major"`
+						Minor       string `json:"minor"`
+						Revision    string `json:"revision"`
+					} `json:"version"`
+				} `json:"kernel"`
+				Version struct {
+					FullVersion string `json:"full_version"`
+					Major       string `json:"major"`
+				} `json:"version"`
+			} `json:"guest_operating_system,omitempty"`
+			GuestTimeZone struct {
+				Name      string `json:"name"`
+				UtcOffset string `json:"utc_offset"`
+			} `json:"guest_time_zone,omitempty"`
+			NextRunConfigurationExists string `json:"next_run_configuration_exists"`
+			NumaTuneMode               string `json:"numa_tune_mode"`
+			RunOnce                    string `json:"run_once,omitempty"`
+			StartTime                  int64  `json:"start_time,omitempty"`
+			Status                     string `json:"status"`
+			StopTime                   int64  `json:"stop_time"`
+			OriginalTemplate           struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"original_template"`
+			Template struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"template"`
+			Actions struct {
+				Link []struct {
+					Href string `json:"href"`
+					Rel  string `json:"rel"`
+				} `json:"link"`
+			} `json:"actions"`
+			Name        string `json:"name"`
+			Description string `json:"description"`
+			Comment     string `json:"comment"`
+			Href        string `json:"href"`
+			ID          string `json:"id"`
+			Bios        struct {
+				BootMenu struct {
+					Enabled string `json:"enabled"`
+				} `json:"boot_menu"`
+				Type string `json:"type"`
+			} `json:"bios"`
+			CPU struct {
+				Architecture string `json:"architecture"`
+				Topology     struct {
+					Cores   string `json:"cores"`
+					Sockets string `json:"sockets"`
+					Threads string `json:"threads"`
+				} `json:"topology"`
+			} `json:"cpu"`
+			Display struct {
+				Address       string `json:"address"`
+				AllowOverride string `json:"allow_override"`
+				Certificate   struct {
+					Content      string `json:"content"`
+					Organization string `json:"organization"`
+					Subject      string `json:"subject"`
+				} `json:"certificate"`
+				CopyPasteEnabled    string `json:"copy_paste_enabled"`
+				DisconnectAction    string `json:"disconnect_action"`
+				FileTransferEnabled string `json:"file_transfer_enabled"`
+				Monitors            string `json:"monitors"`
+				Port                string `json:"port"`
+				SecurePort          string `json:"secure_port"`
+				SingleQxlPci        string `json:"single_qxl_pci"`
+				SmartcardEnabled    string `json:"smartcard_enabled"`
+				Type                string `json:"type"`
+			} `json:"display"`
+			Initialization struct {
+				AuthorizedSSHKeys        string `json:"authorized_ssh_keys"`
+				CloudInitNetworkProtocol string `json:"cloud_init_network_protocol"`
+				CustomScript             string `json:"custom_script"`
+				HostName                 string `json:"host_name"`
+				NicConfigurations        struct {
+				} `json:"nic_configurations"`
+				RegenerateSSHKeys string `json:"regenerate_ssh_keys"`
+				UserName          string `json:"user_name"`
+			} `json:"initialization"`
+			Io struct {
+				Threads string `json:"threads"`
+			} `json:"io"`
+			Memory    string `json:"memory"`
+			Migration struct {
+				AutoConverge string `json:"auto_converge"`
+				Compressed   string `json:"compressed"`
+				Encrypted    string `json:"encrypted"`
+			} `json:"migration"`
+			Origin string `json:"origin"`
+			Os     struct {
+				Boot struct {
+					Devices struct {
+						Device []string `json:"device"`
+					} `json:"devices"`
+				} `json:"boot"`
+				Type string `json:"type"`
+			} `json:"os"`
+			Sso struct {
+				Methods struct {
+					Method []struct {
+						ID string `json:"id"`
+					} `json:"method"`
+				} `json:"methods"`
+			} `json:"sso"`
+			Stateless string `json:"stateless"`
+			Type      string `json:"type"`
+			Usb       struct {
+				Enabled string `json:"enabled"`
+			} `json:"usb"`
+			Cluster struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"cluster"`
+			Quota struct {
+				ID string `json:"id"`
+			} `json:"quota"`
+			Link []struct {
+				Href string `json:"href"`
+				Rel  string `json:"rel"`
+			} `json:"link"`
+			CPUShares        string `json:"cpu_shares"`
+			CreationTime     int64  `json:"creation_time"`
+			DeleteProtected  string `json:"delete_protected"`
+			HighAvailability struct {
+				Enabled  string `json:"enabled"`
+				Priority string `json:"priority"`
+			} `json:"high_availability"`
+			LargeIcon struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"large_icon"`
+			MemoryPolicy struct {
+				Guaranteed string `json:"guaranteed"`
+				Max        string `json:"max"`
+			} `json:"memory_policy"`
+			MigrationDowntime  string `json:"migration_downtime"`
+			MultiQueuesEnabled string `json:"multi_queues_enabled"`
+			SmallIcon          struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"small_icon"`
+			StartPaused                 string `json:"start_paused"`
+			StorageErrorResumeBehaviour string `json:"storage_error_resume_behaviour"`
+			TimeZone                    struct {
+				Name string `json:"name"`
+			} `json:"time_zone"`
+			CPUProfile struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"cpu_profile"`
+			StopReason string `json:"stop_reason,omitempty"`
+		} `json:"vm"`
+	}
+	type listVMResponse struct {
+		Data []struct {
+			Fqdn        string `json:"fqdn"`
+			StartTime   int64  `json:"start_time"`
+			Status      string `json:"status"`
+			Name        string `json:"name"`
+			Description string `json:"description"`
+			Comment     string `json:"comment"`
+			ID          string `json:"id"`
+			CPU         struct {
+				Topology struct {
+					Cores   string `json:"cores"`
+					Sockets string `json:"sockets"`
+					Threads string `json:"threads"`
+				} `json:"topology"`
+			} `json:"cpu"`
+			Memory       string `json:"memory"`
+			CreationTime int64  `json:"creation_time"`
+			Disk         []struct {
+				Name       string `json:"Name"`
+				TotalSize  string `json:"TotalSize"`
+				ActualSize string `json:"ActualSize"`
+			} `json:"Disk"`
+			NIC []struct {
+				Mac             string `json:"mac"`
+				IPv4            string `json:"IPv4"`
+				IPv6            string `json:"IPv6"`
+				ReportedDevices struct {
+					Mac  string `json:"mac"`
+					IPv4 string `json:"IPv4"`
+					IPv6 string `json:"IPv6"`
+				} `json:"reported_devices"`
+			} `json:"NIC"`
+		} `json:"vm"`
+		Message string `json:"message"`
+		Origin  string `json:"origin"`
+		Code    int    `json:"code"`
+	}
+
 	user := c.Get("user").(*jwt.Token)
 	claims := user.Claims.(jwt.MapClaims)
 	_sha256 := sha256.Sum256([]byte(string(claims["name"].(string))))
@@ -659,13 +886,80 @@ func (o ovirt) listVM(c echo.Context) error {
 	body, err := ioutil.ReadAll(res.Body)
 	//fmt.Printf("%s",body)
 	//b, _ := json.MarshalIndent(body, "", "  ")
-	resp := _response{
-		Origin:  "ovirt-listvms",
-		Message: string(body),
+	_VMLists := listVMs{}
+	err = json.Unmarshal(body, &_VMLists)
+	_listVMResponse := listVMResponse{
+		Data:    nil,
+		Message: "Done",
+		Origin:  "ListVMs",
 		Code:    1000,
 	}
+	_Data := _listVMResponse.Data
+	y := struct {
+		Fqdn        string `json:"fqdn"`
+		StartTime   int64  `json:"start_time"`
+		Status      string `json:"status"`
+		Name        string `json:"name"`
+		Description string `json:"description"`
+		Comment     string `json:"comment"`
+		ID          string `json:"id"`
+		CPU         struct {
+			Topology struct {
+				Cores   string `json:"cores"`
+				Sockets string `json:"sockets"`
+				Threads string `json:"threads"`
+			} `json:"topology"`
+		} `json:"cpu"`
+		Memory       string `json:"memory"`
+		CreationTime int64  `json:"creation_time"`
+		Disk         []struct {
+			Name       string `json:"Name"`
+			TotalSize  string `json:"TotalSize"`
+			ActualSize string `json:"ActualSize"`
+		} `json:"Disk"`
+		NIC []struct {
+			Mac             string `json:"mac"`
+			IPv4            string `json:"IPv4"`
+			IPv6            string `json:"IPv6"`
+			ReportedDevices struct {
+				Mac  string `json:"mac"`
+				IPv4 string `json:"IPv4"`
+				IPv6 string `json:"IPv6"`
+			} `json:"reported_devices"`
+		} `json:"NIC"`
+	}{}
+	for _, v := range _VMLists.VM {
+		y.ID = v.ID
+		y.Fqdn = v.Fqdn
+		y.StartTime = v.StartTime
+		y.Status = v.Status
+		y.Name = v.Name
+		y.Description = v.Description
+		y.Comment = v.Comment
+		y.CPU.Topology.Cores = v.CPU.Topology.Cores
+		y.CPU.Topology.Sockets = v.CPU.Topology.Sockets
+		y.CPU.Topology.Threads = v.CPU.Topology.Threads
+		y.Memory = v.Memory
+		y.CreationTime = v.CreationTime
+		y.NIC = listNIC(v.ID)
+		y.Disk = listDisks(v.ID)
+
+		_Data = append(_Data, y)
+	}
+	_listVMResponse.Data = _Data
+	if err != nil {
+		fmt.Println(err)
+		//return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice
+		resp := _response{
+			Origin:  "ovirt-listvms",
+			Message: "Error in Parsing listVMs",
+			Code:    1001,
+		}
+		return c.JSON(http.StatusInternalServerError, resp)
+	}
+	//fmt.Printf("%s", body)
 	//b, _ := json.MarshalIndent(resp, "", "  ")
-	return c.JSON(http.StatusOK, resp)
+	return c.JSON(http.StatusOK, _listVMResponse)
 	//return c.String(http.StatusOK, string(b))
 }
 func (o ovirt) StartVM(c echo.Context) error {
@@ -1155,7 +1449,7 @@ func VMInitialization(relatedUuid string, apiCall string, uuid string) {
 		toggleTask(uuid, 0)
 	}
 }
-func vmStatistics(BA string, VMUUID string) (string, float64, float64) {
+func vmStatistics(BA string, VMUUID string) (string, float64, float64, error) {
 	//ram,cpu,storage
 	var _disk []string
 	{
@@ -1189,7 +1483,7 @@ func vmStatistics(BA string, VMUUID string) (string, float64, float64) {
 		req, err := http.NewRequest(method, url, nil)
 
 		if err != nil {
-			return "", -1, -1
+			return "", -1, -1, errors.New("unexpected Error")
 		}
 		req.Header.Add("Version", "4")
 		req.Header.Add("Accept", "application/json")
@@ -1287,7 +1581,7 @@ func vmStatistics(BA string, VMUUID string) (string, float64, float64) {
 	req, err := http.NewRequest(method, url, nil)
 
 	if err != nil {
-		return "", -1, -1
+		return "", -1, -1, errors.New("unexpected Error")
 	}
 	req.Header.Add("Version", "4")
 	req.Header.Add("Accept", "application/json")
@@ -1296,8 +1590,11 @@ func vmStatistics(BA string, VMUUID string) (string, float64, float64) {
 	res, err := client.Do(req)
 	defer res.Body.Close()
 	body, err := ioutil.ReadAll(res.Body)
-
-	//fmt.Println("full response: ",string(body))
+	fmt.Println("Code: ", res.StatusCode)
+	if err != nil || res.StatusCode == 404 {
+		return "", -1, -1, errors.New("unexpected Error")
+	}
+	//fmt.Println("full response: ", string(body))
 	_vmstatistics := VMStatistics{}
 	_err := json.Unmarshal(body, &_vmstatistics)
 	if _err != nil {
@@ -1335,7 +1632,7 @@ func vmStatistics(BA string, VMUUID string) (string, float64, float64) {
 		req, err := http.NewRequest(method, url, nil)
 
 		if err != nil {
-			return "", -1, -1
+			return "", -1, -1, errors.New("unexpected Error")
 		}
 		req.Header.Add("Version", "4")
 		req.Header.Add("Accept", "application/json")
@@ -1360,7 +1657,7 @@ func vmStatistics(BA string, VMUUID string) (string, float64, float64) {
 		req, err := http.NewRequest(method, url, nil)
 
 		if err != nil {
-			return "", -1, -1
+			return "", -1, -1, errors.New("unexpected Error")
 		}
 		req.Header.Add("Version", "4")
 		req.Header.Add("Accept", "application/json")
@@ -1385,7 +1682,7 @@ func vmStatistics(BA string, VMUUID string) (string, float64, float64) {
 		req, err := http.NewRequest(method, url, nil)
 
 		if err != nil {
-			return "", -1, -1
+			return "", -1, -1, errors.New("unexpected Error")
 		}
 		req.Header.Add("Version", "4")
 		req.Header.Add("Accept", "application/json")
@@ -1409,7 +1706,7 @@ func vmStatistics(BA string, VMUUID string) (string, float64, float64) {
 	mem := _memusage / _memtotal
 
 	_cpu, _ := strconv.ParseFloat(cpu, 64)
-	return strings.Join(_disk, ", "), _cpu, mem
+	return strings.Join(_disk, ", "), _cpu, mem, nil
 
 }
 func (o ovirt) vmDetails(c echo.Context) error {
@@ -1425,7 +1722,7 @@ func (o ovirt) vmDetails(c echo.Context) error {
 	uuid := c.FormValue("uuid")
 	if len(uuid) < 5 {
 		resp := _response{
-			Origin:  "AddUser",
+			Origin:  "vmDetails",
 			Message: "Missing UUID",
 			Code:    1001,
 		}
@@ -1594,9 +1891,23 @@ func (o ovirt) vmDetails(c echo.Context) error {
 	_vmstatus := vmStatus{}
 	_err := json.Unmarshal(body, &_vmstatus)
 	if _err != nil {
-		fmt.Println("Error in vmDetails : ", _err)
+		resp := _response{
+			Origin:  "vmDetails",
+			Message: "Not Found",
+			Code:    1001,
+		}
+		return c.JSON(http.StatusNotFound, resp)
+	}
+	disk, cpu, ram, err := vmStatistics(BA, uuid)
+	if err != nil {
+		fmt.Println("Error in vmDetails 2 : ", err)
+		resp := _response{
+			Origin:  "vmDetails",
+			Message: "Unexpected Error",
+			Code:    1001,
+		}
+		return c.JSON(http.StatusInternalServerError, resp)
 	}
-	disk, cpu, ram := vmStatistics(BA, uuid)
 	type AutoGenerated struct {
 		Message struct {
 			Disk       string `json:"Disk"`
@@ -1655,3 +1966,309 @@ func (o ovirt) ovirtPayment(c echo.Context) error {
 	//return c.String(http.StatusOK, string(b))
 	return c.JSON(http.StatusOK, resp)
 }
+func listNIC(VMUUID string) []struct {
+	Mac             string `json:"mac"`
+	IPv4            string `json:"IPv4"`
+	IPv6            string `json:"IPv6"`
+	ReportedDevices struct {
+		Mac  string `json:"mac"`
+		IPv4 string `json:"IPv4"`
+		IPv6 string `json:"IPv6"`
+	} `json:"reported_devices"`
+} {
+	type NICList struct {
+		NIC []struct {
+			Mac             string `json:"mac"`
+			IPv4            string `json:"IPv4"`
+			IPv6            string `json:"IPv6"`
+			ReportedDevices struct {
+				Mac  string `json:"mac"`
+				IPv4 string `json:"IPv4"`
+				IPv6 string `json:"IPv6"`
+			} `json:"reported_devices"`
+		} `json:"NIC"`
+	}
+
+	type VMNIC struct {
+		Nic []struct {
+			Interface string `json:"interface"`
+			Linked    string `json:"linked"`
+			Mac       struct {
+				Address string `json:"address"`
+			} `json:"mac"`
+			Plugged         string `json:"plugged"`
+			ReportedDevices struct {
+				ReportedDevice []struct {
+					Ips struct {
+						IP []struct {
+							Address string `json:"address"`
+							Version string `json:"version"`
+						} `json:"ip"`
+					} `json:"ips"`
+					Mac struct {
+						Address string `json:"address"`
+					} `json:"mac"`
+					Type        string `json:"type"`
+					Name        string `json:"name"`
+					Description string `json:"description"`
+					Href        string `json:"href"`
+					ID          string `json:"id"`
+				} `json:"reported_device"`
+			} `json:"reported_devices"`
+			VnicProfile struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"vnic_profile"`
+			Actions struct {
+				Link []struct {
+					Href string `json:"href"`
+					Rel  string `json:"rel"`
+				} `json:"link"`
+			} `json:"actions"`
+			Name string `json:"name"`
+			Href string `json:"href"`
+			ID   string `json:"id"`
+			VM   struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"vm"`
+			Link []struct {
+				Href string `json:"href"`
+				Rel  string `json:"rel"`
+			} `json:"link"`
+		} `json:"nic"`
+	}
+	url := "https://ovirt-cl.zi-tel.com/ovirt-engine/api/vms/" + VMUUID + "/nics"
+	method := "GET"
+
+	payload := strings.NewReader(``)
+	client := &http.Client{
+	}
+	req, err := http.NewRequest(method, url, payload)
+
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	req.Header.Add("Version", "4")
+	req.Header.Add("Accept", "application/json")
+	req.Header.Add("Authorization", "Basic YXJnbzhASVBBOjEyMw==")
+
+	res, err := client.Do(req)
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	defer res.Body.Close()
+
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	_VMNIC := VMNIC{}
+	err = json.Unmarshal(body, &_VMNIC)
+	if err != nil {
+		///TODO: ErrorHandling
+		fmt.Println(err)
+		//return CPUPrice, memPrice, StoragePrice, IPPrice, extraBWPrice
+	}
+	_NICList := NICList{}
+	_Data := _NICList.NIC
+	x := struct {
+		Mac             string `json:"mac"`
+		IPv4            string `json:"IPv4"`
+		IPv6            string `json:"IPv6"`
+		ReportedDevices struct {
+			Mac  string `json:"mac"`
+			IPv4 string `json:"IPv4"`
+			IPv6 string `json:"IPv6"`
+		} `json:"reported_devices"`
+	}{}
+	for _, i := range _VMNIC.Nic {
+		x.IPv4 = "1.1.1.1"
+		///TODO:GetAssignedIP
+		x.IPv6 = "Null"
+		x.Mac = i.Mac.Address
+		x.ReportedDevices.Mac = i.ReportedDevices.ReportedDevice[0].Mac.Address
+		x.ReportedDevices.IPv4 = i.ReportedDevices.ReportedDevice[0].Ips.IP[0].Address
+		x.ReportedDevices.IPv6 = i.ReportedDevices.ReportedDevice[0].Ips.IP[1].Address
+		_Data = append(_Data, x)
+	}
+	_NICList.NIC = _Data
+	return _NICList.NIC
+}
+func listDisks(VMUUID string) []struct {
+	Name       string `json:"Name"`
+	TotalSize  string `json:"TotalSize"`
+	ActualSize string `json:"ActualSize"`
+} {
+
+	type DiskList struct {
+		Disk []struct {
+			Name       string `json:"Name"`
+			TotalSize  string `json:"TotalSize"`
+			ActualSize string `json:"ActualSize"`
+		} `json:"Disk"`
+	}
+	type ListDisks struct {
+		DiskAttachment []struct {
+			Active              string `json:"active"`
+			Bootable            string `json:"bootable"`
+			Interface           string `json:"interface"`
+			LogicalName         string `json:"logical_name"`
+			PassDiscard         string `json:"pass_discard"`
+			ReadOnly            string `json:"read_only"`
+			UsesScsiReservation string `json:"uses_scsi_reservation"`
+			Disk                struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"disk"`
+			VM struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"vm"`
+			Href string `json:"href"`
+			ID   string `json:"id"`
+		} `json:"disk_attachment"`
+	}
+	url := "https://ovirt-cl.zi-tel.com/ovirt-engine/api/vms/bcb15dd8-d402-4b2e-99da-94496174ea6b/diskattachments"
+	method := "GET"
+
+	payload := strings.NewReader(``)
+
+	client := &http.Client{
+	}
+	req, err := http.NewRequest(method, url, payload)
+
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	req.Header.Add("Version", "4")
+	req.Header.Add("Accept", "application/json")
+	req.Header.Add("Authorization", "Basic YXJnbzhASVBBOjEyMw==")
+
+	res, err := client.Do(req)
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	defer res.Body.Close()
+
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+	_ListDisks := ListDisks{}
+	err = json.Unmarshal(body, &_ListDisks)
+	if err != nil {
+		fmt.Println(err)
+		return nil
+	}
+
+	_DiskList := DiskList{}
+	for _, v := range _ListDisks.DiskAttachment {
+		_DiskList.Disk = append(_DiskList.Disk, DiskDetails(v.Disk.ID))
+
+	}
+
+	return _DiskList.Disk
+}
+
+func DiskDetails(id string) struct {
+	Name       string `json:"Name"`
+	TotalSize  string `json:"TotalSize"`
+	ActualSize string `json:"ActualSize"`
+} {
+	type DiskDetail struct {
+		ActualSize      string `json:"actual_size"`
+		Alias           string `json:"alias"`
+		Backup          string `json:"backup"`
+		ContentType     string `json:"content_type"`
+		Format          string `json:"format"`
+		ImageID         string `json:"image_id"`
+		PropagateErrors string `json:"propagate_errors"`
+		ProvisionedSize string `json:"provisioned_size"`
+		QcowVersion     string `json:"qcow_version"`
+		Shareable       string `json:"shareable"`
+		Sparse          string `json:"sparse"`
+		Status          string `json:"status"`
+		StorageType     string `json:"storage_type"`
+		TotalSize       string `json:"total_size"`
+		WipeAfterDelete string `json:"wipe_after_delete"`
+		DiskProfile     struct {
+			Href string `json:"href"`
+			ID   string `json:"id"`
+		} `json:"disk_profile"`
+		Quota struct {
+			Href string `json:"href"`
+			ID   string `json:"id"`
+		} `json:"quota"`
+		StorageDomains struct {
+			StorageDomain []struct {
+				Href string `json:"href"`
+				ID   string `json:"id"`
+			} `json:"storage_domain"`
+		} `json:"storage_domains"`
+		Actions struct {
+			Link []struct {
+				Href string `json:"href"`
+				Rel  string `json:"rel"`
+			} `json:"link"`
+		} `json:"actions"`
+		Name        string `json:"name"`
+		Description string `json:"description"`
+		Href        string `json:"href"`
+		ID          string `json:"id"`
+		Link        []struct {
+			Href string `json:"href"`
+			Rel  string `json:"rel"`
+		} `json:"link"`
+	}
+	url := "https://ovirt-cl.zi-tel.com/ovirt-engine/api/disks/c9485030-687f-4987-9980-72e762bca829"
+	method := "GET"
+
+	payload := strings.NewReader(``)
+
+	client := &http.Client{
+	}
+	req, err := http.NewRequest(method, url, payload)
+
+	if err != nil {
+		fmt.Println(err)
+	}
+	req.Header.Add("Version", "4")
+	req.Header.Add("Accept", "application/json")
+	req.Header.Add("Authorization", "Basic YXJnbzhASVBBOjEyMw==")
+
+	res, err := client.Do(req)
+	if err != nil {
+		fmt.Println(err)
+	}
+	defer res.Body.Close()
+
+	body, err := ioutil.ReadAll(res.Body)
+	if err != nil {
+		fmt.Println(err)
+	}
+
+	_DiskDetail := DiskDetail{}
+	err = json.Unmarshal(body, &_DiskDetail)
+	if err != nil {
+		fmt.Println(err)
+	}
+
+	Disk := struct {
+		Name       string `json:"Name"`
+		TotalSize  string `json:"TotalSize"`
+		ActualSize string `json:"ActualSize"`
+	}{
+		Name:       _DiskDetail.Alias,
+		TotalSize:  _DiskDetail.TotalSize,
+		ActualSize: _DiskDetail.ActualSize,
+	}
+
+	return Disk
+}