Skip to content

Commit 72325ab

Browse files
srenatuskagarmoesusanevBrenna Hewer-Darroch
authored
Fix API docs' paths (#3474)
* Alternate versioning strategy Signed-off-by: kagarmoe <[email protected]> * automate-gateway: don't strip /apis prefix for versioned endpoints With this commit in place, we can access IAM stuff as intended, with the proto changes in this PR: [39][default:/src:130]# curl -kv -H "api-token: $TOK" https://127.0.0.1/apis/iam/v2/teams * Trying 127.0.0.1:443... > GET /apis/iam/v2/teams HTTP/2 > Host: 127.0.0.1 > user-agent: curl/7.68.0 > accept: */* > api-token: 3C1z0rcVzsyO2zwQSwJmIkf48Kc= > * Connection state changed (MAX_CONCURRENT_STREAMS == 128)! < HTTP/2 200 < * Connection #0 to host 127.0.0.1 left intact {"teams":[{"id":"admins","name":"admins","projects":[]},{"id":"viewers","name":"Viewers","projects":[]},{"id":"editors","name":"Editors","projects":[]}]} [40][default:/src:0]# Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway/introspect: adapt tests to changed iam paths Signed-off-by: Stephan Renatus <[email protected]> * iam/v2/policies: change paths "/iam/v2" -> "/apis/iam/v2" Signed-off-by: Stephan Renatus <[email protected]> * iam/v2/policies: change paths "/iam/v2" -> "/apis/iam/v2" [regen] Signed-off-by: Stephan Renatus <[email protected]> * automate-ui: update iam paths for introspection Made using git grep --name-only '/iam/v2/' components/automate-ui |\ xargs gsed -i '/\/apis\/iam\/v2/!s#/iam/v2/#/apis/iam/v2/#g' Signed-off-by: Stephan Renatus <[email protected]> * automate-ui: fix lint issue Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway/apis/iam: fix path for POST Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway/apis/iam: fix path for POST [regen] Signed-off-by: Stephan Renatus <[email protected]> * a2-api-integration: fix introspect payload Signed-off-by: Stephan Renatus <[email protected]> * dropme: sync remaining iamv2 path changes Signed-off-by: Stephan Renatus <[email protected]> * *.proto: prepend `/api/v0` to all http options Signed-off-by: Stephan Renatus <[email protected]> * *.proto: prepend `/api/v0` to all http options [regen] Signed-off-by: Stephan Renatus <[email protected]> * *.proto: prepend `/api/v0` to all http options [sync swagger] Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway/introspect: adapt tests to changed /api/v0/ paths Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway/integration: fix test endpoint urls Signed-off-by: Stephan Renatus <[email protected]> * a2-api-integration: fix introspect payload for /api/v0 Signed-off-by: Stephan Renatus <[email protected]> * automate-load-balancer: send /api/* to a-g, unstripped, replace v1 -> v0 Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway/server: adapt muxes Signed-off-by: Stephan Renatus <[email protected]> * [unit] automate-grpc Signed-off-by: Stephan Renatus <[email protected]> * automate-ui: adapt app-authorized arguments to changed paths Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway/habitat: fix health-check hook Signed-off-by: Stephan Renatus <[email protected]> * automate-ui/layout-sidebar: adapt paths Signed-off-by: Stephan Renatus <[email protected]> * ingest-service: fix nodejs integration test paths Signed-off-by: Stephan Renatus <[email protected]> * automate-load-balancer: fix /data-collector/v0 redirect Signed-off-by: Stephan Renatus <[email protected]> * automate-load-balancer: fix /compliance/profiles/... redirect (maybe?) Signed-off-by: Stephan Renatus <[email protected]> * automate-ui/layout-model: fix example comment Signed-off-by: Stephan Renatus <[email protected]> * cert auth tests: fix path Signed-off-by: Stephan Renatus <[email protected]> * fix paths on landing components Signed-off-by: susanev <[email protected]> * fix lint Signed-off-by: susanev <[email protected]> * automate-cs-nginx: /events/data-collector -> /api/v0/events/data-collector Signed-off-by: Stephan Renatus <[email protected]> * automate-cs-oc-erchef: /events/data-collector -> /api/v0/events/data-collector Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway: fix {reports,nodes} export paths Either one of these must be right: - These hadn't been caught by tests and almost slipped through. - This fix is wrong for some reason. Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway/compliance/profiles: +2 all indices in the URL splits This is wrong. Signed-off-by: Stephan Renatus <[email protected]> * automate-cs-nginx: include /api/v0 in /compliance/profiles rewrite Usually, automate-load-balancer would prepend that to support the legacy route /compliance/profiles/*. However, automate-cs-nginx makes its calls directly to automate-gateway, so we'll have to fix the URLs here. Also applies a tiny fix to the logs for profile requests. Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway: prefix remaining routes so stuff still works These have not caused any test failures. However, since we've stopped forwarding requests to automate-gateway without a prefix, these need /api/v0 now to work *through the gateway*. If anything had been calling these directly, it'll break. Signed-off-by: Stephan Renatus <[email protected]> * automate-gateway: add a big fat warning re: custom handlers Signed-off-by: Stephan Renatus <[email protected]> * automate-chef-io/data: reset to master Let's let expeditor do its job here. Signed-off-by: Stephan Renatus <[email protected]> * .studio/license-control-service: fix telemetry_status Signed-off-by: Stephan Renatus <[email protected]> * userperm: update README.md Signed-off-by: Stephan Renatus <[email protected]> * automate-ui/settings/notifications: fix guard url Signed-off-by: Stephan Renatus <[email protected]> * fix profile detail links Signed-off-by: susanev <[email protected]> * more compliance overview link fixes Signed-off-by: susanev <[email protected]> * update compliance export paths documentation these are special mux handler APIs so we don't have nice auto-gen documentation Signed-off-by: Brenna Hewer-Darroch <[email protected]> * fix cfgmgmt.proto post-rebase new endpoint tried to sneak in without a path update :o Signed-off-by: Brenna Hewer-Darroch <[email protected]> Co-authored-by: kagarmoe <[email protected]> Co-authored-by: susanev <[email protected]> Co-authored-by: Brenna Hewer-Darroch <[email protected]>
1 parent f0f0d17 commit 72325ab

File tree

249 files changed

+3427
-3401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+3427
-3401
lines changed

Diff for: .studio/automate-gateway

+23-23
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function gateway_integration() {
2323
# the relevant services up and running:
2424
wait_or_fail_for_port_to_listen "$GATEWAY_PORT"
2525
# Make sure that the gateway is accepting requests
26-
wait_for_success gateway_get /gateway/version || return 1
26+
wait_for_success gateway_get /api/v0/gateway/version || return 1
2727
log_line "The automate-gateway version"
2828
gateway_version || return 1
2929

@@ -36,17 +36,17 @@ function gateway_integration() {
3636
send_chef_action_example || return 1
3737
done
3838
log_line "List Cfgmgmt Nodes (Empty)"
39-
gateway_get /cfgmgmt/nodes "$viewer_token" | jq || return 1
39+
gateway_get /api/v0/cfgmgmt/nodes "$viewer_token" | jq || return 1
4040
log_line "Sending a Chef Run Message"
4141
# shellcheck disable=SC2119
4242
send_chef_run_example || return 1
4343
log_line "Sending an Inspec Message through the Legacy endpoint"
4444
send_inspec_example legacy || return 1
4545
log_line "List Cfgmgmt Nodes (Displays the ingested node)"
4646
# wait for 5 secs to index the node
47-
sleep 5 && gateway_get /cfgmgmt/nodes "$viewer_token" | jq || return 1
47+
sleep 5 && gateway_get /api/v0/cfgmgmt/nodes "$viewer_token" | jq || return 1
4848
log_line "List Event Feed (Displays the ingested actions)"
49-
gateway_get '/eventfeed?collapse=true&page_size=1000' "$viewer_token" | jq || return 1
49+
gateway_get '/api/v0/eventfeed?collapse=true&page_size=1000' "$viewer_token" | jq || return 1
5050

5151
set +o pipefail # reset
5252
}
@@ -68,16 +68,16 @@ function gateway_version() {
6868
install_if_missing core/jq-static jq
6969

7070
log_line "Gateway"
71-
gateway_get /gateway/version | jq .
71+
gateway_get /api/v0/gateway/version | jq .
7272

7373
log_line "Ingest"
74-
gateway_get /ingest/version | jq .
74+
gateway_get /api/v0/ingest/version | jq .
7575

7676
log_line "ConfigMgmt"
77-
gateway_get /cfgmgmt/version | jq .
77+
gateway_get /api/v0/cfgmgmt/version | jq .
7878

7979
log_line "Compliance"
80-
gateway_get /compliance/reporting/version | jq .
80+
gateway_get /api/v0/compliance/reporting/version | jq .
8181
}
8282

8383
document "gateway_get" <<DOC
@@ -124,7 +124,7 @@ function send_chef_action_example() {
124124
if [[ "$2" != "" ]]; then
125125
event_task=$2
126126
fi
127-
local endpoint="/events/data-collector"
127+
local endpoint="/api/v0/events/data-collector"
128128
local examples_path="/src/components/ingest-service/examples"
129129
local tmp_action_json
130130
local rfc_time
@@ -288,11 +288,11 @@ function send_chef_data_raw() {
288288
local endpoint=$1
289289
local token=$2
290290
if [[ "$1" == "legacy" ]]; then
291-
endpoint="${GATEWAY_URL}/events/data-collector"
291+
endpoint="${GATEWAY_URL}/api/v0/events/data-collector"
292292
elif [[ "$1" == "lb" ]]; then
293293
endpoint="https://localhost/data-collector/v0"
294294
elif [[ "$1x" == "x" ]]; then
295-
endpoint="${GATEWAY_URL}/ingest/events/chef/run"
295+
endpoint="${GATEWAY_URL}/api/v0/ingest/events/chef/run"
296296
else
297297
endpoint="$1"
298298
fi
@@ -341,7 +341,7 @@ function delete_multiple_nodes() {
341341
install_if_missing core/curl curl
342342
install_if_missing core/jo jo
343343

344-
endpoint="/ingest/events/chef/node-multiple-deletes"
344+
endpoint="/api/v0/ingest/events/chef/node-multiple-deletes"
345345

346346
jo "node_ids=$(jo -a "$@")" \
347347
| curl -X POST -f --insecure -H "api-token: $(get_api_token)" \
@@ -354,7 +354,7 @@ DOC
354354
function send_inspec_example() {
355355
install_if_missing core/curl curl
356356

357-
local endpoint="/events/data-collector"
357+
local endpoint="/api/v0/events/data-collector"
358358
local examples_json_path=${JSON_FILE:-/src/components/compliance-service/ingest/examples/compliance-success-tiny-report.json}
359359

360360
local uuid
@@ -377,7 +377,7 @@ function send_inspec_failure_example() {
377377
install_if_missing core/curl curl
378378

379379
local examples_path="/src/components/compliance-service/ingest/examples"
380-
local endpoint="/events/data-collector"
380+
local endpoint="/api/v0/events/data-collector"
381381
local uuid
382382
uuid=$(uuidgen)
383383

@@ -402,7 +402,7 @@ function gateway_list_secrets() {
402402
install_if_missing core/curl curl
403403
install_if_missing core/jq-static jq
404404

405-
endpoint="/secrets/search"
405+
endpoint="/api/v0/secrets/search"
406406

407407
curl -X POST -f --insecure -H "api-token: $(get_admin_token)" "${GATEWAY_URL}${endpoint}" | jq
408408
}
@@ -420,7 +420,7 @@ function gateway_create_secret() {
420420
install_if_missing core/curl curl
421421
install_if_missing core/jq-static jq
422422

423-
endpoint="/secrets"
423+
endpoint="/api/v0/secrets"
424424

425425
# shellcheck disable=SC2086
426426
echo '{"name": "bob", "type": "service_now", "data": [{"key": "username", "value": "'$username'"}, {"key": "password", "value": "'$password'"}] }' |\
@@ -439,7 +439,7 @@ function gateway_delete_secret() {
439439
install_if_missing core/curl curl
440440
local id=$1
441441

442-
endpoint="/secrets/id/$id"
442+
endpoint="/api/v0/secrets/id/$id"
443443

444444
# shellcheck disable=SC2086
445445
echo '{"id": "'$id'"}' |\
@@ -459,7 +459,7 @@ function gateway_read_secret() {
459459
install_if_missing core/curl curl
460460
install_if_missing core/jq-static jq
461461

462-
endpoint="/secrets/id/$id"
462+
endpoint="/api/v0/secrets/id/$id"
463463

464464
# shellcheck disable=SC2086
465465
echo '{"id": "'$id'"}' |\
@@ -480,7 +480,7 @@ function gateway_update_secret() {
480480
local username=${2:-"default"}
481481
local password=${3:-"super_secret"}
482482

483-
endpoint="/secrets/id/$id"
483+
endpoint="/api/v0/secrets/id/$id"
484484

485485
# shellcheck disable=SC2086
486486
echo '{"id": "'$id'", "name": "bob", "type": "service_now", "data": [{"key": "username", "value": "'$username'"}, {"key": "password", "value": "'$password'"}] }' |\
@@ -500,7 +500,7 @@ function gateway_delete_notification_rule() {
500500
install_if_missing core/curl curl
501501
install_if_missing core/jq-static jq
502502

503-
endpoint="/notifications/rules/$id"
503+
endpoint="/api/v0/notifications/rules/$id"
504504

505505
# shellcheck disable=SC2086
506506
echo '{"id": "'$id'"}' |\
@@ -515,7 +515,7 @@ function gateway_create_notification_rule() {
515515
install_if_missing core/curl curl
516516
install_if_missing core/jq-static jq
517517

518-
endpoint="/notifications/rules"
518+
endpoint="/api/v0/notifications/rules"
519519

520520
# shellcheck disable=SC2154,SC2086
521521
echo '{"rule": { "name": "'$name'", "event": "CCRFailure", "SlackAlert": { "url": "http://localhost:55565"} }}' |\
@@ -535,7 +535,7 @@ function gateway_get_notification_rule() {
535535
install_if_missing core/curl curl
536536
install_if_missing core/jq-static jq
537537

538-
endpoint="/notifications/rules/$id"
538+
endpoint="/api/v0/notifications/rules/$id"
539539

540540
# shellcheck disable=SC2086
541541
echo '{"id": "'$id'"}' |\
@@ -555,7 +555,7 @@ function gateway_notification_validate_connection() {
555555

556556
install_if_missing core/curl curl
557557

558-
endpoint="/notifications/webhook"
558+
endpoint="/api/v0/notifications/webhook"
559559

560560
# There are three cases for testing a url: with a secret ID, with a username:password, no creds needed
561561
# message='{"url": "'$url'", "secret_id": {"id": "kdfkdfj"}}'

Diff for: .studio/license-control-service

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ document "telemetry_status" <<DOC
1919
Reports on the state of telemetry (enabled/disabled) along with other assorted meta-data.
2020
DOC
2121
function telemetry_status() {
22-
install_if_missing core/jq-static jq
23-
gateway_get /telemetry/config | jq
22+
gateway_get '/api/v0/telemetry/config?pretty'
2423
}
2524

2625
document "remove_dev_license" <<DOC

0 commit comments

Comments
 (0)