package trunk import ( "context" "net/http" "strconv" "repository.basistech.ru/BASIS/decort-golang-sdk/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 }