mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-16 07:26: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:
39
.github/workflows/build_n_push.yml
vendored
39
.github/workflows/build_n_push.yml
vendored
@@ -5,13 +5,44 @@ on:
|
|||||||
- main
|
- main
|
||||||
tags:
|
tags:
|
||||||
- "**"
|
- "**"
|
||||||
pull_request:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
generateAPI:
|
||||||
|
description: 'Generates API pages if set'
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
jobs:
|
jobs:
|
||||||
docs_build_n_push:
|
generate_api_pages:
|
||||||
runs-on: ubuntu-latest
|
runs-on: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install swagger-codegen
|
||||||
|
if: ${{ inputs.generateAPI }}
|
||||||
|
run: brew install swagger-codegen
|
||||||
|
|
||||||
|
- name: Generate api pages for netbird main openapi definition
|
||||||
|
if: ${{ inputs.generateAPI }}
|
||||||
|
run: |
|
||||||
|
npm install
|
||||||
|
npm run gen
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
if: ${{ inputs.generateAPI }}
|
||||||
|
run: |
|
||||||
|
git config --global user.email "no-reply@github.com"
|
||||||
|
git config --global user.name "GitHub Actions"
|
||||||
|
|
||||||
|
git add -A
|
||||||
|
git commit -m "Update API pages"
|
||||||
|
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
|
||||||
|
git push
|
||||||
|
|
||||||
|
docs_build_n_push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [generate_api_pages]
|
||||||
|
steps:
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -24,3 +24,5 @@ yarn-error.log*
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
/.next/
|
/.next/
|
||||||
/yarn.lock
|
/yarn.lock
|
||||||
|
/generator/openapi/
|
||||||
|
/generator/openapi.yml
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
# Swagger Codegen Ignore
|
|
||||||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
3.0.42
|
|
||||||
File diff suppressed because it is too large
Load Diff
221
generator/api.ts
221
generator/api.ts
@@ -1,13 +1,12 @@
|
|||||||
import template from './templates/ApiTemplate'
|
import template from './templates/ApiTemplate'
|
||||||
import { slugify, toArrayWithKey, toTitle, writeToDisk } from './helpers'
|
import { slugify, toArrayWithKey, toTitle, writeToDisk } from './helpers'
|
||||||
import { OpenAPIV3, OpenAPIV2 } from 'openapi-types'
|
import {OpenAPIV3} from 'openapi-types'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as ejs from 'ejs'
|
import * as ejs from 'ejs'
|
||||||
|
|
||||||
export default async function gen(inputFileName: string, outputDir: string) {
|
export default async function gen(inputFileName: string, outputDir: string) {
|
||||||
const specRaw = fs.readFileSync(inputFileName, 'utf8')
|
const specRaw = fs.readFileSync(inputFileName, 'utf8')
|
||||||
const spec = JSON.parse(specRaw) as any
|
const spec = JSON.parse(specRaw) as any
|
||||||
// console.log('spec', spec)
|
|
||||||
|
|
||||||
switch (spec.openapi || spec.swagger) {
|
switch (spec.openapi || spec.swagger) {
|
||||||
case '3.0.0':
|
case '3.0.0':
|
||||||
@@ -79,90 +78,7 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
let components = new Map<string, component>();
|
let components = readComponents(spec.components)
|
||||||
Object.entries(spec.components?.schemas).forEach(([key, val]) => {
|
|
||||||
const schema = val as OpenAPIV3.SchemaObject
|
|
||||||
let outputSchema = new Map<string, any>();
|
|
||||||
let outputExample = new Map<string, any>();
|
|
||||||
let parameters : schemaParameter[] = []
|
|
||||||
if(schema.allOf){
|
|
||||||
schema.allOf.forEach((item) => {
|
|
||||||
if((item as OpenAPIV3.ReferenceObject).$ref){
|
|
||||||
let component = components.get((item as OpenAPIV3.ReferenceObject).$ref.split('/').pop())
|
|
||||||
let schemaMap = new Map(Object.entries(component.schema))
|
|
||||||
let exampleMap = new Map(Object.entries(component.example))
|
|
||||||
schemaMap.forEach((value, key) => {
|
|
||||||
outputSchema.set(key, value)
|
|
||||||
})
|
|
||||||
exampleMap.forEach((value, key) => {
|
|
||||||
outputExample.set(key, value)
|
|
||||||
})
|
|
||||||
parameters = parameters.concat(component.parameters)
|
|
||||||
}
|
|
||||||
if((item as OpenAPIV3.SchemaObject).properties){
|
|
||||||
Object.entries((item as OpenAPIV3.SchemaObject).properties).forEach(([key, val]) => {
|
|
||||||
let property = val as OpenAPIV3.SchemaObject
|
|
||||||
let type, exampleValue
|
|
||||||
if (property.type === "array") {
|
|
||||||
type = new Array(resolveType(property.items, spec.components?.schemas))
|
|
||||||
exampleValue = new Array(resolveExampleValue(property.items, spec.components?.schemas))
|
|
||||||
} else {
|
|
||||||
type = resolveType(property, spec.components?.schemas)
|
|
||||||
exampleValue = resolveExampleValue(property, spec.components?.schemas)
|
|
||||||
}
|
|
||||||
outputSchema.set(key, type)
|
|
||||||
outputExample.set(key, exampleValue)
|
|
||||||
let parameter: schemaParameter = {
|
|
||||||
name: key,
|
|
||||||
type: property.type === "array" ? ((property.items as OpenAPIV3.SchemaObject).type || (property.items as OpenAPIV3.ReferenceObject).$ref.split('/').pop()) + "[]" : property.type,
|
|
||||||
description: property.description,
|
|
||||||
required: schema.required?.includes(key) || false,
|
|
||||||
minimum: property.minimum,
|
|
||||||
maximum: property.maximum,
|
|
||||||
minLength: property.minLength,
|
|
||||||
maxLength: property.maxLength,
|
|
||||||
enum: property.enum
|
|
||||||
}
|
|
||||||
parameters.push(parameter)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Object.entries(schema.properties).forEach(([key, val]) => {
|
|
||||||
let property = val as OpenAPIV3.SchemaObject
|
|
||||||
let type, exampleValue
|
|
||||||
if(property.type === "array"){
|
|
||||||
type = new Array(resolveType(property.items, spec.components?.schemas))
|
|
||||||
exampleValue = new Array(resolveExampleValue(property.items, spec.components?.schemas))
|
|
||||||
} else {
|
|
||||||
type = resolveType(property, spec.components?.schemas)
|
|
||||||
exampleValue = resolveExampleValue(property, spec.components?.schemas)
|
|
||||||
}
|
|
||||||
outputSchema.set(key, type)
|
|
||||||
outputExample.set(key, exampleValue)
|
|
||||||
let parameter : schemaParameter = {
|
|
||||||
name: key,
|
|
||||||
type: property.type === "array" ? ((property.items as OpenAPIV3.SchemaObject).type || (property.items as OpenAPIV3.ReferenceObject).$ref.split('/').pop()) + "[]" : property.type,
|
|
||||||
description: property.description,
|
|
||||||
required: schema.required?.includes(key) || false,
|
|
||||||
minimum: property.minimum,
|
|
||||||
maximum: property.maximum,
|
|
||||||
minLength: property.minLength,
|
|
||||||
maxLength: property.maxLength,
|
|
||||||
enum: property.enum
|
|
||||||
}
|
|
||||||
parameters.push(parameter)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let output : component = {
|
|
||||||
example: Object.fromEntries(outputExample),
|
|
||||||
schema: Object.fromEntries(outputSchema),
|
|
||||||
parameters: parameters
|
|
||||||
}
|
|
||||||
components.set(key, output)
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
tagGroups.forEach((value: enrichedOperation[], key: string) => {
|
tagGroups.forEach((value: enrichedOperation[], key: string) => {
|
||||||
|
|
||||||
@@ -192,42 +108,111 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveType(items: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject | OpenAPIV3.NonArraySchemaObjectType, schemas) : any {
|
function readComponents(components: OpenAPIV3.ComponentsObject) : Map<string, component> {
|
||||||
if((items as OpenAPIV3.ReferenceObject).$ref){
|
let componentsOutput = new Map<string, component>()
|
||||||
let ref = (items as OpenAPIV3.ReferenceObject).$ref
|
|
||||||
let map = new Map<string, any>()
|
for (const [key, value] of Object.entries(components.schemas)) {
|
||||||
Object.entries(schemas[ref.split('/').pop()].properties).forEach(([key, val]) => {
|
let [schema, example, parameter] = resolveComponents(value, components)
|
||||||
let property = val as OpenAPIV3.SchemaObject
|
let component = {
|
||||||
let type
|
example: example,
|
||||||
if(property.type === "array"){
|
schema: schema,
|
||||||
type = new Array(resolveType(property.items, schemas))
|
parameters: parameter
|
||||||
} else {
|
}
|
||||||
type = resolveType(property, schemas)
|
componentsOutput.set(key, component)
|
||||||
}
|
|
||||||
map.set(key, type)
|
|
||||||
})
|
|
||||||
return Object.fromEntries(map)
|
|
||||||
}
|
}
|
||||||
return (items as OpenAPIV3.ArraySchemaObject).type
|
|
||||||
|
return componentsOutput
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveComponents(value: OpenAPIV3.ReferenceObject | OpenAPIV3.ArraySchemaObject | OpenAPIV3.NonArraySchemaObject, components: OpenAPIV3.ComponentsObject) : [Object, Object, schemaParameter[]] {
|
||||||
|
if((value as OpenAPIV3.ReferenceObject).$ref) {
|
||||||
|
let subcomponentName = (value as OpenAPIV3.ReferenceObject).$ref.split('/').pop()
|
||||||
|
let subcomponent = components.schemas[subcomponentName]
|
||||||
|
return resolveComponents(subcomponent, components)
|
||||||
|
}
|
||||||
|
if((value as OpenAPIV3.SchemaObject).properties) {
|
||||||
|
return resolveProperties(value as OpenAPIV3.SchemaObject, components)
|
||||||
|
}
|
||||||
|
if((value as OpenAPIV3.SchemaObject).allOf) {
|
||||||
|
return resolveAllOf(value as OpenAPIV3.SchemaObject, components)
|
||||||
|
}
|
||||||
|
if((value as OpenAPIV3.SchemaObject).type || (value as OpenAPIV3.SchemaObject).example) {
|
||||||
|
return [(value as OpenAPIV3.SchemaObject).type, (value as OpenAPIV3.SchemaObject).example, null]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveAllOf(object: OpenAPIV3.SchemaObject, components: OpenAPIV3.ComponentsObject) : [Object, Object, schemaParameter[]] {
|
||||||
|
let examples = new Map<string, any>()
|
||||||
|
let schemas = new Map<string, any>()
|
||||||
|
let parameters: schemaParameter[] = []
|
||||||
|
for (const [key, value] of Object.entries(object.allOf)) {
|
||||||
|
let example;
|
||||||
|
let schema;
|
||||||
|
let parameter;
|
||||||
|
if((value as OpenAPIV3.ReferenceObject).$ref) {
|
||||||
|
let subcomponentName = (value as OpenAPIV3.ReferenceObject).$ref.split('/').pop()
|
||||||
|
let subcomponent = components.schemas[subcomponentName];
|
||||||
|
[schema, example, parameter] = resolveComponents(subcomponent, components)
|
||||||
|
}
|
||||||
|
if((value as OpenAPIV3.SchemaObject).properties) {
|
||||||
|
[schema, example, parameter] = resolveProperties(value as OpenAPIV3.SchemaObject, components)
|
||||||
|
}
|
||||||
|
if(!(example instanceof Map)) {
|
||||||
|
example = new Map(Object.entries(example))
|
||||||
|
}
|
||||||
|
if(!(schema instanceof Map)) {
|
||||||
|
schema = new Map(Object.entries(schema))
|
||||||
|
}
|
||||||
|
parameters = parameters.concat(parameter)
|
||||||
|
examples = mergeMaps(examples, example)
|
||||||
|
schemas = mergeMaps(schemas, schema)
|
||||||
|
}
|
||||||
|
return [Object.fromEntries(schemas), Object.fromEntries(examples), parameters]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function resolveExampleValue(items: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject | OpenAPIV3.NonArraySchemaObjectType, schemas) : any {
|
function resolveProperties(value: OpenAPIV3.SchemaObject, components: OpenAPIV3.ComponentsObject): [Object, Object, schemaParameter[]] {
|
||||||
if((items as OpenAPIV3.ReferenceObject).$ref){
|
let examples = new Map<string, Object>()
|
||||||
let ref = (items as OpenAPIV3.ReferenceObject).$ref
|
let schemas = new Map<string, Object>()
|
||||||
let map = new Map<string, any>()
|
let parameters: schemaParameter[] = []
|
||||||
Object.entries(schemas[ref.split('/').pop()].properties).forEach(([key, val]) => {
|
for(const [key, property] of Object.entries(value.properties)) {
|
||||||
let property = val as OpenAPIV3.SchemaObject
|
let type: string = ""
|
||||||
let exampleValue
|
if(property["$ref"]) {
|
||||||
if(property.type === "array"){
|
let [schema, example, parameter] = resolveComponents(property, components)
|
||||||
exampleValue = new Array(resolveExampleValue(property.items, schemas))
|
examples.set(key, example)
|
||||||
} else {
|
schemas.set(key, schema)
|
||||||
exampleValue = resolveExampleValue(property, schemas)
|
parameters = parameters.concat(parameter)
|
||||||
}
|
continue
|
||||||
map.set(key, exampleValue)
|
}
|
||||||
})
|
switch (property["type"]) {
|
||||||
return Object.fromEntries(map)
|
case "array":
|
||||||
|
type = ((property["items"] as OpenAPIV3.SchemaObject).type || (property["items"] as OpenAPIV3.ReferenceObject).$ref.split('/').pop()) + "[]"
|
||||||
|
let [schema, example] = resolveComponents(property["items"], components)
|
||||||
|
examples.set(key, new Array(example))
|
||||||
|
schemas.set(key, new Array(schema))
|
||||||
|
break;
|
||||||
|
case "object":
|
||||||
|
default:
|
||||||
|
type = property["type"]
|
||||||
|
examples.set(key, property["example"])
|
||||||
|
schemas.set(key, property["type"])
|
||||||
|
}
|
||||||
|
let parameter: schemaParameter = {
|
||||||
|
name: key,
|
||||||
|
type: type,
|
||||||
|
description: property["description"],
|
||||||
|
required: value.required?.includes(key) || false,
|
||||||
|
minimum: property["minimum"],
|
||||||
|
maximum: property["maximum"],
|
||||||
|
minLength: property["minLength"],
|
||||||
|
maxLength: property["maxLength"],
|
||||||
|
enum: property["enum"],
|
||||||
|
}
|
||||||
|
parameters.push(parameter)
|
||||||
}
|
}
|
||||||
return (items as OpenAPIV3.ArraySchemaObject).example
|
return [Object.fromEntries(schemas), Object.fromEntries(examples), parameters]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mergeMaps(map1: Map<string, Object>, map2: Map<string, Object>) : Map<string, Object> {
|
||||||
|
return new Map([...Array.from(map1.entries()), ...Array.from(map2.entries())]);
|
||||||
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"gen": "swagger-codegen generate -i generator/openapi.yml -l openapi -o generator/api.json && npx ts-node generator/index.ts gen --input generator/api.json/openapi.json --output src/pages/ipa/resources",
|
"gen": "swagger-codegen generate -i https://raw.githubusercontent.com/netbirdio/netbird/main/management/server/http/api/openapi.yml -l openapi -o generator/openapi && npx ts-node generator/index.ts gen --input generator/openapi/openapi.json --output src/pages/ipa/resources",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Accounts'
|
export const title = 'Accounts'
|
||||||
|
|
||||||
|
|
||||||
@@ -236,16 +235,20 @@ curl -X PUT https://api.netbird.io/api/accounts/{accountId} \
|
|||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-H 'Authorization: Token <TOKEN>' \
|
-H 'Authorization: Token <TOKEN>' \
|
||||||
--data-raw '{
|
--data-raw '{
|
||||||
"peer_login_expiration_enabled": true,
|
"settings": {
|
||||||
"peer_login_expiration": 43200
|
"peer_login_expiration_enabled": true,
|
||||||
|
"peer_login_expiration": 43200
|
||||||
|
}
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
let data = JSON.stringify({
|
let data = JSON.stringify({
|
||||||
"peer_login_expiration_enabled": true,
|
"settings": {
|
||||||
"peer_login_expiration": 43200
|
"peer_login_expiration_enabled": true,
|
||||||
|
"peer_login_expiration": 43200
|
||||||
|
}
|
||||||
});
|
});
|
||||||
let config = {
|
let config = {
|
||||||
method: 'put',
|
method: 'put',
|
||||||
@@ -274,8 +277,10 @@ import json
|
|||||||
|
|
||||||
url = "https://api.netbird.io/api/accounts/{accountId}"
|
url = "https://api.netbird.io/api/accounts/{accountId}"
|
||||||
payload = json.dumps({
|
payload = json.dumps({
|
||||||
"peer_login_expiration_enabled": true,
|
"settings": {
|
||||||
"peer_login_expiration": 43200
|
"peer_login_expiration_enabled": true,
|
||||||
|
"peer_login_expiration": 43200
|
||||||
|
}
|
||||||
})
|
})
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -304,8 +309,10 @@ func main() {
|
|||||||
method := "PUT"
|
method := "PUT"
|
||||||
|
|
||||||
payload := strings.NewReader(`{
|
payload := strings.NewReader(`{
|
||||||
"peer_login_expiration_enabled": true,
|
"settings": {
|
||||||
"peer_login_expiration": 43200
|
"peer_login_expiration_enabled": true,
|
||||||
|
"peer_login_expiration": 43200
|
||||||
|
}
|
||||||
}`)
|
}`)
|
||||||
client := &http.Client {
|
client := &http.Client {
|
||||||
}
|
}
|
||||||
@@ -352,8 +359,10 @@ request["Accept"] = "application/json"
|
|||||||
request["Authorization"] = "Token <TOKEN>"
|
request["Authorization"] = "Token <TOKEN>"
|
||||||
|
|
||||||
request.body = JSON.dump({
|
request.body = JSON.dump({
|
||||||
"peer_login_expiration_enabled": true,
|
"settings": {
|
||||||
"peer_login_expiration": 43200
|
"peer_login_expiration_enabled": true,
|
||||||
|
"peer_login_expiration": 43200
|
||||||
|
}
|
||||||
})
|
})
|
||||||
response = https.request(request)
|
response = https.request(request)
|
||||||
puts response.read_body
|
puts response.read_body
|
||||||
@@ -364,8 +373,10 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
|||||||
.build();
|
.build();
|
||||||
MediaType mediaType = MediaType.parse("application/json");
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
RequestBody body = RequestBody.create(mediaType, '{
|
RequestBody body = RequestBody.create(mediaType, '{
|
||||||
"peer_login_expiration_enabled": true,
|
"settings": {
|
||||||
"peer_login_expiration": 43200
|
"peer_login_expiration_enabled": true,
|
||||||
|
"peer_login_expiration": 43200
|
||||||
|
}
|
||||||
}');
|
}');
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url("https://api.netbird.io/api/accounts/{accountId}")
|
.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_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||||
CURLOPT_POSTFIELDS => '{
|
CURLOPT_POSTFIELDS => '{
|
||||||
"peer_login_expiration_enabled": true,
|
"settings": {
|
||||||
"peer_login_expiration": 43200
|
"peer_login_expiration_enabled": true,
|
||||||
|
"peer_login_expiration": 43200
|
||||||
|
}
|
||||||
}',
|
}',
|
||||||
CURLOPT_HTTPHEADER => array(
|
CURLOPT_HTTPHEADER => array(
|
||||||
'Content-Type: application/json',
|
'Content-Type: application/json',
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'DNS'
|
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>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Events'
|
export const title = 'Events'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Groups'
|
export const title = 'Groups'
|
||||||
|
|
||||||
|
|
||||||
@@ -7,7 +6,7 @@ export const title = 'Groups'
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Returns a list of all Groups
|
Returns a list of all groups
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Col sticky>
|
<Col sticky>
|
||||||
@@ -207,7 +206,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Creates a Group
|
Creates a group
|
||||||
|
|
||||||
#### Request-Body Parameters
|
#### Request-Body Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
@@ -238,7 +237,7 @@ curl -X POST https://api.netbird.io/api/groups \
|
|||||||
--data-raw '{
|
--data-raw '{
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
@@ -248,7 +247,7 @@ const axios = require('axios');
|
|||||||
let data = JSON.stringify({
|
let data = JSON.stringify({
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
let config = {
|
let config = {
|
||||||
@@ -280,7 +279,7 @@ url = "https://api.netbird.io/api/groups"
|
|||||||
payload = json.dumps({
|
payload = json.dumps({
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
headers: {
|
headers: {
|
||||||
@@ -312,7 +311,7 @@ func main() {
|
|||||||
payload := strings.NewReader(`{
|
payload := strings.NewReader(`{
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
}`)
|
}`)
|
||||||
client := &http.Client {
|
client := &http.Client {
|
||||||
@@ -362,7 +361,7 @@ request["Authorization"] = "Token <TOKEN>"
|
|||||||
request.body = JSON.dump({
|
request.body = JSON.dump({
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
response = https.request(request)
|
response = https.request(request)
|
||||||
@@ -376,7 +375,7 @@ MediaType mediaType = MediaType.parse("application/json");
|
|||||||
RequestBody body = RequestBody.create(mediaType, '{
|
RequestBody body = RequestBody.create(mediaType, '{
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
}');
|
}');
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
@@ -406,7 +405,7 @@ curl_setopt_array($curl, array(
|
|||||||
CURLOPT_POSTFIELDS => '{
|
CURLOPT_POSTFIELDS => '{
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
}',
|
}',
|
||||||
CURLOPT_HTTPHEADER => array(
|
CURLOPT_HTTPHEADER => array(
|
||||||
@@ -469,7 +468,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Get information about a Group
|
Get information about a group
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
@@ -673,7 +672,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Update/Replace a Group
|
Update/Replace a group
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
@@ -712,7 +711,7 @@ curl -X PUT https://api.netbird.io/api/groups/{groupId} \
|
|||||||
--data-raw '{
|
--data-raw '{
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
@@ -722,7 +721,7 @@ const axios = require('axios');
|
|||||||
let data = JSON.stringify({
|
let data = JSON.stringify({
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
let config = {
|
let config = {
|
||||||
@@ -754,7 +753,7 @@ url = "https://api.netbird.io/api/groups/{groupId}"
|
|||||||
payload = json.dumps({
|
payload = json.dumps({
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
headers: {
|
headers: {
|
||||||
@@ -786,7 +785,7 @@ func main() {
|
|||||||
payload := strings.NewReader(`{
|
payload := strings.NewReader(`{
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
}`)
|
}`)
|
||||||
client := &http.Client {
|
client := &http.Client {
|
||||||
@@ -836,7 +835,7 @@ request["Authorization"] = "Token <TOKEN>"
|
|||||||
request.body = JSON.dump({
|
request.body = JSON.dump({
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
response = https.request(request)
|
response = https.request(request)
|
||||||
@@ -850,7 +849,7 @@ MediaType mediaType = MediaType.parse("application/json");
|
|||||||
RequestBody body = RequestBody.create(mediaType, '{
|
RequestBody body = RequestBody.create(mediaType, '{
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
}');
|
}');
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
@@ -880,7 +879,7 @@ curl_setopt_array($curl, array(
|
|||||||
CURLOPT_POSTFIELDS => '{
|
CURLOPT_POSTFIELDS => '{
|
||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers": [
|
"peers": [
|
||||||
null
|
"ch8i4ug6lnn4g9hqv7m1"
|
||||||
]
|
]
|
||||||
}',
|
}',
|
||||||
CURLOPT_HTTPHEADER => array(
|
CURLOPT_HTTPHEADER => array(
|
||||||
@@ -943,7 +942,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Delete a Group
|
Delete a group
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Peers'
|
export const title = 'Peers'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Policies'
|
export const title = 'Policies'
|
||||||
|
|
||||||
|
|
||||||
@@ -7,7 +6,7 @@ export const title = 'Policies'
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Returns a list of all Policies
|
Returns a list of all policies
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Col sticky>
|
<Col sticky>
|
||||||
@@ -164,16 +163,23 @@ echo $response;
|
|||||||
```json {{ title: 'Example' }}
|
```json {{ title: 'Example' }}
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||||
@@ -187,17 +193,16 @@ echo $response;
|
|||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers_count": 2
|
"peers_count": 2
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
```json {{ title: 'Schema' }}
|
```json {{ title: 'Schema' }}
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
"id": "string",
|
||||||
"name": "string",
|
"name": "string",
|
||||||
"description": "string",
|
"description": "string",
|
||||||
"enabled": "boolean",
|
"enabled": "boolean",
|
||||||
@@ -208,6 +213,12 @@ echo $response;
|
|||||||
"name": "string",
|
"name": "string",
|
||||||
"description": "string",
|
"description": "string",
|
||||||
"enabled": "boolean",
|
"enabled": "boolean",
|
||||||
|
"action": "string",
|
||||||
|
"bidirectional": "boolean",
|
||||||
|
"protocol": "string",
|
||||||
|
"ports": [
|
||||||
|
"string"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"id": "string",
|
"id": "string",
|
||||||
@@ -221,11 +232,9 @@ echo $response;
|
|||||||
"name": "string",
|
"name": "string",
|
||||||
"peers_count": "integer"
|
"peers_count": "integer"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"action": "string"
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"id": "string"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@@ -245,11 +254,18 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Creates a Policy
|
Creates a policy
|
||||||
|
|
||||||
#### Request-Body Parameters
|
#### Request-Body Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
||||||
|
<Property name="id" type="string" required={false}
|
||||||
|
|
||||||
|
|
||||||
|
>
|
||||||
|
Policy ID
|
||||||
|
</Property>
|
||||||
|
|
||||||
<Property name="name" type="string" required={true}
|
<Property name="name" type="string" required={true}
|
||||||
|
|
||||||
|
|
||||||
@@ -278,7 +294,7 @@ echo $response;
|
|||||||
Policy Rego query
|
Policy Rego query
|
||||||
</Property>
|
</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 'Content-Type: application/json' \
|
||||||
-H 'Authorization: Token <TOKEN>' \
|
-H 'Authorization: Token <TOKEN>' \
|
||||||
--data-raw '{
|
--data-raw '{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}'
|
}'
|
||||||
@@ -328,31 +342,29 @@ curl -X POST https://api.netbird.io/api/policies \
|
|||||||
```js
|
```js
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
let data = JSON.stringify({
|
let data = JSON.stringify({
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -383,31 +395,29 @@ import json
|
|||||||
|
|
||||||
url = "https://api.netbird.io/api/policies"
|
url = "https://api.netbird.io/api/policies"
|
||||||
payload = json.dumps({
|
payload = json.dumps({
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -438,31 +448,29 @@ func main() {
|
|||||||
method := "POST"
|
method := "POST"
|
||||||
|
|
||||||
payload := strings.NewReader(`{
|
payload := strings.NewReader(`{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}`)
|
}`)
|
||||||
@@ -511,31 +519,29 @@ request["Accept"] = "application/json"
|
|||||||
request["Authorization"] = "Token <TOKEN>"
|
request["Authorization"] = "Token <TOKEN>"
|
||||||
|
|
||||||
request.body = JSON.dump({
|
request.body = JSON.dump({
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -548,31 +554,29 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
|||||||
.build();
|
.build();
|
||||||
MediaType mediaType = MediaType.parse("application/json");
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
RequestBody body = RequestBody.create(mediaType, '{
|
RequestBody body = RequestBody.create(mediaType, '{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}');
|
}');
|
||||||
@@ -601,31 +605,29 @@ curl_setopt_array($curl, array(
|
|||||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||||
CURLOPT_POSTFIELDS => '{
|
CURLOPT_POSTFIELDS => '{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}',
|
}',
|
||||||
@@ -649,16 +651,23 @@ echo $response;
|
|||||||
<CodeGroup title="Response">
|
<CodeGroup title="Response">
|
||||||
```json {{ title: 'Example' }}
|
```json {{ title: 'Example' }}
|
||||||
{
|
{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||||
@@ -672,15 +681,14 @@ echo $response;
|
|||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers_count": 2
|
"peers_count": 2
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
```json {{ title: 'Schema' }}
|
```json {{ title: 'Schema' }}
|
||||||
{
|
{
|
||||||
|
"id": "string",
|
||||||
"name": "string",
|
"name": "string",
|
||||||
"description": "string",
|
"description": "string",
|
||||||
"enabled": "boolean",
|
"enabled": "boolean",
|
||||||
@@ -691,6 +699,12 @@ echo $response;
|
|||||||
"name": "string",
|
"name": "string",
|
||||||
"description": "string",
|
"description": "string",
|
||||||
"enabled": "boolean",
|
"enabled": "boolean",
|
||||||
|
"action": "string",
|
||||||
|
"bidirectional": "boolean",
|
||||||
|
"protocol": "string",
|
||||||
|
"ports": [
|
||||||
|
"string"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"id": "string",
|
"id": "string",
|
||||||
@@ -704,11 +718,9 @@ echo $response;
|
|||||||
"name": "string",
|
"name": "string",
|
||||||
"peers_count": "integer"
|
"peers_count": "integer"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"action": "string"
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"id": "string"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
@@ -887,16 +899,23 @@ echo $response;
|
|||||||
<CodeGroup title="Response">
|
<CodeGroup title="Response">
|
||||||
```json {{ title: 'Example' }}
|
```json {{ title: 'Example' }}
|
||||||
{
|
{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||||
@@ -910,15 +929,14 @@ echo $response;
|
|||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers_count": 2
|
"peers_count": 2
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
```json {{ title: 'Schema' }}
|
```json {{ title: 'Schema' }}
|
||||||
{
|
{
|
||||||
|
"id": "string",
|
||||||
"name": "string",
|
"name": "string",
|
||||||
"description": "string",
|
"description": "string",
|
||||||
"enabled": "boolean",
|
"enabled": "boolean",
|
||||||
@@ -929,6 +947,12 @@ echo $response;
|
|||||||
"name": "string",
|
"name": "string",
|
||||||
"description": "string",
|
"description": "string",
|
||||||
"enabled": "boolean",
|
"enabled": "boolean",
|
||||||
|
"action": "string",
|
||||||
|
"bidirectional": "boolean",
|
||||||
|
"protocol": "string",
|
||||||
|
"ports": [
|
||||||
|
"string"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"id": "string",
|
"id": "string",
|
||||||
@@ -942,11 +966,9 @@ echo $response;
|
|||||||
"name": "string",
|
"name": "string",
|
||||||
"peers_count": "integer"
|
"peers_count": "integer"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"action": "string"
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"id": "string"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
@@ -978,6 +1000,13 @@ echo $response;
|
|||||||
#### Request-Body Parameters
|
#### Request-Body Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
||||||
|
<Property name="id" type="string" required={false}
|
||||||
|
|
||||||
|
|
||||||
|
>
|
||||||
|
Policy ID
|
||||||
|
</Property>
|
||||||
|
|
||||||
<Property name="name" type="string" required={true}
|
<Property name="name" type="string" required={true}
|
||||||
|
|
||||||
|
|
||||||
@@ -1006,7 +1035,7 @@ echo $response;
|
|||||||
Policy Rego query
|
Policy Rego query
|
||||||
</Property>
|
</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 'Content-Type: application/json' \
|
||||||
-H 'Authorization: Token <TOKEN>' \
|
-H 'Authorization: Token <TOKEN>' \
|
||||||
--data-raw '{
|
--data-raw '{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}'
|
}'
|
||||||
@@ -1056,31 +1083,29 @@ curl -X PUT https://api.netbird.io/api/policies/{policyId} \
|
|||||||
```js
|
```js
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
let data = JSON.stringify({
|
let data = JSON.stringify({
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -1111,31 +1136,29 @@ import json
|
|||||||
|
|
||||||
url = "https://api.netbird.io/api/policies/{policyId}"
|
url = "https://api.netbird.io/api/policies/{policyId}"
|
||||||
payload = json.dumps({
|
payload = json.dumps({
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -1166,31 +1189,29 @@ func main() {
|
|||||||
method := "PUT"
|
method := "PUT"
|
||||||
|
|
||||||
payload := strings.NewReader(`{
|
payload := strings.NewReader(`{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}`)
|
}`)
|
||||||
@@ -1239,31 +1260,29 @@ request["Accept"] = "application/json"
|
|||||||
request["Authorization"] = "Token <TOKEN>"
|
request["Authorization"] = "Token <TOKEN>"
|
||||||
|
|
||||||
request.body = JSON.dump({
|
request.body = JSON.dump({
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -1276,31 +1295,29 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
|||||||
.build();
|
.build();
|
||||||
MediaType mediaType = MediaType.parse("application/json");
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
RequestBody body = RequestBody.create(mediaType, '{
|
RequestBody body = RequestBody.create(mediaType, '{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}');
|
}');
|
||||||
@@ -1329,31 +1346,29 @@ curl_setopt_array($curl, array(
|
|||||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
CURLOPT_CUSTOMREQUEST => 'PUT',
|
CURLOPT_CUSTOMREQUEST => 'PUT',
|
||||||
CURLOPT_POSTFIELDS => '{
|
CURLOPT_POSTFIELDS => '{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
"ch8i4ug6lnn4g9hqv797"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
],
|
||||||
"destinations": [
|
"destinations": [
|
||||||
{
|
"ch8i4ug6lnn4g9h7v7m0"
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
]
|
||||||
"name": "devs",
|
|
||||||
"peers_count": 2
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}',
|
}',
|
||||||
@@ -1377,16 +1392,23 @@ echo $response;
|
|||||||
<CodeGroup title="Response">
|
<CodeGroup title="Response">
|
||||||
```json {{ title: 'Example' }}
|
```json {{ title: 'Example' }}
|
||||||
{
|
{
|
||||||
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"description": "This is a default policy that allows connections between all the resources",
|
"description": "This is a default policy that allows connections between all the resources",
|
||||||
"enabled": true,
|
"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": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||||
"name": "Default",
|
"name": "Default",
|
||||||
"description": "This is a default rule that allows connections between all the resources",
|
"description": "This is a default rule that allows connections between all the resources",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
"action": "accept",
|
||||||
|
"bidirectional": true,
|
||||||
|
"protocol": "tcp",
|
||||||
|
"ports": [
|
||||||
|
"80"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||||
@@ -1400,15 +1422,14 @@ echo $response;
|
|||||||
"name": "devs",
|
"name": "devs",
|
||||||
"peers_count": 2
|
"peers_count": 2
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"action": "accept"
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"id": "ch8i4ug6lnn4g9hqv7mg"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
```json {{ title: 'Schema' }}
|
```json {{ title: 'Schema' }}
|
||||||
{
|
{
|
||||||
|
"id": "string",
|
||||||
"name": "string",
|
"name": "string",
|
||||||
"description": "string",
|
"description": "string",
|
||||||
"enabled": "boolean",
|
"enabled": "boolean",
|
||||||
@@ -1419,6 +1440,12 @@ echo $response;
|
|||||||
"name": "string",
|
"name": "string",
|
||||||
"description": "string",
|
"description": "string",
|
||||||
"enabled": "boolean",
|
"enabled": "boolean",
|
||||||
|
"action": "string",
|
||||||
|
"bidirectional": "boolean",
|
||||||
|
"protocol": "string",
|
||||||
|
"ports": [
|
||||||
|
"string"
|
||||||
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"id": "string",
|
"id": "string",
|
||||||
@@ -1432,11 +1459,9 @@ echo $response;
|
|||||||
"name": "string",
|
"name": "string",
|
||||||
"peers_count": "integer"
|
"peers_count": "integer"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"action": "string"
|
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
"id": "string"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
@@ -1455,7 +1480,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Delete a Policy
|
Delete a policy
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Routes'
|
export const title = 'Routes'
|
||||||
|
|
||||||
|
|
||||||
@@ -1151,7 +1150,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Delete a Route
|
Delete a route
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Rules'
|
export const title = 'Rules'
|
||||||
|
|
||||||
|
|
||||||
@@ -7,7 +6,7 @@ export const title = 'Rules'
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Returns a list of all Rules
|
Returns a list of all rules
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Col sticky>
|
<Col sticky>
|
||||||
@@ -227,7 +226,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Creates a Rule
|
Creates a rule
|
||||||
|
|
||||||
#### Request-Body Parameters
|
#### Request-Body Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
@@ -575,7 +574,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Get information about a Rules
|
Get information about a rules
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
@@ -799,7 +798,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Update/Replace a Rule
|
Update/Replace a rule
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
@@ -1159,7 +1158,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Delete a Rule
|
Delete a rule
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Setup Keys'
|
export const title = 'Setup Keys'
|
||||||
|
|
||||||
|
|
||||||
@@ -219,7 +218,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Creates a Setup Key
|
Creates a setup key
|
||||||
|
|
||||||
#### Request-Body Parameters
|
#### Request-Body Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
@@ -549,7 +548,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Get information about a Setup Key
|
Get information about a setup key
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
@@ -765,7 +764,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Update information about a Setup Key
|
Update information about a setup key
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Tokens'
|
export const title = 'Tokens'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export const title = 'Users'
|
export const title = 'Users'
|
||||||
|
|
||||||
|
|
||||||
@@ -181,7 +180,8 @@ echo $response;
|
|||||||
"devs"
|
"devs"
|
||||||
],
|
],
|
||||||
"is_current": true,
|
"is_current": true,
|
||||||
"is_service_user": false
|
"is_service_user": false,
|
||||||
|
"is_blocked": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@@ -197,7 +197,8 @@ echo $response;
|
|||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"is_current": "boolean",
|
"is_current": "boolean",
|
||||||
"is_service_user": "boolean"
|
"is_service_user": "boolean",
|
||||||
|
"is_blocked": "boolean"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@@ -490,7 +491,8 @@ echo $response;
|
|||||||
"devs"
|
"devs"
|
||||||
],
|
],
|
||||||
"is_current": true,
|
"is_current": true,
|
||||||
"is_service_user": false
|
"is_service_user": false,
|
||||||
|
"is_blocked": false
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
```json {{ title: 'Schema' }}
|
```json {{ title: 'Schema' }}
|
||||||
@@ -504,7 +506,8 @@ echo $response;
|
|||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"is_current": "boolean",
|
"is_current": "boolean",
|
||||||
"is_service_user": "boolean"
|
"is_service_user": "boolean",
|
||||||
|
"is_blocked": "boolean"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
@@ -548,6 +551,13 @@ echo $response;
|
|||||||
|
|
||||||
>
|
>
|
||||||
Groups to auto-assign to peers registered by this user
|
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>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -563,7 +573,8 @@ curl -X PUT https://api.netbird.io/api/users/{userId} \
|
|||||||
"role": "admin",
|
"role": "admin",
|
||||||
"auto_groups": [
|
"auto_groups": [
|
||||||
"devs"
|
"devs"
|
||||||
]
|
],
|
||||||
|
"is_blocked": false
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -573,7 +584,8 @@ let data = JSON.stringify({
|
|||||||
"role": "admin",
|
"role": "admin",
|
||||||
"auto_groups": [
|
"auto_groups": [
|
||||||
"devs"
|
"devs"
|
||||||
]
|
],
|
||||||
|
"is_blocked": false
|
||||||
});
|
});
|
||||||
let config = {
|
let config = {
|
||||||
method: 'put',
|
method: 'put',
|
||||||
@@ -605,7 +617,8 @@ payload = json.dumps({
|
|||||||
"role": "admin",
|
"role": "admin",
|
||||||
"auto_groups": [
|
"auto_groups": [
|
||||||
"devs"
|
"devs"
|
||||||
]
|
],
|
||||||
|
"is_blocked": false
|
||||||
})
|
})
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
@@ -637,7 +650,8 @@ func main() {
|
|||||||
"role": "admin",
|
"role": "admin",
|
||||||
"auto_groups": [
|
"auto_groups": [
|
||||||
"devs"
|
"devs"
|
||||||
]
|
],
|
||||||
|
"is_blocked": false
|
||||||
}`)
|
}`)
|
||||||
client := &http.Client {
|
client := &http.Client {
|
||||||
}
|
}
|
||||||
@@ -687,7 +701,8 @@ request.body = JSON.dump({
|
|||||||
"role": "admin",
|
"role": "admin",
|
||||||
"auto_groups": [
|
"auto_groups": [
|
||||||
"devs"
|
"devs"
|
||||||
]
|
],
|
||||||
|
"is_blocked": false
|
||||||
})
|
})
|
||||||
response = https.request(request)
|
response = https.request(request)
|
||||||
puts response.read_body
|
puts response.read_body
|
||||||
@@ -701,7 +716,8 @@ RequestBody body = RequestBody.create(mediaType, '{
|
|||||||
"role": "admin",
|
"role": "admin",
|
||||||
"auto_groups": [
|
"auto_groups": [
|
||||||
"devs"
|
"devs"
|
||||||
]
|
],
|
||||||
|
"is_blocked": false
|
||||||
}');
|
}');
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url("https://api.netbird.io/api/users/{userId}")
|
.url("https://api.netbird.io/api/users/{userId}")
|
||||||
@@ -731,7 +747,8 @@ curl_setopt_array($curl, array(
|
|||||||
"role": "admin",
|
"role": "admin",
|
||||||
"auto_groups": [
|
"auto_groups": [
|
||||||
"devs"
|
"devs"
|
||||||
]
|
],
|
||||||
|
"is_blocked": false
|
||||||
}',
|
}',
|
||||||
CURLOPT_HTTPHEADER => array(
|
CURLOPT_HTTPHEADER => array(
|
||||||
'Content-Type: application/json',
|
'Content-Type: application/json',
|
||||||
@@ -762,7 +779,8 @@ echo $response;
|
|||||||
"devs"
|
"devs"
|
||||||
],
|
],
|
||||||
"is_current": true,
|
"is_current": true,
|
||||||
"is_service_user": false
|
"is_service_user": false,
|
||||||
|
"is_blocked": false
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
```json {{ title: 'Schema' }}
|
```json {{ title: 'Schema' }}
|
||||||
@@ -776,7 +794,8 @@ echo $response;
|
|||||||
"string"
|
"string"
|
||||||
],
|
],
|
||||||
"is_current": "boolean",
|
"is_current": "boolean",
|
||||||
"is_service_user": "boolean"
|
"is_service_user": "boolean",
|
||||||
|
"is_blocked": "boolean"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
@@ -795,7 +814,7 @@ echo $response;
|
|||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
Delete a User
|
Delete a user
|
||||||
|
|
||||||
#### Path Parameters
|
#### Path Parameters
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|||||||
Reference in New Issue
Block a user