v1.8.0
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ListRequest struct to get list of VGPU
|
||||
@@ -40,6 +42,10 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
PGPUID uint64 `url:"pgpuId,omitempty" json:"pgpuId,omitempty"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
@@ -51,6 +57,7 @@ type ListRequest struct {
|
||||
|
||||
// List gets list of all VGPU as a ListVGPU struct
|
||||
func (v VGPU) List(ctx context.Context, req ListRequest) (*ListVGPU, error) {
|
||||
|
||||
res, err := v.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -68,6 +75,12 @@ func (v VGPU) List(ctx context.Context, req ListRequest) (*ListVGPU, error) {
|
||||
|
||||
// ListRaw gets list of all VGPU as an array of bytes
|
||||
func (v VGPU) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vgpu/list"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
|
||||
Reference in New Issue
Block a user