2022-12-22 17:56:47 +03:00
|
|
|
package vins
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"net/http"
|
2023-03-24 17:09:30 +03:00
|
|
|
|
|
|
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
2022-12-22 17:56:47 +03:00
|
|
|
)
|
|
|
|
|
|
2023-10-25 17:37:18 +03:00
|
|
|
// MassDisableRequest struct to disable several VINSes
|
2022-12-22 17:56:47 +03:00
|
|
|
type MassDisableRequest struct {
|
|
|
|
|
// VINS IDs
|
|
|
|
|
// Required: true
|
2023-03-24 17:09:30 +03:00
|
|
|
VINSIDs []uint64 `url:"vinsIds" json:"vinsIds" validate:"min=1"`
|
2022-12-22 17:56:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MassDisable start jobs to disable several VINSes
|
2025-08-29 12:51:25 +03:00
|
|
|
func (v VINS) MassDisable(ctx context.Context, req MassDisableRequest) (string, error) {
|
2023-03-24 17:09:30 +03:00
|
|
|
err := validators.ValidateRequest(req)
|
2022-12-22 17:56:47 +03:00
|
|
|
if err != nil {
|
2025-08-29 12:51:25 +03:00
|
|
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
2022-12-22 17:56:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
url := "/cloudbroker/vins/massDisable"
|
|
|
|
|
|
2025-08-29 12:51:25 +03:00
|
|
|
res, err := v.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
2022-12-22 17:56:47 +03:00
|
|
|
if err != nil {
|
2025-08-29 12:51:25 +03:00
|
|
|
return "", err
|
2022-12-22 17:56:47 +03:00
|
|
|
}
|
|
|
|
|
|
2025-08-29 12:51:25 +03:00
|
|
|
return string(res), nil
|
2022-12-22 17:56:47 +03:00
|
|
|
}
|