Skip to content

Commit 17cf6a8

Browse files
committed
fix: update request
1 parent 704b0dc commit 17cf6a8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

util/billing.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ type ArcInstance struct {
3939
SubscriptionID string `json:"subscription_id"`
4040
}
4141

42+
type ArcInstanceResponse struct {
43+
ArcRecords []arcInstanceDetails `json:"arc_records"`
44+
}
45+
4246
type arcInstanceDetails struct {
4347
NodeCount int64 `json:"node_count"`
4448
Description string `json:"description"`
@@ -80,7 +84,7 @@ func BillingMiddleware(next http.Handler) http.Handler {
8084

8185
func getArcInstance(arcID string) (ArcInstance, error) {
8286
arcInstance := ArcInstance{}
83-
response := []arcInstanceDetails{}
87+
response := ArcInstanceResponse{}
8488
url := ACC_API + "arc/instance?arcid=" + arcID
8589
req, _ := http.NewRequest("GET", url, nil)
8690
req.Header.Add("Content-Type", "application/json")
@@ -101,7 +105,7 @@ func getArcInstance(arcID string) (ArcInstance, error) {
101105
}
102106
err = json.Unmarshal(body, &response)
103107
fmt.Println("RESPONSE:", response)
104-
arcInstance.SubscriptionID = response[0].SubscriptionID
108+
arcInstance.SubscriptionID = response.ArcRecords[0].SubscriptionID
105109

106110
if err != nil {
107111
log.Println("error while unmarshalling res body: ", err)

0 commit comments

Comments
 (0)