- If the policy module does not exist, it is created.
- If the policy module already exists, it is replaced.
If the policy module isn't correctly defined, a bad request (400) response is returned.
643 matches
14 actions
Open Policy Agent (OPA) REST
14 actions
Other/Open Policy Agent (OPA) REST
If the policy module isn't correctly defined, a bad request (400) response is returned.
package opa.examples
import data.serversimport data.networksimport data.ports
public_servers[server] { some k, m server := servers[_] server.ports[_] == ports[k].id ports[k].networks[_] == networks[m].id networks[m].public == true}{
"type": "object",
"properties": {
"metrics": {
"type": "boolean"
},
"pretty": {
"type": "boolean"
}
},
"additionalProperties": false
}{
"type": "object",
"properties": {
"result": {
"type": "array",
"items": {
"properties": {
"ast": {
"type": "object",
"description": "The types for declarations and runtime objects passed to your implementation. This consists of an abstract syntax tree (AST) of policy modules, package and import declarations, rules, expressions, and terms.",
"properties": {
"package": {
"type": "object",
"properties": {
"path": {
"type": "array",
"description": "The path to the package",
"items": {
"properties": {
"type": {
"type": "string",
"description": "The type of the path operation",
"enum": [
"import",
"package"
]
},
"value": {
"type": "string",
"description": "The path variable"
}
}
}
}
}
},
"rules": {
"type": "array",
"description": "When OPA evaluates a rule, it generates the content of a [virtual documents](https://www.openpolicyagent.org/docs/latest/philosophy/#the-opa-document-model)",
"items": {
"properties": {
"body": {
"type": "array",
"description": "A list of the terms in this rule",
"items": {
"properties": {
"index": {
"type": "object",
"additionalProperties": true
},
"terms": {
"type": "object",
"additionalProperties": true
}
}
}
},
"head": {
"type": "object",
"properties": {
"key": {
"type": "object",
"description": "The type/value pairing for this rule's head",
"properties": {
"type": {
"type": "object",
"additionalProperties": true
},
"value": {
"type": "object",
"additionalProperties": true
}
}
},
"name": {
"type": "string",
"description": "The head of the rule"
}
}
}
}
}
}
}
},
"id": {
"type": "string",
"description": "The name of a policy module"
},
"raw": {
"type": "string",
"description": "A string representation of the full Rego policy"
}
}
}
}
}
}