v16.10.0
v16.10.0
This commit is contained in:
1 parent
bc8c2b40e9
commit
00994516ba
52 files changed
+2287
-98
No files matched your search
@@ -17,6 +17,12 @@ type AddACLAccessRequest struct {
|
||||
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperAddACLAccessRequest struct {
|
||||
AddACLAccessRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// AddACLAccess adds ACL access to an account.
|
||||
func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,7 +32,12 @@ func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (boo
|
||||
|
||||
url := "/cloudbroker/account/add_acl_access"
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
reqWrapped := wrapperAddACLAccessRequest{
|
||||
AddACLAccessRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -38,3 +49,25 @@ func (a Account) AddACLAccess(ctx context.Context, req AddACLAccessRequest) (boo
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// AddACLAccessAsync adds ACL access to an account in async mode
|
||||
func (a Account) AddACLAccessAsync(ctx context.Context, req AddACLAccessRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/add_acl_access"
|
||||
|
||||
reqWrapped := wrapperAddACLAccessRequest{
|
||||
AddACLAccessRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -23,6 +23,12 @@ type AddStoragePolicyRequest struct {
|
||||
Limit int `url:"limit,omitempty" json:"limit,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperAddStoragePolicyRequest struct {
|
||||
AddStoragePolicyRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// AddStoragePolicy add storage policy to the account.
|
||||
func (a Account) AddStoragePolicy(ctx context.Context, req AddStoragePolicyRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -32,7 +38,12 @@ func (a Account) AddStoragePolicy(ctx context.Context, req AddStoragePolicyReque
|
||||
|
||||
url := "/cloudbroker/account/add_storage_policy"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperAddStoragePolicyRequest{
|
||||
AddStoragePolicyRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -44,3 +55,25 @@ func (a Account) AddStoragePolicy(ctx context.Context, req AddStoragePolicyReque
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// AddStoragePolicyAsync add storage policy to the account in async mode
|
||||
func (a Account) AddStoragePolicyAsync(ctx context.Context, req AddStoragePolicyRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/add_storage_policy"
|
||||
|
||||
reqWrapped := wrapperAddStoragePolicyRequest{
|
||||
AddStoragePolicyRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -26,6 +26,12 @@ type AddUserRequest struct {
|
||||
AccessType string `url:"accesstype" json:"accesstype" validate:"accessType"`
|
||||
}
|
||||
|
||||
type wrapperAddUserRequest struct {
|
||||
AddUserRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// AddUser gives a user access rights.
|
||||
//
|
||||
// Deprecated: will be removed in SDK v17.0
|
||||
@@ -37,7 +43,12 @@ func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error)
|
||||
|
||||
url := "/cloudbroker/account/addUser"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperAddUserRequest{
|
||||
AddUserRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -49,3 +60,27 @@ func (a Account) AddUser(ctx context.Context, req AddUserRequest) (bool, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// AddUserAsync gives a user access rights in async mode
|
||||
//
|
||||
// Deprecated: will be removed in SDK v17.0
|
||||
func (a Account) AddUserAsync(ctx context.Context, req AddUserRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/addUser"
|
||||
|
||||
reqWrapped := wrapperAddUserRequest{
|
||||
AddUserRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -19,7 +19,13 @@ type AddZoneRequest struct {
|
||||
ZoneIDs []uint64 `url:"zoneIds" json:"zoneIds" validate:"required"`
|
||||
}
|
||||
|
||||
// AddUser gives a user access rights.
|
||||
type wrapperAddZoneRequest struct {
|
||||
AddZoneRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// AddZone adds zones to account
|
||||
func (a Account) AddZone(ctx context.Context, req AddZoneRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
@@ -28,7 +34,12 @@ func (a Account) AddZone(ctx context.Context, req AddZoneRequest) (bool, error)
|
||||
|
||||
url := "/cloudbroker/account/addZone"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperAddZoneRequest{
|
||||
AddZoneRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (a Account) AddZone(ctx context.Context, req AddZoneRequest) (bool, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// AddZoneAsync adds zones to account in async mode
|
||||
func (a Account) AddZoneAsync(ctx context.Context, req AddZoneRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/addZone"
|
||||
|
||||
reqWrapped := wrapperAddZoneRequest{
|
||||
AddZoneRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -79,6 +79,12 @@ type StoragePolicy struct {
|
||||
Limit int `url:"limit" json:"limit"`
|
||||
}
|
||||
|
||||
type wrapperCreateRequest struct {
|
||||
CreateRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// Create creates account
|
||||
// Setting a cloud unit maximum to -1 or empty will not put any restrictions on the resource
|
||||
func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
@@ -89,7 +95,12 @@ func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error)
|
||||
|
||||
url := "/cloudbroker/account/create"
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
reqWrapped := wrapperCreateRequest{
|
||||
CreateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -101,3 +112,25 @@ func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error)
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// CreateAsync creates account in async mode
|
||||
func (a Account) CreateAsync(ctx context.Context, req CreateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/create"
|
||||
|
||||
reqWrapped := wrapperCreateRequest{
|
||||
CreateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -16,6 +16,12 @@ type DelACLAccessRequest struct {
|
||||
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperDelACLAccessRequest struct {
|
||||
DelACLAccessRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// DelACLAccess deletes ACL access from an account.
|
||||
func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -25,7 +31,12 @@ func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (
|
||||
|
||||
url := "/cloudbroker/account/del_acl_access"
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
reqWrapped := wrapperDelACLAccessRequest{
|
||||
DelACLAccessRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -37,3 +48,25 @@ func (a Account) DeleteACLAccess(ctx context.Context, req DelACLAccessRequest) (
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DeleteACLAccessAsync deletes ACL access from an account in async mode
|
||||
func (a Account) DeleteACLAccessAsync(ctx context.Context, req DelACLAccessRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/del_acl_access"
|
||||
|
||||
reqWrapped := wrapperDelACLAccessRequest{
|
||||
DelACLAccessRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -19,6 +19,12 @@ type DelStoragePolicyRequest struct {
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDelStoragePolicyRequest struct {
|
||||
DelStoragePolicyRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// DelStoragePolicy delete storage policy to the account.
|
||||
func (a Account) DelStoragePolicy(ctx context.Context, req DelStoragePolicyRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -28,7 +34,12 @@ func (a Account) DelStoragePolicy(ctx context.Context, req DelStoragePolicyReque
|
||||
|
||||
url := "/cloudbroker/account/del_storage_policy"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperDelStoragePolicyRequest{
|
||||
DelStoragePolicyRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (a Account) DelStoragePolicy(ctx context.Context, req DelStoragePolicyReque
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DelStoragePolicyAsync delete storage policy to the account in async mode
|
||||
func (a Account) DelStoragePolicyAsync(ctx context.Context, req DelStoragePolicyRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/del_storage_policy"
|
||||
|
||||
reqWrapped := wrapperDelStoragePolicyRequest{
|
||||
DelStoragePolicyRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -22,7 +22,13 @@ type DeleteRequest struct {
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// Delete completes delete an account from the system Returns true if account is deleted or was already deleted or never existed
|
||||
type wrapperDeleteRequest struct {
|
||||
DeleteRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// Delete deletes an account from the system
|
||||
func (a Account) Delete(ctx context.Context, req DeleteRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
@@ -31,10 +37,37 @@ func (a Account) Delete(ctx context.Context, req DeleteRequest) (string, error)
|
||||
|
||||
url := "/cloudbroker/account/delete"
|
||||
|
||||
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperDeleteRequest{
|
||||
DeleteRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(result), nil
|
||||
}
|
||||
|
||||
// DeleteAsync deletes an account from the system in async mode
|
||||
func (a Account) DeleteAsync(ctx context.Context, req DeleteRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/delete"
|
||||
|
||||
reqWrapped := wrapperDeleteRequest{
|
||||
DeleteRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
@@ -18,8 +19,43 @@ type DeleteAccountsRequest struct {
|
||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperDeleteAccountsRequest struct {
|
||||
DeleteAccountsRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// DeleteAccounts destroys a group of accounts
|
||||
func (a Account) DeleteAccounts(ctx context.Context, req DeleteAccountsRequest) (string, error) {
|
||||
func (a Account) DeleteAccounts(ctx context.Context, req DeleteAccountsRequest) ([]uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/deleteAccounts"
|
||||
|
||||
reqWrapped := wrapperDeleteAccountsRequest{
|
||||
DeleteAccountsRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := make([]uint64, 0)
|
||||
|
||||
err = json.Unmarshal(res, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DeleteAccountsAsync destroys a group of accounts in async mode
|
||||
func (a Account) DeleteAccountsAsync(ctx context.Context, req DeleteAccountsRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -27,7 +63,12 @@ func (a Account) DeleteAccounts(ctx context.Context, req DeleteAccountsRequest)
|
||||
|
||||
url := "/cloudbroker/account/deleteAccounts"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperDeleteAccountsRequest{
|
||||
DeleteAccountsRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type DeleteUserRequest struct {
|
||||
UserName string `url:"username" json:"username" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperDeleteUserRequest struct {
|
||||
DeleteUserRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// DeleteUser revokes user access from the account
|
||||
//
|
||||
// Deprecated: will be removed in SDK v17.0
|
||||
@@ -30,7 +36,12 @@ func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, e
|
||||
|
||||
url := "/cloudbroker/account/deleteUser"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperDeleteUserRequest{
|
||||
DeleteUserRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -42,3 +53,27 @@ func (a Account) DeleteUser(ctx context.Context, req DeleteUserRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DeleteUserAsync revokes user access from the account in async mode
|
||||
//
|
||||
// Deprecated: will be removed in SDK v17.0
|
||||
func (a Account) DeleteUserAsync(ctx context.Context, req DeleteUserRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/deleteUser"
|
||||
|
||||
reqWrapped := wrapperDeleteUserRequest{
|
||||
DeleteUserRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
@@ -14,8 +15,43 @@ type DisableAccountsRequest struct {
|
||||
AccountIDs []uint64 `url:"accountIds" json:"accountIds" validate:"min=1"`
|
||||
}
|
||||
|
||||
type wrapperDisableAccountsRequest struct {
|
||||
DisableAccountsRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// DisableAccounts disables accounts
|
||||
func (a Account) DisableAccounts(ctx context.Context, req DisableAccountsRequest) (string, error) {
|
||||
func (a Account) DisableAccounts(ctx context.Context, req DisableAccountsRequest) ([]uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/disableAccounts"
|
||||
|
||||
reqWrapped := wrapperDisableAccountsRequest{
|
||||
DisableAccountsRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := make([]uint64, 0)
|
||||
|
||||
err = json.Unmarshal(res, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// DisableAccountsAsync disables accounts in async mode
|
||||
func (a Account) DisableAccountsAsync(ctx context.Context, req DisableAccountsRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -23,7 +59,12 @@ func (a Account) DisableAccounts(ctx context.Context, req DisableAccountsRequest
|
||||
|
||||
url := "/cloudbroker/account/disableAccounts"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperDisableAccountsRequest{
|
||||
DisableAccountsRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package account
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
@@ -14,8 +15,43 @@ type EnableAccountsRequest struct {
|
||||
AccountIDs []uint64 `url:"accountIds" json:"accountIds" validate:"min=1"`
|
||||
}
|
||||
|
||||
type wrapperEnableAccountsRequest struct {
|
||||
EnableAccountsRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// EnableAccounts enables accounts
|
||||
func (a Account) EnableAccounts(ctx context.Context, req EnableAccountsRequest) (string, error) {
|
||||
func (a Account) EnableAccounts(ctx context.Context, req EnableAccountsRequest) ([]uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/enableAccounts"
|
||||
|
||||
reqWrapped := wrapperEnableAccountsRequest{
|
||||
EnableAccountsRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := make([]uint64, 0)
|
||||
|
||||
err = json.Unmarshal(res, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// EnableAccountsAsync enables accounts in async mode
|
||||
func (a Account) EnableAccountsAsync(ctx context.Context, req EnableAccountsRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -23,7 +59,12 @@ func (a Account) EnableAccounts(ctx context.Context, req EnableAccountsRequest)
|
||||
|
||||
url := "/cloudbroker/account/enableAccounts"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperEnableAccountsRequest{
|
||||
EnableAccountsRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -19,6 +19,12 @@ type GrantAccessTemplatesRequest struct {
|
||||
ImageIDs []uint64 `url:"imageIds" json:"imageIds" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperGrantAccessTemplatesRequest struct {
|
||||
GrantAccessTemplatesRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// GrantAccessTemplates shares specified images with specified account
|
||||
func (a Account) GrantAccessTemplates(ctx context.Context, req GrantAccessTemplatesRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -28,7 +34,12 @@ func (a Account) GrantAccessTemplates(ctx context.Context, req GrantAccessTempla
|
||||
|
||||
url := "/cloudbroker/account/grantAccessTemplates"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperGrantAccessTemplatesRequest{
|
||||
GrantAccessTemplatesRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (a Account) GrantAccessTemplates(ctx context.Context, req GrantAccessTempla
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GrantAccessTemplatesAsync shares specified images with specified account in async mode
|
||||
func (a Account) GrantAccessTemplatesAsync(ctx context.Context, req GrantAccessTemplatesRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/grantAccessTemplates"
|
||||
|
||||
reqWrapped := wrapperGrantAccessTemplatesRequest{
|
||||
GrantAccessTemplatesRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -19,6 +19,12 @@ type RemoveZoneRequest struct {
|
||||
ZoneIDs []uint64 `url:"zoneIds" json:"zoneIds" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperRemoveZoneRequest struct {
|
||||
RemoveZoneRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// RemoveZone removes zones with ids provided from a user.
|
||||
func (a Account) RemoveZone(ctx context.Context, req RemoveZoneRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -28,7 +34,12 @@ func (a Account) RemoveZone(ctx context.Context, req RemoveZoneRequest) (bool, e
|
||||
|
||||
url := "/cloudbroker/account/removeZone"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperRemoveZoneRequest{
|
||||
RemoveZoneRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (a Account) RemoveZone(ctx context.Context, req RemoveZoneRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RemoveZoneAsync removes zones with ids provided from a user in async mode
|
||||
func (a Account) RemoveZoneAsync(ctx context.Context, req RemoveZoneRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/removeZone"
|
||||
|
||||
reqWrapped := wrapperRemoveZoneRequest{
|
||||
RemoveZoneRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -14,6 +14,12 @@ type RestoreRequest struct {
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperRestoreRequest struct {
|
||||
RestoreRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// Restore restores a deleted account
|
||||
func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -23,10 +29,37 @@ func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error
|
||||
|
||||
url := "/cloudbroker/account/restore"
|
||||
|
||||
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperRestoreRequest{
|
||||
RestoreRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(result), nil
|
||||
}
|
||||
|
||||
// RestoreAsync restores a deleted account in async mode
|
||||
func (a Account) RestoreAsync(ctx context.Context, req RestoreRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/restore"
|
||||
|
||||
reqWrapped := wrapperRestoreRequest{
|
||||
RestoreRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -19,6 +19,12 @@ type RevokeAccessTemplatesRequest struct {
|
||||
ImageIDs []uint64 `url:"imageIds" json:"imageIds" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperRevokeAccessTemplatesRequest struct {
|
||||
RevokeAccessTemplatesRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// RevokeAccessTemplates unshares specified images with specified account
|
||||
func (a Account) RevokeAccessTemplates(ctx context.Context, req RevokeAccessTemplatesRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -28,7 +34,12 @@ func (a Account) RevokeAccessTemplates(ctx context.Context, req RevokeAccessTemp
|
||||
|
||||
url := "/cloudbroker/account/revokeAccessTemplates"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperRevokeAccessTemplatesRequest{
|
||||
RevokeAccessTemplatesRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (a Account) RevokeAccessTemplates(ctx context.Context, req RevokeAccessTemp
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// RevokeAccessTemplatesAsync unshares specified images with specified account in async mode
|
||||
func (a Account) RevokeAccessTemplatesAsync(ctx context.Context, req RevokeAccessTemplatesRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/revokeAccessTemplates"
|
||||
|
||||
reqWrapped := wrapperRevokeAccessTemplatesRequest{
|
||||
RevokeAccessTemplatesRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -20,6 +20,12 @@ type SetCPUAllocationParameterRequest struct {
|
||||
StrictLoose string `url:"strict_loose" json:"strict_loose" validate:"required,strict_loose"`
|
||||
}
|
||||
|
||||
type wrapperSetCPUAllocationParameterRequest struct {
|
||||
SetCPUAllocationParameterRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// SetCPUAllocationParameter sets CPU allocation parameter
|
||||
func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAllocationParameterRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -29,7 +35,12 @@ func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAlloca
|
||||
|
||||
url := "/cloudbroker/account/setCpuAllocationParameter"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperSetCPUAllocationParameterRequest{
|
||||
SetCPUAllocationParameterRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -41,3 +52,25 @@ func (a Account) SetCPUAllocationParameter(ctx context.Context, req SetCPUAlloca
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SetCPUAllocationParameterAsync sets CPU allocation parameter in async mode
|
||||
func (a Account) SetCPUAllocationParameterAsync(ctx context.Context, req SetCPUAllocationParameterRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/setCpuAllocationParameter"
|
||||
|
||||
reqWrapped := wrapperSetCPUAllocationParameterRequest{
|
||||
SetCPUAllocationParameterRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -19,6 +19,12 @@ type SetCPUAllocationRatioRequest struct {
|
||||
Ratio uint64 `url:"ratio" json:"ratio" validate:"required"`
|
||||
}
|
||||
|
||||
type wrapperSetCPUAllocationRatioRequest struct {
|
||||
SetCPUAllocationRatioRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// SetCPUAllocationRatio sets CPU allocation ratio
|
||||
func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocationRatioRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -28,7 +34,12 @@ func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocation
|
||||
|
||||
url := "/cloudbroker/account/setCpuAllocationRatio"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperSetCPUAllocationRatioRequest{
|
||||
SetCPUAllocationRatioRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -40,3 +51,25 @@ func (a Account) SetCPUAllocationRatio(ctx context.Context, req SetCPUAllocation
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// SetCPUAllocationRatioAsync sets CPU allocation ratio in async mode
|
||||
func (a Account) SetCPUAllocationRatioAsync(ctx context.Context, req SetCPUAllocationRatioRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/setCpuAllocationRatio"
|
||||
|
||||
reqWrapped := wrapperSetCPUAllocationRatioRequest{
|
||||
SetCPUAllocationRatioRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -70,6 +70,12 @@ type UpdateRequest struct {
|
||||
CpuAllocationParameter string `url:"cpu_allocation_parameter,omitempty" json:"cpu_allocation_parameter,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperUpdateRequest struct {
|
||||
UpdateRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// Update updates an account name and resource types and limits
|
||||
func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -79,7 +85,12 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
|
||||
url := "/cloudbroker/account/update"
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
reqWrapped := wrapperUpdateRequest{
|
||||
UpdateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -91,3 +102,25 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// UpdateAsync updates an account name and resource types and limits in async mode
|
||||
func (a Account) UpdateAsync(ctx context.Context, req UpdateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/update"
|
||||
|
||||
reqWrapped := wrapperUpdateRequest{
|
||||
UpdateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -17,6 +17,12 @@ type UpdateACLAccessRequest struct {
|
||||
APIAccesses []uint64 `url:"apiaccesses,omitempty" json:"apiaccesses,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperUpdateACLAccessRequest struct {
|
||||
UpdateACLAccessRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// UpdateACLAccess updates ACL access in an account.
|
||||
func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -26,7 +32,12 @@ func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest
|
||||
|
||||
url := "/cloudbroker/account/update_acl_access"
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
reqWrapped := wrapperUpdateACLAccessRequest{
|
||||
UpdateACLAccessRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -38,3 +49,25 @@ func (a Account) UpdateACLAccess(ctx context.Context, req UpdateACLAccessRequest
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// UpdateACLAccessAsync updates ACL access in an account in async mode
|
||||
func (a Account) UpdateACLAccessAsync(ctx context.Context, req UpdateACLAccessRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/update_acl_access"
|
||||
|
||||
reqWrapped := wrapperUpdateACLAccessRequest{
|
||||
UpdateACLAccessRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -20,6 +20,12 @@ type UpdateComputeFeaturesRequest struct {
|
||||
ComputeFeatures []string `url:"computeFeatures,omitempty" json:"computeFeatures,omitempty" validate:"omitempty,computeFeatures"`
|
||||
}
|
||||
|
||||
type wrapperUpdateComputeFeaturesRequest struct {
|
||||
UpdateComputeFeaturesRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// UpdateComputeFeatures updates advanced compute features
|
||||
func (a Account) UpdateComputeFeatures(ctx context.Context, req UpdateComputeFeaturesRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -29,7 +35,12 @@ func (a Account) UpdateComputeFeatures(ctx context.Context, req UpdateComputeFea
|
||||
|
||||
url := "/cloudbroker/account/updateComputeFeatures"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperUpdateComputeFeaturesRequest{
|
||||
UpdateComputeFeaturesRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -41,3 +52,25 @@ func (a Account) UpdateComputeFeatures(ctx context.Context, req UpdateComputeFea
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// UpdateComputeFeaturesAsync updates advanced compute features in async mode
|
||||
func (a Account) UpdateComputeFeaturesAsync(ctx context.Context, req UpdateComputeFeaturesRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/updateComputeFeatures"
|
||||
|
||||
reqWrapped := wrapperUpdateComputeFeaturesRequest{
|
||||
UpdateComputeFeaturesRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -26,6 +26,13 @@ type UpdateResourceTypesRequest struct {
|
||||
ResTypes []string `url:"resourceTypes" json:"resourceTypes" validate:"min=1,resTypes"`
|
||||
}
|
||||
|
||||
type wrapperUpdateResourceTypesRequest struct {
|
||||
UpdateResourceTypesRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// UpdateResourceTypes updates resource types in account
|
||||
func (a Account) UpdateResourceTypes(ctx context.Context, req UpdateResourceTypesRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
@@ -34,7 +41,12 @@ func (a Account) UpdateResourceTypes(ctx context.Context, req UpdateResourceType
|
||||
|
||||
url := "/cloudbroker/account/updateResourceTypes"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperUpdateResourceTypesRequest{
|
||||
UpdateResourceTypesRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -46,3 +58,25 @@ func (a Account) UpdateResourceTypes(ctx context.Context, req UpdateResourceType
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// UpdateResourceTypesAsync updates resource types in account in async mode
|
||||
func (a Account) UpdateResourceTypesAsync(ctx context.Context, req UpdateResourceTypesRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/updateResourceTypes"
|
||||
|
||||
reqWrapped := wrapperUpdateResourceTypesRequest{
|
||||
UpdateResourceTypesRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -26,6 +26,12 @@ type UpdateUserRequest struct {
|
||||
AccessType string `url:"accesstype" json:"accesstype" validate:"accessType"`
|
||||
}
|
||||
|
||||
type wrapperUpdateUserRequest struct {
|
||||
UpdateUserRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// UpdateUser updates user access rights
|
||||
//
|
||||
// Deprecated: will be removed in SDK v17.0
|
||||
@@ -37,7 +43,12 @@ func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, e
|
||||
|
||||
url := "/cloudbroker/account/updateUser"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
reqWrapped := wrapperUpdateUserRequest{
|
||||
UpdateUserRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -49,3 +60,27 @@ func (a Account) UpdateUser(ctx context.Context, req UpdateUserRequest) (bool, e
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// UpdateUserAsync updates user access rights in async mode
|
||||
//
|
||||
// Deprecated: will be removed in SDK v17.0
|
||||
func (a Account) UpdateUserAsync(ctx context.Context, req UpdateUserRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/updateUser"
|
||||
|
||||
reqWrapped := wrapperUpdateUserRequest{
|
||||
UpdateUserRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -85,10 +85,6 @@ type StartRequest struct {
|
||||
// - ERROR
|
||||
// - CRITICAL
|
||||
LogLevel string `url:"log_level,omitempty" json:"log_level,omitempty" validate:"omitempty,logLevel"`
|
||||
|
||||
// Daemon log file path (empty for stdout only)
|
||||
// Required: false
|
||||
LogFile string `url:"log_file,omitempty" json:"log_file,omitempty"`
|
||||
}
|
||||
|
||||
// Start starts basis_mpm service on a node
|
||||
|
||||
@@ -85,10 +85,6 @@ type UpdateRequest struct {
|
||||
// - ERROR
|
||||
// - CRITICAL
|
||||
LogLevel string `url:"log_level,omitempty" json:"log_level,omitempty" validate:"omitempty,logLevel"`
|
||||
|
||||
// Daemon log file path (empty for stdout only)
|
||||
// Required: false
|
||||
LogFile string `url:"log_file,omitempty" json:"log_file,omitempty"`
|
||||
}
|
||||
|
||||
func (bm BasisMPM) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
|
||||
@@ -57,6 +57,14 @@ type MigrateV2Request struct {
|
||||
// Destination for a disk
|
||||
// Required: false
|
||||
Storage *Storage `url:"storage,omitempty" json:"storage,omitempty"`
|
||||
|
||||
// Maximum simultaneous disk copies in this migration. Available only for STOPPED VMs in disks mode.
|
||||
// Required: false
|
||||
CopyParallelism uint64 `url:"copy_parallelism,omitempty" json:"copy_parallelism,omitempty"`
|
||||
|
||||
// Optional copy bandwidth limit in bytes/s, per copied disk (104857600 = 100 MiB/s). During VM migration it also limits the RAM transfer.
|
||||
// Required: false
|
||||
BandwidthBytesPerSecond uint64 `url:"bandwidth_bytes_per_second,omitempty" json:"bandwidth_bytes_per_second,omitempty"`
|
||||
}
|
||||
|
||||
// MigrateV2 starts a migration of a compute or a disk
|
||||
|
||||
@@ -34,6 +34,34 @@ type MigrateV2ListRequest struct {
|
||||
// Required: false
|
||||
CleanupRequired interface{} `url:"cleanup_required,omitempty" json:"cleanup_required,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// Account ID at migration start
|
||||
// Required: false
|
||||
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
|
||||
|
||||
// Resource group ID at migration start
|
||||
// Required: false
|
||||
RGID uint64 `url:"rg_id,omitempty" json:"rg_id,omitempty"`
|
||||
|
||||
// Initiating username; case-sensitive
|
||||
// Required: false
|
||||
User string `url:"user,omitempty" json:"user,omitempty"`
|
||||
|
||||
// Match the username exactly or by literal prefix
|
||||
// Required: false
|
||||
UserMatch string `url:"user_match,omitempty" json:"user_match,omitempty" validate:"omitempty,userMatch"`
|
||||
|
||||
// True selects migrations without a user; false selects those with a user. Cannot be combined with user
|
||||
// Required: false
|
||||
UserIsNull interface{} `url:"user_is_null,omitempty" json:"user_is_null,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// True selects migrations without a source node; false selects those with one. Cannot be combined with source_node_id
|
||||
// Required: false
|
||||
SourceNodeIDIsNull interface{} `url:"source_node_id_is_null,omitempty" json:"source_node_id_is_null,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// True selects migrations without a target node; false selects those with one. Cannot be combined with target_node_id
|
||||
// Required: false
|
||||
TargetNodeIDIsNull interface{} `url:"target_node_id_is_null,omitempty" json:"target_node_id_is_null,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
@@ -2345,11 +2345,6 @@ type Memory struct {
|
||||
}
|
||||
|
||||
type ProgressDisks struct {
|
||||
// Scope
|
||||
Scope string `json:"scope"`
|
||||
|
||||
// Target devs
|
||||
TargetDevs []string `json:"target_devs"`
|
||||
|
||||
// Sampled at
|
||||
SampledAt float64 `json:"sampled_at"`
|
||||
@@ -2366,17 +2361,49 @@ type ProgressDisks struct {
|
||||
// Remaining bytes
|
||||
RemainingBytes uint64 `json:"remaining_bytes"`
|
||||
|
||||
// Disks completed
|
||||
DisksCompleted uint64 `json:"disks_completed"`
|
||||
|
||||
// Completed disks
|
||||
CompletedDisks []CompletedDisk `json:"completed_disks"`
|
||||
// True when the server weights independent copy percentages by fixed logical source disk sizes
|
||||
PercentIsEstimated bool `json:"percent_is_estimated"`
|
||||
|
||||
// Disks total
|
||||
DisksTotal uint64 `json:"disks_total"`
|
||||
|
||||
// Current disk
|
||||
CurrentDisk CurrentDisk `json:"current_disk"`
|
||||
// Disks completed
|
||||
DisksCompleted uint64 `json:"disks_completed"`
|
||||
|
||||
// Items
|
||||
Items []ProgressDiskItem `json:"items"`
|
||||
}
|
||||
|
||||
type ProgressDiskItem struct {
|
||||
// Transfer observation time in UTC Unix seconds, or null
|
||||
SampledAt float64 `json:"sampled_at"`
|
||||
|
||||
// Last transfer percentage, not overall workflow completion or remaining time
|
||||
Percent float64 `json:"percent"`
|
||||
|
||||
// Provider-measured throughput, not the configured limit.
|
||||
BytesPerSecond float64 `json:"bytes_per_second"`
|
||||
|
||||
// Provider-reported transferred bytes, never inferred from percent or logical disk size
|
||||
ProcessedBytes uint64 `json:"processed_bytes"`
|
||||
|
||||
// Remaining bytes
|
||||
RemainingBytes uint64 `json:"remaining_bytes"`
|
||||
|
||||
// Kind
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Null for the local stateless system disk, which has no platform disk ID
|
||||
SourceDiskID uint64 `json:"source_disk_id"`
|
||||
|
||||
// Null before allocation or for a stateless system disk
|
||||
TargetDiskID uint64 `json:"target_disk_id"`
|
||||
|
||||
// Guest device such as vda
|
||||
TargetDev string `json:"target_dev"`
|
||||
|
||||
// Last known state of this copy
|
||||
State string `json:"state"`
|
||||
}
|
||||
|
||||
type CompletedDisk struct {
|
||||
@@ -2462,6 +2489,15 @@ type Disk struct {
|
||||
|
||||
// State
|
||||
State string `json:"state"`
|
||||
|
||||
// Offline copy worker node, not the VM placement or its next start node
|
||||
CopyNodeID uint64 `json:"copy_node_id"`
|
||||
|
||||
// Offline physical copy state, separate from the saved disk replacement stage
|
||||
CopyState string `json:"copy_state"`
|
||||
|
||||
// Whether this offline copy writer was confirmed stopped
|
||||
WriterStopped bool `json:"writer_stopped"`
|
||||
}
|
||||
|
||||
type Cleanup struct {
|
||||
@@ -2564,6 +2600,27 @@ type MigrateV2Item struct {
|
||||
|
||||
// Updated at
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
|
||||
// Requested copy limit in bytes/s per disk and for RAM transfer when moving the VM
|
||||
BandwidthBytesPerSecond uint64 `json:"bandwidth_bytes_per_second"`
|
||||
|
||||
// Requested maximum simultaneous offline disk copies in this migration. Null uses all assigned copy nodes, one copy per node. Applies only to offline disk copying.
|
||||
CopyParallelism uint64 `json:"copy_parallelism"`
|
||||
|
||||
// Whether the complete copy plan passed validation and was saved
|
||||
DiskPlanReady bool `json:"disk_plan_ready"`
|
||||
|
||||
// Null until the VM is inspected. Offline applies only to STOPPED VMs in disks mode; the VM remains stopped after copying
|
||||
ExecutionKind string `json:"execution_kind"`
|
||||
|
||||
// Null for online execution. For offline execution, at least one disk replacement decision was saved in disks[].state as COPIED or MIGRATED; model updates may still be unfinished
|
||||
OfflineCommitStarted bool `json:"offline_commit_started"`
|
||||
|
||||
// Requested storage destinations, retained even when preflight validation fails. Null means that no persistent-disk storage migration was requested
|
||||
RequestedStorage RequestedStorage `json:"requested_storage"`
|
||||
|
||||
// Original persistent-disk locations before migration
|
||||
SourceDisks []SourceDisk `json:"source_disks"`
|
||||
}
|
||||
|
||||
type ListMigrateV2 struct {
|
||||
@@ -2637,6 +2694,99 @@ type MigrateV2Record struct {
|
||||
|
||||
// Logs
|
||||
Logs []string `json:"logs"`
|
||||
|
||||
// Requested copy limit in bytes/s per disk and for RAM transfer when moving the VM
|
||||
BandwidthBytesPerSecond uint64 `json:"bandwidth_bytes_per_second"`
|
||||
|
||||
// Requested maximum simultaneous offline disk copies in this migration. Null uses all assigned copy nodes, one copy per node. Applies only to offline disk copying.
|
||||
CopyParallelism uint64 `json:"copy_parallelism"`
|
||||
|
||||
// Whether the complete copy plan passed validation and was saved
|
||||
DiskPlanReady bool `json:"disk_plan_ready"`
|
||||
|
||||
// Null until the VM is inspected. Offline applies only to STOPPED VMs in disks mode; the VM remains stopped after copying
|
||||
ExecutionKind string `json:"execution_kind"`
|
||||
|
||||
// Null for online execution. For offline execution, at least one disk replacement decision was saved in disks[].state as COPIED or MIGRATED; model updates may still be unfinished
|
||||
OfflineCommitStarted bool `json:"offline_commit_started"`
|
||||
|
||||
// Whether this migration still reserves extra CPU/RAM on target_node_id
|
||||
ReservesComputeResources bool `json:"reserves_compute_resources"`
|
||||
|
||||
// Requested storage destinations, retained even when preflight validation fails. Null means that no persistent-disk storage migration was requested
|
||||
RequestedStorage RequestedStorage `json:"requested_storage"`
|
||||
}
|
||||
|
||||
type Targets struct {
|
||||
// Selected source disks for this destination; null selects all persistent disks
|
||||
DiskIDs []uint64 `json:"disk_ids"`
|
||||
|
||||
// SEP ID
|
||||
SEPID uint64 `json:"sep_id"`
|
||||
|
||||
// Storage type learned during validation, or null if the destination was not inspected ye
|
||||
SEPType string `json:"sep_type"`
|
||||
|
||||
// Pool name
|
||||
PoolName string `json:"pool_name"`
|
||||
|
||||
// Requested policy; null preserves each source disk's storage policy
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
}
|
||||
|
||||
// Info about requested storage
|
||||
type RequestedStorage struct {
|
||||
// Whether automatic source-disk cleanup was requested after successful migration
|
||||
AutoCleanup bool `json:"auto_cleanup"`
|
||||
|
||||
// Targets
|
||||
Targets []Targets `json:"targets"`
|
||||
}
|
||||
|
||||
// Info about source disks
|
||||
type SourceDisk struct {
|
||||
// Disk ID
|
||||
DiskID uint64 `json:"disk_id"`
|
||||
|
||||
// SEP ID
|
||||
SEPID uint64 `json:"sep_id"`
|
||||
|
||||
// SEP type
|
||||
SEPType string `json:"sep_type"`
|
||||
|
||||
// Pool name
|
||||
PoolName string `json:"pool_name"`
|
||||
|
||||
// Requested policy; null preserves each source disk's storage policy
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
}
|
||||
|
||||
// Info about saved VM resource parameters for target placement
|
||||
type TargetShadowCompute struct {
|
||||
|
||||
// Compute ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Target node selected for the VM
|
||||
NodeID uint64 `json:"node_id"`
|
||||
|
||||
// Number of vCPUs
|
||||
CPUs uint64 `json:"cpus"`
|
||||
|
||||
// VM memory in MiB
|
||||
RAM uint64 `json:"ram"`
|
||||
|
||||
// Whether CPU pinning was requested
|
||||
CPUPin bool `json:"cpupin"`
|
||||
|
||||
// Saved NUMA affinity policy
|
||||
NumaAffinity string `json:"numaAffinity"`
|
||||
|
||||
// Selected target NUMA node
|
||||
NumaNodeID int64 `json:"numaNodeId"`
|
||||
|
||||
// Target host CPU IDs selected for pinning
|
||||
ReservedNodeCPUs []uint64 `json:"reservedNodeCpus"`
|
||||
}
|
||||
|
||||
// Migrate V2 resolve record
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateV2Target describes a target storage for a group of disks
|
||||
type MigrateV2Target struct {
|
||||
// IDs of detached disks to migrate
|
||||
// Required: true
|
||||
DiskIDs []uint64 `url:"disk_ids" json:"disk_ids" validate:"required,min=1,max=100,unique,dive,required"`
|
||||
|
||||
// SEP ID
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
|
||||
// Name of a pool
|
||||
// Required: true
|
||||
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
|
||||
|
||||
// Storage policy ID
|
||||
// Required: false
|
||||
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
||||
}
|
||||
|
||||
// MigrateV2Storage describes a destination for disks
|
||||
type MigrateV2Storage struct {
|
||||
// Targets for migration
|
||||
// Required: true
|
||||
Targets []MigrateV2Target `url:"targets" json:"targets" validate:"required,min=1,dive"`
|
||||
|
||||
// Whether a separate source-disk cleanup job should be started after full success
|
||||
// Default: true
|
||||
// Required: false
|
||||
AutoCleanup interface{} `url:"auto_cleanup,omitempty" json:"auto_cleanup,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
// MigrateV2Request struct to start an offline migration of a group of detached disks
|
||||
type MigrateV2Request struct {
|
||||
// Bandwidth limit in bytes per second
|
||||
// Required: false
|
||||
BandwidthBytesPerSecond uint64 `url:"bandwidth_bytes_per_second,omitempty" json:"bandwidth_bytes_per_second,omitempty"`
|
||||
|
||||
// Number of simultaneous copies
|
||||
// Required: false
|
||||
CopyParallelism uint64 `url:"copy_parallelism,omitempty" json:"copy_parallelism,omitempty"`
|
||||
|
||||
// Destination for disks
|
||||
// Required: true
|
||||
Storage MigrateV2Storage `url:"storage" json:"storage"`
|
||||
}
|
||||
|
||||
// MigrateV2 starts an offline migration of a group of detached disks and returns workflow job ID
|
||||
func (d Disks) MigrateV2(ctx context.Context, req MigrateV2Request) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/migrate_v2"
|
||||
|
||||
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var resp string
|
||||
|
||||
err = json.Unmarshal(res, &resp)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateV2AbortRequest struct to abort disks migrations
|
||||
type MigrateV2AbortRequest struct {
|
||||
// Migration workflow job IDs
|
||||
// Required: true
|
||||
WorkflowJobIDs []string `url:"workflow_job_ids" json:"workflow_job_ids" validate:"required,min=1,max=100,unique,dive,required"`
|
||||
}
|
||||
|
||||
// MigrateV2Abort aborts disks migrations
|
||||
func (d Disks) MigrateV2Abort(ctx context.Context, req MigrateV2AbortRequest) (*MigrateV2AbortRecord, error) {
|
||||
res, err := d.MigrateV2AbortRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := MigrateV2AbortRecord{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// MigrateV2AbortRaw aborts disks migrations and returns an array of bytes
|
||||
func (d Disks) MigrateV2AbortRaw(ctx context.Context, req MigrateV2AbortRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/migrate_v2_abort"
|
||||
|
||||
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
return res, err
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateV2CleanupRequest struct to clean up source disks after a disks migration
|
||||
type MigrateV2CleanupRequest struct {
|
||||
// Migration workflow job ID
|
||||
// Required: true
|
||||
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
|
||||
}
|
||||
|
||||
// MigrateV2Cleanup cleans up source disks after a disks migration and returns cleanup job ID
|
||||
func (d Disks) MigrateV2Cleanup(ctx context.Context, req MigrateV2CleanupRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/migrate_v2_cleanup"
|
||||
|
||||
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
var resp string
|
||||
|
||||
err = json.Unmarshal(res, &resp)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateV2GetRequest struct to get information about a disks migration
|
||||
type MigrateV2GetRequest struct {
|
||||
// Migration workflow job ID
|
||||
// Required: true
|
||||
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
|
||||
}
|
||||
|
||||
// MigrateV2Get gets information about a disks migration as a MigrateV2Record struct
|
||||
func (d Disks) MigrateV2Get(ctx context.Context, req MigrateV2GetRequest) (*MigrateV2Record, error) {
|
||||
res, err := d.MigrateV2GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := MigrateV2Record{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// MigrateV2GetRaw gets information about a disks migration as an array of bytes
|
||||
func (d Disks) MigrateV2GetRaw(ctx context.Context, req MigrateV2GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/migrate_v2_get"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||
return res, err
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateV2ListRequest struct to get list of disks migrations
|
||||
type MigrateV2ListRequest struct {
|
||||
// Migration workflow job ID
|
||||
// Required: false
|
||||
WorkflowJobID string `url:"workflow_job_id,omitempty" json:"workflow_job_id,omitempty"`
|
||||
|
||||
// Disk ID
|
||||
// Required: false
|
||||
DiskID uint64 `url:"disk_id,omitempty" json:"disk_id,omitempty"`
|
||||
|
||||
// Account ID
|
||||
// Required: false
|
||||
AccountID uint64 `url:"account_id,omitempty" json:"account_id,omitempty"`
|
||||
|
||||
// User name
|
||||
// Required: false
|
||||
User string `url:"user,omitempty" json:"user,omitempty"`
|
||||
|
||||
// User match mode
|
||||
// Should be one of:
|
||||
// - exact
|
||||
// - prefix
|
||||
// Default: exact
|
||||
// Required: false
|
||||
UserMatch string `url:"user_match,omitempty" json:"user_match,omitempty" validate:"omitempty,migrateV2UserMatch"`
|
||||
|
||||
// Find migrations without user
|
||||
// Required: false
|
||||
UserIsNull interface{} `url:"user_is_null,omitempty" json:"user_is_null,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// Migration status
|
||||
// Should be one of:
|
||||
// - QUEUED
|
||||
// - VALIDATING
|
||||
// - PREPARING
|
||||
// - MIGRATING
|
||||
// - COMPLETING
|
||||
// - ABORTING
|
||||
// - NEEDS_ATTENTION
|
||||
// - COMPLETED
|
||||
// - PARTIALLY_COMPLETED
|
||||
// - ABORTED
|
||||
// - ERROR
|
||||
// - RESOLVED
|
||||
// Required: false
|
||||
Status string `url:"status,omitempty" json:"status,omitempty" validate:"omitempty,migrateV2Status"`
|
||||
|
||||
// Whether retained source disks still require cleanup
|
||||
// Required: false
|
||||
CleanupRequired interface{} `url:"cleanup_required,omitempty" json:"cleanup_required,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// Page number
|
||||
// Default: 1
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Default: 100
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty" validate:"omitempty,max=500"`
|
||||
}
|
||||
|
||||
// MigrateV2List gets list of disks migrations as a ListMigrateV2 struct
|
||||
func (d Disks) MigrateV2List(ctx context.Context, req MigrateV2ListRequest) (*ListMigrateV2, error) {
|
||||
res, err := d.MigrateV2ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListMigrateV2{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// MigrateV2ListRaw gets list of disks migrations as an array of bytes
|
||||
func (d Disks) MigrateV2ListRaw(ctx context.Context, req MigrateV2ListRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/migrate_v2_list"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||
return res, err
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package disks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v16/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateV2ResolveRequest struct to resolve a disks migration
|
||||
type MigrateV2ResolveRequest struct {
|
||||
// Migration workflow job ID
|
||||
// Required: true
|
||||
WorkflowJobID string `url:"workflow_job_id" json:"workflow_job_id" validate:"required"`
|
||||
|
||||
// Take over cleanup
|
||||
// Default: false
|
||||
// Required: false
|
||||
TakeOverCleanup interface{} `url:"take_over_cleanup,omitempty" json:"take_over_cleanup,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
// MigrateV2Resolve resolves a disks migration
|
||||
func (d Disks) MigrateV2Resolve(ctx context.Context, req MigrateV2ResolveRequest) (*MigrateV2ResolveRecord, error) {
|
||||
res, err := d.MigrateV2ResolveRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := MigrateV2ResolveRecord{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// MigrateV2ResolveRaw resolves a disks migration and returns an array of bytes
|
||||
func (d Disks) MigrateV2ResolveRaw(ctx context.Context, req MigrateV2ResolveRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/migrate_v2_resolve"
|
||||
|
||||
res, err := d.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
return res, err
|
||||
}
|
||||
@@ -205,21 +205,51 @@ type InfoDisk struct {
|
||||
}
|
||||
|
||||
type ItemReplication struct {
|
||||
// Bandwidth
|
||||
Bandwidth uint64 `json:"bandwidth"`
|
||||
|
||||
// CopyRate
|
||||
CopyRate uint64 `json:"copy_rate"`
|
||||
|
||||
// DiskID
|
||||
DiskID uint64 `json:"diskId"`
|
||||
|
||||
// LastSync
|
||||
LastSync uint64 `json:"last_sync"`
|
||||
|
||||
// PairID
|
||||
PairID string `json:"pair_id"`
|
||||
|
||||
// PoolID
|
||||
PoolID string `json:"poolId"`
|
||||
|
||||
// ProfileID
|
||||
ProfileID uint64 `json:"profile_id"`
|
||||
|
||||
// Role
|
||||
Role string `json:"role"`
|
||||
|
||||
// ScheduleID
|
||||
ScheduleID uint64 `json:"schedule_id"`
|
||||
|
||||
// ScheduleName
|
||||
ScheduleName string `json:"schedule_name"`
|
||||
|
||||
// SelfVolumeID
|
||||
SelfVolumeID string `json:"selfVolumeId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// StorageID
|
||||
StorageID string `json:"storageId"`
|
||||
|
||||
// Target
|
||||
Target string `json:"target"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
|
||||
// VolumeID
|
||||
VolumeID string `json:"volumeId"`
|
||||
}
|
||||
@@ -353,3 +383,432 @@ type MigrateStatus struct {
|
||||
// Operation status
|
||||
Ready bool `json:"ready"`
|
||||
}
|
||||
|
||||
// MigrateV2SourceDisk describes a source disk of a migration
|
||||
type MigrateV2SourceDisk struct {
|
||||
// Disk ID
|
||||
DiskID uint64 `json:"disk_id"`
|
||||
|
||||
// SEP ID
|
||||
SEPID uint64 `json:"sep_id"`
|
||||
|
||||
// SEP type
|
||||
SEPType string `json:"sep_type"`
|
||||
|
||||
// Pool name
|
||||
PoolName string `json:"pool_name"`
|
||||
|
||||
// Storage policy ID
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
}
|
||||
|
||||
// MigrateV2RequestedTarget describes a requested target of a migration
|
||||
type MigrateV2RequestedTarget struct {
|
||||
// Disk IDs
|
||||
DiskIDs []uint64 `json:"disk_ids"`
|
||||
|
||||
// SEP ID
|
||||
SEPID uint64 `json:"sep_id"`
|
||||
|
||||
// SEP type
|
||||
SEPType string `json:"sep_type"`
|
||||
|
||||
// Pool name
|
||||
PoolName string `json:"pool_name"`
|
||||
|
||||
// Storage policy ID
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
}
|
||||
|
||||
// MigrateV2RequestedStorage describes a requested storage of a migration
|
||||
type MigrateV2RequestedStorage struct {
|
||||
// Targets
|
||||
Targets []MigrateV2RequestedTarget `json:"targets"`
|
||||
|
||||
// Auto cleanup
|
||||
AutoCleanup bool `json:"auto_cleanup"`
|
||||
}
|
||||
|
||||
// MigrateV2Origin describes an origin of a migration
|
||||
type MigrateV2Origin struct {
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
|
||||
// Correlation ID
|
||||
CorrelationID string `json:"correlation_id"`
|
||||
}
|
||||
|
||||
// MigrateV2Observation describes an observation of a migration progress
|
||||
type MigrateV2Observation struct {
|
||||
// Updated at
|
||||
UpdatedAt float64 `json:"updated_at"`
|
||||
|
||||
// Agent job ID
|
||||
AgentJobID string `json:"agent_job_id"`
|
||||
|
||||
// Attempt
|
||||
Attempt uint64 `json:"attempt"`
|
||||
|
||||
// Operation
|
||||
Operation string `json:"operation"`
|
||||
}
|
||||
|
||||
// MigrateV2Memory describes a memory progress of a migration
|
||||
type MigrateV2Memory struct {
|
||||
// Sampled at
|
||||
SampledAt float64 `json:"sampled_at"`
|
||||
|
||||
// Percent
|
||||
Percent float64 `json:"percent"`
|
||||
|
||||
// Bytes per second
|
||||
BytesPerSecond float64 `json:"bytes_per_second"`
|
||||
|
||||
// Processed bytes
|
||||
ProcessedBytes uint64 `json:"processed_bytes"`
|
||||
|
||||
// Remaining bytes
|
||||
RemainingBytes uint64 `json:"remaining_bytes"`
|
||||
}
|
||||
|
||||
// MigrateV2ProgressItem describes a progress of a disk copy
|
||||
type MigrateV2ProgressItem struct {
|
||||
// Kind
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Source disk ID
|
||||
SourceDiskID uint64 `json:"source_disk_id"`
|
||||
|
||||
// Target disk ID
|
||||
TargetDiskID uint64 `json:"target_disk_id"`
|
||||
|
||||
// Target dev
|
||||
TargetDev string `json:"target_dev"`
|
||||
|
||||
// State
|
||||
State string `json:"state"`
|
||||
|
||||
// Sampled at
|
||||
SampledAt float64 `json:"sampled_at"`
|
||||
|
||||
// Percent
|
||||
Percent float64 `json:"percent"`
|
||||
|
||||
// Bytes per second
|
||||
BytesPerSecond float64 `json:"bytes_per_second"`
|
||||
|
||||
// Processed bytes
|
||||
ProcessedBytes uint64 `json:"processed_bytes"`
|
||||
|
||||
// Remaining bytes
|
||||
RemainingBytes uint64 `json:"remaining_bytes"`
|
||||
}
|
||||
|
||||
// MigrateV2ProgressDisks describes a disks progress of a migration
|
||||
type MigrateV2ProgressDisks struct {
|
||||
// Sampled at
|
||||
SampledAt float64 `json:"sampled_at"`
|
||||
|
||||
// Percent
|
||||
Percent float64 `json:"percent"`
|
||||
|
||||
// Bytes per second
|
||||
BytesPerSecond float64 `json:"bytes_per_second"`
|
||||
|
||||
// Processed bytes
|
||||
ProcessedBytes uint64 `json:"processed_bytes"`
|
||||
|
||||
// Remaining bytes
|
||||
RemainingBytes uint64 `json:"remaining_bytes"`
|
||||
|
||||
// Percent is estimated
|
||||
PercentIsEstimated bool `json:"percent_is_estimated"`
|
||||
|
||||
// Disks total
|
||||
DisksTotal uint64 `json:"disks_total"`
|
||||
|
||||
// Disks completed
|
||||
DisksCompleted uint64 `json:"disks_completed"`
|
||||
|
||||
// Items
|
||||
Items []MigrateV2ProgressItem `json:"items"`
|
||||
}
|
||||
|
||||
// MigrateV2Progress describes a progress of a migration
|
||||
type MigrateV2Progress struct {
|
||||
// Observation
|
||||
Observation MigrateV2Observation `json:"observation"`
|
||||
|
||||
// Memory
|
||||
Memory MigrateV2Memory `json:"memory"`
|
||||
|
||||
// Disks
|
||||
Disks MigrateV2ProgressDisks `json:"disks"`
|
||||
}
|
||||
|
||||
// MigrateV2Disk describes a disk of a migration
|
||||
type MigrateV2Disk struct {
|
||||
// Source disk ID
|
||||
SourceDiskID uint64 `json:"source_disk_id"`
|
||||
|
||||
// Target disk ID
|
||||
TargetDiskID uint64 `json:"target_disk_id"`
|
||||
|
||||
// SEP ID
|
||||
SEPID uint64 `json:"sep_id"`
|
||||
|
||||
// Pool name
|
||||
PoolName string `json:"pool_name"`
|
||||
|
||||
// Storage policy ID
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
|
||||
// State
|
||||
State string `json:"state"`
|
||||
|
||||
// Copy node ID
|
||||
CopyNodeID uint64 `json:"copy_node_id"`
|
||||
|
||||
// Copy state
|
||||
CopyState string `json:"copy_state"`
|
||||
|
||||
// Writer stopped
|
||||
WriterStopped bool `json:"writer_stopped"`
|
||||
}
|
||||
|
||||
// MigrateV2CleanupInfo describes a cleanup of a migration
|
||||
type MigrateV2CleanupInfo struct {
|
||||
// Job ID
|
||||
JobID string `json:"job_id"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Error
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
// MigrateV2Resolution describes a resolution of a migration
|
||||
type MigrateV2Resolution struct {
|
||||
// Resolved at
|
||||
ResolvedAt string `json:"resolved_at"`
|
||||
|
||||
// Resolved by
|
||||
ResolvedBy string `json:"resolved_by"`
|
||||
|
||||
// Request ID
|
||||
RequestID string `json:"request_id"`
|
||||
|
||||
// Take over cleanup
|
||||
TakeOverCleanup bool `json:"take_over_cleanup"`
|
||||
|
||||
// Previous status
|
||||
PreviousStatus string `json:"previous_status"`
|
||||
|
||||
// Previous cleanup required
|
||||
PreviousCleanupRequired bool `json:"previous_cleanup_required"`
|
||||
|
||||
// Previous error
|
||||
PreviousError string `json:"previous_error"`
|
||||
}
|
||||
|
||||
// MigrateV2Item describes a disks migration in a list
|
||||
type MigrateV2Item struct {
|
||||
// Workflow job ID
|
||||
WorkflowJobID string `json:"workflow_job_id"`
|
||||
|
||||
// User
|
||||
User string `json:"user"`
|
||||
|
||||
// Execution kind
|
||||
ExecutionKind string `json:"execution_kind"`
|
||||
|
||||
// Bandwidth bytes per second
|
||||
BandwidthBytesPerSecond uint64 `json:"bandwidth_bytes_per_second"`
|
||||
|
||||
// Copy parallelism
|
||||
CopyParallelism uint64 `json:"copy_parallelism"`
|
||||
|
||||
// Source disks
|
||||
SourceDisks []MigrateV2SourceDisk `json:"source_disks"`
|
||||
|
||||
// Requested storage
|
||||
RequestedStorage MigrateV2RequestedStorage `json:"requested_storage"`
|
||||
|
||||
// Disk plan ready
|
||||
DiskPlanReady bool `json:"disk_plan_ready"`
|
||||
|
||||
// Disk IDs
|
||||
DiskIDs []uint64 `json:"disk_ids"`
|
||||
|
||||
// Disk IDs not copied
|
||||
DiskIDsNotCopied []uint64 `json:"disk_ids_not_copied"`
|
||||
|
||||
// Account ID
|
||||
AccountID uint64 `json:"account_id"`
|
||||
|
||||
// Origin
|
||||
Origin MigrateV2Origin `json:"origin"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Progress
|
||||
Progress MigrateV2Progress `json:"progress"`
|
||||
|
||||
// Migration result confirmed
|
||||
MigrationResultConfirmed bool `json:"migration_result_confirmed"`
|
||||
|
||||
// Offline commit started
|
||||
OfflineCommitStarted bool `json:"offline_commit_started"`
|
||||
|
||||
// Disks
|
||||
Disks []MigrateV2Disk `json:"disks"`
|
||||
|
||||
// Error
|
||||
Error string `json:"error"`
|
||||
|
||||
// Cleanup required
|
||||
CleanupRequired bool `json:"cleanup_required"`
|
||||
|
||||
// Cleanup
|
||||
Cleanup MigrateV2CleanupInfo `json:"cleanup"`
|
||||
|
||||
// Resolution
|
||||
Resolution MigrateV2Resolution `json:"resolution"`
|
||||
|
||||
// Created at
|
||||
CreatedAt string `json:"created_at"`
|
||||
|
||||
// Updated at
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
// ListMigrateV2 is a list of disks migrations
|
||||
type ListMigrateV2 struct {
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entry_count"`
|
||||
|
||||
// Data
|
||||
Data []MigrateV2Item `json:"data"`
|
||||
}
|
||||
|
||||
// MigrateV2Record describes detailed information about a disks migration
|
||||
type MigrateV2Record struct {
|
||||
// Workflow job ID
|
||||
WorkflowJobID string `json:"workflow_job_id"`
|
||||
|
||||
// User
|
||||
User string `json:"user"`
|
||||
|
||||
// Execution kind
|
||||
ExecutionKind string `json:"execution_kind"`
|
||||
|
||||
// Bandwidth bytes per second
|
||||
BandwidthBytesPerSecond uint64 `json:"bandwidth_bytes_per_second"`
|
||||
|
||||
// Copy parallelism
|
||||
CopyParallelism uint64 `json:"copy_parallelism"`
|
||||
|
||||
// Source disks
|
||||
SourceDisks []MigrateV2SourceDisk `json:"source_disks"`
|
||||
|
||||
// Requested storage
|
||||
RequestedStorage MigrateV2RequestedStorage `json:"requested_storage"`
|
||||
|
||||
// Disk plan ready
|
||||
DiskPlanReady bool `json:"disk_plan_ready"`
|
||||
|
||||
// Disk IDs
|
||||
DiskIDs []uint64 `json:"disk_ids"`
|
||||
|
||||
// Disk IDs not copied
|
||||
DiskIDsNotCopied []uint64 `json:"disk_ids_not_copied"`
|
||||
|
||||
// Account ID
|
||||
AccountID uint64 `json:"account_id"`
|
||||
|
||||
// Origin
|
||||
Origin MigrateV2Origin `json:"origin"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Progress
|
||||
Progress MigrateV2Progress `json:"progress"`
|
||||
|
||||
// Migration result confirmed
|
||||
MigrationResultConfirmed bool `json:"migration_result_confirmed"`
|
||||
|
||||
// Offline commit started
|
||||
OfflineCommitStarted bool `json:"offline_commit_started"`
|
||||
|
||||
// Disks
|
||||
Disks []MigrateV2Disk `json:"disks"`
|
||||
|
||||
// Error
|
||||
Error string `json:"error"`
|
||||
|
||||
// Cleanup required
|
||||
CleanupRequired bool `json:"cleanup_required"`
|
||||
|
||||
// Cleanup
|
||||
Cleanup MigrateV2CleanupInfo `json:"cleanup"`
|
||||
|
||||
// Resolution
|
||||
Resolution MigrateV2Resolution `json:"resolution"`
|
||||
|
||||
// Created at
|
||||
CreatedAt string `json:"created_at"`
|
||||
|
||||
// Updated at
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
|
||||
// Logs
|
||||
Logs []string `json:"logs"`
|
||||
}
|
||||
|
||||
// MigrateV2AbortResult describes a result of a migration abort
|
||||
type MigrateV2AbortResult struct {
|
||||
// Workflow job ID
|
||||
WorkflowJobID string `json:"workflow_job_id"`
|
||||
|
||||
// Disk IDs
|
||||
DiskIDs []uint64 `json:"disk_ids"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Job ID
|
||||
JobID string `json:"job_id"`
|
||||
|
||||
// Message
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// MigrateV2AbortRecord describes results of migrations abort
|
||||
type MigrateV2AbortRecord struct {
|
||||
// Results
|
||||
Results []MigrateV2AbortResult `json:"results"`
|
||||
}
|
||||
|
||||
// MigrateV2ResolveRecord describes a result of a migration resolve
|
||||
type MigrateV2ResolveRecord struct {
|
||||
// Workflow job ID
|
||||
WorkflowJobID string `json:"workflow_job_id"`
|
||||
|
||||
// Disk IDs
|
||||
DiskIDs []uint64 `json:"disk_ids"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Cleanup required
|
||||
CleanupRequired bool `json:"cleanup_required"`
|
||||
|
||||
// Resolution
|
||||
Resolution MigrateV2Resolution `json:"resolution"`
|
||||
|
||||
// Message
|
||||
Message string `json:"message"`
|
||||
}
|
||||
@@ -100,6 +100,45 @@ type RecordNode struct {
|
||||
|
||||
// AutoStart Count
|
||||
AutoStartCount uint64 `json:"autostart_count"`
|
||||
|
||||
// Physical net state
|
||||
PhysicalNetState []PhysicalNetState `json:"physical_net_state"`
|
||||
}
|
||||
|
||||
// Info about physical NIC state
|
||||
type PhysicalNetState struct {
|
||||
// Interface OS name
|
||||
OSName string `json:"osName"`
|
||||
|
||||
// PCI device vendor
|
||||
VendorName string `json:"vendor_name"`
|
||||
|
||||
// PCI device product
|
||||
ProductName string `json:"product_name"`
|
||||
|
||||
// Bound kernel driver
|
||||
Driver string `json:"driver"`
|
||||
|
||||
// PCI slot address
|
||||
PCISlot string `json:"pciSlot"`
|
||||
|
||||
// Interface MAC address
|
||||
MAC string `json:"mac"`
|
||||
|
||||
// Interface MTU
|
||||
MTU uint64 `json:"mtu"`
|
||||
|
||||
// Link speed in Mbps, -1 when unknown
|
||||
LinkSpeed int64 `json:"linkSpeed"`
|
||||
|
||||
// Link state, up or down
|
||||
LinkState string `json:"linkState"`
|
||||
|
||||
// Assigned IP addresses
|
||||
IP []string `json:"ip"`
|
||||
|
||||
// Prefix lengths of the assigned IP addresses
|
||||
CIDR []string `json:"cidr"`
|
||||
}
|
||||
|
||||
// Resource consumption of the node
|
||||
|
||||
@@ -195,6 +195,9 @@ type RecordZone struct {
|
||||
|
||||
// DRS port seed
|
||||
DRSPortSeed uint64 `json:"drs_port_seed"`
|
||||
|
||||
// Timeout
|
||||
TaskDiskTimeout string `json:"task_disk_timeout"`
|
||||
}
|
||||
|
||||
// A zone item from a list
|
||||
@@ -285,4 +288,7 @@ type ItemZone struct {
|
||||
|
||||
// DRS port seed
|
||||
DRSPortSeed uint64 `json:"drs_port_seed"`
|
||||
|
||||
// Timeout
|
||||
TaskDiskTimeout string `json:"task_disk_timeout"`
|
||||
}
|
||||
Reference in new issue
Block a user