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 }