diff --git a/api-doc/.gitignore b/api-doc/.gitignore new file mode 100644 index 00000000000..c3dca1b96fc --- /dev/null +++ b/api-doc/.gitignore @@ -0,0 +1,2 @@ +/build +/target diff --git a/api-doc/Makefile b/api-doc/Makefile new file mode 100644 index 00000000000..ccdb221f67e --- /dev/null +++ b/api-doc/Makefile @@ -0,0 +1,14 @@ +API:=webapp relay + +all: $(API) + +$(API): clean + # Prepare all sources in build/ dir + mkdir -p build target/$@ + cp -r ../$@/sources/api-doc build/$@ + mkdir -p build/$@/assets + cp -r assets/. build/$@/assets + ./build.py $@ build target + +clean: + rm -rf build target diff --git a/api-doc/README.adoc b/api-doc/README.adoc new file mode 100644 index 00000000000..58afda72759 --- /dev/null +++ b/api-doc/README.adoc @@ -0,0 +1,33 @@ += API documentation + +== Usage (openapi/redoc) + +Building the doc requires installing: + +``` +npm install -g redoc-cli @redocly/openapi-cli +``` + +* `openapi-cli` builds a single openapi file from the sources +* `redoc-cli` produces the HTML output from the openapi file + +Then run: + +``` +make +``` + +And the resulting files will be in `target/`. + +== Sources + +The sources are in `{component}/sources/api-doc`. The main file is `openapi.src.yml`. +It is then read and modified by the build process to add the documentation +from the markdown file in `info/description`. + +Each Rudder branch contains the sources of the docs for the APIs introduced in +its version. + +If a Rudder branch introduced several version, the latest one should be named +`openapi.src.yml`, and previous ones `openapi-VERSION.src.yml` +(to allow easier upmerge of changes). \ No newline at end of file diff --git a/api-doc/assets/rudder.png b/api-doc/assets/rudder.png new file mode 100644 index 00000000000..518cba945af Binary files /dev/null and b/api-doc/assets/rudder.png differ diff --git a/api-doc/build.py b/api-doc/build.py new file mode 100755 index 00000000000..76f581035b9 --- /dev/null +++ b/api-doc/build.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 + +# loads a openapi.yml template and adds missing information to produce a valid +# openapi.yml file. +# Then build html docs + +import sys +import yaml +import os +import subprocess +import glob +import shutil + +# API to build +api = sys.argv[1] +source_dir = sys.argv[2] +target_dir = sys.argv[3] + +# source dir +source = "%s/%s" % (source_dir, api) + +# Read openapi(-ver).src.yml and read versions inside. +templates = glob.glob(source+"/openapi*.src.yml") + +for template in templates: + with open(template, 'r') as content_file: + main = yaml.load(content_file.read(), Loader=yaml.FullLoader) + version = main["info"]["version"] + intro_file = main["info"]["description"] + + print("Building version %s from %s" % (version, template)) + + # Fetch introduction content + with open(source+'/introduction.md', 'r') as content_file: + intro = content_file.read() + + # Add external content + main["info"]["description"] = intro + + # Dump target in target .yml file + src_openapi_file = template.replace(".src", "") + with open(src_openapi_file, 'w') as file: + documents = yaml.dump(main, file) + + target = "%s/%s/%s" % (target_dir, api, version) + + # Build final openapi.yml + openapi_file = "%s/openapi.yml" % target + subprocess.call(["openapi", "bundle", src_openapi_file, + "--output", openapi_file]) + + # Build doc from yaml file (with pre-rendered html) + html_file = "%s/openapi.html" % target + subprocess.call(["redoc-cli", "bundle", openapi_file, + "--output", html_file, + # Don't help google track our users + "--disableGoogleFont", + # The famous Rudder orange + "--options.theme.colors.primary.main='#f08004'", + # Expand success examples by default + "--options.expandResponses='200,'", + # More readable in central column + "--options.pathInMiddlePanel=1", + # Hostname is meaningless as it won't match rudder server + "--options.hideHostname=1" + ]) + + shutil.copytree("%s/assets" % source, "%s/assets" % target) diff --git a/webapp/sources/api-doc/assets/APISettings.png b/webapp/sources/api-doc/assets/APISettings.png new file mode 100644 index 00000000000..a9c4647c705 Binary files /dev/null and b/webapp/sources/api-doc/assets/APISettings.png differ diff --git a/webapp/sources/api-doc/code_samples/curl/change-requests/accept.sh b/webapp/sources/api-doc/code_samples/curl/change-requests/accept.sh new file mode 100644 index 00000000000..6b276db472d --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/change-requests/accept.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/changeRequests --data "status=open" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/change-requests/all.sh b/webapp/sources/api-doc/code_samples/curl/change-requests/all.sh new file mode 100644 index 00000000000..6b276db472d --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/change-requests/all.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/changeRequests --data "status=open" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/change-requests/refuse.sh b/webapp/sources/api-doc/code_samples/curl/change-requests/refuse.sh new file mode 100644 index 00000000000..5becf55003e --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/change-requests/refuse.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request DELETE https://rudder.example.com/rudder/api/latest/changeRequests/43 \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/change-requests/update.sh b/webapp/sources/api-doc/code_samples/curl/change-requests/update.sh new file mode 100644 index 00000000000..ab346a305c5 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/change-requests/update.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/changeRequests/42 --data "name=new Name of change request" -d "description=add a new description" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/compliance/global.sh b/webapp/sources/api-doc/code_samples/curl/compliance/global.sh new file mode 100644 index 00000000000..3744a982eb9 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/compliance/global.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/compliance?prettify=true' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/compliance/node.sh b/webapp/sources/api-doc/code_samples/curl/compliance/node.sh new file mode 100644 index 00000000000..6390601d47a --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/compliance/node.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/compliance/nodes/root?level=1' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/compliance/nodes.sh b/webapp/sources/api-doc/code_samples/curl/compliance/nodes.sh new file mode 100644 index 00000000000..b23dd6c0f25 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/compliance/nodes.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/compliance/nodes?level=2' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/compliance/rule.sh b/webapp/sources/api-doc/code_samples/curl/compliance/rule.sh new file mode 100644 index 00000000000..168d350477c --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/compliance/rule.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/compliance/rules/32377fd7-02fd-43d0-aab7-28460a91347b?level=2' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/compliance/rules.sh b/webapp/sources/api-doc/code_samples/curl/compliance/rules.sh new file mode 100644 index 00000000000..b070b734fba --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/compliance/rules.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/compliance/rules?level=2' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/datasources/all.sh b/webapp/sources/api-doc/code_samples/curl/datasources/all.sh new file mode 100644 index 00000000000..e14586d99a8 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/datasources/all.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/datasources' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/datasources/create.sh b/webapp/sources/api-doc/code_samples/curl/datasources/create.sh new file mode 100644 index 00000000000..42d1a3721d7 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/datasources/create.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request PUT https://rudder.example.com/rudder/api/latest/datasources --header "Content-type: application/json" --data @datasources.json \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/datasources/delete.sh b/webapp/sources/api-doc/code_samples/curl/datasources/delete.sh new file mode 100644 index 00000000000..0f3fc3adc7a --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/datasources/delete.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request DELETE https://rudder.example.com/rudder/api/latest/datasources/my-data-source \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/datasources/get.sh b/webapp/sources/api-doc/code_samples/curl/datasources/get.sh new file mode 100644 index 00000000000..97b8bbd976f --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/datasources/get.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/datasources/my-data-source \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/datasources/reload-id.sh b/webapp/sources/api-doc/code_samples/curl/datasources/reload-id.sh new file mode 100644 index 00000000000..29214234598 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/datasources/reload-id.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/datasources/reload/datasourceId \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/datasources/reload-node-id.sh b/webapp/sources/api-doc/code_samples/curl/datasources/reload-node-id.sh new file mode 100644 index 00000000000..ff548022eaf --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/datasources/reload-node-id.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/nodes/nodeId/fetchData/datasourceId \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/datasources/reload-node.sh b/webapp/sources/api-doc/code_samples/curl/datasources/reload-node.sh new file mode 100644 index 00000000000..653be067df4 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/datasources/reload-node.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/nodes/17dadf50-6056-4c8b-a935-6b97d14b89a7/fetchData \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/datasources/reload.sh b/webapp/sources/api-doc/code_samples/curl/datasources/reload.sh new file mode 100644 index 00000000000..136b757b1a6 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/datasources/reload.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/datasources/reload \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/datasources/update.sh b/webapp/sources/api-doc/code_samples/curl/datasources/update.sh new file mode 100644 index 00000000000..ee023b4cc4f --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/datasources/update.sh @@ -0,0 +1,7 @@ +cat disable-datasource-1.json.json +{ + "description": "This data source is temporarly no more used and so disabled", + "enabled": false +} + +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/datasources/my-data-source --header "Content-type: application/json" --data @disable-datasource-1.json.json \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/directives/all.sh b/webapp/sources/api-doc/code_samples/curl/directives/all.sh new file mode 100644 index 00000000000..4f50b88f66d --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/directives/all.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/directives \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/directives/check.sh b/webapp/sources/api-doc/code_samples/curl/directives/check.sh new file mode 100644 index 00000000000..9aaf4150e72 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/directives/check.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/directives/17dadf50-6056-4c8b-a935-6b97d14b89a7/check --data "displayName=Name of new directive" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/directives/create.sh b/webapp/sources/api-doc/code_samples/curl/directives/create.sh new file mode 100644 index 00000000000..7cbeec808ef --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/directives/create.sh @@ -0,0 +1,47 @@ +directives.json: + +{ + "id": "cf2a6c72-18ae-4f82-a12c-0b887792db41", + "displayName": "Example Directive", + "shortDescription": "This in an example Directive to use in Rudder api documentation", + "longDescription": "", + "techniqueName": "genericVariableDefinition", + "techniqueVersion": "2.0", + "tags": { + "env" : "production", + "country" : "FR" + }, + "parameters": { + "section": { + "name": "sections", + "sections": [ + { + "section": { + "name": "Variable definition", + "vars": [ + { + "var": { + "name": "GENERIC_VARIABLE_CONTENT", + "value": "new variable content" + } + }, + { + "var": { + "name": "GENERIC_VARIABLE_NAME", + "value": "new_variable" + } + } + ] + } + } + ] + } + }, + "priority": 3, + "enabled": true, + "system": false, + "policyMode": "default" +} + +curl --header "X-API-Token: yourToken" --request PUT https://rudder.example.com/rudder/api/latest/directives --header "Content-type: application/json" --data @directive.json + diff --git a/webapp/sources/api-doc/code_samples/curl/directives/delete.sh b/webapp/sources/api-doc/code_samples/curl/directives/delete.sh new file mode 100644 index 00000000000..073ed41378f --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/directives/delete.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request DELETE https://rudder.example.com/rudder/api/latest/directives/17dadf50-6056-4c8b-a935-6b97d14b89a7 \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/directives/get.sh b/webapp/sources/api-doc/code_samples/curl/directives/get.sh new file mode 100644 index 00000000000..3f6e3472c87 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/directives/get.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/directives/17dadf50-6056-4c8b-a935-6b97d14b89a7 \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/directives/update.sh b/webapp/sources/api-doc/code_samples/curl/directives/update.sh new file mode 100644 index 00000000000..23db445c715 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/directives/update.sh @@ -0,0 +1,33 @@ +directive.json: +{ + "longDescription": "Add a loooooooooooong description", + "parameters": { + "section": { + "name": "sections", + "sections": [ + { + "section": { + "name": "Variable definition", + "vars": [ + { + "var": { + "name": "GENERIC_VARIABLE_CONTENT", + "value": "Change Variable Content" + } + }, + { + "var": { + "name": "GENERIC_VARIABLE_NAME", + "value": "new_variable" + } + } + ] + } + } + ] + } + }, + "priority": 5 +} + +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/directives/cf2a6c72-18ae-4f82-a12c-0b887792db41 --header "Content-type: application/json" --data @directive.json \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/groups/all.sh b/webapp/sources/api-doc/code_samples/curl/groups/all.sh new file mode 100644 index 00000000000..c970cbd95a5 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/all.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/groups \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/groups/category-id-delete.sh b/webapp/sources/api-doc/code_samples/curl/groups/category-id-delete.sh new file mode 100644 index 00000000000..1e6aa43d1d9 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/category-id-delete.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request DELETE 'https://rudder.example.com/rudder/api/latest/groups/categories/4306143d-eabf-4478-b7b1-1616f4aa02b5' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/groups/category-id-new.sh b/webapp/sources/api-doc/code_samples/curl/groups/category-id-new.sh new file mode 100644 index 00000000000..b2db546783f --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/category-id-new.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request PUT 'https://rudder.example.com/rudder/api/latest/groups/categories' --data "name=new category name" -d "parent=4306143d-eabf-4478-b7b1-1616f4aa02b5" -d "description=A new category created via API' diff --git a/webapp/sources/api-doc/code_samples/curl/groups/category-id-update.sh b/webapp/sources/api-doc/code_samples/curl/groups/category-id-update.sh new file mode 100644 index 00000000000..ddc2d3496fb --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/category-id-update.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/groups/categories/4306143d-eabf-4478-b7b1-1616f4aa02b5' --data "name=new category name" diff --git a/webapp/sources/api-doc/code_samples/curl/groups/category-id.sh b/webapp/sources/api-doc/code_samples/curl/groups/category-id.sh new file mode 100644 index 00000000000..7ffdcedaafa --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/category-id.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/groups/categories/4306143d-eabf-4478-b7b1-1616f4aa02b5' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/groups/create.sh b/webapp/sources/api-doc/code_samples/curl/groups/create.sh new file mode 100644 index 00000000000..01097d669ca --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/create.sh @@ -0,0 +1,18 @@ +groups.json: +{ + "category": "c355f46e-11b0-4c7a-aedd-6a5f3b0303b6", + "displayName": "Example group", + "description": "This is an example Group to use in Rudder api documentation", + "query": + {"select":"node","composition":"Or","where": + [ + {"objectType":"node","attribute":"nodeId","comparator":"eq","value":"1ae6ccfe-00ba-44c0-b1aa-362d2f386032"}, + {"objectType":"node","attribute":"nodeId","comparator":"eq","value":"e4a80fd8-373e-45fc-ad94-2ae618be32e3"} + ] + }, + "dynamic": true, + "enabled": true +} + +curl --header "X-API-Token: yourToken" --request PUT https://rudder.example.com/rudder/api/latest/groups --header "Content-Type: application/json" --data @group.json + diff --git a/webapp/sources/api-doc/code_samples/curl/groups/delete.sh b/webapp/sources/api-doc/code_samples/curl/groups/delete.sh new file mode 100644 index 00000000000..c9fe3f17399 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/delete.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request DELETE 'https://rudder.example.com/rudder/api/latest/groups/17dadf50-6056-4c8b-a935-6b97d14b89a7' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/groups/id.sh b/webapp/sources/api-doc/code_samples/curl/groups/id.sh new file mode 100644 index 00000000000..5b14d4f2e6b --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/id.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/groups/17dadf50-6056-4c8b-a935-6b97d14b89a7' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/groups/reload.sh b/webapp/sources/api-doc/code_samples/curl/groups/reload.sh new file mode 100644 index 00000000000..ce6a9d05e36 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/reload.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/groups/17dadf50-6056-4c8b-a935-6b97d14b89a7/reload' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/groups/tree.sh b/webapp/sources/api-doc/code_samples/curl/groups/tree.sh new file mode 100644 index 00000000000..b034d7945cf --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/tree.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/groups/tree diff --git a/webapp/sources/api-doc/code_samples/curl/groups/update.sh b/webapp/sources/api-doc/code_samples/curl/groups/update.sh new file mode 100644 index 00000000000..31f5d62bfd2 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/groups/update.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/groups/17dadf50-6056-4c8b-a935-6b97d14b89a7' --data "displayName=New name of group" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/inventories/info.sh b/webapp/sources/api-doc/code_samples/curl/inventories/info.sh new file mode 100644 index 00000000000..372fe8cbdd4 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/inventories/info.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/ \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/inventories/restart.sh b/webapp/sources/api-doc/code_samples/curl/inventories/restart.sh new file mode 100644 index 00000000000..97cb5673200 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/inventories/restart.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/inventories/watcher/restart' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/inventories/start.sh b/webapp/sources/api-doc/code_samples/curl/inventories/start.sh new file mode 100644 index 00000000000..e075d9f1531 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/inventories/start.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/inventories/watcher/start' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/inventories/stop.sh b/webapp/sources/api-doc/code_samples/curl/inventories/stop.sh new file mode 100644 index 00000000000..62c7b7199fc --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/inventories/stop.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/inventories/watcher/stop' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/inventories/upload.sh b/webapp/sources/api-doc/code_samples/curl/inventories/upload.sh new file mode 100644 index 00000000000..f227d0a646b --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/inventories/upload.sh @@ -0,0 +1 @@ +curl --request POST --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/inventories/upload -F "file=@inventory-file" -F "signature=@signature-file" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/nodes/all.sh b/webapp/sources/api-doc/code_samples/curl/nodes/all.sh new file mode 100644 index 00000000000..78ceae8906a --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/nodes/all.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" 'https://rudder.example.com/rudder/api/latest/nodes?where=\[\{"objectType":"node","attribute":"OS","comparator":"eq","value":"Linux"\},\{"objectType":"node","attribute":"nodeHostname","comparator":"regex","value":"node1.*"\}\]' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/nodes/apply-all.sh b/webapp/sources/api-doc/code_samples/curl/nodes/apply-all.sh new file mode 100644 index 00000000000..4e855574826 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/nodes/apply-all.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST --header "Content-Type: application/json" https://rudder.example.com/rudder/api/latest/nodes/applyPolicy \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/nodes/apply-id.sh b/webapp/sources/api-doc/code_samples/curl/nodes/apply-id.sh new file mode 100644 index 00000000000..68ce6e3bca0 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/nodes/apply-id.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST --header "Content-Type: application/json" https://rudder.example.com/rudder/api/latest/nodes/root/applyPolicy \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/nodes/delete.sh b/webapp/sources/api-doc/code_samples/curl/nodes/delete.sh new file mode 100644 index 00000000000..e0a885d4d48 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/nodes/delete.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request DELETE https://rudder.example.com/rudder/api/latest/nodes/17dadf50-6056-4c8b-a935-6b97d14b89a7 diff --git a/webapp/sources/api-doc/code_samples/curl/nodes/id-update.sh b/webapp/sources/api-doc/code_samples/curl/nodes/id-update.sh new file mode 100644 index 00000000000..3c9212e52d0 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/nodes/id-update.sh @@ -0,0 +1,16 @@ +# Given the "data.json" JSON file with content: +{ "properties": [ + { "name": "env_type" , "value": "production" }, + { "name": "shell" , "value": "/bin/sh" }, + { "name": "utf-8 poetry", "value": "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ" } +] +, "policyMode" : "audit" +} +# Setting properties from "data.json" and policy mode to audit: +curl --header "X-API-Token: yourToken" --request POST --header "Content-Type: application/json" https://rudder.example.com/rudder/api/latest/nodes/17dadf50-6056-4c8b-a935-6b97d14b89a7 --data @properties.json + +# Removing the key "utf-8 poetry" from the command line and updating the "env_type" one +curl --header "X-API-Token: yourToken" --request POST --header "Content-Type: application/json" https://rudder.example.com/rudder/api/latest/nodes/17dadf50-6056-4c8b-a935-6b97d14b89a7 --data '{ "properties": [{ "name":"utf-8 poetry", "value":""}, {"name":"env_type", "value":"deprovisioned"}] }' + +# Removing the key "env_type" and changing "shell" and use default policy mode +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/nodes/17dadf50-6056-4c8b-a935-6b97d14b89a7 --data "properties=shell=/bin/false" -d "properties=env_type=" -d "policyMode=default" diff --git a/webapp/sources/api-doc/code_samples/curl/nodes/id.sh b/webapp/sources/api-doc/code_samples/curl/nodes/id.sh new file mode 100644 index 00000000000..43613857e13 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/nodes/id.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/nodes/17dadf50-6056-4c8b-a935-6b97d14b89a7\?include=full \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/nodes/pending-id.sh b/webapp/sources/api-doc/code_samples/curl/nodes/pending-id.sh new file mode 100644 index 00000000000..822810b5ea6 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/nodes/pending-id.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/nodes/pending/17dadf50-6056-4c8b-a935-6b97d14b89a7 --data "status=accepted" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/parameters/create-parameter.sh b/webapp/sources/api-doc/code_samples/curl/parameters/create-parameter.sh new file mode 100644 index 00000000000..4dfa6d1c828 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/parameters/create-parameter.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --header "Content-Type: application/json" --request PUT https://rudder.example.com/rudder/api/latest/parameters --data @JSON-file-name \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/parameters/delete-parameter.sh b/webapp/sources/api-doc/code_samples/curl/parameters/delete-parameter.sh new file mode 100644 index 00000000000..af074e07260 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/parameters/delete-parameter.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request DELETE https://rudder.example.com/rudder/api/latest/parameters/ParameterId \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/parameters/get-parameter.sh b/webapp/sources/api-doc/code_samples/curl/parameters/get-parameter.sh new file mode 100644 index 00000000000..37d6cceddb0 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/parameters/get-parameter.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/parameters/ParameterId \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/parameters/list-parameters.sh b/webapp/sources/api-doc/code_samples/curl/parameters/list-parameters.sh new file mode 100644 index 00000000000..ad701850e47 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/parameters/list-parameters.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/parameters \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/parameters/modify-parameter.sh b/webapp/sources/api-doc/code_samples/curl/parameters/modify-parameter.sh new file mode 100644 index 00000000000..248dbc32940 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/parameters/modify-parameter.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/parameters/ParameterId --data "value=### Edited by Rudder ###" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/all.sh b/webapp/sources/api-doc/code_samples/curl/rules/all.sh new file mode 100644 index 00000000000..1fe022aa7ac --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/all.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/rules' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/category-id-delete.sh b/webapp/sources/api-doc/code_samples/curl/rules/category-id-delete.sh new file mode 100644 index 00000000000..7f2985f274d --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/category-id-delete.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request DELETE 'https://rudder.example.com/rudder/api/latest/rules/categories/4306143d-eabf-4478-b7b1-1616f4aa02b5?prettify=true' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/category-id-new.sh b/webapp/sources/api-doc/code_samples/curl/rules/category-id-new.sh new file mode 100644 index 00000000000..2cbb6c906c4 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/category-id-new.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/rules/categories' --data "name=new category" -d "parent=4306143d-eabf-4478-b7b1-1616f4aa02b5" -d "description=A new category created via API' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/category-id-update.sh b/webapp/sources/api-doc/code_samples/curl/rules/category-id-update.sh new file mode 100644 index 00000000000..39f99b720c5 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/category-id-update.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/rules/categories/4306143d-eabf-4478-b7b1-1616f4aa02b5?prettify=true' --data "name=new category name" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/category-id.sh b/webapp/sources/api-doc/code_samples/curl/rules/category-id.sh new file mode 100644 index 00000000000..18273e90fb5 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/category-id.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/rules/categories/4306143d-eabf-4478-b7b1-1616f4aa02b5?prettify=true' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/create.sh b/webapp/sources/api-doc/code_samples/curl/rules/create.sh new file mode 100644 index 00000000000..8f66da1998f --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/create.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request PUT 'https://rudder.example.com/rudder/api/latest/rules' --data "displayName=Name of New Rule" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/delete.sh b/webapp/sources/api-doc/code_samples/curl/rules/delete.sh new file mode 100644 index 00000000000..aa81478f42b --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/delete.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request DELETE 'https://rudder.example.com/rudder/api/latest/rules/176ad06b-ed02-4da3-8053-16225d217741' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/get.sh b/webapp/sources/api-doc/code_samples/curl/rules/get.sh new file mode 100644 index 00000000000..9ef1225bf1b --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/get.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/rules/06ba8940-ed6c-4102-ba46-93d640a64c36' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/tree.sh b/webapp/sources/api-doc/code_samples/curl/rules/tree.sh new file mode 100644 index 00000000000..f8e63bfb3fb --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/tree.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET 'https://rudder.example.com/rudder/api/latest/rules/tree?prettify=true' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/rules/update.sh b/webapp/sources/api-doc/code_samples/curl/rules/update.sh new file mode 100644 index 00000000000..119307d9182 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/rules/update.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/rules/17dadf50-6056-4c8b-a935-6b97d14b89a7' --data "displayName=Name of rule" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/settings/get-setting.sh b/webapp/sources/api-doc/code_samples/curl/settings/get-setting.sh new file mode 100644 index 00000000000..d19b6b1739c --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/settings/get-setting.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/settings/run_frequency \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/settings/list.sh b/webapp/sources/api-doc/code_samples/curl/settings/list.sh new file mode 100644 index 00000000000..760ece0b648 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/settings/list.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/settings \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/settings/set-setting.sh b/webapp/sources/api-doc/code_samples/curl/settings/set-setting.sh new file mode 100644 index 00000000000..073a75c1510 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/settings/set-setting.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/settings/global_policy_mode_overridable --data "value=true" \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/system/create-archive.sh b/webapp/sources/api-doc/code_samples/curl/system/create-archive.sh new file mode 100644 index 00000000000..2989ea92a38 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/system/create-archive.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/system/archives/full \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/system/info.sh b/webapp/sources/api-doc/code_samples/curl/system/info.sh new file mode 100644 index 00000000000..21945c36d00 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/system/info.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/system/info \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/system/list-archives.sh b/webapp/sources/api-doc/code_samples/curl/system/list-archives.sh new file mode 100644 index 00000000000..6e4758efde2 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/system/list-archives.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/system/archives/full \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/system/regenerate-policies.sh b/webapp/sources/api-doc/code_samples/curl/system/regenerate-policies.sh new file mode 100644 index 00000000000..ed94dc28c38 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/system/regenerate-policies.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/system/regenerate/policies' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/system/reload-groups.sh b/webapp/sources/api-doc/code_samples/curl/system/reload-groups.sh new file mode 100644 index 00000000000..03c2ddc11f8 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/system/reload-groups.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/system/reload/groups' diff --git a/webapp/sources/api-doc/code_samples/curl/system/reload-techniques.sh b/webapp/sources/api-doc/code_samples/curl/system/reload-techniques.sh new file mode 100644 index 00000000000..c95279592dc --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/system/reload-techniques.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/system/reload/techniques' diff --git a/webapp/sources/api-doc/code_samples/curl/system/reload.sh b/webapp/sources/api-doc/code_samples/curl/system/reload.sh new file mode 100644 index 00000000000..3fa5fd6b6cf --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/system/reload.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/system/reload' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/system/status.sh b/webapp/sources/api-doc/code_samples/curl/system/status.sh new file mode 100644 index 00000000000..2f766a94236 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/system/status.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/system/status \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/system/update-policies.sh b/webapp/sources/api-doc/code_samples/curl/system/update-policies.sh new file mode 100644 index 00000000000..9f20e6e5be5 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/system/update-policies.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request POST 'https://rudder.example.com/rudder/api/latest/system/update/policies' \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/techniques/all.sh b/webapp/sources/api-doc/code_samples/curl/techniques/all.sh new file mode 100644 index 00000000000..0c907043c62 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/techniques/all.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/techniques \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/techniques/name-version.sh b/webapp/sources/api-doc/code_samples/curl/techniques/name-version.sh new file mode 100644 index 00000000000..b04f993e636 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/techniques/name-version.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/techniques/checkGenericFileContent/6.0/directives \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/curl/techniques/name.sh b/webapp/sources/api-doc/code_samples/curl/techniques/name.sh new file mode 100644 index 00000000000..3eb9ce8a540 --- /dev/null +++ b/webapp/sources/api-doc/code_samples/curl/techniques/name.sh @@ -0,0 +1 @@ +curl --header "X-API-Token: yourToken" --request GET https://rudder.example.com/rudder/api/latest/techniques/checkGenericFileContent/directives \ No newline at end of file diff --git a/webapp/sources/api-doc/code_samples/python/nodes/all.py b/webapp/sources/api-doc/code_samples/python/nodes/all.py new file mode 100644 index 00000000000..aa51a1c8d5c --- /dev/null +++ b/webapp/sources/api-doc/code_samples/python/nodes/all.py @@ -0,0 +1,13 @@ +import json +import requests + +# Get all nodes having a hostname starting with node1 and based on Linux and only display minimal information (id, hostname, status) +url = "https://rudder.example.com/rudder/api/latest/nodes" +linux = {"objectType": "node", "attribute": "OS", + "comparator": "eq", "value": "Linux"} +node1 = {"objectType": "node", "attribute": "nodeHostname", + "comparator": "regex", "value": "node1.*"} +where = [linux, node1] +params = {"where": json.dumps(where), "include": "minimal"} +headers = {"X-API-TOKEN": "yourToken"} +requests.get(url, params=params, headers=headers, verify=False) diff --git a/webapp/sources/api-doc/components/parameters/archive-kind.yml b/webapp/sources/api-doc/components/parameters/archive-kind.yml new file mode 100644 index 00000000000..cc001606f27 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/archive-kind.yml @@ -0,0 +1,12 @@ +name: "archiveKind" +in: path +required: true +schema: + type: string + enum: + - full + - groups + - rules + - directives + example: full +description: Type of archive to make diff --git a/webapp/sources/api-doc/components/parameters/change-request-id.yml b/webapp/sources/api-doc/components/parameters/change-request-id.yml new file mode 100644 index 00000000000..3fae1319fd3 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/change-request-id.yml @@ -0,0 +1,7 @@ +name: changeRequestId +in: path +required: true +schema: + type: integer + description: Change request id + example: 37 diff --git a/webapp/sources/api-doc/components/parameters/compliance-level.yml b/webapp/sources/api-doc/components/parameters/compliance-level.yml new file mode 100644 index 00000000000..7d8ee454159 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/compliance-level.yml @@ -0,0 +1,7 @@ +name: "level" +in: query +schema: + type: integer + example: 4 + default: 10 +description: Number of depth level of compliance objects to display (1:rules, 2:directives, 3:components, 4:nodes, 5:values, 6:reports) diff --git a/webapp/sources/api-doc/components/parameters/datasource-id.yml b/webapp/sources/api-doc/components/parameters/datasource-id.yml new file mode 100644 index 00000000000..4ae96767c25 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/datasource-id.yml @@ -0,0 +1,7 @@ +name: datasourceId +in: path +required: true +description: Id of the data source +schema: + type: string + example: "test-data-source" diff --git a/webapp/sources/api-doc/components/parameters/directive-id.yml b/webapp/sources/api-doc/components/parameters/directive-id.yml new file mode 100644 index 00000000000..1de9aedca24 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/directive-id.yml @@ -0,0 +1,8 @@ +name: "directiveId" +in: path +required: true +description: Id of the directive +schema: + type: string + format: uuid + example: 9a1773c9-0889-40b6-be89-f6504443ac1b diff --git a/webapp/sources/api-doc/components/parameters/group-category-id.yml b/webapp/sources/api-doc/components/parameters/group-category-id.yml new file mode 100644 index 00000000000..693fea3c43a --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/group-category-id.yml @@ -0,0 +1,8 @@ +name: groupCategoryId +in: path +required: true +schema: + type: string + format: uuid + description: Group category id + example: e0a311fa-f7b2-4f9e-89a9-db517b9c6b90 diff --git a/webapp/sources/api-doc/components/parameters/group-id.yml b/webapp/sources/api-doc/components/parameters/group-id.yml new file mode 100644 index 00000000000..26c49b8b258 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/group-id.yml @@ -0,0 +1,8 @@ +name: "groupId" +in: path +required: true +description: Id of the group +schema: + type: string + format: uuid + example: 9a1773c9-0889-40b6-be89-f6504443ac1b diff --git a/webapp/sources/api-doc/components/parameters/include.yml b/webapp/sources/api-doc/components/parameters/include.yml new file mode 100644 index 00000000000..f4522ed836c --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/include.yml @@ -0,0 +1,16 @@ +name: "include" +in: query +description: >- + Level of information to include from the node inventory. Some base levels are defined (**minimal**, **default**, **full**). You can add fields you want to a base level by adding them to the list, possible values are keys from json answer. If you don't provide a base level, they will be added to `default` level, so if you only want os details, use `minimal,os` as the value for this parameter. + + + * **minimal** includes: `id`, `hostname` and `status` + + * **default** includes **minimal** plus `architectureDescription`, `description`, `ipAddresses`, `lastRunDate`, `lastInventoryDate`, `machine`, `os`, `managementTechnology`, `policyServerId`, `properties`, `policyMode `, `ram` and `timezone` + + * **full** includes: **default** plus `accounts`, `bios`, `controllers`, `environmentVariables`, `fileSystems`, `managementTechnologyDetails`, `memories`, `networkInterfaces`, `ports`, `processes`, `processors`, `slots`, `software`, `sound`, `storage`, `videos` and `virtualMachines ` +schema: + type: string + default: default + format: comma-separated list + example: minimal diff --git a/webapp/sources/api-doc/components/parameters/node-composition.yml b/webapp/sources/api-doc/components/parameters/node-composition.yml new file mode 100644 index 00000000000..54355ec1ed6 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/node-composition.yml @@ -0,0 +1,10 @@ +name: composition +in: query +description: Boolean operator to use between each `where` criteria. +schema: + type: string + enum: + - and + - or + default: and + example: and diff --git a/webapp/sources/api-doc/components/parameters/node-id.yml b/webapp/sources/api-doc/components/parameters/node-id.yml new file mode 100644 index 00000000000..ed1114cb622 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/node-id.yml @@ -0,0 +1,8 @@ +name: "nodeId" +in: path +required: true +description: Id of the target node +schema: + type: string + format: uuid (or "root") + example: 9a1773c9-0889-40b6-be89-f6504443ac1b diff --git a/webapp/sources/api-doc/components/parameters/node-query.yml b/webapp/sources/api-doc/components/parameters/node-query.yml new file mode 100644 index 00000000000..e5c79037ba7 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/node-query.yml @@ -0,0 +1,44 @@ +name: query +in: query +description: The criterion you want to find for your nodes. Replaces the `where`, `composition` and `select` parameters in a single parameter. +content: + ## WARNING partially duplicated content from node-where.yml, node-composition.yml and node-select.yml, and also present in groups schema. + application/json: # serialized JSON + schema: + type: object + properties: + select: + description: What kind of data we want to include. Here we can get policy servers/relay by setting `nodeAndPolicyServer`. Only used if `where` is defined. + type: string + default: node + composition: + type: string + enum: + - and + - or + default: and + description: Boolean operator to use between each `where` criteria. + example: and + where: + type: array + description: List of criteria + items: + type: object + properties: + objectType: + type: string + description: Type of the object + example: node + attribute: + description: Attribute to compare + example: OS + type: string + comparator: + description: Comparator to use + example: eq + # FIXME enum + type: string + value: + type: string + example: Linux + description: Value to compare against diff --git a/webapp/sources/api-doc/components/parameters/node-select.yml b/webapp/sources/api-doc/components/parameters/node-select.yml new file mode 100644 index 00000000000..e7c22f67390 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/node-select.yml @@ -0,0 +1,7 @@ +name: select +in: query +# FIXME what does this actually mean? +description: What kind of data we want to include. Here we can get policy servers/relay by setting `nodeAndPolicyServer`. Only used if `where` is defined. +schema: + type: string + default: node diff --git a/webapp/sources/api-doc/components/parameters/node-where.yml b/webapp/sources/api-doc/components/parameters/node-where.yml new file mode 100644 index 00000000000..81d1ceeeb51 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/node-where.yml @@ -0,0 +1,28 @@ +name: where +in: query +description: The criterion you want to find for your nodes +content: + application/json: # serialized JSON + schema: + type: array + description: List of criteria + items: + type: object + properties: + objectType: + type: string + description: Type of the object + example: node + attribute: + description: Attribute to compare + example: OS + type: string + comparator: + description: Comparator to use + example: eq + # FIXME enum + type: string + value: + type: string + example: Linux + description: Value to compare against diff --git a/webapp/sources/api-doc/components/parameters/parameter-id.yml b/webapp/sources/api-doc/components/parameters/parameter-id.yml new file mode 100644 index 00000000000..a6236e0f968 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/parameter-id.yml @@ -0,0 +1,7 @@ +name: "parameterId" +in: path +required: true +description: Id of the parameter to manage +schema: + type: string + example: rudder_file_edit_header diff --git a/webapp/sources/api-doc/components/parameters/rule-category-id.yml b/webapp/sources/api-doc/components/parameters/rule-category-id.yml new file mode 100644 index 00000000000..218c57e5c3c --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/rule-category-id.yml @@ -0,0 +1,8 @@ +name: ruleCategoryId +in: path +required: true +schema: + type: string + format: uuid + description: Rule category id + example: e0a311fa-f7b2-4f9e-89a9-db517b9c6b90 diff --git a/webapp/sources/api-doc/components/parameters/rule-id.yml b/webapp/sources/api-doc/components/parameters/rule-id.yml new file mode 100644 index 00000000000..0c64b67efaf --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/rule-id.yml @@ -0,0 +1,8 @@ +name: "ruleId" +in: path +required: true +description: Id of the target rule +schema: + type: string + format: uuid + example: 9a1773c9-0889-40b6-be89-f6504443ac1b diff --git a/webapp/sources/api-doc/components/parameters/setting-id.yml b/webapp/sources/api-doc/components/parameters/setting-id.yml new file mode 100644 index 00000000000..949db7132c7 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/setting-id.yml @@ -0,0 +1,7 @@ +name: "settingId" +in: path +required: true +description: Id of the setting to set +schema: + type: string + example: global_policy_mode diff --git a/webapp/sources/api-doc/components/parameters/technique-name.yml b/webapp/sources/api-doc/components/parameters/technique-name.yml new file mode 100644 index 00000000000..7b4a1ee055a --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/technique-name.yml @@ -0,0 +1,8 @@ +name: techniqueName +in: path +description: Technique name +required: true +schema: + type: string + example: userManagement + description: Technique name diff --git a/webapp/sources/api-doc/components/parameters/technique-version.yml b/webapp/sources/api-doc/components/parameters/technique-version.yml new file mode 100644 index 00000000000..ed7c13484f1 --- /dev/null +++ b/webapp/sources/api-doc/components/parameters/technique-version.yml @@ -0,0 +1,8 @@ +name: techniqueVersion +in: path +description: Technique version +required: true +schema: + type: string + example: "6.0" + description: Technique version diff --git a/webapp/sources/api-doc/components/responses/agent-output.yml b/webapp/sources/api-doc/components/responses/agent-output.yml new file mode 100644 index 00000000000..25f315847df --- /dev/null +++ b/webapp/sources/api-doc/components/responses/agent-output.yml @@ -0,0 +1,25 @@ +description: Agent output +content: + text/plain: + schema: + type: string + example: >- + Start execution with config [20200218-112602-11ce4f64] + + Hostname M| State Technique Component Key Message + 192.168.210.5 E| compliant Common ncf Initialization Configuration library initialization was correct + 192.168.210.5 E| compliant Common Update Policy and configuration library are already up to date. No action required. + [...] + + ## Summary ##################################################################### + 90 components verified in 15 directives + => 62 components in Enforce mode + -> 48 compliant + -> 13 not-applicable + -> 1 error + => 28 components in Audit mode + -> 15 compliant + -> 3 not-applicable + -> 10 non-compliant + Execution time: 8.89s + ################################################################################ diff --git a/webapp/sources/api-doc/components/schemas/change-request.yml b/webapp/sources/api-doc/components/schemas/change-request.yml new file mode 100644 index 00000000000..92ca17449d0 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/change-request.yml @@ -0,0 +1,42 @@ +type: object +description: Content of the change request +properties: + id: + type: integer + example: 42 + name: + type: string + example: "Remove unused security policy" + description: + type: string + status: + type: string + enum: + - Deployed + - Pending deployment + - Cancelled + - Pending validation + - Open + acceptable: + type: boolean + example: true + created by: + type: string + example: "Matthieu C." + changes: + type: object + properties: + rules: + type: array + items: + type: object + properties: + action: + type: string + example: modify Rule + #rule: + # allOf: + # $ref: ./rule.yml + #directives: + #groups: + #parameters: diff --git a/webapp/sources/api-doc/components/schemas/datasource.yml b/webapp/sources/api-doc/components/schemas/datasource.yml new file mode 100644 index 00000000000..d87a6e81af5 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/datasource.yml @@ -0,0 +1,105 @@ +type: object +properties: + id: + type: string + description: Unique identifier of the data source to create. + example: test-data-source + name: + type: string + description: The human readable name of the data source to create. + example: Test data source + description: + type: string + description: Description of the goal of the data source to create. + example: "Synchronize example data from the CMDB" + enabled: + type: boolean + description: Enable or disable data source. + example: true + updateTimeout: + type: integer + description: Duration in seconds before aborting data source update. The main goal is to prevent never ending requests. If a periodicity if configured, you should set that timeout at a lower value. + example: 30 + runParameters: + type: object + description: Parameters to configure when the data source is fetched to update node properties. + properties: + onGeneration: + type: boolean + example: true + description: Trigger a fetch at the beginning of a policy generation + onNewNode: + type: boolean + example: true + description: Trigger a fetch when a new node is accepted, for that node + schedule: + type: object + description: Configure if data source should be fetch periodically + properties: + type: + type: string + description: "`scheduled` enables periodic update, `notscheduled` disables them" + enum: + - scheduled + - notscheduled + example: scheduled + type: + type: object + description: Define and configure data source type. + properties: + name: + type: string + description: Data source type name + example: HTTP + enum: + - HTTP + parameters: + type: object + description: You can use Rudder variable expansion (`${rudder.node`, `${node.properties...}`) + properties: + url: + type: string + description: URL to contact. Rudder expansion available. + example: http://jsonplaceholder.typicode.com/users/1 + requestMethod: + type: string + example: GET + enum: + - GET + - POST + description: HTTP method to use to contact the URL. + headers: + type: array + description: Represent HTTP headers for the query. Rudder expansion available. + items: + type: object + properties: + name: + type: string + example: X-API-Key + description: Name of the header + value: + type: string + example: 05ce8e3d9df6 + description: Value of the header + path: + type: string + description: JSON path (as defined in [the specification](https://github.com/jayway/JsonPath/), without the leading `$.`) to find the interesting sub-json or string/number/boolean value in the answer. Let empty to use the whole answer as value. + checkSsl: + type: boolean + example: true + description: Check SSL certificate validity for https. Must be set to false for self-signed certificate + requestTimeout: + type: integer + example: 10 + description: Timeout in seconds for each HTTP request + requestMode: + type: object + description: Configure the strategy used to query the HTTP data source. + properties: + name: + type: string + description: Node by node strategy + enum: + - byNode + example: byNode diff --git a/webapp/sources/api-doc/components/schemas/directive-new.yml b/webapp/sources/api-doc/components/schemas/directive-new.yml new file mode 100644 index 00000000000..68a3bd2bd5c --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/directive-new.yml @@ -0,0 +1,126 @@ +## FIXME totally incomplete! +type: object +properties: + source: + type: string + format: uuid + example: b9f6d98a-28bc-4d80-90f7-d2f14269e215 + description: The id of the directive the clone will be based onto. If this parameter if provided, the new directive will be a clone of this source. Other value will override values from the source. + id: + type: string + format: uuid + example: 91252ea2-feb2-412d-8599-c6945fee02c4 + description: Directive id + displayName: + type: string + example: 91252ea2-feb2-412d-8599-c6945fee02c4 + description: Human readable name of the directive + shortDescription: + type: string + example: 91252ea2-feb2-412d-8599-c6945fee02c4 + description: One line directive description + longDescription: + type: string + format: markdown + example: >- + # Documentation + + * [Ticket link](https://tickets.example.com/issues/3456) + description: Description of the technique (rendered as markdown) + techniqueName: + type: string + example: userManagement + description: Directive id + techniqueVersion: + type: string + example: "8.0" + description: Directive id + priority: + type: integer + description: Directive priority. `0` has highest priority. + example: 5 + minimum: 0 + maximum: 10 + enabled: + type: boolean + example: true + description: Is the directive enabled + system: + type: boolean + description: If true it is an internal Rudder directive + example: false + tags: + type: array + items: + type: object + properties: + name: + type: string + description: Value of the `name` key + example: value + example: + customer: MyCompany + parameters: + type: object + description: Directive parameters (depends on the source technique) + example: + name: sections + sections: + - section: + name: File to manage + vars: + - var: + name: FILE_AND_FOLDER_MANAGEMENT_ACTION + value: copy + - var: + name: FILE_AND_FOLDER_MANAGEMENT_SOURCE + value: "/vagrant/node.sh" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_SYMLINK_ENFORCE + value: "false" + sections: + - section: + name: File + vars: + - var: + name: FILE_AND_FOLDER_MANAGEMENT_PATH + value: "/root/test" + - section: + name: File cleaning options + vars: + - var: + name: FILE_AND_FOLDER_DELETION_DAYS + value: "0" + - var: + name: FILE_AND_FOLDER_DELETION_OPTION + value: none + - var: + name: FILE_AND_FOLDER_DELETION_PATTERN + value: ".*" + - section: + name: Permissions + vars: + - var: + name: FILE_AND_FOLDER_MANAGEMENT_CHECK_PERMISSIONS + value: "false" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_GROUP + value: "" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_OWNER + value: "" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_PERM + value: "000" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_RECURSIVE + value: "1" + - section: + name: Post-modification hook + vars: + - var: + name: FILE_AND_FOLDER_MANAGEMENT_POST_HOOK_COMMAND + value: "" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_POST_HOOK_RUN + value: "false" diff --git a/webapp/sources/api-doc/components/schemas/directive.yml b/webapp/sources/api-doc/components/schemas/directive.yml new file mode 100644 index 00000000000..d4e7f50faad --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/directive.yml @@ -0,0 +1,121 @@ +## same as directive-new without source +type: object +properties: + id: + type: string + format: uuid + example: 91252ea2-feb2-412d-8599-c6945fee02c4 + description: Directive id + displayName: + type: string + example: 91252ea2-feb2-412d-8599-c6945fee02c4 + description: Human readable name of the directive + shortDescription: + type: string + example: 91252ea2-feb2-412d-8599-c6945fee02c4 + description: One line directive description + longDescription: + type: string + format: markdown + example: >- + # Documentation + + * [Ticket link](https://tickets.example.com/issues/3456) + description: Description of the technique (rendered as markdown) + techniqueName: + type: string + example: userManagement + description: Directive id + techniqueVersion: + type: string + example: "8.0" + description: Directive id + priority: + type: integer + description: Directive priority. `0` has highest priority. + example: 5 + minimum: 0 + maximum: 10 + enabled: + type: boolean + example: true + description: Is the directive enabled + system: + type: boolean + description: If true it is an internal Rudder directive + example: false + tags: + type: array + items: + type: object + properties: + name: + type: string + description: Value of the `name` key + example: value + example: + customer: MyCompany + parameters: + type: object + description: Directive parameters (depends on the source technique) + example: + name: sections + sections: + - section: + name: File to manage + vars: + - var: + name: FILE_AND_FOLDER_MANAGEMENT_ACTION + value: copy + - var: + name: FILE_AND_FOLDER_MANAGEMENT_SOURCE + value: "/vagrant/node.sh" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_SYMLINK_ENFORCE + value: "false" + sections: + - section: + name: File + vars: + - var: + name: FILE_AND_FOLDER_MANAGEMENT_PATH + value: "/root/test" + - section: + name: File cleaning options + vars: + - var: + name: FILE_AND_FOLDER_DELETION_DAYS + value: "0" + - var: + name: FILE_AND_FOLDER_DELETION_OPTION + value: none + - var: + name: FILE_AND_FOLDER_DELETION_PATTERN + value: ".*" + - section: + name: Permissions + vars: + - var: + name: FILE_AND_FOLDER_MANAGEMENT_CHECK_PERMISSIONS + value: "false" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_GROUP + value: "" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_OWNER + value: "" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_PERM + value: "000" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_RECURSIVE + value: "1" + - section: + name: Post-modification hook + vars: + - var: + name: FILE_AND_FOLDER_MANAGEMENT_POST_HOOK_COMMAND + value: "" + - var: + name: FILE_AND_FOLDER_MANAGEMENT_POST_HOOK_RUN + value: "false" diff --git a/webapp/sources/api-doc/components/schemas/group-category-update.yml b/webapp/sources/api-doc/components/schemas/group-category-update.yml new file mode 100644 index 00000000000..b27567bdc80 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/group-category-update.yml @@ -0,0 +1,18 @@ +type: object +required: + - parent + - name +properties: + parent: + type: string + format: uuid + example: b9f6d98a-28bc-4d80-90f7-d2f14269e215 + description: The parent category of the groups + name: + type: string + description: Name of the group category + example: "Hardware groups" + description: + type: string + description: Group category description + example: "Nodes by hardware provider" diff --git a/webapp/sources/api-doc/components/schemas/group-category.yml b/webapp/sources/api-doc/components/schemas/group-category.yml new file mode 100644 index 00000000000..bbf204cdea1 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/group-category.yml @@ -0,0 +1,24 @@ +type: object +required: + - parent + - name +properties: + parent: + type: string + format: uuid + example: b9f6d98a-28bc-4d80-90f7-d2f14269e215 + description: The parent category of the groups + id: + type: string + format: uuid + description: Group category id, only provide it when needed. + default: "{autogenerated}" + example: 32d013f7-b6d8-46c8-99d3-016307fa66c0 + name: + type: string + description: Name of the group category + example: "Hardware groups" + description: + type: string + description: Group category description + example: "Nodes by hardware provider" diff --git a/webapp/sources/api-doc/components/schemas/group-new.yml b/webapp/sources/api-doc/components/schemas/group-new.yml new file mode 100644 index 00000000000..3342d99f536 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/group-new.yml @@ -0,0 +1,77 @@ +type: object +# Same as group.yml minus some entries +required: + - displayName + - category +properties: + source: + type: string + format: uuid + example: b9f6d98a-28bc-4d80-90f7-d2f14269e215 + description: The id of the group the clone will be based onto. If this parameter if provided, the new group will be a clone of this source. Other value will override values from the source. + category: + type: string + format: uuid + description: Id of the new group's category + example: e17ecf6a-a9f2-44de-a97c-116d24d30ff4 + id: + type: string + format: uuid + description: Group id, only provide it when needed. + default: "{autogenerated}" + example: 32d013f7-b6d8-46c8-99d3-016307fa66c0 + displayName: + type: string + description: Name of the group + example: "Ubuntu 18.04 nodes" + description: + type: string + description: Group description + example: "Documentation for the group" + query: + type: object + description: The criteria defining the group. If not provided, the group will be empty. + properties: + select: + description: What kind of data we want to include. Here we can get policy servers/relay by setting `nodeAndPolicyServer`. Only used if `where` is defined. + type: string + default: node + composition: + type: string + enum: + - and + - or + default: and + description: Boolean operator to use between each `where` criteria. + example: and + where: + type: array + description: List of criteria + items: + type: object + properties: + objectType: + type: string + description: Type of the object + example: node + attribute: + description: Attribute to compare + example: OS + type: string + comparator: + description: Comparator to use + example: eq + # FIXME enum + type: string + value: + type: string + example: Linux + description: Value to compare against + dynamic: + type: boolean + default: true + description: Should the group be dynamically refreshed (if not, it is a static group) + enabled: + type: boolean + default: true + description: Enable or disable the group diff --git a/webapp/sources/api-doc/components/schemas/group-update.yml b/webapp/sources/api-doc/components/schemas/group-update.yml new file mode 100644 index 00000000000..465026b4cf6 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/group-update.yml @@ -0,0 +1,63 @@ +type: object +# Same as group-new.yml minus some entries +properties: + category: + type: string + format: uuid + description: Id of the new group's category + example: e17ecf6a-a9f2-44de-a97c-116d24d30ff4 + displayName: + type: string + description: Name of the group + example: "Ubuntu 18.04 nodes" + description: + type: string + description: Group description + example: "Documentation for the group" + query: + type: object + description: The criteria defining the group. If not provided, the group will be empty. + properties: + select: + description: What kind of data we want to include. Here we can get policy servers/relay by setting `nodeAndPolicyServer`. Only used if `where` is defined. + type: string + default: node + composition: + type: string + enum: + - and + - or + default: and + description: Boolean operator to use between each `where` criteria. + example: and + where: + type: array + description: List of criteria + items: + type: object + properties: + objectType: + type: string + description: Type of the object + example: node + attribute: + description: Attribute to compare + example: OS + type: string + comparator: + description: Comparator to use + example: eq + # FIXME enum + type: string + value: + type: string + example: Linux + description: Value to compare against + dynamic: + type: boolean + default: true + description: Should the group be dynamically refreshed (if not, it is a static group) + enabled: + type: boolean + default: true + description: Enable or disable the group diff --git a/webapp/sources/api-doc/components/schemas/group.yml b/webapp/sources/api-doc/components/schemas/group.yml new file mode 100644 index 00000000000..b8773d46c40 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/group.yml @@ -0,0 +1,78 @@ +type: object +properties: + id: + type: string + format: uuid + description: Group id + default: "{autogenerated}" + example: 32d013f7-b6d8-46c8-99d3-016307fa66c0 + displayName: + type: string + description: Name of the group + example: "Ubuntu 18.04 nodes" + description: + type: string + description: Group description + example: "Documentation for the group" + query: + type: object + description: The criteria defining the group + properties: + select: + description: What kind of data we want to include. Here we can get policy servers/relay by setting `nodeAndPolicyServer`. Only used if `where` is defined. + type: string + default: node + composition: + type: string + enum: + - and + - or + default: and + description: Boolean operator to use between each `where` criteria. + example: and + where: + type: array + description: List of criteria + items: + type: object + properties: + objectType: + type: string + description: Type of the object + example: node + attribute: + description: Attribute to compare + example: OS + type: string + comparator: + description: Comparator to use + example: eq + # FIXME enum + type: string + value: + type: string + example: Linux + description: Value to compare against + nodeIds: + type: array + description: List of nodes in the group + items: + type: string + format: uuid (or "root") + example: 109142a2-40eb-4e6d-84b4-7ebe3670474c + description: Node in the group + dynamic: + type: boolean + default: true + description: Should the group be dynamically refreshed (if not, it is a static group) + enabled: + type: boolean + default: true + description: Enable or disable the group + groupClass: + type: array + items: + type: string + format: condition + example: "group_ubuntu" + description: Conditions defined on nodes in the groups. There is one based on the group id, and one based on the group name. diff --git a/webapp/sources/api-doc/components/schemas/node-full.yml b/webapp/sources/api-doc/components/schemas/node-full.yml new file mode 100644 index 00000000000..0219f43a6cc --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/node-full.yml @@ -0,0 +1,693 @@ +type: object +required: + - id + - hostname + - status + - ipAddresses + - managementTechnology + - policyServerId + - properties +properties: + ########## + # + # minimal + # + ########## + id: + type: string + description: Unique id of the node + format: uuid (or "root") + example: 9a1773c9-0889-40b6-be89-f6504443ac1b + hostname: + type: string + description: Fully qualified name of the node + example: node1.example.com + status: + type: string + description: Status of the node + enum: + - pending + - accepted + - deleted + example: accepted + ########## + # + # default + # + ########## + architectureDescription: + type: string + example: "x86_64" + description: Information about CPU architecture (32/64 bits) + description: + type: string + example: "" + description: A human intended description of the node (not used) + ipAddresses: + type: array + description: IP addresses of the node (IPv4 and IPv6) + items: + type: string + example: 192.168.23.45 + description: IP of the node + lastRunDate: + type: string + format: date + example: "2020-02-29T14:48:28Z" + description: Date and time of the latest run, if one is available (node time) + lastInventoryDate: + type: string + example: "2020-02-29T10:11:32Z" + format: date + description: Date and time of the latest generated inventory, if one is available (node time) + machine: + description: Information about the underlying machine + type: object + properties: + id: + type: string + description: Rudder unique identifier for the machine + type: + type: string + description: Type of the machine + enum: + - Physical + - Virtual + example: Virtual + provider: + type: string + example: vbox + description: In the case of VM, the VM technology + manufacturer: + type: string + example: innotek GmbH + description: Information about machine manufacturer + serialNumber: + type: string + example: ece12459-2b90-49c9-ab1e-72e38f797421 + description: If available, a unique identifier provided by the machine + os: + type: object + description: Information about the operating system + required: + - type + - name + - version + - fullName + - kernelVersion + properties: + type: + type: string + example: Linux + description: Family of the OS + enum: + - Windows + - Linux + - AIX + - FreeBSD + name: + type: string + description: Operating system name (distribution on Linux, etc.) + example: "Centos" + version: + type: string + description: OS version + example: "7.6.1810" + fullName: + type: string + description: Full operating system name + example: CentOS Linux release 7.6.1810 (Core) + servicePack: + type: string + description: If relevant, the service pack of the OS + example: "3" + kernelVersion: + type: string + description: Version of the OS kernel + example: 3.10.0-957.1.3.el7.x86_64 + managementTechnology: + type: array + description: Management agents running on the node + items: + type: object + required: + - name + - value + properties: + name: + type: string + description: Agent name + example: "Rudder" + version: + type: string + description: Agent version + example: "6.0.3.release-1.EL.7" + policyServerId: + type: string + format: uuid (or "root") + example: "root" + description: Rudder policy server managing the node + properties: + type: array + description: Node properties (either set by user or filled by third party sources) + items: + type: object + required: + - name + - value + properties: + name: + type: string + description: Property name + example: datacenter + value: + format: string or JSON + example: AMS2 + description: Property value (can be a string or JSON object) + policyMode: + type: string + enum: + - enforce + - audit + - "default" + example: audit + description: Rudder policy mode for the node (`default` follows the global configuration) + ram: + type: integer + description: Size of RAM in MB + timezone: + type: object + required: + - name + - value + properties: + name: + type: string + description: Timezone name + example: UTC + offset: + type: string + format: +/-difference + description: Timezone offset to UTC + example: "+0000" + ########## + # + # full + # + ########## + accounts: + description: User accounts declared in the node + type: array + items: + type: string + example: root + description: User present on the system + bios: + type: object + # FIXME take from real physical node + description: BIOS information + properties: + name: + type: string + description: BIOS name + example: VirtualBox + version: + type: string + description: BIOS version + example: "1.2.3" + editor: + type: string + description: BIOS editor + example: innotek GmbH + quantity: + type: integer + description: Number of BIOS on the machine + example: 1 + releaseDate: + type: string + description: Release date of the BIOS + example: 2006-12-01 00:00:00+0000 + description: + type: string + description: System provided description of the BIOS (long name) + example: FIXME + controllers: + type: array + description: Physical controller information + items: + type: object + properties: + name: + type: string + description: Controller name + type: + type: string + description: Controller type + quantity: + type: integer + description: Quantity of that controller + example: 1 + description: + type: string + description: System provided description of the controller + manufacturer: + type: string + description: Controller manufacturer + environmentVariables: + type: array + description: Environment variables defined on the node in the context of the agent + items: + type: object + properties: + name: + type: string + description: Environment variable name + example: LANG + value: + type: string + description: Environment variable value + example: en_US.UTF-8 + fileSystems: + type: array + description: File system declared on the node + items: + type: object + properties: + name: + type: string + description: Type of file system (`ext4`, `swap`, etc.) + example: ext4 + mountPoint: + type: string + description: Mount point + example: /srv + description: + type: string + description: Description of the file system + fileCount: + type: integer + description: Number of files + example: 1456 + freeSpace: + type: integer + description: Free space remaining + example: 3487 + totalSpace: + type: integer + description: Total space + example: 208869 + managementTechnologyDetails: + type: object + description: Additional information about management technology + properties: + cfengineKeys: + description: Certificates used by the agent + type: array + items: + type: string + format: PEM + description: Certificate (or public key for <6.0 agents) used by the agent + example: -----BEGIN CERTIFICATE-----\nMIIFqDCC[...]3tALNn\n-----END CERTIFICATE----- + cfengineUser: + type: string + description: Local user account used by the agent + example: root + memories: + type: array + description: Memory slots + items: + type: object + description: Memory slots + properties: + name: + type: string + description: Name of the memory slot or memory module + speed: + type: integer + description: Memory speed (frequency) + example: 1066 + type: + type: string + description: Memory slot type + caption: + type: string + description: Manufacturer provided information about the module + quantity: + type: string + example: 1 + description: Number of modules in that slot + capacity: + type: integer + example: 2 + description: Size of modules + slotNumber: + type: integer + example: 3 + description: Slot number + description: + type: string + description: System provided description + serialNumber: + type: string + description: Serial number of the module + networkInterfaces: + type: array + description: Detailed information about registered network interfaces on the node + items: + type: object + properties: + name: + type: string + example: "eth0" + description: Interface name (for ex "eth0") + mask: + type: array + items: + type: string + format: CIDR + example: 255.255.255.0 + description: Network interface mask + type: + type: string + example: "ethernet" + description: Information about the type of network interface + speed: + type: string + example: "1000" + description: Information about synchronization speed + status: + type: string + example: Up + description: network interface status (enabled or not, up or down) + dhcpServer: + type: string + description: DHCP server managing that network interface + example: "192.168.34.5" + macAddress: + type: string + description: MAC address of the network interface + example: 08:00:27:6f:5c:14 + ipAddresses: + type: array + description: IP addresses of the network interface + items: + type: string + description: IP address + example: "192.168.76.4" + ports: + type: array + description: Physical port information objects + items: + type: object + properties: + name: + type: string + description: Port name + type: + type: string + description: Port type + quantity: + type: integer + example: 1 + description: Quantity of similar ports + description: + type: string + description: System provided description of the port + processes: + type: array + description: Process running (at inventory time) + items: + type: object + description: Process information + properties: + pid: + type: integer + example: 3576 + description: PID of the process + tty: + type: string + example: "?" + description: TTY to which the process is + name: + type: string + example: /usr/sbin/httpd -DFOREGROUND + description: Process name + user: + type: string + description: User account who started the process + example: apache + started: + type: string + format: date + example: 2020-02-29 00:24 + description: Started date and time of the process + # FIXME precise units and meaning of process properties + memory: + type: number + format: float + description: Memory allocated to the process (at inventory time) + example: 0.4000000059604645 + virtualMemory: + type: integer + description: Virtual memory allocated to the process (at inventory time) + example: 4380 + cpuUsage: + type: integer + description: CPU used by the process (at inventory time) + example: 1 + description: + type: string + description: System provided description about the process + processors: + type: array + description: CPU information + items: + type: object + properties: + name: + type: string + description: CPU name + example: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz + arch: + type: string + description: CPU architecture + example: i386 + model: + type: integer + description: CPU model + example: 158 + familyName: + type: string + description: CPU family + core: + type: integer + description: Number of core for that CPU + example: 1 + speed: + type: integer + description: Speed (frequency) of the CPU + example: 2800 + thread: + type: integer + description: Number of thread by core for the CPU + example: 1 + stepping: + type: integer + description: Stepping or power management information + example: 9 + manufacturer: + type: string + description: CPU manufacturer + example: Intel + quantity: + type: integer + description: Number of CPU with these features + example: 1 + cpuid: + type: string + description: Identifier of the CPU + externalClock: + description: External clock used by the CPU + type: string + description: + type: string + description: System provided description of the CPU + slots: + type: array + description: Physical extension slot information + items: + type: object + properties: + name: + type: string + description: Slot name or identifier + status: + type: string + description: Slot status (used, powered, etc) + quantity: + type: integer + description: Quantity of similar slots + description: + type: string + description: System provided description of the slots + software: + type: array + description: Software installed on the node (can have thousands items) + properties: + name: + type: string + description: Name of the software (as reported by the node) + example: libcurl + version: + type: string + description: Version of the software + example: 7.29.0-54.el7_7.2 + editor: + type: string + description: Editor of the software + example: CentOS + description: + type: string + description: A description of the software + example: A library for getting files from web servers + releaseDate: + type: string + format: date + description: Release date of the software + license: + type: object + description: Information about the license + properties: + oem: + type: string + description: Is this an OEM license (and information) + name: + type: string + description: License name + productId: + type: string + description: License product identifier + productKey: + type: string + description: License key + description: + type: string + description: License description + expirationDate: + format: date + type: string + description: License expiration date + sound: + type: array + description: Sound card information + items: + type: object + properties: + name: + type: string + description: Sound card name + quantity: + type: integer + description: Quantity of similar sound cards + example: 1 + description: + type: string + description: System provided description of the sound card + storage: + type: array + description: Storage (disks) information objects + items: + type: object + properties: + name: + type: string + description: Storage name + example: sda + type: + type: string + description: Storage type + example: disk + size: + type: integer + description: Storage size in MB + example: 85899 + model: + type: string + description: Storage model + example: VBOXHARDDISK + firmware: + type: string + description: Storage firmware information + example: "10" + quantity: + type: integer + description: Quantity of similar storage + example: 1 + description: + type: string + description: System provided information about the storage + manufacturer: + type: string + description: Storage manufacturer + serialNumber: + type: string + description: Storage serial number + example: 000a1954 + videos: + type: array + description: Video card information + items: + type: object + properties: + name: + type: string + description: Video card name + memory: + type: string + description: Quantity of memory for that video card + chipset: + type: string + description: information about video card chipset + quantity: + type: integer + example: 1 + description: Quantity of similar video cards + resolution: + type: string + description: Resolution used by that video card at inventory time + description: + type: string + description: System provided description for that video card + virtualMachines: + type: array + description: Hosted virtual machine information + items: + type: object + properties: + name: + type: string + description: Name of the hosted virtual machine + type: + type: string + description: Type of the hosted virtual machine + uuid: + type: string + description: Unique identifier of the hosted virtual machine + vcpu: + type: string + description: Number of virtual CPU allocated to the hosted virtual machine + owner: + type: string + description: Owner of the hosted virtual machine + status: + type: string + description: Status (up, starting, etc) of the hosted virtual machine + memory: + type: string + description: Memory allocated to the hosted virtual machine + subsystem: + type: string + description: Technology of the hosted virtual machine + description: + type: string + description: System provided description of the hosted virtual machine diff --git a/webapp/sources/api-doc/components/schemas/node-settings.yml b/webapp/sources/api-doc/components/schemas/node-settings.yml new file mode 100644 index 00000000000..98a0fb3df7e --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/node-settings.yml @@ -0,0 +1,36 @@ +type: object +properties: + properties: + type: array + items: + type: object + required: + - name + - value + properties: + name: + type: string + description: Property name + example: datacenter + value: + format: string or JSON + example: AMS2 + description: Property value (can be a string or JSON object) + policy: + type: string + description: In which mode the node will apply its configuration policy. Use `default` to use the global mode. + enum: + - "audit" + - "enforce" + - "default" + example: audit + state: + type: string + description: The node life cycle state. See [dedicated doc](https://docs.rudder.io/reference/current/usage/advanced_node_management.html#node-lifecycle) for more information. + enum: + - enabled + - ignored + - empty-policies + - initializing + - preparing-eol + example: enabled diff --git a/webapp/sources/api-doc/components/schemas/parameter.yml b/webapp/sources/api-doc/components/schemas/parameter.yml new file mode 100644 index 00000000000..e0b075edfd2 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/parameter.yml @@ -0,0 +1,21 @@ +type: object +required: + - id +properties: + # FIXME: required on not depends on where it's used + id: + type: string + description: Name of the parameter + example: rudder_file_edit_footer + value: + example: "### End of file managed by Rudder ###" + description: Value of the parameter + type: string + description: + type: string + example: "Default inform message put in footer of managed files by Rudder" + description: Description of the parameter + overridable: + type: boolean + description: Is the global parameter overridable by node + example: false diff --git a/webapp/sources/api-doc/components/schemas/rule-category-update.yml b/webapp/sources/api-doc/components/schemas/rule-category-update.yml new file mode 100644 index 00000000000..9db122f29f6 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/rule-category-update.yml @@ -0,0 +1,18 @@ +type: object +required: + - parent + - name +properties: + parent: + type: string + format: uuid + example: b9f6d98a-28bc-4d80-90f7-d2f14269e215 + description: The parent category of the rules + name: + type: string + description: Name of the rule category + example: "Security policies" + description: + type: string + description: Rules category description + example: "Baseline applying CIS guidelines" \ No newline at end of file diff --git a/webapp/sources/api-doc/components/schemas/rule-category.yml b/webapp/sources/api-doc/components/schemas/rule-category.yml new file mode 100644 index 00000000000..c50aff82913 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/rule-category.yml @@ -0,0 +1,24 @@ +type: object +required: + - parent + - name +properties: + parent: + type: string + format: uuid + example: b9f6d98a-28bc-4d80-90f7-d2f14269e215 + description: The parent category of the rules + id: + type: string + format: uuid + description: Rule category id, only provide it when needed. + default: "{autogenerated}" + example: 32d013f7-b6d8-46c8-99d3-016307fa66c0 + name: + type: string + description: Name of the rule category + example: "Security policies" + description: + type: string + description: Rules category description + example: "Baseline applying CIS guidelines" diff --git a/webapp/sources/api-doc/components/schemas/rule-new.yml b/webapp/sources/api-doc/components/schemas/rule-new.yml new file mode 100644 index 00000000000..94b8d92c1fc --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/rule-new.yml @@ -0,0 +1,55 @@ +type: object +properties: + source: + type: string + format: uuid + example: b9f6d98a-28bc-4d80-90f7-d2f14269e215 + description: The id of the rule the clone will be based onto. If this parameter if provided, the new rule will be a clone of this source. Other value will override values from the source. + id: + type: string + description: Rule id + example: 0c1713ae-cb9d-4f7b-abda-ca38c5d643ea + format: uuid + displayName: + type: string + example: Security policy + description: Rule name + shortDescription: + type: string + example: Baseline applying CIS guidelines + description: One line rule description + longDescription: + type: string + example: This rules should be applied to all Linux nodes required basic hardening + description: Rule documentation + directives: + type: array + description: Directives linked to the rule + items: + type: string + description: "Directive id" + targets: + type: array + description: Groups linked to the rule + items: + type: string + description: "Group id" + enabled: + type: boolean + description: Is the rule enabled + example: true + system: + type: boolean + description: If true it is an internal Rudder rule + example: false + tags: + type: array + items: + type: object + properties: + name: + type: string + description: Value of the `name` key + example: value + example: + customer: MyCompany diff --git a/webapp/sources/api-doc/components/schemas/rule.yml b/webapp/sources/api-doc/components/schemas/rule.yml new file mode 100644 index 00000000000..50e08e1868f --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/rule.yml @@ -0,0 +1,50 @@ +type: object +properties: + id: + type: string + description: Rule id + example: 0c1713ae-cb9d-4f7b-abda-ca38c5d643ea + format: uuid + displayName: + type: string + example: Security policy + description: Rule name + shortDescription: + type: string + example: Baseline applying CIS guidelines + description: One line rule description + longDescription: + type: string + example: This rules should be applied to all Linux nodes required basic hardening + description: Rule documentation + directives: + type: array + description: Directives linked to the rule + items: + type: string + description: "Directive id" + targets: + type: array + description: Groups linked to the rule + items: + type: string + description: "Group id" + enabled: + type: boolean + description: Is the rule enabled + example: true + system: + type: boolean + description: If true it is an internal Rudder rule + example: false + tags: + type: array + items: + type: object + properties: + name: + type: string + description: Value of the `name` key + example: value + example: + customer: MyCompany diff --git a/webapp/sources/api-doc/components/schemas/settings.yml b/webapp/sources/api-doc/components/schemas/settings.yml new file mode 100644 index 00000000000..ee1c4f6a7d3 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/settings.yml @@ -0,0 +1,188 @@ +settings: + properties: + allowed_networks: + type: array + description: List of allowed networks for each policy server (root and relays) + items: + type: object + properties: + id: + type: string + example: "root" + description: Rudder id of the policy server + allowed_networks: + description: List of allowed networks + type: array + items: + description: Allowed network (`0.0.0.0/0` for no restriction `a.b.c.d/32` for one IP) + example: 192.168.40.0/24 + type: string + format: CIDR network + global_policy_mode: + type: string + description: Define the default setting for global policy mode + enum: + - "enforce" + - audit + example: enforce + global_policy_mode_overridable: + type: boolean + description: Allow overrides on this default setting + example: true + run_frequency: + description: Agent run schedule - time between agent runs (in minutes) + type: integer + example: 5 + first_run_hour: + type: integer + example: 0 + description: First agent run time - hour + first_run_minute: + type: integer + example: 0 + description: First agent run time - minute + splay_time: + type: integer + example: 5 + description: Maximum delay after scheduled run time (random interval) + modified_file_ttl: + type: integer + example: 7 + description: Number of days to retain modified files + output_file_ttl: + type: integer + example: 7 + description: Number of days to retain agent output files + require_time_synchronization: + type: boolean + example: true + description: Require time synchronization between nodes and policy server + relay_server_synchronization_method: + type: string + enum: + - "classic" + - rsync + - disabled + example: "classic" + description: Method used to synchronize data between server and relays, either "classic" (agent protocol, default), "rsync" (use rsync to synchronize, that you'll need to be manually set up), or "disabled" (use third party system to transmit data) + relay_server_synchronize_policies: + type: boolean + example: true + description: If **rsync** is set as a synchronization method, use rsync to synchronize policies between Rudder server and relays. If false, you'll have to synchronize policies yourself. + relay_server_synchronize_shared_files: + type: boolean + description: If **rsync** is set as a synchronization method, use rsync to synchronize shared files between Rudder server and relays. If false, you'll have to synchronize shared files yourself. + rsyslog_reporting_protocol: + type: string + enum: + - "TCP" + - "UDP" + example: "UDP" + description: Protocol used for syslog communication between node and server + reporting_mode: + type: string + enum: + - full-compliance + - changes-only + - reports-disabled + example: full-compliance + description: Compliance reporting mode + heartbeat_frequency: + type: integer + example: 10 + description: Send heartbeat every heartbeat_frequency runs (only on **changes-only** compliance mode) + log_all_reports: + type: boolean + example: true + description: Log all reports received to `/var/log/rudder/reports/all.log` + enable_change_message: + type: boolean + example: true + description: Enable change audit logs + mandatory_change_message: + type: boolean + example: false + description: Make message mandatory + change_message_prompt: + type: string + example: Please provide a reason for this change + description: Explanation to display + enable_change_request: + type: boolean + example: false + description: Enable Change Requests + enable_self_validation: + type: boolean + example: true + description: Allow self validation + enable_self_deployment: + type: boolean + example: true + description: Allow self deployment + display_recent_changes_graphs: + type: boolean + example: true + description: Display changes graphs + enable_javascript_directives: + type: string + example: "enabled" + description: Enable script evaluation in Directives + send_metrics: + type: string + example: "not defined" + description: Send anonymous usage statistics + node_onaccept_default_state: + type: string + enum: + - enabled + - ignored + - empty-policies + - initializing + - preparing-eol + example: enabled + description: Set default state for node when they are accepted within Rudder + node_onaccept_default_policyMode: + type: string + enum: + - default + - "enforce" + - audit + example: default + description: Default policy mode for accepted node + unexpected_allows_duplicate: + type: boolean + example: true + description: Ignore duplicated compliance reports + default: true + unexpected_unbound_var_values: + type: boolean + description: Allows multiple reports for configuration based on a multivalued variable + default: true + rudder_compute_changes: + type: boolean + default: true + description: Compute list of changes (repaired reports) per rule + rudder_generation_compute_dyngroups: + type: boolean + default: true + description: Recompute all dynamic groups at the start of policy generation + rudder_save_db_compliance_levels: + type: boolean + default: true + description: Store all compliance levels in database + rudder_save_db_compliance_details: + type: boolean + default: false + description: Store all compliance details in database + rudder_generation_max_parallelism: + type: string + default: "0.5" + description: Set the policy generation parallelism, either as an number of thread (i.e. 4), or a multiplicative of the number of core (x0.5) + rudder_generation_js_timeout: + type: integer + default: 30 + description: Policy generation JS evaluation of directive parameter timeout in seconds + rudder_generation_continue_on_error: + type: boolean + default: false + description: Policy generation continues on error during NodeConfiguration evaluation diff --git a/webapp/sources/api-doc/components/schemas/techniques.yml b/webapp/sources/api-doc/components/schemas/techniques.yml new file mode 100644 index 00000000000..2dab3df34b0 --- /dev/null +++ b/webapp/sources/api-doc/components/schemas/techniques.yml @@ -0,0 +1,15 @@ +type: array +items: + type: object + properties: + name: + type: string + description: Technique name + example: userManagement + versions: + type: array + description: Available versions for this technique + items: + type: string + description: Technique version + example: "6.0" diff --git a/webapp/sources/api-doc/components/securitySchemes/token.yml b/webapp/sources/api-doc/components/securitySchemes/token.yml new file mode 100644 index 00000000000..17aa30c6c12 --- /dev/null +++ b/webapp/sources/api-doc/components/securitySchemes/token.yml @@ -0,0 +1,24 @@ +"API tokens": + description: >- + Authenticating against the API is mandatory for every request, as sensitive information like inventories or configuration rules may get exposed. + It is done using a dedicated API Account, than can be created in the web interface on the 'API Accounts' page located inside the Administration part. + + + ![API Tokens settings](assets/APISettings.png "API Tokens settings") + + + API Accounts are not linked to standard user accounts, and currently give full administrative privileges: they must be secured adequately. + Once you have created an API account, you get a token that will be needed to authenticate every request. This token is the API equivalent of a password, and must + be secured just like a password would be. + + + On any call to the API, you will need to add a **X-API-Token** header to your request to authenticate: + + + curl --request GET --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/rules + + + If you perform any action (creation, update, deletion) using the API, the event log generated will record the API account as the user. + type: apiKey + in: header + name: X-API-Token diff --git a/webapp/sources/api-doc/introduction.md b/webapp/sources/api-doc/introduction.md new file mode 100644 index 00000000000..1abf7e98908 --- /dev/null +++ b/webapp/sources/api-doc/introduction.md @@ -0,0 +1,265 @@ +# Introduction + + +Rudder exposes a REST API, enabling the user to interact with Rudder without using the webapp, for example in scripts or cronjobs. + + +## Versioning + +Each time the API is extended with new features (new functions, new parameters, new responses, ...), it will be assigned a new version number. This will allow you +to keep your existing scripts (based on previous behavior). Versions will always be integers (no 2.1 or 3.3, just 2, 3, 4, ...) or `latest`. + +You can change the version of the API used by setting it either within the url or in a header: + +* the URL: each URL is prefixed by its version id, like `/api/version/function`. + + + # Version 10 + curl -X GET -H "X-API-Token: yourToken" https://rudder.example.com/rudder/api/10/rules + # Latest + curl -X GET -H "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/rules + # Wrong (not an integer) => 404 not found + curl -X GET -H "X-API-Token: yourToken" https://rudder.example.com/rudder/api/3.14/rules + + +* the HTTP headers. You can add the **X-API-Version** header to your request. The value needs to be an integer or `latest`. + + + # Version 10 + curl -X GET -H "X-API-Token: yourToken" -H "X-API-Version: 10" https://rudder.example.com/rudder/api/rules + # Wrong => Error response indicating which versions are available + curl -X GET -H "X-API-Token: yourToken" -H "X-API-Version: 3.14" https://rudder.example.com/rudder/api/rules + + +In the future, we may declare some versions as deprecated, in order to remove them in a later version of Rudder, but we will never remove any versions without warning, or without a safe +period of time to allow migration from previous versions. + + +

Existing versions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VersionRudder versions it appeared inDescription
1Never released (for internal use only)Experimental version
2 to 10 (deprecated)4.3 and beforeThese versions provided the core set of API features for rules, directives, nodes global parameters, change requests and compliance, rudder settings and system API
115.0New system API (replacing old localhost v1 api): status, maintenance operations and server behavior
126.0Node key management
+ + +## Response format + +All responses from the API are in the JSON format. + + + { + "action": The name of the called function, + "id": The ID of the element you want, if relevant, + "result": The result of your action: success or error, + "data": Only present if this is a success and depends on the function, it's usually a JSON object, + "errorDetails": Only present if this is an error, it contains the error message + } + + + +* __Success__ responses are sent with the 200 HTTP (Success) code + +* __Error__ responses are sent with a HTTP error code (mostly 5xx...) + + +## HTTP method + +Rudder's REST API is based on the usage of [HTTP methods](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html). We use them to indicate what action will be done by the request. Currently, we use four of them: + + +* **GET**: search or retrieve information (get rule details, get a group, ...) + +* **PUT**: add new objects (create a directive, clone a Rule, ...) + +* **DELETE**: remove objects (delete a node, delete a parameter, ...) + +* **POST**: update existing objects (update a directive, reload a group, ...) + + +## Parameters + +To use Rudder API, you may need to pass data attributes to the API. Most of them depends on the called function and will be described below, in the corresponding function's section. Some are common to almost all functions and are described here: + +### Passing parameters + +Parameters to the API can be sent: + + +* As part of the URL + +* As request arguments + +* Directly in JSON format + + +#### As part of the URL + +Parameters in URLs are used to indicate which data you want to interact with. The function will not work if this data is missing. + + + # Get the Rule of ID "id" + curl -H "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/rules/id + + +#### Request parameters + +In most cases, data will be sent using request parameters. for all data you want to change, you need to pass one parameter. + +Parameters follow the following schema: + + + key=value + + +You can pass parameters by two means: + +* As query parameters: At the end of your url, put a **?** then your first parameter and then a **&** before next parameters + + + # Update the Rule 'id' with a new name, disabled, and setting it one directive + curl -X POST -H "X-API-Token: yourToken" https://rudder.example.com/rudder/api/rules/latest/{id}?"displayName=my new name"&"enabled=false"&"directives=aDirectiveId" + + +* As request data: You can pass those parameters in the request data, they won't figure in the URL, making it lighter to read, You can pass a file that contains data. + + + # Update the Rule 'id' with a new name, disabled, and setting it one directive (in file directive-info.json) + curl -X POST -H "X-API-Token: yourToken" + https://rudder.example.com/rudder/api/rules/latest/{id} -d "displayName=my new name" -d "enabled=false" -d @directive-info.json + + +#### Directly in JSON format + +Instead of passing parameters one by one, you can instead supply a JSON object containing all you want to do. You'll also have to set the *Content-Type* header to **application/json** (without it the JSON content would be ignored). + +The supplied file must contain a valid JSON: strings need quotes, booleans and integers +don't, ... + +The (human readable) format is: + + + { + "key1": "value1", + "key2": false, + "key3": 42 + } + + +Here is an example with inlined data: + + + + # Update the Rule 'id' with a new name, disabled, and setting it one directive + curl -X POST -H "X-API-Token: yourToken" -H "Content-Type: application/json" + https://rudder.example.com/rudder/api/rules/latest/{id} + -d '{ "displayName": "new name", "enabled": false, "directives": "directiveId"}' + + + +You can also pass a supply the JSON in a file: + + + # Update the Rule 'id' with a new name, disabled, and setting it one directive + curl -X POST -H "X-API-Token: yourToken" -H "Content-Type: application/json" https://rudder.example.com/rudder/api/rules/latest/{id} -d @jsonParam + + +Note that some parameters cannot be passed in a JSON (general parameters, it will be precised when necessary), and you will need to pass them a URL parameters if you want them to be taken into account (you can't mix JSON and request parameters) + + + # Update the Rule 'id' with a new name, disabled, and setting it one directive with reason message "Reason used" + curl -X POST -H "X-API-Token: yourToken" -H "Content-Type: application/json" "https://rudder.example.com/rudder/api/rules/latest/{id}?reason=Reason used" -d @jsonParam -d "reason=Reason ignored" + + +### General parameters + +Some parameters are available for almost all API functions. They will be described in this section. +They must be part of the query and can't be submitted in a JSON form. + +#### Available for all requests + + + + + + + + + + + + + + + + +
FieldTypeDescription
prettifyboolean
optional
+ Determine if the answer should be prettified (human friendly) or not. We recommend using this for debugging purposes, but not for general script usage as this does add some unnecessary load on the server side. +

Default value: false

+
+ + +#### Available for modification requests (PUT/POST/DELETE) + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldTypeDescription
reasonstring
optional or required
+ Set a message to explain the change. If you set the reason messages to be mandatory in the web interface, failing to supply this value will lead to an error. +

Default value: ""

+
changeRequestNamestring
optional
+ Set the change request name, is used only if workflows are enabled. The default value depends on the function called +

Default value: A default string for each function

+
changeRequestDescriptionstring
optional
+ Set the change request description, is used only if workflows are enabled. +

Default value: ""

+
diff --git a/webapp/sources/api-doc/openapi.src.yml b/webapp/sources/api-doc/openapi.src.yml new file mode 100644 index 00000000000..624a263238e --- /dev/null +++ b/webapp/sources/api-doc/openapi.src.yml @@ -0,0 +1,167 @@ +openapi: 3.0.3 +info: + title: Rudder API + version: 11 + # Will be substituted by content of the file at build + description: "introduction.md" + x-logo: + url: "assets/rudder.png" + contact: + email: dev@rudder.io + name: Rudder developers + url: "https://www.rudder.io" + license: + name: "CC-BY-SA 2.0" + url: "https://spdx.org/licenses/CC-BY-SA-2.0.html" +servers: + - url: "https://rudder.example.local/rudder/api/latest/" + description: "Rudder server" +externalDocs: + description: "Learn more about Rudder." + url: "https://docs.rudder.io" +components: + securitySchemes: + $ref: components/securitySchemes/token.yml +security: + # Apply the same auth everywhere + - "API tokens": [] +tags: + - name: Compliance + description: Access compliance data + - name: Rules + description: Rules management + - name: Directives + description: Directives management + - name: Techniques + description: Techniques management + - name: Groups + description: Groups management + - name: Nodes + description: Nodes management + - name: Inventories + description: Inventory processing service + - name: Parameters + description: Global parameters + - name: Settings + description: Server configuration + - name: System + description: Internal components and administration + - name: "🧩 Change requests" + description: >- + **Requires that the `changes-validation` plugin is installed on the server.** + + + Manage change requests. + - name: "🧩 Data sources" + description: >- + **Requires that the `datasources` plugin is installed on the server.** + + + Data sources plugin configuration. +paths: + "/changeRequests/{changeRequestId}/accept": + $ref: paths/change-requests/accept.yml + "/changeRequests/{changeRequestId}": + $ref: paths/change-requests/id.yml + "/api/changeRequests": + $ref: paths/change-requests/all.yml + "/compliance": + $ref: paths/compliance/global.yml + "/compliance/rules": + $ref: paths/compliance/rules.yml + "/compliance/rules/{ruleId}": + $ref: paths/compliance/rule.yml + "/compliance/nodes": + $ref: paths/compliance/nodes.yml + "/compliance/nodes/{nodeId}": + $ref: paths/compliance/node.yml + "/system/status": + $ref: paths/system/status.yml + "/system/info": + $ref: paths/system/info.yml + "/system/reload": + $ref: paths/system/reload.yml + "/reload/techniques": + $ref: paths/system/reload-techniques.yml + "/reload/groups": + $ref: paths/system/reload-groups.yml + "/regenerate/policies": + $ref: paths/system/regenerate-policies.yml + "/system/update/policies": + $ref: paths/system/update-policies.yml + "/system/archives/{archiveKind}": + $ref: paths/system/archives.yml + "/settings": + $ref: paths/settings/list.yml + "/settings/{settingId}": + $ref: paths/settings/setting.yml + "/parameters": + $ref: paths/parameters/parameters.yml + "/parameters/{parameterId}": + $ref: paths/parameters/parameters-id.yml + "/inventories/info": + $ref: paths/inventories/info.yml + "/inventories/upload": + $ref: paths/inventories/upload.yml + "/inventories/watcher/start": + $ref: paths/inventories/start.yml + "/inventories/watcher/stop": + $ref: paths/inventories/stop.yml + "/inventories/watcher/restart": + $ref: paths/inventories/restart.yml + "/datasources": + $ref: paths/datasources/all.yml + "/datasources/{datasourceId}": + $ref: paths/datasources/id.yml + "/datasources/reload": + $ref: paths/datasources/reload.yml + "/datasources/reload/{datasourceId}": + $ref: paths/datasources/reload-id.yml + "/nodes/{nodeId}/fetchData": + $ref: paths/datasources/reload-node.yml + "/nodes/{nodeId}/fetchData/{datasourceId}": + $ref: paths/datasources/reload-node-id.yml + "/nodes": + $ref: paths/nodes/all.yml + "/nodes/{nodeId}": + $ref: paths/nodes/id.yml + "/nodes/pending/{nodeId}": + $ref: paths/nodes/pending-id.yml + "/nodes/applyPolicy": + $ref: paths/nodes/apply-policy.yml + "/nodes/{nodeId}/applyPolicy": + $ref: paths/nodes/apply-policy-id.yml + "/techniques": + $ref: paths/techniques/all.yml + "/techniques/{techniqueName}/directives": + $ref: paths/techniques/name.yml + "/techniques/{techniqueName}/{techniqueVersion}/directives": + $ref: paths/techniques/name-version.yml + "/groups": + $ref: paths/groups/all.yml + "/groups/{groupId}": + $ref: paths/groups/id.yml + "/groups/{groupId}/reload": + $ref: paths/groups/reload.yml + "/groups/categories/{groupCategoryId}": + $ref: paths/groups/category-id.yml + "/groups/categories": + $ref: paths/groups/categories.yml + "/groups/tree": + $ref: paths/groups/tree.yml + "/directives": + $ref: paths/directives/all.yml + "/directives/{directiveId}": + $ref: paths/directives/id.yml + "/directives/{directiveId}/check": + $ref: paths/directives/id-check.yml + "/rules": + $ref: paths/rules/all.yml + "/rules/{ruleId}": + $ref: paths/rules/id.yml + "/rules/categories": + $ref: paths/rules/categories.yml + "/rules/categories/{ruleCategoryId}": + $ref: paths/rules/category-id.yml + "/rules/tree": + $ref: paths/rules/tree.yml diff --git a/webapp/sources/api-doc/paths/change-requests/accept.yml b/webapp/sources/api-doc/paths/change-requests/accept.yml new file mode 100644 index 00000000000..943e7904813 --- /dev/null +++ b/webapp/sources/api-doc/paths/change-requests/accept.yml @@ -0,0 +1,58 @@ +delete: + summary: Accept a request details + description: Accept a change request + operationId: acceptChangeRequest + parameters: + - $ref: ../../components/parameters/change-request-id.yml + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + status: + type: string + description: New status of the change request + enum: + - pending deployment + - deployed + example: deployed + responses: + "200": + description: Change requests information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - acceptChangeRequest + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/change-request.yml + tags: + - 🧩 Change requests + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/change-requests/accept.sh diff --git a/webapp/sources/api-doc/paths/change-requests/all.yml b/webapp/sources/api-doc/paths/change-requests/all.yml new file mode 100644 index 00000000000..c534d64b613 --- /dev/null +++ b/webapp/sources/api-doc/paths/change-requests/all.yml @@ -0,0 +1,42 @@ +get: + summary: List all change requests + description: List all change requests + operationId: listChangeRequests + responses: + "200": + description: Change requests information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - listChangeRequests + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/change-request.yml + tags: + - 🧩 Change requests + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/change-requests/all.sh diff --git a/webapp/sources/api-doc/paths/change-requests/id.yml b/webapp/sources/api-doc/paths/change-requests/id.yml new file mode 100644 index 00000000000..01e1d44bb2d --- /dev/null +++ b/webapp/sources/api-doc/paths/change-requests/id.yml @@ -0,0 +1,145 @@ +get: + summary: Get a change request details + description: Get a change request details + operationId: changeRequestDetails + parameters: + - $ref: ../../components/parameters/change-request-id.yml + responses: + "200": + description: Change requests information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - changeRequestDetails + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/change-request.yml + tags: + - 🧩 Change requests + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/change-requests/all.sh +delete: + summary: Decline a request details + description: Refuse a change request + operationId: declineChangeRequest + parameters: + - $ref: ../../components/parameters/change-request-id.yml + responses: + "200": + description: Change requests information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - declineChangeRequest + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/change-request.yml + tags: + - 🧩 Change requests + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/change-requests/refuse.sh +post: + summary: Update a request details + description: Update a change request + operationId: updateChangeRequest + parameters: + - $ref: ../../components/parameters/change-request-id.yml + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + name: + type: string + description: Change request name + description: + type: string + description: Change request description + responses: + "200": + description: Change requests information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - updateChangeRequest + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/change-request.yml + tags: + - 🧩 Change requests + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/change-requests/update.sh diff --git a/webapp/sources/api-doc/paths/compliance/global.yml b/webapp/sources/api-doc/paths/compliance/global.yml new file mode 100644 index 00000000000..8dce5cd95e9 --- /dev/null +++ b/webapp/sources/api-doc/paths/compliance/global.yml @@ -0,0 +1,80 @@ +get: + summary: Global compliance + description: Get current global compliance of a Rudder server + operationId: getGlobalCompliance + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + example: success + action: + type: string + description: The id of the action + enum: + - getGlobalCompliance + data: + type: object + required: + - globalCompliance + properties: + globalCompliance: + type: object + required: + - compliance + properties: + compliance: + type: number + format: integer + description: Global compliance level (`-1` when no policies are defined) + example: 57 + complianceDetails: + type: object + properties: + successAlreadyOK: + type: number + format: float + example: 48.68 + noReport: + type: number + format: float + example: 36.18 + successNotApplicable: + type: number + format: float + example: 5.92 + unexpectedMissingComponent: + type: number + format: float + example: 2.63 + error: + type: number + format: float + example: 1.32 + unexpectedUnknownComponent: + type: number + format: float + example: 2.63 + successRepaired: + type: number + format: float + example: 2.63 + tags: + - Compliance + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/compliance/global.sh diff --git a/webapp/sources/api-doc/paths/compliance/node.yml b/webapp/sources/api-doc/paths/compliance/node.yml new file mode 100644 index 00000000000..85d84c57b70 --- /dev/null +++ b/webapp/sources/api-doc/paths/compliance/node.yml @@ -0,0 +1,99 @@ +get: + summary: Compliance details by node + description: Get current compliance of a node of a Rudder server + operationId: getNodeCompliance + parameters: + - $ref: ../../components/parameters/compliance-level.yml + - $ref: ../../components/parameters/node-id.yml + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + example: success + action: + type: string + description: The id of the action + enum: + - getNodeCompliance + data: + type: object + required: + - nodes + properties: + nodes: + type: array + items: + type: object + required: + - id + - mode + - compliance + - complianceDetails + properties: + id: + type: string + format: uuid + description: id of the node + example: f37f4928-fcb5-4acf-a422-d40f123a9670 + mode: + type: string + enum: + - full-compliance + - changes-only + - reports-disabled + compliance: + type: number + format: float + description: Rule compliance level + example: 57.43 + complianceDetails: + type: object + properties: + successAlreadyOK: + type: number + format: float + example: 48.68 + noReport: + type: number + format: float + example: 36.18 + successNotApplicable: + type: number + format: float + example: 5.92 + unexpectedMissingComponent: + type: number + format: float + example: 2.63 + error: + type: number + format: float + example: 1.32 + unexpectedUnknownComponent: + type: number + format: float + example: 2.63 + successRepaired: + type: number + format: float + example: 2.63 + tags: + - Compliance + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/compliance/node.sh diff --git a/webapp/sources/api-doc/paths/compliance/nodes.yml b/webapp/sources/api-doc/paths/compliance/nodes.yml new file mode 100644 index 00000000000..6bedf01f2c8 --- /dev/null +++ b/webapp/sources/api-doc/paths/compliance/nodes.yml @@ -0,0 +1,98 @@ +get: + summary: Compliance details for all nodes + description: Get current compliance of all the nodes of a Rudder server + operationId: getNodesCompliance + parameters: + - $ref: ../../components/parameters/compliance-level.yml + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + example: success + action: + type: string + description: The id of the action + enum: + - getNodesCompliance + data: + type: object + required: + - nodes + properties: + nodes: + type: array + items: + type: object + required: + - id + - mode + - compliance + - complianceDetails + properties: + id: + type: string + format: uuid + description: id of the node + example: f37f4928-fcb5-4acf-a422-d40f123a9670 + mode: + type: string + enum: + - full-compliance + - changes-only + - reports-disabled + compliance: + type: number + format: float + description: Rule compliance level + example: 57.43 + complianceDetails: + type: object + properties: + successAlreadyOK: + type: number + format: float + example: 48.68 + noReport: + type: number + format: float + example: 36.18 + successNotApplicable: + type: number + format: float + example: 5.92 + unexpectedMissingComponent: + type: number + format: float + example: 2.63 + error: + type: number + format: float + example: 1.32 + unexpectedUnknownComponent: + type: number + format: float + example: 2.63 + successRepaired: + type: number + format: float + example: 2.63 + tags: + - Compliance + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/compliance/nodes.sh diff --git a/webapp/sources/api-doc/paths/compliance/rule.yml b/webapp/sources/api-doc/paths/compliance/rule.yml new file mode 100644 index 00000000000..bcc7a86c5be --- /dev/null +++ b/webapp/sources/api-doc/paths/compliance/rule.yml @@ -0,0 +1,99 @@ +get: + summary: Compliance details by rule + description: Get current compliance of a rule of a Rudder server + operationId: getRuleCompliance + parameters: + - $ref: ../../components/parameters/compliance-level.yml + - $ref: ../../components/parameters/rule-id.yml + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + example: success + action: + type: string + description: The id of the action + enum: + - getRuleCompliance + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + type: object + required: + - id + - mode + - compliance + - complianceDetails + properties: + id: + type: string + format: uuid + description: id of the rule + example: f37f4928-fcb5-4acf-a422-d40f123a9670 + mode: + type: string + enum: + - full-compliance + - changes-only + - reports-disabled + compliance: + type: number + format: float + description: Rule compliance level + example: 57.43 + complianceDetails: + type: object + properties: + successAlreadyOK: + type: number + format: float + example: 48.68 + noReport: + type: number + format: float + example: 36.18 + successNotApplicable: + type: number + format: float + example: 5.92 + unexpectedMissingComponent: + type: number + format: float + example: 2.63 + error: + type: number + format: float + example: 1.32 + unexpectedUnknownComponent: + type: number + format: float + example: 2.63 + successRepaired: + type: number + format: float + example: 2.63 + tags: + - Compliance + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/compliance/rules.sh diff --git a/webapp/sources/api-doc/paths/compliance/rules.yml b/webapp/sources/api-doc/paths/compliance/rules.yml new file mode 100644 index 00000000000..27709415595 --- /dev/null +++ b/webapp/sources/api-doc/paths/compliance/rules.yml @@ -0,0 +1,98 @@ +get: + summary: Compliance details for all rules + description: Get current compliance of all the rules of a Rudder server + operationId: getRulesCompliance + parameters: + - $ref: ../../components/parameters/compliance-level.yml + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + example: success + action: + type: string + description: The id of the action + enum: + - getRulesCompliance + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + type: object + required: + - id + - mode + - compliance + - complianceDetails + properties: + id: + type: string + format: uuid + description: id of the rule + example: f37f4928-fcb5-4acf-a422-d40f123a9670 + mode: + type: string + enum: + - full-compliance + - changes-only + - reports-disabled + compliance: + type: number + format: float + description: Rule compliance level + example: 57.43 + complianceDetails: + type: object + properties: + successAlreadyOK: + type: number + format: float + example: 48.68 + noReport: + type: number + format: float + example: 36.18 + successNotApplicable: + type: number + format: float + example: 5.92 + unexpectedMissingComponent: + type: number + format: float + example: 2.63 + error: + type: number + format: float + example: 1.32 + unexpectedUnknownComponent: + type: number + format: float + example: 2.63 + successRepaired: + type: number + format: float + example: 2.63 + tags: + - Compliance + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/compliance/rules.sh diff --git a/webapp/sources/api-doc/paths/datasources/all.yml b/webapp/sources/api-doc/paths/datasources/all.yml new file mode 100644 index 00000000000..bc382727fe4 --- /dev/null +++ b/webapp/sources/api-doc/paths/datasources/all.yml @@ -0,0 +1,91 @@ +get: + summary: List all data sources + description: Get the configuration of all present data sources + operationId: getAllDataSources + responses: + "200": + description: Data sources information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - getAllDataSources + data: + type: object + required: + - datasources + properties: + datasources: + type: array + items: + $ref: ../../components/schemas/datasource.yml + tags: + - 🧩 Data sources + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/datasources/all.sh +put: + summary: Create a data source + description: Create a new data source + operationId: createDataSource + requestBody: + content: + application/json: + schema: + $ref: ../../components/schemas/datasource.yml + responses: + "200": + description: Created + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - createDataSource + data: + type: object + description: Information about the data sources + required: + - datasources + properties: + datasources: + type: array + items: + $ref: ../../components/schemas/datasource.yml + + tags: + - 🧩 Data sources + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/datasources/create.sh diff --git a/webapp/sources/api-doc/paths/datasources/id.yml b/webapp/sources/api-doc/paths/datasources/id.yml new file mode 100644 index 00000000000..f5ade624641 --- /dev/null +++ b/webapp/sources/api-doc/paths/datasources/id.yml @@ -0,0 +1,138 @@ +get: + summary: Get data source configuration + description: Get the configuration of a data source + operationId: getDataSource + parameters: + - $ref: ../../components/parameters/datasource-id.yml + responses: + "200": + description: Data source information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - getDataSource + data: + type: object + required: + - datasources + properties: + datasources: + type: array + items: + $ref: ../../components/schemas/datasource.yml + tags: + - "🧩 Data sources" + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/datasources/get.sh +post: + summary: Update a data source configuration + description: Update the configuration of a data source + operationId: updateDataSource + parameters: + - $ref: ../../components/parameters/datasource-id.yml + requestBody: + content: + application/json: + schema: + $ref: ../../components/schemas/datasource.yml + responses: + "200": + description: Data source information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - updateDataSource + data: + type: object + required: + - datasources + properties: + datasources: + type: array + items: + $ref: ../../components/schemas/datasource.yml + tags: + - "🧩 Data sources" + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/datasources/update.sh +delete: + summary: Delete a data source + description: Delete a data source configuration + # FIXME check + operationId: deleteDataSource + parameters: + - $ref: ../../components/parameters/datasource-id.yml + responses: + "200": + description: Data source information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - deleteDataSource + data: + type: object + required: + - datasources + properties: + datasources: + type: array + items: + $ref: ../../components/schemas/datasource.yml + tags: + - "🧩 Data sources" + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/datasources/delete.sh diff --git a/webapp/sources/api-doc/paths/datasources/reload-id.yml b/webapp/sources/api-doc/paths/datasources/reload-id.yml new file mode 100644 index 00000000000..48b5ee849ff --- /dev/null +++ b/webapp/sources/api-doc/paths/datasources/reload-id.yml @@ -0,0 +1,38 @@ +post: + summary: Update properties from data sources + description: Update properties from all data source on all nodes. The call is asynchronous. + operationId: ReloadOneDatasourceAllNodes + parameters: + - $ref: ../../components/parameters/datasource-id.yml + responses: + "200": + description: Data source reloaded + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - ReloadOneDatasourceAllNodes + data: + type: string + example: Data for all nodes, for the 'test-data-source' data source are going to be updated + tags: + - "🧩 Data sources" + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/datasources/reload-id.sh diff --git a/webapp/sources/api-doc/paths/datasources/reload-node-id.yml b/webapp/sources/api-doc/paths/datasources/reload-node-id.yml new file mode 100644 index 00000000000..7e2d911f625 --- /dev/null +++ b/webapp/sources/api-doc/paths/datasources/reload-node-id.yml @@ -0,0 +1,39 @@ +post: + summary: Update properties for one node from a data source + description: Update properties from a data source on one nodes. The call is asynchronous. + operationId: ReloadOneDatasourceOneNode + parameters: + - $ref: ../../components/parameters/node-id.yml + - $ref: ../../components/parameters/datasource-id.yml + responses: + "200": + description: Data sources reloaded + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - ReloadOneDatasourceOneNode + data: + type: string + example: Data for node '4e3336f9-ace8-44d6-8d07-496ff1631b01', for ' test-data-source' data source, is going to be updated + tags: + - "🧩 Data sources" + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/datasources/reload-node-id.sh diff --git a/webapp/sources/api-doc/paths/datasources/reload-node.yml b/webapp/sources/api-doc/paths/datasources/reload-node.yml new file mode 100644 index 00000000000..4e2cecd2f92 --- /dev/null +++ b/webapp/sources/api-doc/paths/datasources/reload-node.yml @@ -0,0 +1,38 @@ +post: + summary: Update properties for one node from all data sources + description: Update properties from all data sources on one nodes. The call is asynchronous. + operationId: ReloadAllDatasourcesOneNode + parameters: + - $ref: ../../components/parameters/node-id.yml + responses: + "200": + description: Data sources reloaded + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - ReloadAllDatasourcesOneNode + data: + type: string + example: Data for node '4e3336f9-ace8-44d6-8d07-496ff1631b01', for all configured data sources, is going to be updated + tags: + - "🧩 Data sources" + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/datasources/reload-node.sh diff --git a/webapp/sources/api-doc/paths/datasources/reload.yml b/webapp/sources/api-doc/paths/datasources/reload.yml new file mode 100644 index 00000000000..b25cdc07faa --- /dev/null +++ b/webapp/sources/api-doc/paths/datasources/reload.yml @@ -0,0 +1,36 @@ +post: + summary: Update properties from data sources + description: Update properties from all data source on all nodes. The call is asynchronous. + operationId: ReloadAllDatasourcesAllNodes + responses: + "200": + description: Data source reloaded + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - ReloadAllDatasourcesAllNodes + data: + type: string + example: Data for all nodes, for all configured data sources are going to be updated + tags: + - "🧩 Data sources" + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/datasources/reload.sh diff --git a/webapp/sources/api-doc/paths/directives/all.yml b/webapp/sources/api-doc/paths/directives/all.yml new file mode 100644 index 00000000000..4c26653e863 --- /dev/null +++ b/webapp/sources/api-doc/paths/directives/all.yml @@ -0,0 +1,89 @@ +get: + summary: List all directives + description: List all directives + operationId: listDirectives + responses: + "200": + description: Directives information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - listDirectives + data: + type: object + required: + - directives + properties: + directives: + type: array + items: + $ref: ../../components/schemas/directive.yml + tags: + - Directives + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/directives/all.sh +put: + summary: Create a directive + description: Create a new directive from provided parameters. You can specify a source directive to clone it. + operationId: createDirective + requestBody: + content: + application/json: + schema: + $ref: ../../components/schemas/directive-new.yml + responses: + "200": + description: Directives information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - createDirective + data: + type: object + required: + - directives + properties: + directives: + type: array + items: + $ref: ../../components/schemas/directive.yml + tags: + - Directives + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/directives/create.sh diff --git a/webapp/sources/api-doc/paths/directives/id-check.yml b/webapp/sources/api-doc/paths/directives/id-check.yml new file mode 100644 index 00000000000..48d52f4dccd --- /dev/null +++ b/webapp/sources/api-doc/paths/directives/id-check.yml @@ -0,0 +1,49 @@ +post: + summary: Check that update on a directive is valid + description: Check that update on a directive is valid + operationId: checkDirective + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + # FIXME add techniqueVersion + $ref: ../../components/schemas/directive.yml + responses: + "200": + description: Directives information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - checkDirective + data: + type: object + required: + - directives + properties: + directives: + type: array + items: + $ref: ../../components/schemas/directive.yml + tags: + - Directives + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/directives/check.sh diff --git a/webapp/sources/api-doc/paths/directives/id.yml b/webapp/sources/api-doc/paths/directives/id.yml new file mode 100644 index 00000000000..5f7ef197897 --- /dev/null +++ b/webapp/sources/api-doc/paths/directives/id.yml @@ -0,0 +1,136 @@ +get: + summary: Get directive details + description: Get all information about a given directive + operationId: directiveDetails + parameters: + - $ref: ../../components/parameters/directive-id.yml + responses: + "200": + description: Directives information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - directiveDetails + data: + type: object + required: + - directives + properties: + directives: + type: array + items: + $ref: ../../components/schemas/directive.yml + tags: + - Directives + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/directives/get.sh +delete: + summary: Delete a directive + description: Delete a directive + operationId: deleteDirective + parameters: + - $ref: ../../components/parameters/directive-id.yml + responses: + "200": + description: Directives information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - deleteDirective + data: + type: object + required: + - directives + properties: + directives: + type: array + items: + $ref: ../../components/schemas/directive.yml + tags: + - Directives + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/directives/delete.sh +post: + summary: Update a directive details + description: Update directive information + operationId: updateDirective + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: ../../components/schemas/directive.yml + responses: + "200": + description: Directives information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - updateDirective + data: + type: object + required: + - directives + properties: + directives: + type: array + items: + $ref: ../../components/schemas/directive.yml + tags: + - Directives + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/directives/update.sh diff --git a/webapp/sources/api-doc/paths/groups/all.yml b/webapp/sources/api-doc/paths/groups/all.yml new file mode 100644 index 00000000000..7af238e8191 --- /dev/null +++ b/webapp/sources/api-doc/paths/groups/all.yml @@ -0,0 +1,89 @@ +get: + summary: List all groups + description: List all groups + operationId: listGroups + responses: + "200": + description: Groups information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - listGroups + data: + type: object + required: + - groups + properties: + groups: + type: array + items: + $ref: ../../components/schemas/group.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/all.sh +put: + summary: Create a group + description: Create a new group based in provided parameters + operationId: createGroup + requestBody: + content: + application/json: + schema: + $ref: ../../components/schemas/group.yml + responses: + "200": + description: Group information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - createGroup + data: + type: object + required: + - groups + properties: + groups: + type: array + items: + $ref: ../../components/schemas/group-new.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/create.sh diff --git a/webapp/sources/api-doc/paths/groups/categories.yml b/webapp/sources/api-doc/paths/groups/categories.yml new file mode 100644 index 00000000000..f445294a890 --- /dev/null +++ b/webapp/sources/api-doc/paths/groups/categories.yml @@ -0,0 +1,48 @@ +put: + summary: Create a group category + description: Create a new group category + operationId: CreateGroupCategory + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: ../../components/schemas/group-category.yml + responses: + "200": + description: Groups category information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - CreateGroupCategory + data: + type: object + required: + - groupCategories + properties: + groupCategories: + type: array + items: + $ref: ../../components/schemas/group-category.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/category-id-new.sh diff --git a/webapp/sources/api-doc/paths/groups/category-id.yml b/webapp/sources/api-doc/paths/groups/category-id.yml new file mode 100644 index 00000000000..ff8dc37ce8c --- /dev/null +++ b/webapp/sources/api-doc/paths/groups/category-id.yml @@ -0,0 +1,138 @@ +get: + summary: Get group category details + description: Get detailed information about a group category + operationId: GetGroupCategoryDetails + parameters: + - $ref: ../../components/parameters/group-category-id.yml + responses: + "200": + description: Groups category information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - GetGroupCategoryDetails + data: + type: object + required: + - groupCategories + properties: + groupCategories: + type: array + items: + $ref: ../../components/schemas/group-category.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/category-id.sh +delete: + summary: Delete group category + description: Delete a group category. It must have no child groups and no children categories. + operationId: DeleteGroupCategory + parameters: + - $ref: ../../components/parameters/group-category-id.yml + responses: + "200": + description: Groups category information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - DeleteGroupCategory + data: + type: object + required: + - groupCategories + properties: + groupCategories: + type: array + items: + $ref: ../../components/schemas/group-category.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/category-id-delete.sh +post: + summary: Update group category details + description: Update detailed information about a group category + operationId: UpdateGroupCategory + parameters: + - $ref: ../../components/parameters/group-category-id.yml + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: ../../components/schemas/group-category-update.yml + responses: + "200": + description: Groups category information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - UpdateGroupCategory + data: + type: object + required: + - groupCategories + properties: + groupCategories: + type: array + items: + $ref: ../../components/schemas/group-category.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/category-id-update.sh diff --git a/webapp/sources/api-doc/paths/groups/id.yml b/webapp/sources/api-doc/paths/groups/id.yml new file mode 100644 index 00000000000..2d7f80a8e35 --- /dev/null +++ b/webapp/sources/api-doc/paths/groups/id.yml @@ -0,0 +1,138 @@ +get: + summary: Get group details + description: Get detailed information about a group + operationId: groupDetails + parameters: + - $ref: ../../components/parameters/group-id.yml + responses: + "200": + description: Groups information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - groupDetails + data: + type: object + required: + - groups + properties: + groups: + type: array + items: + $ref: ../../components/schemas/group.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/id.sh +post: + summary: Update group details + description: Update detailed information about a group + operationId: updateGroup + parameters: + - $ref: ../../components/parameters/group-id.yml + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: ../../components/schemas/group-update.yml + responses: + "200": + description: Groups information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - updateGroup + data: + type: object + required: + - groups + properties: + groups: + type: array + items: + $ref: ../../components/schemas/group.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/update.sh +delete: + summary: Delete a group + description: Update detailed information about a group + operationId: deleteGroup + parameters: + - $ref: ../../components/parameters/group-id.yml + responses: + "200": + description: Groups information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - deleteGroup + data: + type: object + required: + - groups + properties: + groups: + type: array + items: + $ref: ../../components/schemas/group.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/delete.sh diff --git a/webapp/sources/api-doc/paths/groups/reload.yml b/webapp/sources/api-doc/paths/groups/reload.yml new file mode 100644 index 00000000000..80e2dd4fa11 --- /dev/null +++ b/webapp/sources/api-doc/paths/groups/reload.yml @@ -0,0 +1,44 @@ +post: + summary: Reload a group + description: Recompute the content of a group + operationId: reloadGroup + parameters: + - $ref: ../../components/parameters/group-id.yml + responses: + "200": + description: Groups information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - reloadGroup + data: + type: object + required: + - groups + properties: + groups: + type: array + items: + $ref: ../../components/schemas/group.yml + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/reload.sh diff --git a/webapp/sources/api-doc/paths/groups/tree.yml b/webapp/sources/api-doc/paths/groups/tree.yml new file mode 100644 index 00000000000..cf7840019a8 --- /dev/null +++ b/webapp/sources/api-doc/paths/groups/tree.yml @@ -0,0 +1,131 @@ +get: + summary: Get groups tree + description: Get all available groups and their categories in a tree + operationId: GetGroupTree + responses: + "200": + description: Groups information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - GetGroupTree + data: + type: object + required: + - groupCategories + properties: + groupCategories: + type: object + description: Group tree + example: + example: + id: GroupRoot + name: Root of the group and group categories + description: + This is the root category for the groups (both dynamic and static) + and group categories + parent: GroupRoot + categories: + - id: SystemGroups + name: System groups + description: That category holds all the system and special target + parent: GroupRoot + categories: [] + groups: + - id: hasPolicyServer-root + displayName: All nodes managed by root policy server + description: All nodes known by Rudder directly connected to the root server + query: + select: nodeAndPolicyServer + composition: And + where: + - objectType: node + attribute: policyServerId + comparator: eq + value: root + nodeIds: + - dd404bda-2785-4959-abaa-8f37a0bbd85e + - f6223b0e-e2aa-4d1f-b6d1-74de8ea8e513 + - root + dynamic: true + enabled: true + - id: 38dd2107-a73b-45fb-916d-e110312abb87 + name: production groups + description: "" + parent: GroupRoot + categories: [] + groups: + - id: 79d83ff9-24d8-4be6-b1f7-cbb1c173f7a5 + displayName: Linux nodes + description: "" + query: + select: node + composition: And + where: + - objectType: node + attribute: OS + comparator: eq + value: Linux + nodeIds: [] + dynamic: false + enabled: true + groups: + - id: af208515-c2f2-4577-bbf4-9fffebbe6629 + displayName: Test Clients + description: "" + query: + select: node + composition: Or + where: + - objectType: node + attribute: nodeHostname + comparator: regex + value: servername.*company.net + - objectType: node + attribute: nodeHostname + comparator: regex + value: lt serverbla.*company.net + nodeIds: [] + dynamic: true + enabled: true + - id: d7634b2d-7189-422b-9971-24c29b75da46 + displayName: Test Clients + description: "" + query: + select: node + composition: Or + where: + - objectType: node + attribute: nodeHostname + comparator: regex + value: servername.*company.net + - objectType: node + attribute: nodeHostname + comparator: regex + value: lt serverbla.*company.net + nodeIds: [] + dynamic: true + enabled: true + + tags: + - Groups + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/groups/tree.sh diff --git a/webapp/sources/api-doc/paths/inventories/info.yml b/webapp/sources/api-doc/paths/inventories/info.yml new file mode 100644 index 00000000000..bb0740b72f5 --- /dev/null +++ b/webapp/sources/api-doc/paths/inventories/info.yml @@ -0,0 +1,47 @@ +get: + summary: Get information about inventory processing queue + description: Provide information about the current state of the inventory processor + operationId: queueInformation + responses: + "200": + description: Inventories information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - queueInformation + data: + type: object + description: Information about the service + required: + - queueMaxSize + - queueSaturated + properties: + queueMaxSize: + type: integer + example: 50 + queueSaturated: + type: boolean + description: Is the inventory queue full + example: false + tags: + - Inventories + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/inventories/info.sh diff --git a/webapp/sources/api-doc/paths/inventories/restart.yml b/webapp/sources/api-doc/paths/inventories/restart.yml new file mode 100644 index 00000000000..03d85dc82f9 --- /dev/null +++ b/webapp/sources/api-doc/paths/inventories/restart.yml @@ -0,0 +1,36 @@ +post: + summary: Restart inventory watcher + description: Restart the inventory watcher if necessary + operationId: fileWatcherRestart + responses: + "200": + description: Started + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - fileWatcherRestart + data: + type: string + example: "Incoming inventory watcher restarted" + tags: + - Inventories + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/inventories/restart.sh diff --git a/webapp/sources/api-doc/paths/inventories/start.yml b/webapp/sources/api-doc/paths/inventories/start.yml new file mode 100644 index 00000000000..3f07394fa90 --- /dev/null +++ b/webapp/sources/api-doc/paths/inventories/start.yml @@ -0,0 +1,36 @@ +post: + summary: Start inventory watcher + description: Start the inventory watcher if necessary + operationId: fileWatcherStart + responses: + "200": + description: Started + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - fileWatcherStart + data: + type: string + example: "Incoming inventory watcher started" + tags: + - Inventories + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/inventories/start.sh diff --git a/webapp/sources/api-doc/paths/inventories/stop.yml b/webapp/sources/api-doc/paths/inventories/stop.yml new file mode 100644 index 00000000000..7a7310cc149 --- /dev/null +++ b/webapp/sources/api-doc/paths/inventories/stop.yml @@ -0,0 +1,36 @@ +post: + summary: Stop inventory watcher + description: Stop the inventory watcher if necessary + operationId: fileWatcherStop + responses: + "200": + description: Stopped + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - fileWatcherStop + data: + type: string + example: "Incoming inventory watcher stopped" + tags: + - Inventories + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/inventories/stop.sh diff --git a/webapp/sources/api-doc/paths/inventories/upload.yml b/webapp/sources/api-doc/paths/inventories/upload.yml new file mode 100644 index 00000000000..b9b739d73c1 --- /dev/null +++ b/webapp/sources/api-doc/paths/inventories/upload.yml @@ -0,0 +1,48 @@ +post: + summary: Upload an inventory for processing + description: Upload an inventory to the web application + operationId: uploadInventory + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary + signature: + type: string + format: binary + responses: + "200": + description: Inventory uploaded + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - uploadInventory + data: + type: string + example: Inventory 'file.xml' for Node 'c1bab9fc-bcf6-4d59-a397-84c8e2fc06c0' added to processing queue. + tags: + - Inventories + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/inventories/upload.sh diff --git a/webapp/sources/api-doc/paths/nodes/all.yml b/webapp/sources/api-doc/paths/nodes/all.yml new file mode 100644 index 00000000000..e331313d0c9 --- /dev/null +++ b/webapp/sources/api-doc/paths/nodes/all.yml @@ -0,0 +1,52 @@ +get: + summary: List managed nodes + description: Get information about the nodes managed by the target server + operationId: listAcceptedNodes + parameters: + - $ref: ../../components/parameters/include.yml + - $ref: ../../components/parameters/node-query.yml + - $ref: ../../components/parameters/node-where.yml + - $ref: ../../components/parameters/node-composition.yml + - $ref: ../../components/parameters/node-select.yml + responses: + "200": + description: Nodes + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - listAcceptedNodes + data: + type: object + description: Information about the nodes + required: + - nodes + properties: + nodes: + type: array + items: + $ref: ../../components/schemas/node-full.yml + tags: + - Nodes + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/nodes/all.sh + - lang: python + source: + $ref: ../../code_samples/python/nodes/all.py diff --git a/webapp/sources/api-doc/paths/nodes/apply-policy-id.yml b/webapp/sources/api-doc/paths/nodes/apply-policy-id.yml new file mode 100644 index 00000000000..1a3dc34f363 --- /dev/null +++ b/webapp/sources/api-doc/paths/nodes/apply-policy-id.yml @@ -0,0 +1,15 @@ +post: + summary: Trigger an agent run + description: This API allows to trigger an agent run on the target node. Response is a stream of the actual agent run on the node. + operationId: applyNode + parameters: + - $ref: ../../components/parameters/node-id.yml + responses: + 200: + $ref: "../../components/responses/agent-output.yml" + tags: + - Nodes + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/nodes/id.sh diff --git a/webapp/sources/api-doc/paths/nodes/apply-policy.yml b/webapp/sources/api-doc/paths/nodes/apply-policy.yml new file mode 100644 index 00000000000..24484725774 --- /dev/null +++ b/webapp/sources/api-doc/paths/nodes/apply-policy.yml @@ -0,0 +1,51 @@ +post: + summary: Trigger a agent runs + description: This API allows to trigger an agent run on the target node. Response contains a json stating if agent could be started on each node, but not if the run went fine and do not display any output from it. You can see the result of the run in Rudder web interface or in the each agent logs. + operationId: applyPolicyAllNodes + responses: + "200": + description: Result + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - applyPolicyAllNodes + data: + type: array + items: + type: object + properties: + id: + type: string + format: uuid (or "root") + example: 249e14ac-2418-457c-a27d-1650907b13c7 + description: Rudder id of the node + hostname: + type: string + example: node.example.com + description: Node hostname + result: + type: string + description: Result or policy application trigger + example: Started + tags: + - Nodes + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/nodes/apply-all.sh diff --git a/webapp/sources/api-doc/paths/nodes/id.yml b/webapp/sources/api-doc/paths/nodes/id.yml new file mode 100644 index 00000000000..ce48938b11a --- /dev/null +++ b/webapp/sources/api-doc/paths/nodes/id.yml @@ -0,0 +1,141 @@ +get: + summary: Get information about a node + description: Get details about a given node + operationId: nodeDetails + parameters: + - $ref: ../../components/parameters/node-id.yml + - $ref: ../../components/parameters/include.yml + responses: + "200": + description: Nodes + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - nodeDetails + data: + type: object + description: Information about the node + required: + - nodes + properties: + nodes: + type: array + items: + $ref: ../../components/schemas/node-full.yml + tags: + - Nodes + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/nodes/id.sh +post: + summary: Update node settings and properties + description: Update node settings and properties + operationId: updateNode + parameters: + - $ref: ../../components/parameters/node-id.yml + requestBody: + content: + application/json: + schema: + $ref: ../../components/schemas/node-settings.yml + responses: + "200": + description: Nodes + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - updateNode + data: + type: object + description: Information about the node + required: + - nodes + properties: + nodes: + type: array + items: + $ref: ../../components/schemas/node-full.yml + tags: + - Nodes + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/nodes/id-update.sh +delete: + summary: Delete a node + description: Remove a node from the Rudder server. It won't be managed anymore. + operationId: deleteNode + parameters: + - $ref: ../../components/parameters/node-id.yml + responses: + "200": + description: Nodes + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - deleteNode + data: + type: object + description: Information about the node + required: + - nodes + properties: + nodes: + type: array + items: + $ref: ../../components/schemas/node-full.yml + tags: + - Nodes + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/nodes/delete.sh diff --git a/webapp/sources/api-doc/paths/nodes/pending-id.yml b/webapp/sources/api-doc/paths/nodes/pending-id.yml new file mode 100644 index 00000000000..7beb0ddd634 --- /dev/null +++ b/webapp/sources/api-doc/paths/nodes/pending-id.yml @@ -0,0 +1,58 @@ +post: + summary: Update pending Node status + description: Accept or refuse a pending node + operationId: changePendingNodeStatus + parameters: + - $ref: ../../components/parameters/node-id.yml + requestBody: + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + status: + type: string + description: New status of the pending node + enum: + - accepted + - refused + example: accepted + responses: + "200": + description: Nodes + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - changePendingNodeStatus + data: + type: object + description: Information about the node + required: + - nodes + properties: + nodes: + type: array + items: + $ref: ../../components/schemas/node-full.yml + tags: + - Nodes + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/nodes/pending-id.sh diff --git a/webapp/sources/api-doc/paths/parameters/parameters-id.yml b/webapp/sources/api-doc/paths/parameters/parameters-id.yml new file mode 100644 index 00000000000..0428a8608e7 --- /dev/null +++ b/webapp/sources/api-doc/paths/parameters/parameters-id.yml @@ -0,0 +1,180 @@ +get: + summary: Get the value of a parameter + description: Get the current value of a given parameter + operationId: parameterDetails + parameters: + - $ref: ../../components/parameters/parameter-id.yml + responses: + "200": + description: Settings + content: + application/json: + schema: + type: object + required: + - result + - action + - data + - id + properties: + id: + type: string + description: Id of the parameter + example: rudder_file_edit_footer + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - parameterDetails + data: + type: object + description: Parameters + required: + - parameters + properties: + parameters: + type: array + items: + $ref: ../../components/schemas/parameter.yml + tags: + - Parameters + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/parameters/get-parameter.sh +post: + summary: Update a parameter's value + description: Update the properties of a parameter + operationId: updateParameter + parameters: + - $ref: ../../components/parameters/parameter-id.yml + responses: + "200": + description: Settings + content: + application/json: + schema: + type: object + required: + - result + - action + - data + - id + properties: + id: + type: string + description: Id of the parameter + example: rudder_file_edit_footer + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - updateParameter + data: + type: object + description: Parameters + required: + - parameters + properties: + parameters: + type: array + items: + $ref: ../../components/schemas/parameter.yml + tags: + - Parameters + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/parameters/modify-parameter.sh +delete: + summary: Delete a parameter + description: Delete an existing parameter + operationId: deleteParameter + parameters: + - $ref: ../../components/parameters/parameter-id.yml + responses: + "500": + description: Non existing parameter + content: + application/json: + schema: + type: object + required: + - result + - action + - data + - id + properties: + id: + type: string + description: Id of the parameter + example: rudder_file_edit_footer + result: + type: string + description: Result of the request + enum: + - error + action: + type: string + description: The id of the action + enum: + - deleteParameter + errorDetails: + type: string + example: "Could not delete Parameter rudder_file_edit_footer cause is: Could not find Parameter rudder_file_edit_footer." + + "200": + description: Settings + content: + application/json: + schema: + type: object + required: + - result + - action + - data + - id + properties: + id: + type: string + description: Id of the parameter + example: rudder_file_edit_footer + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - deleteParameter + data: + type: object + description: Parameters + required: + - parameters + properties: + parameters: + type: array + items: + $ref: ../../components/schemas/parameter.yml + tags: + - Parameters + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/parameters/delete-parameter.sh diff --git a/webapp/sources/api-doc/paths/parameters/parameters.yml b/webapp/sources/api-doc/paths/parameters/parameters.yml new file mode 100644 index 00000000000..951ec91d4c9 --- /dev/null +++ b/webapp/sources/api-doc/paths/parameters/parameters.yml @@ -0,0 +1,97 @@ +get: + summary: List all global parameters + description: Get the current value of all the global parameters + operationId: listParameters + responses: + "200": + description: Settings + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - listParameters + data: + type: object + description: Parameters + required: + - parameters + properties: + parameters: + type: array + items: + $ref: ../../components/schemas/parameter.yml + tags: + - Parameters + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/parameters/list-parameters.sh +put: + summary: Create a new parameter + description: Create a new global parameter + operationId: createParameter + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: ../../components/schemas/parameter.yml + responses: + "200": + description: Settings + content: + application/json: + schema: + type: object + required: + - result + - action + - data + - id + properties: + id: + type: string + description: Id of the parameter + example: rudder_file_edit_footer + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - createParameter + data: + type: object + description: Parameters + required: + - parameters + properties: + parameters: + type: array + items: + $ref: ../../components/schemas/parameter.yml + tags: + - Parameters + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/parameters/create-parameter.sh diff --git a/webapp/sources/api-doc/paths/rules/all.yml b/webapp/sources/api-doc/paths/rules/all.yml new file mode 100644 index 00000000000..49aecc1a3da --- /dev/null +++ b/webapp/sources/api-doc/paths/rules/all.yml @@ -0,0 +1,89 @@ +get: + summary: List all rules + description: List all rules + operationId: listRules + responses: + "200": + description: Rules information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - listRules + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/rule.yml + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/all.sh +put: + summary: Create a rule + description: Create a new rule. You can specify a source rule to clone it. + operationId: createRule + requestBody: + content: + application/json: + schema: + $ref: ../../components/schemas/rule-new.yml + responses: + "200": + description: Rules information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - createRule + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/rule.yml + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/create.sh diff --git a/webapp/sources/api-doc/paths/rules/categories.yml b/webapp/sources/api-doc/paths/rules/categories.yml new file mode 100644 index 00000000000..91bedd8d7a7 --- /dev/null +++ b/webapp/sources/api-doc/paths/rules/categories.yml @@ -0,0 +1,48 @@ +put: + summary: Create a rule category + description: Create a new rule category + operationId: CreateRuleCategory + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: ../../components/schemas/rule-category.yml + responses: + "200": + description: Rules category information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - CreateRuleCategory + data: + type: object + required: + - ruleCategories + properties: + ruleCategories: + type: array + items: + $ref: ../../components/schemas/rule-category.yml + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/category-id-new.sh diff --git a/webapp/sources/api-doc/paths/rules/category-id.yml b/webapp/sources/api-doc/paths/rules/category-id.yml new file mode 100644 index 00000000000..a3f094277eb --- /dev/null +++ b/webapp/sources/api-doc/paths/rules/category-id.yml @@ -0,0 +1,138 @@ +get: + summary: Get rule category details + description: Get detailed information about a rule category + operationId: GetRuleCategoryDetails + parameters: + - $ref: ../../components/parameters/rule-category-id.yml + responses: + "200": + description: Rules category information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - GetRuleCategoryDetails + data: + type: object + required: + - rulesCategories + properties: + rulesCategories: + type: array + items: + $ref: ../../components/schemas/rule-category.yml + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/category-id.sh +delete: + summary: Delete group category + description: Delete a group category. It must have no child groups and no children categories. + operationId: DeleteRuleCategory + parameters: + - $ref: ../../components/parameters/rule-category-id.yml + responses: + "200": + description: Groups category information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - DeleteRuleCategory + data: + type: object + required: + - groupCategories + properties: + groupCategories: + type: array + items: + $ref: ../../components/schemas/rule-category.yml + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/category-id-delete.sh +post: + summary: Update rule category details + description: Update detailed information about a rule category + operationId: UpdateRuleCategory + parameters: + - $ref: ../../components/parameters/rule-category-id.yml + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: ../../components/schemas/rule-category-update.yml + responses: + "200": + description: Rules category information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - UpdateRuleCategory + data: + type: object + required: + - ruleCategories + properties: + ruleCategories: + type: array + items: + $ref: ../../components/schemas/rule-category.yml + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/category-id-update.sh diff --git a/webapp/sources/api-doc/paths/rules/id.yml b/webapp/sources/api-doc/paths/rules/id.yml new file mode 100644 index 00000000000..5fa6b227b6c --- /dev/null +++ b/webapp/sources/api-doc/paths/rules/id.yml @@ -0,0 +1,138 @@ +get: + summary: Get a rule details + description: Get the details of a rule + operationId: ruleDetails + parameters: + - $ref: ../../components/parameters/rule-id.yml + responses: + "200": + description: Rules information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - ruleDetails + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/rule.yml + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/get.sh +post: + summary: Update a rule details + description: Update the details of a rule + operationId: updateRule + parameters: + - $ref: ../../components/parameters/rule-id.yml + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + $ref: ../../components/schemas/rule.yml + responses: + "200": + description: Rules information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - updateRule + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/rule.yml + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/update.sh +delete: + summary: Delete a rule + description: Delete a rule. + operationId: deleteRule + parameters: + - $ref: ../../components/parameters/rule-id.yml + responses: + "200": + description: Rules information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - deleteRule + data: + type: object + required: + - rules + properties: + rules: + type: array + items: + $ref: ../../components/schemas/rule.yml + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/delete.sh diff --git a/webapp/sources/api-doc/paths/rules/tree.yml b/webapp/sources/api-doc/paths/rules/tree.yml new file mode 100644 index 00000000000..7e5e01ebeaf --- /dev/null +++ b/webapp/sources/api-doc/paths/rules/tree.yml @@ -0,0 +1,106 @@ +get: + summary: Get rules tree + description: Get all available rules and their categories in a tree + operationId: GetRuleTree + responses: + "200": + description: Rules information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - GetRuleTree + data: + type: object + required: + - ruleCategories + properties: + ruleCategories: + type: object + description: Rule tree + example: + example: + id: rootRuleCategory + name: Rules + description: This is the main category of Rules + parent: rootRuleCategory + categories: + - id: 4306143d-eabf-4478-b7b1-1616f4aa02b5 + name: Dev category + description: "" + parent: rootRuleCategory + categories: + - id: f45ec2fd-69f4-4669-9c22-1af3abe2a107 + name: Specific dev category + description: "" + parent: 4306143d-eabf-4478-b7b1-1616f4aa02b5 + categories: [] + rules: + - id: b7fda4e7-3616-4e99-89b0-8ffadaf6b0f0 + displayName: my specific Rule + shortDescription: "" + longDescription: "" + directives: [] + targets: [] + enabled: true + system: false + rules: + - id: f2aa50a9-961c-4cce-a266-380cffcdce32 + displayName: dev Rule + shortDescription: "" + longDescription: "" + directives: [] + targets: [] + enabled: true + system: false + rules: + - id: 43cde273-5bb0-466f-8850-7d3fdde03253 + displayName: Global security policy + shortDescription: "" + longDescription: "" + directives: [] + targets: [] + enabled: true + system: false + - id: 32377fd7-02fd-43d0-aab7-28460a91347b + displayName: Global configuration for all nodes + shortDescription: "" + longDescription: + This Rule was created automatically when Rudder was installed. + It can be used to target Directives to all nodes (including the Rudder root server + itself), or deleted if you would rather create your own set of Rules (it will + never be created again). + directives: + - bff45fe2-8233-4d28-96aa-78b0390b548b + targets: + - include: + or: + - special:all + - special:all_exceptPolicyServers + - special:all_nodes_without_role + exclude: + or: [] + enabled: false + system: false + + tags: + - Rules + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/rules/tree.sh diff --git a/webapp/sources/api-doc/paths/settings/list.yml b/webapp/sources/api-doc/paths/settings/list.yml new file mode 100644 index 00000000000..b6eb43996de --- /dev/null +++ b/webapp/sources/api-doc/paths/settings/list.yml @@ -0,0 +1,41 @@ +get: + summary: List all settings + description: Get the current value of all the settings + operationId: getAllSettings + responses: + "200": + description: Settings + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - getAllSettings + data: + type: object + description: Information about the setting + required: + - settings + properties: + $ref: ../../components/schemas/settings.yml + + tags: + - Settings + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/settings/list.sh diff --git a/webapp/sources/api-doc/paths/settings/setting.yml b/webapp/sources/api-doc/paths/settings/setting.yml new file mode 100644 index 00000000000..ecd6226dd52 --- /dev/null +++ b/webapp/sources/api-doc/paths/settings/setting.yml @@ -0,0 +1,111 @@ +get: + summary: Get the value of a setting + description: Get the current value of a specific setting + operationId: getSetting + parameters: + - $ref: ../../components/parameters/setting-id.yml + responses: + "200": + description: Settings + content: + application/json: + schema: + type: object + required: + - result + - action + - data + - id + properties: + id: + type: string + description: Id of the setting + example: global_policy_mode + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - getSetting + data: + type: object + description: Information about the setting + required: + - settings + properties: + settingId: + type: string + example: value + description: Id and value of the property + tags: + - Settings + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/settings/get-setting.sh +post: + summary: Set the value of a setting + description: Set the current value of a specific setting + operationId: modifySetting + parameters: + - $ref: ../../components/parameters/setting-id.yml + requestBody: + required: true + content: + application/x-www-form-urlencoded: + schema: + type: object + properties: + value: + description: New value of the setting + type: string + example: "enforce" + responses: + "200": + description: Settings + content: + application/json: + schema: + type: object + required: + - result + - action + - data + - id + properties: + id: + type: string + description: Id of the setting + example: global_policy_mode + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - modifySetting + data: + type: object + description: Information about the setting + required: + - settings + properties: + settingId: + type: string + example: value + description: Id and value of the property + tags: + - Settings + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/settings/set-setting.sh diff --git a/webapp/sources/api-doc/paths/system/archives.yml b/webapp/sources/api-doc/paths/system/archives.yml new file mode 100644 index 00000000000..216877a412b --- /dev/null +++ b/webapp/sources/api-doc/paths/system/archives.yml @@ -0,0 +1,124 @@ +get: + summary: List archives + description: List configuration archives + operationId: listArchives + parameters: + - $ref: ../../components/parameters/archive-kind.yml + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The kind of the archive + enum: + - archiveFull + - archiveGroups + - archiveRules + - archiveDirectives + example: archiveFull + data: + type: object + required: + - full + properties: + full: + type: array + items: + type: object + required: + - commiter + - gitCommit + - id + properties: + commiter: + type: string + example: Rudder system account + gitCommit: + type: string + format: hash + example: 546de1b211ecc5b7ca295abac2191bc6bb05d44e + id: + type: string + example: "2019-09-17_16-06-15.255" + tags: + - System + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/system/list-archives.sh +post: + summary: Create an archive + description: Create new archive of the given kind + operationId: createArchive + parameters: + - $ref: ../../components/parameters/archive-kind.yml + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The kind of the archive + enum: + - archiveFull + - archiveGroups + - archiveRules + - archiveDirectives + example: archiveFull + data: + type: object + required: + - full + properties: + full: + type: object + required: + - commiter + - gitCommit + - id + properties: + commiter: + type: string + example: Rudder system account + gitCommit: + type: string + format: hash + example: 546de1b211ecc5b7ca295abac2191bc6bb05d44e + id: + type: string + example: "2019-09-17_16-06-15.255" + tags: + - System + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/system/create-archive.sh diff --git a/webapp/sources/api-doc/paths/system/info.yml b/webapp/sources/api-doc/paths/system/info.yml new file mode 100644 index 00000000000..d505fb4bd76 --- /dev/null +++ b/webapp/sources/api-doc/paths/system/info.yml @@ -0,0 +1,57 @@ +get: + summary: Get server information + description: Get information about the server version + operationId: getSystemInfo + responses: + "200": + description: Service information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - getSystemInfo + data: + type: object + description: Information about the service + required: + - rudder + properties: + rudder: + required: + - major-version + - full-version + - build-time + properties: + major-version: + type: string + example: "6.0" + format: X.Y + full-version: + type: string + example: 6.0.4 + format: X.Y.Z + build-time: + type: string + format: date + example: 2019-03-25T10:11:23Z + tags: + - System + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/system/info.sh diff --git a/webapp/sources/api-doc/paths/system/regenerate-policies.yml b/webapp/sources/api-doc/paths/system/regenerate-policies.yml new file mode 100644 index 00000000000..5bddf855328 --- /dev/null +++ b/webapp/sources/api-doc/paths/system/regenerate-policies.yml @@ -0,0 +1,42 @@ +post: + summary: Trigger a new policy generation + description: Trigger a full policy generation + operationId: regeneratePolicies + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - regeneratePolicies + data: + type: object + required: + - policies + properties: + policies: + type: string + enum: + - Started + tags: + - System + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/system/regenerate-policies.sh diff --git a/webapp/sources/api-doc/paths/system/reload-groups.yml b/webapp/sources/api-doc/paths/system/reload-groups.yml new file mode 100644 index 00000000000..1fa27a7a5a3 --- /dev/null +++ b/webapp/sources/api-doc/paths/system/reload-groups.yml @@ -0,0 +1,42 @@ +post: + summary: Reload dynamic groups + description: Reload dynamic groups + operationId: reloadGroups + responses: + "200": + description: Service reload + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - reloadGroups + data: + type: object + required: + - groups + properties: + groups: + type: string + enum: + - Started + tags: + - System + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/system/reload-groups.sh diff --git a/webapp/sources/api-doc/paths/system/reload-techniques.yml b/webapp/sources/api-doc/paths/system/reload-techniques.yml new file mode 100644 index 00000000000..3524587983d --- /dev/null +++ b/webapp/sources/api-doc/paths/system/reload-techniques.yml @@ -0,0 +1,42 @@ +post: + summary: Reload techniques + description: Reload techniques from local technique library + operationId: reloadTechniques + responses: + "200": + description: Service reload + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - reloadTechniques + data: + type: object + required: + - techniques + properties: + techniques: + type: string + enum: + - Started + tags: + - System + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/system/reload-techniques.sh diff --git a/webapp/sources/api-doc/paths/system/reload.yml b/webapp/sources/api-doc/paths/system/reload.yml new file mode 100644 index 00000000000..c00d410c43f --- /dev/null +++ b/webapp/sources/api-doc/paths/system/reload.yml @@ -0,0 +1,47 @@ +post: + summary: Reload both techniques and dynamic groups + description: Reload both techniques and dynamic groups + operationId: reloadAll + responses: + "200": + description: Service reload + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - reloadAll + data: + type: object + required: + - groups + - techniques + properties: + groups: + type: string + enum: + - Started + techniques: + type: string + enum: + - Started + tags: + - System + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/system/reload.sh diff --git a/webapp/sources/api-doc/paths/system/status.yml b/webapp/sources/api-doc/paths/system/status.yml new file mode 100644 index 00000000000..be3d8f37cc7 --- /dev/null +++ b/webapp/sources/api-doc/paths/system/status.yml @@ -0,0 +1,41 @@ +get: + summary: Get server status + description: Get information about current server status + operationId: getStatus + responses: + "200": + description: Service status + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - getStatus + data: + type: object + description: Status of the service + properties: + global: + type: string + enum: + - OK + tags: + - System + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/system/status.sh diff --git a/webapp/sources/api-doc/paths/system/update-policies.yml b/webapp/sources/api-doc/paths/system/update-policies.yml new file mode 100644 index 00000000000..cdbc1e76cb0 --- /dev/null +++ b/webapp/sources/api-doc/paths/system/update-policies.yml @@ -0,0 +1,42 @@ +post: + summary: Trigger update of policies + description: Update configuration policies if needed + operationId: updatePolicies + responses: + "200": + description: Success + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - updatePolicies + data: + type: object + required: + - policies + properties: + policies: + type: string + enum: + - Started + tags: + - System + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/system/update-policies.sh diff --git a/webapp/sources/api-doc/paths/techniques/all.yml b/webapp/sources/api-doc/paths/techniques/all.yml new file mode 100644 index 00000000000..bcdac129c1f --- /dev/null +++ b/webapp/sources/api-doc/paths/techniques/all.yml @@ -0,0 +1,40 @@ +get: + summary: List all techniques + description: List all technique with their versions + operationId: listTechniques + responses: + "200": + description: Techniques information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - listTechniques + data: + type: object + required: + - techniques + properties: + techniques: + $ref: ../../components/schemas/techniques.yml + tags: + - Techniques + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/techniques/all.sh diff --git a/webapp/sources/api-doc/paths/techniques/name-version.yml b/webapp/sources/api-doc/paths/techniques/name-version.yml new file mode 100644 index 00000000000..6547a07ca58 --- /dev/null +++ b/webapp/sources/api-doc/paths/techniques/name-version.yml @@ -0,0 +1,46 @@ +get: + summary: List all directives based on a version of a technique + description: List all directives based on a version of a technique + # FIXME same as name.yml + operationId: listTechniqueVersionDirectives + parameters: + - $ref: ../../components/parameters/technique-name.yml + - $ref: ../../components/parameters/technique-version.yml + responses: + "200": + description: Techniques information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - listTechniqueDirectives + data: + type: object + required: + - directives + properties: + directives: + type: array + items: + $ref: ../../components/schemas/directive.yml + tags: + - Techniques + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/techniques/name-version.sh diff --git a/webapp/sources/api-doc/paths/techniques/name.yml b/webapp/sources/api-doc/paths/techniques/name.yml new file mode 100644 index 00000000000..d9994a4a17f --- /dev/null +++ b/webapp/sources/api-doc/paths/techniques/name.yml @@ -0,0 +1,44 @@ +get: + summary: List all directives based on a technique + description: List all directives based on all version of a technique + operationId: listTechniquesDirectives + parameters: + - $ref: ../../components/parameters/technique-name.yml + responses: + "200": + description: Techniques information + content: + application/json: + schema: + type: object + required: + - result + - action + - data + properties: + result: + type: string + description: Result of the request + enum: + - success + - error + action: + type: string + description: The id of the action + enum: + - listTechniquesDirectives + data: + type: object + required: + - directives + properties: + directives: + type: array + items: + $ref: ../../components/schemas/directive.yml + tags: + - Techniques + x-code-samples: + - lang: curl + source: + $ref: ../../code_samples/curl/techniques/name.sh