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.
58 lines
1.4 KiB
58 lines
1.4 KiB
package user
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
// GetAuditRequest struct for getting user's audits.
|
|
type GetAuditRequest struct {
|
|
// Name of user (get audits for current user if set to empty).
|
|
// Required: false
|
|
Username string `url:"username,omitempty" json:"username,omitempty"`
|
|
|
|
// Find by api call.
|
|
// Required: false
|
|
Call string `url:"call,omitempty" json:"call,omitempty"`
|
|
|
|
// Find by HTTP status code
|
|
// Required: false
|
|
StatusCode uint64 `url:"statuscode,omitempty" json:"statuscode,omitempty"`
|
|
|
|
// Find all audits after point in time (unixtime)
|
|
// Required: false
|
|
TimestampAt uint64 `url:"timestampAt,omitempty" json:"timestampAt,omitempty"`
|
|
|
|
// Find all audits before point in time (unixtime)
|
|
// Required: false
|
|
TimestampTo uint64 `url:"timestampTo,omitempty" json:"timestampTo,omitempty"`
|
|
|
|
// Page number.
|
|
// Required: false
|
|
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
|
|
|
// Page size, maximum - 100.
|
|
// Required: false
|
|
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
|
}
|
|
|
|
// GetAudit gets user's audits.
|
|
func (u User) GetAudit(ctx context.Context, req GetAuditRequest) (ListAudits, error) {
|
|
url := "/cloudbroker/user/getAudit"
|
|
|
|
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
|
if err != nil {
|
|
return ListAudits{}, err
|
|
}
|
|
|
|
list := ListAudits{}
|
|
|
|
err = json.Unmarshal(res, &list)
|
|
if err != nil {
|
|
return ListAudits{}, err
|
|
}
|
|
|
|
return list, nil
|
|
}
|