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

@@ -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"
)
// ComputeCISetRequest struct to set compute CI

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"
)
// ComputeCIUnsetRequest struct to unset compute CI

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"
)
// CreateCDROMImageRequest struct to create CD-ROM image
@@ -18,10 +18,6 @@ type CreateCDROMImageRequest struct {
// Required: true
URL string `url:"url" json:"url" validate:"required,url"`
// Grid (platform) ID where this CD-ROM image should be create in
// Required: true
GID uint64 `url:"gid" json:"gid" validate:"required"`
// Account ID to make the image exclusive
// Required: false
AccountID uint64 `url:"accountId,omitempty" json:"accountId,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"
)
// CreateRequest struct to create image
@@ -18,10 +18,6 @@ type CreateRequest struct {
// Required: true
URL string `url:"url" json:"url" validate:"required,url"`
// Grid (platform) ID where this template should be create in
// Required: true
GID uint64 `url:"gid" json:"gid" validate:"required"`
// Boot type of image
// Should be one of:
// - bios

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"
)
// CreateVirtualRequest struct to create virtual image

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"
)
// DeleteRequest struct to delete image

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"
)
// DeleteCDROMImageRequest struct to delete CD-ROM image

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"
)
// DeleteImagesRequest struct to delete images

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 image

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"
)
// EditRequest struct to edit image

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 image

View File

@@ -29,7 +29,7 @@ var images = ListImages{
Name: "u16",
Password: "",
Pool: "vmstor",
PresentTo: []uint64{},
PresentTo: map[string]uint64{},
ProviderName: "",
PurgeAttempts: 0,
ReferenceID: "sample_reference_id_u16",
@@ -72,7 +72,7 @@ var images = ListImages{
Name: "alpine-virt-3.17",
Password: "",
Pool: "vmstor",
PresentTo: []uint64{},
PresentTo: map[string]uint64{},
ProviderName: "",
PurgeAttempts: 0,
ReferenceID: "sample_reference_id_alpine",
@@ -115,7 +115,7 @@ var images = ListImages{
Name: "test",
Password: "",
Pool: "vmstor",
PresentTo: []uint64{},
PresentTo: map[string]uint64{},
ProviderName: "",
PurgeAttempts: 0,
ReferenceID: "sample_reference_id_test",

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 image details

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"
)
// GrantAccessRequest struct to share image with accounts
@@ -16,7 +16,7 @@ type GrantAccessRequest struct {
// ID of the accounts for share image
// Required: true
AccountIDs []uint64 `url:"accounts" json:"accounts" validate:"required"`
AccountIDs []int64 `url:"accounts" json:"accounts" validate:"required"`
}
// GrantAccess shares specified image with specified accounts

View File

@@ -1,7 +1,7 @@
// Lists all the images. A image is a template which can be used to deploy machines
package image
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 image
type Image 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"
)
// LinkRequest struct to link virtual image to another image

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 available images

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

View File

@@ -75,7 +75,7 @@ type RecordImage struct {
Pool string `json:"pool"`
// Present to
PresentTo []uint64 `json:"presentTo"`
PresentTo map[string]uint64 `json:"presentTo"`
// Provider name
ProviderName string `json:"provider_name"`
@@ -201,7 +201,7 @@ type ItemImage struct {
Pool string `json:"pool"`
// Present to
PresentTo []uint64 `json:"presentTo"`
PresentTo map[string]uint64 `json:"presentTo"`
// Provider name
ProviderName string `json:"provider_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"
)
// RenameRequest struct to rename image

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"
)
// RevokeAccessRequest struct to unshare image with accounts
@@ -16,7 +16,7 @@ type RevokeAccessRequest struct {
// ID of the accounts for unshare image
// Required: true
AccountIDs []uint64 `url:"accounts" json:"accounts" validate:"required"`
AccountIDs []int64 `url:"accounts" json:"accounts" validate:"required"`
}
// RevokeAccess unshares specified image with specified accounts

View File

@@ -3,7 +3,7 @@ package image
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"
)
// ShareRequest struct to share image

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"
)
// SyncCreateRequest struct to sync create image

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"
)
// UpdateNodesRequest struct to update nodes

View File

@@ -1,39 +0,0 @@
package image
import (
"context"
"encoding/json"
"fmt"
"net/http"
"os"
)
// UploadImageFileResponse struct to enable image
type UploadImageFileResponse struct {
// ImageFileUri
ImageFileUri string `json:"image_file_uri"`
}
// UploadImageFile uploads file image to platform
func (i Image) UploadImageFile(ctx context.Context, filePath string) (string, error) {
file, err := os.ReadFile(filePath)
if err != nil {
return "", fmt.Errorf("can not read file %v", err)
}
url := "/cloudbroker/image/uploadImageFile"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, file)
if err != nil {
return "", err
}
result := UploadImageFileResponse{}
err = json.Unmarshal(res, &result)
if err != nil {
return "", err
}
return result.ImageFileUri, nil
}