v1.6.6
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about resource group
|
||||
// GetRequest struct to get detailed information about resource group
|
||||
type GetRequest struct {
|
||||
// Resource group ID
|
||||
// Required: true
|
||||
@@ -19,18 +19,9 @@ type GetRequest struct {
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// Get gets current configuration of the resource group
|
||||
// Get gets current configuration of the resource group as a RecordResourceGroup struct
|
||||
func (r RG) Get(ctx context.Context, req GetRequest) (*RecordResourceGroup, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/get"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := r.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -44,3 +35,18 @@ func (r RG) Get(ctx context.Context, req GetRequest) (*RecordResourceGroup, erro
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets current configuration of the resource group as an array of bytes
|
||||
func (r RG) 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/rg/get"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of resource groups
|
||||
// ListRequest struct to get list of resource groups
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -53,11 +53,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of all resource groups the user has access to
|
||||
// List gets list of all resource groups the user has access to as a ListResourceGroups struct
|
||||
func (r RG) List(ctx context.Context, req ListRequest) (*ListResourceGroups, error) {
|
||||
url := "/cloudapi/rg/list"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := r.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -71,3 +69,11 @@ func (r RG) List(ctx context.Context, req ListRequest) (*ListResourceGroups, err
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all resource groups the user has access to as an array of bytes
|
||||
func (r RG) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/rg/list"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user