v16.10.0
v16.10.0
This commit is contained in:
1 parent
bc8c2b40e9
commit
00994516ba
52 files changed
+2287
-98
No files matched your search
@@ -70,6 +70,12 @@ type UpdateRequest struct {
|
||||
CpuAllocationParameter string `url:"cpu_allocation_parameter,omitempty" json:"cpu_allocation_parameter,omitempty"`
|
||||
}
|
||||
|
||||
type wrapperUpdateRequest struct {
|
||||
UpdateRequest
|
||||
|
||||
AsyncMode bool `url:"async_mode" json:"async_mode"`
|
||||
}
|
||||
|
||||
// Update updates an account name and resource types and limits
|
||||
func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
@@ -79,7 +85,12 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
|
||||
url := "/cloudbroker/account/update"
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, req)
|
||||
reqWrapped := wrapperUpdateRequest{
|
||||
UpdateRequest: req,
|
||||
AsyncMode: false,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -91,3 +102,25 @@ func (a Account) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// UpdateAsync updates an account name and resource types and limits in async mode
|
||||
func (a Account) UpdateAsync(ctx context.Context, req UpdateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/account/update"
|
||||
|
||||
reqWrapped := wrapperUpdateRequest{
|
||||
UpdateRequest: req,
|
||||
AsyncMode: true,
|
||||
}
|
||||
|
||||
res, err := a.client.DecortApiCallCtype(ctx, http.MethodPost, url, constants.MIMEJSON, reqWrapped)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
Reference in new issue
Block a user