v16.10.0
This commit is contained in:
aafetisov committed 2026-10-30 16:04:15 +03:00
1 parent bc8c2b40e9
commit 00994516ba
52 files changed
+2287 -98

No files matched your search

+34 -1
View File
@@ -23,6 +23,12 @@ type AddStoragePolicyRequest struct {
Limit int `url:"limit,omitempty" json:"limit,omitempty"`
}
type wrapperAddStoragePolicyRequest struct {
AddStoragePolicyRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// AddStoragePolicy add storage policy to the account.
func (a Account) AddStoragePolicy(ctx context.Context, req AddStoragePolicyRequest) (bool, error) {
err := validators.ValidateRequest(req)
@@ -32,7 +38,12 @@ func (a Account) AddStoragePolicy(ctx context.Context, req AddStoragePolicyReque
url := "/cloudbroker/account/add_storage_policy"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperAddStoragePolicyRequest{
AddStoragePolicyRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -44,3 +55,25 @@ func (a Account) AddStoragePolicy(ctx context.Context, req AddStoragePolicyReque
return result, nil
}
// AddStoragePolicyAsync add storage policy to the account in async mode
func (a Account) AddStoragePolicyAsync(ctx context.Context, req AddStoragePolicyRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/add_storage_policy"
reqWrapped := wrapperAddStoragePolicyRequest{
AddStoragePolicyRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}