mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-19 00:46:35 +00:00
Add workflow for api gen and refactor genration script (#60)
* update gitignore * add first version of api generation flow * try to run flow * testing flow * update gen flow * switch flow to macOS * fix * add npm install * test workflow * Update API pages * test workflow with current main * refactor parser * merge examples and schema functions * merge examples and schema functions * merge parameters as well * revert template to single class component * update account * finalizing * update with the newest version of openapi * full flow * update * add docker command * split flow in two jobs * remove testing trigger --------- Co-authored-by: GitHub Actions <no-reply@github.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
export const title = 'Policies'
|
||||
|
||||
|
||||
@@ -7,7 +6,7 @@ export const title = 'Policies'
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Returns a list of all Policies
|
||||
Returns a list of all policies
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
@@ -164,16 +163,23 @@ echo $response;
|
||||
```json {{ title: 'Example' }}
|
||||
[
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
@@ -187,17 +193,16 @@ echo $response;
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg"
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
```json {{ title: 'Schema' }}
|
||||
[
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
@@ -208,6 +213,12 @@ echo $response;
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
"action": "string",
|
||||
"bidirectional": "boolean",
|
||||
"protocol": "string",
|
||||
"ports": [
|
||||
"string"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "string",
|
||||
@@ -221,11 +232,9 @@ echo $response;
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
],
|
||||
"action": "string"
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "string"
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
@@ -245,11 +254,18 @@ echo $response;
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Creates a Policy
|
||||
Creates a policy
|
||||
|
||||
#### Request-Body Parameters
|
||||
<Properties>
|
||||
|
||||
<Property name="id" type="string" required={false}
|
||||
|
||||
|
||||
>
|
||||
Policy ID
|
||||
</Property>
|
||||
|
||||
<Property name="name" type="string" required={true}
|
||||
|
||||
|
||||
@@ -278,7 +294,7 @@ echo $response;
|
||||
Policy Rego query
|
||||
</Property>
|
||||
|
||||
<Property name="rules" type="PolicyRule[]" required={true}
|
||||
<Property name="rules" type="PolicyRuleUpdate[]" required={true}
|
||||
|
||||
|
||||
>
|
||||
@@ -295,31 +311,29 @@ curl -X POST https://api.netbird.io/api/policies \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Token <TOKEN>' \
|
||||
--data-raw '{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
}'
|
||||
@@ -328,31 +342,29 @@ curl -X POST https://api.netbird.io/api/policies \
|
||||
```js
|
||||
const axios = require('axios');
|
||||
let data = JSON.stringify({
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -383,31 +395,29 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/policies"
|
||||
payload = json.dumps({
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -438,31 +448,29 @@ func main() {
|
||||
method := "POST"
|
||||
|
||||
payload := strings.NewReader(`{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
}`)
|
||||
@@ -511,31 +519,29 @@ request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
request.body = JSON.dump({
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -548,31 +554,29 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, '{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
}');
|
||||
@@ -601,31 +605,29 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
}',
|
||||
@@ -649,16 +651,23 @@ echo $response;
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
@@ -672,15 +681,14 @@ echo $response;
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg"
|
||||
]
|
||||
}
|
||||
```
|
||||
```json {{ title: 'Schema' }}
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
@@ -691,6 +699,12 @@ echo $response;
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
"action": "string",
|
||||
"bidirectional": "boolean",
|
||||
"protocol": "string",
|
||||
"ports": [
|
||||
"string"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "string",
|
||||
@@ -704,11 +718,9 @@ echo $response;
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
],
|
||||
"action": "string"
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "string"
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
@@ -887,16 +899,23 @@ echo $response;
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
@@ -910,15 +929,14 @@ echo $response;
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg"
|
||||
]
|
||||
}
|
||||
```
|
||||
```json {{ title: 'Schema' }}
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
@@ -929,6 +947,12 @@ echo $response;
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
"action": "string",
|
||||
"bidirectional": "boolean",
|
||||
"protocol": "string",
|
||||
"ports": [
|
||||
"string"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "string",
|
||||
@@ -942,11 +966,9 @@ echo $response;
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
],
|
||||
"action": "string"
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "string"
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
@@ -978,6 +1000,13 @@ echo $response;
|
||||
#### Request-Body Parameters
|
||||
<Properties>
|
||||
|
||||
<Property name="id" type="string" required={false}
|
||||
|
||||
|
||||
>
|
||||
Policy ID
|
||||
</Property>
|
||||
|
||||
<Property name="name" type="string" required={true}
|
||||
|
||||
|
||||
@@ -1006,7 +1035,7 @@ echo $response;
|
||||
Policy Rego query
|
||||
</Property>
|
||||
|
||||
<Property name="rules" type="PolicyRule[]" required={true}
|
||||
<Property name="rules" type="PolicyRuleUpdate[]" required={true}
|
||||
|
||||
|
||||
>
|
||||
@@ -1023,31 +1052,29 @@ curl -X PUT https://api.netbird.io/api/policies/{policyId} \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Token <TOKEN>' \
|
||||
--data-raw '{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
}'
|
||||
@@ -1056,31 +1083,29 @@ curl -X PUT https://api.netbird.io/api/policies/{policyId} \
|
||||
```js
|
||||
const axios = require('axios');
|
||||
let data = JSON.stringify({
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -1111,31 +1136,29 @@ import json
|
||||
|
||||
url = "https://api.netbird.io/api/policies/{policyId}"
|
||||
payload = json.dumps({
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -1166,31 +1189,29 @@ func main() {
|
||||
method := "PUT"
|
||||
|
||||
payload := strings.NewReader(`{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
}`)
|
||||
@@ -1239,31 +1260,29 @@ request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
request.body = JSON.dump({
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -1276,31 +1295,29 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("application/json");
|
||||
RequestBody body = RequestBody.create(mediaType, '{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
}');
|
||||
@@ -1329,31 +1346,29 @@ curl_setopt_array($curl, array(
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||
CURLOPT_POSTFIELDS => '{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
"ch8i4ug6lnn4g9hqv797"
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
"ch8i4ug6lnn4g9h7v7m0"
|
||||
]
|
||||
}
|
||||
]
|
||||
}',
|
||||
@@ -1377,16 +1392,23 @@ echo $response;
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"query": "package netbird\\n\\nall[rule] {\\n is_peer_in_any_group([\\\"ch8i4ug6lnn4g9hqv7m0\\\",\\\"ch8i4ug6lnn4g9hqv7m0\\\"])\\n rule := {\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"dst\\\", \\\"accept\\\", \\\"\\\"),\\n rules_from_group(\\\"ch8i4ug6lnn4g9hqv7m0\\\", \\\"src\\\", \\\"accept\\\", \\\"\\\"),\\n }[_][_]\\n}\\n",
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"name": "Default",
|
||||
"description": "This is a default rule that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"action": "accept",
|
||||
"bidirectional": true,
|
||||
"protocol": "tcp",
|
||||
"ports": [
|
||||
"80"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
@@ -1400,15 +1422,14 @@ echo $response;
|
||||
"name": "devs",
|
||||
"peers_count": 2
|
||||
}
|
||||
],
|
||||
"action": "accept"
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg"
|
||||
]
|
||||
}
|
||||
```
|
||||
```json {{ title: 'Schema' }}
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
@@ -1419,6 +1440,12 @@ echo $response;
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
"action": "string",
|
||||
"bidirectional": "boolean",
|
||||
"protocol": "string",
|
||||
"ports": [
|
||||
"string"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"id": "string",
|
||||
@@ -1432,11 +1459,9 @@ echo $response;
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
],
|
||||
"action": "string"
|
||||
]
|
||||
}
|
||||
],
|
||||
"id": "string"
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
@@ -1455,7 +1480,7 @@ echo $response;
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Delete a Policy
|
||||
Delete a policy
|
||||
|
||||
#### Path Parameters
|
||||
<Properties>
|
||||
|
||||
Reference in New Issue
Block a user