This commit is contained in:
asteam
2025-09-27 01:06:15 +03:00
parent 1ccc37a104
commit cf584c8123
1175 changed files with 11022 additions and 1832 deletions

View File

@@ -0,0 +1,54 @@
package trunk
import (
"context"
"net/http"
"strconv"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// UpdateRequest struct to update a trunk
type UpdateRequest struct {
// ID of the trunk to update
// Required: true
TrunkID uint64 `url:"id" json:"id" validate:"required"`
// New name of the trunk
// Required: true
Name string `url:"name" json:"name" validate:"required"`
// List of trunk tags (values between 1-4095)
// Required: true
TrunkTags string `url:"trunk_tags" json:"trunk_tags" validate:"required,trunkTags"`
// New description of the trunk
// Required: false
Description string `url:"description,omitempty" json:"description,omitempty"`
// New native VLAN ID
// Required: false
NativeVLANID uint64 `url:"native_vlan_id,omitempty" json:"native_vlan_id,omitempty"`
}
// Update updates a trunk
func (t Trunk) Update(ctx context.Context, req UpdateRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/trunk/update"
res, err := t.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
}