This commit is contained in:
asteam
2025-09-23 14:34:24 +03:00
parent b924e85e49
commit f1ffb4c0fd
1108 changed files with 72020 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
package resmon
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators"
)
type GetByComputeRequest struct {
// Compute ID
// Required: true
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
// Start of time period - unixtime
// Required: false
StartTime uint64 `url:"starttime,omitempty" json:"starttime,omitempty"`
// End of time period - unixtime
// Required: true
EndTime uint64 `url:"endtime,omitempty" json:"endtime,omitempty"`
}
// Get resource monitoring for the specified time period for the concrete compute instance
func (r Resmon) GetByCompute(ctx context.Context, req GetByComputeRequest) (*GetByComputeData, error) {
res, err := r.GetByComputeRaw(ctx, req)
if err != nil {
return nil, err
}
info := GetByComputeData{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetRaw gets information about compute as an array of bytes
func (r Resmon) GetByComputeRaw(ctx context.Context, req GetByComputeRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/resmon/getByCompute"
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}