mirror of
https://github.com/netbirdio/netbird.git
synced 2025-06-27 05:01:43 +02:00
[management] Add network traffic events pagination (#3580)
* Add network traffic events pagination schema
This commit is contained in:
parent
d2b42c8f68
commit
488e619ec7
@ -2015,6 +2015,32 @@ components:
|
|||||||
- policy_name
|
- policy_name
|
||||||
- icmp_type
|
- icmp_type
|
||||||
- icmp_code
|
- icmp_code
|
||||||
|
NetworkTrafficEventsResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
data:
|
||||||
|
type: array
|
||||||
|
description: List of network traffic events
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/NetworkTrafficEvent"
|
||||||
|
page:
|
||||||
|
type: integer
|
||||||
|
description: Current page number
|
||||||
|
page_size:
|
||||||
|
type: integer
|
||||||
|
description: Number of items per page
|
||||||
|
total_records:
|
||||||
|
type: integer
|
||||||
|
description: Total number of event records available
|
||||||
|
total_pages:
|
||||||
|
type: integer
|
||||||
|
description: Total number of pages available
|
||||||
|
required:
|
||||||
|
- data
|
||||||
|
- page
|
||||||
|
- page_size
|
||||||
|
- total_records
|
||||||
|
- total_pages
|
||||||
responses:
|
responses:
|
||||||
not_found:
|
not_found:
|
||||||
description: Resource not found
|
description: Resource not found
|
||||||
@ -4231,15 +4257,77 @@ paths:
|
|||||||
tags: [ Events ]
|
tags: [ Events ]
|
||||||
x-cloud-only: true
|
x-cloud-only: true
|
||||||
x-experimental: true
|
x-experimental: true
|
||||||
|
parameters:
|
||||||
|
- name: page
|
||||||
|
in: query
|
||||||
|
description: Page number
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
|
default: 1
|
||||||
|
- name: page_size
|
||||||
|
in: query
|
||||||
|
description: Number of items per page
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
|
maximum: 50000
|
||||||
|
default: 1000
|
||||||
|
- name: user_id
|
||||||
|
in: query
|
||||||
|
description: Filter by user ID
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- name: protocol
|
||||||
|
in: query
|
||||||
|
description: Filter by protocol
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
- name: type
|
||||||
|
in: query
|
||||||
|
description: Filter by event type
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
enum: [TYPE_UNKNOWN, TYPE_START, TYPE_END, TYPE_DROP]
|
||||||
|
- name: direction
|
||||||
|
in: query
|
||||||
|
description: Filter by direction
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
enum: [INGRESS, EGRESS, DIRECTION_UNKNOWN]
|
||||||
|
- name: search
|
||||||
|
in: query
|
||||||
|
description: Filters events with a partial match on user email, source and destination names and source and destination addresses
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- name: start_date
|
||||||
|
in: query
|
||||||
|
description: Start date for filtering events (ISO 8601 format, e.g., 2024-01-01T00:00:00Z).
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
- name: end_date
|
||||||
|
in: query
|
||||||
|
description: End date for filtering events (ISO 8601 format, e.g., 2024-01-31T23:59:59Z).
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: List of network traffic events
|
description: List of network traffic events
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: array
|
$ref: "#/components/schemas/NetworkTrafficEventsResponse"
|
||||||
items:
|
|
||||||
$ref: "#/components/schemas/NetworkTrafficEvent"
|
|
||||||
'400':
|
'400':
|
||||||
"$ref": "#/components/responses/bad_request"
|
"$ref": "#/components/responses/bad_request"
|
||||||
'401':
|
'401':
|
||||||
|
@ -185,6 +185,21 @@ const (
|
|||||||
UserPermissionsDashboardViewLimited UserPermissionsDashboardView = "limited"
|
UserPermissionsDashboardViewLimited UserPermissionsDashboardView = "limited"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Defines values for GetApiEventsNetworkTrafficParamsType.
|
||||||
|
const (
|
||||||
|
GetApiEventsNetworkTrafficParamsTypeTYPEDROP GetApiEventsNetworkTrafficParamsType = "TYPE_DROP"
|
||||||
|
GetApiEventsNetworkTrafficParamsTypeTYPEEND GetApiEventsNetworkTrafficParamsType = "TYPE_END"
|
||||||
|
GetApiEventsNetworkTrafficParamsTypeTYPESTART GetApiEventsNetworkTrafficParamsType = "TYPE_START"
|
||||||
|
GetApiEventsNetworkTrafficParamsTypeTYPEUNKNOWN GetApiEventsNetworkTrafficParamsType = "TYPE_UNKNOWN"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Defines values for GetApiEventsNetworkTrafficParamsDirection.
|
||||||
|
const (
|
||||||
|
GetApiEventsNetworkTrafficParamsDirectionDIRECTIONUNKNOWN GetApiEventsNetworkTrafficParamsDirection = "DIRECTION_UNKNOWN"
|
||||||
|
GetApiEventsNetworkTrafficParamsDirectionEGRESS GetApiEventsNetworkTrafficParamsDirection = "EGRESS"
|
||||||
|
GetApiEventsNetworkTrafficParamsDirectionINGRESS GetApiEventsNetworkTrafficParamsDirection = "INGRESS"
|
||||||
|
)
|
||||||
|
|
||||||
// AccessiblePeer defines model for AccessiblePeer.
|
// AccessiblePeer defines model for AccessiblePeer.
|
||||||
type AccessiblePeer struct {
|
type AccessiblePeer struct {
|
||||||
// CityName Commonly used English name of the city
|
// CityName Commonly used English name of the city
|
||||||
@ -922,6 +937,24 @@ type NetworkTrafficEvent struct {
|
|||||||
UserName *string `json:"user_name"`
|
UserName *string `json:"user_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NetworkTrafficEventsResponse defines model for NetworkTrafficEventsResponse.
|
||||||
|
type NetworkTrafficEventsResponse struct {
|
||||||
|
// Data List of network traffic events
|
||||||
|
Data []NetworkTrafficEvent `json:"data"`
|
||||||
|
|
||||||
|
// Page Current page number
|
||||||
|
Page int `json:"page"`
|
||||||
|
|
||||||
|
// PageSize Number of items per page
|
||||||
|
PageSize int `json:"page_size"`
|
||||||
|
|
||||||
|
// TotalPages Total number of pages available
|
||||||
|
TotalPages int `json:"total_pages"`
|
||||||
|
|
||||||
|
// TotalRecords Total number of event records available
|
||||||
|
TotalRecords int `json:"total_records"`
|
||||||
|
}
|
||||||
|
|
||||||
// NetworkTrafficLocation defines model for NetworkTrafficLocation.
|
// NetworkTrafficLocation defines model for NetworkTrafficLocation.
|
||||||
type NetworkTrafficLocation struct {
|
type NetworkTrafficLocation struct {
|
||||||
// CityName Name of the city (if known).
|
// CityName Name of the city (if known).
|
||||||
@ -1743,6 +1776,42 @@ type UserRequest struct {
|
|||||||
Role string `json:"role"`
|
Role string `json:"role"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetApiEventsNetworkTrafficParams defines parameters for GetApiEventsNetworkTraffic.
|
||||||
|
type GetApiEventsNetworkTrafficParams struct {
|
||||||
|
// Page Page number
|
||||||
|
Page *int `form:"page,omitempty" json:"page,omitempty"`
|
||||||
|
|
||||||
|
// PageSize Number of items per page
|
||||||
|
PageSize *int `form:"page_size,omitempty" json:"page_size,omitempty"`
|
||||||
|
|
||||||
|
// UserId Filter by user ID
|
||||||
|
UserId *string `form:"user_id,omitempty" json:"user_id,omitempty"`
|
||||||
|
|
||||||
|
// Protocol Filter by protocol
|
||||||
|
Protocol *int `form:"protocol,omitempty" json:"protocol,omitempty"`
|
||||||
|
|
||||||
|
// Type Filter by event type
|
||||||
|
Type *GetApiEventsNetworkTrafficParamsType `form:"type,omitempty" json:"type,omitempty"`
|
||||||
|
|
||||||
|
// Direction Filter by direction
|
||||||
|
Direction *GetApiEventsNetworkTrafficParamsDirection `form:"direction,omitempty" json:"direction,omitempty"`
|
||||||
|
|
||||||
|
// Search Filters events with a partial match on user email, source and destination names and source and destination addresses
|
||||||
|
Search *string `form:"search,omitempty" json:"search,omitempty"`
|
||||||
|
|
||||||
|
// StartDate Start date for filtering events (ISO 8601 format, e.g., 2024-01-01T00:00:00Z).
|
||||||
|
StartDate *time.Time `form:"start_date,omitempty" json:"start_date,omitempty"`
|
||||||
|
|
||||||
|
// EndDate End date for filtering events (ISO 8601 format, e.g., 2024-01-31T23:59:59Z).
|
||||||
|
EndDate *time.Time `form:"end_date,omitempty" json:"end_date,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetApiEventsNetworkTrafficParamsType defines parameters for GetApiEventsNetworkTraffic.
|
||||||
|
type GetApiEventsNetworkTrafficParamsType string
|
||||||
|
|
||||||
|
// GetApiEventsNetworkTrafficParamsDirection defines parameters for GetApiEventsNetworkTraffic.
|
||||||
|
type GetApiEventsNetworkTrafficParamsDirection string
|
||||||
|
|
||||||
// GetApiPeersParams defines parameters for GetApiPeers.
|
// GetApiPeersParams defines parameters for GetApiPeers.
|
||||||
type GetApiPeersParams struct {
|
type GetApiPeersParams struct {
|
||||||
// Name Filter peers by name
|
// Name Filter peers by name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user