Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e8270453cc |
@@ -1,5 +1,4 @@
|
|||||||
## Version 1.5.5
|
## Version 1.5.6
|
||||||
|
|
||||||
### Bugfix
|
### Bugfix
|
||||||
- Added missing field cloudbroker/sep/RecordPool/UsageLimit
|
- Fix the RecordLB field, add the RecordLBList field to cloudbroker/lb/models to correctly receive information on get and list requests
|
||||||
- Fixed the field cloudbroker/sep/RecordConsumption/ByPool
|
|
||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
// FilterByID returns ListLB with specified ID.
|
// FilterByID returns ListLB with specified ID.
|
||||||
func (ll ListLB) FilterByID(id uint64) ListLB {
|
func (ll ListLB) FilterByID(id uint64) ListLB {
|
||||||
predicate := func(rlb RecordLB) bool {
|
predicate := func(rlb ItemLBList) bool {
|
||||||
return rlb.ID == id
|
return rlb.ID == id
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ func (ll ListLB) FilterByID(id uint64) ListLB {
|
|||||||
|
|
||||||
// FilterByName returns ListLB with specified Name.
|
// FilterByName returns ListLB with specified Name.
|
||||||
func (ll ListLB) FilterByName(name string) ListLB {
|
func (ll ListLB) FilterByName(name string) ListLB {
|
||||||
predicate := func(rlb RecordLB) bool {
|
predicate := func(rlb ItemLBList) bool {
|
||||||
return rlb.Name == name
|
return rlb.Name == name
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,22 +27,13 @@ func (ll ListLB) FilterByName(name string) ListLB {
|
|||||||
|
|
||||||
// FilterByExtNetID returns ListLB with specified ExtNetID.
|
// FilterByExtNetID returns ListLB with specified ExtNetID.
|
||||||
func (ll ListLB) FilterByExtNetID(extNetID uint64) ListLB {
|
func (ll ListLB) FilterByExtNetID(extNetID uint64) ListLB {
|
||||||
predicate := func(rlb RecordLB) bool {
|
predicate := func(rlb ItemLBList) bool {
|
||||||
return rlb.ExtNetID == extNetID
|
return rlb.ExtNetID == extNetID
|
||||||
}
|
}
|
||||||
|
|
||||||
return ll.FilterFunc(predicate)
|
return ll.FilterFunc(predicate)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FilterByImageID returns ListLB with specified ImageID.
|
|
||||||
func (ll ListLB) FilterByImageID(imageID uint64) ListLB {
|
|
||||||
predicate := func(rlb RecordLB) bool {
|
|
||||||
return rlb.ImageID == imageID
|
|
||||||
}
|
|
||||||
|
|
||||||
return ll.FilterFunc(predicate)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FilterByK8SID returns ListLB used by specified K8S cluster.
|
// FilterByK8SID returns ListLB used by specified K8S cluster.
|
||||||
func (ll ListLB) FilterByK8SID(ctx context.Context, k8sID uint64, decortClient interfaces.Caller) (*ListLB, error) {
|
func (ll ListLB) FilterByK8SID(ctx context.Context, k8sID uint64, decortClient interfaces.Caller) (*ListLB, error) {
|
||||||
caller := k8s.New(decortClient)
|
caller := k8s.New(decortClient)
|
||||||
@@ -56,7 +47,7 @@ func (ll ListLB) FilterByK8SID(ctx context.Context, k8sID uint64, decortClient i
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate := func(rlb RecordLB) bool {
|
predicate := func(rlb ItemLBList) bool {
|
||||||
return cluster.LBID == rlb.ID
|
return cluster.LBID == rlb.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +57,7 @@ func (ll ListLB) FilterByK8SID(ctx context.Context, k8sID uint64, decortClient i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FilterFunc allows filtering ListLB based on a user-specified predicate.
|
// FilterFunc allows filtering ListLB based on a user-specified predicate.
|
||||||
func (ll ListLB) FilterFunc(predicate func(RecordLB) bool) ListLB {
|
func (ll ListLB) FilterFunc(predicate func(ItemLBList) bool) ListLB {
|
||||||
var result ListLB
|
var result ListLB
|
||||||
|
|
||||||
for _, item := range ll.Data {
|
for _, item := range ll.Data {
|
||||||
@@ -82,9 +73,9 @@ func (ll ListLB) FilterFunc(predicate func(RecordLB) bool) ListLB {
|
|||||||
|
|
||||||
// FindOne returns first found RecordLB
|
// FindOne returns first found RecordLB
|
||||||
// If none was found, returns an empty struct.
|
// If none was found, returns an empty struct.
|
||||||
func (ll ListLB) FindOne() RecordLB {
|
func (ll ListLB) FindOne() ItemLBList {
|
||||||
if len(ll.Data) == 0 {
|
if len(ll.Data) == 0 {
|
||||||
return RecordLB{}
|
return ItemLBList{}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ll.Data[0]
|
return ll.Data[0]
|
||||||
|
|||||||
@@ -3,11 +3,9 @@ package lb
|
|||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
var lbs = ListLB{
|
var lbs = ListLB{
|
||||||
Data: []RecordLB{
|
Data: []ItemLBList{
|
||||||
{
|
{
|
||||||
HAMode: true,
|
HAMode: true,
|
||||||
CKey: "",
|
|
||||||
Meta: []interface{}{},
|
|
||||||
ACL: []interface{}{},
|
ACL: []interface{}{},
|
||||||
Backends: []ItemBackend{},
|
Backends: []ItemBackend{},
|
||||||
CreatedBy: "test_user_1",
|
CreatedBy: "test_user_1",
|
||||||
@@ -22,7 +20,6 @@ var lbs = ListLB{
|
|||||||
GID: 212,
|
GID: 212,
|
||||||
GUID: 1,
|
GUID: 1,
|
||||||
ID: 1,
|
ID: 1,
|
||||||
ImageID: 2121,
|
|
||||||
Milestones: 129000,
|
Milestones: 129000,
|
||||||
Name: "k8s-lb-test-1",
|
Name: "k8s-lb-test-1",
|
||||||
PrimaryNode: Node{},
|
PrimaryNode: Node{},
|
||||||
@@ -37,8 +34,6 @@ var lbs = ListLB{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
HAMode: false,
|
HAMode: false,
|
||||||
CKey: "",
|
|
||||||
Meta: []interface{}{},
|
|
||||||
ACL: []interface{}{},
|
ACL: []interface{}{},
|
||||||
Backends: []ItemBackend{},
|
Backends: []ItemBackend{},
|
||||||
CreatedBy: "test_user_2",
|
CreatedBy: "test_user_2",
|
||||||
@@ -53,7 +48,6 @@ var lbs = ListLB{
|
|||||||
GID: 212,
|
GID: 212,
|
||||||
GUID: 2,
|
GUID: 2,
|
||||||
ID: 2,
|
ID: 2,
|
||||||
ImageID: 2129,
|
|
||||||
Milestones: 129013,
|
Milestones: 129013,
|
||||||
Name: "k8s-lb-test-2",
|
Name: "k8s-lb-test-2",
|
||||||
PrimaryNode: Node{},
|
PrimaryNode: Node{},
|
||||||
@@ -68,8 +62,6 @@ var lbs = ListLB{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
HAMode: true,
|
HAMode: true,
|
||||||
CKey: "",
|
|
||||||
Meta: []interface{}{},
|
|
||||||
ACL: []interface{}{},
|
ACL: []interface{}{},
|
||||||
Backends: []ItemBackend{},
|
Backends: []ItemBackend{},
|
||||||
CreatedBy: "te2t_user_3",
|
CreatedBy: "te2t_user_3",
|
||||||
@@ -84,7 +76,6 @@ var lbs = ListLB{
|
|||||||
GID: 212,
|
GID: 212,
|
||||||
GUID: 3,
|
GUID: 3,
|
||||||
ID: 3,
|
ID: 3,
|
||||||
ImageID: 2139,
|
|
||||||
Milestones: 129025,
|
Milestones: 129025,
|
||||||
Name: "k8s-lb-test-3",
|
Name: "k8s-lb-test-3",
|
||||||
PrimaryNode: Node{},
|
PrimaryNode: Node{},
|
||||||
@@ -125,16 +116,8 @@ func TestFilterByExtNetID(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterByImageID(t *testing.T) {
|
|
||||||
actual := lbs.FilterByImageID(2139).FindOne()
|
|
||||||
|
|
||||||
if actual.ImageID != 2139 {
|
|
||||||
t.Fatal("expected ImageID 2139, found: ", actual.ImageID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestFilterFunc(t *testing.T) {
|
func TestFilterFunc(t *testing.T) {
|
||||||
actual := lbs.FilterFunc(func(rl RecordLB) bool {
|
actual := lbs.FilterFunc(func(rl ItemLBList) bool {
|
||||||
return rl.Status == "DISABLED"
|
return rl.Status == "DISABLED"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ type Node struct {
|
|||||||
// List of load balancers
|
// List of load balancers
|
||||||
type ListLB struct {
|
type ListLB struct {
|
||||||
// Data
|
// Data
|
||||||
Data []RecordLB `json:"data"`
|
Data []ItemLBList `json:"data"`
|
||||||
|
|
||||||
// Entry count
|
// Entry count
|
||||||
EntryCount uint64 `json:"entryCount"`
|
EntryCount uint64 `json:"entryCount"`
|
||||||
@@ -159,6 +159,69 @@ type RecordLB struct {
|
|||||||
// List of load balancer backends
|
// List of load balancer backends
|
||||||
Backends ListBackends `json:"backends"`
|
Backends ListBackends `json:"backends"`
|
||||||
|
|
||||||
|
// Description
|
||||||
|
Description string `json:"desc"`
|
||||||
|
|
||||||
|
// DPAPI password
|
||||||
|
DPAPIPassword string `json:"dpApiPassword"`
|
||||||
|
|
||||||
|
// DPAPI user
|
||||||
|
DPAPIUser string `json:"dpApiUser"`
|
||||||
|
|
||||||
|
// External network ID
|
||||||
|
ExtNetID uint64 `json:"extnetId"`
|
||||||
|
|
||||||
|
// List of load balancer frontends
|
||||||
|
Frontends ListFrontends `json:"frontends"`
|
||||||
|
|
||||||
|
// Grid ID
|
||||||
|
GID uint64 `json:"gid"`
|
||||||
|
|
||||||
|
// GUID
|
||||||
|
GUID uint64 `json:"guid"`
|
||||||
|
|
||||||
|
// ID
|
||||||
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
|
// Image ID
|
||||||
|
ImageID uint64 `json:"imageId"`
|
||||||
|
|
||||||
|
// Milestones
|
||||||
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
|
// Name
|
||||||
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// Primary node
|
||||||
|
PrimaryNode Node `json:"primaryNode"`
|
||||||
|
|
||||||
|
// Resource group ID
|
||||||
|
RGID uint64 `json:"rgId"`
|
||||||
|
|
||||||
|
// Secondary node
|
||||||
|
SecondaryNode Node `json:"secondaryNode"`
|
||||||
|
|
||||||
|
// Status
|
||||||
|
Status string `json:"status"`
|
||||||
|
|
||||||
|
// Tech status
|
||||||
|
TechStatus string `json:"techStatus"`
|
||||||
|
|
||||||
|
// VINS ID
|
||||||
|
VINSID uint64 `json:"vinsId"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detailed information about load balancer in List
|
||||||
|
type ItemLBList struct {
|
||||||
|
// HAMode
|
||||||
|
HAMode bool `json:"HAmode"`
|
||||||
|
|
||||||
|
// Access Control List
|
||||||
|
ACL []interface{} `json:"acl"`
|
||||||
|
|
||||||
|
// List of load balancer backends
|
||||||
|
Backends ListBackends `json:"backends"`
|
||||||
|
|
||||||
// Created by
|
// Created by
|
||||||
CreatedBy string `json:"createdBy"`
|
CreatedBy string `json:"createdBy"`
|
||||||
|
|
||||||
@@ -195,9 +258,6 @@ type RecordLB struct {
|
|||||||
// ID
|
// ID
|
||||||
ID uint64 `json:"id"`
|
ID uint64 `json:"id"`
|
||||||
|
|
||||||
// Image ID
|
|
||||||
ImageID uint64 `json:"imageId"`
|
|
||||||
|
|
||||||
// Milestones
|
// Milestones
|
||||||
Milestones uint64 `json:"milestones"`
|
Milestones uint64 `json:"milestones"`
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user