v16.1.0
v16.1.0
This commit is contained in:
40
pkg/cloudapi/compute/add_acl_access.go
Normal file
40
pkg/cloudapi/compute/add_acl_access.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// AddACLAccessRequest adds ACL access to a vm
|
||||
type AddACLAccessRequest struct {
|
||||
ID uint64 `url:"id" json:"id" validate:"required"`
|
||||
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
|
||||
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
|
||||
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
|
||||
}
|
||||
|
||||
// AddACLAccess adds ACL access to a vm.
|
||||
func (c Compute) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/add_acl_access"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
|
||||
39
pkg/cloudapi/compute/del_acl_access.go
Normal file
39
pkg/cloudapi/compute/del_acl_access.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// DeleteACLAccessRequest deletes ACL access from a vm
|
||||
type DeleteACLAccessRequest struct {
|
||||
ID uint64 `url:"id" json:"id" validate:"required"`
|
||||
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
|
||||
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteACLAccess deletes ACL access from a vm.
|
||||
func (c Compute) DeleteACLAccess(ctx context.Context, req DeleteACLAccessRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/del_acl_access"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
44
pkg/cloudapi/compute/get_acl_access.go
Normal file
44
pkg/cloudapi/compute/get_acl_access.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// GetACLAccessRequest struct to get detailed information about ACL account in a vm
|
||||
type GetACLAccessRequest struct {
|
||||
ID uint64 `url:"id" json:"id" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets current configuration of the ACL access in a vm as a RecordRGACLAccess struct
|
||||
func (c Compute) GetACLAccess(ctx context.Context, req GetACLAccessRequest) (*RecordComputeACLAccess, error) {
|
||||
res, err := c.GetACLAccessRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordComputeACLAccess{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetACLAccessRaw gets current configuration of the ACL access in a vm as an array of bytes
|
||||
func (c Compute) GetACLAccessRaw(ctx context.Context, req GetACLAccessRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/get_acl_access"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
@@ -446,6 +446,9 @@ type RecordCompute struct {
|
||||
// Manager type
|
||||
ManagerType string `json:"managerType"`
|
||||
|
||||
// Memory balloon mode
|
||||
MemoryBalloonMode string `json:"memory_balloon_mode"`
|
||||
|
||||
// Migration job
|
||||
MigrationJob uint64 `json:"migrationjob"`
|
||||
|
||||
@@ -574,6 +577,58 @@ type RecordCompute struct {
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
}
|
||||
|
||||
// Detailed information about ACL Access in a compute
|
||||
type RecordComputeACLAccess struct {
|
||||
// Data
|
||||
Data DataACL `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// Data ACL
|
||||
type DataACL struct {
|
||||
// RG ACL list
|
||||
RGACLList []RGACL `json:"rgACL"`
|
||||
|
||||
// Account ACL list
|
||||
AccountACLList []AccountACL `json:"accountACL"`
|
||||
|
||||
// Compute ACL list
|
||||
ComputeACLList []ComputeACL `json:"computeACL"`
|
||||
}
|
||||
|
||||
// RG ACL info
|
||||
type RGACL struct {
|
||||
Right string `json:"right"`
|
||||
GUID string `json:"guid"`
|
||||
UserGroupID string `json:"userGroupId"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Explicit bool `json:"explicit"`
|
||||
}
|
||||
|
||||
// Account ACL info
|
||||
type AccountACL struct {
|
||||
Right string `json:"right"`
|
||||
GUID string `json:"guid"`
|
||||
UserGroupID string `json:"userGroupId"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Explicit bool `json:"explicit"`
|
||||
}
|
||||
|
||||
// Compute ACL info
|
||||
|
||||
type ComputeACL struct {
|
||||
Right string `json:"right"`
|
||||
GUID string `json:"guid"`
|
||||
UserGroupID string `json:"userGroupId"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
Explicit bool `json:"explicit"`
|
||||
}
|
||||
|
||||
type SnapRecordCompute struct {
|
||||
// Access Control List
|
||||
ACL ListACL `json:"acl"`
|
||||
@@ -1396,6 +1451,9 @@ type ItemCompute struct {
|
||||
// Manager type
|
||||
ManagerType string `json:"managerType"`
|
||||
|
||||
// Memory balloon mode
|
||||
MemoryBalloonMode string `json:"memory_balloon_mode"`
|
||||
|
||||
// Migration job
|
||||
MigrationJob uint64 `json:"migrationjob"`
|
||||
|
||||
@@ -1591,6 +1649,9 @@ type ItemVGPU struct {
|
||||
// Profile Reference
|
||||
ProfileReference string `json:"profile_reference"`
|
||||
|
||||
// Profile Name
|
||||
ProfileName string `json:"profile_name"`
|
||||
|
||||
// Split Mode
|
||||
SplitMode string `json:"split_mode"`
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
@@ -95,7 +96,7 @@ type NetAttachRequest struct {
|
||||
type wrapperNetAttachRequest struct {
|
||||
NetAttachRequest
|
||||
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
AsyncMode bool `url:"asyncMode" json:"asyncMode"`
|
||||
}
|
||||
|
||||
// NetAttach attaches network to compute and gets info about network
|
||||
@@ -112,7 +113,7 @@ func (c Compute) NetAttach(ctx context.Context, req NetAttachRequest) (*RecordNe
|
||||
|
||||
url := "/cloudapi/compute/netAttach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -141,7 +142,7 @@ func (c Compute) NetAttachAsync(ctx context.Context, req NetAttachRequest) (stri
|
||||
|
||||
url := "/cloudapi/compute/netAttach"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -79,6 +79,11 @@ type UpdateRequest struct {
|
||||
// Required: false
|
||||
// Default: reset
|
||||
WatchdogAction string `url:"watchdog_action,omitempty" json:"watchdog_action,omitempty" validate:"omitempty,watchdogAction"`
|
||||
|
||||
// Memory balloon mode. One of ["auto","legacy","none"]
|
||||
// Required: false
|
||||
// Default: "auto"
|
||||
MemoryBalloonMode string `url:"memory_balloon_mode,omitempty" json:"memory_balloon_mode,omitempty" validate:"omitempty,memoryBalloonMode"`
|
||||
}
|
||||
|
||||
// Update updates some properties of the compute
|
||||
|
||||
40
pkg/cloudapi/compute/update_acl_access.go
Normal file
40
pkg/cloudapi/compute/update_acl_access.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// UpdateACLAccessRequest updates ACL access in a vm
|
||||
type UpdateACLAccessRequest struct {
|
||||
ID uint64 `url:"id" json:"id" validate:"required"`
|
||||
AccessType string `url:"accesstype" json:"accesstype" validate:"required"`
|
||||
Usernames []string `url:"usernames,omitempty" json:"usernames,omitempty"`
|
||||
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateACLAccess updates ACL access in a vm.
|
||||
func (c Compute) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/update_acl_access"
|
||||
|
||||
res, err := c.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -28,6 +28,8 @@ type UserGrantRequest struct {
|
||||
}
|
||||
|
||||
// UserGrant grants user access to the compute
|
||||
//
|
||||
// Deprecated: will be removed in SDK v1.17
|
||||
func (c Compute) UserGrant(ctx context.Context, req UserGrantRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
|
||||
@@ -16,6 +16,8 @@ type UserListRequest struct {
|
||||
}
|
||||
|
||||
// UserList gets users list for compute
|
||||
//
|
||||
// Deprecated: will be removed in SDK v1.17
|
||||
func (c Compute) UserList(ctx context.Context, req UserListRequest) (*ListUsers, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
|
||||
@@ -20,6 +20,8 @@ type UserRevokeRequest struct {
|
||||
}
|
||||
|
||||
// UserRevoke revokes user access to the compute
|
||||
//
|
||||
// Deprecated: will be removed in SDK v1.17
|
||||
func (c Compute) UserRevoke(ctx context.Context, req UserRevokeRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
|
||||
@@ -28,6 +28,8 @@ type UserUpdateRequest struct {
|
||||
}
|
||||
|
||||
// UserUpdate updates user access to the compute
|
||||
//
|
||||
// Deprecated: will be removed in SDK v1.17
|
||||
func (c Compute) UserUpdate(ctx context.Context, req UserUpdateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user