v1.14.6
This commit is contained in:
@@ -74,6 +74,7 @@ type NetAttachRequest struct {
|
||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||
|
||||
// Flag indicating whether security groups are enabled for this interface
|
||||
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||
// Required: false
|
||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ type Interface struct {
|
||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||
|
||||
// Flag indicating whether security groups are enabled for this interface
|
||||
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||
// Required: false
|
||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||
|
||||
|
||||
@@ -16,22 +16,22 @@ type HighlyAvailableRequest struct {
|
||||
}
|
||||
|
||||
// HighlyAvailable makes load balancer highly available
|
||||
func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (uint64, error) {
|
||||
func (l LB) HighlyAvailable(ctx context.Context, req HighlyAvailableRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return 0, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudapi/lb/makeHighlyAvailable"
|
||||
|
||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseUint(string(res), 10, 64)
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
@@ -57,6 +57,11 @@ type CreateInAccountRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||
|
||||
// Enable security groups for VINS
|
||||
// Required: false
|
||||
// Default: false
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperCreateRequestInAcc struct {
|
||||
|
||||
@@ -51,6 +51,11 @@ type CreateInRGRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||
|
||||
// Enable security groups for VINS
|
||||
// Required: false
|
||||
// Default: false
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperCreateRequestInRG struct {
|
||||
|
||||
@@ -74,6 +74,7 @@ type NetAttachRequest struct {
|
||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||
|
||||
// Flag indicating whether security groups are enabled for this interface
|
||||
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||
// Required: false
|
||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ type CreateRequest struct {
|
||||
// List of resource groups IDs to which DPDK network will be available. Empty field means all resource groups in the system.
|
||||
// Required: false
|
||||
RGAccess []uint64 `url:"rgAccess,omitempty" json:"rgAccess,omitempty"`
|
||||
|
||||
// Enable security groups for DPDK network
|
||||
// Required: false
|
||||
// Default: false
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
// Create creates a DPDK networks
|
||||
|
||||
@@ -104,6 +104,11 @@ type CreateRequest struct {
|
||||
// Required: false
|
||||
// Default: false
|
||||
HAMode bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
|
||||
|
||||
// Enable security groups for external network
|
||||
// Required: false
|
||||
// Default: false
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperCreateRequest struct {
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
package grid
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// AddRequest struct for location code
|
||||
type AddRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gid" json:"gid" validate:"required"`
|
||||
|
||||
// Name of the location
|
||||
// Required: true
|
||||
Name string `url:"name" json:"name" validate:"required"`
|
||||
|
||||
// Location code typicly used in dns names
|
||||
// Required: true
|
||||
LocationCode string `url:"locationcode" json:"locationcode" validate:"required"`
|
||||
}
|
||||
|
||||
// Add location code (e.g. DNS name of this grid)
|
||||
func (g Grid) Add(ctx context.Context, req AddRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/add"
|
||||
|
||||
res, err := g.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
|
||||
}
|
||||
@@ -129,6 +129,9 @@ type ItemGridList struct {
|
||||
|
||||
// SDN support
|
||||
SDNSupport bool `json:"sdn_support"`
|
||||
|
||||
// Is Zero Access enabled
|
||||
ZeroAccessEnabled bool `json:"zeroaccess_enabled"`
|
||||
}
|
||||
|
||||
// List Grids
|
||||
|
||||
@@ -51,6 +51,7 @@ type Interface struct {
|
||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||
|
||||
// Flag indicating whether security groups are enabled for this interface
|
||||
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||
// Required: false
|
||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ type InterfaceMassCreate struct {
|
||||
SecGroups []uint64 `url:"security_groups,omitempty" json:"security_groups,omitempty"`
|
||||
|
||||
// Flag indicating whether security groups are enabled for this interface
|
||||
// Not applicable to netType VFNIC, TRUNK, or SDN
|
||||
// Required: false
|
||||
EnableSecGroups bool `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty"`
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ package sep
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
@@ -13,32 +15,66 @@ type AddPoolRequest struct {
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
|
||||
// Method Async/Sync
|
||||
// Default: true
|
||||
// Required: false
|
||||
Sync bool `url:"sync" json:"sync"`
|
||||
|
||||
// Pool structure which contains fields such as "name", "usage_limit", "types", "system", "accessAccountIds", "accessResGroupIds". Added fields for other pool types: Des, Ovs - "uris" list of "ip, port".
|
||||
// Dorado, Tatlin no additional fields required. Hitachi - "id", "snapshotable", "snapshot_pool_id", "minLdevId", "maxLdevId", "clone_technology". Shared - "description", "wwns", "allocate_type", "stripes", "metadata_size", "metadatatalun". Local - "description", "node_consumer", "block_disk".
|
||||
// Required: true
|
||||
Pool string `url:"pool" json:"pool" validate:"required"`
|
||||
}
|
||||
|
||||
// AddPool adds pool to SEP
|
||||
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (string, error) {
|
||||
type wrapperAddPoolRequest struct {
|
||||
AddPoolRequest
|
||||
AsyncMode bool `url:"asyncMode"`
|
||||
}
|
||||
|
||||
// AddPool adds pool to SEP in sync mode.
|
||||
// It returns result of operation and error.
|
||||
func (s SEP) AddPool(ctx context.Context, req AddPoolRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperAddPoolRequest{
|
||||
AddPoolRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/addPool"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// AddPoolAsync adds pool to SEP in async mode.
|
||||
// It returns guid of task and error.
|
||||
func (s SEP) AddPoolAsync(ctx context.Context, req AddPoolRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
reqWrapped := wrapperAddPoolRequest{
|
||||
AddPoolRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/addPool"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
result := string(res)
|
||||
result := strings.ReplaceAll(string(res), "\"", "")
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
@@ -34,23 +34,25 @@ type ConfigFieldEditRequest struct {
|
||||
}
|
||||
|
||||
// ConfigFieldEdit edits SEP config field value
|
||||
func (s SEP) ConfigFieldEdit(ctx context.Context, req ConfigFieldEditRequest) (bool, error) {
|
||||
func (s SEP) ConfigFieldEdit(ctx context.Context, req ConfigFieldEditRequest) (*RecordConfigFieldEdit, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/configFieldEdit"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
info := RecordConfigFieldEdit{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
@@ -25,22 +25,24 @@ type DelConsumerNodesRequest struct {
|
||||
}
|
||||
|
||||
// DelConsumerNodes excludes consumer nodes from SEP parameters
|
||||
func (s SEP) DelConsumerNodes(ctx context.Context, req DelConsumerNodesRequest) (bool, error) {
|
||||
func (s SEP) DelConsumerNodes(ctx context.Context, req DelConsumerNodesRequest) (interface{}, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/delConsumerNodes"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
var result interface{}
|
||||
|
||||
err = json.Unmarshal(res, &result)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package sep
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// Total resource information
|
||||
type Total struct {
|
||||
// Capacity limit
|
||||
@@ -185,3 +187,93 @@ type ListAvailableSEP struct {
|
||||
// Data
|
||||
Data []SEPData `json:"data"`
|
||||
}
|
||||
|
||||
// Disk clean settings
|
||||
type DiskCleanSettings struct {
|
||||
// Block size
|
||||
BlockSize string `json:"blocksize"`
|
||||
|
||||
// Write bytes per second
|
||||
WBPS uint64 `json:"wbps"`
|
||||
|
||||
// Write I/O operations per second
|
||||
WIOPS uint64 `json:"wiops"`
|
||||
}
|
||||
|
||||
// Pool configuration
|
||||
type PoolConfig struct {
|
||||
// Disk clean
|
||||
DiskClean *string `json:"disk_clean"`
|
||||
|
||||
// Disk clean settings
|
||||
DiskCleanSettings DiskCleanSettings `json:"disk_clean_settings"`
|
||||
|
||||
// Pool name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Usage limit
|
||||
UsageLimit uint64 `json:"usage_limit"`
|
||||
|
||||
// Additional properties
|
||||
AdditionalProperties map[string]interface{} `json:"-"`
|
||||
}
|
||||
|
||||
func (p *PoolConfig) UnmarshalJSON(data []byte) error {
|
||||
type tmpAlias PoolConfig
|
||||
if err := json.Unmarshal(data, (*tmpAlias)(p)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
all := make(map[string]interface{})
|
||||
if err := json.Unmarshal(data, &all); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
delete(all, "disk_clean")
|
||||
delete(all, "disk_clean_settings")
|
||||
delete(all, "name")
|
||||
delete(all, "usage_limit")
|
||||
|
||||
if len(all) > 0 {
|
||||
p.AdditionalProperties = all
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Sep configuration information
|
||||
type RecordConfigFieldEdit struct {
|
||||
// Format
|
||||
Format string `json:"format"`
|
||||
|
||||
// Pools
|
||||
Pools []PoolConfig `json:"pools"`
|
||||
|
||||
// Protocol
|
||||
Protocol string `json:"protocol"`
|
||||
|
||||
// Additional properties
|
||||
AdditionalProperties map[string]interface{} `json:"-"`
|
||||
}
|
||||
|
||||
func (r *RecordConfigFieldEdit) UnmarshalJSON(data []byte) error {
|
||||
type tmpAlias RecordConfigFieldEdit
|
||||
if err := json.Unmarshal(data, (*tmpAlias)(r)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
all := make(map[string]interface{})
|
||||
if err := json.Unmarshal(data, &all); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
delete(all, "format")
|
||||
delete(all, "pools")
|
||||
delete(all, "protocol")
|
||||
|
||||
if len(all) > 0 {
|
||||
r.AdditionalProperties = all
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -57,6 +57,11 @@ type CreateInAccountRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||
|
||||
// Enable security groups for VINS
|
||||
// Required: false
|
||||
// Default: false
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperCreateRequestInAcc struct {
|
||||
|
||||
@@ -51,6 +51,11 @@ type CreateInRGRequest struct {
|
||||
// Zone ID
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zoneId,omitempty" json:"zoneId,omitempty"`
|
||||
|
||||
// Enable security groups for VINS
|
||||
// Required: false
|
||||
// Default: false
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
type wrapperCreateRequestInRG struct {
|
||||
|
||||
Reference in New Issue
Block a user