3.0.0 • Published 5 years ago

@datafire/rudder_example_local v3.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

@datafire/rudder_example_local

Client library for Rudder API

Installation and Usage

npm install --save @datafire/rudder_example_local
let rudder_example_local = require('@datafire/rudder_example_local').create({
  "API-Tokens": ""
});

.then(data => {
  console.log(data);
});

Description

Download OpenAPI specification: openapi.yml

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.

Response format

All responses from the API are in the JSON format.

{
  "action": The name of the called function,
  "id": The ID of the element you want, if relevant,
  "result": The result of your action: success or error,
  "data": Only present if this is a success and depends on the function, it's usually a JSON object,
  "errorDetails": Only present if this is an error, it contains the error message
}
  • Success responses are sent with the 200 HTTP (Success) code

  • Error responses are sent with a HTTP error code (mostly 5xx...)

HTTP method

Rudder's REST API is based on the usage of HTTP methods. We use them to indicate what action will be done by the request. Currently, we use four of them:

  • GET: search or retrieve information (get rule details, get a group, ...)

  • PUT: add new objects (create a directive, clone a Rule, ...)

  • DELETE: remove objects (delete a node, delete a parameter, ...)

  • POST: update existing objects (update a directive, reload a group, ...)

Parameters

To use Rudder API, you may need to pass data attributes to the API. Most of them depends on the called function and will be described below, in the corresponding function's section. Some are common to almost all functions and are described here:

Passing parameters

Parameters to the API can be sent:

  • As part of the URL

  • As request arguments

  • Directly in JSON format

As part of the URL

Parameters in URLs are used to indicate which data you want to interact with. The function will not work if this data is missing.

# Get the Rule of ID "id"
curl -H "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/rules/id

Request parameters

In most cases, data will be sent using request parameters. for all data you want to change, you need to pass one parameter.

Parameters follow the following schema:

key=value

You can pass parameters by two means:

  • As query parameters: At the end of your url, put a ? then your first parameter and then a & before next parameters
# Update the Rule 'id' with a new name, disabled, and setting it one directive 
curl -X POST -H "X-API-Token: yourToken"  https://rudder.example.com/rudder/api/rules/latest/{id}?"displayName=my new name"&"enabled=false"&"directives=aDirectiveId"
  • As request data: You can pass those parameters in the request data, they won't figure in the URL, making it lighter to read, You can pass a file that contains data.
# Update the Rule 'id' with a new name, disabled, and setting it one directive (in file directive-info.json)
curl -X POST -H "X-API-Token: yourToken"
https://rudder.example.com/rudder/api/rules/latest/{id} -d "displayName=my new name" -d "enabled=false" -d @directive-info.json

Directly in JSON format

Instead of passing parameters one by one, you can instead supply a JSON object containing all you want to do. You'll also have to set the Content-Type header to application/json (without it the JSON content would be ignored).

The supplied file must contain a valid JSON: strings need quotes, booleans and integers don't, ...

The (human readable) format is:

{
  "key1": "value1",
  "key2": false,
  "key3": 42
}

Here is an example with inlined data:

# Update the Rule 'id' with a new name, disabled, and setting it one directive
curl -X POST -H "X-API-Token: yourToken" -H  "Content-Type: application/json"
  https://rudder.example.com/rudder/api/rules/latest/{id} 
  -d '{ "displayName": "new name", "enabled": false, "directives": "directiveId"}'

You can also pass a supply the JSON in a file:

# Update the Rule 'id' with a new name, disabled, and setting it one directive 
curl -X POST -H "X-API-Token: yourToken" -H "Content-Type: application/json" https://rudder.example.com/rudder/api/rules/latest/{id} -d @jsonParam

Note that some parameters cannot be passed in a JSON (general parameters, it will be precised when necessary), and you will need to pass them a URL parameters if you want them to be taken into account (you can't mix JSON and request parameters)

# Update the Rule 'id' with a new name, disabled, and setting it one directive with reason message "Reason used" 
curl -X POST -H "X-API-Token: yourToken" -H "Content-Type: application/json" "https://rudder.example.com/rudder/api/rules/latest/{id}?reason=Reason used" -d @jsonParam -d "reason=Reason ignored"

General parameters

Some parameters are available for almost all API functions. They will be described in this section. They must be part of the query and can't be submitted in a JSON form.

Available for all requests

Available for modification requests (PUT/POST/DELETE)

Actions

listChangeRequests

List all change requests

rudder_example_local.listChangeRequests(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: listChangeRequests): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

getBrandingConf

Get all web interface customization parameters

rudder_example_local.getBrandingConf(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: getBrandingConf): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

updateBRandingConf

change color, logo, label etc.

rudder_example_local.updateBRandingConf({
  "barColor": {},
  "displayBar": true,
  "displayBarLogin": true,
  "displayLabel": true,
  "displayMotd": true,
  "labelColor": {},
  "labelText": "",
  "motd": "",
  "smallLogo": {},
  "wideLogo": {}
}, context)

Input

  • input object
    • barColor required object
    • displayBar required boolean: Whether header bar is displayed or not
    • displayBarLogin required boolean: Whether header bar is displayed in loggin page or not
    • displayLabel required boolean: Whether header bar's label is displayed or not
    • displayMotd required boolean: Whether the message of the day is displayed in loggin page or not
    • labelColor required object
    • labelText required string: The header bar's label title
    • motd required string: Message of the day in loggin page
    • smallLogo required object
    • wideLogo required object

Output

  • output object
    • action required string (values: updateBRandingConf): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

reloadBrandingConf

Reload the configuration from file

rudder_example_local.reloadBrandingConf(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: getBrandingConf): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

declineChangeRequest

Refuse a change request

rudder_example_local.declineChangeRequest({
  "changeRequestId": 0
}, context)

Input

  • input object
    • changeRequestId required integer: Change request id

Output

  • output object
    • action required string (values: declineChangeRequest): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

changeRequestDetails

Get a change request details

rudder_example_local.changeRequestDetails({
  "changeRequestId": 0
}, context)

Input

  • input object
    • changeRequestId required integer: Change request id

Output

  • output object
    • action required string (values: changeRequestDetails): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

updateChangeRequest

Update a change request

rudder_example_local.updateChangeRequest({
  "changeRequestId": 0
}, context)

Input

  • input object
    • changeRequestId required integer: Change request id
    • description string: Change request description
    • name string: Change request name

Output

  • output object
    • action required string (values: updateChangeRequest): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

acceptChangeRequest

Accept a change request

rudder_example_local.acceptChangeRequest({
  "changeRequestId": 0
}, context)

Input

  • input object
    • changeRequestId required integer: Change request id
    • status string (values: pending deployment, deployed): New status of the change request

Output

  • output object
    • action required string (values: acceptChangeRequest): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

getGlobalCompliance

Get current global compliance of a Rudder server

rudder_example_local.getGlobalCompliance(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: getGlobalCompliance): The id of the action
    • data required object
      • globalCompliance required object
        • compliance required number: Global compliance level (-1 when no policies are defined)
        • complianceDetails object
          • error number
          • noReport number
          • successAlreadyOK number
          • successNotApplicable number
          • successRepaired number
          • unexpectedMissingComponent number
          • unexpectedUnknownComponent number
    • result required string (values: success, error): Result of the request

getNodesCompliance

Get current compliance of all the nodes of a Rudder server

rudder_example_local.getNodesCompliance({}, context)

Input

  • input object
    • level integer: Number of depth level of compliance objects to display (1:rules, 2:directives, 3:components, 4:nodes, 5:values, 6:reports)

Output

  • output object
    • action required string (values: getNodesCompliance): The id of the action
    • data required object
      • nodes required array
        • items object
          • compliance required number: Rule compliance level
          • complianceDetails required object
            • error number
            • noReport number
            • successAlreadyOK number
            • successNotApplicable number
            • successRepaired number
            • unexpectedMissingComponent number
            • unexpectedUnknownComponent number
          • id required string: id of the node
          • mode required string (values: full-compliance, changes-only, reports-disabled)
    • result required string (values: success, error): Result of the request

getNodeCompliance

Get current compliance of a node of a Rudder server

rudder_example_local.getNodeCompliance({
  "nodeId": ""
}, context)

Input

  • input object
    • level integer: Number of depth level of compliance objects to display (1:rules, 2:directives, 3:components, 4:nodes, 5:values, 6:reports)
    • nodeId required string: Id of the target node

Output

  • output object
    • action required string (values: getNodeCompliance): The id of the action
    • data required object
      • nodes required array
        • items object
          • compliance required number: Rule compliance level
          • complianceDetails required object
            • error number
            • noReport number
            • successAlreadyOK number
            • successNotApplicable number
            • successRepaired number
            • unexpectedMissingComponent number
            • unexpectedUnknownComponent number
          • id required string: id of the node
          • mode required string (values: full-compliance, changes-only, reports-disabled)
    • result required string (values: success, error): Result of the request

getRulesCompliance

Get current compliance of all the rules of a Rudder server

rudder_example_local.getRulesCompliance({}, context)

Input

  • input object
    • level integer: Number of depth level of compliance objects to display (1:rules, 2:directives, 3:components, 4:nodes, 5:values, 6:reports)

Output

  • output object
    • action required string (values: getRulesCompliance): The id of the action
    • data required object
      • rules required array
        • items object
          • compliance required number: Rule compliance level
          • complianceDetails required object
            • error number
            • noReport number
            • successAlreadyOK number
            • successNotApplicable number
            • successRepaired number
            • unexpectedMissingComponent number
            • unexpectedUnknownComponent number
          • id required string: id of the rule
          • mode required string (values: full-compliance, changes-only, reports-disabled)
    • result required string (values: success, error): Result of the request

getRuleCompliance

Get current compliance of a rule of a Rudder server

rudder_example_local.getRuleCompliance({
  "ruleId": ""
}, context)

Input

  • input object
    • level integer: Number of depth level of compliance objects to display (1:rules, 2:directives, 3:components, 4:nodes, 5:values, 6:reports)
    • ruleId required string: Id of the target rule

Output

  • output object
    • action required string (values: getRuleCompliance): The id of the action
    • data required object
      • rules required array
        • items object
          • compliance required number: Rule compliance level
          • complianceDetails required object
            • error number
            • noReport number
            • successAlreadyOK number
            • successNotApplicable number
            • successRepaired number
            • unexpectedMissingComponent number
            • unexpectedUnknownComponent number
          • id required string: id of the rule
          • mode required string (values: full-compliance, changes-only, reports-disabled)
    • result required string (values: success, error): Result of the request

createNodes

Create a new node

rudder_example_local.createNodes({}, context)

Input

  • input object

Output

  • output object
    • action required string (values: createNodes): The id of the action
    • data required object
      • created required array
        • items string: created nodes ID
      • failed required array
        • items string: failed nodes ID
    • result required string (values: success, error): Result of the request

getAllCve

Get all CVE details

rudder_example_local.getAllCve(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: getAllCve): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

checkCVE

Trigger a CVE check

rudder_example_local.checkCVE(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: checkCVE): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

getCVECheckConfiguration

Get CVE check config

rudder_example_local.getCVECheckConfiguration(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: getCVECheckConfiguration): The id of the action
    • data required object
      • apiKey string: Token used by to contact the API to check CVE
      • url string: Url used to check CVE
    • result required string (values: success, error): Result of the request

updateCVECheckConfiguration

Update cve check config

rudder_example_local.updateCVECheckConfiguration({}, context)

Input

  • input object
    • body object: CVE check config
      • apiKey string: Token used by to contact the API to check CVE
      • url string: Url used to check CVE

Output

  • output object
    • action required string (values: updateCVECheckConfiguration): The id of the action
    • data required object
      • apiKey string: Token used by to contact the API to check CVE
      • url string: Url used to check CVE
    • result required string (values: success, error): Result of the request

getLastCVECheck

Get last CVE check result

rudder_example_local.getLastCVECheck(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: getLastCVECheck): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

getCVEList

Get CVE details, from a list passed a paremeter

rudder_example_local.getCVEList({}, context)

Input

  • input object
    • body object: cveList
      • cveIds array
        • items string: CVE id

Output

  • output object
    • action required string (values: getCVEList): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

updateCVE

Update CVE database from remote source

rudder_example_local.updateCVE({}, context)

Input

  • input object
    • body object: CVE update config
      • url string: Url used to update CVE, will default to one set in config
      • years array
        • items string: Year of the CVE archive to download

Output

  • output object
    • action required string (values: updateCVE): The id of the action
    • data required object
      • CVEs required integer
    • result required string (values: success, error): Result of the request

readCVEfromFS

Update CVE database from file system

rudder_example_local.readCVEfromFS(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: readCVEfromFS): The id of the action
    • data required object
      • CVEs required integer
    • result required string (values: success, error): Result of the request

getAllDataSources

Get the configuration of all present data sources

rudder_example_local.getAllDataSources(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: getAllDataSources): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

createDataSource

Create a new data source

rudder_example_local.createDataSource({}, context)

Input

Output

  • output object
    • action required string (values: createDataSource): The id of the action
    • data required object: Information about the data sources
    • result required string (values: success, error): Result of the request

ReloadAllDatasourcesAllNodes

Update properties from all data source on all nodes. The call is asynchronous.

rudder_example_local.ReloadAllDatasourcesAllNodes(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: ReloadAllDatasourcesAllNodes): The id of the action
    • data required string
    • result required string (values: success, error): Result of the request

ReloadOneDatasourceAllNodes

Update properties from all data source on all nodes. The call is asynchronous.

rudder_example_local.ReloadOneDatasourceAllNodes({
  "datasourceId": ""
}, context)

Input

  • input object
    • datasourceId required string: Id of the data source

Output

  • output object
    • action required string (values: ReloadOneDatasourceAllNodes): The id of the action
    • data required string
    • result required string (values: success, error): Result of the request

deleteDataSource

Delete a data source configuration

rudder_example_local.deleteDataSource({
  "datasourceId": ""
}, context)

Input

  • input object
    • datasourceId required string: Id of the data source

Output

  • output object
    • action required string (values: deleteDataSource): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

getDataSource

Get the configuration of a data source

rudder_example_local.getDataSource({
  "datasourceId": ""
}, context)

Input

  • input object
    • datasourceId required string: Id of the data source

Output

  • output object
    • action required string (values: getDataSource): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

updateDataSource

Update the configuration of a data source

rudder_example_local.updateDataSource({
  "datasourceId": ""
}, context)

Input

  • input object
    • datasourceId required string: Id of the data source
    • body datasource

Output

  • output object
    • action required string (values: updateDataSource): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

listDirectives

List all directives

rudder_example_local.listDirectives(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: listDirectives): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

createDirective

Create a new directive from provided parameters. You can specify a source directive to clone it.

rudder_example_local.createDirective({}, context)

Input

Output

  • output object
    • action required string (values: createDirective): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

deleteDirective

Delete a directive

rudder_example_local.deleteDirective({
  "directiveId": ""
}, context)

Input

  • input object
    • directiveId required string: Id of the directive

Output

  • output object
    • action required string (values: deleteDirective): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

directiveDetails

Get all information about a given directive

rudder_example_local.directiveDetails({
  "directiveId": ""
}, context)

Input

  • input object
    • directiveId required string: Id of the directive

Output

  • output object
    • action required string (values: directiveDetails): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

updateDirective

Update directive information

rudder_example_local.updateDirective({
  "directiveId": ""
}, context)

Input

  • input object
    • directiveId required string: Id of the directive
    • displayName string: Human readable name of the directive
    • enabled boolean: Is the directive enabled
    • id string: Directive id
    • longDescription string: Description of the technique (rendered as markdown)
    • parameters object: Directive parameters (depends on the source technique)
    • policyMode string (values: enforce, audit): Policy mode of the directive
    • priority integer: Directive priority. 0 has highest priority.
    • shortDescription string: One line directive description
    • system boolean: If true it is an internal Rudder directive
    • tags array
    • techniqueName string: Directive id
    • techniqueVersion string: Directive id

Output

  • output object
    • action required string (values: updateDirective): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

checkDirective

Check that update on a directive is valid

rudder_example_local.checkDirective({
  "directiveId": ""
}, context)

Input

  • input object
    • directiveId required string: Id of the directive
    • displayName string: Human readable name of the directive
    • enabled boolean: Is the directive enabled
    • id string: Directive id
    • longDescription string: Description of the technique (rendered as markdown)
    • parameters object: Directive parameters (depends on the source technique)
    • policyMode string (values: enforce, audit): Policy mode of the directive
    • priority integer: Directive priority. 0 has highest priority.
    • shortDescription string: One line directive description
    • system boolean: If true it is an internal Rudder directive
    • tags array
    • techniqueName string: Directive id
    • techniqueVersion string: Directive id

Output

  • output object
    • action required string (values: checkDirective): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

listGroups

List all groups

rudder_example_local.listGroups(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: listGroups): The id of the action
    • data required object
      • groups required array
    • result required string (values: success, error): Result of the request

createGroup

Create a new group based in provided parameters

rudder_example_local.createGroup({}, context)

Input

Output

  • output object
    • action required string (values: createGroup): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

CreateGroupCategory

Create a new group category

rudder_example_local.CreateGroupCategory({
  "name": "",
  "parent": ""
}, context)

Input

  • input object
    • description string: Group category description
    • id string: Group category id, only provide it when needed.
    • name required string: Name of the group category
    • parent required string: The parent category of the groups

Output

  • output object
    • action required string (values: CreateGroupCategory): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

DeleteGroupCategory

Delete a group category. It must have no child groups and no children categories.

rudder_example_local.DeleteGroupCategory({
  "groupCategoryId": ""
}, context)

Input

  • input object
    • groupCategoryId required string: Group category id

Output

  • output object
    • action required string (values: DeleteGroupCategory): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

GetGroupCategoryDetails

Get detailed information about a group category

rudder_example_local.GetGroupCategoryDetails({
  "groupCategoryId": ""
}, context)

Input

  • input object
    • groupCategoryId required string: Group category id

Output

  • output object
    • action required string (values: GetGroupCategoryDetails): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

UpdateGroupCategory

Update detailed information about a group category

rudder_example_local.UpdateGroupCategory({
  "groupCategoryId": "",
  "name": "",
  "parent": ""
}, context)

Input

  • input object
    • groupCategoryId required string: Group category id
    • description string: Group category description
    • name required string: Name of the group category
    • parent required string: The parent category of the groups

Output

  • output object
    • action required string (values: UpdateGroupCategory): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

GetGroupTree

Get all available groups and their categories in a tree

rudder_example_local.GetGroupTree(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: GetGroupTree): The id of the action
    • data required object
      • groupCategories required object: Group tree
    • result required string (values: success, error): Result of the request

deleteGroup

Update detailed information about a group

rudder_example_local.deleteGroup({
  "groupId": ""
}, context)

Input

  • input object
    • groupId required string: Id of the group

Output

  • output object
    • action required string (values: deleteGroup): The id of the action
    • data required object
      • groups required array
    • result required string (values: success, error): Result of the request

groupDetails

Get detailed information about a group

rudder_example_local.groupDetails({
  "groupId": ""
}, context)

Input

  • input object
    • groupId required string: Id of the group

Output

  • output object
    • action required string (values: groupDetails): The id of the action
    • data required object
      • groups required array
    • result required string (values: success, error): Result of the request

updateGroup

Update detailed information about a group

rudder_example_local.updateGroup({
  "groupId": ""
}, context)

Input

  • input object
    • groupId required string: Id of the group
    • category string: Id of the new group's category
    • description string: Group description
    • displayName string: Name of the group
    • dynamic boolean: Should the group be dynamically refreshed (if not, it is a static group)
    • enabled boolean: Enable or disable the group
    • query object: The criteria defining the group. If not provided, the group will be empty.

Output

  • output object
    • action required string (values: updateGroup): The id of the action
    • data required object
      • groups required array
    • result required string (values: success, error): Result of the request

reloadGroup

Recompute the content of a group

rudder_example_local.reloadGroup({
  "groupId": ""
}, context)

Input

  • input object
    • groupId required string: Id of the group

Output

  • output object
    • action required string (values: reloadGroup): The id of the action
    • data required object
      • groups required array
    • result required string (values: success, error): Result of the request

queueInformation

Provide information about the current state of the inventory processor

rudder_example_local.queueInformation(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: queueInformation): The id of the action
    • data required object: Information about the service
      • queueMaxSize required integer
      • queueSaturated required boolean: Is the inventory queue full
    • result required string (values: success, error): Result of the request

uploadInventory

Upload an inventory to the web application

rudder_example_local.uploadInventory({}, context)

Input

  • input object
    • file string
    • signature string

Output

  • output object
    • action required string (values: uploadInventory): The id of the action
    • data required string
    • result required string (values: success, error): Result of the request

fileWatcherRestart

Restart the inventory watcher if necessary

rudder_example_local.fileWatcherRestart(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: fileWatcherRestart): The id of the action
    • data required string
    • result required string (values: success, error): Result of the request

fileWatcherStart

Start the inventory watcher if necessary

rudder_example_local.fileWatcherStart(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: fileWatcherStart): The id of the action
    • data required string
    • result required string (values: success, error): Result of the request

fileWatcherStop

Stop the inventory watcher if necessary

rudder_example_local.fileWatcherStop(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: fileWatcherStop): The id of the action
    • data required string
    • result required string (values: success, error): Result of the request

listAcceptedNodes

Get information about the nodes managed by the target server

rudder_example_local.listAcceptedNodes({}, context)

Input

  • input object
    • include string: 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.
    • composition string (values: and, or): Boolean operator to use between each where criteria.
    • select string: What kind of data we want to include. Here we can get policy servers/relay by setting nodeAndPolicyServer. Only used if where is defined.

Output

  • output object
    • action required string (values: listAcceptedNodes): The id of the action
    • data required object: Information about the nodes
    • result required string (values: success, error): Result of the request

applyPolicyAllNodes

This API allows to trigger an agent run on all nodes. Response contains a json stating if agent could be started on each node, but not if the run went fine and do not display any output from it. You can see the result of the run in Rudder web interface or in the each agent logs.

rudder_example_local.applyPolicyAllNodes(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: applyPolicyAllNodes): The id of the action
    • data required array
      • items object
        • hostname string: Node hostname
        • id string: Rudder id of the node
        • result string: Result or policy application trigger
    • result required string (values: success, error): Result of the request

changePendingNodeStatus

Accept or refuse a pending node

rudder_example_local.changePendingNodeStatus({
  "nodeId": ""
}, context)

Input

  • input object
    • nodeId required string: Id of the target node
    • status string (values: accepted, refused): New status of the pending node

Output

  • output object
    • action required string (values: changePendingNodeStatus): The id of the action
    • data required object: Information about the node
    • result required string (values: success, error): Result of the request

deleteNode

Remove a node from the Rudder server. It won't be managed anymore.

rudder_example_local.deleteNode({
  "nodeId": ""
}, context)

Input

  • input object
    • nodeId required string: Id of the target node

Output

  • output object
    • action required string (values: deleteNode): The id of the action
    • data required object: Information about the node
    • result required string (values: success, error): Result of the request

nodeDetails

Get details about a given node

rudder_example_local.nodeDetails({
  "nodeId": ""
}, context)

Input

  • input object
    • nodeId required string: Id of the target node
    • include string: 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.

Output

  • output object
    • action required string (values: nodeDetails): The id of the action
    • data required object: Information about the node
    • result required string (values: success, error): Result of the request

updateNode

Update node settings and properties

rudder_example_local.updateNode({
  "nodeId": ""
}, context)

Input

  • input object

Output

  • output object
    • action required string (values: updateNode): The id of the action
    • data required object: Information about the node
    • result required string (values: success, error): Result of the request

applyNode

This API allows to trigger an agent run on the target node. Response is a stream of the actual agent run on the node.

rudder_example_local.applyNode({
  "nodeId": ""
}, context)

Input

  • input object
    • nodeId required string: Id of the target node

Output

  • output string

ReloadAllDatasourcesOneNode

Update properties from all data sources on one nodes. The call is asynchronous.

rudder_example_local.ReloadAllDatasourcesOneNode({
  "nodeId": ""
}, context)

Input

  • input object
    • nodeId required string: Id of the target node

Output

  • output object
    • action required string (values: ReloadAllDatasourcesOneNode): The id of the action
    • data required string
    • result required string (values: success, error): Result of the request

ReloadOneDatasourceOneNode

Update properties from a data source on one nodes. The call is asynchronous.

rudder_example_local.ReloadOneDatasourceOneNode({
  "nodeId": "",
  "datasourceId": ""
}, context)

Input

  • input object
    • nodeId required string: Id of the target node
    • datasourceId required string: Id of the data source

Output

  • output object
    • action required string (values: ReloadOneDatasourceOneNode): The id of the action
    • data required string
    • result required string (values: success, error): Result of the request

listParameters

Get the current value of all the global parameters

rudder_example_local.listParameters(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: listParameters): The id of the action
    • data required object: Parameters
    • result required string (values: success, error): Result of the request

createParameter

Create a new global parameter

rudder_example_local.createParameter({
  "id": ""
}, context)

Input

  • input object
    • description string: Description of the parameter
    • id required string: Name of the parameter
    • overridable boolean: Is the global parameter overridable by node

Output

  • output object
    • action required string (values: createParameter): The id of the action
    • data required object: Parameters
    • id required string: Id of the parameter
    • result required string (values: success, error): Result of the request

deleteParameter

Delete an existing parameter

rudder_example_local.deleteParameter({
  "parameterId": ""
}, context)

Input

  • input object
    • parameterId required string: Id of the parameter to manage

Output

  • output object
    • action required string (values: deleteParameter): The id of the action
    • data required object: Parameters
    • id required string: Id of the parameter
    • result required string (values: success, error): Result of the request

parameterDetails

Get the current value of a given parameter

rudder_example_local.parameterDetails({
  "parameterId": ""
}, context)

Input

  • input object
    • parameterId required string: Id of the parameter to manage

Output

  • output object
    • action required string (values: parameterDetails): The id of the action
    • data required object: Parameters
    • id required string: Id of the parameter
    • result required string (values: success, error): Result of the request

updateParameter

Update the properties of a parameter

rudder_example_local.updateParameter({
  "parameterId": ""
}, context)

Input

  • input object
    • parameterId required string: Id of the parameter to manage

Output

  • output object
    • action required string (values: updateParameter): The id of the action
    • data required object: Parameters
    • id required string: Id of the parameter
    • result required string (values: success, error): Result of the request

regeneratePolicies

Trigger a full policy generation

rudder_example_local.regeneratePolicies(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: regeneratePolicies): The id of the action
    • data required object
      • policies required string (values: Started)
    • result required string (values: success, error): Result of the request

reloadGroups

Reload dynamic groups

rudder_example_local.reloadGroups(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: reloadGroups): The id of the action
    • data required object
      • groups required string (values: Started)
    • result required string (values: success, error): Result of the request

reloadTechniques

Reload techniques from local technique library

rudder_example_local.reloadTechniques(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: reloadTechniques): The id of the action
    • data required object
      • techniques required string (values: Started)
    • result required string (values: success, error): Result of the request

listRules

List all rules

rudder_example_local.listRules(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: listRules): The id of the action
    • data required object
      • rules required array
    • result required string (values: success, error): Result of the request

createRule

Create a new rule. You can specify a source rule to clone it.

rudder_example_local.createRule({}, context)

Input

Output

  • output object
    • action required string (values: createRule): The id of the action
    • data required object
      • rules required array
    • result required string (values: success, error): Result of the request

CreateRuleCategory

Create a new rule category

rudder_example_local.CreateRuleCategory({
  "name": "",
  "parent": ""
}, context)

Input

  • input object
    • description string: Rules category description
    • id string: Rule category id, only provide it when needed.
    • name required string: Name of the rule category
    • parent required string: The parent category of the rules

Output

  • output object
    • action required string (values: CreateRuleCategory): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

DeleteRuleCategory

Delete a group category. It must have no child groups and no children categories.

rudder_example_local.DeleteRuleCategory({
  "ruleCategoryId": ""
}, context)

Input

  • input object
    • ruleCategoryId required string: Rule category id

Output

  • output object
    • action required string (values: DeleteRuleCategory): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

GetRuleCategoryDetails

Get detailed information about a rule category

rudder_example_local.GetRuleCategoryDetails({
  "ruleCategoryId": ""
}, context)

Input

  • input object
    • ruleCategoryId required string: Rule category id

Output

  • output object
    • action required string (values: GetRuleCategoryDetails): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

UpdateRuleCategory

Update detailed information about a rule category

rudder_example_local.UpdateRuleCategory({
  "ruleCategoryId": "",
  "name": "",
  "parent": ""
}, context)

Input

  • input object
    • ruleCategoryId required string: Rule category id
    • description string: Rules category description
    • name required string: Name of the rule category
    • parent required string: The parent category of the rules

Output

  • output object
    • action required string (values: UpdateRuleCategory): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

GetRuleTree

Get all available rules and their categories in a tree

rudder_example_local.GetRuleTree(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: GetRuleTree): The id of the action
    • data required object
      • ruleCategories required object: Rule tree
    • result required string (values: success, error): Result of the request

deleteRule

Delete a rule.

rudder_example_local.deleteRule({
  "ruleId": ""
}, context)

Input

  • input object
    • ruleId required string: Id of the target rule

Output

  • output object
    • action required string (values: deleteRule): The id of the action
    • data required object
      • rules required array
    • result required string (values: success, error): Result of the request

ruleDetails

Get the details of a rule

rudder_example_local.ruleDetails({
  "ruleId": ""
}, context)

Input

  • input object
    • ruleId required string: Id of the target rule

Output

  • output object
    • action required string (values: ruleDetails): The id of the action
    • data required object
      • rules required array
    • result required string (values: success, error): Result of the request

updateRule

Update the details of a rule

rudder_example_local.updateRule({
  "ruleId": ""
}, context)

Input

  • input object
    • ruleId required string: Id of the target rule
    • category string: The parent category id.
    • directives array: Directives linked to the rule
    • displayName string: Rule name
    • enabled boolean: Is the rule enabled
    • id string: Rule id
    • longDescription string: Rule documentation
    • shortDescription string: One line rule description
    • system boolean: If true it is an internal Rudder rule
    • tags array
    • targets array: Groups linked to the rule

Output

  • output object
    • action required string (values: updateRule): The id of the action
    • data required object
    • result required string (values: success, error): Result of the request

promoteToRelay

Promote a node to relay

rudder_example_local.promoteToRelay({
  "nodeId": ""
}, context)

Input

  • input object
    • nodeId required string: Id of the target node

Output

  • output object
    • action required string (values: promoteToRelay): The id of the action
    • data required string: Success or error message
    • result required string (values: success, error): Result of the request

getAllSettings

Get the current value of all the settings

rudder_example_local.getAllSettings(null, context)

Input

This action has no parameters

Output

  • output object
    • action required string (values: getAllSettings): The id of the action
    • data required object: Information about the setting
      • settings required object
        • allowed_networks array: List of allowed networks for each policy server (root and relays)
          • items object
            • allowed_networks array: List of allowed networks
            • id string: Rudder id of the policy server
        • change_message_prompt string: Explanation to display
        • display_recent_changes_graphs boolean: Display changes graphs
        • enable_change_message boolean: Enable change audit logs
        • enable_change_request boolean: Enable Change Requests
        • enable_javascript_directives string: Enable script evaluation in Directives
        • enable_self_deployment boolean: Allow self deployment
        • enable_self_validation boolean: Allow self validation
        • first_run_hour integer: First agent run time - hour
        • first_run_minute integer: First agent run time - minute
        • global_policy_mode string (values: enforce, audit): Define the default setting for global policy mode
        • global_policy_mode_overridable boolean: Allow overrides on this default setting
        • heartbeat_frequency integer: Send heartbeat every heartbeat_frequency runs (only on changes-only compliance mode)
        • log_all_reports boolean: Log all reports received to /var/log/rudder/reports/all.log
        • mandatory_change_message boolean: Make message mandatory
        • modified_file_ttl integer: Number of days to retain modified files
        • node_accept_duplicated_hostname boolean: Allow acceptation of a pending node when another one with the same hostname is already accepted
        • node_onaccept_default_policyMode string (values: default, enforce, audit): Default policy mode for accepted node
        • node_onaccept_default_state string (values: enabled, ignored, empty-policies, initializing, preparing-eol): Set default state for node when they are accepted within Rudder
        • output_file_ttl integer: Number of days to retain agent output files
        • relay_server_synchronization_method string (values: classic, rsync, disabled): 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 boolean: 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 boolean: 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.
        • reporting_mode string (values: full-compliance, changes-only, reports-disabled): Compliance reporting mode
        • require_time_synchronization boolean: Require time synchronization between nodes and policy server
        • rsyslog_reporting_protocol string (values: TCP, UDP): Protocol used for syslog communication between node and server
        • rudder_compute_changes boolean: Compute list of changes (repaired reports) per rule
        • rudder_generation_compute_dyngroups boolean: Recompute all dynamic groups at the start of policy generation
        • rudder_generation_continue_on_error boolean: Policy generation continues on error during NodeConfiguration evaluation
        • rudder_generation_js_timeout integer: Policy generation JS evaluation of directive parameter timeout in seconds
        • rudder_generation_max_parallelism string: 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_report_protocol_default string (values: HTTPS, SYSLOG): Default reporting protocol used
        • rudder_save_db_compliance_details boolean: Store all compliance details in database
        • rudder_save_db_compliance_levels boolean: Store all compliance levels in database
        • run_frequency integer: Agent run schedule - time between agent runs (in minutes)
        • send_metrics string: Send anonymous usage statistics
        • splay_time integer: Maximum delay after scheduled run time (random interval)
        • syslog_protocol_disabled boolean: Completely disable syslog protocol
        • unexpected_allows_duplicate boolean: Ignore duplicated compliance reports
        • unexpected_unbound_var_values boolean: Allows multiple reports for configuration based on a multivalued variable
    • result required string (values: success, error): Result of the request

getSetting

Get the current value of a specific setting

rudder_example_local.getSetting({
  "settingId": ""
}, context)

Input

  • input object
    • settingId required string: Id of the setting to set

Output

  • output object
    • action required string (values: getSetting): The id of the action
    • data required object: Information about the setting
      • settingId string: Id and value of the property
    • id required string: Id of the setting
    • result required string (values: success, error): Result of the request

modifySetting

Set the current value of a specific setting

rudder_example_local.modifySetting({
  "settingId": ""
}, context)

Input

  • input object
    • settingId required string: Id of the setting to set
    • value string: New value of the setting

Output

  • output object
    • action required string (values: modifySetting): The id of the action
    • data required object: Information about the setting
      • settingId string: Id and value of the property
    • id required string: Id of the setting
    • result required string (values: success, error): Result of the request

listArchives

List configuration archives

rudder_example_local.listArchives({
  "archiveKind": ""
}, context)

Input

  • input object
    • archiveKind required string (values: full, groups, rules, directives, parameters): Type of archive to make

Output

  • output object
    • action required string (values: archiveFull, archiveGroups, archiveRules, archiveDirectives, archiveParameters): The kind of the archive
    • data required object
      • full required array
        • items object
          • commiter required string
          • gitCommit required string
          • id required string
    • result required string (values: success, error): Result of the request

createArchive

Create new archive of the given kind

rudder_example_local.createArchive({
  "archiveKind": ""
}, context)

Input

  • input `ob