Compare commits

..

1 Commits

Author SHA1 Message Date
d010ae175e 1.7.0-pre-alfa 2023-10-18 12:05:34 +03:00
74 changed files with 645 additions and 1133 deletions

View File

@@ -1,10 +1,7 @@
## 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
## Version 1.6.5
## 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
- Add field and type LibvirtDaemon in model Packages in cloudbroker/stack/models
- Add field and type Packages in model ItemListStacks in cloudbroker/image/models. Add fields and type LibvirtBin, LibvirtDaemon, Lvm2Lockd, OpenvswitchCommon, OpenvswitchSwitch, QemuSystemX86, Sanlock
- Add filter ByGID in cloudbroker/grid/filters
- Add field userData in models WorkersGroupAddRequest in cloudapi/k8s and cloudbroker/k8s

View File

@@ -527,56 +527,6 @@ 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()`, например:

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about account
// Request struct for 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 as a RecordAccount struct
// Get gets account details
func (a Account) Get(ctx context.Context, req GetRequest) (*RecordAccount, error) {
res, err := a.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -32,18 +41,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of accounts
// Request struct for get list of accounts
type ListRequest struct {
// Find by ID
// Required: false
@@ -33,9 +33,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets a list of all accounts the user has access to a ListAccounts struct
// List gets list all accounts the user has access to
func (a Account) List(ctx context.Context, req ListRequest) (*ListAccounts, error) {
res, err := a.ListRaw(ctx, req)
url := "/cloudapi/account/list"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -49,11 +51,3 @@ 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
}

View File

@@ -8,32 +8,15 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about service
// Request struct for 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 as a RecordBasicService struct
// Get gets detailed specifications for the BasicService.
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) {
@@ -43,6 +26,17 @@ func (b BService) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
url := "/cloudapi/bservice/get"
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of BasicService instances
// Request struct for get list BasicService instances
type ListRequest struct {
// Find by ID
// Required: false
@@ -49,9 +49,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of BasicService instances associated with the specified Resource Group as a ListBasicServices struct
// List gets list BasicService instances associated with the specified Resource Group
func (b BService) List(ctx context.Context, req ListRequest) (*ListBasicServices, error) {
res, err := b.ListRaw(ctx, req)
url := "/cloudapi/bservice/list"
res, err := b.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -65,11 +67,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about compute
// Request for 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 as a RecordCompute struct
// Get Gets information about compute
func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error) {
res, err := c.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of available computes
// Request struct for get list available computes
type ListRequest struct {
// Find by ID
// Required: false
@@ -64,7 +64,9 @@ 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) {
res, err := c.ListRaw(ctx, req)
url := "/cloudapi/compute/list"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -78,11 +80,3 @@ 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
}

View File

@@ -8,17 +8,26 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about disk
// Request struct for 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 as a RecordDisk struct
// Get gets disk details
// 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) {
res, err := d.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -32,19 +41,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of disks
// Request struct for get list of disks
type ListRequest struct {
// Find by id
// Required: false
@@ -57,9 +57,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of the created disks belonging to an account as a ListDisks struct
// List gets list the created disks belonging to an account
func (d Disks) List(ctx context.Context, req ListRequest) (*ListDisks, error) {
res, err := d.ListRaw(ctx, req)
url := "/cloudapi/disks/list"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -73,11 +75,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about external network
// Request struct for 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 as a RecordExtNet struct
// Get gets detailed information about external network
func (e ExtNet) Get(ctx context.Context, req GetRequest) (*RecordExtNet, error) {
res, err := e.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of external network
// Request struct for get list external network
type ListRequest struct {
// Find by account ID
// Required: false
@@ -45,9 +45,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all available external networks as a ListExtNets struct
// List gets list all available external networks
func (e ExtNet) List(ctx context.Context, req ListRequest) (*ListExtNets, error) {
res, err := e.ListRaw(ctx, req)
url := "/cloudapi/extnet/list"
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -61,11 +63,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about FLIPGroup
// Request struct for 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 as a RecordFLIPGroup struct
// Get gets details of the specified Floating IP group
func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, error) {
res, err := f.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of FLIPGroup available to the current user
// Request struct for get list 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
// Required: false
// Reuqired: false
ByIP string `url:"byIp,omitempty" json:"byIp,omitempty"`
// Find by resource group ID
// Required: false
// Reuqired: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by id
@@ -45,9 +45,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of FLIPGroup managed cluster instances available to the current user as a ListFLIPGroups struct
// List gets list FLIPGroup managed cluster instances available to the current user
func (f FLIPGroup) List(ctx context.Context, req ListRequest) (*ListFLIPGroups, error) {
res, err := f.ListRaw(ctx, req)
url := "/cloudapi/flipgroup/list"
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -61,11 +63,3 @@ 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
}

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about image
// Request struct for get detailed information about image
type GetRequest struct {
// ID of image to get
// Required: true
@@ -20,9 +20,18 @@ type GetRequest struct {
}
// Get gets image by ID.
// Returns image as a RecordImage struct if user has rights on it
// Returns image if user has rights on it
func (i Image) Get(ctx context.Context, req GetRequest) (*RecordImage, error) {
res, err := i.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -36,19 +45,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of available images
// Request struct for get list available images
type ListRequest struct {
// Find by storage endpoint provider ID
// Required: false
@@ -65,9 +65,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of available images as a ListImages struct, optionally filtering by account ID
// List gets list available images, optionally filtering by account ID
func (i Image) List(ctx context.Context, req ListRequest) (*ListImages, error) {
res, err := i.ListRaw(ctx, req)
url := "/cloudapi/image/list"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -81,11 +83,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about K8CI
// Request struct for 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 as a RecordK8CI struct
// Get gets details of the specified K8 catalog item
func (k K8CI) Get(ctx context.Context, req GetRequest) (*RecordK8CI, error) {
res, err := k.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -30,18 +39,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of information about images
// Request struct for get list information about images
type ListRequest struct {
// Find by ID
// Required: false
@@ -45,9 +45,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all k8ci catalog items available to the current user as a ListK8CI struct
// List gets list all k8ci catalog items available to the current user
func (k K8CI) List(ctx context.Context, req ListRequest) (*ListK8CI, error) {
res, err := k.ListRaw(ctx, req)
url := "/cloudapi/k8ci/list"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -61,11 +63,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about kubernetes cluster
// Request struct for 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 as a RecordK8S struct
// Get gets information about Kubernetes cluster
func (k8s K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) {
res, err := k8s.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list information K8S
// Request struct for get list information K8S
type ListRequest struct {
// Find by ID
// Required: false
@@ -53,9 +53,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all kubernetes clusters the user has access to as a ListK8SClusters
// List gets list all kubernetes clusters the user has access to
func (k8s K8S) List(ctx context.Context, req ListRequest) (*ListK8SClusters, error) {
res, err := k8s.ListRaw(ctx, req)
url := "/cloudapi/k8s/list"
res, err := k8s.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -69,11 +71,3 @@ 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
}

View File

@@ -34,6 +34,11 @@ type ItemK8SGroup struct {
// List of taints
Taints []string `json:"taints"`
// for autoscaler
MinNodes uint64 `json:"minNodes"`
MaxNodes uint64 `json:"maxNodes"`
Autoscaling bool `json:"autoscale"`
}
// List kubernetes cluster groups

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about load balancer
// Request struct for 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 as a RecordLB struct
// Get gets detailed information about load balancer
func (l LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) {
res, err := l.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of load balancers
// Request struct for get list of load balancers
type ListRequest struct {
// Find by ID
// Required: false
@@ -53,9 +53,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all load balancers as a ListLB struct
// List gets list all load balancers
func (l LB) List(ctx context.Context, req ListRequest) (*ListLB, error) {
res, err := l.ListRaw(ctx, req)
url := "/cloudapi/lb/list"
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -69,11 +71,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of locations
// Request struct for get list of locations
type ListRequest struct {
// Page number
// Required: false
@@ -33,9 +33,11 @@ type ListRequest struct {
LocationCode string `url:"locationCode,omitempty" json:"locationCode,omitempty"`
}
// List gets list of all locations as a ListLocations struct
// List gets list all locations
func (l Locations) List(ctx context.Context, req ListRequest) (*ListLocations, error) {
res, err := l.ListRaw(ctx, req)
url := "/cloudapi/locations/list"
res, err := l.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -49,11 +51,3 @@ 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
}

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about resource group
// Request struct for get detailed information about resource group
type GetRequest struct {
// Resource group ID
// Required: true
@@ -19,9 +19,18 @@ type GetRequest struct {
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// Get gets current configuration of the resource group as a RecordResourceGroup struct
// Get gets current configuration of the resource group
func (r RG) Get(ctx context.Context, req GetRequest) (*RecordResourceGroup, error) {
res, err := r.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -35,18 +44,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of resource groups
// Request struct for get list of resource groups
type ListRequest struct {
// Find by ID
// Required: false
@@ -53,9 +53,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all resource groups the user has access to as a ListResourceGroups struct
// List gets list of all resource groups the user has access to
func (r RG) List(ctx context.Context, req ListRequest) (*ListResourceGroups, error) {
res, err := r.ListRaw(ctx, req)
url := "/cloudapi/rg/list"
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -69,11 +71,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct for list of the available flavors
// Request struct for list the available flavors
type ListRequest struct {
// ID of the cloudspace
// Required: false
@@ -25,9 +25,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of the available flavors as a ListSizes struct, filtering can be based on the user which is doing the request
// List gets list the available flavors, filtering can be based on the user which is doing the request
func (s Sizes) List(ctx context.Context, req ListRequest) (*ListSizes, error) {
res, err := s.ListRaw(ctx, req)
url := "/cloudapi/sizes/list"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -41,11 +43,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get info of stack
// Request struct for get info of stack
type GetRequest struct {
// Find by ID
// Required: true
StackId uint64 `url:"stackId" json:"stackId" validate:"required"`
}
// Get gets stack details by ID as an InfoStack struct
// Get stack details by ID
func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) {
res, err := i.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of stacks
// Request struct for get list stack
type ListRequest struct {
// Find by ID
// Required: false
@@ -33,9 +33,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of stacks as a ListStacks struct
// ListStacks gets list stack
func (i Stack) List(ctx context.Context, req ListRequest) (*ListStacks, error) {
res, err := i.ListRaw(ctx, req)
url := "/cloudapi/stack/list"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -49,11 +51,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about task
// Request struct for get infromation 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 as a RecordAsyncTask struct
// Get gets background API task status and result
func (t Tasks) Get(ctx context.Context, req GetRequest) (*RecordAsyncTask, error) {
res, err := t.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -32,18 +41,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of tasks
// Request struct for get list of tasks
type ListRequest struct {
// Page number
// Required: false
@@ -17,9 +17,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of user API tasks with status PROCESSING as a ListTasks struct
// List gets list user API tasks with status PROCESSING
func (t Tasks) List(ctx context.Context, req ListRequest) (*ListTasks, error) {
res, err := t.ListRaw(ctx, req)
url := "/cloudapi/tasks/list"
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -33,11 +35,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about VINS
// Request struct for 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 as a RecordVINS struct
// Get gets information about VINS by ID
func (v VINS) Get(ctx context.Context, req GetRequest) (*RecordVINS, error) {
res, err := v.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -30,19 +39,5 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of VINSes
// Request struct for get list of VINSes
type ListRequest struct {
// Find by ID
// Required: false
@@ -41,9 +41,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of VINSes available for current user as a ListVINS struct
// List gets list of VINSes available for current user
func (v VINS) List(ctx context.Context, req ListRequest) (*ListVINS, error) {
res, err := v.ListRaw(ctx, req)
url := "/cloudapi/vins/list"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -57,11 +59,3 @@ 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
}

View File

@@ -8,32 +8,15 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about account
// Request struct for 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 as a RecordAccount struct
// Get gets information about account
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) {
@@ -43,6 +26,17 @@ func (a Account) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
url := "/cloudbroker/account/get"
info := RecordAccount{}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
if err != nil {
return nil, err
}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of accounts
// Request struct for get list of accounts
type ListRequest struct {
// Find by ID
// Required: false
@@ -33,9 +33,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all accounts the user has access to as a ListAccounts struct
// List gets list all accounts the user has access to
func (a Account) List(ctx context.Context, req ListRequest) (*ListAccounts, error) {
res, err := a.ListRaw(ctx, req)
url := "/cloudbroker/account/list"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -49,11 +51,3 @@ 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
}

View File

@@ -29,10 +29,10 @@ type RecordResourceConsumption struct {
type ItemResourceConsumption struct {
// Current information about resources
Consumed Resource `json:"consumed"`
Current Resource `json:"Current"`
// 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 float64 `json:"disksizemax"`
DiskSizeMax uint64 `json:"disksizemax"`
// Number of External IPs
ExtIPs int64 `json:"extips"`
@@ -414,6 +414,33 @@ 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
@@ -444,7 +471,7 @@ type Limits struct {
// Resources of resource group
type RGResuorces struct {
// Consumed
Consumed Resource `json:"Consumed"`
Consumed Consumed `json:"Consumed"`
// Limits
Limits Limits `json:"Limits"`

View File

@@ -8,32 +8,15 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get apiaccess group.
// Request struct for getting apiaccess group.
type GetRequest struct {
// APIAccess group ID.
// Required: true
APIAccessID uint64 `url:"apiaccessId" json:"apiaccessId" validate:"required"`
}
// Get gets apiaccess group as an ItemAPIAccess struct
// Get gets apiaccess group.
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) {
@@ -43,6 +26,17 @@ func (a APIAccess) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
url := "/cloudbroker/apiaccess/get"
info := ItemAPIAccess{}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
if err != nil {
return nil, err
}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ListRequest struct to get list of all non deleted apiaccess instances.
// Request struct for getting list of all non deleted apiaccess instances.
type ListRequest struct {
// Find by ID
// Required: false
@@ -43,25 +43,8 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all non deleted apiaccess instances as a ListAPIAccess struct
// List gets list of all non deleted apiaccess instances.
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) {
@@ -71,6 +54,17 @@ func (a APIAccess) ListRaw(ctx context.Context, req ListRequest) ([]byte, error)
url := "/cloudbroker/apiaccess/list"
info := ListAPIAccess{}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
if err != nil {
return nil, err
}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest to get information about compute
// Request for get information about compute
type GetRequest struct {
// ID of compute instance
// Required: true
@@ -19,9 +19,18 @@ type GetRequest struct {
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// Get gets information about compute as a RecordCompute struct
// Get gets information about compute
func (c Compute) Get(ctx context.Context, req GetRequest) (*RecordCompute, error) {
res, err := c.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -35,18 +44,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of available computes
// Request struct for get list available computes
type ListRequest struct {
// Find by ID
// Required: false
@@ -61,10 +61,12 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of the available computes as a ListComputes 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) {
res, err := c.ListRaw(ctx, req)
url := "/cloudbroker/compute/list"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -78,11 +80,3 @@ 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
}

View File

@@ -672,7 +672,7 @@ type InfoCompute struct {
StackName string `json:"stackName"`
// Stateless SEP ID
StatelessSEPID int64 `json:"statelessSepId"`
StatelessSEPID uint64 `json:"statelessSepId"`
// Stateless SEP Type
StatelessSEPType string `json:"statelessSepType"`

View File

@@ -8,17 +8,26 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about disk
// Request struct for 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 as a RecordDisk struct.
// Get gets disk details
// 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) {
res, err := d.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -32,19 +41,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list/list_deleted of disks
// Request struct for get list/list_deleted of disks
type ListRequest struct {
// Find by id
// Required: false
@@ -57,9 +57,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of the created disks belonging to an account as a ListDisks struct
// List gets list the created disks belonging to an account
func (d Disks) List(ctx context.Context, req ListRequest) (*ListDisks, error) {
res, err := d.ListRaw(ctx, req)
url := "/cloudbroker/disks/list"
res, err := d.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -73,11 +75,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about external network
// Request struct for 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 as a RecordExtNet struct
// Get gets external network details
func (e ExtNet) Get(ctx context.Context, req GetRequest) (*RecordExtNet, error) {
res, err := e.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of external network
// Request struct for get list external network
type ListRequest struct {
// Find by account ID
// Required: false
@@ -45,9 +45,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all available external networks as a ListExtNet struct
// List gets list all available external networks
func (e ExtNet) List(ctx context.Context, req ListRequest) (*ListExtNet, error) {
res, err := e.ListRaw(ctx, req)
url := "/cloudbroker/extnet/list"
res, err := e.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -61,11 +63,3 @@ 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
}

View File

@@ -127,86 +127,29 @@ type ListExtNet struct {
// Detailed information about external network
type RecordExtNet struct {
// CKey
CKey string `json:"_ckey"`
// Main information about external network
ItemExtNet
// Meta
Meta []interface{} `json:"_meta"`
// CheckIPs
// 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

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about FLIPGroup
// Request struct for 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 as a RecordFLIPGroup struct
// Get gets details of the specified Floating IP group
func (f FLIPGroup) Get(ctx context.Context, req GetRequest) (*RecordFLIPGroup, error) {
res, err := f.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of FLIPGroup available to the current user
// Request struct for get list 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
// Required: false
// Reuqired: false
ByIP string `url:"byIp,omitempty" json:"byIp,omitempty"`
// Find by resource group ID
// Required: false
// Reuqired: false
RGID uint64 `url:"rgId,omitempty" json:"rgId,omitempty"`
// Find by id
@@ -45,9 +45,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of FLIPGroup managed cluster instances available to the current user as a ListFLIPGroups struct
// List gets list FLIPGroup managed cluster instances available to the current user
func (f FLIPGroup) List(ctx context.Context, req ListRequest) (*ListFLIPGroups, error) {
res, err := f.ListRaw(ctx, req)
url := "/cloudbroker/flipgroup/list"
res, err := f.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -61,11 +63,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get grid details
// Request struct for 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 as a RecordGrid struct
// Get gets information about grid by ID
func (g Grid) Get(ctx context.Context, req GetRequest) (*RecordGrid, error) {
res, err := g.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of locations
// Request struct for get list locations
type ListRequest struct {
// Find by id grid
// Required: false
@@ -25,9 +25,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all locations as a ListGrids struct
// List gets list all locations
func (g Grid) List(ctx context.Context, req ListRequest) (*ListGrids, error) {
res, err := g.ListRaw(ctx, req)
url := "/cloudbroker/grid/list"
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -41,11 +43,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get details of the specified group.
// Reuqest struct for getting 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 as an ItemGroup struct
// Get gets details of the specified group.
func (g Group) Get(ctx context.Context, req GetRequest) (*ItemGroup, error) {
res, err := g.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ListRequest struct to get list of group instances.
// Request struct for getting list of group instances.
type ListRequest struct {
// Find by id.
// Requires: false
@@ -31,9 +31,17 @@ 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) {
res, err := g.ListRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -47,18 +55,3 @@ 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
}

View File

@@ -8,32 +8,15 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get image details
// Request struct for get image details
type GetRequest struct {
// ID of image
// Required: true
ImageID uint64 `url:"imageId" json:"imageId" validate:"required"`
}
// Get gets image details by ID as a RecordImage struct
// Get get image details by ID
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) {
@@ -43,6 +26,17 @@ func (i Image) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
url := "/cloudbroker/image/get"
info := RecordImage{}
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
if err != nil {
return nil, err
}
err = json.Unmarshal(res, &info)
if err != nil {
return nil, err
}
return &info, nil
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of available images
// Request struct for get list available images
type ListRequest struct {
// Filter images by storage endpoint provider ID
// Required: false
@@ -65,9 +65,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of information about images as a ListImages struct
// List gets list of information about images
func (i Image) List(ctx context.Context, req ListRequest) (*ListImages, error) {
res, err := i.ListRaw(ctx, req)
url := "/cloudbroker/image/list"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -81,11 +83,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about K8CI
// Request struct for 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 as a RecordK8CI struct
// Get gets details of the specified K8 catalog item
func (k K8CI) Get(ctx context.Context, req GetRequest) (*RecordK8CI, error) {
res, err := k.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list information about images
// Request struct for get list information about images
type ListRequest struct {
// Find by ID
// Required: false
@@ -45,9 +45,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all k8ci catalog items available to the current user as a ListK8CI struct
// List gets list all k8ci catalog items available to the current user
func (k K8CI) List(ctx context.Context, req ListRequest) (*ListK8CI, error) {
res, err := k.ListRaw(ctx, req)
url := "/cloudbroker/k8ci/list"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -61,11 +63,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about kubernetes cluster
// Request struct for 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 as a RecordK8S struct
// Get gets information about kubernetes cluster
func (k K8S) Get(ctx context.Context, req GetRequest) (*RecordK8S, error) {
res, err := k.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list information K8S
// Request struct for get list information K8S
type ListRequest struct {
// Find by ID
// Required: false
@@ -53,9 +53,12 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all kubernetes clusters as a ListK8S struct
// List gets list all kubernetes clusters
func (k K8S) List(ctx context.Context, req ListRequest) (*ListK8S, error) {
res, err := k.ListRaw(ctx, req)
url := "/cloudbroker/k8s/list"
res, err := k.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -69,11 +72,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about load balancer
// Request struct for 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 as a RecordLB struct
// Get gets detailed information about load balancer
func (lb LB) Get(ctx context.Context, req GetRequest) (*RecordLB, error) {
res, err := lb.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of load balancers
// Request struct for get list of load balancers
type ListRequest struct {
// Find by ID
// Required: false
@@ -53,9 +53,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all load balancers as a ListLB struct
// List gets list all load balancers
func (lb LB) List(ctx context.Context, req ListRequest) (*ListLB, error) {
res, err := lb.ListRaw(ctx, req)
url := "/cloudbroker/lb/list"
res, err := lb.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -68,12 +70,5 @@ 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
}

View File

@@ -6,7 +6,6 @@ import (
"net/http"
)
// ListRequest struct to get list of pci devices
type ListRequest struct {
// Find by id
// Required: false
@@ -37,9 +36,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all pci devices as a ListPCIDevices struct
// List gets list all pci devices
func (p PCIDevice) List(ctx context.Context, req ListRequest) (*ListPCIDevices, error) {
res, err := p.ListRaw(ctx, req)
url := "/cloudbroker/pcidevice/list"
res, err := p.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -53,11 +54,3 @@ 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
}

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get detailed information about resource group
// Request struct for get detailed information about resource group
type GetRequest struct {
// Resource group ID
// Required: true
@@ -19,9 +19,18 @@ type GetRequest struct {
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// Get gets current configuration of the resource group as a RecordRG struct
// Get gets current configuration of the resource group
func (r RG) Get(ctx context.Context, req GetRequest) (*RecordRG, error) {
res, err := r.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -35,18 +44,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of resource groups
// Request struct for get list of resource groups
type ListRequest struct {
// Find by ID
// Required: false
@@ -49,9 +49,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all resource groups the user has access to as a ListRG struct
// List gets list of all resource groups the user has access to
func (r RG) List(ctx context.Context, req ListRequest) (*ListRG, error) {
res, err := r.ListRaw(ctx, req)
url := "/cloudbroker/rg/list"
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -65,11 +67,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get SEP parameters
// Request struct for 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 as a RecordSEP struct
// Get gets SEP parameters
func (s SEP) Get(ctx context.Context, req GetRequest) (*RecordSEP, error) {
res, err := s.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of SEPs
// Request struct for get list of SEPs
type ListRequest struct {
// Find by ID
// Required: false
@@ -45,9 +45,11 @@ type ListRequest struct {
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
}
// List gets list of SEPs as a ListSEP struct
// List gets list of SEPs
func (s SEP) List(ctx context.Context, req ListRequest) (*ListSEP, error) {
res, err := s.ListRaw(ctx, req)
url := "/cloudbroker/sep/list"
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -61,11 +63,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get list of stacks
// Request struct for get list stack
type GetRequest struct {
// Find by ID
// Required: true
StackId uint64 `url:"stackId" json:"stackId" validate:"required"`
}
// Get gets stack details by ID as an InfoStack struct
// Get stack details by ID
func (i Stack) Get(ctx context.Context, req GetRequest) (*InfoStack, error) {
res, err := i.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of stacks
// Request struct for get list stack
type ListRequest struct {
// Find by ID
// Required: false
@@ -33,9 +33,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of stacks as a ListStacks struct
// ListStacks gets list stack
func (i Stack) List(ctx context.Context, req ListRequest) (*ListStacks, error) {
res, err := i.ListRaw(ctx, req)
url := "/cloudbroker/stack/list"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -49,11 +51,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get background API task status and result
// Request struct for 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 as a RecordTask struct
// Get gets background API task status and result
func (t Tasks) Get(ctx context.Context, req GetRequest) (*RecordTask, error) {
res, err := t.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of audits
// Request struct for get list audits
type ListRequest struct {
// Page number
// Required: false
@@ -17,9 +17,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of user API task with status PROCESSING as a ListTasks struct
// List gets list user API task with status PROCESSING
func (t Tasks) List(ctx context.Context, req ListRequest) (*ListTasks, error) {
res, err := t.ListRaw(ctx, req)
url := "/cloudbroker/tasks/list"
res, err := t.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -33,11 +35,3 @@ 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
}

View File

@@ -8,16 +8,25 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get user details.
// Request struct for getting user details.
type GetRequest struct {
// ID of the user.
// Required: true
UserID string `url:"userId" json:"userId" validate:"required"`
}
// Get gets user details as an ItemUser struct.
// Get gets user details.
func (u User) Get(ctx context.Context, req GetRequest) (*ItemUser, error) {
res, err := u.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -31,18 +40,3 @@ 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
}

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// ListRequest struct to get all non deleted user instances.
// Request struct for getting all non deleted user instances.
type ListRequest struct {
// Find by ID.
// Required: false
@@ -31,9 +31,18 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets all non deleted user instances as a ListUsers struct
// List gets all non deleted user instances.
func (u User) List(ctx context.Context, req ListRequest) (*ListUsers, error) {
res, err := u.ListRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -47,18 +56,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of VGPU
// Request struct for getting list of VGPU
type ListRequest struct {
// Find by id
// Required: false
@@ -49,9 +49,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of all VGPU as a ListVGPU struct
// List gets list all VGPU
func (v VGPU) List(ctx context.Context, req ListRequest) (*ListVGPU, error) {
res, err := v.ListRaw(ctx, req)
url := "/cloudbroker/vgpu/list"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -65,11 +67,3 @@ 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
}

View File

@@ -8,7 +8,7 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// GetRequest struct to get information about VINS
// Request struct for get information about VINS
type GetRequest struct {
// VINS ID
// Required: true
@@ -19,9 +19,18 @@ type GetRequest struct {
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
}
// Get gets information about VINS by ID as a RecordVINS struct
// Get gets information about VINS by ID
func (v VINS) Get(ctx context.Context, req GetRequest) (*RecordVINS, error) {
res, err := v.GetRaw(ctx, req)
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)
if err != nil {
return nil, err
}
@@ -35,18 +44,3 @@ 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
}

View File

@@ -6,7 +6,7 @@ import (
"net/http"
)
// ListRequest struct to get list of VINSes
// Request struct for get list of VINSes
type ListRequest struct {
// Find by ID
// Required: false
@@ -41,9 +41,11 @@ type ListRequest struct {
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// List gets list of VINSes as a ListVINS struct
// List gets list of VINSes
func (v VINS) List(ctx context.Context, req ListRequest) (*ListVINS, error) {
res, err := v.ListRaw(ctx, req)
url := "/cloudbroker/vins/list"
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return nil, err
}
@@ -57,11 +59,3 @@ 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
}