Commit aafc5a1
Add support for synthetics global parameters (#1155)
* Add support for synthetics global parameters
This adds support for creating synthetics global parameters, which are
used to store secrets used for synthetics monitors.
This implementation is based on what we already do for synthetics
private locations. This is mostly just a simple wrapper around API
calls, except we currently requery the resource after creating it or
updating it. This is because Kibana (at least in 9.0.0) has some
unexpected responses for /api/synthetics/params:
1. The POST request to create a parameter does not include the `value`
field in the response.
2. The PUT request to update a parameter returns the new values for all
fields, except for `value`, which contains the old secret.
3. None of the responses include the `share_across_spaces` value, which
can only be inferred by checking of `namespaces` is `["*"]`.
We also use the undocumented `DELETE /api/synthetics/params` API that
the Kibana UI uses due to many quirks with the deletion APIs in various
versions of Kibana. I tested every single version of Kibana since the
parameter APIs were introduced (8.12.0) and this one is the only one
that works on all versions.
* `DELETE /api/synthetics/params/<id>` (from documentation)
- Works on >=8.17.0.
- HTTP 404 on 8.12.x through 8.16.x.
* `DELETE /api/synthetics/params/_bulk_delete` (from documentation)
- HTTP 400 on 9.0.x with error message about URL parameters and body
provided at the same time (`_bulk_delete` interpreted as parameter
ID?).
- HTTP 403 on 8.18.x with error message about missing `uptime-read` and
`uptime-write` permissions despite having the `superuser` role.
- HTTP 403 with no details on 8.17.x.
- HTTP 404 on 8.12.x through 8.16.x.
* `POST /api/synthetics/params/_bulk_delete` (from comment in documentation
example)
- Works on >=8.17.0.
- HTTP 404 on 8.12.x through 8.16.x.
* `DELETE /api/synthetics/params` (what the Kibana UI does)
- Works on >=8.12.0.
Finally, this updates the Github Actions workflow to run the tests using
HTTP basic auth instead of API keys. On all versions of Kibana, the
params endpoint fails to return the current value when using API keys,
even if permissions are not restricted for the key. Explicitly granting
the key all permissions to Kibana does not work either.
Fixes: #1152
Signed-off-by: Andrew Gunnerson <andrew.gunnerson@elastic.co>
* synthetics/parameter: Remove duplicate code when rereading in create/update
Signed-off-by: Andrew Gunnerson <andrew.gunnerson@elastic.co>
* synthetics/parameter: Switch to using OAPI client
Co-Authored-By: Toby Brain <toby.brain@elastic.co>
Signed-off-by: Andrew Gunnerson <andrew.gunnerson@elastic.co>
* Changelog
---------
Signed-off-by: Andrew Gunnerson <andrew.gunnerson@elastic.co>
Co-authored-by: Toby Brain <toby.brain@elastic.co>1 parent ec089b4 commit aafc5a1
File tree
21 files changed
+1436
-3
lines changed- .github/workflows
- docs/resources
- examples/resources/elasticstack_kibana_synthetics_parameter
- generated/kbapi
- internal
- kibana/synthetics
- parameter
- utils
- libs/go-kibana-rest/kbapi
- provider
- templates/resources
21 files changed
+1436
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
| 183 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
425 | 426 | | |
426 | 427 | | |
427 | 428 | | |
428 | | - | |
| 429 | + | |
| 430 | + | |
429 | 431 | | |
430 | 432 | | |
431 | 433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments