This commit is contained in:
2026-06-05 17:14:39 +03:00
parent e9adcfec1c
commit fea00bbb42
157 changed files with 4837 additions and 251 deletions

View File

@@ -19,6 +19,12 @@ type MassDeleteRequest struct {
Permanently bool `url:"permanently,omitempty" json:"permanently,omitempty"`
}
type wrapperMassDeleteRequest struct {
MassDeleteRequest
AsyncMode bool `url:"asyncMode"`
}
// MassDelete starts jobs to delete several computes
func (c Compute) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -26,9 +32,14 @@ func (c Compute) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, e
return false, validators.ValidationErrors(validators.GetErrors(err))
}
reqWrapped := wrapperMassDeleteRequest{
MassDeleteRequest: req,
AsyncMode: false,
}
url := "/cloudbroker/compute/massDelete"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -40,3 +51,25 @@ func (c Compute) MassDelete(ctx context.Context, req MassDeleteRequest) (bool, e
return result, nil
}
// MassDeleteAsync starts jobs to delete several computes with AsyncMode
func (c Compute) MassDeleteAsync(ctx context.Context, req MassDeleteRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
reqWrapped := wrapperMassDeleteRequest{
MassDeleteRequest: req,
AsyncMode: true,
}
url := "/cloudbroker/compute/massDelete"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}