Project

General

Profile

Actions

Bug #6221

closed

Format of the query to update groups via API is not documented

Added by François ARMAND about 9 years ago. Updated about 7 years ago.

Status:
Rejected
Priority:
1
Category:
Documentation
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Name check:
Fix check:
Regression:

Description

In the API documentation, the "query" for groups update (see http://www.rudder-project.org/rudder-api-doc/#api-Groups-createGroup) is not documented.


Related issues 1 (0 open1 closed)

Has duplicate Rudder - User story #10299: API Doc missing possibilities of New Group's query syntaxResolvedActions
Actions #1

Updated by François ARMAND about 9 years ago

  • Description updated (diff)

The json structure is organized like that:

"select" : mandatory value,  "node" or "nodeAndPolicyServer" 
"composition": either "and" or "or". Optionnal, default to "and"
"where": an array of json objects composed of:
"objectType": the kind of object to look for. They are all defined in https://github.com/Normation/rudder/blob/branches/rudder/3.0/rudder-core/src/main/scala/com/normation/rudder/domain/queries/DitQueryData.scala around line #280 (def objectTypes = Map... ). Some interesting ones:
node : for all the OS, RAM, etc
environmentVariable
software
"attribute": the name of the attribute to lookup for the given object. The possible names are defined in DitQueryData to: it's the huge list of "ObjectCriterion". Problem: most use name defined elsewhere in the form of "A_OS_VERSION" etc. The name are defined in one the two files:
https://github.com/Normation/ldap-inventory/blob/branches/rudder/3.0/inventory-repository/src/main/scala/com/normation/inventory/ldap/core/LDAPConstants.scala
https://github.com/Normation/rudder/blob/branches/rudder/3.0/rudder-core/src/main/scala/com/normation/rudder/domain/RudderLDAPConstants.scala
"comparator": the kind of comparator to use:
exits / notExists: only check the presence of that kind of attribute for the object in the node
eq: equals
notEq: not equals
gt / gteq: greater than / greater or equals
lt / lteq : lesser than / lesser or equals
regex: match the given pattern. The authorized regex are the Java one, as defined in http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
notRegex : all entries not matching the given regex
and there is a special syntax for key=value objects, like "environmentVariable". For them, you use the attribute "name.value", the comparator to use, with a new one:
hasKey: to only check for the key part equals the given value
else, the comparison is done on "key=value", and you can do almost anything with regex
Ex: {"select":"nodeAndPolicyServer","composition":"And","where":[{"objectType":"environmentVariable","attribute":"name.value","comparator":"regex","value":".*NAME=r[o]{2}t"}]}

There is example in the tests for query:
https://github.com/Normation/rudder/blob/branches/rudder/3.0/rudder-core/src/test/scala/com/normation/rudder/services/queries/TestJsonQueryLexing.scala
https://github.com/Normation/rudder/blob/branches/rudder/3.0/rudder-core/src/test/scala/com/normation/rudder/services/queries/TestQueryProcessor.scala

So, if you read until hear, you now see that the current format is quite ad-hoc - or more preciselly, it reflects far to much the underlying storage format.
A more versatile version is think about, based on the JSON format of the node details returned by the API and a XPATH kind of query. But well, it's not for now, and the current language is already in the nature, so it will be supported :)
At least, in 3.1 we are going to try to normalize object and attribute names so that they match the names in the node details returned by the API.

Actions #2

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.10 to 2.10.11
Actions #3

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.11 to 2.10.12
Actions #4

Updated by François ARMAND about 9 years ago

  • Category changed from API to Documentation
  • Reproduced set to No
Actions #5

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.12 to 2.10.13
Actions #6

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.13 to 2.10.14
Actions #7

Updated by Vincent MEMBRÉ almost 9 years ago

  • Target version changed from 2.10.14 to 2.10.15
Actions #8

Updated by Vincent MEMBRÉ almost 9 years ago

  • Target version changed from 2.10.15 to 2.10.16
Actions #9

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.10.16 to 2.10.17
Actions #10

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.10.17 to 2.10.18
Actions #11

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.10.18 to 2.10.19
Actions #12

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.10.19 to 2.10.20
Actions #13

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.10.20 to 277
Actions #14

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 277 to 2.11.18
Actions #15

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 2.11.18 to 2.11.19
Actions #16

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 2.11.19 to 2.11.20
Actions #17

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 2.11.20 to 2.11.21
Actions #18

Updated by Vincent MEMBRÉ almost 8 years ago

  • Target version changed from 2.11.21 to 2.11.22
Actions #19

Updated by Vincent MEMBRÉ almost 8 years ago

  • Target version changed from 2.11.22 to 2.11.23
Actions #20

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 2.11.23 to 2.11.24
Actions #21

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 2.11.24 to 308
Actions #22

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 308 to 3.1.14
Actions #23

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.14 to 3.1.15
Actions #24

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.15 to 3.1.16
Actions #25

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.16 to 3.1.17
Actions #26

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.17 to 3.1.18
Actions #27

Updated by Vincent MEMBRÉ about 7 years ago

  • Target version changed from 3.1.18 to 3.1.19
Actions #28

Updated by Alexis Mousset about 7 years ago

  • Has duplicate User story #10299: API Doc missing possibilities of New Group's query syntax added
Actions #29

Updated by Alexis Mousset about 7 years ago

  • Status changed from In progress to Rejected

Duplicate of #10299.

Actions

Also available in: Atom PDF