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

@@ -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"
)
// AccessGrantRequest struct to grant access to resource group

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"
)
// AccessRevokeRequest struct to revoke access

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 := "/cloudbroker/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

@@ -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"
)
// AffinityGroupComputesRequest struct to get list of all computes with their relationships

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"
)
// AffinityGroupsGetRequest struct to get list of computes from affinity group

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"
)
// AffinityGroupsListRequest struct to get list of affinity groups from resource group

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"
)
// AuditsRequest struct to get audit

View File

@@ -5,7 +5,8 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// CreateRequest struct to create resource group
@@ -26,6 +27,10 @@ type CreateRequest struct {
// Required: false
MaxMemoryCapacity int64 `url:"maxMemoryCapacity,omitempty" json:"maxMemoryCapacity,omitempty"`
// Storage policies
// Required: false
StoragePolicies []StoragePolicy `url:"-" json:"storage_policies,omitempty"`
// Max size of aggregated virtual disks in GB
// Required: false
MaxVDiskCapacity int64 `url:"maxVDiskCapacity,omitempty" json:"maxVDiskCapacity,omitempty"`
@@ -73,9 +78,18 @@ type CreateRequest struct {
UniqPools []string `url:"uniqPools,omitempty" json:"uniqPools,omitempty"`
// Advanced compute features,
// one of: hugepages, numa, cpupin, vfnic, dpdk, changemac
// one of: hugepages, numa, cpupin, vfnic, dpdk, changemac, trunk
// Required: false
ComputeFeatures []string `url:"computeFeatures,omitempty" json:"computeFeatures,omitempty" validate:"omitempty,computeFeatures"`
// SDN access group id
// Required: false
SDNAccessGroupID string `url:"sdn_access_group_id,omitempty" json:"sdn_access_group_id,omitempty"`
}
type StoragePolicy struct {
ID uint64 `url:"id" json:"id"`
Limit int `url:"limit" json:"limit"`
}
// Create creates resource group
@@ -87,7 +101,7 @@ func (r RG) Create(ctx context.Context, req CreateRequest) (uint64, error) {
url := "/cloudbroker/rg/create"
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := r.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return 0, err
}

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 := "/cloudbroker/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

@@ -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"
)
// DeleteRequest struct to delete resource group

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"
)
// DisableRequest struct to disable resource group

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"
)
// EnableRequest struct to enable resource group

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 resource group

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"
)
// GetResourceConsumptionRequest struct to get detailed information about resource consumption for ResGroup

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 resource groups

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"
)
// ListComputesRequest struct to get list of computes

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"
)
// ListDeletedRequest struct to get list of deleted resource groups

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"
)
// ListLBRequest struct to get list of load balancers

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"
)
// ListPFWRequest struct to get list of port forward rules

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"
)
// ListVINSRequest struct to get list of VINSes

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"
)
// MassDeleteRequest struct to delete several resource groups
@@ -26,18 +26,18 @@ type MassDeleteRequest struct {
}
// MassDelete starts jobs to delete several resource groups
func (r RG) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, error) {
func (r RG) MassDelete(ctx context.Context, req MassDeleteRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/rg/massDelete"
_, err = r.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
return "", err
}
return true, nil
return string(res), 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"
)
// MassDisableRequest struct to disable several resource groups
@@ -15,18 +15,18 @@ type MassDisableRequest struct {
}
// MassDisable start jobs to disable several resource groups
func (r RG) MassDisable(ctx context.Context, req MassDisableRequest) (bool, error) {
func (r RG) MassDisable(ctx context.Context, req MassDisableRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/rg/massDisable"
_, err = r.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
return "", err
}
return true, nil
return string(res), 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"
)
// MassEnableRequest struct to enable several resource groups
@@ -15,18 +15,18 @@ type MassEnableRequest struct {
}
// MassEnable start jobs to enable several resource groups
func (r RG) MassEnable(ctx context.Context, req MassEnableRequest) (bool, error) {
func (r RG) MassEnable(ctx context.Context, req MassEnableRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/rg/massEnable"
_, err = r.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
return "", err
}
return true, nil
return string(res), nil
}

View File

@@ -126,6 +126,9 @@ type ResourceLimits struct {
// GPU units
GPUUnits float64 `json:"gpu_units"`
// Storage policies
StoragePolicies []StoragePolicy `json:"storage_policy"`
}
// Detailed information about resource group
@@ -202,9 +205,15 @@ type ItemRG struct {
// Resource types list
ResTypes []string `json:"resourceTypes"`
// SDN access group id
SDNAccessGroupID string `json:"sdn_access_group_id"`
// Secret
Secret string `json:"secret"`
// Storage policy ids
StoragePolicyIDs []uint64 `json:"storage_policy_ids"`
// Status
Status string `json:"status"`

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"
)
// RemoveDefNetRequest struct to remove default network

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"
)
// RestoreRequest struct to restore resource group

View File

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

View File

@@ -3,7 +3,7 @@ package rg
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

@@ -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"
)
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter

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"
)
// SetCPUAllocationRatioRequest struct for setting CPU allocation ratio

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"
)
// SetDefNetRequest struct to set default network

View File

@@ -5,7 +5,8 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// UpdateRequest struct to update resource group
@@ -50,6 +51,10 @@ type UpdateRequest struct {
// Default: false
// Required: false
ClearUniqPools bool `url:"clearUniqPools" json:"clearUniqPools"`
// Storage policies
// Required: false
StoragePolicies []StoragePolicy `url:"-" json:"storage_policies,omitempty"`
}
// Update updates resource group
@@ -61,7 +66,7 @@ func (r RG) Update(ctx context.Context, req UpdateRequest) (bool, error) {
url := "/cloudbroker/rg/update"
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := r.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
if err != nil {
return false, err
}

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"
)
// UpdateComputeFeaturesRequest struct to update advanced compute features

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"
)
// UpdateResourceTypesRequest struct to update resource types in account

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"
)
// UsageRequest struct to get report of resource usage