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,64 @@
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.ID)
}
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 ListResources) 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.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,10 @@
package apiaccess
// IDs gets array of APIAccessId from ListAPIAccess struct
func (laa ListAPIAccess) IDs() []uint64 {
res := make([]uint64, 0, len(laa.Data))
for _, apiaccess := range laa.Data {
res = append(res, apiaccess.ID)
}
return res
}

View File

@@ -103,56 +103,56 @@ type CloudAPIEndpoints struct {
}
type CloudBrokerEndpoints struct {
Account []string `json:"account,omitempty"`
APIAccess []string `json:"apiaccess,omitempty"`
Audit []string `json:"audit,omitempty"`
AuditBeat []string `json:"auditbeat,omitempty"`
AuditCollector []string `json:"auditcollector,omitempty"`
BackupCreator []string `json:"backupcreator,omitempty"`
BService []string `json:"bservice,omitempty"`
CloudSpace []string `json:"cloudspace,omitempty"`
Compute []string `json:"compute,omitempty"`
ComputeCI []string `json:"computeci,omitempty"`
Desnode []string `json:"desnode,omitempty"`
Diagnostics []string `json:"diagnostics,omitempty"`
Disks []string `json:"disks,omitempty"`
Eco []string `json:"eco,omitempty"`
ExtNet []string `json:"extnet,omitempty"`
FlIPgroup []string `json:"flipgroup,omitempty"`
Grid []string `json:"grid,omitempty"`
Group []string `json:"group,omitempty"`
Health []string `json:"health,omitempty"`
IaaS []string `json:"iaas,omitempty"`
Image []string `json:"image,omitempty"`
Job []string `json:"job,omitempty"`
K8CI []string `json:"k8ci,omitempty"`
K8S []string `json:"k8s,omitempty"`
KVMPPC []string `json:"kvmppc,omitempty"`
KVMX86 []string `json:"kvmx86,omitempty"`
LB []string `json:"lb,omitempty"`
Machine []string `json:"machine,omitempty"`
Metering []string `json:"metering,omitempty"`
Milestones []string `json:"milestones,omitempty"`
Node []string `json:"node,omitempty"`
Openshift []string `json:"openshift,omitempty"`
OpenshiftCI []string `json:"openshiftci,omitempty"`
Ovsnode []string `json:"ovsnode,omitempty"`
PCIDevice []string `json:"pcidevice,omitempty"`
PGPU []string `json:"pgpu,omitempty"`
Prometheus []string `json:"prometheus,omitempty"`
QOS []string `json:"qos,omitempty"`
Resmon []string `json:"resmon,omitempty"`
RG []string `json:"rg,omitempty"`
Sep []string `json:"sep,omitempty"`
Stack []string `json:"stack,omitempty"`
Tasks []string `json:"tasks,omitempty"`
TLock []string `json:"tlock,omitempty"`
User []string `json:"user,omitempty"`
VGPU []string `json:"vgpu,omitempty"`
VINS []string `json:"vins,omitempty"`
VNFDev []string `json:"vnfdev,omitempty"`
ZeroAccess []string `json:"zeroaccess,omitempty"`
All bool `json:"ALL,omitempty"`
Account []string `json:"account,omitempty"`
APIAccess []string `json:"apiaccess,omitempty"`
Audit interface{} `json:"audit,omitempty"`
AuditBeat []string `json:"auditbeat,omitempty"`
AuditCollector []string `json:"auditcollector,omitempty"`
BackupCreator []string `json:"backupcreator,omitempty"`
BService []string `json:"bservice,omitempty"`
CloudSpace []string `json:"cloudspace,omitempty"`
Compute []string `json:"compute,omitempty"`
ComputeCI []string `json:"computeci,omitempty"`
Desnode []string `json:"desnode,omitempty"`
Diagnostics []string `json:"diagnostics,omitempty"`
Disks []string `json:"disks,omitempty"`
Eco []string `json:"eco,omitempty"`
ExtNet []string `json:"extnet,omitempty"`
FlIPgroup []string `json:"flipgroup,omitempty"`
Grid []string `json:"grid,omitempty"`
Group []string `json:"group,omitempty"`
Health []string `json:"health,omitempty"`
IaaS []string `json:"iaas,omitempty"`
Image []string `json:"image,omitempty"`
Job []string `json:"job,omitempty"`
K8CI []string `json:"k8ci,omitempty"`
K8S []string `json:"k8s,omitempty"`
KVMPPC []string `json:"kvmppc,omitempty"`
KVMX86 []string `json:"kvmx86,omitempty"`
LB []string `json:"lb,omitempty"`
Machine []string `json:"machine,omitempty"`
Metering []string `json:"metering,omitempty"`
Milestones []string `json:"milestones,omitempty"`
Node []string `json:"node,omitempty"`
Openshift []string `json:"openshift,omitempty"`
OpenshiftCI []string `json:"openshiftci,omitempty"`
Ovsnode []string `json:"ovsnode,omitempty"`
PCIDevice []string `json:"pcidevice,omitempty"`
PGPU []string `json:"pgpu,omitempty"`
Prometheus []string `json:"prometheus,omitempty"`
QOS []string `json:"qos,omitempty"`
Resmon []string `json:"resmon,omitempty"`
RG []string `json:"rg,omitempty"`
Sep []string `json:"sep,omitempty"`
Stack []string `json:"stack,omitempty"`
Tasks []string `json:"tasks,omitempty"`
TLock []string `json:"tlock,omitempty"`
User []string `json:"user,omitempty"`
VGPU []string `json:"vgpu,omitempty"`
VINS []string `json:"vins,omitempty"`
VNFDev []string `json:"vnfdev,omitempty"`
ZeroAccess []string `json:"zeroaccess,omitempty"`
All bool `json:"ALL,omitempty"`
}
type LibCloudEndpoints struct {

View File

@@ -0,0 +1,46 @@
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 (lid ListInfoDisks) IDs() []uint64 {
res := make([]uint64, 0, len(lid))
for _, d := range lid {
res = append(res, d.ID)
}
return res
}
// IDs gets array of PFWsIDs from ListPFW struct
func (lp ListPFW) IDs() []uint64 {
res := make([]uint64, 0, len(lp))
for _, p := range lp {
res = append(res, p.ID)
}
return res
}
// IDs gets array of DiskIDs from ListDisks struct
func (ld ListDisks) IDs() []uint64 {
res := make([]uint64, 0, len(ld))
for _, d := range ld {
res = append(res, d.ID)
}
return res
}
// IDs gets array of PCIDeviceIDs from ListPCIDevices struct
func (lpd ListPCIDevices) IDs() []uint64 {
res := make([]uint64, 0, len(lpd.Data))
for _, pd := range lpd.Data {
res = append(res, pd.ID)
}
return res
}

View File

@@ -720,10 +720,13 @@ type RecordCompute struct {
InfoCompute
}
// Information about of disk IDs
type ListInfoDisks []InfoDisk
// Main information about compute for list
type ItemCompute struct {
// List of disk IDs
Disks []InfoDisk `json:"disks"`
Disks ListInfoDisks `json:"disks"`
// Main information about compute
InfoCompute

View File

@@ -0,0 +1,20 @@
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 ListUnattachedDisks struct
func (ldu ListUnattachedDisks) IDs() []uint64 {
res := make([]uint64, 0, len(ldu.Data))
for _, d := range ldu.Data {
res = append(res, d.ID)
}
return res
}

View File

@@ -0,0 +1,19 @@
package extnet
// IDs gets array of ExtNetIDs from ListExtNet struct
func (le ListExtNet) 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 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
}

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
}

View File

@@ -0,0 +1,19 @@
package grid
// IDs gets array of GRIDID from ListGrids struct
func (lg ListGrids) IDs() []uint64 {
res := make([]uint64, 0, len(lg.Data))
for _, e := range lg.Data {
res = append(res, e.GID)
}
return res
}
// IDs gets array of GRIDID from ListResourceConsumption struct
func (lg ListResourceConsumption) IDs() []uint64 {
res := make([]uint64, 0, len(lg.Data))
for _, e := range lg.Data {
res = append(res, e.GID)
}
return res
}

View File

@@ -0,0 +1,28 @@
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 StackIDs from ListStacks struct
func (ls ListStacks) IDs() []uint64 {
res := make([]uint64, 0, len(ls.Data))
for _, h := range ls.Data {
res = append(res, h.ID)
}
return res
}
// IDs gets array of HistoryIDs from ListHistory struct
func (lh ListHistory) IDs() []uint64 {
res := make([]uint64, 0, len(lh))
for _, h := range lh {
res = append(res, h.ID)
}
return res
}

View File

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

View File

@@ -0,0 +1,30 @@
package k8s
// IDs gets array of K8SIDs from ListK8S struct
func (lk ListK8S) 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 ListK8SGroup) 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/cloudbroker/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 pcidevice
// IDs gets array of PCIDeviceIDs from ListPCIDevices struct
func (lpd ListPCIDevices) IDs() []uint64 {
res := make([]uint64, 0, len(lpd.Data))
for _, lb := range lpd.Data {
res = append(res, lb.ID)
}
return res
}

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

@@ -0,0 +1,55 @@
package rg
// IDs gets array of ResourceGroupIDs from ListRG struct
func (lrg ListRG) 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 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 _, vi := range llb.Data {
res = append(res, vi.ID)
}
return res
}
// IDs gets array of ResourceGroupIDs from ListResourceConsumption struct
func (lrc ListResourceConsumption) IDs() []uint64 {
res := make([]uint64, 0, len(lrc.Data))
for _, rg := range lrc.Data {
res = append(res, rg.RGID)
}
return res
}
// IDs gets array of VINSIDs from ListPFW struct
func (lpfw ListPFW) IDs() []uint64 {
res := make([]uint64, 0, len(lpfw.Data))
for _, pfw := range lpfw.Data {
res = append(res, pfw.VINSID)
}
return res
}

View File

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

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
}

View File

@@ -0,0 +1,10 @@
package user
// IDs gets array of UserIDs from ListAPIAccess struct
func (us ListAPIAccess) IDs() []uint64 {
res := make([]uint64, 0, len(us))
for _, us := range us {
res = append(res, us.ID)
}
return res
}

View File

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

View File

@@ -0,0 +1,55 @@
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 NATRuleIDs from ListNATRules struct
func (lnr ListNATRules) IDs() []uint64 {
res := make([]uint64, 0, len(lnr.Data))
for _, nrc := range lnr.Data {
res = append(res, nrc.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
}
// IDs gets array of NATRuleConfigIDs from ListNatRule struct
func (lnrc ListNatRule) IDs() []uint64 {
res := make([]uint64, 0, len(lnrc))
for _, nrc := range lnrc {
res = append(res, nrc.ID)
}
return res
}

View File

@@ -336,6 +336,9 @@ type RecordGW struct {
InfoVNF
}
// List NATRules
type ListNatRule []ItemNATRule
// NAT config
type NATConfig struct {
// Network mask
@@ -345,7 +348,7 @@ type NATConfig struct {
Network string `json:"network"`
// Rules
Rules []ItemNATRule `json:"rules"`
Rules ListNatRule `json:"rules"`
}
// Main information about NAT