This commit is contained in:
asteam
2025-09-27 01:06:15 +03:00
parent 1ccc37a104
commit cf584c8123
1175 changed files with 11022 additions and 1832 deletions

View File

@@ -0,0 +1,54 @@
package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// AddSSHIdentityRequest struct to add node ssh information
type AddSSHIdentityRequest struct {
// Node ID
// Required: true
NID uint64 `url:"node_id" json:"node_id" validate:"required"`
// Host name of the client
// Required: true
ClientHostName string `url:"client_host_name" json:"client_host_name" validate:"required"`
// SSH host key of the client
// Required: true
ClientHostKey string `url:"client_host_key" json:"client_host_key" validate:"required" `
// SSH public key of the client
// Required: true
ClientPublicKey string `url:"client_public_key" json:"client_public_key" validate:"required"`
// IPv4 address
// Required: true
ClientIPAddress string `url:"client_ip_address" json:"client_ip_address" validate:"required" `
}
// AddSSHIdentity adds node ssh information
func (n Node) AddSSHIdentity(ctx context.Context, req AddSSHIdentityRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/add_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

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// ApplyIpmiActionRequest struct to apply ipmi action on node
@@ -14,7 +14,7 @@ type ApplyIpmiActionRequest struct {
NID uint64 `url:"nid" json:"nid" validate:"required"`
// Action
// on of actions power_on shutdown force_shutdown reboot
// Available values : is_powered, power_on, shutdown, force_shutdown, reboot.
// Required: true
Action string `url:"action" json:"action" validate:"required,action"`
}

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// ConsumptionRequest struct to get node summary by resources and consumption

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DecommissionRequest struct to set node status to DECOMMISSIONED

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// EnableRequest struct to enable node from maintenance status to enabled

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// EnableNodesRequest struct to enable nodes from maintenance status to enabled

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// GetRequest struct to get detailed information about node

View File

@@ -0,0 +1,39 @@
package node
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// GetSSHIdentityRequest struct to get node ssh information
type GetSSHIdentityRequest struct {
// Node ID
// Required: true
NID uint64 `url:"node_id" json:"node_id" validate:"required"`
}
// GetSSHIdentity gets node ssh information
func (n Node) GetSSHIdentity(ctx context.Context, req GetSSHIdentityRequest) (*SSHIdentity, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/get_ssh_identity"
res, err := n.client.DecortApiCall(ctx, http.MethodGet, url, req)
if err != nil {
return nil, err
}
info := SSHIdentity{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// ListRequest struct to get list of nodes

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// MaintenanceRequest struct to place node in maintenance state

View File

@@ -73,6 +73,9 @@ type RecordNode struct {
// Version
Version string `json:"version"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
}
// Resource consumption of the node
@@ -97,6 +100,9 @@ type ConsumptionInfo struct {
type FreeResourcesInfo struct {
// RAM
RAM float64 `json:"RAM"`
// VCPU
VCPU uint64 `json:"vCPU"`
}
// Resources Info
@@ -227,6 +233,9 @@ type ItemNode struct {
// Roles
Roles []string `json:"roles"`
// SDN Hypervisor Name
SDNHypervisorName string `json:"sdn_hypervisor_name"`
// Seps
Seps []uint64 `json:"seps"`
@@ -253,6 +262,9 @@ type ItemNode struct {
// Version
Version string `json:"version"`
// Zone ID
ZoneID uint64 `json:"zoneId"`
}
// Numa Topology Info
@@ -380,3 +392,15 @@ type Role struct {
Reason string `json:"reason"`
Time uint64 `json:"time"`
}
// Information about SSH Identity
type SSHIdentity struct {
//Host name of the client
HostName string `json:"host_name"`
//SSH host key of the client
HostKey string `json:"host_key"`
//Array of SSH public keys of the client
PublicKeys []string `json:"public_keys"`
}

View File

@@ -2,7 +2,7 @@
package node
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/interfaces"
)
// Structure for creating request to node

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// RestrictRequest struct to set node status to 'RESTRICTED'

View File

@@ -3,7 +3,7 @@ package node
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/serialization"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/serialization"
)
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// SetCoreIsolationRequest struct to isolate selected cores on node boot

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// SetHugePagesRequest struct to set on-boot Huge Pages configuration

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// SetSRIOVStatusRequest struct to set Single-root input/output virtualization kernel config on node

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// SetVFsNumberRequest struct to set number of VFs for individual NIC on node

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
type VFParam struct {

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// UpdateRequest struct to update node for actual version