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

QA: how-tos #190

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,18 @@ entities:
hour: 1000
{% endentity_examples %}

## 2. Validate
## 2. Apply configuration

{% include how-tos/steps/apply_config.md %}

## 3. Validate

After configuring the Rate Limiting plugin, you can verify that it was configured correctly and is working, by sending more requests than allowed in the configured time limit.

```bash
for _ in {1..6}
do
curl http://localhost:8000/example-route/anything/
curl -i http://localhost:8000/anything
done
```
{: data-deployment-topology="on-prem" }
Expand Down
30 changes: 11 additions & 19 deletions app/_how-tos/create-a-custom-webhook-slack-with-kong-gateway.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,17 @@ related_resources:
## 1. Configure an Event Hook using the `webhook-custom` handler

Using the `webhook-custom` handler, you can configure an Event Hook that listens for events on a source. The `webhook-custom` handler offers a template that you can configure to create a custom webhook. In this tutorial, we will configure an Event Hook that issues a `POST` request when a `crud` event happens on the Consumer entity. That `POST` request will be made to a Slack webhook application containing a custom message describing the event.

curl -X POST http://localhost:8001/event-hooks \
-H "Content-Type: application/json" \
-d '{
"source": "crud",
"event": "consumers",
"handler": "webhook-custom",
"on_change": true,
"config": {
"method": "POST",
"url": "$SLACK_WEBHOOK_URL",
"headers": {
"Content-type": "application/json"
},
"payload": {
"text": "new consumer added"
}
}
}'
```sh
curl -i -X POST http://localhost:8001/event-hooks \
-d source="crud" \
-d event="consumers" \
-d handler="webhook-custom" \
-d on_change=true \
-d config.method="POST" \
-d config.url=$SLACK_WEBHOOK_URL \
-d config.headers.Content-type="application/json" \
-d config.payload.text="new consumer added"
```

Posting this will result in a `200` response. The `config` body in the Event Hook contains information about the webhook that was created:

Expand Down
4 changes: 2 additions & 2 deletions app/_includes/prereqs/event-hook/slack.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ To create an event hook that pushes information to Slack you will need to config

1. Create an application in [Slack](https://api.slack.com/apps?new_app=1)
2. From the application select **Incoming Webhooks** and activate incoming webhooks.
3. Copy the **Webhook URL** from the Slack application dashboard and set it as an environment variable:
3. Add a new webhook and select a Slack channel.
4. Copy the **Webhook URL** from the Slack application dashboard and set it as an environment variable:
`export SLACK_WEBHOOK_URL=<webhook-url>`
4. In Slack, add your application to a channel.

Loading