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

44 lines
1.2 KiB
Go
Raw Normal View History

2025-09-23 14:34:24 +03:00
package rg
import (
"context"
"net/http"
2025-12-08 16:30:08 +03:00
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/internal/validators"
2025-09-23 14:34:24 +03:00
)
// MassDeleteRequest struct to delete several resource groups
type MassDeleteRequest struct {
// IDs of the resource groups
// Required: true
RGIDs []uint64 `url:"rgIds" json:"rgIds" validate:"min=1"`
// Set to true if you want force delete non-empty resource groups
// Required: false
Force bool `url:"force,omitempty" json:"force,omitempty"`
// 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
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
}
// MassDelete starts jobs to delete several resource groups
2025-09-27 01:06:15 +03:00
func (r RG) MassDelete(ctx context.Context, req MassDeleteRequest) (string, error) {
2025-09-23 14:34:24 +03:00
err := validators.ValidateRequest(req)
if err != nil {
2025-09-27 01:06:15 +03:00
return "", validators.ValidationErrors(validators.GetErrors(err))
2025-09-23 14:34:24 +03:00
}
url := "/cloudbroker/rg/massDelete"
2025-09-27 01:06:15 +03:00
res, err := r.client.DecortApiCall(ctx, http.MethodPost, url, req)
2025-09-23 14:34:24 +03:00
if err != nil {
2025-09-27 01:06:15 +03:00
return "", err
2025-09-23 14:34:24 +03:00
}
2025-09-27 01:06:15 +03:00
return string(res), nil
2025-09-23 14:34:24 +03:00
}