From d0fce013ff5b8b3a76c098e60e72a7543c580544 Mon Sep 17 00:00:00 2001 From: Vinayak <32881538+vinayak42@users.noreply.github.com> Date: Wed, 7 Nov 2018 00:19:07 +0530 Subject: [PATCH] docs(*) Add `Back to TOC` link to all files of 0.14.x (#997) * Add Back to TOC link to all files of 0.14.x * Add line spaces and remove link at EOF --- app/0.14.x/admin-api.md | 146 ++++++++++++++++++ app/0.14.x/auth.md | 8 + app/0.14.x/configuration.md | 6 + .../getting-started/adding-consumers.md | 6 + .../getting-started/configuring-a-service.md | 7 +- .../getting-started/enabling-plugins.md | 4 + app/0.14.x/getting-started/introduction.md | 2 + app/0.14.x/getting-started/quickstart.md | 10 +- app/0.14.x/health-checks-circuit-breakers.md | 8 + app/0.14.x/logging.md | 2 + app/0.14.x/network.md | 5 + .../access-the-datastore.md | 4 + app/0.14.x/plugin-development/admin-api.md | 6 + .../plugin-development/custom-entities.md | 10 ++ app/0.14.x/plugin-development/custom-logic.md | 12 ++ .../plugin-development/entities-cache.md | 12 ++ .../plugin-development/file-structure.md | 6 + .../plugin-configuration.md | 10 ++ app/0.14.x/plugin-development/tests.md | 2 + 19 files changed, 264 insertions(+), 2 deletions(-) diff --git a/app/0.14.x/admin-api.md b/app/0.14.x/admin-api.md index 3562dcd9903..cac81b43da7 100644 --- a/app/0.14.x/admin-api.md +++ b/app/0.14.x/admin-api.md @@ -165,6 +165,8 @@ Handy for complex bodies (ex: complex plugin configuration), in that case simply } ``` +[Back to TOC](#table-of-contents) + --- ## Information routes @@ -209,6 +211,8 @@ HTTP 200 OK * `available_on_server`: Names of plugins that are installed on the node. * `enabled_in_cluster`: Names of plugins that are enabled/configured. That is, the plugins configurations currently in the datastore shared by all Kong nodes. +[Back to TOC](#table-of-contents) + --- ### Retrieve node status @@ -255,6 +259,8 @@ HTTP 200 OK * `database`: Metrics about the database. * `reachable`: A boolean value reflecting the state of the database connection. Please note that this flag **does not** reflect the health of the database itself. +[Back to TOC](#table-of-contents) + --- ## Service Object @@ -277,6 +283,8 @@ of how Kong proxies traffic. {{ page.service_json }} ``` +[Back to TOC](#table-of-contents) + --- ### Add Service @@ -299,6 +307,8 @@ HTTP 201 Created {{ page.service_json }} ``` +[Back to TOC](#table-of-contents) + --- ### Retrieve Service @@ -326,8 +336,12 @@ HTTP 200 OK ```json {{ page.service_json }} ``` + +[Back to TOC](#table-of-contents) + --- + ### List Services **Endpoint** @@ -380,6 +394,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update Service @@ -412,6 +428,8 @@ HTTP 200 OK {{ page.service_json }} ``` +[Back to TOC](#table-of-contents) + --- ### Update or create Service @@ -450,6 +468,8 @@ HTTP 201 Created or HTTP 200 OK See POST and PATCH responses. +[Back to TOC](#table-of-contents) + --- ### Delete Service @@ -468,6 +488,8 @@ Attributes | Description HTTP 204 No Content ``` +[Back to TOC](#table-of-contents) + --- ## Route Object @@ -486,6 +508,8 @@ your infrastructure. {{ page.route_json }} ``` +[Back to TOC](#table-of-contents) + --- ### Add Route @@ -508,6 +532,10 @@ HTTP 201 Created {{ page.route_json }} ``` +[Back to TOC](#table-of-contents) + +--- + ### Retrieve Route **Endpoints** @@ -528,6 +556,8 @@ HTTP 200 OK {{ page.route_json }} ``` +[Back to TOC](#table-of-contents) + --- ### List Routes @@ -584,8 +614,11 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- + ### List Routes associated to a Service **Endpoints** @@ -640,6 +673,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update Route @@ -665,8 +700,12 @@ HTTP 200 OK ```json {{ page.service_json }} ``` + +[Back to TOC](#table-of-contents) + --- + ### Update or create Route **Endpoint** @@ -695,8 +734,12 @@ HTTP 201 Created or HTTP 200 OK ```json {{ page.route_json }} ``` + +[Back to TOC](#table-of-contents) + --- + ### Delete Route **Endpoint** @@ -713,6 +756,8 @@ Attributes | Description HTTP 204 No Content ``` +[Back to TOC](#table-of-contents) + --- ## Consumer Object @@ -725,6 +770,8 @@ The Consumer object represents a consumer - or a user - of a Service. You can ei } ``` +[Back to TOC](#table-of-contents) + --- ### Create Consumer @@ -751,6 +798,8 @@ HTTP 201 Created } ``` +[Back to TOC](#table-of-contents) + --- ### Retrieve Consumer @@ -777,6 +826,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### List Consumers @@ -815,6 +866,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update Consumer @@ -845,6 +898,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update or create Consumer @@ -883,6 +938,8 @@ HTTP 201 Created or HTTP 200 OK See POST and PATCH responses. +[Back to TOC](#table-of-contents) + --- ### Delete Consumer @@ -901,6 +958,8 @@ Attributes | Description HTTP 204 No Content ``` +[Back to TOC](#table-of-contents) + --- ## Plugin Object @@ -973,6 +1032,8 @@ fallback to running Plugin config A. Note that if config B is disabled (its `enabled` flag is set to `false`), config A will apply to requests that would have otherwise matched config B. +[Back to TOC](#table-of-contents) + --- ### Add Plugin @@ -1016,6 +1077,8 @@ HTTP 201 Created } ``` +[Back to TOC](#table-of-contents) + --- ### Retrieve Plugin @@ -1049,6 +1112,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### List All Plugins @@ -1107,6 +1172,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update Plugin @@ -1144,6 +1211,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update or Add Plugin @@ -1171,6 +1240,8 @@ HTTP 201 Created or HTTP 200 OK See POST and PATCH responses. +[Back to TOC](#table-of-contents) + --- ### Delete Plugin @@ -1189,6 +1260,8 @@ Attributes | Description HTTP 204 No Content ``` +[Back to TOC](#table-of-contents) + --- ### Retrieve Enabled Plugins @@ -1238,6 +1311,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Retrieve Plugin Schema @@ -1268,6 +1343,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ## Certificate Object @@ -1314,6 +1391,8 @@ HTTP 201 Created } ``` +[Back to TOC](#table-of-contents) + --- ### Retrieve Certificate @@ -1343,6 +1422,9 @@ HTTP 200 OK "created_at": 1485521710265 } ``` + +[Back to TOC](#table-of-contents) + --- ### List Certificates @@ -1382,6 +1464,9 @@ HTTP 200 OK ] } ``` + +[Back to TOC](#table-of-contents) + --- ### Update Certificate @@ -1414,6 +1499,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update or create Certificate @@ -1455,6 +1542,8 @@ HTTP 201 Created or HTTP 200 OK See POST and PATCH responses. +[Back to TOC](#table-of-contents) + --- ### Delete Certificate @@ -1471,6 +1560,8 @@ Attributes | Description HTTP 204 No Content ``` +[Back to TOC](#table-of-contents) + --- ## SNI Objects @@ -1491,6 +1582,8 @@ lookup the certificate object based on the SNI associated with the certificate. } ``` +[Back to TOC](#table-of-contents) + --- ### Add SNI @@ -1520,6 +1613,8 @@ HTTP 201 Created } ``` +[Back to TOC](#table-of-contents) + --- ### Retrieve SNI @@ -1549,6 +1644,10 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + +--- + ### List SNIs **Endpoint** @@ -1585,6 +1684,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update SNI @@ -1612,6 +1713,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update or create SNI @@ -1648,6 +1751,8 @@ HTTP 201 Created or HTTP 200 OK See POST and PATCH responses. +[Back to TOC](#table-of-contents) + --- ### Delete SNI @@ -1663,6 +1768,9 @@ Attributes | Description ``` HTTP 204 No Content ``` + +[Back to TOC](#table-of-contents) + --- ## Upstream Objects @@ -1722,6 +1830,8 @@ object, and applies to all of its targets. } ``` +[Back to TOC](#table-of-contents) + --- ### Add upstream @@ -1787,6 +1897,8 @@ HTTP 201 Created } ``` +[Back to TOC](#table-of-contents) + --- ### Retrieve upstream @@ -1852,6 +1964,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### List upstreams @@ -1978,6 +2092,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update upstream @@ -2047,6 +2163,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Update or create Upstream @@ -2074,6 +2192,8 @@ HTTP 201 Created or HTTP 200 OK See POST and PATCH responses. +[Back to TOC](#table-of-contents) + --- ### Delete upstream @@ -2092,6 +2212,8 @@ Attributes | Description HTTP 204 No Content ``` +[Back to TOC](#table-of-contents) + --- ### Show Upstream health for node @@ -2123,6 +2245,10 @@ The health for each Target is returned in its `health` field: its status is displayed as `UNHEALTHY`. The load balancer is not directing any traffic to this Target via this Upstream. +[Back to TOC](#table-of-contents) + +--- + ### Endpoint
/upstreams/{name or id}/health/
@@ -2162,6 +2288,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ## Target Object @@ -2184,6 +2312,8 @@ The current target object definition is the one with the latest `created_at`. } ``` +[Back to TOC](#table-of-contents) + --- ### Add target @@ -2216,6 +2346,8 @@ HTTP 201 Created } ``` +[Back to TOC](#table-of-contents) + --- ### List targets @@ -2275,6 +2407,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### List all targets @@ -2283,6 +2417,10 @@ Lists all targets of the upstream. Multiple target objects for the same target may be returned, showing the history of changes for a specific target. The target object with the latest `created_at` is the current definition. +[Back to TOC](#table-of-contents) + +--- + ### Endpoint
/upstreams/{name or id}/targets/all/
@@ -2319,6 +2457,8 @@ HTTP 200 OK } ``` +[Back to TOC](#table-of-contents) + --- ### Delete target @@ -2341,6 +2481,8 @@ Attributes | Description HTTP 204 No Content ``` +[Back to TOC](#table-of-contents) + --- ### Set target as healthy @@ -2372,6 +2514,8 @@ Attributes | Description HTTP 204 No Content ``` +[Back to TOC](#table-of-contents) + --- ### Set target as unhealthy @@ -2409,6 +2553,8 @@ Attributes | Description HTTP 204 No Content ``` +[Back to TOC](#table-of-contents) + [clustering]: /{{page.kong_version}}/clustering [cli]: /{{page.kong_version}}/cli [active]: /{{page.kong_version}}/health-checks-circuit-breakers/#active-health-checks diff --git a/app/0.14.x/auth.md b/app/0.14.x/auth.md index f190620128e..e2d3196a9bc 100644 --- a/app/0.14.x/auth.md +++ b/app/0.14.x/auth.md @@ -27,6 +27,8 @@ then there is no consumer to be identified, and only the credentials will be add The authentication method specific elements and examples can be found in each [plugin's documentation][plugins]. +[Back to TOC](#table-of-contents) + ## Consumers The easiest way to think about consumers is to map them one-on-one to users. Yet, to Kong this does not matter. @@ -36,6 +38,8 @@ platform, e.g. an android consumer, an iOS consumer, etc. It is an opaque concept to Kong and hence they are called "consumers" and not "users". +[Back to TOC](#table-of-contents) + ## Anonymous Access Kong has the ability to configure a given Service to allow **both** authenticated **and** anonymous access. @@ -178,6 +182,8 @@ the corresponding route: It shows the request was successful, but anonymous. +[Back to TOC](#table-of-contents) + ## Multiple Authentication Kong supports multiple authentication plugins for a given Service, allowing @@ -211,5 +217,7 @@ tokens etc. will require authentication by the other configured auth plugins. configured on the anonymous consumer. Failure to do so will allow unauthorized requests. +[Back to TOC](#table-of-contents) + [plugins]: https://konghq.com/plugins/ [key-auth]: /plugins/key-authentication diff --git a/app/0.14.x/configuration.md b/app/0.14.x/configuration.md index 25cbffda5c0..86e8b96633d 100644 --- a/app/0.14.x/configuration.md +++ b/app/0.14.x/configuration.md @@ -147,6 +147,8 @@ For a list of Nginx directives, see https://nginx.org/en/docs/dirindex.html. Note however that some directives are dependent of specific Nginx modules, some of which may not be included with the official builds of Kong. +[Back to TOC](#table-of-contents) + ### Including files via injected Nginx directives For more complex configuration scenarios, such as adding entire new @@ -196,6 +198,8 @@ path will be interpreted relative to the value of the `prefix` property of your `kong.conf` file (or the value of the `-p` flag of `kong start` if you used it to override the prefix when starting Kong). +[Back to TOC](#table-of-contents) + ## Custom Nginx templates & embedding Kong For the vast majority of use-cases, using the Nginx directive injection system @@ -216,6 +220,8 @@ Nginx configuration and launch Kong using your customized template. can reuse Kong's generated configuration and include it in your existing configuration. +[Back to TOC](#table-of-contents) + ### Custom Nginx templates Kong can be started, reloaded and restarted with an `--nginx-conf` argument, diff --git a/app/0.14.x/getting-started/adding-consumers.md b/app/0.14.x/getting-started/adding-consumers.md index 12142c1625e..a4931f54bed 100644 --- a/app/0.14.x/getting-started/adding-consumers.md +++ b/app/0.14.x/getting-started/adding-consumers.md @@ -50,6 +50,8 @@ Congratulations! You've just added your first consumer to Kong. consumers][API-consumers] to associate a consumer with your existing user database. +[Back to TOC](#table-of-contents) + ## 2. Provision key credentials for your Consumer Now, we can create a key for our recently created consumer `Jason` by @@ -61,6 +63,8 @@ $ curl -i -X POST \ --data 'key=ENTER_KEY_HERE' ``` +[Back to TOC](#table-of-contents) + ## 3. Verify that your Consumer credentials are valid We can now issue the following request to verify that the credentials of @@ -73,6 +77,8 @@ $ curl -i -X GET \ --header "apikey: ENTER_KEY_HERE" ``` +[Back to TOC](#table-of-contents) + ## Next Steps Now that we've covered the basics of adding Services, Routes, Consumers and enabling diff --git a/app/0.14.x/getting-started/configuring-a-service.md b/app/0.14.x/getting-started/configuring-a-service.md index 6c1f819c006..52d7e0c1330 100644 --- a/app/0.14.x/getting-started/configuring-a-service.md +++ b/app/0.14.x/getting-started/configuring-a-service.md @@ -62,6 +62,7 @@ Connection: keep-alive } ``` +[Back to TOC](#table-of-contents) ## 2. Add a Route for the Service @@ -102,6 +103,8 @@ Connection: keep-alive Kong is now aware of your Service and ready to proxy requests. +[Back to TOC](#table-of-contents) + ## 3. Forward your requests through Kong Issue the following cURL request to verify that Kong is properly forwarding @@ -125,6 +128,8 @@ the header defined in the above cURL request:
+[Back to TOC](#table-of-contents) + ## Next Steps Now that you've added your Service to Kong, let's learn how to enable plugins. @@ -134,4 +139,4 @@ Go to [Enabling Plugins ›][enabling-plugins] [API]: /{{page.kong_version}}/admin-api [enabling-plugins]: /{{page.kong_version}}/getting-started/enabling-plugins [proxy-port]: /{{page.kong_version}}/configuration/#nginx-section -[mockbin]: https://mockbin.com/ +[mockbin]: https://mockbin.com/ \ No newline at end of file diff --git a/app/0.14.x/getting-started/enabling-plugins.md b/app/0.14.x/getting-started/enabling-plugins.md index b15b7e86f8d..937af4c9db1 100644 --- a/app/0.14.x/getting-started/enabling-plugins.md +++ b/app/0.14.x/getting-started/enabling-plugins.md @@ -39,6 +39,8 @@ $ curl -i -X POST \ defaults to `['apikey']`. It is a list of headers and parameters names (both are supported) that are supposed to contain the apikey during a request. +[Back to TOC](#table-of-contents) + ## 2. Verify that the plugin is properly configured Issue the following cURL request to verify that the [key-auth][key-auth] @@ -62,6 +64,8 @@ HTTP/1.1 401 Unauthorized } ``` +[Back to TOC](#table-of-contents) + ## Next Steps Now that you've configured the **key-auth** plugin lets learn how to add diff --git a/app/0.14.x/getting-started/introduction.md b/app/0.14.x/getting-started/introduction.md index 4a333b9d941..82f6b1c900f 100644 --- a/app/0.14.x/getting-started/introduction.md +++ b/app/0.14.x/getting-started/introduction.md @@ -20,6 +20,8 @@ To be more precise, Kong is a Lua application running in Nginx and made possible This sets the foundations for a pluggable architecture, where Lua scripts (referred to as *”plugins”*) can be enabled and executed at runtime. Because of this, we like to think of Kong as **a paragon of microservice architecture**: at its core, it implements database abstraction, routing and plugin management. Plugins can live in separate code bases and be injected anywhere into the request lifecycle, all in a few lines of code. +[Back to TOC](#table-of-contents) + ## Next Steps Now, lets get familiar with learning how to "start" and "stop" Kong. diff --git a/app/0.14.x/getting-started/quickstart.md b/app/0.14.x/getting-started/quickstart.md index 77c2b460d7b..deab6d77341 100644 --- a/app/0.14.x/getting-started/quickstart.md +++ b/app/0.14.x/getting-started/quickstart.md @@ -35,6 +35,8 @@ $ kong start [-c /path/to/kong.conf] **Note:** the CLI accepts a configuration option (`-c /path/to/kong.conf`) allowing you to point to your own configuration. +[Back to TOC](#table-of-contents) + ## 2. Verify that Kong has started successfully If everything went well, you should see a message (`Kong started`) @@ -50,6 +52,8 @@ By default Kong listens on the following ports: - `:8001` on which the [Admin API][API] used to configure Kong listens. - `:8444` on which the Admin API listens for HTTPS traffic. +[Back to TOC](#table-of-contents) + ## 3. Stop Kong As needed you can stop the Kong process by issuing the following @@ -59,6 +63,8 @@ As needed you can stop the Kong process by issuing the following $ kong stop ``` +[Back to TOC](#table-of-contents) + ## 4. Reload Kong Issue the following command to [reload][CLI] Kong without downtime: @@ -67,6 +73,8 @@ Issue the following command to [reload][CLI] Kong without downtime: $ kong reload ``` +[Back to TOC](#table-of-contents) + ## Next Steps Now that you have Kong running you can interact with the Admin API. @@ -76,4 +84,4 @@ To begin, go to [Configuring a Service ›][configuring-a-service] [CLI]: /{{page.kong_version}}/cli [API]: /{{page.kong_version}}/admin-api [datastore-section]: /{{page.kong_version}}/configuration/#datastore-section -[configuring-a-service]: /{{page.kong_version}}/getting-started/configuring-a-service +[configuring-a-service]: /{{page.kong_version}}/getting-started/configuring-a-service \ No newline at end of file diff --git a/app/0.14.x/health-checks-circuit-breakers.md b/app/0.14.x/health-checks-circuit-breakers.md index 0ad6ec279c3..87ce499d491 100644 --- a/app/0.14.x/health-checks-circuit-breakers.md +++ b/app/0.14.x/health-checks-circuit-breakers.md @@ -122,6 +122,8 @@ Note: and does not limit the response. *Failing to do so might lead to health checks not being executed.* +[Back to TOC](#table-of-contents) + ## Types of health checks ### Active health checks @@ -191,6 +193,8 @@ passive health checks to monitor the target health based solely on its traffic, and only use active health checks while the target is unhealthy, in order to re-enable it automatically. +[Back to TOC](#table-of-contents) + ## Enabling and disabling health checks ### Enabling active health checks @@ -239,6 +243,8 @@ probes to consider a target unhealthy. active probes (as defined by `healthchecks.active.unhealthy.http_statuses`) to consider a target unhealthy. +[Back to TOC](#table-of-contents) + ### Enabling passive health checks Passive health checks do not feature a probe, as they work by interpreting @@ -259,6 +265,8 @@ traffic to consider a target unhealthy, as observed by passive health checks. proxied traffic (as defined by `healthchecks.passive.unhealthy.http_statuses`) to consider a target unhealthy, as observed by passive health checks. +[Back to TOC](#table-of-contents) + ### Disabling health checks In all counter thresholds and intervals specified in the `healthchecks` diff --git a/app/0.14.x/logging.md b/app/0.14.x/logging.md index 9c5b3fcea0d..485f1c0af56 100644 --- a/app/0.14.x/logging.md +++ b/app/0.14.x/logging.md @@ -142,3 +142,5 @@ proxy_access_log=logs/access.log show_everything if=$keeplog The final step in the process to make all the changes take effect is to restart kong. you can use the `kong restart` command to do so. Now, any requests made with an email address in it will no longer be logged. Of course, we can use this logic to remove anything we want from the logs on a conditional manner. + +[Back to TOC](#table-of-contents) \ No newline at end of file diff --git a/app/0.14.x/network.md b/app/0.14.x/network.md index b6c45c6d9a7..a700e8128b3 100644 --- a/app/0.14.x/network.md +++ b/app/0.14.x/network.md @@ -22,6 +22,8 @@ The proxy ports is where Kong receives its incoming traffic. There are two ports These are the **only ports** that should be made available to your clients. +[Back to TOC](#table-of-contents) + ### Management api This is the port where Kong exposes its management api. Hence in production this port should be firewalled to protect @@ -30,6 +32,8 @@ it from unauthorized access. * `8001` provides Kong's **Admin API** that you can use to operate Kong. See [admin_listen]. * `8444` provides the same Kong **Admin API** but using HTTPS. See [admin_listen] and the `ssl` suffix. +[Back to TOC](#table-of-contents) + ## Firewall Below are the recommended firewall settings: @@ -39,6 +43,7 @@ Below are the recommended firewall settings: * If you are binding the Admin API to a public-facing interface (via [admin_listen]), then **protect** it to only allow trusted clients to access the Admin API. See also [Securing the Admin API][secure_admin_api]. +[Back to TOC](#table-of-contents) [proxy_listen]: /{{page.kong_version}}/configuration/#proxy_listen [admin_listen]: /{{page.kong_version}}/configuration/#admin_listen diff --git a/app/0.14.x/plugin-development/access-the-datastore.md b/app/0.14.x/plugin-development/access-the-datastore.md index cb5020d55ef..502d44d27ee 100644 --- a/app/0.14.x/plugin-development/access-the-datastore.md +++ b/app/0.14.x/plugin-development/access-the-datastore.md @@ -53,6 +53,8 @@ local plugins_dao = kong.dao.plugins The `kong` global exposes the [Plugin Development Kit], and its `kong.dao` and `kong.db` properties are instances of the DAO and DB singletons. +[Back to TOC](#table-of-contents) + --- ## The DAO Lua API @@ -80,6 +82,8 @@ local inserted_plugin, err = kong.dao.plugins:insert({ For a real-life example of the DAO being used in a plugin, see the [Key-Auth plugin source code](https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/handler.lua). +[Back to TOC](#table-of-contents) + --- Next: [Custom Entities ›]({{page.book.next}}) diff --git a/app/0.14.x/plugin-development/admin-api.md b/app/0.14.x/plugin-development/admin-api.md index 8657ce2ee72..0101c1d5bf5 100644 --- a/app/0.14.x/plugin-development/admin-api.md +++ b/app/0.14.x/plugin-development/admin-api.md @@ -26,6 +26,8 @@ level of abstraction makes it easy for you to add endpoints. kong.plugins..api ``` +[Back to TOC](#table-of-contents) + ## Adding endpoints to the Admin API Kong will detect and load your endpoints if they are defined in a module named: @@ -74,6 +76,8 @@ other keys: errors](http://leafo.net/lapis/reference/exception_handling.html#capturing-recoverable-errors) documentation. +[Back to TOC](#table-of-contents) + --- ## Helpers @@ -129,6 +133,8 @@ return { See the [complete Admin API of the Key-Auth plugin](https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/api.lua) for an extended version of this example. +[Back to TOC](#table-of-contents) + --- Next: [Write tests for your plugin]({{page.book.next}}) diff --git a/app/0.14.x/plugin-development/custom-entities.md b/app/0.14.x/plugin-development/custom-entities.md index b1c73269e83..dbd96e4e241 100644 --- a/app/0.14.x/plugin-development/custom-entities.md +++ b/app/0.14.x/plugin-development/custom-entities.md @@ -22,6 +22,10 @@ kong.plugins..schema.migrations kong.plugins..daos ``` +[Back to TOC](#table-of-contents) + +--- + ## Create a migration file Once you have defined your model, you must create your migration modules which @@ -127,6 +131,8 @@ the `migrations` file. To see a real-life example, give a look at the [Key-Auth plugin migrations](https://github.com/Kong/kong/tree/master/kong/plugins/key-auth/migrations) +[Back to TOC](#table-of-contents) + --- ## Retrieve your custom DAO from the DAO Factory @@ -200,6 +206,8 @@ table of `daos.lua`. You can see an example of this in the [Key-Auth `daos.lua` file](https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/daos.lua). +[Back to TOC](#table-of-contents) + --- ## Caching custom entities @@ -217,6 +225,8 @@ The next chapter will focus on caching custom entities, and invalidating them when they change in the datastore: [Caching custom entities]({{page.book.next}}). +[Back to TOC](#table-of-contents) + --- Next: [Caching custom entities ›]({{page.book.next}}) diff --git a/app/0.14.x/plugin-development/custom-logic.md b/app/0.14.x/plugin-development/custom-logic.md index abceaf2d9cf..038513b2d21 100644 --- a/app/0.14.x/plugin-development/custom-logic.md +++ b/app/0.14.x/plugin-development/custom-logic.md @@ -23,6 +23,10 @@ namespaced under: `kong.plugins..handler` kong.plugins..handler ``` +[Back to TOC](#table-of-contents) + +--- + ## Available request contexts The plugins interface allows you to override any of the following methods in @@ -53,6 +57,8 @@ chapter]({{page.book.next}}). [body_filter_by_lua]: https://github.com/openresty/lua-nginx-module#body_filter_by_lua [log_by_lua]: https://github.com/openresty/lua-nginx-module#log_by_lua +[Back to TOC](#table-of-contents) + --- ## handler.lua specifications @@ -183,6 +189,8 @@ return CustomHandler See [the source code of the Key-Auth plugin](https://github.com/Kong/kong/blob/master/kong/plugins/key-auth/handler.lua) for an example of a real-life handler code. +[Back to TOC](#table-of-contents) + --- ## Plugin Development Kit @@ -199,6 +207,8 @@ When you are trying to implement some logic that needs to interact with Kong some error or debug information...), you should consult the [Plugin Development Kit Reference][pdk]. +[Back to TOC](#table-of-contents) + --- ## Plugins execution order @@ -255,6 +265,8 @@ request-termination | 2 correlation-id | 1 post-function | -1000 +[Back to TOC](#table-of-contents) + --- Next: [Store configuration ›]({{page.book.next}}) diff --git a/app/0.14.x/plugin-development/entities-cache.md b/app/0.14.x/plugin-development/entities-cache.md index f5d2e2752a4..250c07a842c 100644 --- a/app/0.14.x/plugin-development/entities-cache.md +++ b/app/0.14.x/plugin-development/entities-cache.md @@ -37,6 +37,10 @@ under heavy load). kong.plugins..daos ``` +[Back to TOC](#table-of-contents) + +--- + ## Caching custom entities Once you have defined your custom entities, you can cache them in-memory in @@ -138,6 +142,8 @@ inconsistency, we need to evict the cached entity from the in-memory store and force Kong to request it again from the datastore. We refer to this process as cache invalidation. +[Back to TOC](#table-of-contents) + --- ## Cache invalidation for your entities @@ -275,6 +281,10 @@ kong.worker_events.register(function(data) end, "crud", "consumers") ``` +[Back to TOC](#table-of-contents) + +--- + ## Extending the Admin API As you are probably aware, the [Admin API] is where Kong users communicate with @@ -284,6 +294,8 @@ example, creating and deleting API keys). The way you would do this is by extending the Admin API, which we will detail in the next chapter: [Extending the Admin API]({{page.book.next}}). +[Back to TOC](#table-of-contents) + --- Next: [Extending the Admin API ›]({{page.book.next}}) diff --git a/app/0.14.x/plugin-development/file-structure.md b/app/0.14.x/plugin-development/file-structure.md index 8d3d86784b1..73f0191fbd2 100644 --- a/app/0.14.x/plugin-development/file-structure.md +++ b/app/0.14.x/plugin-development/file-structure.md @@ -57,6 +57,8 @@ optional, and will allow the plugin to implement some extra-functionalities Now let's describe exactly what are the modules you can implement and what their purpose is. +[Back to TOC](#table-of-contents) + --- ## Basic plugin modules @@ -76,6 +78,8 @@ simple-plugin by the user. This module holds the *schema* of that configuration and defines rules on it, so that the user can only enter valid configuration values. +[Back to TOC](#table-of-contents) + --- ## Advanced plugin modules @@ -111,6 +115,8 @@ master each one of them. The [Key-Auth plugin] is an example of plugin with this file structure. See [its source code] for more details. +[Back to TOC](#table-of-contents) + --- Next: [Write custom logic ›]({{page.book.next}}) diff --git a/app/0.14.x/plugin-development/plugin-configuration.md b/app/0.14.x/plugin-development/plugin-configuration.md index bde44d94211..21a17c6c490 100644 --- a/app/0.14.x/plugin-development/plugin-configuration.md +++ b/app/0.14.x/plugin-development/plugin-configuration.md @@ -41,6 +41,10 @@ the appropriate error messages. kong.plugins..schema ``` +[Back to TOC](#table-of-contents) + +--- + ## schema.lua specifications This module is to return a Lua table with properties that will define how your plugins can later be configured by users. Available properties are: @@ -77,6 +81,10 @@ return { } ``` +[Back to TOC](#table-of-contents) + +--- + ## Describing your configuration schema The `fields` property of your `schema.lua` file described the schema of your @@ -240,6 +248,8 @@ return CustomHandler You can also see a real-world example of schema in [the Key-Auth plugin source code]. +[Back to TOC](#table-of-contents) + --- Next: [Store custom entities ›]({{page.book.next}}) diff --git a/app/0.14.x/plugin-development/tests.md b/app/0.14.x/plugin-development/tests.md index 398b641d615..b0a5de9d275 100644 --- a/app/0.14.x/plugin-development/tests.md +++ b/app/0.14.x/plugin-development/tests.md @@ -103,6 +103,8 @@ and Admin API on port 9001. If you want to see a real-world example, give a look at the [Key-Auth plugin specs](https://github.com/Kong/kong/tree/master/spec/03-plugins/10-key-auth) +[Back to TOC](#table-of-contents) + --- Next: [Distribute your plugin ›]({{page.book.next}})