This commit is contained in:
asteam
2025-08-01 15:36:29 +03:00
parent 7dacf35cd6
commit e10ee7f801
13 changed files with 94 additions and 219 deletions

View File

@@ -7,7 +7,7 @@ import (
var accounts = ListAccounts{
Data: []ItemAccount{
{
ACL: []RecordACL{
ACL: []ListRecordACL{
{
IsExplicit: true,
GUID: "",
@@ -25,7 +25,7 @@ var accounts = ListAccounts{
UpdatedTime: 1676645275,
},
{
ACL: []RecordACL{
ACL: []ListRecordACL{
{
IsExplicit: true,
GUID: "",
@@ -43,7 +43,7 @@ var accounts = ListAccounts{
UpdatedTime: 1676645275,
},
{
ACL: []RecordACL{
ACL: []ListRecordACL{
{
IsExplicit: true,
GUID: "",

View File

@@ -1,7 +1,34 @@
package account
// Access Control List
type ListRecordACL struct {
// Whether access is explicitly specified
IsExplicit bool `json:"explicit"`
// GUID
GUID string `json:"guid"`
// Access rights
Rights string `json:"right"`
// Status
Status string `json:"status"`
// Account Type
Type string `json:"type"`
// Account owner ID
UgroupID string `json:"userGroupId"`
// Is it possible to remove
CanBeDeleted bool `json:"canBeDeleted"`
}
// Access Control List
type RecordACL struct {
// Emails
Emails []string `json:"emails"`
// Whether access is explicitly specified
IsExplicit bool `json:"explicit"`
@@ -51,7 +78,7 @@ type ResourceLimits struct {
// Main information in one of if the list of accounts
type ItemAccount struct {
// Access Control List
ACL []RecordACL `json:"acl"`
ACL []ListRecordACL `json:"acl"`
// Compute Features
ComputeFeatures []string `json:"computeFeatures"`

View File

@@ -709,6 +709,9 @@ type ItemVNFInterface struct {
// Target
Target string `json:"target"`
// Trunk tags
TrunkTags string `json:"trunk_tags"`
// Type
Type string `json:"type"`

View File

@@ -150,7 +150,7 @@ type CreateRequest struct {
// Required: false
CustomFields string `url:"customFields,omitempty" json:"customFields,omitempty"`
// Type of compute Stateful (KVM_X86) or Stateless (SVA_KVM_X86)
// Type of compute Stateful (KVM_X86)
// Required: false
Driver string `url:"driver,omitempty" json:"driver,omitempty" validate:"omitempty,computeDriver"`

View File

@@ -57,7 +57,7 @@ type CreateBlankRequest struct {
// Required: false
Interfaces []Interface `url:"-" json:"interfaces,omitempty" validate:"omitempty,dive"`
// Type of compute Stateful (KVM_X86) or Stateless (SVA_KVM_X86)
// Type of compute Stateful (KVM_X86)
// Required: false
Driver string `url:"driver,omitempty" json:"driver,omitempty" validate:"omitempty,computeDriver"`

View File

@@ -0,0 +1,35 @@
package compute
import (
"context"
"net/http"
"strings"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// MigrateAbortRequest struct to abort migration
type MigrateAbortRequest struct {
// ID of the compute instance
// Required: true
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
}
// MigrateAbort aborts compute migration
func (c Compute) MigrateAbort(ctx context.Context, req MigrateAbortRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/migrate_abort"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return "", err
}
result := strings.ReplaceAll(string(res), "\"", "")
return result, nil
}

View File

@@ -573,6 +573,9 @@ type ItemInterface struct {
// Target
Target string `json:"target"`
// Trunk tags
TrunkTags string `json:"trunk_tags"`
// Type
Type string `json:"type"`

View File

@@ -97,7 +97,9 @@ func (i Image) CreateImage(ctx context.Context, req CreateRequest) (uint64, erro
url := "/cloudbroker/image/createImage"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
syncReq := asyncWrapperCreateRequest{CreateRequest: req, AsyncMode: false}
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
if err != nil {
return 0, err
}
@@ -117,7 +119,7 @@ func (i Image) AsyncCreateImage(ctx context.Context, req CreateRequest) (string,
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/image/create"
url := "/cloudbroker/image/createImage"
asyncReq := asyncWrapperCreateRequest{CreateRequest: req, AsyncMode: true}

View File

@@ -154,7 +154,7 @@ type CreateRequest struct {
// Required: false
CustomField string `url:"customFields,omitempty" json:"customFields,omitempty"`
//Type of compute Stateful (KVM_X86) or Stateless (SVA_KVM_X86)
//Type of compute Stateful (KVM_X86)
// Required: false
Driver string `url:"driver,omitempty" json:"driver,omitempty"`

View File

@@ -61,7 +61,7 @@ type CreateBlankRequest struct {
// Required: false
Description string `url:"desc,omitempty" json:"desc,omitempty"`
//Type of compute Stateful (KVM_X86) or Stateless (SVA_KVM_X86)
//Type of compute Stateful (KVM_X86)
// Required: false
Driver string `url:"driver,omitempty" json:"driver,omitempty"`