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

Add CLI commands for managing webhook endpoints #1754

Merged
merged 1 commit into from
Dec 18, 2024
Merged

Conversation

gunndabad
Copy link
Collaborator

@gunndabad gunndabad commented Dec 18, 2024

These commands provide a temporary solution for managing webhook endpoints until we have some UI for doing so.

Create an endpoint

> trscli webhook-endpoint create --user-id "0b5b4d7a-f096-493f-aaea-9771fdeaff5c" --address "https://localhost:4200/webhook" --cloud-event-types alert.created alert.updated alert.deleted --api-version Next

{
  "WebhookEndpointId": "e3809f55-71ff-41ff-8a6a-76b4b88219e1",
  "ApplicationUserId": "0b5b4d7a-f096-493f-aaea-9771fdeaff5c",
  "ApplicationUserName": "Developer",
  "ApiVersion": "Next",
  "Address": "https://localhost:4200/webhook",
  "CloudEventTypes": [
    "alert.created",
    "alert.deleted",
    "alert.updated"
  ],
  "Enabled": true
}

List all endpoints

> trscli webhook-endpoint list

[
  {
    "WebhookEndpointId": "e3809f55-71ff-41ff-8a6a-76b4b88219e1",
    "ApplicationUserId": "0b5b4d7a-f096-493f-aaea-9771fdeaff5c",
    "ApplicationUserName": "Developer",
    "ApiVersion": "Next",
    "Address": "https://localhost:4200/webhook",
    "CloudEventTypes": [
      "alert.created",
      "alert.deleted",
      "alert.updated"
    ],
    "Enabled": true
  }
]

Update an endpoint (e.g. disable it)

> trscli webhook-endpoint update --id "e3809f55-71ff-41ff-8a6a-76b4b88219e1" --enabled false

{
  "WebhookEndpointId": "e3809f55-71ff-41ff-8a6a-76b4b88219e1",
  "ApplicationUserId": "0b5b4d7a-f096-493f-aaea-9771fdeaff5c",
  "ApplicationUserName": "Developer",
  "ApiVersion": "Next",
  "Address": "https://localhost:4200/webhook",
  "CloudEventTypes": [
    "alert.created",
    "alert.deleted",
    "alert.updated"
  ],
  "Enabled": false
}

Delete an endpoint

> trscli webhook-endpoint delete --id "e3809f55-71ff-41ff-8a6a-76b4b88219e1"

@gunndabad gunndabad force-pushed the webhook-cli-commands branch from 03b1027 to 24695eb Compare December 18, 2024 14:30
@gunndabad gunndabad marked this pull request as ready for review December 18, 2024 14:31
@gunndabad gunndabad merged commit ee51de7 into main Dec 18, 2024
18 checks passed
@gunndabad gunndabad deleted the webhook-cli-commands branch December 18, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants