5 Commits

Author SHA1 Message Date
09b745caea v12.6.0 2025-10-14 14:56:21 +03:00
12e0b306ba v12.5.0 2025-10-09 17:53:08 +03:00
dayterr
42271b7a65 v12.4.0 2025-10-02 12:51:29 +03:00
8ac3b274ea v12.3.0 2025-10-01 16:25:48 +03:00
9950acd535 v12.2.0 2025-10-01 11:33:51 +03:00
17 changed files with 210 additions and 21 deletions

View File

@@ -7,8 +7,7 @@ Dynamix SDK - это библиотека, написанная на языке
- Версия 9.0.х Dynamix-SDK соответствует 4.1.0 версии платформы
- Версия 10.0.х Dynamix-SDK соответствует 4.2.0 версии платформы
- Версия 11.0.х Dynamix-SDK соответствует 4.3.0 версии платформы
- Версия 12.0.х Dynamix-SDK соответствует 4.4.0 версии платформы
- Версия 12.1.х Dynamix-SDK соответствует 4.4.0 версии платформы
- Версия 12.x.х Dynamix-SDK соответствует 4.4.0 версии платформы
## Оглавление

View File

@@ -28,10 +28,12 @@ func (de DecortClient) Check() (*CheckInfo, error) {
err = json.Unmarshal([]byte(strings.Replace(strings.Trim(string(res), `"`), "\\", "", -1)), &info)
if err != nil {
if _, exists := constants.VersionMap[string(res)]; exists {
info.Version = string(res)
var v string
json.Unmarshal([]byte(res), &v)
if _, exists := constants.VersionMap[v]; exists {
info.Version = v
} else {
return nil, err
return nil, fmt.Errorf("platform version isn't supported")
}
}
@@ -55,7 +57,13 @@ func (bvs BVSDecortClient) Check() (*CheckInfo, error) {
err = json.Unmarshal([]byte(strings.Replace(strings.Trim(string(res), `"`), "\\", "", -1)), &info)
if err != nil {
return nil, err
var v string
json.Unmarshal([]byte(res), &v)
if _, exists := constants.VersionMap[v]; exists {
info.Version = v
} else {
return nil, fmt.Errorf("platform version isn't supported")
}
}
if v, ok := constants.VersionMap[info.Version]; ok {
@@ -78,7 +86,13 @@ func (ldc LegacyDecortClient) Check() (*CheckInfo, error) {
err = json.Unmarshal([]byte(strings.Replace(strings.Trim(string(res), `"`), "\\", "", -1)), &info)
if err != nil {
return nil, err
var v string
json.Unmarshal([]byte(res), &v)
if _, exists := constants.VersionMap[v]; exists {
info.Version = v
} else {
return nil, fmt.Errorf("platform version isn't supported")
}
}
if v, ok := constants.VersionMap[info.Version]; ok {

View File

@@ -29,8 +29,8 @@ var K8sValues = []string{"labels", "taints", "annotations, additionalSANs"}
var VersionMap = map[string]string{
"4.4.0": "-",
"4.3.0": "v11.0.0",
"4.2.0": "v10.0.0",
"4.1.1": "v9.0.0",
"4.1.0": "v9.0.0",
"4.3.0": "-",
"4.2.0": "-",
"4.1.1": "-",
"4.1.0": "-",
}

View File

@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)

View File

@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)

View File

@@ -3,9 +3,8 @@ package compute
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"strconv"
)
// ChangeLinkStateRequest struct to change link state

View File

@@ -2,7 +2,6 @@ package pcidevice
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/serialization"
)

View File

@@ -0,0 +1,46 @@
package rg
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// AddStoragePolicyRequest struct for adding storage policy to the resource group
type AddStoragePolicyRequest struct {
// ID of resource group to add to
// Required: true
RGID uint64 `url:"resgroup_id" json:"resgroup_id" validate:"required"`
// ID of the storage policy to which to connect resource group
// Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
// Limit storage resources GB. Or -1 unlimit
// Required: false
Limit int `url:"limit,omitempty" json:"limit,omitempty"`
}
// AddStoragePolicy add storage policy to the account.
func (r RG) AddStoragePolicy(ctx context.Context, req AddStoragePolicyRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/rg/add_storage_policy"
res, err := r.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

@@ -0,0 +1,42 @@
package rg
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DelStoragePolicyRequest struct for deleting storage policy to the resource group
type DelStoragePolicyRequest struct {
// ID of resource group
// Required: true
RGID uint64 `url:"resgroup_id" json:"resgroup_id" validate:"required"`
// ID of the storage policy to which to disconnect account
// Required: true
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
}
// DelStoragePolicy delete storage policy to the account.
func (r RG) DelStoragePolicy(ctx context.Context, req DelStoragePolicyRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/rg/del_storage_policy"
res, err := r.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

@@ -30,6 +30,9 @@ type ItemStoragePolicy struct {
// Max IOPS for the sotrage policy
LimitIOPS uint64 `json:"limit_iops"`
// Storage policy ID
StoragePolicyID uint64 `json:"storage_policy_id"`
// Which accounts and resource groups use the storage policy
Usage Usage `json:"usage"`
}
@@ -56,6 +59,9 @@ type InfoStoragePolicy struct {
// Max IOPS for the sotrage policy
LimitIOPS uint64 `json:"limit_iops"`
// ID of the storage policy
StoragePolicyID uint64 `json:"storage_policy_id"`
// Which accounts and resource groups use the storage policy
Usage Usage `json:"usage"`
}

View File

@@ -214,6 +214,9 @@ type RecordVNFDev struct {
// Zone ID
ZoneID uint64 `json:"zoneId"`
// Live migration job ID
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
}
// VNF config

View File

@@ -3,9 +3,8 @@ package grid
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"strconv"
)
// SetCPUAllocationParameterRequest for setting CPU allocation parameter

View File

@@ -3,9 +3,8 @@ package grid
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
"strconv"
)
// SetCPUAllocationRatioForVMRequest for setting CPU allocation ratio for computes

View File

@@ -2,6 +2,7 @@ package image
import (
"context"
"encoding/json"
"net/http"
"strconv"
@@ -43,6 +44,11 @@ type CreateCDROMImageRequest struct {
PasswordDl string `url:"passwordDL,omitempty" json:"passwordDL,omitempty"`
}
type asyncWrapperCreateCDROMImageRequest struct {
CreateCDROMImageRequest
AsyncMode bool `url:"asyncMode"`
}
// CreateCDROMImage creates CD-ROM image from an ISO identified by URL
func (i Image) CreateCDROMImage(ctx context.Context, req CreateCDROMImageRequest) (uint64, error) {
err := validators.ValidateRequest(req)
@@ -52,7 +58,9 @@ func (i Image) CreateCDROMImage(ctx context.Context, req CreateCDROMImageRequest
url := "/cloudbroker/image/createCDROMImage"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
syncReq := asyncWrapperCreateCDROMImageRequest{CreateCDROMImageRequest: req, AsyncMode: false}
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, syncReq)
if err != nil {
return 0, err
}
@@ -64,3 +72,29 @@ func (i Image) CreateCDROMImage(ctx context.Context, req CreateCDROMImageRequest
return result, nil
}
// AsyncCreateCDROMImage creates CD-ROM image from an ISO identified by URL in async mode
func (i Image) AsyncCreateCDROMImage(ctx context.Context, req CreateCDROMImageRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/image/createCDROMImage"
asyncReq := asyncWrapperCreateCDROMImageRequest{CreateCDROMImageRequest: req, AsyncMode: true}
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, asyncReq)
if err != nil {
return " ", err
}
var taskID string
err = json.Unmarshal(res, &taskID)
if err != nil {
return "", err
}
return taskID, nil
}

View File

@@ -0,0 +1,42 @@
package node
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// UpdateDescriptionRequest struct to update description of the node
type UpdateDescriptionRequest struct {
// Node ID
// Required: true
NID uint64 `url:"nid" json:"nid" validate:"required"`
// New description for the node
// Required: true
Description string `url:"description" json:"description" validate:"required"`
}
// UpdateDescription updates description of the node
func (n Node) UpdateDescription(ctx context.Context, req UpdateDescriptionRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/node/update_description"
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

@@ -56,6 +56,9 @@ type ItemStoragePolicy struct {
// Max IOPS for the sotrage policy
LimitIOPS uint64 `json:"limit_iops"`
// Storage policy ID
StoragePolicyID uint64 `json:"storage_policy_id"`
// Which accounts and resource groups use the storage policy
Usage Usage `json:"usage"`
}
@@ -82,6 +85,9 @@ type InfoStoragePolicy struct {
// Max IOPS for the storage policy
LimitIOPS uint64 `json:"limit_iops"`
// Storage policy ID
StoragePolicyID uint64 `json:"storage_policy_id"`
// Which accounts and resource groups use the storage policy
Usage Usage `json:"usage"`
}

View File

@@ -250,6 +250,9 @@ type VNFDev struct {
// Zone ID
ZoneID uint64 `json:"zoneId"`
// Live migration job ID
LiveMigrationJobID uint64 `json:"live_migration_job_id"`
}
// Main information about reservation