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.
dynamix-golang-sdk/pkg/cloudbroker/apiaccess/user_list.go

49 lines
1.1 KiB

package apiaccess
import (
"context"
"encoding/json"
"net/http"
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v12/internal/validators"
)
// UserListRequest struct for getting a list of users currently included in the specified group.
type UserListRequest struct {
// APIAccess group ID
// Required: true
APIAccessID uint64 `url:"apiaccess_id" json:"apiaccess_id" validate:"required"`
// Page number
// Required: false
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
// Page size
// Required: false
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
}
// UserList gets a list of users currently included in the specified group.
func (a APIAccess) UserList(ctx context.Context, req UserListRequest) ([]string, error) {
err := validators.ValidateRequest(req)
if err != nil {
return nil, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/apiaccess/userList"
list := make([]string, 0)
res, err := a.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
}