This commit is contained in:
stSolo
2022-12-22 17:56:47 +03:00
parent 8712561853
commit d4b1ab7133
672 changed files with 28509 additions and 4419 deletions

View File

@@ -6,26 +6,36 @@ import (
"net/http"
)
// Request struct for get list external network
type ListRequest struct {
AccountID uint64 `url:"accountId"`
Page uint64 `url:"page"`
Size uint64 `url:"size"`
// Filter by account ID
// Required: false
AccountID uint64 `url:"accountId,omitempty"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty"`
}
func (e ExtNet) List(ctx context.Context, req ListRequest) (ExtNetList, error) {
// List gets list all available external networks
func (e ExtNet) List(ctx context.Context, req ListRequest) (ListExtNets, error) {
url := "/cloudapi/extnet/list"
extnetListRaw, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
extnetList := ExtNetList{}
err = json.Unmarshal(extnetListRaw, &extnetList)
list := ListExtNets{}
err = json.Unmarshal(res, &list)
if err != nil {
return nil, err
}
return extnetList, nil
return list, nil
}