From 2b5c7850e7cd57b871e21f3502467bed0f914e1a Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Fri, 20 Dec 2024 18:40:18 +0100 Subject: [PATCH 1/2] Update add-rate-limiting-to-a-service-with-kong-gateway.md --- .../add-rate-limiting-to-a-service-with-kong-gateway.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/_how-tos/add-rate-limiting-to-a-service-with-kong-gateway.md b/app/_how-tos/add-rate-limiting-to-a-service-with-kong-gateway.md index 66226657..5d9e49b2 100644 --- a/app/_how-tos/add-rate-limiting-to-a-service-with-kong-gateway.md +++ b/app/_how-tos/add-rate-limiting-to-a-service-with-kong-gateway.md @@ -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" } From 034420f470fd2263ad62439e7ec4dd8826d7c483 Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Fri, 20 Dec 2024 18:40:26 +0100 Subject: [PATCH 2/2] slack webhook fixes --- ...-custom-webhook-slack-with-kong-gateway.md | 30 +++++++------------ app/_includes/prereqs/event-hook/slack.md | 4 +-- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/app/_how-tos/create-a-custom-webhook-slack-with-kong-gateway.md b/app/_how-tos/create-a-custom-webhook-slack-with-kong-gateway.md index 2c7f3c33..04853ee1 100644 --- a/app/_how-tos/create-a-custom-webhook-slack-with-kong-gateway.md +++ b/app/_how-tos/create-a-custom-webhook-slack-with-kong-gateway.md @@ -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: diff --git a/app/_includes/prereqs/event-hook/slack.md b/app/_includes/prereqs/event-hook/slack.md index 3c5e39c7..98a4613b 100644 --- a/app/_includes/prereqs/event-hook/slack.md +++ b/app/_includes/prereqs/event-hook/slack.md @@ -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=` -4. In Slack, add your application to a channel.