Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b666789c7d | |||
| b069c31745 | |||
| 2953ef0a85 | |||
| 50a4d5ade2 | |||
| 1575b75fa6 |
58
CHANGELOG.md
58
CHANGELOG.md
@@ -1,52 +1,10 @@
|
||||
## Version 1.6.0
|
||||
|
||||
### Bugfix
|
||||
- Fix client and legacy-client, the cyclicity of sending requests has been removed
|
||||
- Edit description field SSLSkipVerify in config/config and config/legacy-config
|
||||
- Remove tags required fields ExtNetID VINSID Start in model CreateRequest in cloudapi/lb/create and cloudbroker/lb/create
|
||||
- Add tags required fields BindingName BindingAddress BindingPort in model FrontendBindRequest in cloudapi/lb/frontend_bind
|
||||
- Add tags required fields BindingAddress BindingPort in model FrontendBindUpdateRequest in cloudapi/lb/frontend_bind_update
|
||||
- Remove tags omitempty in field Start in model kvmx86 and kvmppc in cloudapi and cloudbroker /create /mass_create
|
||||
- Add field Driver in models cloudbroker/kvmx86/create and cloudbroker/kvmx86/create_blank
|
||||
- Add field ExternalIp in model ItemDetailedInfo cloudbroker/k8s/models and cloudapi/k8s/models
|
||||
- Add fields StackID and Reason in model CreateRequest cloudbroker/kvmppc
|
||||
|
||||
### Feature
|
||||
- Add field UserData in cloudapi/bservice/group_add
|
||||
- Add fields VinsId, LbSysctlParams, HighlyAvailable, AdditionalSANs, InitConfiguration, ClusterConfiguration, KubeletConfiguration, KubeProxyConfiguration, JoinConfiguration, UserData, ExtNetOnly, OidcCertificate in model request cloudapi/k8s/create and cloudbroker/k8s/create
|
||||
- Add fields SysctlParams, HighlyAvailable in model CreateRequest in cloudapi/lb/create and cloudbroker/lb/create
|
||||
- Add fields BackendHAIP, FrontendHAIP, PartK8s, SysctlParams in model RecordLB in cloudapi/lb/models and cloudbroker/lb/models
|
||||
- Add models InfoStack, ItemStack, ListStacks cloudapi/stack/models
|
||||
- Add field Routes and type Route in CreateInAccountRequest and CreateInRGRequest models in cloudapi/vins/create_in_rg and /cloudapi/vins/create_in_account
|
||||
- Add field Enabled in model ItemVNFInterface in cloudapi/vins/models
|
||||
- Add fields Routes in models RecordNAT, RecordDHCP, RecordGW and add type ListStaticRoutes, ListRoutes, ItemRoutes in cloudapi/vins/models
|
||||
|
||||
- Added new endpoints:
|
||||
- cloudapi/k8s/get_worker_nodes_meta_data
|
||||
- cloudapi/k8s/update_worker_nodes_meta_data
|
||||
- cloudapi/lb/make_highly_available
|
||||
- cloudapi/lb/updateSysctParams
|
||||
- cloudapi/stack/get
|
||||
- cloudapi/stack/list
|
||||
- cloudapi/vins/static_route_list
|
||||
- cloudapi/vins/static_route_access_grant
|
||||
- cloudapi/vins/static_route_access_revoke
|
||||
- cloudapi/vins/static_route_add
|
||||
- cloudapi/vins/static_route_del
|
||||
- cloudbroker/compute/set_custom_fields
|
||||
- cloudbroker/k8s/get_worker_nodes_meta_data
|
||||
- cloudbroker/k8s/update_worker_nodes_meta_data
|
||||
- cloudbroker/lb/make_highly_available
|
||||
- cloudbroker/lb/updateSysctParams
|
||||
- cloudbroker/vins/static_route_list
|
||||
- cloudbroker/vins/static_route_access_grant
|
||||
- cloudbroker/vins/static_route_access_revoke
|
||||
- cloudbroker/vins/static_route_add
|
||||
- cloudbroker/vins/static_route_del
|
||||
- cloudbroker/extnet/static_route_list
|
||||
- cloudbroker/extnet/static_route_access_grant
|
||||
- cloudbroker/extnet/static_route_access_revoke
|
||||
- cloudbroker/extnet/static_route_add
|
||||
- cloudbroker/extnet/static_route_del
|
||||
## Version 1.6.6
|
||||
|
||||
## Bugfix
|
||||
- Fixed model RecordExtNet in cloudbroker/extnet/models for correct work of get request
|
||||
- Fixed json tags in ItemResourceConsumption model and delete extra model Consumed in cloudbroker/account/models
|
||||
- Fixed statelessSepId field type from uint64 to int64 in cloudbroker/compute/models for correct work of list request
|
||||
|
||||
## Feature
|
||||
- Added GetRaw and ListRaw methods that give response as an array of bytes for cloudAPI groups: account, compute, k8s, disks, rg, bservice, disks,extnet, flipgroup, image, k8ci, lb, locations(list), sizes(list), stack, tasks, vins
|
||||
- Added GetRaw and ListRaw methods that give response as an array of bytes for cloudbroker groups: account, apiaccess, compute, disks, extnet, flipgroup, grid, group, image, k8ci, k8s, lb, rg, sep, stack, tasks, user, vgpu, vins
|
||||
50
README.md
50
README.md
@@ -527,6 +527,56 @@ func main() {
|
||||
}
|
||||
```
|
||||
|
||||
Для запросов Get и List реализованы запросы GetRaw и ListRaw, которые возвращают ответ не в виде соответствующей структуры, а в виде массива байт (JSON).
|
||||
Выполнение таких запросов происходит аналогично.
|
||||
|
||||
#### Пример выполнения GetRaw и ListRaw запросов
|
||||
|
||||
```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/account"
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
// 1. Создание структуры запроса GetRequest на создание аккаунта и выполнение GetRaw запроса с помощью конвейера
|
||||
req1 := account.GetRequest{
|
||||
AccountID: 123,
|
||||
}
|
||||
res1, err := client.CloudAPI().Account().GetRaw(context.Background(), req1)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(string(res1))
|
||||
|
||||
// 2. Создание структуры запроса ListRequest на получение аккаунтов и выполнение ListRaw запроса с помощью конвейера
|
||||
req2 := account.ListRequest{}
|
||||
res2, err := client.CloudAPI().Account().ListRaw(context.Background(), req2)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(string(res2))
|
||||
}
|
||||
```
|
||||
|
||||
### Фильтрация
|
||||
|
||||
Для каждого `ListRequest` в SDK есть группа функций для фильтрации ответа платформы. Для того чтобы произвести фильтрацию по заданным полям, достаточно описать анонимную функцию (предикат) в `.FilterFunc()`, например:
|
||||
|
||||
@@ -151,7 +151,7 @@ func (dc *DecortClient) DecortApiCall(ctx context.Context, method, url string, p
|
||||
_ = writer.WriteField("withLB", strconv.FormatBool(k8sCaCreateReq.WithLB))
|
||||
}
|
||||
|
||||
_ = writer.WriteField("highlyAvailable", strconv.FormatBool(k8sCaCreateReq.HighlyAvailable))
|
||||
_ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(k8sCaCreateReq.HighlyAvailable))
|
||||
|
||||
if k8sCaCreateReq.AdditionalSANs != nil {
|
||||
for _, v := range k8sCaCreateReq.AdditionalSANs {
|
||||
@@ -287,7 +287,7 @@ func (dc *DecortClient) DecortApiCall(ctx context.Context, method, url string, p
|
||||
_ = writer.WriteField("withLB", strconv.FormatBool(k8sCbCreateReq.WithLB))
|
||||
}
|
||||
|
||||
_ = writer.WriteField("highlyAvailable", strconv.FormatBool(k8sCbCreateReq.HighlyAvailable))
|
||||
_ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(k8sCbCreateReq.HighlyAvailable))
|
||||
|
||||
if k8sCbCreateReq.AdditionalSANs != nil {
|
||||
for _, v := range k8sCbCreateReq.AdditionalSANs {
|
||||
|
||||
@@ -148,7 +148,7 @@ func (ldc *LegacyDecortClient) DecortApiCall(ctx context.Context, method, url st
|
||||
_ = writer.WriteField("withLB", strconv.FormatBool(k8sCreateReq.WithLB))
|
||||
}
|
||||
|
||||
_ = writer.WriteField("highlyAvailable", strconv.FormatBool(k8sCreateReq.HighlyAvailable))
|
||||
_ = writer.WriteField("highlyAvailableLB", strconv.FormatBool(k8sCreateReq.HighlyAvailable))
|
||||
|
||||
if k8sCreateReq.AdditionalSANs != nil {
|
||||
for _, v := range k8sCreateReq.AdditionalSANs {
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about account
|
||||
// GetRequest struct to get information about account
|
||||
type GetRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets account details
|
||||
// Get gets account details as a RecordAccount struct
|
||||
func (a Account) Get(ctx context.Context, req GetRequest) (*RecordAccount, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/account/get"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := a.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -41,3 +32,18 @@ func (a Account) Get(ctx context.Context, req GetRequest) (*RecordAccount, error
|
||||
return &info, nil
|
||||
|
||||
}
|
||||
|
||||
// GetRaw gets account details as an array of bytes
|
||||
func (a Account) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/account/get"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of accounts
|
||||
// ListRequest struct to get list of accounts
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -33,11 +33,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all accounts the user has access to
|
||||
// List gets a list of all accounts the user has access to a ListAccounts struct
|
||||
func (a Account) List(ctx context.Context, req ListRequest) (*ListAccounts, error) {
|
||||
url := "/cloudapi/account/list"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := a.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -51,3 +49,11 @@ func (a Account) List(ctx context.Context, req ListRequest) (*ListAccounts, erro
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets a list of all accounts the user has access to as an array of bytes
|
||||
func (a Account) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/account/list"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ type Resource struct {
|
||||
DiskSize float64 `json:"disksize"`
|
||||
|
||||
// Max disk size
|
||||
DiskSizeMax uint64 `json:"disksizemax"`
|
||||
DiskSizeMax float64 `json:"disksizemax"`
|
||||
|
||||
// Number of External IPs
|
||||
ExtIPs int64 `json:"extips"`
|
||||
@@ -126,10 +126,10 @@ type RecordResourceConsumption struct {
|
||||
// Information about resources
|
||||
type ItemResourceConsumption struct {
|
||||
// Current information about resources
|
||||
Current Resource `json:"Current"`
|
||||
Consumed Resource `json:"consumed"`
|
||||
|
||||
// Reserved information about resources
|
||||
Reserved Resource `json:"Reserved"`
|
||||
Reserved Resource `json:"reserved"`
|
||||
|
||||
// Account ID
|
||||
AccountID uint64 `json:"id"`
|
||||
|
||||
@@ -8,15 +8,32 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about service
|
||||
// GetRequest struct to get detailed information about service
|
||||
type GetRequest struct {
|
||||
// ID of the service to query information
|
||||
// Required: true
|
||||
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets detailed specifications for the BasicService.
|
||||
// Get gets detailed specifications for the BasicService as a RecordBasicService struct
|
||||
func (b BService) Get(ctx context.Context, req GetRequest) (*RecordBasicService, error) {
|
||||
res, err := b.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordBasicService{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets detailed specifications for the BasicService as an array of bytes
|
||||
func (b BService) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
@@ -26,17 +43,6 @@ func (b BService) Get(ctx context.Context, req GetRequest) (*RecordBasicService,
|
||||
|
||||
url := "/cloudapi/bservice/get"
|
||||
|
||||
bsRaw, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordBasicService{}
|
||||
|
||||
err = json.Unmarshal(bsRaw, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list BasicService instances
|
||||
// ListRequest struct to get list of BasicService instances
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -49,11 +49,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list BasicService instances associated with the specified Resource Group
|
||||
// List gets list of BasicService instances associated with the specified Resource Group as a ListBasicServices struct
|
||||
func (b BService) List(ctx context.Context, req ListRequest) (*ListBasicServices, error) {
|
||||
url := "/cloudapi/bservice/list"
|
||||
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := b.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -67,3 +65,11 @@ func (b BService) List(ctx context.Context, req ListRequest) (*ListBasicServices
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of BasicService instances associated with the specified Resource Group as an array of bytes
|
||||
func (b BService) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/bservice/list"
|
||||
|
||||
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request for get information about compute
|
||||
// GetRequest struct to get information about compute
|
||||
type GetRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
ComputeID uint64 `url:"computeId" json:"computeId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get Gets information about compute
|
||||
// Get gets information about compute as a RecordCompute struct
|
||||
func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/get"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets information about compute as an array of bytes
|
||||
func (c Compute) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/compute/get"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list available computes
|
||||
// ListRequest struct to get list of available computes
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -64,9 +64,7 @@ type ListRequest struct {
|
||||
// List gets list of the available computes.
|
||||
// Filtering based on status is possible
|
||||
func (c Compute) List(ctx context.Context, req ListRequest) (*ListComputes, error) {
|
||||
url := "/cloudapi/compute/list"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -80,3 +78,11 @@ func (c Compute) List(ctx context.Context, req ListRequest) (*ListComputes, erro
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of the available computes.
|
||||
func (c Compute) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/compute/list"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ type ListPCIDeviceRequest struct {
|
||||
// Required: false
|
||||
DevID uint64 `url:"devId,omitempty" json:"devId,omitempty"`
|
||||
|
||||
// Find by type
|
||||
// Find by name
|
||||
// Required: false
|
||||
Type string `url:"type,omitempty" json:"type,omitempty"`
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Find by status
|
||||
// Required: false
|
||||
|
||||
@@ -8,26 +8,17 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about disk
|
||||
// GetRequest struct to get information about disk
|
||||
type GetRequest struct {
|
||||
// ID of the disk
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets disk details
|
||||
// Get gets disk details as a RecordDisk struct
|
||||
// Notice: the devicename field is the name as it is passed to the kernel (kname in linux) for unattached disks this field has no relevant value
|
||||
func (d Disks) Get(ctx context.Context, req GetRequest) (*RecordDisk, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/disks/get"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := d.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -41,3 +32,19 @@ func (d Disks) Get(ctx context.Context, req GetRequest) (*RecordDisk, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets disk details as an array of bytes
|
||||
// Notice: the devicename field is the name as it is passed to the kernel (kname in linux) for unattached disks this field has no relevant value
|
||||
func (d Disks) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/disks/get"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of disks
|
||||
// ListRequest struct to get list of disks
|
||||
type ListRequest struct {
|
||||
// Find by id
|
||||
// Required: false
|
||||
@@ -57,11 +57,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list the created disks belonging to an account
|
||||
// List gets list of the created disks belonging to an account as a ListDisks struct
|
||||
func (d Disks) List(ctx context.Context, req ListRequest) (*ListDisks, error) {
|
||||
url := "/cloudapi/disks/list"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := d.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -75,3 +73,11 @@ func (d Disks) List(ctx context.Context, req ListRequest) (*ListDisks, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of the created disks belonging to an account as an array of bytes
|
||||
func (d Disks) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/disks/list"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about external network
|
||||
// GetRequest struct to get detailed information about external network
|
||||
type GetRequest struct {
|
||||
// ID of external network
|
||||
// Required: true
|
||||
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets detailed information about external network
|
||||
// Get gets detailed information about external network as a RecordExtNet struct
|
||||
func (e ExtNet) Get(ctx context.Context, req GetRequest) (*RecordExtNet, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/extnet/get"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := e.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (e ExtNet) Get(ctx context.Context, req GetRequest) (*RecordExtNet, error)
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets detailed information about external network as an array of bytes
|
||||
func (e ExtNet) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/extnet/get"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list external network
|
||||
// ListRequest struct to get list of external network
|
||||
type ListRequest struct {
|
||||
// Find by account ID
|
||||
// Required: false
|
||||
@@ -45,11 +45,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all available external networks
|
||||
// List gets list of all available external networks as a ListExtNets struct
|
||||
func (e ExtNet) List(ctx context.Context, req ListRequest) (*ListExtNets, error) {
|
||||
url := "/cloudapi/extnet/list"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := e.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,3 +61,11 @@ func (e ExtNet) List(ctx context.Context, req ListRequest) (*ListExtNets, error)
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all available external networks as an array of bytes
|
||||
func (e ExtNet) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/extnet/list"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about FLIPGroup
|
||||
// GetRequest struct to get information about FLIPGroup
|
||||
type GetRequest struct {
|
||||
// FLIPGroup ID
|
||||
// Required: true
|
||||
FLIPGroupID uint64 `url:"flipgroupId" json:"flipgroupId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets details of the specified Floating IP group
|
||||
// Get gets details of the specified Floating IP group as a RecordFLIPGroup struct
|
||||
func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/flipgroup/get"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := f.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, e
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets details of the specified Floating IP group as an array of bytes
|
||||
func (f FLIPGroup) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/flipgroup/get"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list FLIPGroup available to the current user
|
||||
// ListRequest struct to get list of FLIPGroup available to the current user
|
||||
type ListRequest struct {
|
||||
// Find by name
|
||||
// Required: false
|
||||
@@ -25,11 +25,11 @@ type ListRequest struct {
|
||||
ExtNetID uint64 `url:"extnetId,omitempty" json:"extnetId,omitempty"`
|
||||
|
||||
// Find by IP
|
||||
// Reuqired: false
|
||||
// Required: false
|
||||
ByIP string `url:"byIp,omitempty" json:"byIp,omitempty"`
|
||||
|
||||
// Find by resource group ID
|
||||
// Reuqired: false
|
||||
// Required: false
|
||||
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
|
||||
|
||||
// Find by id
|
||||
@@ -45,11 +45,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list FLIPGroup managed cluster instances available to the current user
|
||||
// List gets list of FLIPGroup managed cluster instances available to the current user as a ListFLIPGroups struct
|
||||
func (f FLIPGroup) List(ctx context.Context, req ListRequest) (*ListFLIPGroups, error) {
|
||||
url := "/cloudapi/flipgroup/list"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := f.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,3 +61,11 @@ func (f FLIPGroup) List(ctx context.Context, req ListRequest) (*ListFLIPGroups,
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of FLIPGroup managed cluster instances available to the current user as an array of bytes
|
||||
func (f FLIPGroup) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/flipgroup/list"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about image
|
||||
// GetRequest struct to get detailed information about image
|
||||
type GetRequest struct {
|
||||
// ID of image to get
|
||||
// Required: true
|
||||
@@ -20,18 +20,9 @@ type GetRequest struct {
|
||||
}
|
||||
|
||||
// Get gets image by ID.
|
||||
// Returns image if user has rights on it
|
||||
// Returns image as a RecordImage struct if user has rights on it
|
||||
func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/image/get"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := i.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -45,3 +36,19 @@ func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets image by ID.
|
||||
// Returns image as an array of bytes if user has rights on it
|
||||
func (i Image) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/image/get"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list available images
|
||||
// ListRequest struct to get list of available images
|
||||
type ListRequest struct {
|
||||
// Find by storage endpoint provider ID
|
||||
// Required: false
|
||||
@@ -65,11 +65,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list available images, optionally filtering by account ID
|
||||
// List gets list of available images as a ListImages struct, optionally filtering by account ID
|
||||
func (i Image) List(ctx context.Context, req ListRequest) (*ListImages, error) {
|
||||
url := "/cloudapi/image/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := i.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -83,3 +81,11 @@ func (i Image) List(ctx context.Context, req ListRequest) (*ListImages, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of available images as an array of bytes
|
||||
func (i Image) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/image/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about K8CI
|
||||
// GetRequest struct to get information about K8CI
|
||||
type GetRequest struct {
|
||||
// ID of the K8 catalog item to get
|
||||
// Required: true
|
||||
K8CIID uint64 `url:"k8ciId" json:"k8ciId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets details of the specified K8 catalog item
|
||||
// Get gets details of the specified K8 catalog item as a RecordK8CI struct
|
||||
func (k K8CI) Get(ctx context.Context, req GetRequest) (*RecordK8CI, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/k8ci/get"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -39,3 +30,18 @@ func (k K8CI) Get(ctx context.Context, req GetRequest) (*RecordK8CI, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets details of the specified K8 catalog item as an array of bytes
|
||||
func (k K8CI) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/k8ci/get"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list information about images
|
||||
// ListRequest struct to get list of information about images
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -45,11 +45,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all k8ci catalog items available to the current user
|
||||
// List gets list of all k8ci catalog items available to the current user as a ListK8CI struct
|
||||
func (k K8CI) List(ctx context.Context, req ListRequest) (*ListK8CI, error) {
|
||||
url := "/cloudapi/k8ci/list"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,3 +61,11 @@ func (k K8CI) List(ctx context.Context, req ListRequest) (*ListK8CI, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all k8ci catalog items available to the current user as an array of bytes
|
||||
func (k K8CI) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/k8ci/list"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ type CreateRequest struct {
|
||||
|
||||
// Use Highly Available schema for LB deploy
|
||||
// Required: false
|
||||
HighlyAvailable bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
|
||||
HighlyAvailable bool `url:"highlyAvailableLB,omitempty" json:"highlyAvailableLB,omitempty"`
|
||||
|
||||
// Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names
|
||||
// Required: false
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about kubernetes cluster
|
||||
// GetRequest struct to get detailed information about kubernetes cluster
|
||||
type GetRequest struct {
|
||||
// Kubernetes cluster ID
|
||||
// Required: true
|
||||
K8SID uint64 `url:"k8sId" json:"k8sId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets information about Kubernetes cluster
|
||||
// Get gets information about Kubernetes cluster as a RecordK8S struct
|
||||
func (k8s K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/k8s/get"
|
||||
|
||||
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k8s.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (k8s K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets information about Kubernetes cluster as an array of bytes
|
||||
func (k8s K8S) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/k8s/get"
|
||||
|
||||
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list information K8S
|
||||
// ListRequest struct to get list information K8S
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -53,11 +53,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all kubernetes clusters the user has access to
|
||||
// List gets list of all kubernetes clusters the user has access to as a ListK8SClusters
|
||||
func (k8s K8S) List(ctx context.Context, req ListRequest) (*ListK8SClusters, error) {
|
||||
url := "/cloudapi/k8s/list"
|
||||
|
||||
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k8s.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -71,3 +69,11 @@ func (k8s K8S) List(ctx context.Context, req ListRequest) (*ListK8SClusters, err
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all kubernetes clusters the user has access to as an array of bytes
|
||||
func (k8s K8S) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/k8s/list"
|
||||
|
||||
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -32,10 +32,6 @@ type ListDeletedRequest struct {
|
||||
// Required: false
|
||||
BasicServiceID uint64 `url:"basicServiceId,omitempty" json:"basicServiceId,omitempty"`
|
||||
|
||||
// Find by status
|
||||
// Required: false
|
||||
Status string `url:"status,omitempty" json:"status,omitempty"`
|
||||
|
||||
// Find by techStatus
|
||||
// Required: false
|
||||
TechStatus string `url:"techStatus,omitempty" json:"techStatus,omitempty"`
|
||||
|
||||
@@ -56,6 +56,10 @@ type WorkersGroupAddRequest struct {
|
||||
// Worker node boot disk size in GB If 0 is specified, size is defined by the OS image size
|
||||
// Required: false
|
||||
WorkerDisk uint64 `url:"workerDisk,omitempty" json:"workerDisk,omitempty"`
|
||||
|
||||
// Meta data for working group computes, format YAML "user_data": 1111
|
||||
// Required: false
|
||||
UserData string `url:"userData,omitempty" json:"userData,omitempty"`
|
||||
}
|
||||
|
||||
// WorkersGroupAdd adds workers group to Kubernetes cluster
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about load balancer
|
||||
// GetRequest struct to get detailed information about load balancer
|
||||
type GetRequest struct {
|
||||
// ID of the load balancer to get details for
|
||||
// Required: true
|
||||
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets detailed information about load balancer
|
||||
// Get gets detailed information about load balancer as a RecordLB struct
|
||||
func (l LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/lb/get"
|
||||
|
||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := l.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (l LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets detailed information about load balancer as an array of bytes
|
||||
func (l LB) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/lb/get"
|
||||
|
||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of load balancers
|
||||
// ListRequest struct to get list of load balancers
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -53,11 +53,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all load balancers
|
||||
// List gets list of all load balancers as a ListLB struct
|
||||
func (l LB) List(ctx context.Context, req ListRequest) (*ListLB, error) {
|
||||
url := "/cloudapi/lb/list"
|
||||
|
||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := l.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -71,3 +69,11 @@ func (l LB) List(ctx context.Context, req ListRequest) (*ListLB, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all load balancers as an array of bytes
|
||||
func (l LB) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/lb/list"
|
||||
|
||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ type RecordLB struct {
|
||||
HAMode bool `json:"HAmode"`
|
||||
|
||||
// Access Control List
|
||||
ACL []interface{} `json:"acl"`
|
||||
ACL interface{} `json:"acl"`
|
||||
|
||||
// BackendHAIP
|
||||
BackendHAIP string `json:"backendHAIP"`
|
||||
@@ -78,7 +78,7 @@ type RecordLB struct {
|
||||
Status string `json:"status"`
|
||||
|
||||
// Sysctl Params
|
||||
SysctlParams []interface{} `json:"sysctlParams"`
|
||||
SysctlParams interface{} `json:"sysctlParams"`
|
||||
|
||||
// Tech status
|
||||
TechStatus string `json:"techStatus"`
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of locations
|
||||
// ListRequest struct to get list of locations
|
||||
type ListRequest struct {
|
||||
// Page number
|
||||
// Required: false
|
||||
@@ -33,11 +33,9 @@ type ListRequest struct {
|
||||
LocationCode string `url:"locationCode,omitempty" json:"locationCode,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all locations
|
||||
// List gets list of all locations as a ListLocations struct
|
||||
func (l Locations) List(ctx context.Context, req ListRequest) (*ListLocations, error) {
|
||||
url := "/cloudapi/locations/list"
|
||||
|
||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := l.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -51,3 +49,11 @@ func (l Locations) List(ctx context.Context, req ListRequest) (*ListLocations, e
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all locations as an array of bytes
|
||||
func (l Locations) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/locations/list"
|
||||
|
||||
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -13,6 +13,14 @@ type AffinityGroupsListRequest struct {
|
||||
// Resource group ID
|
||||
// Required: true
|
||||
RGID uint64 `url:"rgId" json:"rgId" validate:"required"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// AffinityGroupsList gets all currently defined affinity groups in this resource group with compute IDs
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about resource group
|
||||
// GetRequest struct to get detailed information about resource group
|
||||
type GetRequest struct {
|
||||
// Resource group ID
|
||||
// Required: true
|
||||
@@ -19,18 +19,9 @@ type GetRequest struct {
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// Get gets current configuration of the resource group
|
||||
// Get gets current configuration of the resource group as a RecordResourceGroup struct
|
||||
func (r RG) Get(ctx context.Context, req GetRequest) (*RecordResourceGroup, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/get"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := r.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -44,3 +35,18 @@ func (r RG) Get(ctx context.Context, req GetRequest) (*RecordResourceGroup, erro
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets current configuration of the resource group as an array of bytes
|
||||
func (r RG) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/rg/get"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of resource groups
|
||||
// ListRequest struct to get list of resource groups
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -53,11 +53,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of all resource groups the user has access to
|
||||
// List gets list of all resource groups the user has access to as a ListResourceGroups struct
|
||||
func (r RG) List(ctx context.Context, req ListRequest) (*ListResourceGroups, error) {
|
||||
url := "/cloudapi/rg/list"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := r.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -71,3 +69,11 @@ func (r RG) List(ctx context.Context, req ListRequest) (*ListResourceGroups, err
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all resource groups the user has access to as an array of bytes
|
||||
func (r RG) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/rg/list"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -48,10 +48,10 @@ type Resources struct {
|
||||
// Detailed information about resource consumption
|
||||
type ItemResourceConsumption struct {
|
||||
// Consumed information about resources
|
||||
Consumed Resource `json:"Consumed"`
|
||||
Consumed Resource `json:"consumed"`
|
||||
|
||||
// Reserved information about resources
|
||||
Reserved Resource `json:"Reserved"`
|
||||
Reserved Resource `json:"reserved"`
|
||||
|
||||
// Resource limits
|
||||
ResourceLimits ResourceLimits `json:"resourceLimits"`
|
||||
@@ -333,7 +333,7 @@ type ListAffinityGroupsComputes []ItemAffinityGroupComputes
|
||||
|
||||
type ListAffinityGroups struct {
|
||||
// Data
|
||||
Data map[string][]uint64 `json:"data"`
|
||||
Data []map[string][]uint64 `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for list the available flavors
|
||||
// ListRequest struct for list of the available flavors
|
||||
type ListRequest struct {
|
||||
// ID of the cloudspace
|
||||
// Required: false
|
||||
@@ -25,11 +25,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list the available flavors, filtering can be based on the user which is doing the request
|
||||
// List gets list of the available flavors as a ListSizes struct, filtering can be based on the user which is doing the request
|
||||
func (s Sizes) List(ctx context.Context, req ListRequest) (*ListSizes, error) {
|
||||
url := "/cloudapi/sizes/list"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := s.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -43,3 +41,11 @@ func (s Sizes) List(ctx context.Context, req ListRequest) (*ListSizes, error) {
|
||||
|
||||
return list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of the available flavors as an array of bytes
|
||||
func (s Sizes) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/sizes/list"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get info of stack
|
||||
// GetRequest struct to get info of stack
|
||||
type GetRequest struct {
|
||||
// Find by ID
|
||||
// Required: true
|
||||
StackId uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get stack details by ID
|
||||
// Get gets stack details by ID as an InfoStack struct
|
||||
func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/stack/get"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := i.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets stack details by ID as an array of bytes
|
||||
func (i Stack) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/stack/get"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list stack
|
||||
// ListRequest struct to get list of stacks
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -33,11 +33,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// ListStacks gets list stack
|
||||
// List gets list of stacks as a ListStacks struct
|
||||
func (i Stack) List(ctx context.Context, req ListRequest) (*ListStacks, error) {
|
||||
url := "/cloudapi/stack/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := i.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -51,3 +49,11 @@ func (i Stack) List(ctx context.Context, req ListRequest) (*ListStacks, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of stacks as an array of bytes
|
||||
func (i Stack) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/stack/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get infromation about task
|
||||
// GetRequest struct to get information about task
|
||||
type GetRequest struct {
|
||||
// ID of audit
|
||||
// Required: true
|
||||
AuditID string `url:"auditId" json:"auditId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets background API task status and result
|
||||
// Get gets background API task status and result as a RecordAsyncTask struct
|
||||
func (t Tasks) Get(ctx context.Context, req GetRequest) (*RecordAsyncTask, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/tasks/get"
|
||||
|
||||
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := t.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -41,3 +32,18 @@ func (t Tasks) Get(ctx context.Context, req GetRequest) (*RecordAsyncTask, error
|
||||
return &info, nil
|
||||
|
||||
}
|
||||
|
||||
// GetRaw gets background API task status and result as an array of bytes
|
||||
func (t Tasks) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/tasks/get"
|
||||
|
||||
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of tasks
|
||||
// ListRequest struct to get list of tasks
|
||||
type ListRequest struct {
|
||||
// Page number
|
||||
// Required: false
|
||||
@@ -17,11 +17,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list user API tasks with status PROCESSING
|
||||
// List gets list of user API tasks with status PROCESSING as a ListTasks struct
|
||||
func (t Tasks) List(ctx context.Context, req ListRequest) (*ListTasks, error) {
|
||||
url := "/cloudapi/tasks/list"
|
||||
|
||||
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := t.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -35,3 +33,11 @@ func (t Tasks) List(ctx context.Context, req ListRequest) (*ListTasks, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of user API tasks with status PROCESSING as an array of bytes
|
||||
func (t Tasks) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/tasks/list"
|
||||
|
||||
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about VINS
|
||||
// GetRequest struct to get information about VINS
|
||||
type GetRequest struct {
|
||||
// VINS ID
|
||||
// Required: true
|
||||
VINSID uint64 `url:"vinsId" json:"vinsId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets information about VINS by ID
|
||||
// Get gets information about VINS by ID as a RecordVINS struct
|
||||
func (v VINS) Get(ctx context.Context, req GetRequest) (*RecordVINS, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/vins/get"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := v.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -39,5 +30,19 @@ func (v VINS) Get(ctx context.Context, req GetRequest) (*RecordVINS, error) {
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
|
||||
}
|
||||
|
||||
// GetRaw gets information about VINS by ID as an array of bytes
|
||||
func (v VINS) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudapi/vins/get"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of VINSes
|
||||
// ListRequest struct to get list of VINSes
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -41,11 +41,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of VINSes available for current user
|
||||
// List gets list of VINSes available for current user as a ListVINS struct
|
||||
func (v VINS) List(ctx context.Context, req ListRequest) (*ListVINS, error) {
|
||||
url := "/cloudapi/vins/list"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := v.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -59,3 +57,11 @@ func (v VINS) List(ctx context.Context, req ListRequest) (*ListVINS, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of VINSes available for current user as an array of bytes
|
||||
func (v VINS) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudapi/vins/list"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,15 +8,32 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about account
|
||||
// GetRequest struct to get information about account
|
||||
type GetRequest struct {
|
||||
// ID an account
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets information about account
|
||||
// Get gets information about account as a RecordAccount struct
|
||||
func (a Account) Get(ctx context.Context, req GetRequest) (*RecordAccount, error) {
|
||||
res, err := a.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordAccount{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets information about account as an array of bytes
|
||||
func (a Account) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
@@ -26,17 +43,6 @@ func (a Account) Get(ctx context.Context, req GetRequest) (*RecordAccount, error
|
||||
|
||||
url := "/cloudbroker/account/get"
|
||||
|
||||
info := RecordAccount{}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of accounts
|
||||
// ListRequest struct to get list of accounts
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -33,11 +33,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all accounts the user has access to
|
||||
// List gets list of all accounts the user has access to as a ListAccounts struct
|
||||
func (a Account) List(ctx context.Context, req ListRequest) (*ListAccounts, error) {
|
||||
url := "/cloudbroker/account/list"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := a.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -51,3 +49,11 @@ func (a Account) List(ctx context.Context, req ListRequest) (*ListAccounts, erro
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all accounts the user has access to as an array of bytes
|
||||
func (a Account) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/account/list"
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@ type RecordResourceConsumption struct {
|
||||
|
||||
type ItemResourceConsumption struct {
|
||||
// Current information about resources
|
||||
Current Resource `json:"Current"`
|
||||
Consumed Resource `json:"consumed"`
|
||||
|
||||
// Reserved information about resources
|
||||
Reserved Resource `json:"Reserved"`
|
||||
Reserved Resource `json:"reserved"`
|
||||
|
||||
// ID of account
|
||||
AccountID uint64 `json:"id"`
|
||||
@@ -54,7 +54,7 @@ type Resource struct {
|
||||
DiskSize float64 `json:"disksize"`
|
||||
|
||||
// Disk size max
|
||||
DiskSizeMax uint64 `json:"disksizemax"`
|
||||
DiskSizeMax float64 `json:"disksizemax"`
|
||||
|
||||
// Number of External IPs
|
||||
ExtIPs int64 `json:"extips"`
|
||||
@@ -414,33 +414,6 @@ type Computes struct {
|
||||
Stopped uint64 `json:"Stopped"`
|
||||
}
|
||||
|
||||
// Consumed
|
||||
type Consumed struct {
|
||||
// Number of CPU
|
||||
CPU uint64 `json:"cpu"`
|
||||
|
||||
// Disk size
|
||||
DiskSize float64 `json:"disksize"`
|
||||
|
||||
// Disk size max
|
||||
DiskSizeMax int64 `json:"disksizemax"`
|
||||
|
||||
// External IPs
|
||||
ExtIPs uint64 `json:"extips"`
|
||||
|
||||
// External traffic
|
||||
ExtTraffic uint64 `json:"exttraffic"`
|
||||
|
||||
// Number of GPU
|
||||
GPU uint64 `json:"gpu"`
|
||||
|
||||
// Number of RAM
|
||||
RAM uint64 `json:"ram"`
|
||||
|
||||
// SEPs
|
||||
SEPs map[string]map[string]DiskUsage `json:"seps"`
|
||||
}
|
||||
|
||||
// Limits
|
||||
type Limits struct {
|
||||
// Number of CPU
|
||||
@@ -471,7 +444,7 @@ type Limits struct {
|
||||
// Resources of resource group
|
||||
type RGResuorces struct {
|
||||
// Consumed
|
||||
Consumed Consumed `json:"Consumed"`
|
||||
Consumed Resource `json:"Consumed"`
|
||||
|
||||
// Limits
|
||||
Limits Limits `json:"Limits"`
|
||||
|
||||
@@ -8,15 +8,32 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting apiaccess group.
|
||||
// GetRequest struct to get apiaccess group.
|
||||
type GetRequest struct {
|
||||
// APIAccess group ID.
|
||||
// Required: true
|
||||
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets apiaccess group.
|
||||
// Get gets apiaccess group as an ItemAPIAccess struct
|
||||
func (a APIAccess) Get(ctx context.Context, req GetRequest) (*ItemAPIAccess, error) {
|
||||
res, err := a.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := ItemAPIAccess{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets apiaccess group as an array of bytes
|
||||
func (a APIAccess) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
@@ -26,17 +43,6 @@ func (a APIAccess) Get(ctx context.Context, req GetRequest) (*ItemAPIAccess, err
|
||||
|
||||
url := "/cloudbroker/apiaccess/get"
|
||||
|
||||
info := ItemAPIAccess{}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting list of all non deleted apiaccess instances.
|
||||
// ListRequest struct to get list of all non deleted apiaccess instances.
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -43,8 +43,25 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of all non deleted apiaccess instances.
|
||||
// List gets list of all non deleted apiaccess instances as a ListAPIAccess struct
|
||||
func (a APIAccess) List(ctx context.Context, req ListRequest) (*ListAPIAccess, error) {
|
||||
res, err := a.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := ListAPIAccess{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all non deleted apiaccess instances as an array of bytes
|
||||
func (a APIAccess) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
@@ -54,17 +71,6 @@ func (a APIAccess) List(ctx context.Context, req ListRequest) (*ListAPIAccess, e
|
||||
|
||||
url := "/cloudbroker/apiaccess/list"
|
||||
|
||||
info := ListAPIAccess{}
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request for get information about compute
|
||||
// GetRequest to get information about compute
|
||||
type GetRequest struct {
|
||||
// ID of compute instance
|
||||
// Required: true
|
||||
@@ -19,18 +19,9 @@ type GetRequest struct {
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// Get gets information about compute
|
||||
// Get gets information about compute as a RecordCompute struct
|
||||
func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/get"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -44,3 +35,18 @@ func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets information about compute as an array of bytes
|
||||
func (c Compute) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/compute/get"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list available computes
|
||||
// ListRequest struct to get list of available computes
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -61,12 +61,10 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of the available computes.
|
||||
// List gets list of the available computes as a ListComputes struct.
|
||||
// Filtering based on status is possible
|
||||
func (c Compute) List(ctx context.Context, req ListRequest) (*ListComputes, error) {
|
||||
url := "/cloudbroker/compute/list"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := c.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -80,3 +78,11 @@ func (c Compute) List(ctx context.Context, req ListRequest) (*ListComputes, erro
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of the available computes as an array of bytes
|
||||
func (c Compute) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/compute/list"
|
||||
|
||||
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -672,7 +672,7 @@ type InfoCompute struct {
|
||||
StackName string `json:"stackName"`
|
||||
|
||||
// Stateless SEP ID
|
||||
StatelessSEPID uint64 `json:"statelessSepId"`
|
||||
StatelessSEPID int64 `json:"statelessSepId"`
|
||||
|
||||
// Stateless SEP Type
|
||||
StatelessSEPType string `json:"statelessSepType"`
|
||||
|
||||
@@ -8,26 +8,17 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about disk
|
||||
// GetRequest struct to get information about disk
|
||||
type GetRequest struct {
|
||||
// ID of the disk
|
||||
// Required: true
|
||||
DiskID uint64 `url:"diskId" json:"diskId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets disk details
|
||||
// Get gets disk details as a RecordDisk struct.
|
||||
// Notice: the devicename field is the name as it is passed to the kernel (kname in linux) for unattached disks this field has no relevant value
|
||||
func (d Disks) Get(ctx context.Context, req GetRequest) (*RecordDisk, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/get"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := d.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -41,3 +32,19 @@ func (d Disks) Get(ctx context.Context, req GetRequest) (*RecordDisk, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets disk details as an array of bytes.
|
||||
// Notice: the devicename field is the name as it is passed to the kernel (kname in linux) for unattached disks this field has no relevant value
|
||||
func (d Disks) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/disks/get"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list/list_deleted of disks
|
||||
// ListRequest struct to get list/list_deleted of disks
|
||||
type ListRequest struct {
|
||||
// Find by id
|
||||
// Required: false
|
||||
@@ -57,11 +57,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list the created disks belonging to an account
|
||||
// List gets list of the created disks belonging to an account as a ListDisks struct
|
||||
func (d Disks) List(ctx context.Context, req ListRequest) (*ListDisks, error) {
|
||||
url := "/cloudbroker/disks/list"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := d.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -75,3 +73,11 @@ func (d Disks) List(ctx context.Context, req ListRequest) (*ListDisks, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of the created disks belonging to an account as an array of bytes
|
||||
func (d Disks) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/disks/list"
|
||||
|
||||
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about external network
|
||||
// GetRequest struct to get information about external network
|
||||
type GetRequest struct {
|
||||
// ID of external network
|
||||
// Required: true
|
||||
NetID uint64 `url:"net_id" json:"net_id" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets external network details
|
||||
// Get gets external network details as a RecordExtNet struct
|
||||
func (e ExtNet) Get(ctx context.Context, req GetRequest) (*RecordExtNet, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/extnet/get"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := e.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (e ExtNet) Get(ctx context.Context, req GetRequest) (*RecordExtNet, error)
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets external network details as an array of bytes
|
||||
func (e ExtNet) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/extnet/get"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list external network
|
||||
// ListRequest struct to get list of external network
|
||||
type ListRequest struct {
|
||||
// Find by account ID
|
||||
// Required: false
|
||||
@@ -45,11 +45,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all available external networks
|
||||
// List gets list of all available external networks as a ListExtNet struct
|
||||
func (e ExtNet) List(ctx context.Context, req ListRequest) (*ListExtNet, error) {
|
||||
url := "/cloudbroker/extnet/list"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := e.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,3 +61,11 @@ func (e ExtNet) List(ctx context.Context, req ListRequest) (*ListExtNet, error)
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all available external networks as an array of bytes
|
||||
func (e ExtNet) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/extnet/list"
|
||||
|
||||
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -127,29 +127,86 @@ type ListExtNet struct {
|
||||
|
||||
// Detailed information about external network
|
||||
type RecordExtNet struct {
|
||||
// Main information about external network
|
||||
ItemExtNet
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// CheckIps
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
// CheckIPs
|
||||
CheckIPs []string `json:"checkIps"`
|
||||
|
||||
// Default
|
||||
Default bool `json:"default"`
|
||||
|
||||
// Default QOS
|
||||
DefaultQOS QOS `json:"defaultQos"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// List DNS
|
||||
DNS []string `json:"dns"`
|
||||
|
||||
// List excludes
|
||||
Excluded ListReservations `json:"excluded"`
|
||||
|
||||
// Free IPs number
|
||||
FreeIPs uint64 `json:"free_ips"`
|
||||
|
||||
// Gateway
|
||||
Gateway string `json:"gateway"`
|
||||
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GUID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// IPCIDR
|
||||
IPCIDR string `json:"ipcidr"`
|
||||
|
||||
// Milestones
|
||||
Milestones uint64 `json:"milestones"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Network
|
||||
Network string `json:"network"`
|
||||
|
||||
// Network ID
|
||||
NetworkID uint64 `json:"networkId"`
|
||||
|
||||
// OVSBridge
|
||||
OVSBridge string `json:"ovsBridge"`
|
||||
|
||||
// PreReservationsNum
|
||||
PreReservationsNum uint64 `json:"preReservationsNum"`
|
||||
|
||||
// Prefix
|
||||
Prefix uint64 `json:"prefix"`
|
||||
|
||||
// PriVNFDevID
|
||||
PriVNFDevID uint64 `json:"priVnfDevId"`
|
||||
|
||||
// List reservations
|
||||
Reservations ListReservations `json:"reservations"`
|
||||
|
||||
// List of shared with
|
||||
SharedWith []interface{} `json:"sharedWith"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// VLAN ID
|
||||
VLANID uint64 `json:"vlanId"`
|
||||
|
||||
// VNFs
|
||||
VNFs VNFs `json:"vnfs"`
|
||||
}
|
||||
|
||||
// List of static routes
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about FLIPGroup
|
||||
// GetRequest struct to get information about FLIPGroup
|
||||
type GetRequest struct {
|
||||
// FLIPGroup ID
|
||||
// Required: true
|
||||
FLIPGroupID uint64 `url:"flipgroupId" json:"flipgroupId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets details of the specified Floating IP group
|
||||
// Get gets details of the specified Floating IP group as a RecordFLIPGroup struct
|
||||
func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/flipgroup/get"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := f.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, e
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets details of the specified Floating IP group as an array of bytes
|
||||
func (f FLIPGroup) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/flipgroup/get"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list FLIPGroup available to the current user
|
||||
// ListRequest struct to get list of FLIPGroup available to the current user
|
||||
type ListRequest struct {
|
||||
// Find by name
|
||||
// Required: false
|
||||
@@ -25,11 +25,11 @@ type ListRequest struct {
|
||||
ExtNetID uint64 `url:"extnetId,omitempty" json:"extnetId,omitempty"`
|
||||
|
||||
// Find by IP
|
||||
// Reuqired: false
|
||||
// Required: false
|
||||
ByIP string `url:"byIp,omitempty" json:"byIp,omitempty"`
|
||||
|
||||
// Find by resource group ID
|
||||
// Reuqired: false
|
||||
// Required: false
|
||||
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
|
||||
|
||||
// Find by id
|
||||
@@ -45,11 +45,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list FLIPGroup managed cluster instances available to the current user
|
||||
// List gets list of FLIPGroup managed cluster instances available to the current user as a ListFLIPGroups struct
|
||||
func (f FLIPGroup) List(ctx context.Context, req ListRequest) (*ListFLIPGroups, error) {
|
||||
url := "/cloudbroker/flipgroup/list"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := f.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,3 +61,11 @@ func (f FLIPGroup) List(ctx context.Context, req ListRequest) (*ListFLIPGroups,
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of FLIPGroup managed cluster instances available to the current user as an array of bytes
|
||||
func (f FLIPGroup) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/flipgroup/list"
|
||||
|
||||
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -9,6 +9,15 @@ func (lg ListGrids) FilterByID(id uint64) ListGrids {
|
||||
return lg.FilterFunc(predicate)
|
||||
}
|
||||
|
||||
// FilterByGID returns ListGrids with specified GID.
|
||||
func (lg ListGrids) FilterByGID(gid uint64) ListGrids {
|
||||
predicate := func(rg ItemGridList) bool {
|
||||
return rg.GID == gid
|
||||
}
|
||||
|
||||
return lg.FilterFunc(predicate)
|
||||
}
|
||||
|
||||
// FilterByName returns ListGrids with specified Name.
|
||||
func (lg ListGrids) FilterByName(name string) ListGrids {
|
||||
predicate := func(rg ItemGridList) bool {
|
||||
|
||||
@@ -106,6 +106,14 @@ func TestFilterByID(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterByGID(t *testing.T) {
|
||||
actual := grids.FilterByGID(777).FindOne()
|
||||
|
||||
if actual.GID != 777 {
|
||||
t.Fatal("expected ID 777, found: ", actual.GID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterByName(t *testing.T) {
|
||||
actual := grids.FilterByName("gamma").FindOne()
|
||||
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get grid details
|
||||
// GetRequest struct to get grid details
|
||||
type GetRequest struct {
|
||||
// Grid (platform) ID
|
||||
// Required: true
|
||||
GID uint64 `url:"gridId" json:"gridId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets information about grid by ID
|
||||
// Get gets information about grid by ID as a RecordGrid struct
|
||||
func (g Grid) Get(ctx context.Context, req GetRequest) (*RecordGrid, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/get"
|
||||
|
||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := g.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (g Grid) Get(ctx context.Context, req GetRequest) (*RecordGrid, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets information about grid by ID as an array of bytes
|
||||
func (g Grid) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/grid/get"
|
||||
|
||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list locations
|
||||
// ListRequest struct to get list of locations
|
||||
type ListRequest struct {
|
||||
// Find by id grid
|
||||
// Required: false
|
||||
@@ -25,11 +25,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all locations
|
||||
// List gets list of all locations as a ListGrids struct
|
||||
func (g Grid) List(ctx context.Context, req ListRequest) (*ListGrids, error) {
|
||||
url := "/cloudbroker/grid/list"
|
||||
|
||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := g.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -43,3 +41,11 @@ func (g Grid) List(ctx context.Context, req ListRequest) (*ListGrids, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all locations as an array of bytes
|
||||
func (g Grid) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/grid/list"
|
||||
|
||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Reuqest struct for getting details of the specified group.
|
||||
// GetRequest struct to get details of the specified group.
|
||||
type GetRequest struct {
|
||||
// Group ID
|
||||
// Required: true
|
||||
GroupID string `url:"groupId" json:"groupId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets details of the specified group.
|
||||
// Get gets details of the specified group as an ItemGroup struct
|
||||
func (g Group) Get(ctx context.Context, req GetRequest) (*ItemGroup, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/group/get"
|
||||
|
||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := g.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (g Group) Get(ctx context.Context, req GetRequest) (*ItemGroup, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets details of the specified group as an array of bytes
|
||||
func (g Group) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/group/get"
|
||||
|
||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting list of group instances.
|
||||
// ListRequest struct to get list of group instances.
|
||||
type ListRequest struct {
|
||||
// Find by id.
|
||||
// Requires: false
|
||||
@@ -31,17 +31,9 @@ type ListRequest struct {
|
||||
Active bool `url:"active" json:"active" validate:"required"`
|
||||
}
|
||||
|
||||
// List gets list of group instances as a ListGroups struct
|
||||
func (g Group) List(ctx context.Context, req ListRequest) (*ListGroups, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/group/list"
|
||||
|
||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := g.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -55,3 +47,18 @@ func (g Group) List(ctx context.Context, req ListRequest) (*ListGroups, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of group instances as an array of bytes
|
||||
func (g Group) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/group/list"
|
||||
|
||||
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,15 +8,32 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get image details
|
||||
// GetRequest struct to get image details
|
||||
type GetRequest struct {
|
||||
// ID of image
|
||||
// Required: true
|
||||
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get get image details by ID
|
||||
// Get gets image details by ID as a RecordImage struct
|
||||
func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error) {
|
||||
res, err := i.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := RecordImage{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets image details by ID as an array of bytes
|
||||
func (i Image) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
@@ -26,17 +43,6 @@ func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error) {
|
||||
|
||||
url := "/cloudbroker/image/get"
|
||||
|
||||
info := RecordImage{}
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list available images
|
||||
// ListRequest struct to get list of available images
|
||||
type ListRequest struct {
|
||||
// Filter images by storage endpoint provider ID
|
||||
// Required: false
|
||||
@@ -65,11 +65,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of information about images
|
||||
// List gets list of information about images as a ListImages struct
|
||||
func (i Image) List(ctx context.Context, req ListRequest) (*ListImages, error) {
|
||||
url := "/cloudbroker/image/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := i.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -83,3 +81,11 @@ func (i Image) List(ctx context.Context, req ListRequest) (*ListImages, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of information about images as an array of bytes
|
||||
func (i Image) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/image/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -176,10 +176,10 @@ type GUID string
|
||||
func (r *GUID) UnmarshalJSON(b []byte) error {
|
||||
|
||||
if b[0] == '"' {
|
||||
*r = GUID(string(b[1:len(b)-1]))
|
||||
*r = GUID(string(b[1 : len(b)-1]))
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
*r = GUID(string(b))
|
||||
|
||||
return nil
|
||||
@@ -190,74 +190,167 @@ type ListHistory []History
|
||||
|
||||
// List stacks
|
||||
type ListStacks struct {
|
||||
Data []struct {
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
// API URL
|
||||
APIURL string `json:"apiUrl"`
|
||||
|
||||
// API key
|
||||
APIKey string `json:"apikey"`
|
||||
|
||||
// App ID
|
||||
AppID string `json:"appId"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// Descr
|
||||
Descr string `json:"descr"`
|
||||
|
||||
// Drivers
|
||||
Drivers []string `json:"drivers"`
|
||||
|
||||
// Eco
|
||||
Eco interface{} `json:"eco"`
|
||||
|
||||
// Error
|
||||
Error uint64 `json:"error"`
|
||||
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// List image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
// Login
|
||||
Login string `json:"login"`
|
||||
|
||||
// Mem allocation ratio
|
||||
// Required: false
|
||||
MemAllocationRatio float64 `json:"mem_allocation_ratio"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Password
|
||||
Password string `json:"passwd"`
|
||||
|
||||
// Reference ID
|
||||
ReferenceID string `json:"referenceId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
} `json:"data"`
|
||||
// Data
|
||||
Data []ItemListStacks `json:"data"`
|
||||
|
||||
// Entry count
|
||||
EntryCount uint64 `json:"entryCount"`
|
||||
}
|
||||
|
||||
// Detailed information about image
|
||||
type ItemListStacks struct {
|
||||
// CKey
|
||||
CKey string `json:"_ckey"`
|
||||
|
||||
// Meta
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
// API URL
|
||||
APIURL string `json:"apiUrl"`
|
||||
|
||||
// API key
|
||||
APIKey string `json:"apikey"`
|
||||
|
||||
// App ID
|
||||
AppID string `json:"appId"`
|
||||
|
||||
// CPU allocation ratio
|
||||
CPUAllocationRatio float64 `json:"cpu_allocation_ratio"`
|
||||
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// Descr
|
||||
Descr string `json:"descr"`
|
||||
|
||||
// Drivers
|
||||
Drivers []string `json:"drivers"`
|
||||
|
||||
// Eco
|
||||
Eco interface{} `json:"eco"`
|
||||
|
||||
// Error
|
||||
Error uint64 `json:"error"`
|
||||
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
// GID
|
||||
GUID uint64 `json:"guid"`
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// List image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
// Login
|
||||
Login string `json:"login"`
|
||||
|
||||
// Mem allocation ratio
|
||||
MemAllocationRatio float64 `json:"mem_allocation_ratio"`
|
||||
|
||||
// Name
|
||||
Name string `json:"name"`
|
||||
|
||||
// Packegas
|
||||
Packages Packages `json:"packages"`
|
||||
|
||||
// Password
|
||||
Password string `json:"passwd"`
|
||||
|
||||
// Reference ID
|
||||
ReferenceID string `json:"referenceId"`
|
||||
|
||||
// Status
|
||||
Status string `json:"status"`
|
||||
|
||||
// Type
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// Package
|
||||
type Packages struct {
|
||||
// LibvirtBin
|
||||
LibvirtBin LibvirtBin `json:"libvirt-bin"`
|
||||
|
||||
// LibvirtDaemon
|
||||
LibvirtDaemon LibvirtDaemon `json:"libvirt-daemon"`
|
||||
|
||||
// Lvm2Lockd
|
||||
Lvm2Lockd Lvm2Lockd `json:"lvm2-lockd"`
|
||||
|
||||
// OpenvswitchCommon
|
||||
OpenvswitchCommon OpenvswitchCommon `json:"openvswitch-common"`
|
||||
|
||||
// OpenvswitchSwitch
|
||||
OpenvswitchSwitch OpenvswitchSwitch `json:"openvswitch-switch"`
|
||||
|
||||
// QemuSystemX86
|
||||
QemuSystemX86 QemuSystemX86 `json:"qemu-system-x86"`
|
||||
|
||||
// Sanlock
|
||||
Sanlock Sanlock `json:"sanlock"`
|
||||
}
|
||||
|
||||
// LibvirtBin
|
||||
type LibvirtBin struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
type LibvirtDaemon struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// Lvm2Lockd
|
||||
type Lvm2Lockd struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// OpenvswitchCommon
|
||||
type OpenvswitchCommon struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// OpenvswitchSwitch
|
||||
type OpenvswitchSwitch struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// QemuSystemX86
|
||||
type QemuSystemX86 struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
// Sanlock
|
||||
type Sanlock struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about K8CI
|
||||
// GetRequest struct to get information about K8CI
|
||||
type GetRequest struct {
|
||||
// ID of the K8 catalog item to get
|
||||
// Required: true
|
||||
K8CIID uint64 `url:"k8ciId" json:"k8ciId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets details of the specified K8 catalog item
|
||||
// Get gets details of the specified K8 catalog item as a RecordK8CI struct
|
||||
func (k K8CI) Get(ctx context.Context, req GetRequest) (*RecordK8CI, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/k8ci/get"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (k K8CI) Get(ctx context.Context, req GetRequest) (*RecordK8CI, error) {
|
||||
|
||||
return &item, nil
|
||||
}
|
||||
|
||||
// GetRaw gets details of the specified K8 catalog item as an array of bytes
|
||||
func (k K8CI) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/k8ci/get"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list information about images
|
||||
// ListRequest struct to get list information about images
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -45,11 +45,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all k8ci catalog items available to the current user
|
||||
// List gets list of all k8ci catalog items available to the current user as a ListK8CI struct
|
||||
func (k K8CI) List(ctx context.Context, req ListRequest) (*ListK8CI, error) {
|
||||
url := "/cloudbroker/k8ci/list"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,3 +61,11 @@ func (k K8CI) List(ctx context.Context, req ListRequest) (*ListK8CI, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all k8ci catalog items available to the current user as an array of bytes
|
||||
func (k K8CI) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/k8ci/list"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ type CreateRequest struct {
|
||||
|
||||
// Use Highly Available schema for LB deploy
|
||||
// Required: false
|
||||
HighlyAvailable bool `url:"highlyAvailable,omitempty" json:"highlyAvailable,omitempty"`
|
||||
HighlyAvailable bool `url:"highlyAvailableLB,omitempty" json:"highlyAvailableLB,omitempty"`
|
||||
|
||||
// Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names
|
||||
// Required: false
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about kubernetes cluster
|
||||
// GetRequest struct to get detailed information about kubernetes cluster
|
||||
type GetRequest struct {
|
||||
// Kubernetes cluster ID
|
||||
// Required: true
|
||||
K8SID uint64 `url:"k8sId" json:"k8sId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets information about kubernetes cluster
|
||||
// Get gets information about kubernetes cluster as a RecordK8S struct
|
||||
func (k K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/k8s/get"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (k K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets information about kubernetes cluster as an array of bytes
|
||||
func (k K8S) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/k8s/get"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list information K8S
|
||||
// ListRequest struct to get list information K8S
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -53,12 +53,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all kubernetes clusters
|
||||
// List gets list of all kubernetes clusters as a ListK8S struct
|
||||
func (k K8S) List(ctx context.Context, req ListRequest) (*ListK8S, error) {
|
||||
|
||||
url := "/cloudbroker/k8s/list"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := k.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -72,3 +69,11 @@ func (k K8S) List(ctx context.Context, req ListRequest) (*ListK8S, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all kubernetes clusters as an array of bytes
|
||||
func (k K8S) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/k8s/list"
|
||||
|
||||
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -58,6 +58,10 @@ type WorkersGroupAddRequest struct {
|
||||
// Worker node boot disk size in GB If 0 is specified, size is defined by the OS image size
|
||||
// Required: false
|
||||
WorkerDisk uint64 `url:"workerDisk,omitempty" json:"workerDisk,omitempty"`
|
||||
|
||||
// Meta data for working group computes, format YAML "user_data": 1111
|
||||
// Required: false
|
||||
UserData string `url:"userData,omitempty" json:"userData,omitempty"`
|
||||
}
|
||||
|
||||
// WorkersGroupAdd adds workers group to kubernetes cluster
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about load balancer
|
||||
// GetRequest struct to get detailed information about load balancer
|
||||
type GetRequest struct {
|
||||
// ID of the load balancer to get details for
|
||||
// Required: true
|
||||
LBID uint64 `url:"lbId" json:"lbId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets detailed information about load balancer
|
||||
// Get gets detailed information about load balancer as a RecordLB struct
|
||||
func (lb LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/lb/get"
|
||||
|
||||
res, err := lb.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := lb.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (lb LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) {
|
||||
return &info, nil
|
||||
|
||||
}
|
||||
|
||||
// GetRaw gets detailed information about load balancer as an array of bytes
|
||||
func (lb LB) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/lb/get"
|
||||
|
||||
res, err := lb.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of load balancers
|
||||
// ListRequest struct to get list of load balancers
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -53,11 +53,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all load balancers
|
||||
// List gets list of all load balancers as a ListLB struct
|
||||
func (lb LB) List(ctx context.Context, req ListRequest) (*ListLB, error) {
|
||||
url := "/cloudbroker/lb/list"
|
||||
|
||||
res, err := lb.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := lb.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -70,5 +68,12 @@ func (lb LB) List(ctx context.Context, req ListRequest) (*ListLB, error) {
|
||||
}
|
||||
|
||||
return &list, nil
|
||||
|
||||
}
|
||||
|
||||
// ListRaw gets list of all load balancers as an array of bytes
|
||||
func (lb LB) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/lb/list"
|
||||
|
||||
res, err := lb.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ type RecordLB struct {
|
||||
Meta []interface{} `json:"_meta"`
|
||||
|
||||
// Access Control List
|
||||
ACL []interface{} `json:"acl"`
|
||||
ACL interface{} `json:"acl"`
|
||||
|
||||
// BackendHAIP
|
||||
BackendHAIP string `json:"backendHAIP"`
|
||||
@@ -214,7 +214,7 @@ type RecordLB struct {
|
||||
Status string `json:"status"`
|
||||
|
||||
// Sysctl Params
|
||||
SysctlParams []string `json:"sysctlParams"`
|
||||
SysctlParams interface{} `json:"sysctlParams"`
|
||||
|
||||
// Tech status
|
||||
TechStatus string `json:"techStatus"`
|
||||
@@ -229,7 +229,7 @@ type ItemLBList struct {
|
||||
HAMode bool `json:"HAmode"`
|
||||
|
||||
// Access Control List
|
||||
ACL []interface{} `json:"acl"`
|
||||
ACL interface{} `json:"acl"`
|
||||
|
||||
// BackendHAIP
|
||||
BackendHAIP string `json:"backendHAIP"`
|
||||
@@ -298,7 +298,7 @@ type ItemLBList struct {
|
||||
Status string `json:"status"`
|
||||
|
||||
// Sysctl Params
|
||||
SysctlParams []string `json:"sysctlParams"`
|
||||
SysctlParams interface{} `json:"sysctlParams"`
|
||||
|
||||
// Tech status
|
||||
TechStatus string `json:"techStatus"`
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ListRequest struct to get list of pci devices
|
||||
type ListRequest struct {
|
||||
// Find by id
|
||||
// Required: false
|
||||
@@ -36,11 +37,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all pci devices
|
||||
// List gets list of all pci devices as a ListPCIDevices struct
|
||||
func (p PCIDevice) List(ctx context.Context, req ListRequest) (*ListPCIDevices, error) {
|
||||
url := "/cloudbroker/pcidevice/list"
|
||||
|
||||
res, err := p.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := p.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -54,3 +53,11 @@ func (p PCIDevice) List(ctx context.Context, req ListRequest) (*ListPCIDevices,
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all pci devices as an array of bytes
|
||||
func (p PCIDevice) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/pcidevice/list"
|
||||
|
||||
res, err := p.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get detailed information about resource group
|
||||
// GetRequest struct to get detailed information about resource group
|
||||
type GetRequest struct {
|
||||
// Resource group ID
|
||||
// Required: true
|
||||
@@ -19,18 +19,9 @@ type GetRequest struct {
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// Get gets current configuration of the resource group
|
||||
// Get gets current configuration of the resource group as a RecordRG struct
|
||||
func (r RG) Get(ctx context.Context, req GetRequest) (*RecordRG, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/rg/get"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := r.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -44,3 +35,18 @@ func (r RG) Get(ctx context.Context, req GetRequest) (*RecordRG, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets current configuration of the resource group as an array of bytes
|
||||
func (r RG) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/rg/get"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of resource groups
|
||||
// ListRequest struct to get list of resource groups
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -49,11 +49,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of all resource groups the user has access to
|
||||
// List gets list of all resource groups the user has access to as a ListRG struct
|
||||
func (r RG) List(ctx context.Context, req ListRequest) (*ListRG, error) {
|
||||
url := "/cloudbroker/rg/list"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := r.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -67,3 +65,11 @@ func (r RG) List(ctx context.Context, req ListRequest) (*ListRG, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all resource groups the user has access to as an array of bytes
|
||||
func (r RG) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/rg/list"
|
||||
|
||||
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get SEP parameters
|
||||
// GetRequest struct to get SEP parameters
|
||||
type GetRequest struct {
|
||||
// Storage endpoint provider ID
|
||||
// Required: true
|
||||
SEPID uint64 `url:"sep_id" json:"sep_id" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets SEP parameters
|
||||
// Get gets SEP parameters as a RecordSEP struct
|
||||
func (s SEP) Get(ctx context.Context, req GetRequest) (*RecordSEP, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/get"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := s.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (s SEP) Get(ctx context.Context, req GetRequest) (*RecordSEP, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets SEP parameters as an array of bytes
|
||||
func (s SEP) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/get"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of SEPs
|
||||
// ListRequest struct to get list of SEPs
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -45,11 +45,9 @@ type ListRequest struct {
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of SEPs
|
||||
// List gets list of SEPs as a ListSEP struct
|
||||
func (s SEP) List(ctx context.Context, req ListRequest) (*ListSEP, error) {
|
||||
url := "/cloudbroker/sep/list"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := s.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -63,3 +61,11 @@ func (s SEP) List(ctx context.Context, req ListRequest) (*ListSEP, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of SEPs as an array of bytes
|
||||
func (s SEP) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/sep/list"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get list stack
|
||||
// GetRequest struct to get list of stacks
|
||||
type GetRequest struct {
|
||||
// Find by ID
|
||||
// Required: true
|
||||
StackId uint64 `url:"stackId" json:"stackId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get stack details by ID
|
||||
// Get gets stack details by ID as an InfoStack struct
|
||||
func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/stack/get"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := i.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets stack details by ID as an array of bytes
|
||||
func (i Stack) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/stack/get"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list stack
|
||||
// ListRequest struct to get list of stacks
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -33,11 +33,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// ListStacks gets list stack
|
||||
// List gets list of stacks as a ListStacks struct
|
||||
func (i Stack) List(ctx context.Context, req ListRequest) (*ListStacks, error) {
|
||||
url := "/cloudbroker/stack/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := i.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -51,3 +49,11 @@ func (i Stack) List(ctx context.Context, req ListRequest) (*ListStacks, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of stacks as an array of bytes
|
||||
func (i Stack) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/stack/list"
|
||||
|
||||
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ type InfoStack struct {
|
||||
|
||||
// ID
|
||||
ID uint64 `json:"id"`
|
||||
|
||||
// List image IDs
|
||||
Images []uint64 `json:"images"`
|
||||
|
||||
@@ -73,7 +74,6 @@ type InfoStack struct {
|
||||
|
||||
// List of stacks
|
||||
type ListStacks struct {
|
||||
|
||||
//List
|
||||
Data []InfoStack `json:"data"`
|
||||
|
||||
@@ -83,10 +83,12 @@ type ListStacks struct {
|
||||
|
||||
// Package
|
||||
type Packages struct {
|
||||
|
||||
// LibvirtBin
|
||||
LibvirtBin LibvirtBin `json:"libvirt-bin"`
|
||||
|
||||
// LibvirtDaemon
|
||||
LibvirtDaemon LibvirtDaemon `json:"libvirt-daemon"`
|
||||
|
||||
// Lvm2Lockd
|
||||
Lvm2Lockd Lvm2Lockd `json:"lvm2-lockd"`
|
||||
|
||||
@@ -105,7 +107,14 @@ type Packages struct {
|
||||
|
||||
// LibvirtBin
|
||||
type LibvirtBin struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
// Version
|
||||
Ver string `json:"ver"`
|
||||
}
|
||||
|
||||
type LibvirtDaemon struct {
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
@@ -115,7 +124,6 @@ type LibvirtBin struct {
|
||||
|
||||
// Lvm2Lockd
|
||||
type Lvm2Lockd struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
@@ -125,7 +133,6 @@ type Lvm2Lockd struct {
|
||||
|
||||
// OpenvswitchCommon
|
||||
type OpenvswitchCommon struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
@@ -135,7 +142,6 @@ type OpenvswitchCommon struct {
|
||||
|
||||
// OpenvswitchSwitch
|
||||
type OpenvswitchSwitch struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
@@ -145,7 +151,6 @@ type OpenvswitchSwitch struct {
|
||||
|
||||
// QemuSystemX86
|
||||
type QemuSystemX86 struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
@@ -155,7 +160,6 @@ type QemuSystemX86 struct {
|
||||
|
||||
// Sanlock
|
||||
type Sanlock struct {
|
||||
|
||||
// InstalledSize
|
||||
InstalledSize string `json:"installed_size"`
|
||||
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get background API task status and result
|
||||
// GetRequest struct to get background API task status and result
|
||||
type GetRequest struct {
|
||||
// ID of audit GUID
|
||||
// Required: true
|
||||
AuditID string `url:"auditId" json:"auditId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets background API task status and result
|
||||
// Get gets background API task status and result as a RecordTask struct
|
||||
func (t Tasks) Get(ctx context.Context, req GetRequest) (*RecordTask, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/tasks/get"
|
||||
|
||||
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := t.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (t Tasks) Get(ctx context.Context, req GetRequest) (*RecordTask, error) {
|
||||
|
||||
return &item, nil
|
||||
}
|
||||
|
||||
// GetRaw gets background API task status and result as an array of bytes
|
||||
func (t Tasks) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/tasks/get"
|
||||
|
||||
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list audits
|
||||
// ListRequest struct to get list of audits
|
||||
type ListRequest struct {
|
||||
// Page number
|
||||
// Required: false
|
||||
@@ -17,11 +17,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list user API task with status PROCESSING
|
||||
// List gets list of user API task with status PROCESSING as a ListTasks struct
|
||||
func (t Tasks) List(ctx context.Context, req ListRequest) (*ListTasks, error) {
|
||||
url := "/cloudbroker/tasks/list"
|
||||
|
||||
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := t.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -35,3 +33,11 @@ func (t Tasks) List(ctx context.Context, req ListRequest) (*ListTasks, error) {
|
||||
|
||||
return &item, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of user API task with status PROCESSING as an array of bytes
|
||||
func (t Tasks) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/tasks/list"
|
||||
|
||||
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,25 +8,16 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting user details.
|
||||
// GetRequest struct to get user details.
|
||||
type GetRequest struct {
|
||||
// ID of the user.
|
||||
// Required: true
|
||||
UserID string `url:"userId" json:"userId" validate:"required"`
|
||||
}
|
||||
|
||||
// Get gets user details.
|
||||
// Get gets user details as an ItemUser struct.
|
||||
func (u User) Get(ctx context.Context, req GetRequest) (*ItemUser, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/get"
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := u.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -40,3 +31,18 @@ func (u User) Get(ctx context.Context, req GetRequest) (*ItemUser, error) {
|
||||
|
||||
return &item, nil
|
||||
}
|
||||
|
||||
// GetRaw gets user details as an array of bytes
|
||||
func (u User) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/get"
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for getting all non deleted user instances.
|
||||
// ListRequest struct to get all non deleted user instances.
|
||||
type ListRequest struct {
|
||||
// Find by ID.
|
||||
// Required: false
|
||||
@@ -31,18 +31,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets all non deleted user instances.
|
||||
// List gets all non deleted user instances as a ListUsers struct
|
||||
func (u User) List(ctx context.Context, req ListRequest) (*ListUsers, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/list"
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := u.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -56,3 +47,18 @@ func (u User) List(ctx context.Context, req ListRequest) (*ListUsers, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets all non deleted user instances as an array of bytes
|
||||
func (u User) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/list"
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for getting list of VGPU
|
||||
// ListRequest struct to get list of VGPU
|
||||
type ListRequest struct {
|
||||
// Find by id
|
||||
// Required: false
|
||||
@@ -49,11 +49,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list all VGPU
|
||||
// List gets list of all VGPU as a ListVGPU struct
|
||||
func (v VGPU) List(ctx context.Context, req ListRequest) (*ListVGPU, error) {
|
||||
url := "/cloudbroker/vgpu/list"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := v.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -67,3 +65,11 @@ func (v VGPU) List(ctx context.Context, req ListRequest) (*ListVGPU, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of all VGPU as an array of bytes
|
||||
func (v VGPU) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/vgpu/list"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// Request struct for get information about VINS
|
||||
// GetRequest struct to get information about VINS
|
||||
type GetRequest struct {
|
||||
// VINS ID
|
||||
// Required: true
|
||||
@@ -19,18 +19,9 @@ type GetRequest struct {
|
||||
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
|
||||
}
|
||||
|
||||
// Get gets information about VINS by ID
|
||||
// Get gets information about VINS by ID as a RecordVINS struct
|
||||
func (v VINS) Get(ctx context.Context, req GetRequest) (*RecordVINS, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vins/get"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := v.GetRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -44,3 +35,18 @@ func (v VINS) Get(ctx context.Context, req GetRequest) (*RecordVINS, error) {
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// GetRaw gets information about VINS by ID as an array of bytes
|
||||
func (v VINS) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
for _, validationError := range validators.GetErrors(err) {
|
||||
return nil, validators.ValidationError(validationError)
|
||||
}
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vins/get"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for get list of VINSes
|
||||
// ListRequest struct to get list of VINSes
|
||||
type ListRequest struct {
|
||||
// Find by ID
|
||||
// Required: false
|
||||
@@ -41,11 +41,9 @@ type ListRequest struct {
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
}
|
||||
|
||||
// List gets list of VINSes
|
||||
// List gets list of VINSes as a ListVINS struct
|
||||
func (v VINS) List(ctx context.Context, req ListRequest) (*ListVINS, error) {
|
||||
url := "/cloudbroker/vins/list"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := v.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -59,3 +57,11 @@ func (v VINS) List(ctx context.Context, req ListRequest) (*ListVINS, error) {
|
||||
|
||||
return &list, nil
|
||||
}
|
||||
|
||||
// ListRaw gets list of VINSes as an array of bytes
|
||||
func (v VINS) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
url := "/cloudbroker/vins/list"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
return res, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user