You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.8 KiB
63 lines
1.8 KiB
package dpdknet
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"strconv"
|
|
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/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
|
|
}
|