Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST APIs for events. #8655

Merged
merged 5 commits into from
Sep 5, 2023
Merged

Conversation

MUzairS15
Copy link
Contributor

@MUzairS15 MUzairS15 commented Sep 5, 2023

Notes for Reviewers

This PR fixes adds REST APIs for events.

  1. /api/v2/events: Get all events belonging to the logged in user. (This particular API will be changed to /api/events once the UI is compeltely updated to use new events and SSE is tunred off, otherwise existing events will break.)
    Supported query params:
  2. ?page : Defaults to page 1
  3. ?pagesize: Defaults to 25, to get all events set ?pagesize=all
  4. ?sort: Column to sort the results on, defaults to updated_at.
  5. ?order: Sort order for the results, defaults to ascending.
  6. ?category: Filter events based on event category, expects an array. eg: ?category=[connection, application,...]
  7. ?severity: Filter events based on event severity, expects an array. eg: ?severity=[informational, error,...]
  8. ?action: Filter events based on event action, expects an array. eg: ?action=[create, delete,...]
  9. ?search: Search based one event description. (Not requried now, but have added incase)
API response:
{
  "events": [
    {
      "acted_upon": "1cfd0da5-3c6e-a2a5-eb1b-f6a7cd55f402",
      "action": "registering",
      "category": "connection",
      "created_at": "2023-09-01T16:43:33.548017+05:30",
      "description": "",
      "id": "12ere4-sew33-23asds-er45-49s56w2",
      "metadata": null,
      "operation_id": "25e5524f-3e08-42a5-a1f3-a12e73d54de4",
      "severity": "informational",
      "status": "",
      "system_id": "f7368f43-0d14-4e6a-918b-5dbef07aaafb",
      "updated_at": "2023-09-01T16:43:33.548168+05:30",
      "user_id": "b6467d0a-f11e-4614-9eb2-ab80c4f1c58d"
    }
  ],
  "page": 1,
  "page_size": 1,
  "count_by_severity_level": [
    {
      "severity": "error",
      "count": 23
    },
    {
      "severity": "informational",
      "count": 60
    },
    {
      "severity": "warning",
      "count": 93
    }
  ],
  "total_count": 65
}

page, pagesize, totalcount, count_by_severity_level are always returned`.

  1. /api/events/status/{id}:

Update event's status associated with id.

Response: Updated event.
 {
      "acted_upon": "00000000-0000-0000-0000-000000000000",
      "action": "flush",
      "category": "meshsync",
      "created_at": "2023-09-02T18:52:59.092049+05:30",
      "description": "No Kubernetes context specified, please choose a context from context switcher",
      "id": "93f33cc1-f1e4-416d-9177-1c239bf3c0e0",
      "metadata": null,
      "operation_id": "d6019752-f7a1-4af3-a5f2-d30d2158e51d",
      "severity": "error",
      "status": "unread",
      "system_id": "d24217ff-a41f-4215-933c-a6ed2f599a50",
      "updated_at": "2023-09-05T22:09:29.247692+05:30",
      "user_id": "b6467d0a-f11e-4614-9eb2-ab80c4f1c58d"
    }
  1. /api/events/{id}:
    Delete event associated with id.
    Signed commits
  • Yes, I signed my commits.

Signed-off-by: MUzairS15 <muzair.shaikh810@gmail.com>
Signed-off-by: MUzairS15 <muzair.shaikh810@gmail.com>
server/handlers/error.go Outdated Show resolved Hide resolved
server/handlers/error.go Outdated Show resolved Hide resolved
server/handlers/error.go Outdated Show resolved Hide resolved
server/handlers/error.go Outdated Show resolved Hide resolved
Signed-off-by: Lee Calcote <leecalcote@gmail.com>
@leecalcote leecalcote merged commit d860b21 into meshery:master Sep 5, 2023
12 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants