package storagepolicy import ( "context" "encoding/json" "net/http" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) type GetRequest struct { // ID of storage policy // Required: true StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"` } func (sp StoragePolicy) Get(ctx context.Context, req GetRequest) (*InfoStoragePolicy, error) { res, err := sp.GetRaw(ctx, req) if err != nil { return nil, err } info := InfoStoragePolicy{} err = json.Unmarshal(res, &info) if err != nil { return nil, err } return &info, nil } func (sp StoragePolicy) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) { err := validators.ValidateRequest(req) if err != nil { return nil, validators.ValidationErrors(validators.GetErrors(err)) } url := "/cloudbroker/storage_policy/get" res, err := sp.client.DecortApiCall(ctx, http.MethodGet, url, req) return res, err }