This commit is contained in:
2023-09-18 14:13:55 +03:00
parent 4d9b8fc9d8
commit df8b045e77
16 changed files with 413 additions and 281 deletions

View File

@@ -3,7 +3,7 @@ package k8ci
// FilterByID returns ListK8CI with specified ID.
func (lkc ListK8CI) FilterByID(id uint64) ListK8CI {
predicate := func(ikc ItemK8CI) bool {
return ikc.RecordK8CI.ID == id
return ikc.RecordK8CIList.ID == id
}
return lkc.FilterFunc(predicate)
@@ -12,7 +12,7 @@ func (lkc ListK8CI) FilterByID(id uint64) ListK8CI {
// FilterByName returns ListK8CI with specified Name.
func (lkc ListK8CI) FilterByName(name string) ListK8CI {
predicate := func(ikc ItemK8CI) bool {
return ikc.RecordK8CI.Name == name
return ikc.RecordK8CIList.Name == name
}
return lkc.FilterFunc(predicate)

View File

@@ -6,7 +6,7 @@ var k8ciItems = ListK8CI{
Data: []ItemK8CI{
{
CreatedTime: 123902139,
RecordK8CI: RecordK8CI{
RecordK8CIList: RecordK8CIList{
Description: "",
GID: 0,
GUID: 1,
@@ -17,7 +17,7 @@ var k8ciItems = ListK8CI{
MaxMasterCount: 2,
MaxWorkerCount: 3,
Name: "purple_snake",
SharedWith: []interface{}{},
SharedWith: []uint64{},
Status: "ENABLED",
Version: "1",
WorkerDriver: "KVM_X86",
@@ -26,7 +26,7 @@ var k8ciItems = ListK8CI{
},
{
CreatedTime: 123902232,
RecordK8CI: RecordK8CI{
RecordK8CIList: RecordK8CIList{
Description: "",
GID: 0,
GUID: 2,
@@ -37,7 +37,7 @@ var k8ciItems = ListK8CI{
MaxMasterCount: 3,
MaxWorkerCount: 5,
Name: "green_giant",
SharedWith: []interface{}{},
SharedWith: []uint64{},
Status: "DISABLED",
Version: "2",
WorkerDriver: "KVM_X86",
@@ -46,7 +46,7 @@ var k8ciItems = ListK8CI{
},
{
CreatedTime: 123902335,
RecordK8CI: RecordK8CI{
RecordK8CIList: RecordK8CIList{
Description: "",
GID: 0,
GUID: 3,
@@ -57,7 +57,7 @@ var k8ciItems = ListK8CI{
MaxMasterCount: 5,
MaxWorkerCount: 9,
Name: "magenta_cloud",
SharedWith: []interface{}{},
SharedWith: []uint64{},
Status: "ENABLED",
Version: "3",
WorkerDriver: "KVM_X86",

View File

@@ -1,11 +1,11 @@
package k8ci
// Main information about K8CI
// Main information about K8CI in List
type ItemK8CI struct {
// Created time
CreatedTime uint64 `json:"createdTime"`
// Detailed information about K8CI
RecordK8CI
RecordK8CIList
}
// List K8CI
@@ -17,7 +17,55 @@ type ListK8CI struct {
EntryCount uint64 `json:"entryCount"`
}
// Detailed information about K8CI
// Detailed information about K8CI in List
type RecordK8CIList struct {
// Description
Description string `json:"desc"`
// Grid ID
GID uint64 `json:"gid"`
// GUID
GUID uint64 `json:"guid"`
// ID
ID uint64 `json:"id"`
// Load balancer image ID
LBImageID uint64 `json:"lbImageId"`
// Master driver
MasterDriver string `json:"masterDriver"`
// Master image ID
MasterImageID uint64 `json:"masterImageId"`
// Max master count
MaxMasterCount uint64 `json:"maxMasterCount"`
// Max worker count
MaxWorkerCount uint64 `json:"maxWorkerCount"`
// Name
Name string `json:"name"`
// Shared with
SharedWith []uint64 `json:"sharedWith"`
// Status
Status string `json:"status"`
// Version
Version string `json:"version"`
// Worker driver
WorkerDriver string `json:"workerDriver"`
// Worker image ID
WorkerImageID uint64 `json:"workerImageId"`
}
// Detailed information about K8CI
type RecordK8CI struct {
// Description
Description string `json:"desc"`
@@ -52,8 +100,11 @@ type RecordK8CI struct {
// Name
Name string `json:"name"`
//NetworkPlugins
NetworkPlugins []string `json:"networkPlugins"`
// Shared with
SharedWith []interface{} `json:"sharedWith"`
SharedWith []uint64 `json:"sharedWith"`
// Status
Status string `json:"status"`