Files
decort-golang-sdk/pkg/cloudbroker/rg/mass_delete.go

44 lines
1.2 KiB
Go
Raw Normal View History

package rg
import (
"context"
"net/http"
2023-03-24 17:09:30 +03:00
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
2023-10-25 17:37:18 +03:00
// MassDeleteRequest struct to delete several resource groups
type MassDeleteRequest 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-12-22 17:56:47 +03:00
// Set to true if you want force delete non-empty resource groups
// Required: false
2023-03-01 19:05:53 +03:00
Force bool `url:"force,omitempty" json:"force,omitempty"`
2022-12-22 17:56:47 +03:00
// Set to true if you want to destroy resource group and all linked
// resources, if any, immediately.
// Otherwise, they will be placed into recycle bin and could be
// restored later within recycle bins purge period
// Required: false
2023-03-01 19:05:53 +03:00
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
}
2022-12-22 17:56:47 +03:00
// MassDelete starts jobs to delete several resource groups
2025-07-15 17:39:18 +03:00
func (r RG) MassDelete(ctx context.Context, req MassDeleteRequest) (string, error) {
2023-03-24 17:09:30 +03:00
err := validators.ValidateRequest(req)
if err != nil {
2025-07-15 17:39:18 +03:00
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/rg/massDelete"
2025-07-15 17:39:18 +03:00
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
2025-07-15 17:39:18 +03:00
return "", err
}
2025-07-15 17:39:18 +03:00
return string(res), nil
}