v1.15.2
This commit is contained in:
dayterr
2026-06-19 16:40:41 +03:00
parent f5a632654b
commit cd5d1c9d0b
10 changed files with 72 additions and 48 deletions

View File

@@ -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 {

View File

@@ -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