v1.15.2
v1.15.2
This commit is contained in:
@@ -11,12 +11,12 @@ import (
|
||||
// ConsumptionRequest struct to get consumption info
|
||||
type ConsumptionRequest struct {
|
||||
// Storage endpoint provider ID
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sep_id,omitempty" json:"sep_id,omitempty"`
|
||||
}
|
||||
|
||||
// Consumption gets SEP consumption info
|
||||
func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*RecordConsumption, error) {
|
||||
func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*ListConsumption, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -29,7 +29,7 @@ func (s SEP) Consumption(ctx context.Context, req ConsumptionRequest) (*RecordCo
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordConsumption{}
|
||||
info := ListConsumption{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
|
||||
@@ -47,8 +47,22 @@ type ByPool struct {
|
||||
UsageLimit uint64 `json:"usage_limit"`
|
||||
}
|
||||
|
||||
// List of Resource groups
|
||||
type ListConsumption struct {
|
||||
// Data
|
||||
Data []RecordConsumption `json:"data"`
|
||||
|
||||
// Enrtry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// Main information about consumption
|
||||
type RecordConsumption struct {
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
// By pool
|
||||
ByPool map[string]ByPool `json:"byPool"`
|
||||
|
||||
@@ -57,6 +71,9 @@ type RecordConsumption struct {
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
|
||||
// Consumed by
|
||||
ConsumedBy []uint64 `json:"consumedBy"`
|
||||
}
|
||||
|
||||
// Main information about URI
|
||||
|
||||
Reference in New Issue
Block a user