v9.0.0
This commit is contained in:
62
pkg/cloudbroker/dpdknet/update.go
Normal file
62
pkg/cloudbroker/dpdknet/update.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package dpdknet
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators"
|
||||
)
|
||||
|
||||
// UpdateRequest struct to update DPDK network
|
||||
type UpdateRequest struct {
|
||||
// ID of DPDK network to update
|
||||
// Required: true
|
||||
DPDKID uint64 `url:"dpdkId" json:"dpdkId" validate:"required"`
|
||||
|
||||
// New name of DPDK network
|
||||
// Required: false
|
||||
Name string `url:"name,omitempty" json:"name,omitempty"`
|
||||
|
||||
// Description of DPDK network. Prefer to contain additional information about DPDK network
|
||||
// Required: false
|
||||
Description string `url:"description,omitempty" json:"description,omitempty"`
|
||||
|
||||
// List of account IDs to which DPDK network will be available. Empty field means all accounts in the system.
|
||||
// Required: false
|
||||
AccountAccess []uint64 `url:"accountAccess,omitempty" json:"accountAccess,omitempty"`
|
||||
|
||||
// List of resource groups IDs to which DPDK network will be available. Empty field means all resource groups in the system.
|
||||
// Required: true
|
||||
RGAccess []uint64 `url:"rgAccess,omitempty" json:"rgAccess,omitempty"`
|
||||
|
||||
// ID of vlan
|
||||
// Required: true
|
||||
VlanID uint64 `url:"vlanId,omitempty" json:"vlanId,omitempty"`
|
||||
|
||||
// Name of OVS Bridge to use for DPDK network
|
||||
// Required: true
|
||||
OVSBridge string `url:"ovsBridge,omitempty" json:"ovsBridge,omitempty"`
|
||||
}
|
||||
|
||||
// Update updates a DPDK networks
|
||||
func (d DPDKNet) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/dpdknet/update"
|
||||
|
||||
res, err := d.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