v12.0.0
This commit is contained in:
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/dynamix-golang-sdk/v12/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