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 information about FLIPGroup
|
||||
// GetRequest struct to get information about FLIPGroup
|
||||
type GetRequest struct {
|
||||
// FLIPGroup ID
|
||||
// Required: true
|
||||
FLIPGroupID uint64 `url:"flipgroupId" json:"flipgroupId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets details of the specified Floating IP group
|
||||
// Get gets details of the specified Floating IP group as a RecordFLIPGroup struct
|
||||
func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/flipgroup/get"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := f.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, e
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets details of the specified Floating IP group as an array of bytes
|
||||
func (f FLIPGroup) 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 := "/cloudapi/flipgroup/get"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list FLIPGroup available to the current user
|
||||
// ListRequest struct to get list of FLIPGroup available to the current user
|
||||
type ListRequest struct {
|
||||
// Find by name
|
||||
// Required: false
|
||||
@@ -25,11 +25,11 @@ type ListRequest struct {
|
||||
ExtNetID uint64 `url:"extnetId,omitempty" json:"extnetId,omitempty"`
|
||||
|
||||
// Find by IP
|
||||
// Reuqired: false
|
||||
// Required: false
|
||||
ByIP string `url:"byIp,omitempty" json:"byIp,omitempty"`
|
||||
|
||||
// Find by resource group ID
|
||||
// Reuqired: false
|
||||
// Required: false
|
||||
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
|
||||
|
||||
// Find by id
|
||||
@@ -45,11 +45,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list FLIPGroup managed cluster instances available to the current user
|
||||
// List gets list of FLIPGroup managed cluster instances available to the current user as a ListFLIPGroups struct
|
||||
func (f FLIPGroup) List(ctx context.Context, req ListRequest) (*ListFLIPGroups, error) {
|
||||
url := "/cloudapi/flipgroup/list"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := f.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,3 +61,11 @@ func (f FLIPGroup) List(ctx context.Context, req ListRequest) (*ListFLIPGroups,
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of FLIPGroup managed cluster instances available to the current user as an array of bytes
|
||||
func (f FLIPGroup) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/flipgroup/list"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user