mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-06 04:48:40 +00:00
Fixed fetch not using from/to options (#179)
This commit is contained in:
parent
1a0517f46b
commit
02e02718d2
@ -57,7 +57,7 @@ func GetEntries(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetHARs(c *gin.Context) {
|
func GetHARs(c *gin.Context) {
|
||||||
entriesFilter := &models.HarFetchRequestBody{}
|
entriesFilter := &models.HarFetchRequestQuery{}
|
||||||
order := database.OrderDesc
|
order := database.OrderDesc
|
||||||
if err := c.BindQuery(entriesFilter); err != nil {
|
if err := c.BindQuery(entriesFilter); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, err)
|
c.JSON(http.StatusBadRequest, err)
|
||||||
@ -146,12 +146,12 @@ func GetHARs(c *gin.Context) {
|
|||||||
func UploadEntries(c *gin.Context) {
|
func UploadEntries(c *gin.Context) {
|
||||||
rlog.Infof("Upload entries - started\n")
|
rlog.Infof("Upload entries - started\n")
|
||||||
|
|
||||||
uploadRequestBody := &models.UploadEntriesRequestBody{}
|
uploadParams := &models.UploadEntriesRequestQuery{}
|
||||||
if err := c.BindQuery(uploadRequestBody); err != nil {
|
if err := c.BindQuery(uploadParams); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, err)
|
c.JSON(http.StatusBadRequest, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := validation.Validate(uploadRequestBody); err != nil {
|
if err := validation.Validate(uploadParams); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, err)
|
c.JSON(http.StatusBadRequest, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -160,19 +160,19 @@ func UploadEntries(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
rlog.Infof("Upload entries - creating token. dest %s\n", uploadRequestBody.Dest)
|
rlog.Infof("Upload entries - creating token. dest %s\n", uploadParams.Dest)
|
||||||
token, err := up9.CreateAnonymousToken(uploadRequestBody.Dest)
|
token, err := up9.CreateAnonymousToken(uploadParams.Dest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.String(http.StatusServiceUnavailable, "Cannot analyze, mizu is already analyzing")
|
c.String(http.StatusServiceUnavailable, "Cannot analyze, mizu is already analyzing")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
rlog.Infof("Upload entries - uploading. token: %s model: %s\n", token.Token, token.Model)
|
rlog.Infof("Upload entries - uploading. token: %s model: %s\n", token.Token, token.Model)
|
||||||
go up9.UploadEntriesImpl(token.Token, token.Model, uploadRequestBody.Dest, uploadRequestBody.SleepIntervalSec)
|
go up9.UploadEntriesImpl(token.Token, token.Model, uploadParams.Dest, uploadParams.SleepIntervalSec)
|
||||||
c.String(http.StatusOK, "OK")
|
c.String(http.StatusOK, "OK")
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetFullEntries(c *gin.Context) {
|
func GetFullEntries(c *gin.Context) {
|
||||||
entriesFilter := &models.HarFetchRequestBody{}
|
entriesFilter := &models.HarFetchRequestQuery{}
|
||||||
if err := c.BindQuery(entriesFilter); err != nil {
|
if err := c.BindQuery(entriesFilter); err != nil {
|
||||||
c.JSON(http.StatusBadRequest, err)
|
c.JSON(http.StatusBadRequest, err)
|
||||||
}
|
}
|
||||||
|
@ -119,19 +119,19 @@ func (fedex *FullEntryDetailsExtra) UnmarshalData(entry *MizuEntry) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type EntriesFilter struct {
|
type EntriesFilter struct {
|
||||||
Limit int `query:"limit" validate:"required,min=1,max=200"`
|
Limit int `form:"limit" validate:"required,min=1,max=200"`
|
||||||
Operator string `query:"operator" validate:"required,oneof='lt' 'gt'"`
|
Operator string `form:"operator" validate:"required,oneof='lt' 'gt'"`
|
||||||
Timestamp int64 `query:"timestamp" validate:"required,min=1"`
|
Timestamp int64 `form:"timestamp" validate:"required,min=1"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UploadEntriesRequestBody struct {
|
type UploadEntriesRequestQuery struct {
|
||||||
Dest string `form:"dest"`
|
Dest string `form:"dest"`
|
||||||
SleepIntervalSec int `form:"interval"`
|
SleepIntervalSec int `form:"interval"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HarFetchRequestBody struct {
|
type HarFetchRequestQuery struct {
|
||||||
From int64 `query:"from"`
|
From int64 `form:"from"`
|
||||||
To int64 `query:"to"`
|
To int64 `form:"to"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebSocketEntryMessage struct {
|
type WebSocketEntryMessage struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user