51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package logicalports
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
|
)
|
|
|
|
type PortsInfo struct {
|
|
// Force
|
|
// Required: true
|
|
Force bool `url:"force" json:"force" validate:"required"`
|
|
|
|
// ID
|
|
// Required: true
|
|
ID string `url:"id" json:"id" validate:"required"`
|
|
|
|
// Version ID
|
|
// Required: true
|
|
VersionID uint64 `url:"version_id" json:"version_id" validate:"required"`
|
|
}
|
|
|
|
// DeleteBatchRequest struct to delete a batch of logical ports
|
|
type DeleteBatchRequest struct {
|
|
// Access Group ID
|
|
// Required: true
|
|
AccessGroupID string `url:"access_group_id" json:"access_group_id" validate:"required"`
|
|
|
|
// Ports Info
|
|
// Required: true
|
|
PortsInfo []PortsInfo `json:"ports_info" validate:"required,dive"`
|
|
}
|
|
|
|
// DeleteBatch deletes a batch of logical ports
|
|
func (lp LogicalPorts) DeleteBatch(ctx context.Context, req DeleteBatchRequest) (bool, error) {
|
|
err := validators.ValidateRequest(req)
|
|
if err != nil {
|
|
return false, validators.ValidationErrors(validators.GetErrors(err))
|
|
}
|
|
url := "/sdn/logical_port/delete_batch"
|
|
|
|
_, err = lp.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
return true, nil
|
|
}
|