v1.16.4
This commit is contained in:
dayterr
2026-09-18 16:49:20 +03:00
parent b39021820a
commit bf932e5ef9
161 changed files with 2375 additions and 227 deletions

View File

@@ -0,0 +1,46 @@
package vmfolder
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about a vm folder
type GetRequest struct {
// ID of a folder
// Required: true
FolderID uint64 `url:"folder_id" json:"folder_id" validate:"required"`
}
// Get gets current configuration of the vm folder as a RecordVMFolder struct
func (v VMFolder) Get(ctx context.Context, req GetRequest) (*RecordVMFolder, error) {
res, err := v.GetRaw(ctx, req)
if err != nil {
return nil, err
}
info := RecordVMFolder{}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}
// GetRaw gets current configuration of the vm folder as an array of bytes
func (v VMFolder) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudapi/vmfolder/get"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}