This commit is contained in:
asteam
2025-09-26 19:17:30 +03:00
parent 48e2b0f2f9
commit 1ccc37a104
1022 changed files with 6440 additions and 1688 deletions

View File

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

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// AddUserRequest struct to add permission to access account for a user

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// AuditsRequest struct to give list of account audits

View File

@@ -1,75 +0,0 @@
package account
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
)
// CreateRequest struct for creating account
type CreateRequest struct {
// Display name
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// Name of the account
// Required: true
Username string `url:"username" json:"username" validate:"required"`
// Email
// Required: false
EmailAddress string `url:"emailaddress,omitempty" json:"emailaddress,omitempty" validate:"omitempty,email"`
// Max size of memory in MB
// Required: false
MaxMemoryCapacity int64 `url:"maxMemoryCapacity,omitempty" json:"maxMemoryCapacity,omitempty"`
// Max size of aggregated vdisks in GB
// Required: false
MaxVDiskCapacity int64 `url:"maxVDiskCapacity,omitempty" json:"maxVDiskCapacity,omitempty"`
// Max number of CPU cores
// Required: false
MaxCPUCapacity int64 `url:"maxCPUCapacity,omitempty" json:"maxCPUCapacity,omitempty"`
// Max sent/received network transfer peering
// Required: false
MaxNetworkPeerTransfer int64 `url:"maxNetworkPeerTransfer,omitempty" json:"maxNetworkPeerTransfer,omitempty"`
// Max number of assigned public IPs
// Required: false
MaxNumPublicIP int64 `url:"maxNumPublicIP,omitempty" json:"maxNumPublicIP,omitempty"`
// If true send emails when a user is granted access to resources
// Required: false
SendAccessEmails bool `url:"sendAccessEmails" json:"sendAccessEmails"`
// Limit (positive) or disable (0) GPU resources
// Required: false
GPUUnits int64 `url:"gpu_units,omitempty" json:"gpu_units,omitempty"`
}
// Create creates account
// Setting a cloud unit maximum to -1 or empty will not put any restrictions on the resource
func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/account/create"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return 0, err
}
result, err := strconv.ParseUint(string(res), 10, 64)
if err != nil {
return 0, err
}
return result, nil
}

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// DeleteRequest struct to delete account

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// DeleteUserRequest struct to revoke access to account

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// DisableEnableRequest struct to change status of account
@@ -13,6 +13,10 @@ type DisableEnableRequest struct {
// ID of account
// Required: true
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
// Reason of disabling
// Required: false
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// Disable disables an account

View File

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

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GetConsumedAccountUnitsRequest struct to calculate the currently consumed units for all cloudspaces and resource groups in the account

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GetConsumedCloudUnitsByTypeRequest struct to calculate the currently consumed cloud units of the specified type for all cloudspaces and resource groups in the account

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GetReservedAccountUnitsRequest struct to calculate the reserved units for all cloudspaces and resource groups in the account

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GetResourceConsumptionRequest struct to get resource consumption

View File

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

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// ListComputesRequest struct to get a list of compute instances

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// ListDeletedRequest struct to get a list of deleted accounts

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// ListDisksRequest struct to get a list of deleted disks

View File

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

View File

@@ -5,7 +5,7 @@ import (
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// ListRGRequest struct to get a list of resource groups

View File

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

View File

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

View File

@@ -62,6 +62,9 @@ type ItemAccount struct {
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
// Description
Description string `json:"desc"`
// ID
ID uint64 `json:"id"`
@@ -197,6 +200,9 @@ type RecordAccount struct {
// Created time
CreatedTime uint64 `json:"createdTime"`
// Description
Description string `json:"desc"`
// Deactivation time
DeactivationTime float64 `json:"deactivationTime"`
@@ -512,6 +518,9 @@ type ItemRG struct {
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
// Description
Description string `json:"desc"`
// Resource group ID
RGID uint64 `json:"id"`

View File

@@ -4,7 +4,7 @@ import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// RestoreRequest struct to restore a deleted account

View File

@@ -3,7 +3,7 @@ package account
import (
"encoding/json"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/serialization"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/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/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// UpdateRequest struct to update account
@@ -14,6 +14,10 @@ type UpdateRequest struct {
// Required: true
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
// Description
// Required: false
Description string `url:"desc,omitempty" json:"desc,omitempty"`
// Name of the account
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`

View File

@@ -5,7 +5,7 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// UpdateUserRequest struct to update user access rights