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. + + +
Version | +Rudder versions it appeared in | +Description | +
---|---|---|
1 | +Never released (for internal use only) | +Experimental version | +
2 to 10 (deprecated) | +4.3 and before | +These versions provided the core set of API features for rules, directives, nodes global parameters, change requests and compliance, rudder settings and system API | +
11 | +5.0 | +New system API (replacing old localhost v1 api): status, maintenance operations and server behavior | +
12 | +6.0 | +Node key management | +
Field | +Type | +Description | +
---|---|---|
prettify | +boolean 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: |
+
Field | +Type | +Description | +
---|---|---|
reason | +string 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: |
+
changeRequestName | +string optional |
+
+ Set the change request name, is used only if workflows are enabled. The default value depends on the function called
+ Default value: |
+
changeRequestDescription | +string optional |
+
+ Set the change request description, is used only if workflows are enabled.
+ Default value: |
+