This commit is contained in:
2023-11-03 11:17:45 +03:00
parent 4120cd2b1a
commit 84c0248019
40 changed files with 964 additions and 73 deletions

View File

@@ -0,0 +1,73 @@
package account
// IDs gets array of AccountIDs from ListAccounts struct
func (la ListAccounts) IDs() []uint64 {
res := make([]uint64, 0, len(la.Data))
for _, acc := range la.Data {
res = append(res, acc.ID)
}
return res
}
// IDs gets array of ComputeIDs from ListComputes struct
func (lc ListComputes) IDs() []uint64 {
res := make([]uint64, 0, len(lc.Data))
for _, c := range lc.Data {
res = append(res, c.ComputeID)
}
return res
}
// IDs gets array of DiskIDs from ListDisks struct
func (ld ListDisks) IDs() []uint64 {
res := make([]uint64, 0, len(ld.Data))
for _, d := range ld.Data {
res = append(res, d.ID)
}
return res
}
// IDs gets array of FLIPGroupIDs from ListFLIPGroups struct
func (fg ListFLIPGroups) IDs() []uint64 {
res := make([]uint64, 0, len(fg.Data))
for _, g := range fg.Data {
res = append(res, g.ID)
}
return res
}
// IDs gets array of AccountIDs from ListResourceConsumption struct
func (rc ListResourceConsumption) IDs() []uint64 {
res := make([]uint64, 0, len(rc.Data))
for _, r := range rc.Data {
res = append(res, r.AccountID)
}
return res
}
// IDs gets array of RGIDs from ListRG struct
func (rg ListRG) IDs() []uint64 {
res := make([]uint64, 0, len(rg.Data))
for _, g := range rg.Data {
res = append(res, g.RGID)
}
return res
}
// IDs gets array of TemplateIDs from ListTemplates struct
func (lt ListTemplates) IDs() []uint64 {
res := make([]uint64, 0, len(lt.Data))
for _, t := range lt.Data {
res = append(res, t.ID)
}
return res
}
// IDs gets array of VINSIDs from ListVINS struct
func (lv ListVINS) IDs() []uint64 {
res := make([]uint64, 0, len(lv.Data))
for _, v := range lv.Data {
res = append(res, v.ID)
}
return res
}

View File

@@ -0,0 +1,37 @@
package bservice
// IDs gets array of BasicServiceIDs from ListBasicServices struct
func (lbs ListBasicServices) IDs() []uint64 {
res := make([]uint64, 0, len(lbs.Data))
for _, bs := range lbs.Data {
res = append(res, bs.ID)
}
return res
}
// IDs gets array of ComputeIDs from ListComputes struct
func (lc ListComputes) IDs() []uint64 {
res := make([]uint64, 0, len(lc))
for _, c := range lc {
res = append(res, c.ID)
}
return res
}
// IDs gets array of GroupIDs from ListGroups struct
func (lg ListGroups) IDs() []uint64 {
res := make([]uint64, 0, len(lg))
for _, g := range lg {
res = append(res, g.ID)
}
return res
}
// IDs gets array of GroupComputeIDs from ListGroupComputes struct
func (lgc ListGroupComputes) IDs() []uint64 {
res := make([]uint64, 0, len(lgc))
for _, gc := range lgc {
res = append(res, gc.ID)
}
return res
}

View File

@@ -0,0 +1,37 @@
package compute
// IDs gets array of ComputeIDs from ListComputes struct
func (lc ListComputes) IDs() []uint64 {
res := make([]uint64, 0, len(lc.Data))
for _, c := range lc.Data {
res = append(res, c.ID)
}
return res
}
// IDs gets array of DiskIDs from ListInfoDisks struct
func (li ListInfoDisks) IDs() []uint64 {
res := make([]uint64, 0, len(li))
for _, i := range li {
res = append(res, i.ID)
}
return res
}
// IDs gets array of PFWsIDs from ListPFWs struct
func (lp ListPFWs) IDs() []uint64 {
res := make([]uint64, 0, len(lp.Data))
for _, p := range lp.Data {
res = append(res, p.ID)
}
return res
}
// IDs gets array of DiskIDs from ListComputeDisks struct
func (lcd ListComputeDisks) IDs() []uint64 {
res := make([]uint64, 0, len(lcd))
for _, cd := range lcd {
res = append(res, cd.ID)
}
return res
}

View File

@@ -819,7 +819,7 @@ type ItemCompute struct {
Devices interface{} `json:"devices"`
// List disk items
Disks []InfoDisk `json:"disks"`
Disks ListInfoDisks `json:"disks"`
// Driver
Driver string `json:"driver"`
@@ -918,6 +918,9 @@ type ItemCompute struct {
VirtualImageID uint64 `json:"virtualImageId"`
}
// ListInfoDisks
type ListInfoDisks []InfoDisk
// Information Disk
type InfoDisk struct {
// ID

28
pkg/cloudapi/disks/ids.go Normal file
View File

@@ -0,0 +1,28 @@
package disks
// IDs gets array of DiskIDs from ListDisks struct
func (ld ListDisks) IDs() []uint64 {
res := make([]uint64, 0, len(ld.Data))
for _, d := range ld.Data {
res = append(res, d.ID)
}
return res
}
// IDs gets array of DiskIDs from ListDisksUnattached struct
func (ldu ListDisksUnattached) IDs() []uint64 {
res := make([]uint64, 0, len(ldu.Data))
for _, d := range ldu.Data {
res = append(res, d.ID)
}
return res
}
// IDs gets array of DiskIDs from ListSearchDisks struct
func (lsd ListSearchDisks) IDs() []uint64 {
res := make([]uint64, 0, len(lsd))
for _, d := range lsd {
res = append(res, d.ID)
}
return res
}

View File

@@ -0,0 +1,19 @@
package extnet
// IDs gets array of ExtNetIDs from ListExtNets struct
func (le ListExtNets) IDs() []uint64 {
res := make([]uint64, 0, len(le.Data))
for _, e := range le.Data {
res = append(res, e.ID)
}
return res
}
// IDs gets array of ComputeIDs from ListExtNetComputes struct
func (le ListExtNetComputes) IDs() []uint64 {
res := make([]uint64, 0, len(le.Data))
for _, e := range le.Data {
res = append(res, e.ID)
}
return res
}

View File

@@ -0,0 +1,10 @@
package flipgroup
// IDs gets array of FLIPGroupIDs from ListFLIPGroups struct
func (le ListFLIPGroups) IDs() []uint64 {
res := make([]uint64, 0, len(le.Data))
for _, e := range le.Data {
res = append(res, e.ID)
}
return res
}

19
pkg/cloudapi/image/ids.go Normal file
View File

@@ -0,0 +1,19 @@
package image
// IDs gets array of ImageIDs from ListImages struct
func (li ListImages) IDs() []uint64 {
res := make([]uint64, 0, len(li.Data))
for _, i := range li.Data {
res = append(res, i.ID)
}
return res
}
// IDs gets array of HistoryIDs from ListHistories struct
func (lh ListHistories) IDs() []uint64 {
res := make([]uint64, 0, len(lh))
for _, h := range lh {
res = append(res, h.ID)
}
return res
}

View File

@@ -66,7 +66,10 @@ type ListImages struct {
EntryCount uint64 `json:"entryCount"`
}
// History
// ListHistories of record image
type ListHistories []History
// History of record image
type History struct {
// GUID
GUID string `json:"guid"`
@@ -123,7 +126,7 @@ type RecordImage struct {
GUID uint64 `json:"guid"`
// History
History []History `json:"history"`
History ListHistories `json:"history"`
// HotResize
HotResize bool `json:"hotResize"`

10
pkg/cloudapi/k8ci/ids.go Normal file
View File

@@ -0,0 +1,10 @@
package k8ci
// IDs gets array of K8CIIDs from ListK8CI struct
func (lk ListK8CI) IDs() []uint64 {
res := make([]uint64, 0, len(lk.Data))
for _, k := range lk.Data {
res = append(res, k.ID)
}
return res
}

28
pkg/cloudapi/k8s/ids.go Normal file
View File

@@ -0,0 +1,28 @@
package k8s
// IDs gets array of K8SIDs from ListK8SClusters struct
func (lk ListK8SClusters) IDs() []uint64 {
res := make([]uint64, 0, len(lk.Data))
for _, k := range lk.Data {
res = append(res, k.ID)
}
return res
}
// IDs gets array of K8SWorkerGroupIDs from ListK8SGroups struct
func (lwg ListK8SGroups) IDs() []uint64 {
res := make([]uint64, 0, len(lwg))
for _, wg := range lwg {
res = append(res, wg.ID)
}
return res
}
// IDs gets array of Worker or Master ComputesIDs from ListDetailedInfo struct
func (ldi ListDetailedInfo) IDs() []uint64 {
res := make([]uint64, 0, len(ldi))
for _, di := range ldi {
res = append(res, di.ID)
}
return res
}

10
pkg/cloudapi/lb/ids.go Normal file
View File

@@ -0,0 +1,10 @@
package lb
// IDs gets array of LBIDs from ListLB struct
func (llb ListLB) IDs() []uint64 {
res := make([]uint64, 0, len(llb.Data))
for _, lb := range llb.Data {
res = append(res, lb.ID)
}
return res
}

View File

@@ -0,0 +1,10 @@
package locations
// IDs gets array of LocationIDs from ListLocations struct
func (ll ListLocations) IDs() []uint64 {
res := make([]uint64, 0, len(ll.Data))
for _, l := range ll.Data {
res = append(res, l.GID)
}
return res
}

55
pkg/cloudapi/rg/ids.go Normal file
View File

@@ -0,0 +1,55 @@
package rg
// IDs gets array of ResourceGroupIDs from ListResourceGroups struct
func (lrg ListResourceGroups) IDs() []uint64 {
res := make([]uint64, 0, len(lrg.Data))
for _, rg := range lrg.Data {
res = append(res, rg.ID)
}
return res
}
// IDs gets array of ComputeIDs from ListAffinityGroupsComputes struct
func (lag ListAffinityGroupsComputes) IDs() []uint64 {
res := make([]uint64, 0, len(lag))
for _, ag := range lag {
res = append(res, ag.ComputeID)
}
return res
}
// IDs gets array of ComputeIDs from ListComputes struct
func (lc ListComputes) IDs() []uint64 {
res := make([]uint64, 0, len(lc.Data))
for _, c := range lc.Data {
res = append(res, c.ID)
}
return res
}
// IDs gets array of LBIDs from ListLB struct
func (llb ListLB) IDs() []uint64 {
res := make([]uint64, 0, len(llb.Data))
for _, lb := range llb.Data {
res = append(res, lb.ID)
}
return res
}
// IDs gets array of VINSIDs from ListVINS struct
func (llb ListVINS) IDs() []uint64 {
res := make([]uint64, 0, len(llb.Data))
for _, lb := range llb.Data {
res = append(res, lb.ID)
}
return res
}
// IDs gets array of ResourceGroupIDs from ListResourceConsumption struct
func (lrc ListResourceConsumption) IDs() []uint64 {
res := make([]uint64, 0, len(lrc.Data))
for _, rc := range lrc.Data {
res = append(res, rc.RGID)
}
return res
}

10
pkg/cloudapi/sizes/ids.go Normal file
View File

@@ -0,0 +1,10 @@
package sizes
// IDs gets array of configured available flavours IDs from ListSizes struct
func (ls ListSizes) IDs() []uint64 {
res := make([]uint64, 0, len(ls.Data))
for _, s := range ls.Data {
res = append(res, s.ID)
}
return res
}

10
pkg/cloudapi/stack/ids.go Normal file
View File

@@ -0,0 +1,10 @@
package stack
// IDs gets array of StackIDs from ListStacks struct
func (ls ListStacks) IDs() []uint64 {
res := make([]uint64, 0, len(ls.Data))
for _, s := range ls.Data {
res = append(res, s.ID)
}
return res
}

64
pkg/cloudapi/vins/ids.go Normal file
View File

@@ -0,0 +1,64 @@
package vins
// IDs gets array of VINSIDs from ListVINS struct
func (lv ListVINS) IDs() []uint64 {
res := make([]uint64, 0, len(lv.Data))
for _, v := range lv.Data {
res = append(res, v.ID)
}
return res
}
// IDs gets array of ExtNetIDs from ListExtNets struct
func (le ListExtNets) IDs() []uint64 {
res := make([]uint64, 0, len(le.Data))
for _, e := range le.Data {
res = append(res, e.ExtNetID)
}
return res
}
// IDs gets array of ComputeIDs from ListVINSComputes struct
func (lvc ListVINSComputes) IDs() []uint64 {
res := make([]uint64, 0, len(lvc))
for _, vc := range lvc {
res = append(res, vc.ID)
}
return res
}
// IDs gets array of NATRuleConfigIDs from ListNATRulesConfig struct
func (lnrc ListNATRulesConfig) IDs() []uint64 {
res := make([]uint64, 0, len(lnrc))
for _, nrc := range lnrc {
res = append(res, nrc.ID)
}
return res
}
// IDs gets array of NATRuleIDs from ListNATRules struct
func (lnr ListNATRules) IDs() []uint64 {
res := make([]uint64, 0, len(lnr.Data))
for _, nr := range lnr.Data {
res = append(res, nr.ID)
}
return res
}
// IDs gets array of StaticRouteIDs from ListStaticRoutes struct
func (lsr ListStaticRoutes) IDs() []uint64 {
res := make([]uint64, 0, len(lsr.Data))
for _, sr := range lsr.Data {
res = append(res, sr.ID)
}
return res
}
// IDs gets array of RouteIDs from ListRoutes struct
func (lr ListRoutes) IDs() []uint64 {
res := make([]uint64, 0, len(lr))
for _, r := range lr {
res = append(res, r.ID)
}
return res
}