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:
pascal-fischer
2023-06-05 09:35:54 +02:00
committed by GitHub
parent 33b3153723
commit f33b4df3dd
20 changed files with 481 additions and 5928 deletions

View File

@@ -1,4 +1,3 @@
export const title = 'Accounts'
@@ -236,16 +235,20 @@ curl -X PUT https://api.netbird.io/api/accounts/{accountId} \
-H 'Content-Type: application/json' \
-H 'Authorization: Token <TOKEN>' \
--data-raw '{
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
"settings": {
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
}
}'
```
```js
const axios = require('axios');
let data = JSON.stringify({
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
"settings": {
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
}
});
let config = {
method: 'put',
@@ -274,8 +277,10 @@ import json
url = "https://api.netbird.io/api/accounts/{accountId}"
payload = json.dumps({
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
"settings": {
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
}
})
headers: {
'Content-Type': 'application/json',
@@ -304,8 +309,10 @@ func main() {
method := "PUT"
payload := strings.NewReader(`{
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
"settings": {
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
}
}`)
client := &http.Client {
}
@@ -352,8 +359,10 @@ request["Accept"] = "application/json"
request["Authorization"] = "Token <TOKEN>"
request.body = JSON.dump({
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
"settings": {
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
}
})
response = https.request(request)
puts response.read_body
@@ -364,8 +373,10 @@ OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
"settings": {
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
}
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/accounts/{accountId}")
@@ -392,8 +403,10 @@ curl_setopt_array($curl, array(
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS => '{
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
"settings": {
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',

View File

@@ -1,4 +1,3 @@
export const title = 'DNS'
@@ -1445,7 +1444,7 @@ echo $response;
---
## Retrieve DNS Settings {{ tag: 'GET' , label: '/api/dns/settings' }}
## Retrieve DNS settings {{ tag: 'GET' , label: '/api/dns/settings' }}
<Row>
<Col>

View File

@@ -1,4 +1,3 @@
export const title = 'Events'

View File

@@ -1,4 +1,3 @@
export const title = 'Groups'
@@ -7,7 +6,7 @@ export const title = 'Groups'
<Row>
<Col>
Returns a list of all Groups
Returns a list of all groups
</Col>
<Col sticky>
@@ -207,7 +206,7 @@ echo $response;
<Row>
<Col>
Creates a Group
Creates a group
#### Request-Body Parameters
<Properties>
@@ -238,7 +237,7 @@ curl -X POST https://api.netbird.io/api/groups \
--data-raw '{
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
}'
```
@@ -248,7 +247,7 @@ const axios = require('axios');
let data = JSON.stringify({
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
});
let config = {
@@ -280,7 +279,7 @@ url = "https://api.netbird.io/api/groups"
payload = json.dumps({
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
})
headers: {
@@ -312,7 +311,7 @@ func main() {
payload := strings.NewReader(`{
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
}`)
client := &http.Client {
@@ -362,7 +361,7 @@ request["Authorization"] = "Token <TOKEN>"
request.body = JSON.dump({
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
})
response = https.request(request)
@@ -376,7 +375,7 @@ MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
}');
Request request = new Request.Builder()
@@ -406,7 +405,7 @@ curl_setopt_array($curl, array(
CURLOPT_POSTFIELDS => '{
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
}',
CURLOPT_HTTPHEADER => array(
@@ -469,7 +468,7 @@ echo $response;
<Row>
<Col>
Get information about a Group
Get information about a group
#### Path Parameters
<Properties>
@@ -673,7 +672,7 @@ echo $response;
<Row>
<Col>
Update/Replace a Group
Update/Replace a group
#### Path Parameters
<Properties>
@@ -712,7 +711,7 @@ curl -X PUT https://api.netbird.io/api/groups/{groupId} \
--data-raw '{
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
}'
```
@@ -722,7 +721,7 @@ const axios = require('axios');
let data = JSON.stringify({
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
});
let config = {
@@ -754,7 +753,7 @@ url = "https://api.netbird.io/api/groups/{groupId}"
payload = json.dumps({
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
})
headers: {
@@ -786,7 +785,7 @@ func main() {
payload := strings.NewReader(`{
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
}`)
client := &http.Client {
@@ -836,7 +835,7 @@ request["Authorization"] = "Token <TOKEN>"
request.body = JSON.dump({
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
})
response = https.request(request)
@@ -850,7 +849,7 @@ MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '{
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
}');
Request request = new Request.Builder()
@@ -880,7 +879,7 @@ curl_setopt_array($curl, array(
CURLOPT_POSTFIELDS => '{
"name": "devs",
"peers": [
null
"ch8i4ug6lnn4g9hqv7m1"
]
}',
CURLOPT_HTTPHEADER => array(
@@ -943,7 +942,7 @@ echo $response;
<Row>
<Col>
Delete a Group
Delete a group
#### Path Parameters
<Properties>

View File

@@ -1,4 +1,3 @@
export const title = 'Peers'

View File

@@ -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>

View File

@@ -1,4 +1,3 @@
export const title = 'Routes'
@@ -1151,7 +1150,7 @@ echo $response;
<Row>
<Col>
Delete a Route
Delete a route
#### Path Parameters
<Properties>

View File

@@ -1,4 +1,3 @@
export const title = 'Rules'
@@ -7,7 +6,7 @@ export const title = 'Rules'
<Row>
<Col>
Returns a list of all Rules
Returns a list of all rules
</Col>
<Col sticky>
@@ -227,7 +226,7 @@ echo $response;
<Row>
<Col>
Creates a Rule
Creates a rule
#### Request-Body Parameters
<Properties>
@@ -575,7 +574,7 @@ echo $response;
<Row>
<Col>
Get information about a Rules
Get information about a rules
#### Path Parameters
<Properties>
@@ -799,7 +798,7 @@ echo $response;
<Row>
<Col>
Update/Replace a Rule
Update/Replace a rule
#### Path Parameters
<Properties>
@@ -1159,7 +1158,7 @@ echo $response;
<Row>
<Col>
Delete a Rule
Delete a rule
#### Path Parameters
<Properties>

View File

@@ -1,4 +1,3 @@
export const title = 'Setup Keys'
@@ -219,7 +218,7 @@ echo $response;
<Row>
<Col>
Creates a Setup Key
Creates a setup key
#### Request-Body Parameters
<Properties>
@@ -549,7 +548,7 @@ echo $response;
<Row>
<Col>
Get information about a Setup Key
Get information about a setup key
#### Path Parameters
<Properties>
@@ -765,7 +764,7 @@ echo $response;
<Row>
<Col>
Update information about a Setup Key
Update information about a setup key
#### Path Parameters
<Properties>

View File

@@ -1,4 +1,3 @@
export const title = 'Tokens'

View File

@@ -1,4 +1,3 @@
export const title = 'Users'
@@ -181,7 +180,8 @@ echo $response;
"devs"
],
"is_current": true,
"is_service_user": false
"is_service_user": false,
"is_blocked": false
}
]
```
@@ -197,7 +197,8 @@ echo $response;
"string"
],
"is_current": "boolean",
"is_service_user": "boolean"
"is_service_user": "boolean",
"is_blocked": "boolean"
}
]
```
@@ -490,7 +491,8 @@ echo $response;
"devs"
],
"is_current": true,
"is_service_user": false
"is_service_user": false,
"is_blocked": false
}
```
```json {{ title: 'Schema' }}
@@ -504,7 +506,8 @@ echo $response;
"string"
],
"is_current": "boolean",
"is_service_user": "boolean"
"is_service_user": "boolean",
"is_blocked": "boolean"
}
```
</CodeGroup>
@@ -548,6 +551,13 @@ echo $response;
>
Groups to auto-assign to peers registered by this user
</Property>
<Property name="is_blocked" type="boolean" required={true}
>
If set to true then user is blocked and can't use the system
</Property>
</Properties>
</Col>
@@ -563,7 +573,8 @@ curl -X PUT https://api.netbird.io/api/users/{userId} \
"role": "admin",
"auto_groups": [
"devs"
]
],
"is_blocked": false
}'
```
@@ -573,7 +584,8 @@ let data = JSON.stringify({
"role": "admin",
"auto_groups": [
"devs"
]
],
"is_blocked": false
});
let config = {
method: 'put',
@@ -605,7 +617,8 @@ payload = json.dumps({
"role": "admin",
"auto_groups": [
"devs"
]
],
"is_blocked": false
})
headers: {
'Content-Type': 'application/json',
@@ -637,7 +650,8 @@ func main() {
"role": "admin",
"auto_groups": [
"devs"
]
],
"is_blocked": false
}`)
client := &http.Client {
}
@@ -687,7 +701,8 @@ request.body = JSON.dump({
"role": "admin",
"auto_groups": [
"devs"
]
],
"is_blocked": false
})
response = https.request(request)
puts response.read_body
@@ -701,7 +716,8 @@ RequestBody body = RequestBody.create(mediaType, '{
"role": "admin",
"auto_groups": [
"devs"
]
],
"is_blocked": false
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/users/{userId}")
@@ -731,7 +747,8 @@ curl_setopt_array($curl, array(
"role": "admin",
"auto_groups": [
"devs"
]
],
"is_blocked": false
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
@@ -762,7 +779,8 @@ echo $response;
"devs"
],
"is_current": true,
"is_service_user": false
"is_service_user": false,
"is_blocked": false
}
```
```json {{ title: 'Schema' }}
@@ -776,7 +794,8 @@ echo $response;
"string"
],
"is_current": "boolean",
"is_service_user": "boolean"
"is_service_user": "boolean",
"is_blocked": "boolean"
}
```
</CodeGroup>
@@ -795,7 +814,7 @@ echo $response;
<Row>
<Col>
Delete a User
Delete a user
#### Path Parameters
<Properties>