This commit is contained in:
asteam
2025-11-14 17:59:31 +03:00
parent 18a4311b97
commit e3a65c0f33
151 changed files with 10721 additions and 28 deletions

View File

@@ -0,0 +1,42 @@
package segments
import (
"context"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/constants"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// DeleteRequest struct for delete segment
type DeleteRequest struct {
// ID of segment
// Required: true
SegmentID string `url:"segment_id" json:"segment_id" validate:"required"`
// ID of version
// Required: true
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
// Force delete
// Required: false
Force bool `url:"force,omitempty" json:"force,omitempty"`
}
// Delete delete an segment
func (s Segments) Delete(ctx context.Context, req DeleteRequest) error {
err := validators.ValidateRequest(req)
if err != nil {
return validators.ValidationErrors(validators.GetErrors(err))
}
url := "/sdn/segment/delete"
_, err = s.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
if err != nil {
return err
}
return nil
}