v1.16.1
This commit is contained in:
dayterr
2026-08-28 16:36:41 +03:00
parent eb195dd992
commit b3fccfb000
131 changed files with 3204 additions and 478 deletions

View File

@@ -0,0 +1,40 @@
package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// AddACLAccessRequest adds ACL access to a vm
type AddACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// AddACLAccess adds ACL access to a vm.
func (c Compute) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/add_acl_access"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -0,0 +1,39 @@
package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// DeleteACLAccessRequest deletes ACL access from a vm
type DeleteACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// DeleteACLAccess deletes ACL access from a vm.
func (c Compute) DeleteACLAccess(ctx context.Context, req DeleteACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/del_acl_access"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -0,0 +1,44 @@
package compute
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetACLAccessRequest struct to get detailed information about ACL account in a vm
type GetACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
}
// Get gets current configuration of the ACL access in a vm as a RecordRGACLAccess struct
func (c Compute) GetACLAccess(ctx context.Context, req GetACLAccessRequest) (*RecordComputeACLAccess, error) {
res, err := c.GetACLAccessRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordComputeACLAccess{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetACLAccessRaw gets current configuration of the ACL access in a vm as an array of bytes
func (c Compute) GetACLAccessRaw(ctx context.Context, req GetACLAccessRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/get_acl_access"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}

View File

@@ -816,6 +816,9 @@ type InfoCompute struct {
// Manager type
ManagerType string `json:"managerType"`
// Memory balloon mode
MemoryBalloonMode string `json:"memory_balloon_mode"`
// Migration job
MigrationJob uint64 `json:"migrationjob"`
@@ -1109,6 +1112,9 @@ type RecordCompute struct {
// Manager type
ManagerType string `json:"managerType"`
// Memory balloon mode
MemoryBalloonMode string `json:"memory_balloon_mode"`
// Migration job
MigrationJob uint64 `json:"migrationjob"`
@@ -1248,6 +1254,57 @@ type RecordCompute struct {
_ uint64 `json:"nodeId"`
}
// Detailed information about ACL Access in a compute
type RecordComputeACLAccess struct {
// Data
Data DataACL `json:"data"`
// Entry count
EntryCount uint64 `json:"entryCount"`
}
// Data ACL
type DataACL struct {
// RG ACL list
RGACLList []RGACL `json:"rgACL"`
// Account ACL list
AccountACLList []AccountACL `json:"accountACL"`
// Compute ACL list
ComputeACLList []ComputeACL `json:"computeACL"`
}
// RG ACL info
type RGACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// Account ACL info
type AccountACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// Compute ACL info
type ComputeACL struct {
Right string `json:"right"`
GUID string `json:"guid"`
UserGroupID string `json:"userGroupId"`
Status string `json:"status"`
Type string `json:"type"`
Explicit bool `json:"explicit"`
}
// SnapRecordCompute is RecordCompute but without the SnapSets field
type SnapRecordCompute struct {
// Account ID
@@ -1705,6 +1762,9 @@ type ItemVGPU struct {
// Profile Reference
ProfileReference string `json:"profile_reference"`
// Profile Name
ProfileName string `json:"profile_name"`
// Split Mode
SplitMode string `json:"split_mode"`
@@ -2123,6 +2183,9 @@ type ItemShadowComputeInterface struct {
// QOS
QOS QOS `json:"qos"`
// List of QoS Policy IDs
QoSPolicies []uint64 `json:"qos_policies"`
// Libvirt settings
LibvirtSettings LibvirtSettings `json:"libvirtSettings"`

View File

@@ -5,6 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
@@ -95,7 +96,7 @@ type NetAttachRequest struct {
type wrapperNetAttachRequest struct {
NetAttachRequest
AsyncMode bool `url:"asyncMode"`
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
}
// NetAttach attaches network to compute and gets info about network
@@ -112,7 +113,7 @@ func (c Compute) NetAttach(ctx context.Context, req NetAttachRequest) (*RecordNe
url := "/cloudbroker/compute/netAttach"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return nil, err
}
@@ -141,7 +142,7 @@ func (c Compute) NetAttachAsync(ctx context.Context, req NetAttachRequest) (stri
url := "/cloudbroker/compute/netAttach"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
if err != nil {
return "", err
}

View File

@@ -83,6 +83,11 @@ type UpdateRequest struct {
// Required: false
// Default: reset
WatchdogAction string `url:"watchdog_action,omitempty" json:"watchdog_action,omitempty" validate:"omitempty,watchdogAction"`
// Memory balloon mode. One of ["auto","legacy","none"]
// Required: false
// Default: "auto"
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
}
// Update updates some properties of the compute

View File

@@ -0,0 +1,40 @@
package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// UpdateACLAccessRequest updates ACL access in a vm
type UpdateACLAccessRequest struct {
ID uint64 `url:"id" json:"id" validate:"required"`
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
}
// UpdateACLAccess updates ACL access in a vm.
func (c Compute) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/compute/update_acl_access"
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}

View File

@@ -28,6 +28,8 @@ type UserGrantRequest struct {
}
// UserGrant grants user access to the compute
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -16,6 +16,8 @@ type UserListRequest struct {
}
// UserList gets users list for compute
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -20,6 +20,8 @@ type UserRevokeRequest struct {
}
// UserRevoke revokes user access to the compute
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -28,6 +28,8 @@ type UserUpdateRequest struct {
}
// UserUpdate updates user access to the compute
//
// Deprecated: will be removed in SDK v1.17
func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {