From 01aa1e554434404b85cb631a9aff9570314d4088 Mon Sep 17 00:00:00 2001 From: Diana <75819066+cloudjumpercat@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:47:56 -0600 Subject: [PATCH] Copyedit Gateway how tos and any how to includes (#188) Signed-off-by: Diana <75819066+cloudjumpercat@users.noreply.github.com> Co-authored-by: Angel --- ...miting-for-a-consumer-with-kong-gateway.md | 24 ++++++++------- ...d-rate-limiting-tiers-with-kong-gateway.md | 9 ++++-- ...limiting-to-a-service-with-kong-gateway.md | 12 +++++--- ...-custom-webhook-slack-with-kong-gateway.md | 9 +++--- ...e-a-lambda-event-hook-with-kong-gateway.md | 10 +++---- ...eate-a-log-event-hook-with-kong-gateway.md | 8 ++--- .../create-a-webhook-with-kong-gateway.md | 6 ++-- app/_how-tos/custom-deck-object-defaults.md | 14 ++++----- ...tication-on-a-service-with-kong-gateway.md | 30 ++++++++++++++----- .../multiple-rate-limits-window-sizes.md | 12 ++++++-- .../restart-kong-gateway-container.md | 6 ++-- ...set-up-ai-proxy-advanced-with-anthropic.md | 3 +- .../set-up-ai-proxy-with-anthropic.md | 3 +- app/_includes/cleanup/platform/konnect.md | 2 +- .../how-tos/steps/ai-proxy-validate.md | 2 +- app/_includes/prereqs/entities.md | 2 +- .../event-hook/restart-kong-gateway.md | 4 +-- app/_includes/prereqs/event-hook/slack.md | 2 +- app/_includes/prereqs/products/konnect.md | 6 ++-- 19 files changed, 99 insertions(+), 65 deletions(-) diff --git a/app/_how-tos/add-rate-limiting-for-a-consumer-with-kong-gateway.md b/app/_how-tos/add-rate-limiting-for-a-consumer-with-kong-gateway.md index 25c26391..05a552b8 100644 --- a/app/_how-tos/add-rate-limiting-for-a-consumer-with-kong-gateway.md +++ b/app/_how-tos/add-rate-limiting-for-a-consumer-with-kong-gateway.md @@ -2,6 +2,8 @@ title: Rate limit a consumer with {{site.base_gateway}} content_type: how_to related_resources: + - text: Rate Limiting + url: /rate-limiting/ - text: How to create rate limiting tiers with {{site.base_gateway}} url: /how-to/add-rate-limiting-tiers-with-kong-gateway/ - text: Rate Limiting plugin @@ -32,8 +34,8 @@ tags: - rate-limiting tldr: - q: How do I rate limit a consumer with {{site.base_gateway}}? - a: Enable an authentication plugin and create a consumer with credentials, then enable the Rate Limiting plugin on the new consumer. + q: How do I rate limit a Consumer with {{site.base_gateway}}? + a: Enable an authentication plugin and create a Consumer with credentials, then enable the Rate Limiting plugin on the new Consumer. tools: - deck @@ -55,12 +57,12 @@ cleanup: icon_url: /assets/icons/gateway.svg --- -## 1. Create a consumer +## 1. Create a Consumer -Consumers let you identify the client that's interacting with {{site.base_gateway}}. -We're going to use key [authentication](/authentication/) in this tutorial, so the consumer needs an API key to access any {{site.base_gateway}} services. +[Consumers](/gateway/entities/consumer/) let you identify the client that's interacting with {{site.base_gateway}}. +We're going to use key [authentication](/authentication/) in this tutorial, so the Consumer needs an API key to access any {{site.base_gateway}} Services. -Add the following content to `kong.yaml` to create a consumer: +Add the following content to `kong.yaml` to create a Consumer: {% entity_examples %} entities: @@ -72,10 +74,10 @@ entities: ## 2. Enable authentication -Authentication lets you identify a consumer so that you can apply rate limiting. +Authentication lets you identify a Consumer so that you can apply rate limiting. This example uses the [Key Authentication](/plugins/key-auth) plugin, but you can use any authentication plugin that you prefer. -Enable the plugin globally, which means it applies to all {{site.base_gateway}} services and routes: +Enable the plugin globally, which means it applies to all {{site.base_gateway}} Services and Routes: {% entity_examples %} entities: @@ -88,7 +90,7 @@ entities: ## 3. Enable rate limiting -Enable the [Rate Limiting plugin](/plugins/rate-limiting/) for the consumer. +Enable the [Rate Limiting plugin](/plugins/rate-limiting/) for the Consumer. In this example, the limit is 5 requests per minute and 1000 requests per hour. {% entity_examples %} @@ -108,7 +110,7 @@ append_to_existing_section: true ## 5. Validate -You can run the following command to test the rate limiting as the consumer: +You can run the following command to test the rate limiting as the Consumer: ```bash for _ in {1..6}; do curl -i http://localhost:8000/anything -H 'apikey:example-key'; echo; done @@ -120,4 +122,4 @@ for _ in {1..6}; do curl -i $KONNECT_PROXY_URL/anything -H 'apikey:example-key'; ``` {: data-deployment-topology="konnect" } -This command sends six consecutive requests to the route. On the last one you should get a `429` error with the message `API rate limit exceeded`. +This command sends six consecutive requests to the Route. On the last one, you should get a `429` error with the message `API rate limit exceeded`. diff --git a/app/_how-tos/add-rate-limiting-tiers-with-kong-gateway.md b/app/_how-tos/add-rate-limiting-tiers-with-kong-gateway.md index 50de358e..a4f441c2 100644 --- a/app/_how-tos/add-rate-limiting-tiers-with-kong-gateway.md +++ b/app/_how-tos/add-rate-limiting-tiers-with-kong-gateway.md @@ -1,8 +1,11 @@ --- title: Create rate limiting tiers with {{site.base_gateway}} content_type: how_to - related_resources: + - text: Rate Limiting + url: /rate-limiting/ + - text: Rate Limiting Advanced plugin + url: /plugins/rate-limiting-advanced/ - text: Consumer Group API documentation url: /api/gateway/admin-ee/#/operations/get-consumer_groups @@ -41,7 +44,7 @@ tags: tldr: q: How do I rate limit different tiers of users, such as free vs. premium subscribers, in my API using {{site.base_gateway}}? - a: To effectively manage API traffic for various user tiers (such as free, basic, and premium subscribers), you can create **Consumer Groups** for each tier and assign individual Consumers to these groups. Then, configure the Rate Limiting Advanced plugin to apply specific rate limits based on these groups. This setup allows you to enforce customized request limits for each tier, ensuring fair usage and optimizing performance for high-value users. + a: To manage API traffic for various user tiers (such as free, basic, and premium subscribers), you can create Consumer Groups for each tier and assign individual Consumers to these groups. Then, configure the Rate Limiting Advanced plugin to apply specific rate limits based on these groups. This setup allows you to enforce customized request limits for each tier, ensuring fair usage and optimizing performance for high-value users. faqs: - q: Why can't I use the regular Rate Limiting plugin to rate limit tiers of Consumers? @@ -116,7 +119,7 @@ entities: ## 4. Enable rate limiting on each tier -Enable the Rate Limiting Advanced plugin for each tier: +Enable the Rate Limiting Advanced plugin for each tier. {% entity_examples %} entities: 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 5d9e49b2..db3b5f29 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 @@ -1,8 +1,12 @@ --- -title: Enable rate limiting on a service with {{site.base_gateway}} +title: Rate limit a Gateway Service with {{site.base_gateway}} content_type: how_to related_resources: + - text: Rate Limiting + url: /rate-limiting/ + - text: Rate Limiting plugin + url: /plugins/rate-limiting/ - text: How to create rate limiting tiers with {{site.base_gateway}} url: /how-to/add-rate-limiting-tiers-with-kong-gateway/ - text: Rate Limiting Advanced plugin @@ -29,8 +33,8 @@ tags: - rate-limiting tldr: - q: How do I rate limit a service with {{site.base_gateway}}? - a: Install the Rate Limiting plugin and enable it on the service. + q: How do I rate limit a Gateway Service with {{site.base_gateway}}? + a: Install the Rate Limiting plugin and enable it on the Service. tools: - deck @@ -54,7 +58,7 @@ cleanup: ## 1. Enable rate limiting -Enable the [Rate Limiting plugin](/plugins/rate-limiting/) for the service. +Enable the [Rate Limiting plugin](/plugins/rate-limiting/) for the Service. In this example, the limit is 5 requests per second and 1000 requests per hour. {% entity_examples %} 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 04853ee1..20df0020 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 @@ -14,8 +14,8 @@ tags: - notifications tldr: - q: How can I create a custom webhook to push information to Slack using Event Hooks. - a: With an application URL from Slack, you can configure an Event Hook using the `webhook-custom` handler that can `POST` event information to Slack. + q: How can I create a custom webhook to push information to Slack using Event Hooks? + a: With an application URL from Slack, you can configure an **Important**: Before you can use Event Hooks for the first time, {{site.base_gateway}} needs to be [reloaded](/how-to/restart-kong-gateway-container). -Using the Admin API to create a new Consumer: +Use the Admin API to create a new Consumer: ```sh curl -i -X POST http://localhost:8001/consumers \ diff --git a/app/_how-tos/create-a-lambda-event-hook-with-kong-gateway.md b/app/_how-tos/create-a-lambda-event-hook-with-kong-gateway.md index d88f58a2..d9a30dc8 100644 --- a/app/_how-tos/create-a-lambda-event-hook-with-kong-gateway.md +++ b/app/_how-tos/create-a-lambda-event-hook-with-kong-gateway.md @@ -41,9 +41,9 @@ related_resources: ## 1. Create a lambda Event Hook -A `lambda` Event Hook is an Event Hook that utilizes the `lambda` handler to pass custom code to an Event Hook. Depending on the source and individual event, that code can execute during various stages of the lifecycle of an event. In this guide, you will create an `lambda` Event Hook with custom code that logs an error with a specific message every time you create a Consumer. +A `lambda` Event Hook is an Event Hook that utilizes the `lambda` handler to pass custom code to an Event Hook. Depending on the source and individual event, that code can execute during various stages of the lifecycle of an event. In this guide, you will create an `lambda` Event Hook with custom code that logs an error with a specific message every time you create a [Consumer](/gateway/entities/consumer/). -Create a lua script to load into the lambda Event Hook. +Create a Lua script to load into the lambda Event Hook. ```lua return function (data, event, source, pid) @@ -52,7 +52,7 @@ error("Event Hook on consumer " .. user .. "") end ``` -Create a lambda Event Hook on the `consumers` event, with the `crud` source by creating a `POST` request to the Admin API and passing the code in the request body as an array of strings. +Create a `lambda` Event Hook on the `consumers` event, with the `crud` source by creating a `POST` request to the Admin API and passing the code in the request body as an array of strings. ```sh curl -i -X POST http://localhost:8001/event-hooks \ @@ -74,7 +74,7 @@ curl -i -X POST http://localhost:8001/event-hooks \ ## 2. Validate the webhook {:.warning} -> **Important**: Before you can use event hooks for the first time, {{site.base_gateway}} needs to be reloaded. +> **Important**: Before you can use Event Hooks for the first time, {{site.base_gateway}} needs to be [reloaded](/how-to/restart-kong-gateway-container). Using the Admin API create a new Consumer: @@ -89,4 +89,4 @@ Review the logs at `/usr/local/kong/logs/error.log` for an update about the crea 2024/12/16 21:52:54 [error] 114#0: *153047 [kong] event_hooks.lua:190 [string "return function (data, event, source, pid)..."]:3: Event Hook on consumer my-consumer, context: ngx.timer, client: 172.19.0.1, server: 0.0.0.0:8001 ``` -In the error logs, you will see the Event Hook, and the error log that resulted from `error("Event Hook on consumer " .. user .. "")`. \ No newline at end of file +In the error logs, you will see the Event Hook and the error log that resulted from `error("Event Hook on consumer " .. user .. "")`. \ No newline at end of file diff --git a/app/_how-tos/create-a-log-event-hook-with-kong-gateway.md b/app/_how-tos/create-a-log-event-hook-with-kong-gateway.md index 848bf775..dc91ac11 100644 --- a/app/_how-tos/create-a-log-event-hook-with-kong-gateway.md +++ b/app/_how-tos/create-a-log-event-hook-with-kong-gateway.md @@ -15,8 +15,8 @@ tags: - webhook - notifications tldr: - q: How do I create an Event Hook that logs events on the Consumer entity. - a: The `log` Event Hook handler can write log events. You can configure an Event Hook using the `log` handler to write to the log file every time a CRUD event happens on the Consumer entity by issuing a `POST` request to the `/event-hooks` endpoint. + q: How do I create an Event Hook that logs events on the Consumer entity? + a: The `log` Event Hook handler can write log events. You can configure an Event Hook using the `log` handler to write to the log file every time a CRUD event happens on the