Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7b30fb686 | |||
| cf11855fa3 | |||
| f111787976 | |||
| 84c0248019 |
25
CHANGELOG.md
25
CHANGELOG.md
@@ -1,20 +1,7 @@
|
||||
## Version 1.6.7
|
||||
## Version 1.6.12
|
||||
|
||||
## Bugfix
|
||||
- Refactoring client and legacy-client
|
||||
- Delete tag "required" in RecursiveDelete field model DeleteUserRequest in cloudbroker/account/delete_user
|
||||
- Delete tag "omitempty" in RecursiveDelete field model DeleteUserRequest in cloudapi/account/delete_user
|
||||
- Delete tag "required" in Ratio field model SetCPUAllocationRatioRequest in cloudbroker/account/set_cpu_allocation_ratio
|
||||
- Change tag from "requireD" to "required" in K8SID field model WorkerRestartRequest in cloudbroker/k8s/worker_restart
|
||||
- Add tag "required" in UserIDs field model DeleteUsersRequest in cloudbroker/users/delete_users
|
||||
- Change tag "validate" in ComputeID field model SnapshotEvictDiskRequest in cloudbroker/compute/snapshot_evict_disk
|
||||
- Delete unnecessary validation in ListRaw method in cloudbroker/apiaccess/list
|
||||
- Delete unnecessary validation in ListDeleted method in cloudbroker/apiaccess/list_deleted
|
||||
- Delete unnecessary validation in GetAudit method in cloudbroker/user/get_audit
|
||||
- Delete unnecessary validation in ListRaw method in cloudbroker/user/list
|
||||
- Delete unnecessary validation in ListTypes method in cloudbroker/disks/list_types
|
||||
- Delete tag "required" in Active field model ListRequest in cloudbroker/group/list
|
||||
- Delete unnecessary validation in List method in cloudbroker/group/list
|
||||
- Change type from "APIsEndpoints" to "APIString" in APIs field in APIsIncludeRequest model in cloudbroker/apiaccess/apis_include
|
||||
- Change type from "APIsEndpoints" to "APIString" in APIs field in APIsExcludeRequest model in cloudbroker/apiaccess/apis_exclude
|
||||
- Refactoring multiple errors out put after validation in all cloudapi and cloudbroker groups, in client and legacy-client
|
||||
### Bugfix
|
||||
- Fix allowed network plugin value from "weawenet" to "weavenet" in validators for cloudapi/k8s, cloudbroker/k8s and cloudbroker/k8ci
|
||||
- Delete omitempty from json, url tags in field Permanently in model DeleteRequest in cloudbroker/k8ci and cloudbroker/k8s
|
||||
- Fix panic in SnapshotList method in cloudapi/bservice
|
||||
- Fix panic in AffinityGroupsList method in cloudapi/rg
|
||||
46
README.md
46
README.md
@@ -766,6 +766,52 @@ func main() {
|
||||
|
||||
```
|
||||
|
||||
### Получение списка уникальных идентификаторов (ID) объекта
|
||||
|
||||
Для всех структур, имеющих поля со списками объектов с уникальными числовыми идентификаторами (ID), добавлены методы IDs(), возвращающие массивы уникальных идентификаторов объектов в этих списках.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"fmt"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/config"
|
||||
decort "repository.basistech.ru/BASIS/decort-golang-sdk"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/bservice"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Настройка конфигурации
|
||||
cfg := config.Config{
|
||||
AppID: "<APPID>",
|
||||
AppSecret: "<APPSECRET>",
|
||||
SSOURL: "https://sso.digitalenergy.online",
|
||||
DecortURL: "https://mr4.digitalenergy.online",
|
||||
Retries: 5,
|
||||
}
|
||||
|
||||
// Создание клиента
|
||||
client := decort.New(cfg)
|
||||
|
||||
// Создание структуры запроса GetRequest на получение информации о сервисе и выполнение запроса с помощью конвейера
|
||||
req := bservice.GetRequest{
|
||||
ServiceID: 123,
|
||||
}
|
||||
res, err := client.CloudAPI().BService().Get(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Получение списков ID ComputeIDs и GroupIDs экземпляра res типа RecordBasicService по полям Computes и Groups, соответственно
|
||||
computeIDs := res.Computes.IDs()
|
||||
groupIDs := res.Groups.IDs()
|
||||
fmt.Println(computeIDs)
|
||||
fmt.Println(groupIDs)
|
||||
}
|
||||
```
|
||||
|
||||
## Работа с legacy клиентом
|
||||
|
||||
Работа с legacy клиентом применяется для пользователей, которые не используют для авторизации decs3o.
|
||||
|
||||
60
client.go
60
client.go
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
@@ -97,22 +96,11 @@ func (dc *DecortClient) DecortApiCall(ctx context.Context, method, url string, p
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := dc.do(req, ctype)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
// perform request
|
||||
var respBytes []byte
|
||||
respBytes, err = dc.do(req, ctype)
|
||||
|
||||
respBytes, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, errors.New(string(respBytes))
|
||||
}
|
||||
|
||||
return respBytes, nil
|
||||
return respBytes, err
|
||||
}
|
||||
|
||||
func (dc *DecortClient) getToken(ctx context.Context) error {
|
||||
@@ -149,7 +137,7 @@ func (dc *DecortClient) getToken(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dc *DecortClient) do(req *http.Request, ctype string) (*http.Response, error) {
|
||||
func (dc *DecortClient) do(req *http.Request, ctype string) ([]byte, error) {
|
||||
if ctype != "" {
|
||||
req.Header.Add("Content-Type", ctype)
|
||||
} else {
|
||||
@@ -159,25 +147,27 @@ func (dc *DecortClient) do(req *http.Request, ctype string) (*http.Response, err
|
||||
req.Header.Add("Authorization", "bearer "+dc.cfg.Token)
|
||||
req.Header.Set("Accept", "application/json")
|
||||
|
||||
// var resp *http.Response
|
||||
// var err error
|
||||
buf, _ := io.ReadAll(req.Body)
|
||||
// req = req.Clone(req.Context())
|
||||
|
||||
// for i := uint64(0); i < dc.cfg.Retries; i++ {
|
||||
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
resp, err := dc.client.Do(req)
|
||||
|
||||
// if err == nil {
|
||||
if resp.StatusCode == 200 {
|
||||
return resp, err
|
||||
buf, err := io.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respBytes, _ := io.ReadAll(resp.Body)
|
||||
err = fmt.Errorf("%s", respBytes)
|
||||
resp.Body.Close()
|
||||
// }
|
||||
// }
|
||||
|
||||
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
resp, err := dc.client.Do(req)
|
||||
if err != nil || resp == nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
// handle successful request
|
||||
respBytes, _ := io.ReadAll(resp.Body)
|
||||
if resp.StatusCode == 200 {
|
||||
return respBytes, nil
|
||||
}
|
||||
|
||||
// handle errors with status code other than 200
|
||||
err = fmt.Errorf("%s", respBytes)
|
||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
||||
}
|
||||
|
||||
@@ -402,7 +392,7 @@ func createK8sCloudBroker(req k8s_cb.CreateRequest) (*bytes.Buffer, string) {
|
||||
}
|
||||
|
||||
_ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly))
|
||||
|
||||
|
||||
ct := writer.FormDataContentType()
|
||||
|
||||
writer.Close()
|
||||
|
||||
@@ -39,7 +39,7 @@ var (
|
||||
|
||||
sepFieldTypeValues = []string{"int", "str", "bool", "list", "dict"}
|
||||
|
||||
networkPluginValues = []string{"flannel", "weawenet", "calico"}
|
||||
networkPluginValues = []string{"flannel", "weavenet", "calico"}
|
||||
|
||||
strictLooseValues = []string{"strict", "loose"}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
@@ -78,7 +77,7 @@ func (ldc *LegacyDecortClient) DecortApiCall(ctx context.Context, method, url st
|
||||
|
||||
k8sCaCreateReq, okCa := params.(k8s_ca.CreateRequest)
|
||||
k8sCbCreateReq, okCb := params.(k8s_cb.CreateRequest)
|
||||
|
||||
|
||||
var body *bytes.Buffer
|
||||
var ctype string
|
||||
|
||||
@@ -93,28 +92,17 @@ func (ldc *LegacyDecortClient) DecortApiCall(ctx context.Context, method, url st
|
||||
}
|
||||
body = bytes.NewBufferString(values.Encode() + fmt.Sprintf("&authkey=%s", ldc.cfg.Token))
|
||||
}
|
||||
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, method, ldc.decortURL+"/restmachine"+url, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := ldc.do(req, ctype)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
// perform request
|
||||
var respBytes []byte
|
||||
respBytes, err = ldc.do(req, ctype)
|
||||
|
||||
respBytes, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, errors.New(string(respBytes))
|
||||
}
|
||||
|
||||
return respBytes, nil
|
||||
return respBytes, err
|
||||
}
|
||||
|
||||
func (ldc *LegacyDecortClient) getToken(ctx context.Context) error {
|
||||
@@ -148,7 +136,7 @@ func (ldc *LegacyDecortClient) getToken(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ldc *LegacyDecortClient) do(req *http.Request, ctype string) (*http.Response, error) {
|
||||
func (ldc *LegacyDecortClient) do(req *http.Request, ctype string) ([]byte, error) {
|
||||
if ctype != "" {
|
||||
req.Header.Add("Content-Type", ctype)
|
||||
} else {
|
||||
@@ -156,26 +144,30 @@ func (ldc *LegacyDecortClient) do(req *http.Request, ctype string) (*http.Respon
|
||||
}
|
||||
req.Header.Set("Accept", "application/json")
|
||||
|
||||
// var resp *http.Response
|
||||
// var err error
|
||||
buf, _ := io.ReadAll(req.Body)
|
||||
// req = req.Clone(req.Context())
|
||||
|
||||
// for i := uint64(0); i < ldc.cfg.Retries; i++ {
|
||||
|
||||
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
resp, err := ldc.client.Do(req)
|
||||
|
||||
// if err == nil {
|
||||
if resp.StatusCode == 200 {
|
||||
return resp, err
|
||||
buf, err := io.ReadAll(req.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
respBytes, _ := io.ReadAll(resp.Body)
|
||||
err = fmt.Errorf("%s", respBytes)
|
||||
resp.Body.Close()
|
||||
// }
|
||||
// }
|
||||
req.Body.Close()
|
||||
req.Body = io.NopCloser(bytes.NewBuffer(buf))
|
||||
|
||||
resp, err := ldc.client.Do(req)
|
||||
if err != nil || resp == nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
// handle successful request
|
||||
respBytes, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if resp.StatusCode == 200 {
|
||||
return respBytes, nil
|
||||
}
|
||||
|
||||
// handle errors with status code other than 200
|
||||
err = fmt.Errorf("%s", respBytes)
|
||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
||||
}
|
||||
|
||||
@@ -402,7 +394,7 @@ func createK8sCloudBrokerLegacy(req k8s_cb.CreateRequest, token string) (*bytes.
|
||||
}
|
||||
|
||||
_ = writer.WriteField("extnetOnly", strconv.FormatBool(req.ExtNetOnly))
|
||||
|
||||
|
||||
_ = writer.WriteField("authkey", token)
|
||||
|
||||
ct := writer.FormDataContentType()
|
||||
|
||||
73
pkg/cloudapi/account/ids.go
Normal file
73
pkg/cloudapi/account/ids.go
Normal 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
|
||||
}
|
||||
37
pkg/cloudapi/bservice/ids.go
Normal file
37
pkg/cloudapi/bservice/ids.go
Normal 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
|
||||
}
|
||||
@@ -169,6 +169,15 @@ type ItemSnapshot struct {
|
||||
}
|
||||
|
||||
// List of Snapshots
|
||||
type ListInfoSnapshots struct {
|
||||
// Data
|
||||
Data ListSnapshots `json:"data"`
|
||||
|
||||
// EntryCount
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// List of Snapshots inside RecordBasicService
|
||||
type ListSnapshots []ItemSnapshot
|
||||
|
||||
// Main information about Group
|
||||
|
||||
@@ -16,7 +16,7 @@ type SnapshotListRequest struct {
|
||||
}
|
||||
|
||||
// SnapshotList gets list existing snapshots of the Basic Service
|
||||
func (b BService) SnapshotList(ctx context.Context, req SnapshotListRequest) (ListSnapshots, error) {
|
||||
func (b BService) SnapshotList(ctx context.Context, req SnapshotListRequest) (*ListInfoSnapshots, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
@@ -29,12 +29,12 @@ func (b BService) SnapshotList(ctx context.Context, req SnapshotListRequest) (Li
|
||||
return nil, err
|
||||
}
|
||||
|
||||
list := ListSnapshots{}
|
||||
list := ListInfoSnapshots{}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return list, nil
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
@@ -38,8 +38,8 @@ type AffinityRuleAddRequest struct {
|
||||
Key string `url:"key" json:"key" validate:"required"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value" json:"value" validate:"required"`
|
||||
// Required: false
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// AffinityRuleAdd add affinity rule
|
||||
|
||||
@@ -38,8 +38,8 @@ type AffinityRuleRemoveRequest struct {
|
||||
Key string `url:"key" json:"key" validate:"required"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value" json:"value" validate:"required"`
|
||||
// Required: false
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// AffinityRuleRemove remove affinity rule
|
||||
|
||||
@@ -38,8 +38,8 @@ type AntiAffinityRuleAddRequest struct {
|
||||
Key string `url:"key" json:"key" validate:"required"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value" json:"value" validate:"required"`
|
||||
// Required: false
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// AntiAffinityRuleAdd add anti affinity rule
|
||||
|
||||
@@ -38,8 +38,8 @@ type AntiAffinityRuleRemoveRequest struct {
|
||||
Key string `url:"key" json:"key" validate:"required"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value" json:"value" validate:"required"`
|
||||
// Required: false
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// AntiAffinityRuleRemove remove anti affinity rule
|
||||
|
||||
37
pkg/cloudapi/compute/ids.go
Normal file
37
pkg/cloudapi/compute/ids.go
Normal 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
|
||||
}
|
||||
@@ -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
28
pkg/cloudapi/disks/ids.go
Normal 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
|
||||
}
|
||||
19
pkg/cloudapi/extnet/ids.go
Normal file
19
pkg/cloudapi/extnet/ids.go
Normal 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
|
||||
}
|
||||
10
pkg/cloudapi/flipgroup/ids.go
Normal file
10
pkg/cloudapi/flipgroup/ids.go
Normal 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
19
pkg/cloudapi/image/ids.go
Normal 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
|
||||
}
|
||||
@@ -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
10
pkg/cloudapi/k8ci/ids.go
Normal 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
|
||||
}
|
||||
@@ -29,7 +29,7 @@ type CreateRequest struct {
|
||||
WorkerGroupName string `url:"workerGroupName" json:"workerGroupName" validate:"required,workerGroupName"`
|
||||
|
||||
// Network plugin
|
||||
// Must be one of these values: flannel, weawenet, calico
|
||||
// Must be one of these values: flannel, weavenet, calico
|
||||
// Required: true
|
||||
NetworkPlugin string `url:"networkPlugin" json:"networkPlugin" validate:"required,networkPlugin"`
|
||||
|
||||
|
||||
28
pkg/cloudapi/k8s/ids.go
Normal file
28
pkg/cloudapi/k8s/ids.go
Normal 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
10
pkg/cloudapi/lb/ids.go
Normal 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
|
||||
}
|
||||
10
pkg/cloudapi/locations/ids.go
Normal file
10
pkg/cloudapi/locations/ids.go
Normal 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
55
pkg/cloudapi/rg/ids.go
Normal 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
|
||||
}
|
||||
@@ -331,9 +331,18 @@ type ItemAffinityGroupComputes struct {
|
||||
// List of affinity groups
|
||||
type ListAffinityGroupsComputes []ItemAffinityGroupComputes
|
||||
|
||||
// Main information about
|
||||
type ItemAffinityGroup struct {
|
||||
ID uint64 `json:"id"`
|
||||
NodeID uint64 `json:"node_id"`
|
||||
}
|
||||
|
||||
// List of affinity group
|
||||
type ListAffinityGroup []ItemAffinityGroup
|
||||
|
||||
type ListAffinityGroups struct {
|
||||
// Data
|
||||
Data []map[string][]uint64 `json:"data"`
|
||||
Data []map[string]ListAffinityGroup `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
|
||||
10
pkg/cloudapi/sizes/ids.go
Normal file
10
pkg/cloudapi/sizes/ids.go
Normal 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
10
pkg/cloudapi/stack/ids.go
Normal 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
64
pkg/cloudapi/vins/ids.go
Normal 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
|
||||
}
|
||||
64
pkg/cloudbroker/account/ids.go
Normal file
64
pkg/cloudbroker/account/ids.go
Normal 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
|
||||
}
|
||||
10
pkg/cloudbroker/apiaccess/ids.go
Normal file
10
pkg/cloudbroker/apiaccess/ids.go
Normal 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
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -40,8 +40,8 @@ type AffinityRuleAddRequest struct {
|
||||
Key string `url:"key" json:"key" validate:"required"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value" json:"value" validate:"required"`
|
||||
// Required: false
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// AffinityRuleAdd adds affinity rule
|
||||
|
||||
@@ -38,8 +38,8 @@ type AffinityRuleRemoveRequest struct {
|
||||
Key string `url:"key" json:"key" validate:"required"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value" json:"value" validate:"required"`
|
||||
// Required: false
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// AffinityRuleRemove remove affinity rule
|
||||
|
||||
@@ -38,8 +38,8 @@ type AntiAffinityRuleAddRequest struct {
|
||||
Key string `url:"key" json:"key" validate:"required"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value" json:"value" validate:"required"`
|
||||
// Required: false
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// AntiAffinityRuleAdd adds anti affinity rule
|
||||
|
||||
@@ -38,8 +38,8 @@ type AntiAffinityRuleRemoveRequest struct {
|
||||
Key string `url:"key" json:"key" validate:"required"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value" json:"value" validate:"required"`
|
||||
// Required: false
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
// AntiAffinityRuleRemove removes anti affinity rule
|
||||
|
||||
46
pkg/cloudbroker/compute/ids.go
Normal file
46
pkg/cloudbroker/compute/ids.go
Normal 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
|
||||
}
|
||||
@@ -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
|
||||
|
||||
20
pkg/cloudbroker/disks/ids.go
Normal file
20
pkg/cloudbroker/disks/ids.go
Normal 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
|
||||
}
|
||||
|
||||
19
pkg/cloudbroker/extnet/ids.go
Normal file
19
pkg/cloudbroker/extnet/ids.go
Normal 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
|
||||
}
|
||||
10
pkg/cloudbroker/flipgroup/ids.go
Normal file
10
pkg/cloudbroker/flipgroup/ids.go
Normal 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/cloudbroker/grid/ids.go
Normal file
19
pkg/cloudbroker/grid/ids.go
Normal 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
|
||||
}
|
||||
28
pkg/cloudbroker/image/ids.go
Normal file
28
pkg/cloudbroker/image/ids.go
Normal 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
|
||||
}
|
||||
@@ -60,7 +60,7 @@ type CreateRequest struct {
|
||||
MaxWorkerCount uint64 `url:"maxWorkerCount" json:"maxWorkerCount" validate:"required"`
|
||||
|
||||
// Network plugins
|
||||
// Values of slice must be flannel, weawenet or calico
|
||||
// Values of slice must be flannel, weavenet or calico
|
||||
//Required: true
|
||||
NetworkPlugins []string `url:"networkPlugins" json:"networkPlugins" validate:"required,networkPlugins"`
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ type DeleteRequest struct {
|
||||
|
||||
// Delete permanently or not
|
||||
// Required: false
|
||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
||||
Permanently bool `url:"permanently" json:"permanently"`
|
||||
}
|
||||
|
||||
// Delete deletes K8CI by ID
|
||||
|
||||
10
pkg/cloudbroker/k8ci/ids.go
Normal file
10
pkg/cloudbroker/k8ci/ids.go
Normal 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
|
||||
}
|
||||
@@ -29,7 +29,7 @@ type CreateRequest struct {
|
||||
WorkerGroupName string `url:"workerGroupName" json:"workerGroupName" validate:"required,workerGroupName"`
|
||||
|
||||
// Network plugin
|
||||
// Must be one of these values: flunnel, weawenet, calico
|
||||
// Must be one of these values: flannel, weavenet, calico
|
||||
// Required: true
|
||||
NetworkPlugin string `url:"networkPlugin" json:"networkPlugin" validate:"required,networkPlugin"`
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ type DeleteRequest struct {
|
||||
// True if cluster is destroyed permanently.
|
||||
// Otherwise it can be restored from recycle bin
|
||||
// Required: false
|
||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
||||
Permanently bool `url:"permanently" json:"permanently"`
|
||||
}
|
||||
|
||||
// Delete deletes kubernetes cluster
|
||||
|
||||
30
pkg/cloudbroker/k8s/ids.go
Normal file
30
pkg/cloudbroker/k8s/ids.go
Normal 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
10
pkg/cloudbroker/lb/ids.go
Normal 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
|
||||
}
|
||||
10
pkg/cloudbroker/pcidevice/ids.go
Normal file
10
pkg/cloudbroker/pcidevice/ids.go
Normal 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
55
pkg/cloudbroker/rg/ids.go
Normal 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
|
||||
}
|
||||
10
pkg/cloudbroker/sep/ids.go
Normal file
10
pkg/cloudbroker/sep/ids.go
Normal 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
|
||||
}
|
||||
10
pkg/cloudbroker/stack/ids.go
Normal file
10
pkg/cloudbroker/stack/ids.go
Normal 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
|
||||
}
|
||||
10
pkg/cloudbroker/user/ids.go
Normal file
10
pkg/cloudbroker/user/ids.go
Normal 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
|
||||
}
|
||||
10
pkg/cloudbroker/vgpu/ids.go
Normal file
10
pkg/cloudbroker/vgpu/ids.go
Normal 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
|
||||
}
|
||||
55
pkg/cloudbroker/vins/ids.go
Normal file
55
pkg/cloudbroker/vins/ids.go
Normal 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
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user