v1.16.6
This commit is contained in:
dayterr
2026-10-02 16:36:20 +03:00
parent d26e8b2621
commit 25e2242360
28 changed files with 293 additions and 109 deletions

View File

@@ -38,6 +38,10 @@ type ListRequest struct {
// Required: false
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
// Filter by user ID
// Required: false
UserID string `url:"user_id,omitempty" json:"user_id,omitempty"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`

View File

@@ -161,51 +161,51 @@ type CloudAPIEndpoints struct {
}
type CloudBrokerEndpoints struct {
Account []string `json:"account,omitempty"`
APIAccess []string `json:"apiaccess,omitempty"`
Account interface{} `json:"account,omitempty"`
APIAccess interface{} `json:"apiaccess,omitempty"`
Audit interface{} `json:"audit,omitempty"`
AuditBeat []string `json:"auditbeat,omitempty"`
AuditCollector []string `json:"auditcollector,omitempty"`
Backup []string `json:"backup,omitempty"`
BackupCreator []string `json:"backupcreator,omitempty"`
BService []string `json:"bservice,omitempty"`
Compute []string `json:"compute,omitempty"`
Disks []string `json:"disks,omitempty"`
DPDKNet []string `json:"dpdknet,omitempty"`
Eco []string `json:"eco,omitempty"`
ExtNet []string `json:"extnet,omitempty"`
FlIPgroup []string `json:"flipgroup,omitempty"`
Grid []string `json:"grid,omitempty"`
Group []string `json:"group,omitempty"`
Health []string `json:"health,omitempty"`
Image []string `json:"image,omitempty"`
AuditCollector interface{} `json:"auditcollector,omitempty"`
Backup interface{} `json:"backup,omitempty"`
BackupCreator interface{} `json:"backupcreator,omitempty"`
BService interface{} `json:"bservice,omitempty"`
Compute interface{} `json:"compute,omitempty"`
Disks interface{} `json:"disks,omitempty"`
DPDKNet interface{} `json:"dpdknet,omitempty"`
Eco interface{} `json:"eco,omitempty"`
ExtNet interface{} `json:"extnet,omitempty"`
FlIPgroup interface{} `json:"flipgroup,omitempty"`
Grid interface{} `json:"grid,omitempty"`
Group interface{} `json:"group,omitempty"`
Health interface{} `json:"health,omitempty"`
Image interface{} `json:"image,omitempty"`
Job interface{} `json:"job,omitempty"`
K8CI []string `json:"k8ci,omitempty"`
K8S []string `json:"k8s,omitempty"`
KVMX86 []string `json:"kvmx86,omitempty"`
LB []string `json:"lb,omitempty"`
Metering []string `json:"metering,omitempty"`
Milestones []string `json:"milestones,omitempty"`
K8CI interface{} `json:"k8ci,omitempty"`
K8S interface{} `json:"k8s,omitempty"`
KVMX86 interface{} `json:"kvmx86,omitempty"`
LB interface{} `json:"lb,omitempty"`
Metering interface{} `json:"metering,omitempty"`
Milestones interface{} `json:"milestones,omitempty"`
Node []string `json:"node,omitempty"`
PCIDevice []string `json:"pcidevice,omitempty"`
PGPU []string `json:"pgpu,omitempty"`
Prometheus []string `json:"prometheus,omitempty"`
PCIDevice interface{} `json:"pcidevice,omitempty"`
PGPU interface{} `json:"pgpu,omitempty"`
Prometheus interface{} `json:"prometheus,omitempty"`
Resmon interface{} `json:"resmon,omitempty"`
RG []string `json:"rg,omitempty"`
SecurityGroup []string `json:"security_group,omitempty"`
Sep []string `json:"sep,omitempty"`
StoragePolicy []string `json:"storage_policy,omitempty"`
Tasks []string `json:"tasks,omitempty"`
TLock []string `json:"tlock,omitempty"`
Trunk []string `json:"trunk,omitempty"`
User []string `json:"user,omitempty"`
VFPool []string `json:"vfpool,omitempty"`
VGPU []string `json:"vgpu,omitempty"`
VINS []string `json:"vins,omitempty"`
VMFolder []string `json:"vmfolder,omitempty"`
VNFDev []string `json:"vnfdev,omitempty"`
ZeroAccess []string `json:"zeroaccess,omitempty"`
Zone []string `json:"zone,omitempty"`
RG interface{} `json:"rg,omitempty"`
SecurityGroup interface{} `json:"security_group,omitempty"`
Sep interface{} `json:"sep,omitempty"`
StoragePolicy interface{} `json:"storage_policy,omitempty"`
Tasks interface{} `json:"tasks,omitempty"`
TLock interface{} `json:"tlock,omitempty"`
Trunk interface{} `json:"trunk,omitempty"`
User interface{} `json:"user,omitempty"`
VFPool interface{} `json:"vfpool,omitempty"`
VGPU interface{} `json:"vgpu,omitempty"`
VINS interface{} `json:"vins,omitempty"`
VMFolder interface{} `json:"vmfolder,omitempty"`
VNFDev interface{} `json:"vnfdev,omitempty"`
ZeroAccess interface{} `json:"zeroaccess,omitempty"`
Zone interface{} `json:"zone,omitempty"`
All bool `json:"ALL,omitempty"`
}

View File

@@ -24,6 +24,8 @@ type UserListRequest struct {
}
// UserList gets a list of users currently included in the specified group.
//
// Deprecated: will be removed in SDK v1.17
func (a APIAccess) UserList(ctx context.Context, req UserListRequest) ([]string, error) {
err := validators.ValidateRequest(req)
if err != nil {

View File

@@ -63,6 +63,14 @@ type ListRequest struct {
// Required: false
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
// Find by disk id
// Required: false
DiskID uint64 `url:"disk_id,omitempty" json:"disk_id,omitempty"`
// Find by vm folder id
// Required: false
VMFolderID uint64 `url:"vmfolder_id,omitempty" json:"vmfolder_id,omitempty"`
// Find by vins id
// Required: false
VINSID uint64 `url:"vins_id,omitempty" json:"vins_id,omitempty"`
@@ -96,7 +104,7 @@ type ListRequest struct {
ExcludeAuditLines bool `url:"exclude_audit_lines,omitempty" json:"exclude_audit_lines,omitempty"`
// Public Session ID
PublicSessionID string `json:"public_session_id"`
PublicSessionID string `url:"public_session_id,omitempty" json:"public_session_id,omitempty"`
}
// List gets audit records for the specified account object

View File

@@ -86,7 +86,7 @@ type UpdateRequest struct {
// Memory balloon mode. One of ["auto","legacy","none"]
// Required: false
// Default: "auto"
// Default: none
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
}

View File

@@ -2,6 +2,7 @@ package extnet
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -15,6 +16,11 @@ type EnableRequest struct {
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
}
type asyncWrapperEnableRequest struct {
EnableRequest
AsyncMode bool `url:"async_mode"`
}
// Enable enables external networks
func (e ExtNet) Enable(ctx context.Context, req EnableRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -24,7 +30,12 @@ func (e ExtNet) Enable(ctx context.Context, req EnableRequest) (bool, error) {
url := "/cloudbroker/extnet/enable"
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
aReq := asyncWrapperEnableRequest{
EnableRequest: req,
AsyncMode: false,
}
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return false, err
}
@@ -36,3 +47,32 @@ func (e ExtNet) Enable(ctx context.Context, req EnableRequest) (bool, error) {
return result, nil
}
// EnableAsync enables external networks in async mode
func (e ExtNet) EnableAsync(ctx context.Context, req EnableRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/extnet/enable"
aReq := asyncWrapperEnableRequest{
EnableRequest: req,
AsyncMode: true,
}
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, aReq)
if err != nil {
return "", err
}
var resp string
err = json.Unmarshal(res, &resp)
if err != nil {
return "", err
}
return resp, nil
}

View File

@@ -277,7 +277,7 @@ type CreateRequest struct {
// Memory balloon mode. One of ["auto","legacy","none"]
// Required: false
// Default: "auto"
// Default: none
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
// List of vGPU IDs to attach to the VM

View File

@@ -149,7 +149,7 @@ type CreateBlankRequest struct {
// Memory balloon mode. One of ["auto","legacy","none"]
// Required: false
// Default: "auto"
// Default: none
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
// List of vGPU IDs to attach to the VM

View File

@@ -195,7 +195,7 @@ type MassCreateRequest struct {
// Memory balloon mode. One of ["auto","legacy","none"]
// Required: false
// Default: "auto"
// Default: none
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
}

View File

@@ -13,10 +13,6 @@ type EnableRequest struct {
// Required: true
NID uint64 `url:"nid" json:"nid" validate:"required"`
// Message
// Required: false
Message string `url:"message,omitempty" json:"message,omitempty"`
// Do not check locks, iscsi-sessions or disk-present
// Default: false
// Required: false

View File

@@ -340,6 +340,9 @@ type ItemNode struct {
// PCI devices attached to the node
PCIDevices []ItemPCIDevice `json:"pci_devices"`
// Shared locks
SharedLocks map[string]interface{} `json:"shared_locks"`
}
type PackageInfo struct {
@@ -429,6 +432,12 @@ type ItemNicInfo struct {
// VFList
VFList []interface{} `json:"vflist"`
// Link state
LinkState string `json:"linkState"`
// Link speed
LinkSpeed int64 `json:"linkSpeed"`
}
type ListNetAddr []ItemNetAddr

View File

@@ -0,0 +1,42 @@
package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// RemoveSSHIdentityRequest to remove an ssh identity from a node
type RemoveSSHIdentityRequest struct {
// Node ID
// Required: true
NodeID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Key to remove
// Required: true
ClientPublicKey string `url:"client_public_key" json:"client_public_key" validate:"required"`
}
// RemoveSSHIdentity removes an ssh identity from a node
func (n Node) RemoveSSHIdentity(ctx context.Context, req RemoveSSHIdentityRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/remove_ssh_identity"
res, err := n.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
}

View File

@@ -32,7 +32,7 @@ type SharedLockStartRequest struct {
type wrapperSharedLockStartRequest struct {
SharedLockStartRequest
AsyncMode bool `url:"sync"`
AsyncMode bool `url:"async_mode"`
}
// SharedLockStart start shared locks without AsyncMode

View File

@@ -27,7 +27,7 @@ type SharedLockStopRequest struct {
type wrapperSharedLockStopRequest struct {
SharedLockStopRequest
AsyncMode bool `url:"sync"`
AsyncMode bool `url:"async_mode"`
}
// SharedLockStop stop shared locks without AsyncMode

View File

@@ -22,7 +22,7 @@ type ListRequest struct {
Sub string `url:"sub,omitempty" json:"sub,omitempty"`
// Filter by sid from JWT
SID uint64 `url:"sid,omitempty" json:"sid,omitempty"`
SID string `url:"sid,omitempty" json:"sid,omitempty"`
// Filter sessions with login_time >= timestamp (Unix timestamp)
TimestampAt uint64 `url:"timestamp_at,omitempty" json:"timestamp_at,omitempty"`
@@ -48,7 +48,7 @@ type ListRequest struct {
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty"`
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty"`
}
// List gets list of sessions as a ListSession struct

View File

@@ -29,6 +29,11 @@ type CreateRequest struct {
// one of: bvs, decs3o
// Required: false
Provider string `url:"provider,omitempty" json:"provider,omitempty" validate:"omitempty,userProvider"`
// Whether we create a service account
// Default value: false
// Required: false
ServiceAccount interface{} `url:"serviceaccount,omitempty" json:"serviceaccount,omitempty" validate:"omitempty,isBool"`
}
// Create creates a user.

View File

@@ -0,0 +1,42 @@
package user
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// UpdateServiceAccountRequest to update ServiceAccount field
type UpdateServiceAccountRequest struct {
// User ID
// Required: true
UserID string `url:"user_id" json:"user_id" validate:"required"`
// Whether the account is a service account
// Required: true
ServiceAccount interface{} `url:"serviceaccount" json:"serviceaccount" validate:"required,isBool"`
}
// UpdateServiceAccount updates ServiceAccount field
func (u User) UpdateServiceAccount(ctx context.Context, req UpdateServiceAccountRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/user/update_service_account"
res, err := u.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
}

View File

@@ -184,6 +184,9 @@ type ItemInterface struct {
// List of VNF IDs
VNFs []uint64 `json:"vnfs"`
// Whether default gateway is enabled
EnableDefaultGateway bool `json:"enable_default_gateway"`
}
// List of interfaces
@@ -304,6 +307,9 @@ type VNFsConfig struct {
// List of reservations
Reservations ListReservations `json:"reservations"`
// Whether default gateway is enabled
EnableDefaultGateway bool `json:"enable_default_gateway"`
}
// Primary

View File

@@ -13,11 +13,11 @@ import (
type DelACLAccessRequest struct {
// ID of a folder
// Required: true
FolderID uint64 `url:"folder_id" json:"folder_id"`
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
// User or group name to revoke access from
// Required: true
User string `url:"user" json:"user"`
User string `url:"user" json:"user" validate:"required"`
}
// DeleteACLAccess deletes ACL access from a vm foler