This commit is contained in:
2026-06-19 17:42:24 +03:00
parent 3fe358fd9e
commit cf8dae6f4b
1505 changed files with 103498 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
package sep
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
)
// ConsumptionRequest struct to get consumption info
type ConsumptionRequest struct {
// Storage endpoint provider ID
// 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) (*ListConsumption, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/sep/consumption"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
info := ListConsumption{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}