Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a3711057ba | |||
| 1c59ca338a | |||
| f1529c9aac | |||
| 040235f92f |
161
CHANGELOG.md
161
CHANGELOG.md
@@ -1,162 +1,9 @@
|
||||
## Version 1.5.0
|
||||
## Version 1.5.4
|
||||
|
||||
### Feature
|
||||
- Added cloudbroker/stack group of endpoints support. Added the possibility to get information about stacks (list handler) and about a specific stack by ID (get handler)
|
||||
- Added cloudbroker/flipgroup group of endpoints support. Added the possibility to get information about flipgroup (list handler) and about a specific flipgroup by ID (get handler), add and remote compute, create, edit and delete flipgroup.
|
||||
|
||||
- Updated lists responses models in:
|
||||
- - cloudapi/account/list
|
||||
- - cloudbroker/account/list
|
||||
- - cloudapi/bservice/list
|
||||
- - cloudapi/compute/list
|
||||
- - cloudbroker/compute/list
|
||||
- - cloudapi/computeci/list
|
||||
- - cloudapi/disks/list
|
||||
- - cloudbroker/disks/list
|
||||
- - cloudapi/extnet/list
|
||||
- - cloudbroker/extnet/list
|
||||
- - cloudapi/flipgroup/list
|
||||
- - cloudapi/image/list
|
||||
- - cloudbroker/image/list
|
||||
- - cloudapi/k8ci/list
|
||||
- - cloudbroker/k8ci/list
|
||||
- - cloudapi/k8s/list
|
||||
- - cloudapi/k8s/listDeleted
|
||||
- - cloudbroker/k8s/list
|
||||
- - cloudbroker/k8s/listDeleted
|
||||
- - cloudapi/tasks/list
|
||||
- - cloudbroker/tasks/list
|
||||
- - cloudapi/rg/list
|
||||
- - cloudbroker/rg/list
|
||||
- - cloudapi/vins/list
|
||||
- - cloudbroker/vins/list
|
||||
- - cloudapi/account/listDeleted
|
||||
- - cloudapi/account/listCompute
|
||||
- - cloudapi/account/listDisks
|
||||
- - cloudapi/account/listFlipGroups
|
||||
- - cloudapi/account/listRG
|
||||
- - cloudapi/account/listVINS
|
||||
- - cloudapi/compute/listDeleted
|
||||
- - cloudapi/disks/listDeleted
|
||||
- - cloudapi/disks/listTypes
|
||||
- - cloudapi/k8ci/listDeleted
|
||||
- - cloudapi/lb/list
|
||||
- - cloudapi/lb/listDeleted
|
||||
- - cloudbroker/lb/list
|
||||
- - cloudbroker/lb/listDeleted
|
||||
- - cloudapi/rg/listComputes
|
||||
- - cloudapi/rg/listDeleted
|
||||
- - cloudapi/rg/listLb
|
||||
- - cloudapi/rg/listPFW
|
||||
- - cloudapi/rg/listVins
|
||||
- - cloudapi/vins/listDeleted
|
||||
- - cloudbroker/account/listComputes
|
||||
- - cloudbroker/account/listDeleted
|
||||
- - cloudbroker/account/listDisks
|
||||
- - cloudbroker/account/listFlipGroups
|
||||
- - cloudbroker/account/listRG
|
||||
- - cloudbroker/account/listVINS
|
||||
- - cloudbroker/compute/listDeleted
|
||||
- - cloudapi/compute/listPciDevice
|
||||
- - cloudbroker/compute/listPciDevice
|
||||
- - cloudapi/compute/listVGpu
|
||||
- - cloudbroker/compute/listVGpu
|
||||
- - cloudbroker/disks/listTypes
|
||||
- - cloudbroker/grid/list
|
||||
- - cloudbroker/grid/listEmails
|
||||
- - cloudbroker/k8ci/listDeleted
|
||||
- - cloudbroker/pcidevice/list
|
||||
- - cloudbroker/rg/affinityGroupsList
|
||||
- - cloudbroker/rg/listDeleted
|
||||
- - cloudbroker/rg/listComputes
|
||||
- - cloudbroker/rg/listLB
|
||||
- - cloudbroker/rg/listPfw
|
||||
- - cloudbroker/rg/listResourceConsumption
|
||||
- - cloudbroker/rg/listVins
|
||||
- - cloudbroker/sep/list
|
||||
- - cloudbroker/vgpu/list
|
||||
- - cloudbroker/vins/extnetList
|
||||
- - cloudbroker/vins/IpList
|
||||
- - cloudbroker/vins/natRuleList
|
||||
- - cloudapi/account/listTemplates
|
||||
- - cloudapi/compute/pfwList
|
||||
- - cloudapi/compute/sanpshotList
|
||||
- - cloudapi/compute/userList
|
||||
- - cloudapi/vins/extnetList
|
||||
- - cloudapi/vins/ipList
|
||||
- - cloudapi/vins/natRuleList
|
||||
- - cloudapi/sizes/list
|
||||
- - cloudapi/rg/affinityGroupsList
|
||||
- - cloudapi/extnet/listComputes
|
||||
|
||||
- Added new endpoints:
|
||||
- - cloudapi/rg/getResourceConsumption
|
||||
- - cloudapi/rg/listResourceConsumption
|
||||
- - cloudbroker/rg/getResourceConsumption
|
||||
- - cloudbroker/rg/listResourceConsumption
|
||||
- - cloudapi/account/getResourceConsumption
|
||||
- - cloudapi/account/listResourceConsumption
|
||||
- - cloudbroker/account/getResourceConsumption
|
||||
- - cloudbroker/account/listResourceConsumption
|
||||
- - cloudbroker/grid/getResourceConsumption
|
||||
- - cloudbroker/grid/listResourceConsumption
|
||||
- - cloudapi/compute/getCustomFields
|
||||
- - cloudapi/compute/deleteCustomFields
|
||||
- - cloudapi/compute/setCustomFields
|
||||
|
||||
- Added field CU_DM to ResourceLimits model (account, rg)
|
||||
|
||||
- Added field ReferenceID to SnapshotExtended model in cloudapi/compute/get
|
||||
|
||||
- Added field Interfaces in requests:
|
||||
- - cloudapi/kvmppc/create
|
||||
- - cloudapi/kvmppc/createBlank
|
||||
- - cloudapi/kvmx86/create
|
||||
- - cloudapi/kvmx86/createBlank
|
||||
- - cloudbroker/kvmppc/create
|
||||
- - cloudbroker/kvmppc/createBlank
|
||||
- - cloudbroker/kvmx86/create
|
||||
- - cloudbroker/kvmx86/createBlank
|
||||
|
||||
- Added UpdatedBy field to task model in cloudbroker/task/get
|
||||
|
||||
- Made optional fields in requests:
|
||||
- - Reason (cloudbroker/account/delete)
|
||||
- - Reason (cloudbroker/account/restore)
|
||||
- - Gateway (cloudbroker/extnet/create)
|
||||
- - Reason (cloudbroker/image/delete)
|
||||
- - Num (cloudapi/k8s/workerAdd)
|
||||
- - NetID (cloudbroker/vins/extnetConnect)
|
||||
|
||||
- Updated cloudapi/rg/get model
|
||||
|
||||
- Deleted field Username from cloudbroker/account/update request
|
||||
|
||||
- Deleted field EmailAddress from cloudbroker/account/update request
|
||||
|
||||
- Added field DiskType to cloudbroker/compute/diskAttach request
|
||||
|
||||
- Added field Reason to cloudbroker/compute/diskQos request
|
||||
|
||||
- Added field Enabled to cloudbroker/compute/netAttach response model
|
||||
|
||||
- Added field CPUAllocationRatio to cloudbroker/image/listStacks response model
|
||||
|
||||
- Added field Descr to cloudbroker/image/listStacks response model
|
||||
|
||||
- Added field MemAllocationRatio to cloudbroker/image/listStacks response model
|
||||
|
||||
- Updated cloudapi/k8s/workersGroupByName response model
|
||||
|
||||
- Deleted field LBImageID from cloudbroker/k8ci/create request
|
||||
|
||||
- Deleted field ImageID from cloudbroker/lb/create request
|
||||
|
||||
- Deleted field Reason from cloudbroker/vins/extnetList request
|
||||
|
||||
- Added field CustomFields to cloudapi/kvmx86/create request
|
||||
|
||||
- Added field Driver to cloudapi/kvmx86/create request
|
||||
|
||||
- Added field Driver to cloudapi/kvmx86/createBlank request
|
||||
|
||||
### Bugfix
|
||||
- Changed the Excluded field type in cloudbroker/extnet/get response model
|
||||
- Fixed the field image/models/history.guid, added a custom unmarshall. Fixed an error with get information about images (handlers - list, get) in cloudbroker
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/config"
|
||||
)
|
||||
@@ -17,14 +18,21 @@ func NewLegacyHttpClient(cfg config.LegacyConfig) *http.Client {
|
||||
},
|
||||
}
|
||||
|
||||
var expiredTime time.Time
|
||||
|
||||
if cfg.Token != "" {
|
||||
expiredTime = time.Now().AddDate(0, 0, 1)
|
||||
}
|
||||
|
||||
return &http.Client{
|
||||
Transport: &transportLegacy{
|
||||
base: transCfg,
|
||||
username: url.QueryEscape(cfg.Username),
|
||||
password: url.QueryEscape(cfg.Password),
|
||||
retries: cfg.Retries,
|
||||
token: cfg.Token,
|
||||
decortURL: cfg.DecortURL,
|
||||
base: transCfg,
|
||||
username: url.QueryEscape(cfg.Username),
|
||||
password: url.QueryEscape(cfg.Password),
|
||||
retries: cfg.Retries,
|
||||
token: cfg.Token,
|
||||
decortURL: cfg.DecortURL,
|
||||
expiryTime: expiredTime,
|
||||
},
|
||||
|
||||
Timeout: cfg.Timeout.Get(),
|
||||
|
||||
@@ -9,16 +9,17 @@ import (
|
||||
)
|
||||
|
||||
type transportLegacy struct {
|
||||
base http.RoundTripper
|
||||
username string
|
||||
password string
|
||||
retries uint64
|
||||
token string
|
||||
decortURL string
|
||||
base http.RoundTripper
|
||||
username string
|
||||
password string
|
||||
retries uint64
|
||||
token string
|
||||
decortURL string
|
||||
expiryTime time.Time
|
||||
}
|
||||
|
||||
func (t *transportLegacy) RoundTrip(request *http.Request) (*http.Response, error) {
|
||||
if t.token == "" {
|
||||
if t.token == "" || time.Now().After(t.expiryTime) {
|
||||
body := fmt.Sprintf("username=%s&password=%s", t.username, t.password)
|
||||
bodyReader := strings.NewReader(body)
|
||||
|
||||
@@ -39,6 +40,7 @@ func (t *transportLegacy) RoundTrip(request *http.Request) (*http.Response, erro
|
||||
|
||||
token := string(tokenBytes)
|
||||
t.token = token
|
||||
t.expiryTime = time.Now().AddDate(0, 0, 1)
|
||||
}
|
||||
|
||||
tokenValue := fmt.Sprintf("&authkey=%s", t.token)
|
||||
@@ -63,7 +65,9 @@ func (t *transportLegacy) RoundTrip(request *http.Request) (*http.Response, erro
|
||||
err = fmt.Errorf("%s", respBytes)
|
||||
resp.Body.Close()
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
||||
}
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package validators
|
||||
|
||||
import (
|
||||
"github.com/go-playground/validator/v10"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// computeDriverValidator is used to validate Driver field in kvmx86/kvmppc create.
|
||||
@@ -263,3 +264,11 @@ func strictLooseValidator(fe validator.FieldLevel) bool {
|
||||
|
||||
return StringInSlice(fieldValue, strictLooseValues)
|
||||
}
|
||||
|
||||
// name workerGroup must be more 3 symbol
|
||||
func workerGroupNameValidator(fe validator.FieldLevel) bool {
|
||||
fieldValue := fe.Field().String()
|
||||
fieldValue = strings.Trim(fieldValue, " ")
|
||||
|
||||
return len(fieldValue) >= 3
|
||||
}
|
||||
|
||||
@@ -127,6 +127,12 @@ func errorMessage(fe validator.FieldError) string {
|
||||
fe.Field(),
|
||||
joinValues(flipgroupClientTypeValues))
|
||||
|
||||
// k8s Validators
|
||||
case "workerGroupName":
|
||||
return fmt.Sprintf("%s %s must be more 3 symbol",
|
||||
prefix,
|
||||
fe.Field())
|
||||
|
||||
// KVM_X86/KVM_PPC Validators
|
||||
case "kvmNetType":
|
||||
return fmt.Sprintf("%s %s must be one of the following: %s",
|
||||
|
||||
@@ -180,5 +180,10 @@ func registerAllValidators(validate *validator.Validate) error {
|
||||
return err
|
||||
}
|
||||
|
||||
err = validate.RegisterValidation("workerGroupName", workerGroupNameValidator)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ type DiskDelRequest struct {
|
||||
|
||||
// False if disk is to be deleted to recycle bin
|
||||
// Required: true
|
||||
Permanently bool `url:"permanently" json:"permanently" validate:"required"`
|
||||
Permanently bool `url:"permanently" json:"permanently"`
|
||||
}
|
||||
|
||||
// DiskDel delete disk and detach from compute
|
||||
|
||||
@@ -40,6 +40,14 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||
|
||||
// Find by sep ID
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Find by pool name
|
||||
// Required: false
|
||||
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
@@ -32,6 +32,14 @@ type ListUnattachedRequest struct {
|
||||
// Required: false
|
||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
||||
|
||||
// Find by sep ID
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Find by pool name
|
||||
// Required: false
|
||||
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
@@ -24,7 +24,7 @@ type CreateRequest struct {
|
||||
|
||||
// Name for first worker group created with cluster
|
||||
// Required: true
|
||||
WorkerGroupName string `url:"workerGroupName" json:"workerGroupName" validate:"required"`
|
||||
WorkerGroupName string `url:"workerGroupName" json:"workerGroupName" validate:"required,workerGroupName"`
|
||||
|
||||
// Network plugin
|
||||
// Must be one of these values: flannel, weawenet, calico
|
||||
|
||||
@@ -20,7 +20,7 @@ type DeleteUserRequest struct {
|
||||
|
||||
// Recursively revoke access rights from owned cloudspaces and vmachines
|
||||
// Required: false
|
||||
RecursiveDelete bool `url:"recursivedelete,omitempty" json:"recursivedelete,omitempty"`
|
||||
RecursiveDelete bool `url:"recursivedelete" json:"recursivedelete" validate:"required"`
|
||||
}
|
||||
|
||||
// DeleteUser revokes user access from the account
|
||||
|
||||
@@ -16,7 +16,7 @@ type DisableRequest struct {
|
||||
|
||||
// Reason to disable
|
||||
// Required: true
|
||||
Reason string `url:"reason" json:"reason" validate:"required"`
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// Disable disables an account
|
||||
|
||||
@@ -16,7 +16,7 @@ type EnableRequest struct {
|
||||
|
||||
// Reason to enable
|
||||
// Required: true
|
||||
Reason string `url:"reason" json:"reason" validate:"required"`
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// Enable enables an account
|
||||
|
||||
@@ -16,7 +16,7 @@ type ListVINSRequest struct {
|
||||
|
||||
// Find by VINS ID
|
||||
// Required: false
|
||||
VINSID uint64 `url:"vins,omitempty" json:"vinsId,omitempty"`
|
||||
VINSID uint64 `url:"vinsId,omitempty" json:"vinsId,omitempty"`
|
||||
|
||||
// Find by name
|
||||
// Required: false
|
||||
|
||||
@@ -20,7 +20,7 @@ type DiskDelRequest struct {
|
||||
|
||||
// False if disk is to be deleted to recycle bin
|
||||
// Required: true
|
||||
Permanently bool `url:"permanently" json:"permanently" validate:"required"`
|
||||
Permanently bool `url:"permanently" json:"permanently"`
|
||||
|
||||
// Reason for action
|
||||
// Required: false
|
||||
|
||||
@@ -40,6 +40,14 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||
|
||||
// Find by sep ID
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Find by pool name
|
||||
// Required: false
|
||||
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
@@ -24,10 +24,6 @@ type ListUnattachedRequest struct {
|
||||
// Required: false
|
||||
Status string `url:"status,omitempty" json:"status,omitempty"`
|
||||
|
||||
// Find by shared, true or false
|
||||
// Required: false
|
||||
Shared bool `url:"shared,omitempty" json:"shared,omitempty"`
|
||||
|
||||
// Type of the disks
|
||||
// Required: false
|
||||
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||
@@ -36,6 +32,14 @@ type ListUnattachedRequest struct {
|
||||
// Required: false
|
||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
||||
|
||||
// Find by sep ID
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Find by pool name
|
||||
// Required: false
|
||||
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
10
pkg/cloudbroker/flipgoup.go
Normal file
10
pkg/cloudbroker/flipgoup.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package cloudbroker
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/flipgroup"
|
||||
)
|
||||
|
||||
// Accessing the FLIPGroup method group
|
||||
func (cb *CloudBroker) FLIPGroup() *flipgroup.FLIPGroup {
|
||||
return flipgroup.New(cb.client)
|
||||
}
|
||||
44
pkg/cloudbroker/flipgroup/compute_add.go
Normal file
44
pkg/cloudbroker/flipgroup/compute_add.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package flipgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for add compute instance
|
||||
type ComputeAddRequest struct {
|
||||
// ID of the Floating IP group to add compute instance to
|
||||
// Required: true
|
||||
FLIPGroupID uint64 `url:"flipgroupId" json:"flipgroupId" validate:"required"`
|
||||
|
||||
// ID of the compute instance to add to this group
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
// ComputeAdd add compute instance to the Floating IP group
|
||||
func (f FLIPGroup) ComputeAdd(ctx context.Context, req ComputeAddRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/flipgroup/computeAdd"
|
||||
|
||||
res, err := f.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
|
||||
}
|
||||
44
pkg/cloudbroker/flipgroup/compute_remove.go
Normal file
44
pkg/cloudbroker/flipgroup/compute_remove.go
Normal file
@@ -0,0 +1,44 @@
|
||||
package flipgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for remove compute instance
|
||||
type ComputeRemoveRequest struct {
|
||||
// ID of the Floating IP group to remove compute instance from
|
||||
// Required: true
|
||||
FLIPGroupID uint64 `url:"flipgroupId" json:"flipgroupId" validate:"required"`
|
||||
|
||||
// ID of the compute instance to remove
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
// ComputeRemove remove compute instance from the Floating IP group
|
||||
func (f FLIPGroup) ComputeRemove(ctx context.Context, req ComputeRemoveRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/flipgroup/computeRemove"
|
||||
|
||||
res, err := f.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
|
||||
}
|
||||
71
pkg/cloudbroker/flipgroup/create.go
Normal file
71
pkg/cloudbroker/flipgroup/create.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package flipgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for create FLIPGroup
|
||||
type CreateRequest struct {
|
||||
// Account ID
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
|
||||
// FLIPGroup name
|
||||
// Required: true
|
||||
Name string `url:"name" json:"name" validate:"required"`
|
||||
|
||||
// Network type
|
||||
// Should be one of:
|
||||
// - EXTNET
|
||||
// - VINS
|
||||
// Required: true
|
||||
NetType string `url:"netType" json:"netType" validate:"computeNetType"`
|
||||
|
||||
// ID of external network or VINS
|
||||
// Required: true
|
||||
NetID uint64 `url:"netId" json:"netId" validate:"required"`
|
||||
|
||||
// Type of client
|
||||
// - 'compute'
|
||||
// - 'vins' (will be later)
|
||||
// Required: true
|
||||
ClientType string `url:"clientType" json:"clientType" validate:"flipgroupClientType"`
|
||||
|
||||
// IP address to associate with this group. If empty, the platform will autoselect IP address
|
||||
// Required: false
|
||||
IP string `url:"ip,omitempty" json:"ip,omitempty"`
|
||||
|
||||
// Text description of this FLIPGorup instance
|
||||
// Required: false
|
||||
Description string `url:"desc,omitempty" json:"desc,omitempty"`
|
||||
}
|
||||
|
||||
// Create method will create a new FLIPGorup in the specified Account
|
||||
func (f FLIPGroup) Create(ctx context.Context, req CreateRequest) (*RecordFLIPGroupCreated, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/flipgroup/create"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordFLIPGroupCreated{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
40
pkg/cloudbroker/flipgroup/delete.go
Normal file
40
pkg/cloudbroker/flipgroup/delete.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package flipgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for delete FLIPGroup
|
||||
type DeleteRequest struct {
|
||||
// FLIPGroup ID
|
||||
// Required: true
|
||||
FLIPGroupID uint64 `url:"flipgroupId" json:"flipgroupId" validate:"required"`
|
||||
}
|
||||
|
||||
// Delete method wil delete Floating IP group
|
||||
func (f FLIPGroup) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/flipgroup/delete"
|
||||
|
||||
res, err := f.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
|
||||
}
|
||||
48
pkg/cloudbroker/flipgroup/edit.go
Normal file
48
pkg/cloudbroker/flipgroup/edit.go
Normal file
@@ -0,0 +1,48 @@
|
||||
package flipgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for edit FLIPGroup
|
||||
type EditRequest struct {
|
||||
// FLIPGroup ID
|
||||
// Required: true
|
||||
FLIPGroupID uint64 `url:"flipgroupId" json:"flipgroupId" validate:"required"`
|
||||
|
||||
// FLIPGroup name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// FLIPGroup description
|
||||
// Required: false
|
||||
Description string `url:"desc,omitempty" json:"desc,omitempty"`
|
||||
}
|
||||
|
||||
// Edit edits FLIPGroup fields
|
||||
func (f FLIPGroup) Edit(ctx context.Context, req EditRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return false, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/flipgroup/edit"
|
||||
|
||||
res, err := f.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
|
||||
}
|
||||
18
pkg/cloudbroker/flipgroup/flipgroup.go
Normal file
18
pkg/cloudbroker/flipgroup/flipgroup.go
Normal file
@@ -0,0 +1,18 @@
|
||||
// API to manage FLIPGroup instances
|
||||
package flipgroup
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
)
|
||||
|
||||
// Structure for creating request to FLIPGroup
|
||||
type FLIPGroup struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for FLIPGroup endpoints
|
||||
func New(client interfaces.Caller) *FLIPGroup {
|
||||
return &FLIPGroup{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
42
pkg/cloudbroker/flipgroup/get.go
Normal file
42
pkg/cloudbroker/flipgroup/get.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package flipgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about FLIPGroup
|
||||
type GetRequest struct {
|
||||
// FLIPGroup ID
|
||||
// Required: true
|
||||
FLIPGroupID uint64 `url:"flipgroupId" json:"flipgroupId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets details of the specified Floating IP group
|
||||
func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/flipgroup/get"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordFLIPGroup{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
65
pkg/cloudbroker/flipgroup/list.go
Normal file
65
pkg/cloudbroker/flipgroup/list.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package flipgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list FLIPGroup available to the current user
|
||||
type ListRequest struct {
|
||||
// Find by name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Find by vinsId
|
||||
// Required: false
|
||||
VINSID uint64 `url:"vinsId,omitempty" json:"vinsId,omitempty"`
|
||||
|
||||
// Find by VINS name
|
||||
// Required: false
|
||||
VINSName string `url:"vinsName,omitempty" json:"vinsName,omitempty"`
|
||||
|
||||
// Find by extnetId
|
||||
// Required: false
|
||||
ExtNetID uint64 `url:"extnetId,omitempty" json:"extnetId,omitempty"`
|
||||
|
||||
// Find by IP
|
||||
// Reuqired: false
|
||||
ByIP string `url:"byIp,omitempty" json:"byIp,omitempty"`
|
||||
|
||||
// Find by resource group ID
|
||||
// Reuqired: false
|
||||
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
|
||||
|
||||
// Find by id
|
||||
// Required: false
|
||||
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list FLIPGroup managed cluster instances available to the current user
|
||||
func (f FLIPGroup) List(ctx context.Context, req ListRequest) (*ListFLIPGroups, error) {
|
||||
url := "/cloudbroker/flipgroup/list"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListFLIPGroups{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
169
pkg/cloudbroker/flipgroup/models.go
Normal file
169
pkg/cloudbroker/flipgroup/models.go
Normal file
@@ -0,0 +1,169 @@
|
||||
package flipgroup
|
||||
|
||||
// Main information about FLIPGroup
|
||||
type RecordFLIPGroupCreated struct {
|
||||
// Default GW
|
||||
DefaultGW string `json:"defaultGW"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// IP
|
||||
IP string `json:"ip"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Network mask
|
||||
NetMask uint64 `json:"netmask"`
|
||||
}
|
||||
|
||||
type RecordFLIPGroup struct {
|
||||
// Account ID
|
||||
AccountID uint64 `json:"accountId"`
|
||||
|
||||
// Account name
|
||||
AccountName string `json:"accountName"`
|
||||
|
||||
// List of client IDs
|
||||
ClientIDs []uint64 `json:"clientIds"`
|
||||
|
||||
// Client names
|
||||
ClientNames []string `json:"clientNames"`
|
||||
|
||||
// Client type
|
||||
ClientType string `json:"clientType"`
|
||||
|
||||
// Connection ID
|
||||
ConnID uint64 `json:"connId"`
|
||||
|
||||
// Connection type
|
||||
ConnType string `json:"connType"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
// Created time
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
|
||||
// Default GW
|
||||
DefaultGW string `json:"defaultGW"`
|
||||
|
||||
// Deleted by
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
|
||||
// Deleted time
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// IP
|
||||
IP string `json:"ip"`
|
||||
|
||||
// Milestones
|
||||
Milestones uint64 `json:"milestones"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Network ID
|
||||
NetID uint64 `json:"netId"`
|
||||
|
||||
// Network type
|
||||
NetType string `json:"netType"`
|
||||
|
||||
// Network
|
||||
Network string `json:"network"`
|
||||
|
||||
// Resource group ID
|
||||
RGID uint64 `json:"rgId"`
|
||||
|
||||
// Resource group name
|
||||
RGName string `json:"rgName"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Updated by
|
||||
UpdatedBy string `json:"updatedBy"`
|
||||
|
||||
// Updated time
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
}
|
||||
|
||||
// Detailed information about FLIPGroup
|
||||
type ItemFLIPGroup struct {
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
// Account ID
|
||||
AccountID uint64 `json:"accountId"`
|
||||
|
||||
// List of client IDs
|
||||
ClientIDs []uint64 `json:"clientIds"`
|
||||
|
||||
// Client type
|
||||
ClientType string `json:"clientType"`
|
||||
|
||||
// Connection ID
|
||||
ConnID uint64 `json:"connId"`
|
||||
|
||||
// Connection type
|
||||
ConnType string `json:"connType"`
|
||||
|
||||
// Default GW
|
||||
DefaultGW string `json:"defaultGW"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// IP
|
||||
IP string `json:"ip"`
|
||||
|
||||
// Milestones
|
||||
Milestones uint64 `json:"milestones"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Network ID
|
||||
NetID uint64 `json:"netId"`
|
||||
|
||||
// Network type
|
||||
NetType string `json:"netType"`
|
||||
|
||||
// NetMask
|
||||
NetMask uint64 `json:"netmask"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
// List of FLIPGroup
|
||||
type ListFLIPGroups struct {
|
||||
Data []ItemFLIPGroup `json:"data"`
|
||||
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
43
pkg/cloudbroker/flipgroup/serialize.go
Normal file
43
pkg/cloudbroker/flipgroup/serialize.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package flipgroup
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/serialization"
|
||||
)
|
||||
|
||||
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
|
||||
//
|
||||
// In order to serialize with indent make sure to follow these guidelines:
|
||||
// - First argument -> prefix
|
||||
// - Second argument -> indent
|
||||
func (lfg ListFLIPGroups) Serialize(params ...string) (serialization.Serialized, error) {
|
||||
if len(lfg.Data) == 0 {
|
||||
return []byte{}, nil
|
||||
}
|
||||
|
||||
if len(params) > 1 {
|
||||
prefix := params[0]
|
||||
indent := params[1]
|
||||
|
||||
return json.MarshalIndent(lfg, prefix, indent)
|
||||
}
|
||||
|
||||
return json.Marshal(lfg)
|
||||
}
|
||||
|
||||
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
|
||||
//
|
||||
// In order to serialize with indent make sure to follow these guidelines:
|
||||
// - First argument -> prefix
|
||||
// - Second argument -> indent
|
||||
func (ifg ItemFLIPGroup) Serialize(params ...string) (serialization.Serialized, error) {
|
||||
if len(params) > 1 {
|
||||
prefix := params[0]
|
||||
indent := params[1]
|
||||
|
||||
return json.MarshalIndent(ifg, prefix, indent)
|
||||
}
|
||||
|
||||
return json.Marshal(ifg)
|
||||
}
|
||||
@@ -20,7 +20,7 @@ type DeleteRequest struct {
|
||||
|
||||
// Whether to completely delete the image
|
||||
// Required: false
|
||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
||||
Permanently bool `url:"permanently" json:"permanently"`
|
||||
}
|
||||
|
||||
// Delete deletes image by ID
|
||||
|
||||
@@ -162,7 +162,7 @@ type ListACL []ACL
|
||||
// History information
|
||||
type History struct {
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
GUID GUID `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
@@ -171,6 +171,20 @@ type History struct {
|
||||
Timestamp uint64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type GUID string
|
||||
|
||||
func (r *GUID) UnmarshalJSON(b []byte) error {
|
||||
|
||||
if b[0] == '"' {
|
||||
*r = GUID(string(b[1:len(b)-1]))
|
||||
return nil
|
||||
}
|
||||
|
||||
*r = GUID(string(b))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// List history
|
||||
type ListHistory []History
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ type CreateRequest struct {
|
||||
|
||||
// Name for first worker group created with cluster
|
||||
// Required: true
|
||||
WorkerGroupName string `url:"workerGroupName" json:"workerGroupName" validate:"required"`
|
||||
WorkerGroupName string `url:"workerGroupName" json:"workerGroupName" validate:"required, workerGroupName"`
|
||||
|
||||
// Network plugin
|
||||
// Must be one of these values: flunnel, weawenet, calico
|
||||
|
||||
10
pkg/cloudbroker/stack.go
Normal file
10
pkg/cloudbroker/stack.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package cloudbroker
|
||||
|
||||
import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/stack"
|
||||
)
|
||||
|
||||
// Accessing the Stack method group
|
||||
func (cb *CloudBroker) Stack() *stack.Stack {
|
||||
return stack.New(cb.client)
|
||||
}
|
||||
42
pkg/cloudbroker/stack/get.go
Normal file
42
pkg/cloudbroker/stack/get.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get list stack
|
||||
type GetRequest struct {
|
||||
// Find by ID
|
||||
// Required: true
|
||||
StackId uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get stack details by ID
|
||||
func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/stack/get"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := InfoStack{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
53
pkg/cloudbroker/stack/list.go
Normal file
53
pkg/cloudbroker/stack/list.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package stack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list stack
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
|
||||
|
||||
// Find by name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Find by type
|
||||
// Required: false
|
||||
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||
|
||||
// Find by status
|
||||
// Required: false
|
||||
Status string `url:"status,omitempty" json:"status,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// ListStacks gets list stack
|
||||
func (i Stack) List(ctx context.Context, req ListRequest) (*ListStacks, error) {
|
||||
url := "/cloudbroker/stack/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListStacks{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
164
pkg/cloudbroker/stack/models.go
Normal file
164
pkg/cloudbroker/stack/models.go
Normal file
@@ -0,0 +1,164 @@
|
||||
package stack
|
||||
|
||||
// Main information about stack
|
||||
type InfoStack struct {
|
||||
// CKey
|
||||
Ckey string `json:"_ckey"`
|
||||
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
//API URL
|
||||
APIURL string `json:"apiUrl"`
|
||||
|
||||
//API key
|
||||
Apikey string `json:"apikey"`
|
||||
|
||||
// App ID
|
||||
AppID string `json:"appId"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// Descr
|
||||
Descr string `json:"descr"`
|
||||
|
||||
// Drivers
|
||||
Drivers []string `json:"drivers"`
|
||||
|
||||
// Eco
|
||||
Eco interface{} `json:"eco"`
|
||||
|
||||
// Error
|
||||
Error uint64 `json:"error"`
|
||||
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
// List image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
// Login
|
||||
Login string `json:"login"`
|
||||
|
||||
// Mem allocation ratio
|
||||
MemAllocationRatio float64 `json:"mem_allocation_ratio"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Packegas
|
||||
Packages Packages `json:"packages"`
|
||||
|
||||
//Password
|
||||
Password string `json:"passwd"`
|
||||
|
||||
// Reference ID
|
||||
ReferenceID string `json:"referenceId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// List of stacks
|
||||
type ListStacks struct {
|
||||
|
||||
//List
|
||||
Data []InfoStack `json:"data"`
|
||||
|
||||
//Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// Package
|
||||
type Packages struct {
|
||||
|
||||
// LibvirtBin
|
||||
LibvirtBin LibvirtBin `json:"libvirt-bin"`
|
||||
|
||||
// Lvm2Lockd
|
||||
Lvm2Lockd Lvm2Lockd `json:"lvm2-lockd"`
|
||||
|
||||
// OpenvswitchCommon
|
||||
OpenvswitchCommon OpenvswitchCommon `json:"openvswitch-common"`
|
||||
|
||||
// OpenvswitchSwitch
|
||||
OpenvswitchSwitch OpenvswitchSwitch `json:"openvswitch-switch"`
|
||||
|
||||
// QemuSystemX86
|
||||
QemuSystemX86 QemuSystemX86 `json:"qemu-system-x86"`
|
||||
|
||||
// Sanlock
|
||||
Sanlock Sanlock `json:"sanlock"`
|
||||
}
|
||||
|
||||
// LibvirtBin
|
||||
type LibvirtBin struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// Lvm2Lockd
|
||||
type Lvm2Lockd struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// OpenvswitchCommon
|
||||
type OpenvswitchCommon struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// OpenvswitchSwitch
|
||||
type OpenvswitchSwitch struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// QemuSystemX86
|
||||
type QemuSystemX86 struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// Sanlock
|
||||
type Sanlock struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
16
pkg/cloudbroker/stack/stack.go
Normal file
16
pkg/cloudbroker/stack/stack.go
Normal file
@@ -0,0 +1,16 @@
|
||||
// Lists all the stack.
|
||||
package stack
|
||||
|
||||
import "repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
|
||||
// Structure for creating request to stack
|
||||
type Stack struct {
|
||||
client interfaces.Caller
|
||||
}
|
||||
|
||||
// Builder for stack endpoint
|
||||
func New(client interfaces.Caller) *Stack {
|
||||
return &Stack{
|
||||
client: client,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user