v14.3.0
This commit is contained in:
50
pkg/sdn/logicalports/delete_batch.go
Normal file
50
pkg/sdn/logicalports/delete_batch.go
Normal file
@@ -0,0 +1,50 @@
|
||||
package logicalports
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/internal/constants"
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v14/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
|
||||
}
|
||||
Reference in New Issue
Block a user