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

@@ -1,7 +1,7 @@
package cloudbroker
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/pkg/cloudbroker/account"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/pkg/cloudbroker/account"
)
// Accessing the Account method group

View File

@@ -1,7 +1,7 @@
// API Actor API for managing account
package account
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/interfaces"
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
// Structure for creating request to account
type Account struct {

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 for adding permission to access to 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

@@ -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"
)
// CreateRequest struct for creating account
@@ -14,6 +14,10 @@ type CreateRequest struct {
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// Description
// Required: false
Description string `url:"desc,omitempty" json:"desc,omitempty"`
// Name of the account
// Required: true
Username string `url:"username" json:"username" validate:"required"`
@@ -56,7 +60,7 @@ type CreateRequest struct {
UniqPools []string `url:"uniqPools,omitempty" json:"uniqPools,omitempty"`
// Advanced compute features,
// one of: hugepages, numa, cpupin, vfnic
// one of: hugepages, numa, cpupin, vfnic, dpdk, changemac
// Required: false
ComputeFeatures []string `url:"computeFeatures,omitempty" json:"computeFeatures,omitempty" validate:"omitempty,computeFeatures"`
}

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
@@ -16,6 +16,14 @@ type DeleteRequest struct {
// Whether to completely delete the account
// Required: false
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
// Name of account
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`
// Reason of deleting
// Required: false
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// Delete completes delete an account from the system Returns true if account is deleted or was already deleted or never existed

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"
)
// DeleteAccountsRequest struct to delete group of accounts

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"
)
// DisableRequest struct to disable account
@@ -13,6 +13,10 @@ type DisableRequest 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

@@ -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"
)
// DisableAccountsRequest struct to disable group of accounts
@@ -12,6 +12,10 @@ type DisableAccountsRequest struct {
// IDs of accounts
// Required: true
AccountIDs []uint64 `url:"accountIds" json:"accountIds" validate:"min=1"`
// Reason of disabling
// Required: false
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// DisableAccounts disables accounts

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

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"
)
// EnableAccountsRequest to enable group 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"
)
// 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"
)
// GetResourceConsumptionRequest struct for getting resource consumption

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"
)
// GrantAccessTemplatesRequest struct to share images with 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"
)
// 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"
)
// ListAvailableTemplatesRequest struct to list templates who sharedWith include accountId

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

View File

@@ -170,6 +170,9 @@ type InfoAccount struct {
// Display name
DisplayName string `json:"displayname"`
// Description
Description string `json:"desc"`
// GUID
GUID uint64 `json:"guid"`
@@ -476,6 +479,9 @@ type ItemRG struct {
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
// Description
Description string `json:"desc"`
// ID
ID 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
@@ -12,6 +12,10 @@ type RestoreRequest struct {
// ID an account
// Required: true
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
// Reason of disabling
// Required: false
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// Restore restores a deleted 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"
)
// RevokeAccessTemplatesRequest struct to unshare images with 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"
)
// SetCPUAllocationParameterRequest struct for setting CPU allocation parameter

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

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" json:"name"`

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"
)
// UpdateComputeFeaturesRequest struct to update advanced compute features
@@ -15,7 +15,7 @@ type UpdateComputeFeaturesRequest struct {
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
// Advanced compute features,
// one of: hugepages, numa, cpupin, vfnic
// one of: hugepages, numa, cpupin, vfnic, dpdk, changemac
// Required: false
ComputeFeatures []string `url:"computeFeatures,omitempty" json:"computeFeatures,omitempty" validate:"omitempty,computeFeatures"`
}

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"
)
// UpdateResourceTypesRequest struct to update resource types in 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"
)
// UpdateUserRequest struct to update user access rights

View File

@@ -1,6 +1,6 @@
package cloudbroker
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/pkg/cloudbroker/apiaccess"
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/pkg/cloudbroker/apiaccess"
// Accessing the APIAccess method group
func (cb *CloudBroker) APIAccess() *apiaccess.APIAccess {

View File

@@ -5,15 +5,23 @@ 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"
)
// APIFindRequest struct for finding apiaccess groups.
type APIFindRequest struct {
// API function to find
// Example: cloudbroker/k8s/create
// Required: true
APIName string `url:"apiName" json:"apiName" validate:"required"`
//API group to find (cloudbroker, cloudapi, etc)
//Available values : cloudapi, cloudbroker, system
//Required: true
APIGroup string `url:"api_group" json:"api_group" validate:"required,apiGroup"`
//API object to find (compute, vins, etc )
//Required: true
APIObject string `url:"api_object" json:"api_object" validate:"required"`
//API endpoint to find (delete, create, etc)
//Required: true
APIMethod string `url:"api_method" json:"api_method" validate:"required"`
}
// APIFind outputs a list of apiaccess groups that mention the specified API function.

View File

@@ -1,6 +1,6 @@
package apiaccess
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/interfaces"
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
// Structure for creating request to APIAccess
type APIAccess struct {

View File

@@ -6,7 +6,7 @@ import (
"fmt"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
type APIString string
@@ -15,7 +15,7 @@ type APIString string
type APIsExcludeRequest struct {
// APIAccess group ID
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
// APIs to remove from APIAccess group
// Required: true

View File

@@ -5,14 +5,14 @@ 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"
)
// APIsIncludeRequest struct for adding api to access group.
type APIsIncludeRequest struct {
// APIAccess group ID.
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
// APIs to add to APIAccess group.
// Required: true

View File

@@ -5,14 +5,14 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// CopyRequest Request for copying apiaccess group.
type CopyRequest struct {
// ID of the API access group to make copy from
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
// Name of the target API access group, which will be created on successful copy
// Required: true

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"
)
// CreateRequest struct for creating apiaccess group.

View File

@@ -5,14 +5,14 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// DeleteRequest struct for deleting apiaccess group.
type DeleteRequest struct {
// APIAccess group ID.
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
// Set True to delete apiaccess group with attached users.
// Required: false

View File

@@ -5,14 +5,14 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// DescUpdateRequest struct for updating apiaccess group description.
type DescUpdateRequest struct {
// APIAccess group ID.
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
// New description to set for the apiaccess group.
// Required: true

View File

@@ -5,14 +5,14 @@ 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 apiaccess group.
type GetRequest struct {
// APIAccess group ID.
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
}
// Get gets apiaccess group as an ItemAPIAccess struct

View File

@@ -6,11 +6,11 @@ import (
"net/http"
)
// GetPreGroups gets list of pre default groups from spec
func (a APIAccess) GetPreGroups(ctx context.Context) (map[string]APIsEndpoints, error) {
url := "/cloudbroker/apiaccess/getPreGroups"
// GetDefault gets default apiaccess group
func (a APIAccess) GetDefault(ctx context.Context) (*ItemAPIAccessDefault, error) {
url := "/cloudbroker/apiaccess/getDefault"
info := make(map[string]APIsEndpoints)
info := ItemAPIAccessDefault{}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, nil)
if err != nil {
@@ -22,5 +22,5 @@ func (a APIAccess) GetPreGroups(ctx context.Context) (map[string]APIsEndpoints,
return nil, err
}
return info, nil
return &info, nil
}

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 all non deleted apiaccess instances.
@@ -22,21 +22,21 @@ type ListRequest struct {
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Find by created actor
// Find by description
// Required: false
CreatedBy string `url:"createdBy,omitempty" json:"createdBy,omitempty"`
Desc string `url:"desc,omitempty" json:"desc,omitempty"`
// Find by created after time (unix timestamp)
// Required: false
CreatedAfter uint64 `url:"createdAfter,omitempty" json:"createdAfter,omitempty"`
CreatedAfter uint64 `url:"created_after,omitempty" json:"created_after,omitempty"`
// Find by created before time (unix timestamp)
// Required: false
CreatedBefore uint64 `url:"createdBefore,omitempty" json:"createdBefore,omitempty"`
CreatedBefore uint64 `url:"created_before,omitempty" json:"created_before,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false

View File

@@ -1,48 +0,0 @@
package apiaccess
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
)
// ListDeletedRequest struct for getting list of all deleted apiaccess instances.
type ListDeletedRequest struct {
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number.
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size.
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// ListDeleted gets list of all deleted apiaccess instances.
func (a APIAccess) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListAPIAccess, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/apiaccess/listDeleted"
info := ListAPIAccess{}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}

View File

@@ -4,20 +4,51 @@ type ItemAPIAccess struct {
// APIs
APIs APIsEndpoints `json:"apis"`
// Created by
CreatedBy string `json:"createdBy"`
// Created time
CreatedTime uint64 `json:"createdTime"`
CreatedTime uint64 `json:"created_at"`
// Is default
Default bool `json:"default"`
// Deleted by
DeletedBy string `json:"deletedBy"`
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
DeletedTime uint64 `json:"deleted_at"`
// Description
Description string `json:"desc"`
// GID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// ID
ID uint64 `json:"id"`
// Name
Name string `json:"name"`
// Is protected
Protected bool `json:"protected"`
// Status
Status string `json:"status"`
// Updated time
UpdatedTime uint64 `json:"updated_at"`
}
type ItemAPIAccessDefault struct {
// APIs
APIs APIsEndpoints `json:"apis"`
// Created at
CreatedAt uint64 `json:"created_at"`
// Is default
Default bool `json:"default"`
// Deleted at
DeletedAt uint64 `json:"deleted_at"`
// Description
Description string `json:"decs"`
@@ -31,23 +62,17 @@ type ItemAPIAccess struct {
// ID
ID uint64 `json:"id"`
// Milestones
Milestones uint64 `json:"milestones"`
// Name
Name string `json:"name"`
// Is protected
// Protected
Protected bool `json:"protected"`
// Status
Status string `json:"status"`
//Updated by
UpdatedBy string `json:"updatedBy"`
// Updated time
UpdatedTime uint64 `json:"updatedTime"`
//Updated at
UpdatedAt uint64 `json:"updated_at"`
}
type ListAPIAccess struct {
@@ -77,6 +102,7 @@ type CloudAPIEndpoints struct {
Compute []string `json:"compute,omitempty"`
ComputeCI []string `json:"computeci,omitempty"`
Disks []string `json:"disks,omitempty"`
DPDK []string `json:"dpdk,omitempty"`
ExtNet []string `json:"extnet,omitempty"`
FLIPGroup []string `json:"flipgroup,omitempty"`
GPU []string `json:"gpu,omitempty"`
@@ -115,6 +141,7 @@ type CloudBrokerEndpoints struct {
Desnode []string `json:"desnode,omitempty"`
Diagnostics []string `json:"diagnostics,omitempty"`
Disks []string `json:"disks,omitempty"`
DPDK []string `json:"dpdk,omitempty"`
Eco []string `json:"eco,omitempty"`
ExtNet []string `json:"extnet,omitempty"`
FlIPgroup []string `json:"flipgroup,omitempty"`

View File

@@ -5,14 +5,14 @@ import (
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SetDefaultRequest struct for setting default apiaccess group.
type SetDefaultRequest struct {
// APIAccess group ID
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
}
// SetDefault sets current apiaccess group default.

View File

@@ -6,16 +6,16 @@ import (
"context"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SubtractRequest struct for subtracting.
type SubtractRequest struct {
// ID of the API access group to subtract from. This group will contain the difference.
MinuendID uint64 `url:"minuendId" json:"minuendId" validate:"required"`
MinuendID uint64 `url:"minuend_group_id" json:"minuend_group_id" validate:"required"`
// ID of the API access group which is subtracted. This group is unchanged.
SubtrahendID uint64 `url:"subtrahendId" json:"subtrahendId" validate:"required"`
SubtrahendID uint64 `url:"subtrahend_group_id" json:"subtrahend_group_id" validate:"required"`
}
// Subtract removes such APIs from MinuendID that match APIs from SubtrahendID.

View File

@@ -5,18 +5,18 @@ 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"
)
// UnionRequest struct for union.
type UnionRequest struct {
// Recipient apiaccess group ID
// Required: true
RecipientID uint64 `url:"recipientId" json:"recipientId" validate:"required"`
RecipientID uint64 `url:"recipient_group_id" json:"recipient_group_id" validate:"required"`
// Donor apiaccess group ID
// Required: true
DonorID uint64 `url:"donorId" json:"donorId" validate:"required"`
DonorID uint64 `url:"donor_group_id" json:"donor_group_id" validate:"required"`
}
// Union combines the API list of group #1 ("recipient") and group #2 ("donor"),

View File

@@ -6,14 +6,14 @@ 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 for updating apis of apiaccess group.
type UpdateRequest struct {
// APIAccess group ID
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
// APIs to remove from APIAccess group
// Required: false

View File

@@ -5,14 +5,14 @@ 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"
)
// UserListRequest struct for getting a list of users currently included in the specified group.
type UserListRequest struct {
// APIAccess group ID
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
// Page number
// Required: false

View File

@@ -1,7 +1,7 @@
package cloudbroker
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/pkg/cloudbroker/audit"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/pkg/cloudbroker/audit"
)
// Accessing the Stack method group

View File

@@ -1,6 +1,6 @@
package audit
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/interfaces"
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
// Structure for creating request to audit
type Audit struct {

View File

@@ -5,14 +5,14 @@ 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
type GetRequest struct {
// Audit GUID
// Required: true
AuditGuid string `url:"auditGuid" json:"auditGuid" validate:"required"`
AuditGuid string `url:"audit_guid" json:"audit_guid" validate:"required"`
}
// Get gets information about audit as a RecordAudit struct

View File

@@ -5,14 +5,14 @@ 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"
)
// LinkedJobsRequest struct to get information about jobs linked with Audit
type LinkedJobsRequest struct {
// Audit GUID
// Required: true
AuditGuid string `url:"auditGuid" json:"auditGuid" validate:"required"`
AuditGuid string `url:"audit_guid" json:"audit_guid" validate:"required"`
}
// LinkedJobs gets information about Linked Jobs as a ListLinkedJobs struct

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 give list of account audits
@@ -13,11 +13,11 @@ type ListRequest struct {
// Find all audits after point in time (unixtime)
// Required: false
TimestampAt uint64 `url:"timestampAt,omitempty" json:"timestampAt,omitempty"`
TimestampAt uint64 `url:"timestamp_at,omitempty" json:"timestamp_at,omitempty"`
// Find all audits before point in time (unixtime)
// Required: false
TimestampTo uint64 `url:"timestampTo,omitempty" json:"timestampTo,omitempty"`
TimestampTo uint64 `url:"timestamp_to,omitempty" json:"timestamp_to,omitempty"`
// Find by user (Mongo RegExp supported)
// Required: false
@@ -27,17 +27,21 @@ type ListRequest struct {
// Required: false
Call string `url:"call,omitempty" json:"call,omitempty"`
// Find by request id
// Required: false
RequestID string `url:"request_id,omitempty" json:"request_id,omitempty"`
// Find by HTTP min status code
// Required: false
MinStatusCode uint64 `url:"minStatusCode,omitempty" json:"minStatusCode,omitempty"`
MinStatusCode uint64 `url:"min_status_code,omitempty" json:"min_status_code,omitempty"`
// Find by HTTP max status code
// Required: false
MaxStatusCode uint64 `url:"maxStatusCode,omitempty" json:"maxStatusCode,omitempty"`
MaxStatusCode uint64 `url:"max_status_code,omitempty" json:"max_status_code,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
SortBy string `url:"sort_by,omitempty" json:"sort_by,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false

View File

@@ -2,23 +2,44 @@ package audit
// Main info about audit
type ItemAudit struct {
// Args
Args string `json:"args"`
// Call
Call string `json:"call"`
// GUID
GUID string `json:"guid"`
// Kwargs
Kwargs string `json:"kwargs"`
// RemoteAddr
RemoteAddr string `json:"remote_addr"`
// Response time
ResponseTime float64 `json:"responsetime"`
// Result
Result string `json:"result"`
// Status code
StatusCode uint64 `json:"statuscode"`
// Timestamp
Timestamp float64 `json:"timestamp"`
// Timestamp End
TimestampEnd float64 `json:"timestampEnd"`
// User
User string `json:"user"`
// TTL
TTL string `json:"_ttl"`
// Tags
Tags string `json:"tags"`
}
// List of audits
@@ -68,6 +89,9 @@ type RecordAudit struct {
// User
User string `json:"user"`
// TTL
TTL string `json:"_ttl"`
}
// List of Linked Jobs
@@ -85,6 +109,9 @@ type ItemLinkedJobs struct {
// NID
NID uint64 `json:"nid"`
// Physical Node or not
PhysicalNode bool `json:"physicalNode"`
// state
State string `json:"state"`

View File

@@ -1,6 +1,6 @@
package cloudbroker
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/pkg/cloudbroker/backup"
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/pkg/cloudbroker/backup"
// Accessing the Backup method group
func (cb *CloudBroker) Backup() *backup.Backup {

View File

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

View File

@@ -6,7 +6,7 @@ import (
"net/http"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// CreateDiskBackupRequest struct for creating disk backup

View File

@@ -6,7 +6,7 @@ import (
"net/http"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
type Disk struct {

View File

@@ -6,7 +6,7 @@ import (
"strconv"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// DeleteDiskBackupRequest struct for deleting disk backup

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"
)
// ListBackupPathsRequest struct for getting list of backup paths

View File

@@ -6,7 +6,7 @@ import (
"net/http"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// RestoreDiskFromBackupRequest struct for restoring disk from backup

View File

@@ -6,7 +6,7 @@ import (
"net/http"
"strings"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/internal/validators"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
type BackupFile struct {

View File

@@ -0,0 +1,8 @@
package cloudbroker
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/pkg/cloudbroker/bservice"
// Accessing the BService method group
func (ca *CloudBroker) BService() *bservice.BService {
return bservice.New(ca.client)
}

View File

@@ -0,0 +1,15 @@
package bservice
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
// Structure for creating request to bservice
type BService struct {
client interfaces.Caller
}
// Builder for bservice endpoints
func New(client interfaces.Caller) *BService {
return &BService{
client,
}
}

View File

@@ -0,0 +1,50 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// CreateRequest struct for BasicService
type CreateRequest struct {
// Name of the service
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// ID of the Resource Group where this service will be placed
// Required: true
RGID uint64 `url:"rgId" json:"rgId" validate:"required"`
// Name of the user to deploy SSH key for. Pass empty string if no SSH key deployment is required
// Required: false
SSHUser string `url:"sshUser,omitempty" json:"sshUser,omitempty"`
// SSH key to deploy for the specified user. Same key will be deployed to all computes of the service
// Required: false
SSHKey string `url:"sshKey,omitempty" json:"sshKey,omitempty"`
}
// Create creates blank BasicService instance
func (b BService) Create(ctx context.Context, req CreateRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/create"
res, err := b.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

@@ -0,0 +1,42 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// DeleteRequest struct to delete basic service
type DeleteRequest struct {
// ID of the BasicService to be delete
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// If set to False, Basic service will be deleted to recycle bin. Otherwise destroyed immediately
// Required: true
Permanently bool `url:"permanently" json:"permanently"`
}
// Delete deletes BasicService instance
func (b BService) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/delete"
res, err := b.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,40 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// DisableRequest struct for disable service
type DisableRequest struct {
// ID of the service to disable
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
}
// Disable disables service.
// Disabling a service technically means setting model status
// of all computes and service itself to DISABLED and stopping all computes.
func (b BService) Disable(ctx context.Context, req DisableRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/disable"
res, err := b.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,41 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// EnableRequest struct to disable service
type EnableRequest struct {
// ID of the service to enable
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
}
// Enable enables service.
// Enabling a service technically means setting model status of
// all computes and service itself to ENABLED.
// It does not start computes.
func (b BService) Enable(ctx context.Context, req EnableRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/enable"
res, err := b.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,71 @@
package bservice
// FilterByID returns ListBasicServices with specified ID.
func (lbs ListBasicServices) FilterByID(id uint64) ListBasicServices {
predicate := func(ibs ItemBasicService) bool {
return ibs.ID == id
}
return lbs.FilterFunc(predicate)
}
// FilterByName returns ListBasicServices with specified Name.
func (lbs ListBasicServices) FilterByName(name string) ListBasicServices {
predicate := func(ibs ItemBasicService) bool {
return ibs.Name == name
}
return lbs.FilterFunc(predicate)
}
// FilterByRGID returns ListBasicServices with specified RGID.
func (lbs ListBasicServices) FilterByRGID(rgID uint64) ListBasicServices {
predicate := func(ibs ItemBasicService) bool {
return ibs.RGID == rgID
}
return lbs.FilterFunc(predicate)
}
// FilterByStatus returns ListBasicServices with specified Status.
func (lbs ListBasicServices) FilterByStatus(status string) ListBasicServices {
predicate := func(ibs ItemBasicService) bool {
return ibs.Status == status
}
return lbs.FilterFunc(predicate)
}
// FilterByTechStatus returns ListBasicServices with specified TechStatus.
func (lbs ListBasicServices) FilterByTechStatus(techStatus string) ListBasicServices {
predicate := func(ibs ItemBasicService) bool {
return ibs.TechStatus == techStatus
}
return lbs.FilterFunc(predicate)
}
// FilterFunc allows filtering ListResourceGroups based on a user-specified predicate.
func (lbs ListBasicServices) FilterFunc(predicate func(ItemBasicService) bool) ListBasicServices {
var result ListBasicServices
for _, item := range lbs.Data {
if predicate(item) {
result.Data = append(result.Data, item)
}
}
result.EntryCount = uint64(len(lbs.Data))
return result
}
// FindOne returns first found ItemBasicService
// If none was found, returns an empty struct.
func (lbs ListBasicServices) FindOne() ItemBasicService {
if lbs.EntryCount == 0 {
return ItemBasicService{}
}
return lbs.Data[0]
}

View File

@@ -0,0 +1,155 @@
package bservice
import "testing"
var bservices = ListBasicServices{
Data: []ItemBasicService{
{
AccountID: 1,
AccountName: "std_1",
BaseDomain: "",
CreatedBy: "sample_user_1@decs3o",
CreatedTime: 1677743675,
DeletedBy: "",
DeletedTime: 0,
GID: 212,
Groups: []uint64{},
GUID: 1,
ID: 1,
Name: "bservice_1",
ParentSrvID: 0,
ParentSrvType: "",
RGID: 7971,
RGName: "rg_1",
SSHUser: "",
Status: "CREATED",
TechStatus: "STOPPED",
UpdatedBy: "",
UpdatedTime: 0,
UserManaged: true,
},
{
AccountID: 2,
AccountName: "std_2",
BaseDomain: "",
CreatedBy: "sample_user_1@decs3o",
CreatedTime: 1677743736,
DeletedBy: "",
DeletedTime: 0,
GID: 212,
Groups: []uint64{},
GUID: 2,
ID: 2,
Name: "bservice_2",
ParentSrvID: 0,
ParentSrvType: "",
RGID: 7972,
RGName: "rg_2",
SSHUser: "",
Status: "CREATED",
TechStatus: "STOPPED",
UpdatedBy: "",
UpdatedTime: 0,
UserManaged: true,
},
{
AccountID: 3,
AccountName: "std_3",
BaseDomain: "",
CreatedBy: "sample_user_2@decs3o",
CreatedTime: 1677743830,
DeletedBy: "",
DeletedTime: 0,
GID: 212,
Groups: []uint64{},
GUID: 3,
ID: 3,
Name: "bservice_3",
ParentSrvID: 0,
ParentSrvType: "",
RGID: 7973,
RGName: "rg_3",
SSHUser: "",
Status: "ENABLED",
TechStatus: "STARTED",
UpdatedBy: "",
UpdatedTime: 0,
UserManaged: true,
},
},
EntryCount: 3,
}
func TestFilterByID(t *testing.T) {
actual := bservices.FilterByID(1).FindOne()
if actual.ID != 1 {
t.Fatal("expected ID 1, found: ", actual.ID)
}
}
func TestFilterByName(t *testing.T) {
actual := bservices.FilterByName("bservice_3").FindOne()
if actual.Name != "bservice_3" {
t.Fatal("expected Name 'bservice_3', found: ", actual.Name)
}
}
func TestFilterByRGID(t *testing.T) {
actual := bservices.FilterByRGID(7971).FindOne()
if actual.RGID != 7971 {
t.Fatal("expected RGID 7971, found: ", actual.RGID)
}
}
func TestFilterByStatus(t *testing.T) {
actual := bservices.FilterByStatus("CREATED")
if len(actual.Data) != 2 {
t.Fatal("expected 2 found, actual: ", len(actual.Data))
}
for _, item := range actual.Data {
if item.Status != "CREATED" {
t.Fatal("expected Status 'CREATED', found: ", item.Status)
}
}
}
func TestFilterByTechStatus(t *testing.T) {
actual := bservices.FilterByTechStatus("STOPPED")
if len(actual.Data) != 2 {
t.Fatal("expected 2 found, actual: ", len(actual.Data))
}
for _, item := range actual.Data {
if item.TechStatus != "STOPPED" {
t.Fatal("expected TechStatus 'STOPPED', found: ", item.TechStatus)
}
}
}
func TestFilterFunc(t *testing.T) {
actual := bservices.FilterFunc(func(ibs ItemBasicService) bool {
return ibs.CreatedBy == "sample_user_2@decs3o"
})
if len(actual.Data) > 1 {
t.Fatal("expected 1 found, actual: ", len(actual.Data))
}
if actual.FindOne().CreatedBy != "sample_user_2@decs3o" {
t.Fatal("expected 'sample_user_2@decs3o', found: ", actual.FindOne().CreatedBy)
}
}
func TestSortByCreatedTime(t *testing.T) {
actual := bservices.SortByCreatedTime(true)
if actual.Data[0].CreatedTime != 1677743830 || actual.Data[2].CreatedTime != 1677743675 {
t.Fatal("expected descending order, found ascending")
}
}

View File

@@ -0,0 +1,46 @@
package bservice
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GetRequest struct to get detailed information about service
type GetRequest struct {
// ID of the service to query information
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
}
// Get gets detailed specifications for the BasicService as a RecordBasicService struct
func (b BService) Get(ctx context.Context, req GetRequest) (*RecordBasicService, error) {
res, err := b.GetRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordBasicService{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetRaw gets detailed specifications for the BasicService as an array of bytes
func (b BService) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/get"
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}

View File

@@ -0,0 +1,112 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupAddRequest struct to create new compute group within BasicService
type GroupAddRequest struct {
// ID of the Basic Service to add a group to
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// Name of the Compute Group to add
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// Computes number. Defines how many computes must be there in the group
// Required: true
Count uint64 `url:"count" json:"count" validate:"required"`
// Compute CPU number. All computes in the group have the same CPU count
// Required: true
CPU uint64 `url:"cpu" json:"cpu" validate:"required"`
// Compute RAM volume in MB. All computes in the group have the same RAM volume
// Required: true
RAM uint64 `url:"ram" json:"ram" validate:"required"`
// Compute boot disk size in GB
// Required: true
Disk uint64 `url:"disk" json:"disk" validate:"required"`
// OS image ID to create computes from
// Required: true
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
// Compute driver
// should be one of:
// - KVM_X86
// Required: true
Driver string `url:"driver" json:"driver" validate:"driver"`
// Storage endpoint provider ID
// Required: false
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
// Pool to use if sepId is set, can be also empty if needed to be chosen by system
// Required: false
SEPPool string `url:"sepPool,omitempty" json:"sepPool,omitempty"`
// Group role tag. Can be empty string, does not have to be unique
// Required: false
Role string `url:"role,omitempty" json:"role,omitempty"`
// List of ViNSes to connect computes to
// Required: false
VINSes []uint64 `url:"vinses,omitempty" json:"vinses,omitempty"`
// List of external networks to connect computes to
// Required: false
ExtNets []uint64 `url:"extnets,omitempty" json:"extnets,omitempty"`
// Time of Compute Group readiness
// Required: false
TimeoutStart uint64 `url:"timeoutStart,omitempty" json:"timeoutStart,omitempty"`
// Meta data for working group computes, format YAML "user_data": 1111
// Required: false
UserData string `url:"userData,omitempty" json:"userData,omitempty"`
//Chipset "i440fx" or "Q35
//Required: false
Chipset string `url:"chipset,omitempty" json:"chipset,omitempty" validate:"chipset"`
}
// GetRAM returns RAM field values
func (r GroupAddRequest) GetRAM() map[string]uint64 {
res := make(map[string]uint64, 1)
res["RAM"] = r.RAM
return res
}
// GroupAdd creates new Compute Group within BasicService.
// Compute Group is NOT started automatically,
// so you need to explicitly start it
func (b BService) GroupAdd(ctx context.Context, req GroupAddRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupAdd"
res, err := b.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

@@ -0,0 +1,46 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupComputeRemoveRequest struct to remove group compute
type GroupComputeRemoveRequest struct {
// ID of the Basic Service
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute GROUP
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
// ID of the Compute
// Required: true
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
}
// GroupComputeRemove makes group compute remove of the Basic Service
func (b BService) GroupComputeRemove(ctx context.Context, req GroupComputeRemoveRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupComputeRemove"
res, err := b.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,44 @@
package bservice
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupGetRequest struct to get detailed information about Compute Group
type GroupGetRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
}
// GroupGet gets detailed specifications for the Compute Group
func (b BService) GroupGet(ctx context.Context, req GroupGetRequest) (*RecordGroup, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupGet"
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
info := RecordGroup{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}

View File

@@ -0,0 +1,48 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupParentRemoveRequest struct to remove parent Compute Group
// relation from the specified Compute Group
type GroupParentRemoveRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
// ID of the parent Compute Group
// to remove from the current Compute Group
// Required: true
ParentID uint64 `url:"parentId" json:"parentId" validate:"required"`
}
// GroupParentRemove removes parent Compute Group relation to the specified Compute Group
func (b BService) GroupParentRemove(ctx context.Context, req GroupParentRemoveRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupParentRemove"
res, err := b.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,46 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupParentAddRequest struct to add parent Compute Group relation to the specified Compute Group
type GroupParentAddRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
// ID of the parent Compute Group to register with the current Compute Group
// Required: true
ParentID uint64 `url:"parentId" json:"parentId" validate:"required"`
}
// GroupParentAdd add parent Compute Group relation to the specified Compute Group
func (b BService) GroupParentAdd(ctx context.Context, req GroupParentAddRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupParentAdd"
res, err := b.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,43 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupRemoveRequest struct for destroy the specified Compute Group
type GroupRemoveRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
}
// GroupRemove destroy the specified Compute Group
func (b BService) GroupRemove(ctx context.Context, req GroupRemoveRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupRemove"
res, err := b.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,59 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupResizeRequest struct to resize the group
type GroupResizeRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group to resize
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
// Either delta or absolute value of computes
// Required: true
Count int64 `url:"count" json:"count" validate:"required"`
//Chipset for new computes, either i440fx or Q35 (i440fx by default)
//Available values : i440fx, Q35
//Default value : i440fx
//Required: true
Chipset string `url:"chipset" json:"chipset" validate:"required,chipset"`
// Either delta or absolute value of computes
// Should be one of:
// - ABSOLUTE
// - RELATIVE
// Required: true
Mode string `url:"mode" json:"mode" validate:"bserviceMode"`
}
// GroupResize resize the group by changing the number of computes
func (b BService) GroupResize(ctx context.Context, req GroupResizeRequest) (uint64, error) {
err := validators.ValidateRequest(req)
if err != nil {
return 0, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupResize"
res, err := b.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

@@ -0,0 +1,42 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupStartRequest struct to start the specified Compute Group
type GroupStartRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group to start
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
}
// GroupStart starts the specified Compute Group within BasicService
func (b BService) GroupStart(ctx context.Context, req GroupStartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupStart"
res, err := b.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,46 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupStopRequest struct to stop the specified Compute Group
type GroupStopRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group to stop
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
// Force stop Compute Group
// Required: false
Force bool `url:"force,omitempty" json:"force,omitempty"`
}
// GroupStop stops the specified Compute Group within BasicService
func (b BService) GroupStop(ctx context.Context, req GroupStopRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupStop"
res, err := b.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,76 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupUpdateRequest struct to update existing Compute group
type GroupUpdateRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
// Specify non-empty string to update Compute Group name
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`
// Specify non-empty string to update group role
// Required: false
Role string `url:"role,omitempty" json:"role,omitempty"`
// Specify positive value to set new compute CPU count
// Required: false
CPU uint64 `url:"cpu,omitempty" json:"cpu,omitempty"`
// Specify positive value to set new compute RAM volume in MB
// Required: false
RAM uint64 `url:"ram,omitempty" json:"ram,omitempty"`
// Specify new compute boot disk size in GB
// Required: false
Disk uint64 `url:"disk,omitempty" json:"disk,omitempty"`
// Force resize Compute Group
// Required: false
Force bool `url:"force,omitempty" json:"force,omitempty"`
}
// GetRAM returns RAM field values
func (r GroupUpdateRequest) GetRAM() map[string]uint64 {
res := make(map[string]uint64, 1)
res["RAM"] = r.RAM
return res
}
// GroupUpdate updates existing Compute group within Basic Service and apply new settings to its computes as necessary
func (b BService) GroupUpdate(ctx context.Context, req GroupUpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupUpdate"
res, err := b.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,46 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupUpdateExtNetRequest struct to update External Network settings
type GroupUpdateExtNetRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
// List of Extnets to connect computes
// Required: false
ExtNets []uint64 `url:"extnets,omitempty" json:"extnets,omitempty"`
}
// GroupUpdateExtNet updates External Network settings for the group according to the new list
func (b BService) GroupUpdateExtNet(ctx context.Context, req GroupUpdateExtNetRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupUpdateExtnet"
res, err := b.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,46 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// GroupUpdateVINSRequest struct to update VINS settings
type GroupUpdateVINSRequest struct {
// ID of the Basic Service of Compute Group
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// ID of the Compute Group
// Required: true
CompGroupID uint64 `url:"compgroupId" json:"compgroupId" validate:"required"`
// List of ViNSes to connect computes
// Required: false
VINSes []uint64 `url:"vinses,omitempty" json:"vinses,omitempty"`
}
// GroupUpdateVINS update ViNS settings for the group according to the new list
func (b BService) GroupUpdateVINS(ctx context.Context, req GroupUpdateVINSRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/groupUpdateVins"
res, err := b.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,87 @@
package bservice
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// ListRequest struct to get list of BasicService instances
type ListRequest struct {
// Find by ID
// Required: false
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
// Find by name
// Required: false
Name string `url:"name,omitempty" json:"name,omitempty"`
// ID of the account to query for BasicService instances
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// Find by resource group name
// Required: false
RGName string `url:"rgName,omitempty" json:"rgName,omitempty"`
// ID of the resource group to query for BasicService instances
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by tech status
// Required: false
TechStatus string `url:"techStatus,omitempty" json:"techStatus,omitempty"`
// Find by status
// Required: false
Status string `url:"status,omitempty" json:"status,omitempty"`
// Find by account name
// Required: false
AccountName string `url:"accountName,omitempty" json:"accountName,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of BasicService instances associated with the specified Resource Group as a ListBasicServices struct
func (b BService) List(ctx context.Context, req ListRequest) (*ListBasicServices, error) {
res, err := b.ListRaw(ctx, req)
if err != nil {
return nil, err
}
list := ListBasicServices{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}
// ListRaw gets list of BasicService instances associated with the specified Resource Group as an array of bytes
func (b BService) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/list"
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}

View File

@@ -0,0 +1,56 @@
package bservice
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// ListDeletedRequest struct to get list of deleted BasicService instances
type ListDeletedRequest struct {
// ID of the account to query for BasicService instances
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
// ID of the resource group to query for BasicService instances
// Required: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Sort by one of supported fields, format +|-(field)
// Required: false
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// ListDeleted gets list of deleted BasicService instances associated with the specified Resource Group
func (b BService) ListDeleted(ctx context.Context, req ListDeletedRequest) (*ListBasicServices, error) {
if err := validators.ValidateRequest(req); err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/listDeleted"
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
list := ListBasicServices{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}

View File

@@ -0,0 +1,401 @@
package bservice
// Detailed info about BasicService
type RecordBasicService struct {
// Account ID
AccountID uint64 `json:"accountId"`
// Account name
AccountName string `json:"accountName"`
// Base domain
BaseDomain string `json:"baseDomain"`
// List Computes
Computes ListComputes `json:"computes"`
// Number of cores
CPUTotal uint64 `json:"cpuTotal"`
// Created by
CreatedBy string `json:"createdBy"`
// Created time
CreatedTime uint64 `json:"createdTime"`
// Deleted by
DeletedBy string `json:"deletedBy"`
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
// Amount of disk space used, GB
DiskTotal uint64 `json:"diskTotal"`
// Grid ID
GID uint64 `json:"gid"`
// List of Service Compute Groups
Groups ListGroups `json:"groups"`
// GUID
GUID uint64 `json:"guid"`
// ID
ID uint64 `json:"id"`
// Milestones
Milestones uint64 `json:"milestones"`
// Name
Name string `json:"name"`
// Parent service ID
ParentSrvID uint64 `json:"parentSrvId"`
// Parent service type
ParentSrvType string `json:"parentSrvType"`
// Total amount of RAM, MB
RAMTotal uint64 `json:"ramTotal"`
// Resource group ID
RGID uint64 `json:"rgId"`
// Resource group name
RGName string `json:"rgName"`
// List of snapshots
Snapshots ListSnapshots `json:"snapshots"`
// SSH key for connection
SSHKey string `json:"sshKey"`
// Username for SSH connection
SSHUser string `json:"sshUser"`
// status
Status string `json:"status"`
// TechStatus
TechStatus string `json:"techStatus"`
// Updated by
UpdatedBy string `json:"updatedBy"`
// Updated time
UpdatedTime uint64 `json:"updatedTime"`
// Whether user controlled
UserManaged bool `json:"userManaged"`
}
// List of Groups
type ListGroups []ItemGroup
// Main information about Group
type ItemGroup struct {
// Amount of computes
Computes uint64 `json:"computes"`
// Consistency
Consistency bool `json:"consistency"`
// Group ID
ID uint64 `json:"id"`
// Group name
Name string `json:"name"`
// Status
Status string `json:"status"`
// TechStatus
TechStatus string `json:"techStatus"`
}
// List of Computes
type ListComputes []ItemCompute
// Main information about Compute
type ItemCompute struct {
// Account ID
AccountID uint64 `json:"accountId"`
// Architecture
Architecture string `json:"arch"`
// Compute group ID
CompGroupID uint64 `json:"compgroupId"`
// Compute group name
CompGroupName string `json:"compgroupName"`
// compute group role
CompGroupRole string `json:"compgroupRole"`
// ID
ID uint64 `json:"id"`
// Name
Name string `json:"name"`
// Resource group ID
RGID uint64 `json:"rgId"`
// StackID
StackID uint64 `json:"stackId"`
// Status
Status string `json:"status"`
// Tech status
TechStatus string `json:"techStatus"`
}
// List of Snapshot
type ListSnapshots []ItemSnapshot
// Main information about Snapshot
type ItemSnapshot struct {
// GUID
GUID string `json:"guid"`
// Label
Label string `json:"label"`
// Timestamp
Timestamp uint64 `json:"timestamp"`
// Valid or not
Valid bool `json:"valid"`
}
// List of BasicServices
type ListBasicServices struct {
Data []ItemBasicService `json:"data"`
EntryCount uint64 `json:"entryCount"`
}
// Main information about BasicService
type ItemBasicService struct {
// Account ID
AccountID uint64 `json:"accountId"`
// Account name
AccountName string `json:"accountName"`
// Base domain
BaseDomain string `json:"baseDomain"`
// Created by
CreatedBy string `json:"createdBy"`
// Created time
CreatedTime uint64 `json:"createdTime"`
// Deleted by
DeletedBy string `json:"deletedBy"`
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
// Grid ID
GID uint64 `json:"gid"`
// List of group IDs
Groups []uint64 `json:"groups"`
// GUID
GUID uint64 `json:"guid"`
// ID
ID uint64 `json:"id"`
// Name
Name string `json:"name"`
// Milestones
Milestones uint64 `json:"milestones"`
// Parent service ID
ParentSrvID uint64 `json:"parentSrvId"`
// Parent service type
ParentSrvType string `json:"parentSrvType"`
// Resource group ID
RGID uint64 `json:"rgId"`
// Resource group name
RGName string `json:"rgName"`
// List of snapshots
Snapshots ListSnapshots `json:"snapshots"`
// SSH key for connection
SSHKey string `json:"sshKey"`
// SSH user
SSHUser string `json:"sshUser"`
// Status
Status string `json:"status"`
// TechStatus
TechStatus string `json:"techStatus"`
// Updated by
UpdatedBy string `json:"updatedBy"`
// Updated time
UpdatedTime uint64 `json:"updatedTime"`
// User Managed or not
UserManaged bool `json:"userManaged"`
}
// List of Snapshots
type ListInfoSnapshots struct {
// Data
Data ListSnapshots `json:"data"`
// EntryCount
EntryCount uint64 `json:"entryCount"`
}
// Main information about Group
type RecordGroup struct {
// Account ID
AccountID uint64 `json:"accountId"`
// Account Name
AccountName string `json:"accountName"`
// List of Computes
Computes ListGroupComputes `json:"computes"`
// Consistency or not
Consistency bool `json:"consistency"`
// Number of CPU
CPU uint64 `json:"cpu"`
// Created by
CreatedBy string `json:"createdBy"`
// Created time
CreatedTime uint64 `json:"createdTime"`
// Deleted by
DeletedBy string `json:"deletedBy"`
// Deleted time
DeletedTime uint64 `json:"deletedTime"`
// Amount of disk
Disk uint64 `json:"disk"`
// Driver
Driver string `json:"driver"`
// list of External Network IDs
ExtNets []uint64 `json:"extnets"`
// Grid ID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// ID
ID uint64 `json:"id"`
// Image ID
ImageID uint64 `json:"imageId"`
// Milestones
Milestones uint64 `json:"milestones"`
// Name
Name string `json:"name"`
// List of Parent IDs
Parents []uint64 `json:"parents"`
// Pool name
PoolName string `json:"poolName"`
// Number of RAM, MB
RAM uint64 `json:"ram"`
// Resource group ID
RGID uint64 `json:"rgId"`
// Resource group name
RGName string `json:"rgName"`
// Role
Role string `json:"role"`
// SEPID
SEPID uint64 `json:"sepId"`
// Sequence number
SeqNo uint64 `json:"seqNo"`
// Service ID
ServiceID uint64 `json:"serviceId"`
// Status
Status string `json:"status"`
// TechStatus
TechStatus string `json:"techStatus"`
// Timeout Start
TimeoutStart uint64 `json:"timeoutStart"`
// Updated by
UpdatedBy string `json:"updatedBy"`
// Updated time
UpdatedTime uint64 `json:"updatedTime"`
// List of VINS IDs
VINSes []uint64 `json:"vinses"`
}
// List of Group Computes
type ListGroupComputes []ItemGroupCompute
// Main information about Group Compute
type ItemGroupCompute struct {
// ID
ID uint64 `json:"id"`
// IP Addresses
IPAddresses []string `json:"ipAddresses"`
// Name
Name string `json:"name"`
// List of information about OS Users
OSUsers ListOSUsers `json:"osUsers"`
//Chipset
Chipset string `json:"chipset"`
}
// List of information about OS Users
type ListOSUsers []ItemOSUser
// Main information about OS User
type ItemOSUser struct {
// Login
Login string `json:"login"`
// Password
Password string `json:"password"`
}

View File

@@ -0,0 +1,38 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// RestoreRequest struct to restore BasicService instance
type RestoreRequest struct {
// ID of the BasicService to be restored
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
}
// Restore restores BasicService instance
func (b BService) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/restore"
res, err := b.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 bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SnapshotCreateRequest struct to create snapshot
type SnapshotCreateRequest struct {
// ID of the Basic Service
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// Label of the snapshot
// Required: true
Label string `url:"label" json:"label" validate:"required"`
}
// SnapshotCreate create snapshot of the Basic Service
func (b BService) SnapshotCreate(ctx context.Context, req SnapshotCreateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/snapshotCreate"
res, err := b.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 bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SnapshotDeleteRequest struct to delete snapshot
type SnapshotDeleteRequest struct {
// ID of the Basic Service
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// Label of the snapshot
// Required: true
Label string `url:"label" json:"label" validate:"required"`
}
// SnapshotDelete delete snapshot of the Basic Service
func (b BService) SnapshotDelete(ctx context.Context, req SnapshotDeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/snapshotDelete"
res, err := b.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,40 @@
package bservice
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SnapshotListRequest struct to get list of existing snapshots
type SnapshotListRequest struct {
// ID of the Basic Service
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
}
// SnapshotList gets list existing snapshots of the Basic Service
func (b BService) SnapshotList(ctx context.Context, req SnapshotListRequest) (*ListInfoSnapshots, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/snapshotList"
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
list := ListInfoSnapshots{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return &list, nil
}

View File

@@ -0,0 +1,42 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// SnapshotRollbackRequest struct to rollback snapshot
type SnapshotRollbackRequest struct {
// ID of the Basic Service
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
// Label of the snapshot
// Required: true
Label string `url:"label" json:"label" validate:"required"`
}
// SnapshotRollback rollback snapshot of the Basic Service
func (b BService) SnapshotRollback(ctx context.Context, req SnapshotRollbackRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/snapshotRollback"
res, err := b.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,60 @@
package bservice
import "sort"
// SortByCreatedTime sorts ListBasicServices by the CreatedTime field in ascending order.
//
// If inverse param is set to true, the order is reversed.
func (lbs ListBasicServices) SortByCreatedTime(inverse bool) ListBasicServices {
if lbs.EntryCount < 2 {
return lbs
}
sort.Slice(lbs.Data, func(i, j int) bool {
if inverse {
return lbs.Data[i].CreatedTime > lbs.Data[j].CreatedTime
}
return lbs.Data[i].CreatedTime < lbs.Data[j].CreatedTime
})
return lbs
}
// SortByUpdatedTime sorts ListBasicServices by the UpdatedTime field in ascending order.
//
// If inverse param is set to true, the order is reversed.
func (lbs ListBasicServices) SortByUpdatedTime(inverse bool) ListBasicServices {
if lbs.EntryCount < 2 {
return lbs
}
sort.Slice(lbs.Data, func(i, j int) bool {
if inverse {
return lbs.Data[i].UpdatedTime > lbs.Data[j].UpdatedTime
}
return lbs.Data[i].UpdatedTime < lbs.Data[j].UpdatedTime
})
return lbs
}
// SortByDeletedTime sorts ListBasicServices by the DeletedTime field in ascending order.
//
// If inverse param is set to true, the order is reversed.
func (lbs ListBasicServices) SortByDeletedTime(inverse bool) ListBasicServices {
if lbs.EntryCount < 2 {
return lbs
}
sort.Slice(lbs.Data, func(i, j int) bool {
if inverse {
return lbs.Data[i].DeletedTime > lbs.Data[j].DeletedTime
}
return lbs.Data[i].DeletedTime < lbs.Data[j].DeletedTime
})
return lbs
}

View File

@@ -0,0 +1,40 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// StartRequest struct to start service
type StartRequest struct {
// ID of the service to start
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
}
// Start starts service.
// Starting a service technically means starting computes from all
// service groups according to group relations
func (b BService) Start(ctx context.Context, req StartRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/start"
res, err := b.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,40 @@
package bservice
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
)
// StopRequest struct to stop service
type StopRequest struct {
// ID of the service to stop
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
}
// Stop stops service.
// Stopping a service technically means stopping computes from
// all service groups
func (b BService) Stop(ctx context.Context, req StopRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/bservice/stop"
res, err := b.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

@@ -1,7 +1,7 @@
// List of method groups for the admin
package cloudbroker
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/interfaces"
import "repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/interfaces"
// Structure for creating request to CloudBroker groups
type CloudBroker struct {

View File

@@ -1,7 +1,7 @@
package cloudbroker
import (
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v10/pkg/cloudbroker/compute"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/pkg/cloudbroker/compute"
)
// Accessing the Compute method group

Some files were not shown because too many files have changed in this diff Show More