Files
decort-golang-sdk/pkg/cloudbroker/compute/ids.go
2024-03-14 14:52:56 +03:00

47 lines
1.0 KiB
Go

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.Data))
for _, p := range lp.Data {
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
}