v16.4.0
v16.4.0
This commit is contained in:
1 parent
4c05d94552
commit
2c7f0d29df
159 files changed
+2249
-216
No files matched your search
@@ -0,0 +1,65 @@
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// ListReplicationProfileRequest struct to get list of replication profiles
|
||||
type ListReplicationProfileRequest struct {
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
|
||||
// Search by replication profile ID
|
||||
// Required: false
|
||||
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
|
||||
|
||||
// Search by replication profile name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Search by replication type
|
||||
// Required: false
|
||||
ReplicationType string `url:"replication_type,omitempty" json:"replication_type,omitempty"`
|
||||
|
||||
// Sort by one of supported fields, format ±<field>
|
||||
// Required: false
|
||||
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty"`
|
||||
}
|
||||
|
||||
// ListReplicationProfile gets list of replication profiles as a ListReplicationProfiles struct
|
||||
func (sp StPolicy) ListReplicationProfile(ctx context.Context, req ListReplicationProfileRequest) (*ListReplicationProfiles, error) {
|
||||
res, err := sp.ListReplicationProfileRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListReplicationProfiles{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListReplicationProfileRaw gets list of replication profiles as an array of bytes
|
||||
func (sp StPolicy) ListReplicationProfileRaw(ctx context.Context, req ListReplicationProfileRequest) ([]byte, error) {
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/storage_policy/list_replication_profile"
|
||||
|
||||
res, err := sp.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||
return res, err
|
||||
}
|
||||
Reference in new issue
Block a user