v1.12.2
This commit is contained in:
@@ -46,6 +46,11 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Sort by zone id
|
||||
// Default value: 0
|
||||
// Required: false
|
||||
ZoneID uint64 `url:"zone_id,omitempty" json:"zone_id,omitempty"`
|
||||
|
||||
// Page number
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
|
||||
@@ -28,18 +28,18 @@ type MassDeleteRequest struct {
|
||||
}
|
||||
|
||||
// MassDelete start jobs to delete several VINSes
|
||||
func (v VINS) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, error) {
|
||||
func (v VINS) MassDelete(ctx context.Context, req MassDeleteRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vins/massDelete"
|
||||
|
||||
_, err = v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,18 +15,18 @@ type MassDisableRequest struct {
|
||||
}
|
||||
|
||||
// MassDisable start jobs to disable several VINSes
|
||||
func (v VINS) MassDisable(ctx context.Context, req MassDisableRequest) (bool, error) {
|
||||
func (v VINS) MassDisable(ctx context.Context, req MassDisableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vins/massDisable"
|
||||
|
||||
_, err = v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -15,18 +15,18 @@ type MassEnableRequest struct {
|
||||
}
|
||||
|
||||
// MassEnable start jobs to enable several VINSes
|
||||
func (v VINS) MassEnable(ctx context.Context, req MassEnableRequest) (bool, error) {
|
||||
func (v VINS) MassEnable(ctx context.Context, req MassEnableRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vins/massEnable"
|
||||
|
||||
_, err = v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return "", err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
return string(res), nil
|
||||
}
|
||||
|
||||
@@ -508,6 +508,9 @@ type RecordVINS struct {
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// Enable Security Groups
|
||||
EnableSecGroups bool `json:"enable_secgroups"`
|
||||
|
||||
// Grid ID
|
||||
GID uint64 `json:"gid"`
|
||||
|
||||
@@ -718,6 +721,9 @@ type ItemVINS struct {
|
||||
// Description
|
||||
Description string `json:"desc"`
|
||||
|
||||
// Enable Security Groups
|
||||
EnableSecGroups bool `json:"enable_secgroups"`
|
||||
|
||||
// External IP
|
||||
ExternalIP string `json:"externalIP"`
|
||||
|
||||
|
||||
51
pkg/cloudbroker/vins/update.go
Normal file
51
pkg/cloudbroker/vins/update.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package vins
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// UpdateRequest struct to update vins parameters
|
||||
type UpdateRequest struct {
|
||||
// VINS ID
|
||||
// Required: true
|
||||
VINSID uint64 `url:"vins_id" json:"vins_id" validate:"required"`
|
||||
|
||||
// Name
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Desc
|
||||
// Required: false
|
||||
Desc string `url:"desc,omitempty" json:"desc,omitempty"`
|
||||
|
||||
// Flag indicating whether security groups are enabled for this network
|
||||
// Required: false
|
||||
EnableSecGroups interface{} `url:"enable_secgroups,omitempty" json:"enable_secgroups,omitempty" validate:"omitempty,isBool"`
|
||||
}
|
||||
|
||||
// Update updates a vins parameters
|
||||
func (v VINS) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/vins/update"
|
||||
|
||||
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user