Project

General

Profile

Actions

User story #6137

closed

Retrieve compliance from the API

Added by Benoît PECCATTE almost 10 years ago. Updated over 9 years ago.

Status:
Released
Priority:
1 (highest)
Category:
API
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:

Description

I want to be able to get the compliance of a given node from the API.
And maybe be get the global compliance status too.

The proposed endpoints are:

GET .../api/latest/compliance/nodes
=> return the list of compliance by node for all nodes, see proposed format belove
GET .../api/latest/compliance/nodes/UUID-OF-NODE
=> return the list of compliance for the node with the given UUID, see proposed format belove
GET .../api/latest/compliance/rules
=> return the list of compliance by rule for all rules, see proposed format belove
GET .../api/latest/compliance/rules/UUID-OF-RULE
=> return the list of compliance for the rule with the given UUID, see proposed format belove

The name of the compliance level would bi:
- successNotApplicable
- successAlreadyOK
- successRepaired
- error
- unexpectedUnknownComponent
- unexpectedMissingComponent
- noReport
- applaying

For a node, we will have the hierarchy: Node -> Rules -> Directives -> Components -> Values, like:

      {
        "id": "root",
        "compliance": {
          "successAlreadyOK": 100
        },
        "rules": [
          {
            "id": "2278f76f-28d3-4326-8199-99561dd8c785",
            "compliance": {
              "successAlreadyOK": 100
            },
            "directives": [
              {
                "id": "ab459975-7116-40ad-aab7-6479694ff606",
                "compliance": {
                  "successAlreadyOK": 100
                },
                "components": [
                  {
                    "name": "MOTD Configuration",
                    "compliance": {
                      "successAlreadyOK": 100
                    },
                    "values": [
                      {
                        "value": "None",
                        "reports": [
                          {
                            "status": "successAlreadyOK" 
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }

And for a rule, the hierarchy would be: Rule -> Directives -> Components -> Nodes -> Values, like:

      {
        "id": "inventory-all",
        "compliance": {
          "successAlreadyOK": 33.33,
          "noReport": 66.67
        },
        "directives": [
          {
            "id": "inventory-all",
            "compliance": {
              "successAlreadyOK": 33.33,
              "noReport": 66.67
            },
            "components": [
              {
                "name": "inventory",
                "compliance": {
                  "successAlreadyOK": 33.33,
                  "noReport": 66.67
                },
                "nodes": [
                  {
                    "id": "729be5c4-55a2-4b97-8529-5154cbb63a18",
                    "values": [
                      {
                        "value": "None",
                        "reports": [
                          {
                            "status": "noReport" 
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "id": "0876521e-3c81-4775-85c7-5dd7f9d5d3da",
                    "values": [
                      {
                        "value": "None",
                        "reports": [
                          {
                            "status": "noReport" 
                          }
                        ]
                      }
                    ]
                  },
                  {
                    "id": "root",
                    "values": [
                      {
                        "value": "None",
                        "reports": [
                          {
                            "status": "successAlreadyOK" 
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }


Subtasks 1 (0 open1 closed)

Bug #6753: Compliance API throws exceptionReleasedNicolas CHARLES2015-06-12Actions
Actions

Also available in: Atom PDF