v1.16.4
This commit is contained in:
dayterr
2026-09-18 16:49:20 +03:00
parent b39021820a
commit bf932e5ef9
161 changed files with 2375 additions and 227 deletions

View File

@@ -0,0 +1,46 @@
package stpolicy
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetReplicationProfileRequest struct to get replication profile
type GetReplicationProfileRequest struct {
// ID of replication profile
// Required: true
ProfileID uint64 `url:"profile_id" json:"profile_id" validate:"required"`
}
// GetReplicationProfile gets replication profile as an InfoReplicationProfile struct
func (sp StPolicy) GetReplicationProfile(ctx context.Context, req GetReplicationProfileRequest) (*InfoReplicationProfile, error) {
res, err := sp.GetReplicationProfileRaw(ctx, req)
if err != nil {
return nil, err
}
info := InfoReplicationProfile{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetReplicationProfileRaw gets replication profile as an array of bytes
func (sp StPolicy) GetReplicationProfileRaw(ctx context.Context, req GetReplicationProfileRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/storage_policy/get_replication_profile"
res, err := sp.client.DecortApiCall(ctx, http.MethodGet, url, req)
return res, err
}