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

+35 -2
View File
@@ -19,7 +19,13 @@ type AddZoneRequest struct {
ZoneIDs []uint64 `url:"zoneIds" json:"zoneIds" validate:"required"`
}
// AddUser gives a user access rights.
type wrapperAddZoneRequest struct {
AddZoneRequest
AsyncMode bool `url:"async_mode" json:"async_mode"`
}
// AddZone adds zones to account
func (a Account) AddZone(ctx context.Context, req AddZoneRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
@@ -28,7 +34,12 @@ func (a Account) AddZone(ctx context.Context, req AddZoneRequest) (bool, error)
url := "/cloudbroker/account/addZone"
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
reqWrapped := wrapperAddZoneRequest{
AddZoneRequest: req,
AsyncMode: false,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return false, err
}
@@ -40,3 +51,25 @@ func (a Account) AddZone(ctx context.Context, req AddZoneRequest) (bool, error)
return result, nil
}
// AddZoneAsync adds zones to account in async mode
func (a Account) AddZoneAsync(ctx context.Context, req AddZoneRequest) (string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/addZone"
reqWrapped := wrapperAddZoneRequest{
AddZoneRequest: req,
AsyncMode: true,
}
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
if err != nil {
return "", err
}
return string(res), nil
}