2022-10-06 12:53:21 +03:00
|
|
|
package rg
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"net/http"
|
2023-03-24 17:09:30 +03:00
|
|
|
|
|
|
|
|
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
2022-10-06 12:53:21 +03:00
|
|
|
)
|
|
|
|
|
|
2023-10-25 17:37:18 +03:00
|
|
|
// MassDisableRequest struct to disable several resource groups
|
2022-10-06 12:53:21 +03:00
|
|
|
type MassDisableRequest struct {
|
2022-12-22 17:56:47 +03:00
|
|
|
// IDs of the resource groups
|
|
|
|
|
// Required: true
|
2023-03-24 17:09:30 +03:00
|
|
|
RGIDs []uint64 `url:"rgIds" json:"rgIds" validate:"min=1"`
|
2022-10-06 12:53:21 +03:00
|
|
|
}
|
|
|
|
|
|
2022-12-22 17:56:47 +03:00
|
|
|
// MassDisable start jobs to disable several resource groups
|
2025-07-15 17:39:18 +03:00
|
|
|
func (r RG) MassDisable(ctx context.Context, req MassDisableRequest) (string, error) {
|
2023-03-24 17:09:30 +03:00
|
|
|
err := validators.ValidateRequest(req)
|
2022-10-06 12:53:21 +03:00
|
|
|
if err != nil {
|
2025-07-15 17:39:18 +03:00
|
|
|
return "", validators.ValidationErrors(validators.GetErrors(err))
|
2022-10-06 12:53:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
url := "/cloudbroker/rg/massDisable"
|
|
|
|
|
|
2025-07-15 17:39:18 +03:00
|
|
|
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
2022-10-06 12:53:21 +03:00
|
|
|
if err != nil {
|
2025-07-15 17:39:18 +03:00
|
|
|
return "", err
|
2022-10-06 12:53:21 +03:00
|
|
|
}
|
|
|
|
|
|
2025-07-15 17:39:18 +03:00
|
|
|
return string(res), nil
|
2022-10-06 12:53:21 +03:00
|
|
|
}
|