v1.12.3
This commit is contained in:
@@ -29,7 +29,7 @@ type CreateRequest struct {
|
||||
|
||||
// Storage policies
|
||||
// Required: false
|
||||
StoragePolicies []StoragePolicy `url:"-" json:"storage_policies" validate:"required"`
|
||||
StoragePolicies []StoragePolicy `url:"-" json:"storage_policies,omitempty"`
|
||||
|
||||
// Max size of memory in MB
|
||||
// Required: false
|
||||
@@ -79,8 +79,8 @@ type CreateRequest struct {
|
||||
}
|
||||
|
||||
type StoragePolicy struct {
|
||||
ID int64 `url:"id" json:"id"`
|
||||
Limit int `url:"limit" json:"limit"`
|
||||
ID uint64 `url:"id" json:"id"`
|
||||
Limit int `url:"limit" json:"limit"`
|
||||
}
|
||||
|
||||
// Create creates account
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
var accounts = ListAccounts{
|
||||
Data: []ItemAccount{
|
||||
{
|
||||
Meta: []interface{}{},
|
||||
InfoAccount: InfoAccount{
|
||||
CreatedTime: 1676878820,
|
||||
DeletedTime: 0,
|
||||
@@ -28,7 +27,6 @@ var accounts = ListAccounts{
|
||||
},
|
||||
},
|
||||
{
|
||||
Meta: []interface{}{},
|
||||
InfoAccount: InfoAccount{
|
||||
CreatedTime: 1676645275,
|
||||
DeletedTime: 1677723401,
|
||||
@@ -49,7 +47,6 @@ var accounts = ListAccounts{
|
||||
},
|
||||
},
|
||||
{
|
||||
Meta: []interface{}{},
|
||||
InfoAccount: InfoAccount{
|
||||
CreatedTime: 1676883850,
|
||||
DeletedTime: 1676883899,
|
||||
|
||||
@@ -46,6 +46,18 @@ type ListResources struct {
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// Policy
|
||||
type Policy struct {
|
||||
// Size of the disk
|
||||
DiskSize float64 `json:"disksize"`
|
||||
|
||||
// Max size of the disk
|
||||
DiskSizeMax float64 `json:"disksizemax"`
|
||||
|
||||
// SEPs used
|
||||
SEPs map[string]map[string]DiskUsage `json:"seps"`
|
||||
}
|
||||
|
||||
type Resource struct {
|
||||
// Number of cores
|
||||
CPU int64 `json:"cpu"`
|
||||
@@ -70,6 +82,9 @@ type Resource struct {
|
||||
|
||||
// SEPs
|
||||
SEPs map[string]map[string]DiskUsage `json:"seps"`
|
||||
|
||||
// Policies
|
||||
Policies map[string]Policy `json:"policies"`
|
||||
}
|
||||
|
||||
// Disk usage
|
||||
@@ -143,9 +158,6 @@ type InfoAccount struct {
|
||||
// DCLocation
|
||||
DCLocation string `json:"DCLocation"`
|
||||
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// Company
|
||||
Company string `json:"company"`
|
||||
|
||||
@@ -245,8 +257,6 @@ type RecordAccount struct {
|
||||
|
||||
// More information about account
|
||||
type ItemAccount struct {
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
// Access Control List
|
||||
ACL []ACL `json:"acl"`
|
||||
|
||||
@@ -58,7 +58,6 @@ var computes = ListComputes{
|
||||
GID: 212,
|
||||
GUID: 48500,
|
||||
ID: 48500,
|
||||
ImageID: 9884,
|
||||
Interfaces: ListInterfaces{},
|
||||
LockStatus: "UNLOCKED",
|
||||
ManagerID: 0,
|
||||
@@ -85,7 +84,6 @@ var computes = ListComputes{
|
||||
UserManaged: true,
|
||||
VGPUs: []uint64{},
|
||||
VINSConnected: 0,
|
||||
VirtualImageID: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -122,7 +120,6 @@ var computes = ListComputes{
|
||||
GID: 212,
|
||||
GUID: 48556,
|
||||
ID: 48556,
|
||||
ImageID: 9884,
|
||||
Interfaces: ListInterfaces{},
|
||||
LockStatus: "UNLOCKED",
|
||||
ManagerID: 0,
|
||||
@@ -149,7 +146,6 @@ var computes = ListComputes{
|
||||
UserManaged: true,
|
||||
VGPUs: []uint64{},
|
||||
VINSConnected: 0,
|
||||
VirtualImageID: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -301,7 +297,6 @@ var deleteComputes = ListDeletedComputes{
|
||||
GID: 212,
|
||||
GUID: 48500,
|
||||
ID: 48500,
|
||||
ImageID: 9884,
|
||||
Interfaces: ListInterfaces{},
|
||||
LockStatus: "UNLOCKED",
|
||||
ManagerID: 0,
|
||||
@@ -327,7 +322,6 @@ var deleteComputes = ListDeletedComputes{
|
||||
UserManaged: true,
|
||||
VGPUs: []uint64{},
|
||||
VINSConnected: 0,
|
||||
VirtualImageID: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -364,7 +358,6 @@ var deleteComputes = ListDeletedComputes{
|
||||
GID: 212,
|
||||
GUID: 48556,
|
||||
ID: 48556,
|
||||
ImageID: 9884,
|
||||
Interfaces: ListInterfaces{},
|
||||
LockStatus: "UNLOCKED",
|
||||
ManagerID: 0,
|
||||
@@ -390,7 +383,6 @@ var deleteComputes = ListDeletedComputes{
|
||||
UserManaged: true,
|
||||
VGPUs: []uint64{},
|
||||
VINSConnected: 0,
|
||||
VirtualImageID: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -46,10 +46,6 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
|
||||
|
||||
// Find by image ID
|
||||
// Required: false
|
||||
ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`
|
||||
|
||||
// Find by CD image ID
|
||||
// Required: false
|
||||
CDImageID uint64 `url:"cdImageId,omitempty" json:"cdImageId,omitempty"`
|
||||
|
||||
55
pkg/cloudbroker/compute/migrate_storage_list.go
Normal file
55
pkg/cloudbroker/compute/migrate_storage_list.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// MigrateStorageListRequest struct to get list of jobs
|
||||
type MigrateStorageListRequest struct {
|
||||
// Find by job ID
|
||||
// Required: false
|
||||
MigrationJobID uint64 `url:"migration_job_id,omitempty" json:"migration_job_id,omitempty"`
|
||||
|
||||
// If True then return completed jobs
|
||||
// Required: false
|
||||
Completed interface{} `url:"completed,omitempty" json:"completed,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// MigrateStorageList gets list of the jobs.
|
||||
func (c Compute) MigrateStorageList(ctx context.Context, req MigrateStorageListRequest) (*ListMigrateStorage, error) {
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/migrate_storage_list"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListMigrateStorage{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
@@ -720,9 +720,6 @@ type InfoCompute struct {
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Image ID
|
||||
ImageID uint64 `json:"imageId"`
|
||||
|
||||
// List interfaces
|
||||
Interfaces ListInterfaces `json:"interfaces"`
|
||||
|
||||
@@ -765,6 +762,9 @@ type InfoCompute struct {
|
||||
// List OS users
|
||||
OSUsers ListOSUsers `json:"osUsers"`
|
||||
|
||||
// Name of OS
|
||||
OSVersion string `json:"os_version"`
|
||||
|
||||
// Pinned to stack
|
||||
PinnedToStack int64 `json:"pinnedToStack"`
|
||||
|
||||
@@ -840,9 +840,6 @@ type InfoCompute struct {
|
||||
// VINS connected
|
||||
VINSConnected uint64 `json:"vinsConnected"`
|
||||
|
||||
// Virtual image ID
|
||||
VirtualImageID uint64 `json:"virtualImageId"`
|
||||
|
||||
// Zone ID
|
||||
ZoneID uint64 `json:"zoneId"`
|
||||
}
|
||||
@@ -1046,6 +1043,9 @@ type RecordCompute struct {
|
||||
// List OS users
|
||||
OSUsers ListOSUsers `json:"osUsers"`
|
||||
|
||||
// Name of OS
|
||||
OSVersion string `json:"os_version"`
|
||||
|
||||
// Pinned to stack
|
||||
PinnedToStack int64 `json:"pinnedToStack"`
|
||||
|
||||
@@ -1118,12 +1118,6 @@ type RecordCompute struct {
|
||||
// List VGPU
|
||||
VGPUs []VGPUItem `json:"vgpus"`
|
||||
|
||||
// Virtual image ID
|
||||
VirtualImageID uint64 `json:"virtualImageId"`
|
||||
|
||||
// VirtualImageName
|
||||
VirtualImageName string `json:"virtualImageName"`
|
||||
|
||||
// VNC password
|
||||
VNCPassword string `json:"vncPasswd"`
|
||||
|
||||
@@ -1375,3 +1369,31 @@ type ItemVGPU struct {
|
||||
// VM ID
|
||||
VMID uint64 `json:"vmid"`
|
||||
}
|
||||
|
||||
type ListMigrateStorage struct {
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
Data []MigrateStorageItem `json:"data"`
|
||||
}
|
||||
|
||||
type MigrateStorageItem struct {
|
||||
// Migration completion status
|
||||
Completed bool `json:"completed"`
|
||||
|
||||
// Domain name
|
||||
DomainName string `json:"domainName"`
|
||||
|
||||
// Migration job ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Migration process log
|
||||
Log []string `json:"log"`
|
||||
|
||||
// Source stack ID
|
||||
SourceStackID uint64 `json:"sourceStackId"`
|
||||
|
||||
// Migration status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Target stack ID
|
||||
TargetStackID uint64 `json:"targetStackId"`
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ type RedeployRequest struct {
|
||||
// Required: false
|
||||
ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`
|
||||
|
||||
// The OS version that will be installed on the virtual machine
|
||||
// Required: false
|
||||
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
|
||||
|
||||
// Storage policy id of compute. The rules of the specified storage policy will be used.
|
||||
// Required: true
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
|
||||
36
pkg/cloudbroker/compute/start_migration_in.go
Normal file
36
pkg/cloudbroker/compute/start_migration_in.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// StartMigrationINRequest struct to start compute for external migration in
|
||||
type StartMigrationINRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// ID of the stack where the compute will be staged for migration-in
|
||||
// Required: false
|
||||
StackID uint64 `url:"stackId,omitempty" json:"stackId,omitempty"`
|
||||
}
|
||||
|
||||
// StartMigrationIN starts compute for external migration in
|
||||
func (c Compute) StartMigrationIN(ctx context.Context, req StartRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/start_migration_in"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
36
pkg/cloudbroker/compute/stop_migration_in.go
Normal file
36
pkg/cloudbroker/compute/stop_migration_in.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// StopMigrationINRequest struct to stop compute for external migration in
|
||||
type StopMigrationINRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
|
||||
// If provided, indicates the UUID of the VM on the target host and that migration completed.
|
||||
// Required: false
|
||||
NewVMUUID string `url:"new_vm_uuid,omitempty" json:"new_vm_uuid,omitempty"`
|
||||
}
|
||||
|
||||
// StopMigrationIN stops compute for external migration in
|
||||
func (c Compute) StopMigrationIN(ctx context.Context, req StartRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/stop_migration_in"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
@@ -65,6 +65,10 @@ type UpdateRequest struct {
|
||||
// Does this machine supports hot resize, true or false
|
||||
// Required: false
|
||||
HotResize interface{} `url:"hotResize,omitempty" json:"hotResize,omitempty" validate:"omitempty,isBool"`
|
||||
|
||||
// The OS version that will be installed on the virtual machine
|
||||
// Required: false
|
||||
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
|
||||
}
|
||||
|
||||
// Update updates some properties of the compute
|
||||
|
||||
@@ -46,6 +46,10 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Find by storage policy id
|
||||
// Required: false
|
||||
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
||||
|
||||
// Find by pool name
|
||||
// Required: false
|
||||
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
|
||||
|
||||
@@ -38,6 +38,10 @@ type ListUnattachedRequest struct {
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Find by storage policy id
|
||||
// Required: false
|
||||
StoragePolicyID uint64 `url:"storage_policy_id,omitempty" json:"storage_policy_id,omitempty"`
|
||||
|
||||
// Find by pool name
|
||||
// Required: false
|
||||
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
package image
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// UpdateNodesRequest struct to update nodes
|
||||
type UpdateNodesRequest struct {
|
||||
// Image ID
|
||||
// Required: true
|
||||
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
|
||||
|
||||
// List of stacks
|
||||
// Required: false
|
||||
EnabledStacks []uint64 `url:"enabledStacks,omitempty" json:"enabledStacks,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateNodes updates image availability on nodes
|
||||
func (i Image) UpdateNodes(ctx context.Context, req UpdateNodesRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/image/updateNodes"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
@@ -121,6 +121,10 @@ type CreateRequest struct {
|
||||
// Required: false
|
||||
ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`
|
||||
|
||||
// The OS version that will be installed on the virtual machine
|
||||
// Required: false
|
||||
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
|
||||
|
||||
// Size of the boot disk in GB
|
||||
// Required: false
|
||||
BootDisk uint64 `url:"bootDisk,omitempty" json:"bootDisk,omitempty"`
|
||||
|
||||
@@ -92,6 +92,10 @@ type CreateBlankRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||
|
||||
// The OS version that will be installed on the virtual machine
|
||||
// Required: false
|
||||
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
|
||||
}
|
||||
|
||||
// GetRAM returns RAM field values
|
||||
|
||||
@@ -87,6 +87,10 @@ type MassCreateRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||
|
||||
// The OS version that will be installed on the virtual machine
|
||||
// Required: false
|
||||
OSVersion string `url:"os_version,omitempty" json:"os_version,omitempty"`
|
||||
}
|
||||
|
||||
type asyncWrapperMassCreateRequest struct {
|
||||
|
||||
54
pkg/cloudbroker/node/add_ssh_identity.go
Normal file
54
pkg/cloudbroker/node/add_ssh_identity.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// AddSSHIdentityRequest struct to add node ssh information
|
||||
type AddSSHIdentityRequest struct {
|
||||
// Node ID
|
||||
// Required: true
|
||||
NID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||
|
||||
// Host name of the client
|
||||
// Required: true
|
||||
ClientHostName string `url:"client_host_name" json:"client_host_name" validate:"required"`
|
||||
|
||||
// SSH host key of the client
|
||||
// Required: true
|
||||
ClientHostKey string `url:"client_host_key" json:"client_host_key" validate:"required" `
|
||||
|
||||
// SSH public key of the client
|
||||
// Required: true
|
||||
ClientPublicKey string `url:"client_public_key" json:"client_public_key" validate:"required"`
|
||||
|
||||
// IPv4 address
|
||||
// Required: true
|
||||
ClientIPAddress string `url:"client_ip_address" json:"client_ip_address" validate:"required" `
|
||||
}
|
||||
|
||||
// AddSSHIdentity adds node ssh information
|
||||
func (n Node) AddSSHIdentity(ctx context.Context, req AddSSHIdentityRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/node/add_ssh_identity"
|
||||
|
||||
res, err := n.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
39
pkg/cloudbroker/node/get_ssh_identity.go
Normal file
39
pkg/cloudbroker/node/get_ssh_identity.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetSSHIdentityRequest struct to get node ssh information
|
||||
type GetSSHIdentityRequest struct {
|
||||
// Node ID
|
||||
// Required: true
|
||||
NID uint64 `url:"node_id" json:"node_id" validate:"required"`
|
||||
}
|
||||
|
||||
// GetSSHIdentity gets node ssh information
|
||||
func (n Node) GetSSHIdentity(ctx context.Context, req GetSSHIdentityRequest) (*SSHIdentity, error) {
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/node/get_ssh_identity"
|
||||
|
||||
res, err := n.client.DecortApiCall(ctx, http.MethodGet, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := SSHIdentity{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
@@ -392,3 +392,15 @@ type Role struct {
|
||||
Reason string `json:"reason"`
|
||||
Time uint64 `json:"time"`
|
||||
}
|
||||
|
||||
// Information about SSH Identity
|
||||
type SSHIdentity struct {
|
||||
//Host name of the client
|
||||
HostName string `json:"host_name"`
|
||||
|
||||
//SSH host key of the client
|
||||
HostKey string `json:"host_key"`
|
||||
|
||||
//Array of SSH public keys of the client
|
||||
PublicKeys []string `json:"public_keys"`
|
||||
}
|
||||
|
||||
@@ -88,8 +88,8 @@ type CreateRequest struct {
|
||||
}
|
||||
|
||||
type StoragePolicy struct {
|
||||
ID int64 `url:"id" json:"id"`
|
||||
Limit int `url:"limit" json:"limit"`
|
||||
ID uint64 `url:"id" json:"id"`
|
||||
Limit int `url:"limit" json:"limit"`
|
||||
}
|
||||
|
||||
// Create creates resource group
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
// FilterByID returns ListSecurityGroups with specified ID.
|
||||
func (lsg ListSecurityGroups) FilterByID(id uint64) ListSecurityGroups {
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import "testing"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
94
pkg/cloudbroker/secgroup/models.go
Normal file
94
pkg/cloudbroker/secgroup/models.go
Normal file
@@ -0,0 +1,94 @@
|
||||
package secgroup
|
||||
|
||||
type ListSecurityGroups struct {
|
||||
// List
|
||||
Data []ItemSecurityGroup `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemSecurityGroup struct {
|
||||
// ID of the security group
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Account ID that owns the security group
|
||||
AccountID uint64 `json:"account_id"`
|
||||
|
||||
// Name of the security group
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the security group
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of rules
|
||||
Rules Rules `json:"rules"`
|
||||
|
||||
// Created at
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
|
||||
// Updated at
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"created_by"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type RecordSecurityGroup struct {
|
||||
// ID of the security group
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Account ID that owns the security group
|
||||
AccountID uint64 `json:"account_id"`
|
||||
|
||||
// Name of the security group
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the security group
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of rules
|
||||
Rules Rules `json:"rules"`
|
||||
|
||||
// Created at
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
|
||||
// Updated at
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"created_by"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type Rules []Rule
|
||||
|
||||
type Rule struct {
|
||||
// ID of the rule
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Traffic direction (inbound/outbound)
|
||||
Direction string `json:"direction"`
|
||||
|
||||
// IP protocol version
|
||||
Ethertype string `json:"ethertype"`
|
||||
|
||||
// Network protocol
|
||||
Protocol string `json:"protocol"`
|
||||
|
||||
// Start port number (for TCP/UDP)
|
||||
PortRangeMin uint64 `json:"port_range_min"`
|
||||
|
||||
// End port number (for TCP/UDP)
|
||||
PortRangeMax uint64 `json:"port_range_max"`
|
||||
|
||||
// Remote IP prefix in CIDR notation
|
||||
RemoteIPPrefix string `json:"remote_ip_prefix"`
|
||||
|
||||
RemoteGroupID uint64 `json:"remote_group_id"`
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import "sort"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package securitygroup
|
||||
package secgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -1,43 +0,0 @@
|
||||
package securitygroup
|
||||
|
||||
type ListSecurityGroups struct {
|
||||
Data []ItemSecurityGroup `json:"data"`
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemSecurityGroup struct {
|
||||
ID uint64 `json:"id"`
|
||||
AccountID uint64 `json:"account_id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Rules Rules `json:"rules"`
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
CreatedBy string `json:"created_by"`
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type RecordSecurityGroup struct {
|
||||
ID uint64 `json:"id"`
|
||||
AccountID uint64 `json:"account_id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Rules Rules `json:"rules"`
|
||||
CreatedAt uint64 `json:"created_at"`
|
||||
UpdatedAt uint64 `json:"updated_at"`
|
||||
CreatedBy string `json:"created_by"`
|
||||
UpdatedBy string `json:"updated_by"`
|
||||
}
|
||||
|
||||
type Rules []Rule
|
||||
|
||||
type Rule struct {
|
||||
ID uint64 `json:"id"`
|
||||
Direction string `json:"direction"`
|
||||
Ethertype string `json:"ethertype"`
|
||||
Protocol string `json:"protocol"`
|
||||
PortRangeMin uint64 `json:"port_range_min"`
|
||||
PortRangeMax uint64 `json:"port_range_max"`
|
||||
RemoteIPPrefix string `json:"remote_ip_prefix"`
|
||||
RemoteGroupID uint64 `json:"remote_group_id"`
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package cloudbroker
|
||||
|
||||
import (
|
||||
securitygroup "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/security_group"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/secgroup"
|
||||
)
|
||||
|
||||
// Accessing the Security Group method group
|
||||
func (cb *CloudBroker) SecurityGroup() *securitygroup.SecurityGroup {
|
||||
return securitygroup.New(cb.client)
|
||||
func (cb *CloudBroker) SecurityGroup() *secgroup.SecurityGroup {
|
||||
return secgroup.New(cb.client)
|
||||
}
|
||||
|
||||
10
pkg/cloudbroker/storage_policy.go
Normal file
10
pkg/cloudbroker/storage_policy.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package cloudbroker
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stpolicy"
|
||||
)
|
||||
|
||||
// Accessing the Storage Policy method group
|
||||
func (cb *CloudBroker) StPolicy() *stpolicy.StPolicy {
|
||||
return stpolicy.New(cb.client)
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package storagepolicy
|
||||
|
||||
type InfoStoragePolicyWithID struct {
|
||||
ID uint64 `json:"id"`
|
||||
GUID uint64 `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AccessSepPools ListAccessSepPools `json:"access_seps_pools"`
|
||||
Status string `json:"status"`
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
}
|
||||
|
||||
type ListStoragePolicies struct {
|
||||
Data []ItemStoragePolicy `json:"data"`
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemStoragePolicy struct {
|
||||
ID uint64 `json:"id"`
|
||||
GUID uint64 `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AccessSepPools ListAccessSepPools `json:"access_seps_pools"`
|
||||
Status string `json:"status"`
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type InfoStoragePolicy struct {
|
||||
ID uint64 `json:"id"`
|
||||
GUID uint64 `json:"guid"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
AccessSepPools ListAccessSepPools `json:"access_seps_pools"`
|
||||
Status string `json:"status"`
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type ListAccessSepPools []AccessSepPool
|
||||
|
||||
type AccessSepPool struct {
|
||||
SepID uint64 `json:"sep_id"`
|
||||
PoolNames []string `json:"pool_names"`
|
||||
}
|
||||
|
||||
type Usage struct {
|
||||
Accounts []uint64 `json:"accounts"`
|
||||
Resgroups []uint64 `json:"resgroups"`
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package cloudbroker
|
||||
|
||||
import (
|
||||
storagepolicy "repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/storage_policy"
|
||||
)
|
||||
|
||||
// Accessing the Storage Policy method group
|
||||
func (cb *CloudBroker) StoragePolicy() *storagepolicy.StoragePolicy {
|
||||
return storagepolicy.New(cb.client)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -15,14 +15,14 @@ type AddPoolRequest struct {
|
||||
|
||||
// Storage endpoint provider ID to add
|
||||
// Required: true
|
||||
SepID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
|
||||
// Pool to add
|
||||
// Required: true
|
||||
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) AddPool(ctx context.Context, req AddPoolRequest) (*InfoStoragePolicyWithID, error) {
|
||||
func (sp StPolicy) AddPool(ctx context.Context, req AddPoolRequest) (*InfoStoragePolicyWithID, error) {
|
||||
res, err := sp.AddPoolRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -38,7 +38,7 @@ func (sp StoragePolicy) AddPool(ctx context.Context, req AddPoolRequest) (*InfoS
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) AddPoolRaw(ctx context.Context, req AddPoolRequest) ([]byte, error) {
|
||||
func (sp StPolicy) AddPoolRaw(ctx context.Context, req AddPoolRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
type AccessSepsPool struct {
|
||||
type AccessSEPsPool struct {
|
||||
|
||||
// Storage endpoint provider ID
|
||||
// Required: true
|
||||
SepID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
|
||||
// Names of pools
|
||||
// Required: true
|
||||
@@ -27,7 +27,7 @@ type CreateRequest struct {
|
||||
|
||||
// List of storage endpoint access objects
|
||||
// Required: true
|
||||
AccessSepsPools []AccessSepPool `url:"access_seps_pools" json:"access_seps_pools" validate:"required"`
|
||||
AccessSEPsPools []AccessSEPsPool `url:"access_seps_pools" json:"access_seps_pools" validate:"required"`
|
||||
|
||||
// Description of the storage policy
|
||||
// Required: false
|
||||
@@ -40,7 +40,7 @@ type CreateRequest struct {
|
||||
}
|
||||
|
||||
// Create creates a new storage policy
|
||||
func (sp StoragePolicy) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
func (sp StPolicy) Create(ctx context.Context, req CreateRequest) (uint64, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -14,7 +14,7 @@ type DeleteRequest struct {
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
func (sp StPolicy) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -8,21 +8,21 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
type DeletePollRequest struct {
|
||||
type DeletePoolRequest struct {
|
||||
// ID of storage policy
|
||||
// Required: true
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
|
||||
// Storage endpoint provider ID to delete
|
||||
// Required: true
|
||||
SepID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
|
||||
// Pool to delete
|
||||
// Required: true
|
||||
PoolName string `url:"pool_name" json:"pool_name" validate:"required"`
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) DeletePool(ctx context.Context, req DeletePollRequest) (*InfoStoragePolicyWithID, error) {
|
||||
func (sp StPolicy) DeletePool(ctx context.Context, req DeletePoolRequest) (*InfoStoragePolicyWithID, error) {
|
||||
res, err := sp.DeletePoolRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -38,7 +38,7 @@ func (sp StoragePolicy) DeletePool(ctx context.Context, req DeletePollRequest) (
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) DeletePoolRaw(ctx context.Context, req DeletePollRequest) ([]byte, error) {
|
||||
func (sp StPolicy) DeletePoolRaw(ctx context.Context, req DeletePoolRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -14,7 +14,7 @@ type DisableRequest struct {
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) Disable(ctx context.Context, req DisableRequest) (bool, error) {
|
||||
func (sp StPolicy) Disable(ctx context.Context, req DisableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -14,7 +14,7 @@ type EnableRequest struct {
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
||||
func (sp StPolicy) Enable(ctx context.Context, req EnableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
// FilterByID returns ListStoragePolicies with specified ID.
|
||||
func (lsp ListStoragePolicies) FilterByID(id uint64) ListStoragePolicies {
|
||||
@@ -1,19 +1,19 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import "testing"
|
||||
|
||||
var asp9 = AccessSepPool{
|
||||
SepID: 9,
|
||||
var asp9 = AccessSEPPool{
|
||||
SEPID: 9,
|
||||
PoolNames: []string{"data03"},
|
||||
}
|
||||
|
||||
var asp7 = AccessSepPool{
|
||||
SepID: 7,
|
||||
var asp7 = AccessSEPPool{
|
||||
SEPID: 7,
|
||||
PoolNames: []string{"pool_QA"},
|
||||
}
|
||||
|
||||
var asp8 = AccessSepPool{
|
||||
SepID: 8,
|
||||
var asp8 = AccessSEPPool{
|
||||
SEPID: 8,
|
||||
PoolNames: []string{
|
||||
"alpha_pool_block",
|
||||
"alpha_pool_stripe",
|
||||
@@ -28,7 +28,7 @@ var storagePolicyItems = ListStoragePolicies{
|
||||
GUID: 1,
|
||||
Name: "storagePolicy01",
|
||||
Description: "desc",
|
||||
AccessSepPools: ListAccessSepPools{asp7},
|
||||
AccessSEPPools: ListAccessSEPPools{asp7},
|
||||
Status: "ENABLED",
|
||||
LimitIOPS: 2000,
|
||||
Usage: Usage{},
|
||||
@@ -38,7 +38,7 @@ var storagePolicyItems = ListStoragePolicies{
|
||||
GUID: 3,
|
||||
Name: "storagePolicy03",
|
||||
Description: "desc",
|
||||
AccessSepPools: ListAccessSepPools{asp7, asp8, asp9},
|
||||
AccessSEPPools: ListAccessSEPPools{asp7, asp8, asp9},
|
||||
Status: "ENABLED",
|
||||
LimitIOPS: 2500,
|
||||
Usage: Usage{},
|
||||
@@ -48,7 +48,7 @@ var storagePolicyItems = ListStoragePolicies{
|
||||
GUID: 5,
|
||||
Name: "storagePolicy05",
|
||||
Description: "another desc",
|
||||
AccessSepPools: ListAccessSepPools{asp8, asp9},
|
||||
AccessSEPPools: ListAccessSEPPools{asp8, asp9},
|
||||
Status: "DISABLED",
|
||||
LimitIOPS: 2000,
|
||||
Usage: Usage{},
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -14,7 +14,7 @@ type GetRequest struct {
|
||||
StoragePolicyID uint64 `url:"storage_policy_id" json:"storage_policy_id" validate:"required"`
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) Get(ctx context.Context, req GetRequest) (*InfoStoragePolicy, error) {
|
||||
func (sp StPolicy) Get(ctx context.Context, req GetRequest) (*InfoStoragePolicy, error) {
|
||||
res, err := sp.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -30,7 +30,7 @@ func (sp StoragePolicy) Get(ctx context.Context, req GetRequest) (*InfoStoragePo
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
func (sp StPolicy) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -59,7 +59,7 @@ type ListRequest struct {
|
||||
}
|
||||
|
||||
// List gets list of storage policies as a ListStoragePolicies struct
|
||||
func (sp StoragePolicy) List(ctx context.Context, req ListRequest) (*ListStoragePolicies, error) {
|
||||
func (sp StPolicy) List(ctx context.Context, req ListRequest) (*ListStoragePolicies, error) {
|
||||
|
||||
res, err := sp.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
@@ -77,7 +77,7 @@ func (sp StoragePolicy) List(ctx context.Context, req ListRequest) (*ListStorage
|
||||
}
|
||||
|
||||
// ListRaw gets list of storage policies as an array of bytes
|
||||
func (sp StoragePolicy) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
func (sp StPolicy) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
|
||||
if err := validators.ValidateRequest(req); err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
108
pkg/cloudbroker/stpolicy/models.go
Normal file
108
pkg/cloudbroker/stpolicy/models.go
Normal file
@@ -0,0 +1,108 @@
|
||||
package stpolicy
|
||||
|
||||
type InfoStoragePolicyWithID struct {
|
||||
// ID of the storage policy
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// Name of the storage policy
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the storage policy
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of pools in SEP for storage policy
|
||||
AccessSEPPools ListAccessSEPPools `json:"access_seps_pools"`
|
||||
|
||||
// Status of the storage policy
|
||||
Status string `json:"status"`
|
||||
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// ID of the storage policy
|
||||
StoragePolicyID uint64 `json:"storage_policy_id"`
|
||||
}
|
||||
|
||||
type ListStoragePolicies struct {
|
||||
// List
|
||||
Data []ItemStoragePolicy `json:"data"`
|
||||
|
||||
// Entry Count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
type ItemStoragePolicy struct {
|
||||
// ID of the storage policy
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// Name of the storage policy
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the storage policy
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of pools in SEP for storage policy
|
||||
AccessSEPPools ListAccessSEPPools `json:"access_seps_pools"`
|
||||
|
||||
// Status of the storage policy
|
||||
Status string `json:"status"`
|
||||
|
||||
// Max IOPS for the sotrage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type InfoStoragePolicy struct {
|
||||
// ID of the storage policy
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// Name of the storage policy
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description of the storage policy
|
||||
Description string `json:"description"`
|
||||
|
||||
// List of pools in SEP for storage policy
|
||||
AccessSEPPools ListAccessSEPPools `json:"access_seps_pools"`
|
||||
|
||||
// Status of the storage policy
|
||||
Status string `json:"status"`
|
||||
|
||||
// Max IOPS for the storage policy
|
||||
LimitIOPS uint64 `json:"limit_iops"`
|
||||
|
||||
// Which accounts and resource groups use the storage policy
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
type ListAccessSEPPools []AccessSEPPool
|
||||
|
||||
type AccessSEPPool struct {
|
||||
// SEP ID
|
||||
SEPID uint64 `json:"sep_id"`
|
||||
|
||||
// SEP name
|
||||
Name string `json:"sep_name"`
|
||||
|
||||
// Pool names
|
||||
PoolNames []string `json:"pool_names"`
|
||||
}
|
||||
|
||||
type Usage struct {
|
||||
// List of accounts
|
||||
Accounts []uint64 `json:"accounts"`
|
||||
|
||||
// List of resource groups
|
||||
Resgroups []uint64 `json:"resgroups"`
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
// Structure for creating request to storage policy
|
||||
type StoragePolicy struct {
|
||||
type StPolicy struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for stack endpoint
|
||||
func New(client interfaces.Caller) *StoragePolicy {
|
||||
return &StoragePolicy{
|
||||
func New(client interfaces.Caller) *StPolicy {
|
||||
return &StPolicy{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package storagepolicy
|
||||
package stpolicy
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -27,7 +27,7 @@ type UpdateRequest struct {
|
||||
}
|
||||
|
||||
// Update updates storage policy
|
||||
func (sp StoragePolicy) Update(ctx context.Context, req UpdateRequest) (*InfoStoragePolicyWithID, error) {
|
||||
func (sp StPolicy) Update(ctx context.Context, req UpdateRequest) (*InfoStoragePolicyWithID, error) {
|
||||
res, err := sp.UpdateRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -43,7 +43,7 @@ func (sp StoragePolicy) Update(ctx context.Context, req UpdateRequest) (*InfoSto
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
func (sp StoragePolicy) UpdateRaw(ctx context.Context, req UpdateRequest) ([]byte, error) {
|
||||
func (sp StPolicy) UpdateRaw(ctx context.Context, req UpdateRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
Reference in New Issue
Block a user