diff --git a/CHANGELOG.md b/CHANGELOG.md index b7a917d..ea82860 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,6 @@ -## Version 1.5.6 +## Version 1.5.7 ### Bugfix -- Fix the RecordLB field, add the RecordLBList field to cloudbroker/lb/models to correctly receive information on get and list requests \ No newline at end of file +- Remove the required tag of the start field in the CreateRequest model in cb/lb/create, since it is impossible to create an lb without starting it +- Fix model the RecordGrid, add the ItemGridList model to cloudbroker/grid/models to correctly receive information on get and list requests +- Fix tag json field GID in model RecordResourcesConsumption cb/grid/models \ No newline at end of file diff --git a/pkg/cloudbroker/grid/filter.go b/pkg/cloudbroker/grid/filter.go index cbea1b8..a509797 100644 --- a/pkg/cloudbroker/grid/filter.go +++ b/pkg/cloudbroker/grid/filter.go @@ -2,7 +2,7 @@ package grid // FilterByID returns ListGrids with specified ID. func (lg ListGrids) FilterByID(id uint64) ListGrids { - predicate := func(rg RecordGrid) bool { + predicate := func(rg ItemGridList) bool { return rg.ID == id } @@ -11,7 +11,7 @@ func (lg ListGrids) FilterByID(id uint64) ListGrids { // FilterByName returns ListGrids with specified Name. func (lg ListGrids) FilterByName(name string) ListGrids { - predicate := func(rg RecordGrid) bool { + predicate := func(rg ItemGridList) bool { return rg.Name == name } @@ -20,7 +20,7 @@ func (lg ListGrids) FilterByName(name string) ListGrids { // FilterByLocationCode returns ListGrids with specified LocationCode. func (lg ListGrids) FilterByLocationCode(locationCode string) ListGrids { - predicate := func(rg RecordGrid) bool { + predicate := func(rg ItemGridList) bool { return rg.LocationCode == locationCode } @@ -28,7 +28,7 @@ func (lg ListGrids) FilterByLocationCode(locationCode string) ListGrids { } // FilterFunc allows filtering ListGrids based on a user-specified predicate. -func (lg ListGrids) FilterFunc(predicate func(RecordGrid) bool) ListGrids { +func (lg ListGrids) FilterFunc(predicate func(ItemGridList) bool) ListGrids { var result ListGrids for _, item := range lg.Data { @@ -44,9 +44,9 @@ func (lg ListGrids) FilterFunc(predicate func(RecordGrid) bool) ListGrids { // FindOne returns first found RecordGrid. // If none was found, returns an empty struct. -func (lg ListGrids) FindOne() RecordGrid { +func (lg ListGrids) FindOne() ItemGridList { if len(lg.Data) == 0 { - return RecordGrid{} + return ItemGridList{} } return lg.Data[0] diff --git a/pkg/cloudbroker/grid/filter_test.go b/pkg/cloudbroker/grid/filter_test.go index 2cf82ad..1e85d57 100644 --- a/pkg/cloudbroker/grid/filter_test.go +++ b/pkg/cloudbroker/grid/filter_test.go @@ -3,7 +3,7 @@ package grid import "testing" var grids = ListGrids{ - Data: []RecordGrid{ + Data: []ItemGridList{ { Resources: Resources{ Current: RecordResource{ @@ -123,7 +123,7 @@ func TestFilterByLocationCode(t *testing.T) { } func TestFilterFunc(t *testing.T) { - actual := grids.FilterFunc(func(rg RecordGrid) bool { + actual := grids.FilterFunc(func(rg ItemGridList) bool { return rg.GID == 777 }). FindOne() diff --git a/pkg/cloudbroker/grid/models.go b/pkg/cloudbroker/grid/models.go index 688a329..0a6f7c1 100644 --- a/pkg/cloudbroker/grid/models.go +++ b/pkg/cloudbroker/grid/models.go @@ -18,7 +18,7 @@ type RecordResourcesConsumption struct { Reserved RecordResource `json:"Reserved"` // GID - GID uint64 `json:"gid"` + GID uint64 `json:"id"` } type ListResourceConsumption struct { @@ -67,6 +67,27 @@ type DiskUsage struct { // Detailed information about grid type RecordGrid struct { + // Flag + Flag string `json:"flag"` + + // Grid ID + GID uint64 `json:"gid"` + + // GUID + GUID uint64 `json:"guid"` + + // ID + ID uint64 `json:"id"` + + // Location code + LocationCode string `json:"locationCode"` + + // Name + Name string `json:"name"` +} + +// Information about grid +type ItemGridList struct { // Resource information Resources Resources `json:"Resources"` @@ -92,7 +113,7 @@ type RecordGrid struct { // List Grids type ListGrids struct { //Data - Data []RecordGrid `json:"data"` + Data []ItemGridList `json:"data"` // Entry count EntryCount uint64 `json:"entryCount"` diff --git a/pkg/cloudbroker/lb/create.go b/pkg/cloudbroker/lb/create.go index 7b88efc..7048fe0 100644 --- a/pkg/cloudbroker/lb/create.go +++ b/pkg/cloudbroker/lb/create.go @@ -29,7 +29,7 @@ type CreateRequest struct { // Start now Load balancer // Required: false - Start bool `url:"start" json:"start" validate:"required"` + Start bool `url:"start" json:"start"` // Text description of this load balancer // Required: false