v1.6.6
This commit is contained in:
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get SEP parameters
|
||||
// GetRequest struct to get SEP parameters
|
||||
type GetRequest struct {
|
||||
// Storage endpoint provider ID
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets SEP parameters
|
||||
// Get gets SEP parameters as a RecordSEP struct
|
||||
func (s SEP) Get(ctx context.Context, req GetRequest) (*RecordSEP, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/get"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := s.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (s SEP) Get(ctx context.Context, req GetRequest) (*RecordSEP, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets SEP parameters as an array of bytes
|
||||
func (s SEP) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/get"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of SEPs
|
||||
// ListRequest struct to get list of SEPs
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -45,11 +45,9 @@ type ListRequest struct {
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of SEPs
|
||||
// List gets list of SEPs as a ListSEP struct
|
||||
func (s SEP) List(ctx context.Context, req ListRequest) (*ListSEP, error) {
|
||||
url := "/cloudbroker/sep/list"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := s.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,3 +61,11 @@ func (s SEP) List(ctx context.Context, req ListRequest) (*ListSEP, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of SEPs as an array of bytes
|
||||
func (s SEP) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/sep/list"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user