You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
|
4 days ago
|
package extnet
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"net/http"
|
||
|
|
|
||
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/constants"
|
||
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||
|
|
)
|
||
|
|
|
||
|
|
// DeleteRequest struct for delete extnet
|
||
|
|
type DeleteRequest struct {
|
||
|
|
// ID of external network
|
||
|
|
// Required: true
|
||
|
|
ExtNetID string `url:"external_network_id" json:"external_network_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 external network
|
||
|
|
func (e ExtNet) Delete(ctx context.Context, req DeleteRequest) error {
|
||
|
|
err := validators.ValidateRequest(req)
|
||
|
|
if err != nil {
|
||
|
|
return validators.ValidationErrors(validators.GetErrors(err))
|
||
|
|
}
|
||
|
|
|
||
|
|
url := "/sdn/external_network/delete"
|
||
|
|
|
||
|
|
_, err = e.client.DecortApiCallCtype(ctx, http.MethodDelete, url, constants.MIMEJSON, req)
|
||
|
|
|
||
|
|
if err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|