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.
46 lines
793 B
46 lines
793 B
package sep
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"net/http"
|
|
"strconv"
|
|
)
|
|
|
|
// Request struct for disable SEP
|
|
type DisableRequest struct {
|
|
// Storage endpoint provider ID
|
|
// Required: true
|
|
SEPID uint64 `url:"sep_id"`
|
|
}
|
|
|
|
func (srq DisableRequest) validate() error {
|
|
if srq.SEPID == 0 {
|
|
return errors.New("validation-error: field SEPID must be set")
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// Disable disables SEP by ID
|
|
func (s SEP) Disable(ctx context.Context, req DisableRequest) (bool, error) {
|
|
err := req.validate()
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
url := "/cloudbroker/sep/disable"
|
|
|
|
res, err := s.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
|
|
}
|