v1.16.4
v1.16.4
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
@@ -27,10 +26,10 @@ type wrapperUpdateRequest struct {
|
||||
}
|
||||
|
||||
// Update updates apis of apiaccess group.
|
||||
func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (bool, error) {
|
||||
func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (*ItemAPIAccess, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return false, validators.ValidationErrors(validators.GetErrors(err))
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/apiaccess/update"
|
||||
@@ -41,20 +40,22 @@ func (a APIAccess) Update(ctx context.Context, req UpdateRequest) (bool, error)
|
||||
|
||||
apiJSON, err := json.Marshal(&req.APIs)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
reqWrapped.APIString = string(apiJSON)
|
||||
|
||||
res, err := a.client.DecortApiCall(ctx, http.MethodPost, url, reqWrapped)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result, err := strconv.ParseBool(string(res))
|
||||
info := ItemAPIAccess{}
|
||||
|
||||
err = json.Unmarshal(res, &info)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return result, nil
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user