v9.0.0
This commit is contained in:
42
pkg/cloudbroker/user/apiaccess_list.go
Normal file
42
pkg/cloudbroker/user/apiaccess_list.go
Normal file
@@ -0,0 +1,42 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v9/internal/validators"
|
||||
)
|
||||
|
||||
// APIAccessListRequest struct for showing list of dicts with information about
|
||||
// apiaccess groups contains to the user.
|
||||
type APIAccessListRequest struct {
|
||||
// ID of the user to list API access groups for.
|
||||
// Required: true
|
||||
UserID string `url:"userId" json:"userId" validate:"required"`
|
||||
}
|
||||
|
||||
// APIAccessList shows list of dicts with information about apiaccess groups contains to the user.
|
||||
func (u User) APIAccessList(ctx context.Context, req APIAccessListRequest) (ListAPIAccess, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/apiaccessList"
|
||||
|
||||
list := ListAPIAccess{}
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(res, &list)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return list, nil
|
||||
}
|
||||
Reference in New Issue
Block a user