Project

General

Profile

User story #6137

Updated by François ARMAND over 9 years ago

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: 
 <pre> 
       { 
         "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" 
                           } 
                         ] 
                       } 
                     ] 
                   } 
                 ] 
               } 
             ] 
           } 
         ] 
       } 
 </pre> 

 And for a rule, the hierarchy would be: Rule -> Directives -> Components -> Nodes -> Values, like: 
 <pre> 
       { 
         "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" 
                           } 
                         ] 
                       } 
                     ] 
                   } 
                 ] 
               } 
             ] 
           } 
         ] 
       } 
 </pre> 
 

Back