v1.6.12
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// DeleteCustomFieldsRequest struct to delete compute's custom fields
|
||||
type DeleteCustomFieldsRequest struct {
|
||||
// ID of the compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
// DeleteCustomFields deletes computes custom fields
|
||||
func (c Compute) DeleteCustomFields(ctx context.Context, req DeleteCustomFieldsRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/deleteCustomFields"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -20,8 +20,8 @@ func (lid ListInfoDisks) IDs() []uint64 {
|
||||
|
||||
// IDs gets array of PFWsIDs from ListPFW struct
|
||||
func (lp ListPFW) IDs() []uint64 {
|
||||
res := make([]uint64, 0, len(lp.Data))
|
||||
for _, p := range lp.Data {
|
||||
res := make([]uint64, 0, len(lp))
|
||||
for _, p := range lp {
|
||||
res = append(res, p.ID)
|
||||
}
|
||||
return res
|
||||
|
||||
@@ -12,14 +12,6 @@ type RecordACL struct {
|
||||
RGACL ListACL `json:"rgACL"`
|
||||
}
|
||||
|
||||
type ListUsers struct {
|
||||
// Data
|
||||
Data RecordACL `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// ACL information
|
||||
type ItemACL struct {
|
||||
// Explicit
|
||||
@@ -83,15 +75,6 @@ type ItemSnapshot struct {
|
||||
// List of snapshots
|
||||
type ListSnapshots []ItemSnapshot
|
||||
|
||||
// List of snapshots
|
||||
type ListSnapShot struct {
|
||||
// Data
|
||||
Data []ItemSnapshot `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// Main information about snapshot usage
|
||||
type ItemSnapshotUsage struct {
|
||||
// Count
|
||||
@@ -249,13 +232,7 @@ type ItemPFW struct {
|
||||
}
|
||||
|
||||
// List port forwards
|
||||
type ListPFW struct {
|
||||
// Data
|
||||
Data []ItemPFW `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
type ListPFW []ItemPFW
|
||||
|
||||
// Main information about rule
|
||||
type ItemRule struct {
|
||||
@@ -592,9 +569,6 @@ type InfoCompute struct {
|
||||
// Boot disk size
|
||||
BootDiskSize uint64 `json:"bootdiskSize"`
|
||||
|
||||
// cd Image Id
|
||||
CdImageId uint64 `json:"cdImageId"`
|
||||
|
||||
// Clone reference
|
||||
CloneReference uint64 `json:"cloneReference"`
|
||||
|
||||
@@ -664,9 +638,6 @@ type InfoCompute struct {
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Need reboot
|
||||
NeedReboot bool `json:"needReboot"`
|
||||
|
||||
// List OS users
|
||||
OSUsers ListOSUsers `json:"osUsers"`
|
||||
|
||||
@@ -761,7 +732,7 @@ type ItemCompute struct {
|
||||
InfoCompute
|
||||
|
||||
// Total disk size
|
||||
TotalDiskSize uint64 `json:"totalDisksSize"`
|
||||
TotalDiskSize uint64 `json:"totalDiskSize"`
|
||||
|
||||
// VINS connected
|
||||
VINSConnected uint64 `json:"vinsConnected"`
|
||||
|
||||
@@ -20,7 +20,7 @@ type PFWListRequest struct {
|
||||
}
|
||||
|
||||
// PFWList gets compute port forwards list
|
||||
func (c Compute) PFWList(ctx context.Context, req PFWListRequest) (*ListPFW, error) {
|
||||
func (c Compute) PFWList(ctx context.Context, req PFWListRequest) (ListPFW, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -40,5 +40,5 @@ func (c Compute) PFWList(ctx context.Context, req PFWListRequest) (*ListPFW, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
return list, nil
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ type SnapshotListRequest struct {
|
||||
}
|
||||
|
||||
// SnapshotList gets list of compute snapshots
|
||||
func (c Compute) SnapshotList(ctx context.Context, req SnapshotListRequest) (*ListSnapShot, error) {
|
||||
func (c Compute) SnapshotList(ctx context.Context, req SnapshotListRequest) (ListSnapshots, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -29,12 +29,12 @@ func (c Compute) SnapshotList(ctx context.Context, req SnapshotListRequest) (*Li
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListSnapShot{}
|
||||
list := ListSnapshots{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
return list, nil
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ type UserListRequest struct {
|
||||
}
|
||||
|
||||
// UserList gets users list for compute
|
||||
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) {
|
||||
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*RecordACL, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -29,7 +29,7 @@ func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListUsers{}
|
||||
list := RecordACL{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user