Files
dynamix-golang-sdk/pkg/cloudbroker/compute/abort_shared_snapshot_merge.go

69 lines
1.9 KiB
Go
Raw Normal View History

2025-09-27 01:06:15 +03:00
package compute
import (
"context"
"net/http"
2026-06-05 17:30:36 +03:00
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v15/internal/validators"
2025-09-27 01:06:15 +03:00
)
// AbortSharedSnapshotMergeRequest struct to abort shared snapshots merge
type AbortSharedSnapshotMergeRequest struct {
// ID of the compute
// Required: true
ComputeID uint64 `url:"compute_id" json:"compute_id" validate:"required"`
// Label of the snapshot
// Required: true
Label string `url:"label" json:"label" validate:"required"`
}
2026-06-05 17:30:36 +03:00
type wrapperAbortSharedSnapshotMergeRequest struct {
AbortSharedSnapshotMergeRequest
AsyncMode bool `url:"asyncMode"`
}
2025-09-27 01:06:15 +03:00
// AbortSharedSnapshotMerge shared snapshots merge abort
2026-03-13 17:20:54 +03:00
func (c Compute) AbortSharedSnapshotMerge(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
2025-09-27 01:06:15 +03:00
err := validators.ValidateRequest(req)
if err != nil {
2026-03-13 17:20:54 +03:00
return "", validators.ValidationErrors(validators.GetErrors(err))
2025-09-27 01:06:15 +03:00
}
2026-06-05 17:30:36 +03:00
reqWrapped := wrapperAbortSharedSnapshotMergeRequest{
AbortSharedSnapshotMergeRequest: req,
AsyncMode: false,
}
url := "/cloudbroker/compute/abort_shared_snapshot_merge"
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}
// AbortSharedSnapshotMergeAsync shared snapshots merge abort in async mode
func (c Compute) AbortSharedSnapshotMergeAsync(ctx context.Context, req AbortSharedSnapshotMergeRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
reqWrapped := wrapperAbortSharedSnapshotMergeRequest{
AbortSharedSnapshotMergeRequest: req,
AsyncMode: true,
}
2025-09-27 01:06:15 +03:00
url := "/cloudbroker/compute/abort_shared_snapshot_merge"
2026-06-05 17:30:36 +03:00
res, err := c.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
2025-09-27 01:06:15 +03:00
if err != nil {
2026-03-13 17:20:54 +03:00
return "", err
2025-09-27 01:06:15 +03:00
}
2026-03-13 17:20:54 +03:00
return string(res), nil
2025-09-27 01:06:15 +03:00
}