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.
58 lines
1.1 KiB
58 lines
1.1 KiB
package vins
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"net/http"
|
|
"strconv"
|
|
)
|
|
|
|
// Request struct for update QOS
|
|
type DefaultQOSUpdateRequest struct {
|
|
// ID of VINS
|
|
// Required: true
|
|
VINSID uint64 `url:"vinsId"`
|
|
|
|
// Internal traffic, kbit
|
|
// Required: false
|
|
IngressRate uint64 `url:"ingress_rate,omitempty"`
|
|
|
|
// Internal traffic burst, kbit
|
|
// Required: false
|
|
IngressBirst uint64 `url:"ingress_birst,omitempty"`
|
|
|
|
// External traffic rate, kbit
|
|
// Required: false
|
|
EgressRate uint64 `url:"egress_rate,omitempty"`
|
|
}
|
|
|
|
func (vrq DefaultQOSUpdateRequest) validate() error {
|
|
if vrq.VINSID == 0 {
|
|
return errors.New("validation-error: field VINSID must be set")
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// DefaultQOSUpdate update default QOS values
|
|
func (v VINS) DefaultQOSUpdate(ctx context.Context, req DefaultQOSUpdateRequest) (bool, error) {
|
|
err := req.validate()
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
url := "/cloudbroker/vins/defaultQosUpdate"
|
|
|
|
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
|
|
}
|