You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
decort-golang-sdk/pkg/cloudapi/user/get_resource_consumption.go

27 lines
544 B

package user
import (
"context"
"encoding/json"
"net/http"
)
// GetResourceConsumption gets amount of consumed and reserved resources (cpu, ram, disk) by current user
func (u User) GetResourceConsumption(ctx context.Context) (*ResourceConsumption, error) {
url := "/cloudapi/user/getResourceConsumption"
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, nil)
if err != nil {
return nil, err
}
item := ResourceConsumption{}
err = json.Unmarshal(res, &item)
if err != nil {
return nil, err
}
return &item, nil
}