Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42800ac4fe | ||
|
|
de12bc2acc | ||
|
|
46af79b664 | ||
|
|
84bcd2eb53 | ||
|
|
cc9aa2a6fc | ||
|
|
7ddd8c5fbe |
11
CHANGELOG.md
11
CHANGELOG.md
@@ -1,6 +1,11 @@
|
||||
## Version 1.0.2
|
||||
## Version 1.2.0
|
||||
|
||||
### Bug fixes
|
||||
|
||||
- Update tags for Kubernetes create
|
||||
- Add License file
|
||||
#### Client
|
||||
|
||||
- Added legacy client authorization support
|
||||
|
||||
#### All
|
||||
|
||||
- Add json tags for requests
|
||||
|
||||
75
README.md
75
README.md
@@ -2,6 +2,12 @@
|
||||
|
||||
Decort SDK - это библиотека, написанная на языке GO, позволяющая взаимодействовать с API облачной платформы **DECORT**. Библиотека содеражит в себе структуры и методы, необходимые для отправки запросов. Decort SDK имеет встроенный http-клиент и поддерживает разные способы авторизации на платформе. Библиотека так же содержит в себе модели ответов от платформы.
|
||||
|
||||
## Версии
|
||||
|
||||
- Версия 1.0.x Decort-SDK соответствует 3.8.4 версии платформы
|
||||
- Версия 1.1.x Decort-SDK соответствует 3.8.5 версии платформы
|
||||
- Версия 1.2.x Decort-SDK соответствует 3.8.5 версии платформы
|
||||
|
||||
## Оглавление
|
||||
|
||||
- [Установка](#установка)
|
||||
@@ -13,6 +19,11 @@ Decort SDK - это библиотека, написанная на языке G
|
||||
- [Создание клиента](#создание-клиента)
|
||||
- [Создание структуры запроса](#cоздание-структуры-запроса)
|
||||
- [Выполнение запроса](#выполнение-запроса)
|
||||
- [Работа с legacy клиентом](#работа-с-legacy-клиентом)
|
||||
- [Настройка конфигурации legacy клиента](#настройка-конфигурации-legacy-клиента)
|
||||
- [Создание legacy клиента](#создание-legacy-клиента)
|
||||
- [Создание структуры запроса](#cоздание-структуры-запроса)
|
||||
- [Выполнение запроса](#выполнение-запроса)
|
||||
|
||||
## Установка
|
||||
|
||||
@@ -417,7 +428,7 @@ func main() {
|
||||
}
|
||||
|
||||
//Выполнение запроса с помощью конвейера
|
||||
res, err := client.СloudAPI().KVMX86().Create(context.Background(), req)
|
||||
res, err := client.CloudAPI().KVMX86().Create(context.Background(), req)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@@ -425,3 +436,65 @@ func main() {
|
||||
fmt.Println(res)
|
||||
}
|
||||
```
|
||||
|
||||
## Работа с legacy клиентом
|
||||
|
||||
Работа с legacy клиентом применяется для пользователей, которые не используют для авторизации decs3o.
|
||||
|
||||
### Настройка конфигурации legacy клиента
|
||||
|
||||
Сначала, необходимо создать переменную конфигурации клиента. Конфигурация состоит как из обязательных, так и необязательных полей.
|
||||
|
||||
| Поле | Тип | Обязательный | Описание |
|
||||
| ------------- | ------ | ------------ | ------------------------------------------------------------------ |
|
||||
| Username | string | Да | username legacy пользователя |
|
||||
| Password | string | Да | пароль legacy пользователя |
|
||||
| DecortURL | string | Да | URL адрес платформы, с которой будет осуществляться взаимодействие |
|
||||
| Retries | uint | Нет | Кол-во неудачных попыток выполнения запроса, по умолчанию - 5 |
|
||||
| SSLSkipVerify | bool | Нет | Пропуск проверки подлинности сертификата, по умолчанию - true |
|
||||
| Token | string | Нет | JWT токен |
|
||||
|
||||
Пример кода:
|
||||
|
||||
```go
|
||||
import (
|
||||
"github.com/rudecs/decort-sdk/config"
|
||||
)
|
||||
func main(){
|
||||
// Настройка конфигурации
|
||||
legacyCfg := config.LegacyConfig{
|
||||
Username: "<USERNAME>",
|
||||
Password: "<PASSWORD>",
|
||||
DecortURL: "https://mr4.digitalenergy.online",
|
||||
Retries: 5,
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Создание legacy клиента
|
||||
|
||||
Создание клиента происходит с помощью функции-строителя `NewLegacy` из основного пакета `decort-sdk`, для избежания проблем с именами, пакету можно присвоить алиас `decort`. Функция принимает конфигурацию, возвращает структуру `DecortClient`, с помощью которой можно взаимодействовать с платформой.
|
||||
|
||||
### Пример
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/rudecs/decort-sdk/config"
|
||||
decort "github.com/rudecs/decort-sdk"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Настройка конфигурации
|
||||
legacyCfg := config.LegacyConfig{
|
||||
Username: "<USERNAME>",
|
||||
Password: "<PASSWORD>",
|
||||
DecortURL: "https://mr4.digitalenergy.online",
|
||||
Retries: 5,
|
||||
}
|
||||
|
||||
// Создание клиента
|
||||
legacyClient := decort.NewLegacy(cfg)
|
||||
}
|
||||
```
|
||||
|
||||
33
config/legacy-config.go
Normal file
33
config/legacy-config.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package config
|
||||
|
||||
// Legacy client configuration
|
||||
type LegacyConfig struct {
|
||||
// ServiceAccount username
|
||||
// Required: true
|
||||
// Example : "osh_mikoev"
|
||||
Username string
|
||||
|
||||
// ServiceAccount password
|
||||
// Required: true
|
||||
// Example: "[1o>hYkjnJr)HI78q7t&#%8Lm"
|
||||
Password string
|
||||
|
||||
// Platform token
|
||||
// Required: false
|
||||
// Example: "158e76424b0d4810b6086hgbhj928fc4a6bc06e"
|
||||
Token string
|
||||
|
||||
// Address of the platform on which the actions are planned
|
||||
// Required: true
|
||||
// Example: "https://mr4.digitalenergy.online"
|
||||
DecortURL string
|
||||
|
||||
// Amount platform request attempts
|
||||
// Default value: 5
|
||||
// Required: false
|
||||
Retries uint64
|
||||
|
||||
// Skip verify, true by default
|
||||
// Required: false
|
||||
SSLSkipVerify bool
|
||||
}
|
||||
@@ -29,7 +29,7 @@ func NewHttpClient(cfg config.Config) *http.Client {
|
||||
retries: cfg.Retries,
|
||||
clientID: cfg.AppID,
|
||||
clientSecret: cfg.AppSecret,
|
||||
SSOURL: cfg.SSOURL,
|
||||
ssoURL: cfg.SSOURL,
|
||||
token: cfg.Token,
|
||||
expiryTime: expiredTime,
|
||||
//TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
|
||||
32
internal/client/legacy-http-client.go
Normal file
32
internal/client/legacy-http-client.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/rudecs/decort-sdk/config"
|
||||
)
|
||||
|
||||
// NewLegacyHttpClient creates legacy HTTP Client
|
||||
func NewLegacyHttpClient(cfg config.LegacyConfig) *http.Client {
|
||||
transCfg := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{
|
||||
//nolint:gosec
|
||||
InsecureSkipVerify: cfg.SSLSkipVerify,
|
||||
},
|
||||
}
|
||||
|
||||
return &http.Client{
|
||||
Transport: &transportLegacy{
|
||||
base: transCfg,
|
||||
username: cfg.Username,
|
||||
password: cfg.Password,
|
||||
retries: cfg.Retries,
|
||||
token: cfg.Token,
|
||||
decortURL: cfg.DecortURL,
|
||||
},
|
||||
|
||||
Timeout: 5 * time.Minute,
|
||||
}
|
||||
}
|
||||
68
internal/client/legacy-transport.go
Normal file
68
internal/client/legacy-transport.go
Normal file
@@ -0,0 +1,68 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type transportLegacy struct {
|
||||
base http.RoundTripper
|
||||
username string
|
||||
password string
|
||||
retries uint64
|
||||
token string
|
||||
decortURL string
|
||||
}
|
||||
|
||||
func (t *transportLegacy) RoundTrip(request *http.Request) (*http.Response, error) {
|
||||
if t.token == "" {
|
||||
body := fmt.Sprintf("username=%s&password=%s", t.username, t.password)
|
||||
bodyReader := strings.NewReader(body)
|
||||
|
||||
req, _ := http.NewRequestWithContext(request.Context(), "POST", t.decortURL+"/restmachine/cloudapi/user/authenticate", bodyReader)
|
||||
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
|
||||
resp, err := t.base.RoundTrip(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get token: %w", err)
|
||||
}
|
||||
|
||||
tokenBytes, _ := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("unable to get token: %s", tokenBytes)
|
||||
}
|
||||
|
||||
token := string(tokenBytes)
|
||||
t.token = token
|
||||
}
|
||||
|
||||
tokenValue := fmt.Sprintf("authkey=%s", t.token)
|
||||
tokenReader := strings.NewReader(tokenValue)
|
||||
|
||||
req, _ := http.NewRequestWithContext(request.Context(), request.Method, request.URL.String(), tokenReader)
|
||||
|
||||
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
req.Header.Set("Accept", "application/json")
|
||||
|
||||
var resp *http.Response
|
||||
var err error
|
||||
for i := uint64(0); i < t.retries; i++ {
|
||||
resp, err = t.base.RoundTrip(req)
|
||||
if err == nil {
|
||||
if resp.StatusCode == 200 {
|
||||
return resp, nil
|
||||
}
|
||||
respBytes, _ := io.ReadAll(resp.Body)
|
||||
err = fmt.Errorf("%s", respBytes)
|
||||
resp.Body.Close()
|
||||
}
|
||||
|
||||
time.Sleep(time.Second * 5)
|
||||
}
|
||||
return nil, fmt.Errorf("could not execute request: %w", err)
|
||||
}
|
||||
@@ -14,7 +14,7 @@ type transport struct {
|
||||
clientID string
|
||||
clientSecret string
|
||||
token string
|
||||
SSOURL string
|
||||
ssoURL string
|
||||
expiryTime time.Time
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
body := fmt.Sprintf("grant_type=client_credentials&client_id=%s&client_secret=%s&response_type=id_token", t.clientID, t.clientSecret)
|
||||
bodyReader := strings.NewReader(body)
|
||||
|
||||
req, _ := http.NewRequestWithContext(req.Context(), "POST", t.SSOURL+"/v1/oauth/access_token", bodyReader)
|
||||
req, _ := http.NewRequestWithContext(req.Context(), "POST", t.ssoURL+"/v1/oauth/access_token", bodyReader)
|
||||
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
|
||||
resp, err := t.base.RoundTrip(req)
|
||||
|
||||
74
legacy-client.go
Normal file
74
legacy-client.go
Normal file
@@ -0,0 +1,74 @@
|
||||
package decortsdk
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/google/go-querystring/query"
|
||||
"github.com/rudecs/decort-sdk/config"
|
||||
"github.com/rudecs/decort-sdk/internal/client"
|
||||
"github.com/rudecs/decort-sdk/pkg/cloudapi"
|
||||
"github.com/rudecs/decort-sdk/pkg/cloudbroker"
|
||||
)
|
||||
|
||||
// Legacy HTTP-client for platform
|
||||
type LegacyDecortClient struct {
|
||||
decortURL string
|
||||
client *http.Client
|
||||
}
|
||||
|
||||
// Legacy client builder
|
||||
func NewLegacy(cfg config.LegacyConfig) *LegacyDecortClient {
|
||||
if cfg.Retries == 0 {
|
||||
cfg.Retries = 5
|
||||
}
|
||||
|
||||
return &LegacyDecortClient{
|
||||
decortURL: cfg.DecortURL,
|
||||
client: client.NewLegacyHttpClient(cfg),
|
||||
}
|
||||
}
|
||||
|
||||
// CloudAPI builder
|
||||
func (ldc *LegacyDecortClient) CloudAPI() *cloudapi.CloudAPI {
|
||||
return cloudapi.New(ldc)
|
||||
}
|
||||
|
||||
// CloudBroker builder
|
||||
func (ldc *LegacyDecortClient) CloudBroker() *cloudbroker.CloudBroker {
|
||||
return cloudbroker.New(ldc)
|
||||
}
|
||||
|
||||
// DecortApiCall method for sending requests to the platform
|
||||
func (ldc *LegacyDecortClient) DecortApiCall(ctx context.Context, method, url string, params interface{}) ([]byte, error) {
|
||||
values, err := query.Values(params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
body := strings.NewReader(values.Encode())
|
||||
req, err := http.NewRequestWithContext(ctx, method, ldc.decortURL+"/restmachine"+url, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := ldc.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
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
|
||||
}
|
||||
@@ -13,18 +13,18 @@ import (
|
||||
type AddUserRequest struct {
|
||||
// ID of account to add to
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
|
||||
// Name of the user to be given rights
|
||||
// Required: true
|
||||
UserID string `url:"userId"`
|
||||
UserID string `url:"userId" json:"userId"`
|
||||
|
||||
// Account permission types:
|
||||
// - 'R' for read only access
|
||||
// - 'RCX' for Write
|
||||
// - 'ARCXDU' for Admin
|
||||
// Required: true
|
||||
AccessType string `url:"accesstype"`
|
||||
AccessType string `url:"accesstype" json:"accesstype"`
|
||||
}
|
||||
|
||||
func (arq AddUserRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type AuditsRequest struct {
|
||||
// ID of the account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq AuditsRequest) validate() error {
|
||||
|
||||
@@ -5,62 +5,49 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for creating account
|
||||
type CreateRequest struct {
|
||||
// Display name
|
||||
// Required: true
|
||||
Name string `url:"name"`
|
||||
Name string `url:"name" json:"name"`
|
||||
|
||||
// Name of the account
|
||||
// Required: true
|
||||
Username string `url:"username"`
|
||||
Username string `url:"username" json:"username"`
|
||||
|
||||
// Email
|
||||
// Required: false
|
||||
EmailAddress string `url:"emailaddress,omitempty"`
|
||||
EmailAddress string `url:"emailaddress,omitempty" json:"emailaddress,omitempty"`
|
||||
|
||||
// Max size of memory in MB
|
||||
// Required: false
|
||||
MaxMemoryCapacity uint64 `url:"maxMemoryCapacity,omitempty"`
|
||||
MaxMemoryCapacity int64 `url:"maxMemoryCapacity,omitempty" json:"maxMemoryCapacity,omitempty"`
|
||||
|
||||
// Max size of aggregated vdisks in GB
|
||||
// Required: false
|
||||
MaxVDiskCapacity uint64 `url:"maxVDiskCapacity,omitempty"`
|
||||
MaxVDiskCapacity int64 `url:"maxVDiskCapacity,omitempty" json:"maxVDiskCapacity,omitempty"`
|
||||
|
||||
// Max number of CPU cores
|
||||
// Required: false
|
||||
MaxCPUCapacity uint64 `url:"maxCPUCapacity,omitempty"`
|
||||
MaxCPUCapacity int64 `url:"maxCPUCapacity,omitempty" json:"maxCPUCapacity,omitempty"`
|
||||
|
||||
// Max sent/received network transfer peering
|
||||
// Required: false
|
||||
MaxNetworkPeerTransfer uint64 `url:"maxNetworkPeerTransfer,omitempty"`
|
||||
MaxNetworkPeerTransfer int64 `url:"maxNetworkPeerTransfer,omitempty" json:"maxNetworkPeerTransfer,omitempty"`
|
||||
|
||||
// Max number of assigned public IPs
|
||||
// Required: false
|
||||
MaxNumPublicIP uint64 `url:"maxNumPublicIP,omitempty"`
|
||||
MaxNumPublicIP int64 `url:"maxNumPublicIP,omitempty" json:"maxNumPublicIP,omitempty"`
|
||||
|
||||
// If true send emails when a user is granted access to resources
|
||||
// Required: false
|
||||
SendAccessEmails bool `url:"sendAccessEmails,omitempty"`
|
||||
SendAccessEmails bool `url:"sendAccessEmails,omitempty" json:"sendAccessEmails,omitempty"`
|
||||
|
||||
// Limit (positive) or disable (0) GPU resources
|
||||
// Required: false
|
||||
GPUUnits uint64 `url:"gpu_units,omitempty"`
|
||||
|
||||
// Resource types available to create in this account
|
||||
// Each element in a resource type slice must be one of:
|
||||
// - compute
|
||||
// - vins
|
||||
// - k8s
|
||||
// - openshift
|
||||
// - lb
|
||||
// - flipgroup
|
||||
// Required: false
|
||||
ResTypes []string `url:"resourceTypes,omitempty"`
|
||||
GPUUnits int64 `url:"gpu_units,omitempty" json:"gpu_units,omitempty"`
|
||||
}
|
||||
|
||||
func (arq CreateRequest) validate() error {
|
||||
@@ -70,14 +57,6 @@ func (arq CreateRequest) validate() error {
|
||||
if arq.Username == "" {
|
||||
return errors.New("validation-error: field Username can not be empty")
|
||||
}
|
||||
if len(arq.ResTypes) > 0 {
|
||||
for _, value := range arq.ResTypes {
|
||||
validate := validators.StringInSlice(value, []string{"compute", "vins", "k8s", "openshift", "lb", "flipgroup"})
|
||||
if !validate {
|
||||
return errors.New("validation-error: Every resource type specified should be one of [compute, vins, k8s, openshift, lb, flipgroup]")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -90,7 +69,7 @@ func (a Account) Create(ctx context.Context, req CreateRequest) (uint64, error)
|
||||
return 0, err
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/create"
|
||||
url := "/cloudapi/account/create"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
type DeleteRequest struct {
|
||||
// ID of account to delete
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
|
||||
// Whether to completely delete the account
|
||||
// Required: false
|
||||
Permanently bool `url:"permanently,omitempty"`
|
||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
||||
}
|
||||
|
||||
func (arq DeleteRequest) validate() error {
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type DeleteUserRequest struct {
|
||||
// ID of the account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
|
||||
// ID or emailaddress of the user to remove
|
||||
// Required: true
|
||||
UserID string `url:"userId"`
|
||||
UserID string `url:"userId" json:"userId"`
|
||||
|
||||
// Recursively revoke access rights from owned cloudspaces and vmachines
|
||||
// Required: false
|
||||
RecursiveDelete bool `url:"recursivedelete,omitempty"`
|
||||
RecursiveDelete bool `url:"recursivedelete,omitempty" json:"recursivedelete,omitempty"`
|
||||
}
|
||||
|
||||
func (arq DeleteUserRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type DisabelEnableRequest struct {
|
||||
// ID of account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq DisabelEnableRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type GetRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq GetRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type GetConsumedAccountUnitsRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq GetConsumedAccountUnitsRequest) validate() error {
|
||||
|
||||
@@ -13,11 +13,11 @@ import (
|
||||
type GetConsumedCloudUnitsByTypeRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
|
||||
// Cloud unit resource type
|
||||
// Required: true
|
||||
CUType string `url:"cutype"`
|
||||
CUType string `url:"cutype" json:"cutype"`
|
||||
}
|
||||
|
||||
func (arq GetConsumedCloudUnitsByTypeRequest) validate() error {
|
||||
|
||||
@@ -10,15 +10,15 @@ import (
|
||||
type GetConsumtionRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
|
||||
// Epoch represents the start time
|
||||
// Required: true
|
||||
Start uint64 `url:"start"`
|
||||
Start uint64 `url:"start" json:"start"`
|
||||
|
||||
// Epoch represents the end time
|
||||
// Required: true
|
||||
End uint64 `url:"end"`
|
||||
End uint64 `url:"end" json:"end"`
|
||||
}
|
||||
|
||||
func (arq GetConsumtionRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type GetReservedAccountUnitsRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq GetReservedAccountUnitsRequest) validate() error {
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
type ListRequest struct {
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page"`
|
||||
Page uint64 `url:"page" json:"page"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size"`
|
||||
Size uint64 `url:"size" json:"size"`
|
||||
}
|
||||
|
||||
// List gets list all accounts the user has access to
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type ListComputesRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq ListComputesRequest) validate() error {
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
type ListDeletedRequest struct {
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page"`
|
||||
Page uint64 `url:"page" json:"page"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size"`
|
||||
Size uint64 `url:"size" json:"size"`
|
||||
}
|
||||
|
||||
// ListDeleted gets list all deleted accounts the user has access to
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type ListDisksRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq ListDisksRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type ListFLIPGroupsRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq ListFLIPGroupsRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type ListRGRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq ListRGRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type ListTemplatesRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
|
||||
// Include deleted images
|
||||
// Required: false
|
||||
IncludeDeleted bool `url:"includedeleted"`
|
||||
IncludeDeleted bool `url:"includedeleted" json:"includedeleted"`
|
||||
}
|
||||
|
||||
func (arq ListTemplatesRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type ListVINSRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq ListVINSRequest) validate() error {
|
||||
|
||||
@@ -45,75 +45,6 @@ type ResourceLimits struct {
|
||||
GPUUnits float64 `json:"gpu_units"`
|
||||
}
|
||||
|
||||
// Main information of account
|
||||
type InfoAccount struct {
|
||||
// Segment
|
||||
DCLocation string `json:"DCLocation"`
|
||||
|
||||
// Key
|
||||
CKey string `jspn:"_ckey"`
|
||||
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
// Access Control List
|
||||
ACL []RecordACL `json:"acl"`
|
||||
|
||||
// Company
|
||||
Company string `json:"company"`
|
||||
|
||||
// Company URL
|
||||
CompanyURL string `json:"companyurl"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `jspn:"createdBy"`
|
||||
|
||||
// Created time
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
|
||||
// Deactiovation time
|
||||
DeactiovationTime float64 `json:"deactivationTime"`
|
||||
|
||||
// Deleted by
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
|
||||
// Deleted time
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
|
||||
// Display name
|
||||
DisplayName string `json:"displayname"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Resource Limits
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
|
||||
// If true send emails when a user is granted access to resources
|
||||
SendAccessEmails bool `json:"sendAccessEmails"`
|
||||
|
||||
// Service Account
|
||||
ServiceAccount bool `json:"serviceAccount"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Updated time
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
|
||||
// Version
|
||||
Version uint64 `json:"version"`
|
||||
|
||||
// List VINS in account
|
||||
VINS []uint64 `json:"vins"`
|
||||
}
|
||||
|
||||
// Main information in one of if the list of accounts
|
||||
type ItemAccount struct {
|
||||
// Access Control List
|
||||
@@ -147,7 +78,10 @@ type Resource struct {
|
||||
CPU int64 `json:"cpu"`
|
||||
|
||||
// Disk size
|
||||
DiskSize int64 `json:"disksize"`
|
||||
DiskSize float64 `json:"disksize"`
|
||||
|
||||
// Max disk size
|
||||
DiskSizeMax uint64 `json:"disksizemax"`
|
||||
|
||||
// Number of External IPs
|
||||
ExtIPs int64 `json:"extips"`
|
||||
@@ -160,6 +94,18 @@ type Resource struct {
|
||||
|
||||
// Number of RAM
|
||||
RAM int64 `json:"ram"`
|
||||
|
||||
// SEPs
|
||||
SEPs map[string]map[string]DiskUsage `json:"seps"`
|
||||
}
|
||||
|
||||
// Disk usage
|
||||
type DiskUsage struct {
|
||||
// Disk size
|
||||
DiskSize float64 `json:"disksize"`
|
||||
|
||||
// Disk size max
|
||||
DiskSizeMax uint64 `json:"disksizemax"`
|
||||
}
|
||||
|
||||
// Information about resources
|
||||
@@ -189,21 +135,84 @@ type Machines struct {
|
||||
Halted uint64 `json:"halted"`
|
||||
}
|
||||
|
||||
// Сomplete information about account
|
||||
// Main information about account
|
||||
type RecordAccount struct {
|
||||
// Main information about account
|
||||
InfoAccount
|
||||
// DCLocation
|
||||
DCLocation string `json:"DCLocation"`
|
||||
|
||||
// Resources
|
||||
Resources Resources `json:"Resources"`
|
||||
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// Access control list
|
||||
ACL []RecordACL `json:"acl"`
|
||||
|
||||
// Company
|
||||
Company string `json:"company"`
|
||||
|
||||
// Company URL
|
||||
CompanyURL string `json:"companyurl"`
|
||||
|
||||
// Computes
|
||||
Computes Computes `json:"computes"`
|
||||
|
||||
// Created by
|
||||
CreatedBy string `json:"createdBy"`
|
||||
|
||||
// Created time
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
|
||||
// Deactivation time
|
||||
DeactivationTime uint64 `json:"deactivationTime"`
|
||||
|
||||
// Deleted by
|
||||
DeletedBy string `json:"deletedBy"`
|
||||
|
||||
// Deleted time
|
||||
DeletedTime uint64 `json:"deletedTime"`
|
||||
|
||||
// Display name
|
||||
DisplayName string `json:"displayname"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// Machines
|
||||
Machines Machines `json:"machines"`
|
||||
|
||||
// Number of VINSes
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Resource limits
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
|
||||
// Resource types
|
||||
ResourceTypes []string `json:"resourceTypes"`
|
||||
|
||||
// Send access emails
|
||||
SendAccessEmails bool `json:"sendAccessEmails"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// UniqPools
|
||||
UniqPools []interface{} `json:"uniqPools"`
|
||||
|
||||
// Updated time
|
||||
UpdatedTime uint64 `json:"updatedTime"`
|
||||
|
||||
// Version
|
||||
Version uint64 `json:"version"`
|
||||
|
||||
// VINS
|
||||
VINS []uint64 `json:"vins"`
|
||||
|
||||
// VINSes
|
||||
VINSes uint64 `json:"vinses"`
|
||||
}
|
||||
|
||||
@@ -287,6 +296,9 @@ type ItemDisk struct {
|
||||
// ID SEP
|
||||
SEPID uint64 `json:"sepId"`
|
||||
|
||||
// Shareable
|
||||
Shareable bool `json:"shareable"`
|
||||
|
||||
// Max size
|
||||
SizeMax uint64 `json:"sizeMax"`
|
||||
|
||||
@@ -378,10 +390,10 @@ type ListAudits []ItemAudit
|
||||
// Information compute in resource group
|
||||
type RGComputes struct {
|
||||
// Number of started computes
|
||||
Started uint64 `json:"started"`
|
||||
Started uint64 `json:"Started"`
|
||||
|
||||
// Number of stopped computes
|
||||
Stopped uint64 `json:"stopped"`
|
||||
Stopped uint64 `json:"Stopped"`
|
||||
}
|
||||
|
||||
// Resources of Resource group
|
||||
@@ -390,12 +402,39 @@ type RGResources struct {
|
||||
Consumed Resource `json:"Consumed"`
|
||||
|
||||
// Limits
|
||||
Limits Resource `json:"Limits"`
|
||||
Limits LimitsRG `json:"Limits"`
|
||||
|
||||
// Reserved
|
||||
Reserved Resource `json:"Reserved"`
|
||||
}
|
||||
|
||||
// Resources used
|
||||
type LimitsRG struct {
|
||||
// Number of cores
|
||||
CPU int64 `json:"cpu"`
|
||||
|
||||
// Disk size
|
||||
DiskSize int64 `json:"disksize"`
|
||||
|
||||
// Max disk size
|
||||
DiskSizeMax int64 `json:"disksizemax"`
|
||||
|
||||
// Number of External IPs
|
||||
ExtIPs int64 `json:"extips"`
|
||||
|
||||
// External traffic
|
||||
ExtTraffic int64 `json:"exttraffic"`
|
||||
|
||||
// Number of grafic cores
|
||||
GPU int64 `json:"gpu"`
|
||||
|
||||
// Number of RAM
|
||||
RAM int64 `json:"ram"`
|
||||
|
||||
// SEPs
|
||||
SEPs uint64 `json:"seps"`
|
||||
}
|
||||
|
||||
// Main information about resource group
|
||||
type ItemRG struct {
|
||||
// Computes
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type RestoreRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
}
|
||||
|
||||
func (arq RestoreRequest) validate() error {
|
||||
|
||||
@@ -5,72 +5,51 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/rudecs/decort-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for updaate account
|
||||
type UpdateRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
|
||||
// Name of the account
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty"`
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Max size of memory in MB
|
||||
// Required: false
|
||||
MaxMemoryCapacity uint64 `url:"maxMemoryCapacity,omitempty"`
|
||||
MaxMemoryCapacity uint64 `url:"maxMemoryCapacity,omitempty" json:"maxMemoryCapacity,omitempty"`
|
||||
|
||||
// Max size of aggregated vdisks in GB
|
||||
// Required: false
|
||||
MaxVDiskCapacity uint64 `url:"maxVDiskCapacity,omitempty"`
|
||||
MaxVDiskCapacity uint64 `url:"maxVDiskCapacity,omitempty" json:"maxVDiskCapacity,omitempty"`
|
||||
|
||||
// Max number of CPU cores
|
||||
// Required: false
|
||||
MaxCPUCapacity uint64 `url:"maxCPUCapacity,omitempty"`
|
||||
MaxCPUCapacity uint64 `url:"maxCPUCapacity,omitempty" json:"maxCPUCapacity,omitempty"`
|
||||
|
||||
// Max sent/received network transfer peering
|
||||
// Required: false
|
||||
MaxNetworkPeerTransfer uint64 `url:"maxNetworkPeerTransfer,omitempty"`
|
||||
MaxNetworkPeerTransfer uint64 `url:"maxNetworkPeerTransfer,omitempty" json:"maxNetworkPeerTransfer,omitempty"`
|
||||
|
||||
// Max number of assigned public IPs
|
||||
// Required: false
|
||||
MaxNumPublicIP uint64 `url:"maxNumPublicIP,omitempty"`
|
||||
MaxNumPublicIP uint64 `url:"maxNumPublicIP,omitempty" json:"maxNumPublicIP,omitempty"`
|
||||
|
||||
// If true send emails when a user is granted access to resources
|
||||
// Required: false
|
||||
SendAccessEmails bool `url:"sendAccessEmails,omitempty"`
|
||||
SendAccessEmails bool `url:"sendAccessEmails,omitempty" json:"sendAccessEmails,omitempty"`
|
||||
|
||||
// Limit (positive) or disable (0) GPU resources
|
||||
// Required: false
|
||||
GPUUnits uint64 `url:"gpu_units,omitempty"`
|
||||
|
||||
// Resource types available to create in this account
|
||||
// Each element in a resource type slice must be one of:
|
||||
// - compute
|
||||
// - vins
|
||||
// - k8s
|
||||
// - openshift
|
||||
// - lb
|
||||
// - flipgroup
|
||||
// Required: false
|
||||
ResTypes []string `url:"resourceTypes,omitempty"`
|
||||
GPUUnits uint64 `url:"gpu_units,omitempty" json:"gpu_units,omitempty"`
|
||||
}
|
||||
|
||||
func (arq UpdateRequest) validate() error {
|
||||
if arq.AccountID == 0 {
|
||||
return errors.New("validation-error: field AccountID can not be empty or equal to 0")
|
||||
}
|
||||
if len(arq.ResTypes) > 0 {
|
||||
for _, value := range arq.ResTypes {
|
||||
validate := validators.StringInSlice(value, []string{"compute", "vins", "k8s", "openshift", "lb", "flipgroup"})
|
||||
if !validate {
|
||||
return errors.New("validation-error: Every resource type specified should be one of [compute, vins, k8s, openshift, lb, flipgroup]")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -13,18 +13,18 @@ import (
|
||||
type UpdateUserRequest struct {
|
||||
// ID of the account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId"`
|
||||
|
||||
// Userid/Email for registered users or emailaddress for unregistered users
|
||||
// Required: true
|
||||
UserID string `url:"userId"`
|
||||
UserID string `url:"userId" json:"userId"`
|
||||
|
||||
// Account permission types:
|
||||
// - 'R' for read only access
|
||||
// - 'RCX' for Write
|
||||
// - 'ARCXDU' for Admin
|
||||
// Required: true
|
||||
AccessType string `url:"accesstype"`
|
||||
AccessType string `url:"accesstype" json:"accesstype"`
|
||||
}
|
||||
|
||||
func (arq UpdateUserRequest) validate() error {
|
||||
|
||||
@@ -11,19 +11,19 @@ import (
|
||||
type CreateRequest struct {
|
||||
// Name of the service
|
||||
// Required: true
|
||||
Name string `url:"name"`
|
||||
Name string `url:"name" json:"name"`
|
||||
|
||||
// ID of the Resource Group where this service will be placed
|
||||
// Required: true
|
||||
RGID uint64 `url:"rgId"`
|
||||
RGID uint64 `url:"rgId" json:"rgId"`
|
||||
|
||||
// Name of the user to deploy SSH key for. Pass empty string if no SSH key deployment is required
|
||||
// Required: false
|
||||
SSHUser string `url:"sshUser,omitempty"`
|
||||
SSHUser string `url:"sshUser,omitempty" json:"sshUser,omitempty"`
|
||||
|
||||
// SSH key to deploy for the specified user. Same key will be deployed to all computes of the service
|
||||
// Required: false
|
||||
SSHKey string `url:"sshKey,omitempty"`
|
||||
SSHKey string `url:"sshKey,omitempty" json:"sshKey,omitempty"`
|
||||
}
|
||||
|
||||
func (bsrq CreateRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type DeleteRequest struct {
|
||||
// ID of the BasicService to be delete
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// If set to False, Basic service will be deleted to recycle bin. Otherwise destroyed immediately
|
||||
// Required: true
|
||||
Permanently bool `url:"permanently,omitempty"`
|
||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
||||
}
|
||||
|
||||
func (bsrq DeleteRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type DisableRequest struct {
|
||||
// ID of the service to disable
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
}
|
||||
|
||||
func (bsrq DisableRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type EnableRequest struct {
|
||||
// ID of the service to enable
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
}
|
||||
|
||||
func (bsrq EnableRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type GetRequest struct {
|
||||
// ID of the service to query information
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
}
|
||||
|
||||
func (bsrq GetRequest) validate() error {
|
||||
|
||||
@@ -11,54 +11,62 @@ import (
|
||||
type GroupAddRequest struct {
|
||||
// ID of the Basic Service to add a group to
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// Name of the Compute Group to add
|
||||
// Required: true
|
||||
Name string `url:"name"`
|
||||
Name string `url:"name" json:"name"`
|
||||
|
||||
// Computes number. Defines how many computes must be there in the group
|
||||
// Required: true
|
||||
Count uint64 `url:"count"`
|
||||
Count uint64 `url:"count" json:"count"`
|
||||
|
||||
// Compute CPU number. All computes in the group have the same CPU count
|
||||
// Required: true
|
||||
CPU uint64 `url:"cpu"`
|
||||
CPU uint64 `url:"cpu" json:"cpu"`
|
||||
|
||||
// Compute RAM volume in MB. All computes in the group have the same RAM volume
|
||||
// Required: true
|
||||
RAM uint64 `url:"ram"`
|
||||
RAM uint64 `url:"ram" json:"ram"`
|
||||
|
||||
// Compute boot disk size in GB
|
||||
// Required: true
|
||||
Disk uint64 `url:"disk"`
|
||||
Disk uint64 `url:"disk" json:"disk"`
|
||||
|
||||
// OS image ID to create computes from
|
||||
// Required: true
|
||||
ImageID uint64 `url:"imageId"`
|
||||
ImageID uint64 `url:"imageId" json:"imageId"`
|
||||
|
||||
// Compute driver
|
||||
// should be one of:
|
||||
// - KVM_X86
|
||||
// - KVM_PPC
|
||||
// Required: true
|
||||
Driver string `url:"driver"`
|
||||
Driver string `url:"driver" json:"driver"`
|
||||
|
||||
// Storage endpoint provider ID
|
||||
// Required: false
|
||||
SEPID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Pool to use if sepId is set, can be also empty if needed to be chosen by system
|
||||
// Required: false
|
||||
SEPPool string `url:"sepPool,omitempty" json:"sepPool,omitempty"`
|
||||
|
||||
// Group role tag. Can be empty string, does not have to be unique
|
||||
// Required: false
|
||||
Role string `url:"role,omitempty"`
|
||||
Role string `url:"role,omitempty" json:"role,omitempty"`
|
||||
|
||||
// List of ViNSes to connect computes to
|
||||
// Required: false
|
||||
VINSes []uint64 `url:"vinses,omitempty"`
|
||||
VINSes []uint64 `url:"vinses,omitempty" json:"vinses,omitempty"`
|
||||
|
||||
// List of external networks to connect computes to
|
||||
// Required: false
|
||||
ExtNets []uint64 `url:"extnets,omitempty"`
|
||||
ExtNets []uint64 `url:"extnets,omitempty" json:"extnets,omitempty"`
|
||||
|
||||
// Time of Compute Group readiness
|
||||
// Required: false
|
||||
TimeoutStart uint64 `url:"timeoutStart"`
|
||||
TimeoutStart uint64 `url:"timeoutStart" json:"timeoutStart"`
|
||||
}
|
||||
|
||||
func (bsrq GroupAddRequest) validate() error {
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type GroupComputeRemoveRequest struct {
|
||||
// ID of the Basic Service
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute GROUP
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
|
||||
// ID of the Compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (bsrq GroupComputeRemoveRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type GroupGetRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
}
|
||||
|
||||
func (bsrq GroupGetRequest) validate() error {
|
||||
|
||||
@@ -12,15 +12,15 @@ import (
|
||||
type GroupParentAddRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
|
||||
// ID of the parent Compute Group to register with the current Compute Group
|
||||
// Required: true
|
||||
ParentID uint64 `url:"parentId"`
|
||||
ParentID uint64 `url:"parentId" json:"parentId"`
|
||||
}
|
||||
|
||||
func (bsrq GroupParentAddRequest) validate() error {
|
||||
|
||||
@@ -12,16 +12,16 @@ import (
|
||||
type GroupParentRemoveRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
|
||||
// ID of the parent Compute Group
|
||||
// to remove from the current Compute Group
|
||||
// Required: true
|
||||
ParentID uint64 `url:"parentId"`
|
||||
ParentID uint64 `url:"parentId" json:"parentId"`
|
||||
}
|
||||
|
||||
func (bsrq GroupParentRemoveRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type GroupRemoveRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
}
|
||||
|
||||
func (bsrq GroupRemoveRequest) validate() error {
|
||||
|
||||
@@ -13,22 +13,22 @@ import (
|
||||
type GroupResizeRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group to resize
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
|
||||
// Either delta or absolute value of computes
|
||||
// Required: true
|
||||
Count int64 `url:"count"`
|
||||
Count int64 `url:"count" json:"count"`
|
||||
|
||||
// Either delta or absolute value of computes
|
||||
// Should be one of:
|
||||
// - ABSOLUTE
|
||||
// - RELATIVE
|
||||
// Required: true
|
||||
Mode string `url:"mode"`
|
||||
Mode string `url:"mode" json:"mode"`
|
||||
}
|
||||
|
||||
func (bsrq GroupResizeRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type GroupStartRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group to start
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
}
|
||||
|
||||
func (bsrq GroupStartRequest) validate() error {
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type GroupStopRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group to stop
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
|
||||
// Force stop Compute Group
|
||||
// Required: true
|
||||
Force bool `url:"force,omitempty"`
|
||||
Force bool `url:"force,omitempty" json:"force,omitempty"`
|
||||
}
|
||||
|
||||
func (bsrq GroupStopRequest) validate() error {
|
||||
|
||||
@@ -11,35 +11,35 @@ import (
|
||||
type GroupUpdateRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
|
||||
// Specify non-empty string to update Compute Group name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty"`
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Specify non-empty string to update group role
|
||||
// Required: false
|
||||
Role string `url:"role,omitempty"`
|
||||
Role string `url:"role,omitempty" json:"role,omitempty"`
|
||||
|
||||
// Specify positive value to set new compute CPU count
|
||||
// Required: false
|
||||
CPU uint64 `url:"cpu,omitempty"`
|
||||
CPU uint64 `url:"cpu,omitempty" json:"cpu,omitempty"`
|
||||
|
||||
// Specify positive value to set new compute RAM volume in MB
|
||||
// Required: false
|
||||
RAM uint64 `url:"ram,omitempty"`
|
||||
RAM uint64 `url:"ram,omitempty" json:"ram,omitempty"`
|
||||
|
||||
// Specify new compute boot disk size in GB
|
||||
// Required: false
|
||||
Disk uint64 `url:"disk,omitempty"`
|
||||
Disk uint64 `url:"disk,omitempty" json:"disk,omitempty"`
|
||||
|
||||
// Force resize Compute Group
|
||||
// Required: false
|
||||
Force bool `url:"force,omitempty"`
|
||||
Force bool `url:"force,omitempty" json:"force,omitempty"`
|
||||
}
|
||||
|
||||
func (bsrq GroupUpdateRequest) validate() error {
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type GroupUpdateExtNetRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
|
||||
// List of Extnets to connect computes
|
||||
// Required: false
|
||||
ExtNets []uint64 `url:"extnets,omitempty"`
|
||||
ExtNets []uint64 `url:"extnets,omitempty" json:"extnets,omitempty"`
|
||||
}
|
||||
|
||||
func (bsrq GroupUpdateExtNetRequest) validate() error {
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type GroupUpdateVINSRequest struct {
|
||||
// ID of the Basic Service of Compute Group
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// ID of the Compute Group
|
||||
// Required: true
|
||||
CompGroupID uint64 `url:"compgroupId"`
|
||||
CompGroupID uint64 `url:"compgroupId" json:"compgroupId"`
|
||||
|
||||
// List of ViNSes to connect computes
|
||||
// Required: false
|
||||
VINSes []uint64 `url:"vinses,omitempty"`
|
||||
VINSes []uint64 `url:"vinses,omitempty" json:"vinses,omitempty"`
|
||||
}
|
||||
|
||||
func (bsrq GroupUpdateVINSRequest) validate() error {
|
||||
|
||||
@@ -10,19 +10,19 @@ import (
|
||||
type ListRequest struct {
|
||||
// ID of the account to query for BasicService instances
|
||||
// Required: false
|
||||
AccountID uint64 `url:"accountId,omitempty"`
|
||||
AccountID uint64 `url:"accountId,omitempty" json:"accountId,omitempty"`
|
||||
|
||||
// ID of the resource group to query for BasicService instances
|
||||
// Required: false
|
||||
RGID uint64 `url:"rgId,omitempty"`
|
||||
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty"`
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty"`
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list BasicService instances associated with the specified Resource Group
|
||||
|
||||
@@ -191,6 +191,9 @@ type RecordGroup struct {
|
||||
// List of Parent IDs
|
||||
Parents []uint64 `json:"parents"`
|
||||
|
||||
// Pool name
|
||||
PoolName string `json:"poolName"`
|
||||
|
||||
// Number of RAM, MB
|
||||
RAM uint64 `json:"ram"`
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type RestoreRequest struct {
|
||||
// ID of the BasicService to be restored
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
}
|
||||
|
||||
func (bsrq RestoreRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type SnapshotCreateRequest struct {
|
||||
// ID of the Basic Service
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// Label of the snapshot
|
||||
// Required: true
|
||||
Label string `url:"label"`
|
||||
Label string `url:"label" json:"label"`
|
||||
}
|
||||
|
||||
func (bsrq SnapshotCreateRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type SnapshotDeleteRequest struct {
|
||||
// ID of the Basic Service
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// Label of the snapshot
|
||||
// Required: true
|
||||
Label string `url:"label"`
|
||||
Label string `url:"label" json:"label"`
|
||||
}
|
||||
|
||||
func (bsrq SnapshotDeleteRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type SnapshotListRequest struct {
|
||||
// ID of the Basic Service
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
}
|
||||
|
||||
func (bsrq SnapshotListRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type SnapshotRollbackRequest struct {
|
||||
// ID of the Basic Service
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
|
||||
// Label of the snapshot
|
||||
// Required: true
|
||||
Label string `url:"label"`
|
||||
Label string `url:"label" json:"label"`
|
||||
}
|
||||
|
||||
func (bsrq SnapshotRollbackRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type StartRequest struct {
|
||||
// ID of the service to start
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
}
|
||||
|
||||
func (bsrq StartRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type StopRequest struct {
|
||||
// ID of the service to stop
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId"`
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId"`
|
||||
}
|
||||
|
||||
func (bsrq StopRequest) validate() error {
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
type AffinityGroupCheckStartRequest struct {
|
||||
// ID of the resource group
|
||||
// Required: true
|
||||
RGID uint64 `url:"rgId"`
|
||||
RGID uint64 `url:"rgId" json:"rgId"`
|
||||
|
||||
// Affinity group label
|
||||
// Required: true
|
||||
AffinityLabel string `url:"affinityLabel"`
|
||||
AffinityLabel string `url:"affinityLabel" json:"affinityLabel"`
|
||||
}
|
||||
|
||||
func (crq AffinityGroupCheckStartRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type AffinityLabelRemoveRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq AffinityLabelRemoveRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type AffinityLabelSetRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Affinity group label
|
||||
// Required: true
|
||||
AffinityLabel string `url:"affinityLabel"`
|
||||
AffinityLabel string `url:"affinityLabel" json:"affinityLabel"`
|
||||
}
|
||||
|
||||
func (crq AffinityLabelSetRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type AffinityRelationsRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq AffinityRelationsRequest) validate() error {
|
||||
|
||||
@@ -13,18 +13,18 @@ import (
|
||||
type AffinityRuleAddRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Compute or node, for whom rule applies
|
||||
// Required: true
|
||||
Topology string `url:"topology"`
|
||||
Topology string `url:"topology" json:"topology"`
|
||||
|
||||
// The degree of 'strictness' of this rule
|
||||
// Should be one of:
|
||||
// - RECOMMENDED
|
||||
// - REQUIRED
|
||||
// Required: true
|
||||
Policy string `url:"policy"`
|
||||
Policy string `url:"policy" json:"policy"`
|
||||
|
||||
// The comparison mode is 'value', recorded by the specified 'key'
|
||||
// Should be one of:
|
||||
@@ -32,15 +32,15 @@ type AffinityRuleAddRequest struct {
|
||||
// - EN
|
||||
// - ANY
|
||||
// Required: true
|
||||
Mode string `url:"mode"`
|
||||
Mode string `url:"mode" json:"mode"`
|
||||
|
||||
// Key that are taken into account when analyzing this rule will be identified
|
||||
// Required: true
|
||||
Key string `url:"key"`
|
||||
Key string `url:"key" json:"key"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value"`
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
func (crq AffinityRuleAddRequest) validate() error {
|
||||
|
||||
@@ -13,18 +13,18 @@ import (
|
||||
type AffinityRuleRemoveRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Compute or node, for whom rule applies
|
||||
// Required: true
|
||||
Topology string `url:"topology"`
|
||||
Topology string `url:"topology" json:"topology"`
|
||||
|
||||
// The degree of 'strictness' of this rule
|
||||
// Should be one of:
|
||||
// - RECOMMENDED
|
||||
// - REQUIRED
|
||||
// Required: true
|
||||
Policy string `url:"policy"`
|
||||
Policy string `url:"policy" json:"policy"`
|
||||
|
||||
// The comparison mode is 'value', recorded by the specified 'key'
|
||||
// Should be one of:
|
||||
@@ -32,15 +32,15 @@ type AffinityRuleRemoveRequest struct {
|
||||
// - EN
|
||||
// - ANY
|
||||
// Required: true
|
||||
Mode string `url:"mode"`
|
||||
Mode string `url:"mode" json:"mode"`
|
||||
|
||||
// Key that are taken into account when analyzing this rule will be identified
|
||||
// Required: true
|
||||
Key string `url:"key"`
|
||||
Key string `url:"key" json:"key"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value"`
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
func (crq AffinityRuleRemoveRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type AffinityRulesClearRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq AffinityRulesClearRequest) validate() error {
|
||||
|
||||
@@ -13,18 +13,18 @@ import (
|
||||
type AntiAffinityRuleAddRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Compute or node, for whom rule applies
|
||||
// Required: true
|
||||
Topology string `url:"topology"`
|
||||
Topology string `url:"topology" json:"topology"`
|
||||
|
||||
// The degree of 'strictness' of this rule
|
||||
// Should be one of:
|
||||
// - RECOMMENDED
|
||||
// - REQUIRED
|
||||
// Required: true
|
||||
Policy string `url:"policy"`
|
||||
Policy string `url:"policy" json:"policy"`
|
||||
|
||||
// The comparison mode is 'value', recorded by the specified 'key'
|
||||
// Should be one of:
|
||||
@@ -32,15 +32,15 @@ type AntiAffinityRuleAddRequest struct {
|
||||
// - EN
|
||||
// - ANY
|
||||
// Required: true
|
||||
Mode string `url:"mode"`
|
||||
Mode string `url:"mode" json:"mode"`
|
||||
|
||||
// Key that are taken into account when analyzing this rule will be identified
|
||||
// Required: true
|
||||
Key string `url:"key"`
|
||||
Key string `url:"key" json:"key"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value"`
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
func (crq AntiAffinityRuleAddRequest) validate() error {
|
||||
|
||||
@@ -13,18 +13,18 @@ import (
|
||||
type AntiAffinityRuleRemoveRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Compute or node, for whom rule applies
|
||||
// Required: true
|
||||
Topology string `url:"topology"`
|
||||
Topology string `url:"topology" json:"topology"`
|
||||
|
||||
// The degree of 'strictness' of this rule
|
||||
// Should be one of:
|
||||
// - RECOMMENDED
|
||||
// - REQUIRED
|
||||
// Required: true
|
||||
Policy string `url:"policy"`
|
||||
Policy string `url:"policy" json:"policy"`
|
||||
|
||||
// The comparison mode is 'value', recorded by the specified 'key'
|
||||
// Should be one of:
|
||||
@@ -32,15 +32,15 @@ type AntiAffinityRuleRemoveRequest struct {
|
||||
// - EN
|
||||
// - ANY
|
||||
// Required: true
|
||||
Mode string `url:"mode"`
|
||||
Mode string `url:"mode" json:"mode"`
|
||||
|
||||
// Key that are taken into account when analyzing this rule will be identified
|
||||
// Required: true
|
||||
Key string `url:"key"`
|
||||
Key string `url:"key" json:"key"`
|
||||
|
||||
// Value that must match the key to be taken into account when analyzing this rule
|
||||
// Required: true
|
||||
Value string `url:"value"`
|
||||
Value string `url:"value" json:"value"`
|
||||
}
|
||||
|
||||
func (crq AntiAffinityRuleRemoveRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type AntiAffinityRulesClearRequest struct {
|
||||
// ID of the compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq AntiAffinityRulesClearRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type AttachGPURequest struct {
|
||||
// Identifier compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Identifier vGPU
|
||||
// Required: true
|
||||
VGPUID uint64 `url:"vgpuId"`
|
||||
VGPUID uint64 `url:"vgpuId" json:"vgpuId"`
|
||||
}
|
||||
|
||||
func (crq AttachGPURequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type AttachPCIDeviceRequest struct {
|
||||
// Identifier compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// PCI device ID
|
||||
// Required: true
|
||||
DeviceID uint64 `url:"deviceId"`
|
||||
DeviceID uint64 `url:"deviceId" json:"deviceId"`
|
||||
}
|
||||
|
||||
func (crq AttachPCIDeviceRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type AuditsRequest struct {
|
||||
// ID of the compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq AuditsRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type CDEjectRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq CDEjectRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type CDInsertRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// ID of CD-ROM image
|
||||
// Required: true
|
||||
CDROMID uint64 `url:"cdromId"`
|
||||
CDROMID uint64 `url:"cdromId" json:"cdromId"`
|
||||
}
|
||||
|
||||
func (crq CDInsertRequest) validate() error {
|
||||
|
||||
@@ -11,19 +11,19 @@ import (
|
||||
type CloneRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Name of the clone
|
||||
// Required: true
|
||||
Name string `url:"name"`
|
||||
Name string `url:"name" json:"name"`
|
||||
|
||||
// Timestamp of the parent's snapshot to create clone from
|
||||
// Required: false
|
||||
SnapshotTimestamp uint64 `url:"snapshotTimestamp"`
|
||||
SnapshotTimestamp uint64 `url:"snapshotTimestamp" json:"snapshotTimestamp"`
|
||||
|
||||
// Name of the parent's snapshot to create clone from
|
||||
// Required: false
|
||||
SnapshotName string `url:"snapshotName"`
|
||||
SnapshotName string `url:"snapshotName" json:"snapshotName"`
|
||||
}
|
||||
|
||||
func (crq CloneRequest) validate() error {
|
||||
|
||||
@@ -12,11 +12,11 @@ import (
|
||||
type CreateTemplateRequest struct {
|
||||
// ID of the compute to create template from
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Name to assign to the template being created
|
||||
// Required: true
|
||||
Name string `url:"name"`
|
||||
Name string `url:"name" json:"name"`
|
||||
|
||||
// Async API call
|
||||
// For async call use CreateTemplateAsync
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type DeleteRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Delete permanently
|
||||
// Required: false
|
||||
Permanently bool `url:"permanently,omitempty"`
|
||||
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
|
||||
|
||||
// Set True if you want to detach data disks (if any) from the compute before its deletion
|
||||
// Required: false
|
||||
DetachDisks bool `url:"detachDisks,omitempty"`
|
||||
DetachDisks bool `url:"detachDisks,omitempty" json:"detachDisks,omitempty"`
|
||||
}
|
||||
|
||||
func (crq DeleteRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type DetachGPURequest struct {
|
||||
// Identifier compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Identifier virtual GPU
|
||||
// Required: false
|
||||
VGPUID int64 `url:"vgpuId,omitempty"`
|
||||
VGPUID int64 `url:"vgpuId,omitempty" json:"vgpuId,omitempty"`
|
||||
}
|
||||
|
||||
func (crq DetachGPURequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type DetachPCIDeviceRequest struct {
|
||||
// Identifier compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Pci device ID
|
||||
// Required: true
|
||||
DeviceID uint64 `url:"deviceId"`
|
||||
DeviceID uint64 `url:"deviceId" json:"deviceId"`
|
||||
}
|
||||
|
||||
func (crq DetachPCIDeviceRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type DisableRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq DisableRequest) validate() error {
|
||||
|
||||
@@ -11,40 +11,40 @@ import (
|
||||
type DiskAddRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Name for disk
|
||||
// Required: true
|
||||
DiskName string `url:"diskName"`
|
||||
DiskName string `url:"diskName" json:"diskName"`
|
||||
|
||||
// Disk size in GB
|
||||
// Required: true
|
||||
Size uint64 `url:"size"`
|
||||
Size uint64 `url:"size" json:"size"`
|
||||
|
||||
// Type of the disk
|
||||
// Should be one of:
|
||||
// - D
|
||||
// - B
|
||||
// Required: false
|
||||
DiskType string `url:"diskType,omitempty"`
|
||||
DiskType string `url:"diskType,omitempty" json:"diskType,omitempty"`
|
||||
|
||||
// Storage endpoint provider ID
|
||||
// By default the same with boot disk
|
||||
// Required: false
|
||||
SepID uint64 `url:"sepId,omitempty"`
|
||||
SepID uint64 `url:"sepId,omitempty" json:"sepId,omitempty"`
|
||||
|
||||
// Pool name
|
||||
// By default will be chosen automatically
|
||||
// Required: false
|
||||
Pool string `url:"pool,omitempty"`
|
||||
Pool string `url:"pool,omitempty" json:"pool,omitempty"`
|
||||
|
||||
// Optional description
|
||||
// Required: false
|
||||
Description string `url:"desc,omitempty"`
|
||||
Description string `url:"desc,omitempty" json:"desc,omitempty"`
|
||||
|
||||
// Specify image id for create disk from template
|
||||
// Required: false
|
||||
ImageID uint64 `url:"imageId,omitempty"`
|
||||
ImageID uint64 `url:"imageId,omitempty" json:"imageId,omitempty"`
|
||||
}
|
||||
|
||||
func (crq DiskAddRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type DiskAttachRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// ID of the disk to attach
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId"`
|
||||
DiskID uint64 `url:"diskId" json:"diskId"`
|
||||
}
|
||||
|
||||
func (crq DiskAttachRequest) validate() error {
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type DiskDelRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// ID of disk instance
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId"`
|
||||
DiskID uint64 `url:"diskId" json:"diskId"`
|
||||
|
||||
// False if disk is to be deleted to recycle bin
|
||||
// Required: true
|
||||
Permanently bool `url:"permanently"`
|
||||
Permanently bool `url:"permanently" json:"permanently"`
|
||||
}
|
||||
|
||||
func (crq DiskDelRequest) validate() error {
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
type DiskDetachRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// ID of the disk to detach
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId"`
|
||||
DiskID uint64 `url:"diskId" json:"diskId"`
|
||||
}
|
||||
|
||||
func (crq DiskDetachRequest) validate() error {
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type DiskQOSRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// ID of the disk to apply limits
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId"`
|
||||
DiskID uint64 `url:"diskId" json:"diskId"`
|
||||
|
||||
// Limit IO for a certain disk total and read/write options are not allowed to be combined
|
||||
// Required: true
|
||||
Limits string `url:"limits"`
|
||||
Limits string `url:"limits" json:"limits"`
|
||||
}
|
||||
|
||||
func (crq DiskQOSRequest) validate() error {
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type DiskResizeRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// ID of the disk to resize
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId"`
|
||||
DiskID uint64 `url:"diskId" json:"diskId"`
|
||||
|
||||
// New disk size
|
||||
// Required: true
|
||||
Size uint64 `url:"size"`
|
||||
Size uint64 `url:"size" json:"size"`
|
||||
}
|
||||
|
||||
func (crq DiskResizeRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type EnableRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq EnableRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type GetRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq GetRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type GetAuditsRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq GetAuditsRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type GetConsoleURLRequest struct {
|
||||
// ID of compute instance to get console for
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq GetConsoleURLRequest) validate() error {
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
type GetLogRequest struct {
|
||||
// ID of compute instance to get log for
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Path to log file
|
||||
// Required: true
|
||||
Path string `url:"path"`
|
||||
Path string `url:"path" json:"path"`
|
||||
}
|
||||
|
||||
func (crq GetLogRequest) validate() error {
|
||||
|
||||
@@ -10,15 +10,15 @@ import (
|
||||
type ListRequest struct {
|
||||
// Include deleted computes
|
||||
// Required: false
|
||||
IncludeDeleted bool `url:"includedeleted,omitempty"`
|
||||
IncludeDeleted bool `url:"includedeleted,omitempty" json:"includedeleted,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty"`
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty"`
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of the available computes.
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
type ListDeletedRequest struct {
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty"`
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty"`
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// ListDeleted gets list all deleted computes
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type ListPCIDeviceRequest struct {
|
||||
// Identifier compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq ListPCIDeviceRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type ListVGPURequest struct {
|
||||
// Identifier compute
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq ListVGPURequest) validate() error {
|
||||
|
||||
@@ -3,13 +3,13 @@ package compute
|
||||
// Access Control List
|
||||
type RecordACL struct {
|
||||
// Account ACL list
|
||||
AccountACL ListACL `json:"accountACL"`
|
||||
AccountACL ListACL `json:"accountAcl"`
|
||||
|
||||
// Compute ACL list
|
||||
ComputeACL ListACL `json:"computeACL"`
|
||||
ComputeACL ListACL `json:"computeAcl"`
|
||||
|
||||
// Resource group ACL list
|
||||
RGACL ListACL `json:"rgACL"`
|
||||
RGACL ListACL `json:"rgAcl"`
|
||||
}
|
||||
|
||||
// ACL information
|
||||
@@ -281,7 +281,7 @@ type RecordCompute struct {
|
||||
// Created time
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
|
||||
// Custom fields
|
||||
// Custom fields items
|
||||
CustomFields map[string]interface{} `json:"customFields"`
|
||||
|
||||
// Deleted by
|
||||
@@ -597,6 +597,9 @@ type ItemComputeDisk struct {
|
||||
// Pool
|
||||
Pool string `json:"pool"`
|
||||
|
||||
// Present to
|
||||
PresentTo []uint64 `json:"presentTo"`
|
||||
|
||||
// Purge time
|
||||
PurgeTime uint64 `json:"purgeTime"`
|
||||
|
||||
@@ -612,11 +615,14 @@ type ItemComputeDisk struct {
|
||||
// SepID
|
||||
SepID uint64 `json:"sepId"`
|
||||
|
||||
// Shareable
|
||||
Shareable bool `json:"shareable"`
|
||||
|
||||
// Size max
|
||||
SizeMax uint64 `json:"sizeMax"`
|
||||
|
||||
//Size used
|
||||
SizeUsed uint64 `json:"sizeUsed"`
|
||||
SizeUsed float64 `json:"sizeUsed"`
|
||||
|
||||
// List extend snapshots
|
||||
Snapshots SnapshotExtendList `json:"snapshots"`
|
||||
@@ -703,7 +709,7 @@ type IOTune struct {
|
||||
// Main information about compute
|
||||
type ItemCompute struct {
|
||||
// Access Control List
|
||||
ACL []interface{} `json:"ACL"`
|
||||
ACL []interface{} `json:"acl"`
|
||||
|
||||
// Account ID
|
||||
AccountID uint64 `json:"accountId"`
|
||||
@@ -750,7 +756,7 @@ type ItemCompute struct {
|
||||
// Created time
|
||||
CreatedTime uint64 `json:"createdTime"`
|
||||
|
||||
// Custom fields
|
||||
// Custom fields list
|
||||
CustomFields map[string]interface{} `json:"customFields"`
|
||||
|
||||
// Deleted by
|
||||
@@ -765,8 +771,8 @@ type ItemCompute struct {
|
||||
// Devices
|
||||
Devices interface{} `json:"devices"`
|
||||
|
||||
// List disk IDs
|
||||
Disks []uint64 `json:"disks"`
|
||||
// List disk items
|
||||
Disks []InfoDisk `json:"disks"`
|
||||
|
||||
// Driver
|
||||
Driver string `json:"driver"`
|
||||
@@ -783,9 +789,6 @@ type ItemCompute struct {
|
||||
// Image ID
|
||||
ImageID uint64 `json:"imageId"`
|
||||
|
||||
// Image name
|
||||
ImageName string `json:"imageName"`
|
||||
|
||||
// List interfaces
|
||||
Interfaces ListInterfaces `json:"interfaces"`
|
||||
|
||||
@@ -858,17 +861,23 @@ type ItemCompute struct {
|
||||
// User Managed or not
|
||||
UserManaged bool `json:"userManaged"`
|
||||
|
||||
// Userdata
|
||||
Userdata interface{} `json:"userdata"`
|
||||
|
||||
// List vGPU IDs
|
||||
VGPUs []uint64 `json:"vgpus"`
|
||||
|
||||
// VINS connected
|
||||
VINSConnected uint64 `json:"vinsConnected"`
|
||||
|
||||
// Virtual image ID
|
||||
VirtualImageID uint64 `json:"virtualImageId"`
|
||||
}
|
||||
|
||||
// Virtual image name
|
||||
VirtualImageName string `json:"virtualImageName"`
|
||||
// Information Disk
|
||||
type InfoDisk struct {
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// PCISlot
|
||||
PCISlot uint64 `json:"pciSlot"`
|
||||
}
|
||||
|
||||
// List information about computes
|
||||
|
||||
@@ -11,26 +11,26 @@ import (
|
||||
type MoveToRGRequest struct {
|
||||
// ID of the compute instance to move
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// ID of the target resource group
|
||||
// Required: true
|
||||
RGID uint64 `url:"rgId"`
|
||||
RGID uint64 `url:"rgId" json:"rgId"`
|
||||
|
||||
// New name for the compute upon successful move,
|
||||
// if name change required.
|
||||
// Pass empty string if no name change necessary
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty"`
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Should the compute be restarted upon successful move
|
||||
// Required: false
|
||||
Autostart bool `url:"autostart,omitempty"`
|
||||
Autostart bool `url:"autostart,omitempty" json:"autostart,omitempty"`
|
||||
|
||||
// By default moving compute in a running state is not allowed.
|
||||
// Set this flag to True to force stop running compute instance prior to move.
|
||||
// Required: false
|
||||
ForceStop bool `url:"forceStop,omitempty"`
|
||||
ForceStop bool `url:"forceStop,omitempty" json:"forceStop,omitempty"`
|
||||
}
|
||||
|
||||
func (crq MoveToRGRequest) validate() error {
|
||||
|
||||
@@ -13,23 +13,23 @@ import (
|
||||
type NetAttachRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// Network type
|
||||
// 'EXTNET' for connect to external network directly
|
||||
// and 'VINS' for connect to ViNS
|
||||
// Required: true
|
||||
NetType string `url:"netType"`
|
||||
NetType string `url:"netType" json:"netType"`
|
||||
|
||||
// Network ID for connect to
|
||||
// For EXTNET - external network ID
|
||||
// For VINS - VINS ID
|
||||
// Required: true
|
||||
NetID uint64 `url:"netId"`
|
||||
NetID uint64 `url:"netId" json:"netId"`
|
||||
|
||||
// Directly required IP address for new network interface
|
||||
// Required: true
|
||||
IPAddr string `url:"ipAddr,omitempty"`
|
||||
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
|
||||
}
|
||||
|
||||
func (crq NetAttachRequest) validate() error {
|
||||
|
||||
@@ -11,15 +11,15 @@ import (
|
||||
type NetDetachRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// IP of the network interface
|
||||
// Required: false
|
||||
IPAddr string `url:"ipAddr,omitempty"`
|
||||
IPAddr string `url:"ipAddr,omitempty" json:"ipAddr,omitempty"`
|
||||
|
||||
// MAC of the network interface
|
||||
// Required: false
|
||||
MAC string `url:"mac,omitempty"`
|
||||
MAC string `url:"mac,omitempty" json:"mac,omitempty"`
|
||||
}
|
||||
|
||||
func (crq NetDetachRequest) validate() error {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
type PauseRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
}
|
||||
|
||||
func (crq PauseRequest) validate() error {
|
||||
|
||||
@@ -13,24 +13,24 @@ import (
|
||||
type PFWAddRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// External start port number for the rule
|
||||
// Required: true
|
||||
PublicPortStart uint64 `url:"publicPortStart"`
|
||||
PublicPortStart uint64 `url:"publicPortStart" json:"publicPortStart"`
|
||||
|
||||
// End port number (inclusive) for the ranged rule
|
||||
// Required: false
|
||||
PublicPortEnd uint64 `url:"publicPortEnd,omitempty"`
|
||||
PublicPortEnd uint64 `url:"publicPortEnd,omitempty" json:"publicPortEnd,omitempty"`
|
||||
|
||||
// Internal base port number
|
||||
// Required: true
|
||||
LocalBasePort uint64 `url:"localBasePort"`
|
||||
LocalBasePort uint64 `url:"localBasePort" json:"localBasePort"`
|
||||
|
||||
// Network protocol
|
||||
// either "tcp" or "udp"
|
||||
// Required: true
|
||||
Proto string `url:"proto"`
|
||||
Proto string `url:"proto" json:"proto"`
|
||||
}
|
||||
|
||||
func (crq PFWAddRequest) validate() error {
|
||||
|
||||
@@ -11,28 +11,28 @@ import (
|
||||
type PFWDelRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId"`
|
||||
ComputeID uint64 `url:"computeId" json:"computeId"`
|
||||
|
||||
// ID of the rule to delete. If specified, all other arguments will be ignored
|
||||
// Required: false
|
||||
PFWID uint64 `url:"ruleId,omitempty"`
|
||||
PFWID uint64 `url:"ruleId,omitempty" json:"ruleId,omitempty"`
|
||||
|
||||
// External start port number for the rule
|
||||
// Required: false
|
||||
PublicPortStart uint64 `url:"publicPortStart,omitempty"`
|
||||
PublicPortStart uint64 `url:"publicPortStart,omitempty" json:"publicPortStart,omitempty"`
|
||||
|
||||
// End port number (inclusive) for the ranged rule
|
||||
// Required: false
|
||||
PublicPortEnd uint64 `url:"publicPortEnd,omitempty"`
|
||||
PublicPortEnd uint64 `url:"publicPortEnd,omitempty" json:"publicPortEnd,omitempty"`
|
||||
|
||||
// Internal base port number
|
||||
// Required: false
|
||||
LocalBasePort uint64 `url:"localBasePort,omitempty"`
|
||||
LocalBasePort uint64 `url:"localBasePort,omitempty" json:"localBasePort,omitempty"`
|
||||
|
||||
// Network protocol
|
||||
// either "tcp" or "udp"
|
||||
// Required: false
|
||||
Proto string `url:"proto,omitempty"`
|
||||
Proto string `url:"proto,omitempty" json:"proto,omitempty"`
|
||||
}
|
||||
|
||||
func (crq PFWDelRequest) validate() error {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user