v1.6.6
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request for get information about compute
|
||||
// GetRequest to get information about compute
|
||||
type GetRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
@@ -19,18 +19,9 @@ type GetRequest struct {
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// Get gets information about compute
|
||||
// Get gets information about compute as a RecordCompute struct
|
||||
func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/get"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -44,3 +35,18 @@ func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets information about compute as an array of bytes
|
||||
func (c Compute) 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/compute/get"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list available computes
|
||||
// ListRequest struct to get list of available computes
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -61,12 +61,10 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of the available computes.
|
||||
// List gets list of the available computes as a ListComputes struct.
|
||||
// Filtering based on status is possible
|
||||
func (c Compute) List(ctx context.Context, req ListRequest) (*ListComputes, error) {
|
||||
url := "/cloudbroker/compute/list"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -80,3 +78,11 @@ func (c Compute) List(ctx context.Context, req ListRequest) (*ListComputes, erro
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of the available computes as an array of bytes
|
||||
func (c Compute) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/compute/list"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -672,7 +672,7 @@ type InfoCompute struct {
|
||||
StackName string `json:"stackName"`
|
||||
|
||||
// Stateless SEP ID
|
||||
StatelessSEPID uint64 `json:"statelessSepId"`
|
||||
StatelessSEPID int64 `json:"statelessSepId"`
|
||||
|
||||
// Stateless SEP Type
|
||||
StatelessSEPType string `json:"statelessSepType"`
|
||||
|
||||
Reference in New Issue
Block a user