Skip to content

Commit

Permalink
🐛 add validation and change binding method
Browse files Browse the repository at this point in the history
  • Loading branch information
hijiki51 committed Aug 6, 2022
1 parent 8652553 commit 2399d79
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"bytes"
"encoding/json"
"errors"
"io/ioutil"
"log"
"net/http"
Expand Down Expand Up @@ -180,7 +181,19 @@ func (cc *ConohaClient) ObjectStorageRequests() (map[string]float64, error) {
}

// データ整形
data := uResp.Request.Data[len(uResp.Request.Data)-3]
if len(uResp.Request.Data) == 0 {
return nil, errors.New("No data")
}
data := uResp.Request.Data[0]
for i, label := range uResp.Request.Schema {
if label == "unixtime" {
for _, v := range uResp.Request.Data {
if data[i] < v[i] {
data = v
}
}
}
}
usage := make(map[string]float64)
for i, label := range uResp.Request.Schema {
usage[label] = data[i]
Expand Down

0 comments on commit 2399d79

Please sign in to comment.