You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
package user
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/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
|
|
}
|