add examples to response

This commit is contained in:
Pascal Fischer
2023-05-05 18:00:13 +02:00
parent 2b65de30e4
commit adf57d5294
16 changed files with 1174 additions and 180 deletions

View File

@@ -49,8 +49,9 @@ export type schemaParameter = {
enum?: string[] enum?: string[]
} }
export type schemaObject = { export type component = {
examples: Object example: Object
schema: Object
parameters: schemaParameter[] parameters: schemaParameter[]
} }
@@ -77,31 +78,39 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string, { apiUrl }: { apiU
}) })
}) })
let schemas = new Map<string, schemaObject>(); let components = new Map<string, component>();
Object.entries(spec.components?.schemas).forEach(([key, val]) => { Object.entries(spec.components?.schemas).forEach(([key, val]) => {
const schema = val as OpenAPIV3.SchemaObject const schema = val as OpenAPIV3.SchemaObject
let examples = new Map<string, any>(); let outputSchema = new Map<string, any>();
let outputExample = new Map<string, any>();
let parameters : schemaParameter[] = [] let parameters : schemaParameter[] = []
if(schema.allOf){ if(schema.allOf){
schema.allOf.forEach((item) => { schema.allOf.forEach((item) => {
if((item as OpenAPIV3.ReferenceObject).$ref){ if((item as OpenAPIV3.ReferenceObject).$ref){
let schemaObject = schemas.get((item as OpenAPIV3.ReferenceObject).$ref.split('/').pop()) let component = components.get((item as OpenAPIV3.ReferenceObject).$ref.split('/').pop())
let examplesMap = new Map(Object.entries(schemaObject.examples)) let schemaMap = new Map(Object.entries(component.schema))
examplesMap.forEach((value, key) => { let exampleMap = new Map(Object.entries(component.example))
examples.set(key, value) schemaMap.forEach((value, key) => {
outputSchema.set(key, value)
}) })
parameters = parameters.concat(schemaObject.parameters) exampleMap.forEach((value, key) => {
outputExample.set(key, value)
})
parameters = parameters.concat(component.parameters)
} }
if((item as OpenAPIV3.SchemaObject).properties){ if((item as OpenAPIV3.SchemaObject).properties){
Object.entries((item as OpenAPIV3.SchemaObject).properties).forEach(([key, val]) => { Object.entries((item as OpenAPIV3.SchemaObject).properties).forEach(([key, val]) => {
let property = val as OpenAPIV3.SchemaObject let property = val as OpenAPIV3.SchemaObject
let type let type, exampleValue
if (property.type === "array") { if (property.type === "array") {
type = new Array(resolveType(property.items, spec.components?.schemas)) type = new Array(resolveType(property.items, spec.components?.schemas))
exampleValue = new Array(resolveExampleValue(property.items, spec.components?.schemas))
} else { } else {
type = resolveType(property, spec.components?.schemas) type = resolveType(property, spec.components?.schemas)
exampleValue = resolveExampleValue(property, spec.components?.schemas)
} }
examples.set(key, type) outputSchema.set(key, type)
outputExample.set(key, exampleValue)
let parameter: schemaParameter = { let parameter: schemaParameter = {
name: key, name: key,
type: property.type === "array" ? ((property.items as OpenAPIV3.SchemaObject).type || (property.items as OpenAPIV3.ReferenceObject).$ref.split('/').pop()) + "[]" : property.type, type: property.type === "array" ? ((property.items as OpenAPIV3.SchemaObject).type || (property.items as OpenAPIV3.ReferenceObject).$ref.split('/').pop()) + "[]" : property.type,
@@ -120,13 +129,16 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string, { apiUrl }: { apiU
} else { } else {
Object.entries(schema.properties).forEach(([key, val]) => { Object.entries(schema.properties).forEach(([key, val]) => {
let property = val as OpenAPIV3.SchemaObject let property = val as OpenAPIV3.SchemaObject
let type let type, exampleValue
if(property.type === "array"){ if(property.type === "array"){
type = new Array(resolveType(property.items, spec.components?.schemas)) type = new Array(resolveType(property.items, spec.components?.schemas))
exampleValue = new Array(resolveExampleValue(property.items, spec.components?.schemas))
} else { } else {
type = resolveType(property, spec.components?.schemas) type = resolveType(property, spec.components?.schemas)
exampleValue = resolveExampleValue(property, spec.components?.schemas)
} }
examples.set(key, type) outputSchema.set(key, type)
outputExample.set(key, exampleValue)
let parameter : schemaParameter = { let parameter : schemaParameter = {
name: key, name: key,
type: property.type === "array" ? ((property.items as OpenAPIV3.SchemaObject).type || (property.items as OpenAPIV3.ReferenceObject).$ref.split('/').pop()) + "[]" : property.type, type: property.type === "array" ? ((property.items as OpenAPIV3.SchemaObject).type || (property.items as OpenAPIV3.ReferenceObject).$ref.split('/').pop()) + "[]" : property.type,
@@ -142,12 +154,12 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string, { apiUrl }: { apiU
}) })
} }
let output : component = {
let output : schemaObject = { example: Object.fromEntries(outputExample),
examples: Object.fromEntries(examples), schema: Object.fromEntries(outputSchema),
parameters: parameters parameters: parameters
} }
schemas.set(key, output) components.set(key, output)
}) })
@@ -169,7 +181,7 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string, { apiUrl }: { apiU
tag: key, tag: key,
sections, sections,
operations, operations,
schemas, components,
}) })
// Write to disk // Write to disk
@@ -198,3 +210,23 @@ function resolveType(items: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject |
return (items as OpenAPIV3.ArraySchemaObject).type return (items as OpenAPIV3.ArraySchemaObject).type
} }
function resolveExampleValue(items: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject | OpenAPIV3.NonArraySchemaObjectType, schemas) : any {
if((items as OpenAPIV3.ReferenceObject).$ref){
let ref = (items as OpenAPIV3.ReferenceObject).$ref
let map = new Map<string, any>()
Object.entries(schemas[ref.split('/').pop()].properties).forEach(([key, val]) => {
let property = val as OpenAPIV3.SchemaObject
let exampleValue
if(property.type === "array"){
exampleValue = new Array(resolveExampleValue(property.items, schemas))
} else {
exampleValue = resolveExampleValue(property, schemas)
}
map.set(key, exampleValue)
})
return Object.fromEntries(map)
}
return (items as OpenAPIV3.ArraySchemaObject).example
}

View File

@@ -158,7 +158,7 @@
"/api/users" : { "/api/users" : {
"get" : { "get" : {
"tags" : [ "Users" ], "tags" : [ "Users" ],
"summary" : "Retrieve Users", "summary" : "List all Users",
"description" : "Returns a list of all users", "description" : "Returns a list of all users",
"operationId" : "getUsers", "operationId" : "getUsers",
"parameters" : [ { "parameters" : [ {
@@ -2325,7 +2325,8 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Account ID" "description" : "Account ID",
"example" : "ch8i4ug6lnn4g9hqv7l0"
}, },
"settings" : { "settings" : {
"$ref" : "#/components/schemas/AccountSettings" "$ref" : "#/components/schemas/AccountSettings"
@@ -2337,11 +2338,13 @@
"properties" : { "properties" : {
"peer_login_expiration_enabled" : { "peer_login_expiration_enabled" : {
"type" : "boolean", "type" : "boolean",
"description" : "Enables or disables peer login expiration globally. After peer's login has expired the user has to log in (authenticate). Applies only to peers that were added by a user (interactive SSO login)." "description" : "Enables or disables peer login expiration globally. After peer's login has expired the user has to log in (authenticate). Applies only to peers that were added by a user (interactive SSO login).",
"example" : true
}, },
"peer_login_expiration" : { "peer_login_expiration" : {
"type" : "integer", "type" : "integer",
"description" : "Period of time after which peer login expires (seconds)." "description" : "Period of time after which peer login expires (seconds).",
"example" : 43200
} }
} }
}, },
@@ -2351,41 +2354,49 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "User ID" "description" : "User ID",
"example" : "google-oauth2|277474792786460067937"
}, },
"email" : { "email" : {
"type" : "string", "type" : "string",
"description" : "User's email address" "description" : "User's email address",
"example" : "demo@netbird.io"
}, },
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "User's name from idp provider" "description" : "User's name from idp provider",
"example" : "Tom Schulz"
}, },
"role" : { "role" : {
"type" : "string", "type" : "string",
"description" : "User's NetBird account role" "description" : "User's NetBird account role",
"example" : "admin"
}, },
"status" : { "status" : {
"type" : "string", "type" : "string",
"description" : "User's status", "description" : "User's status",
"example" : "active",
"enum" : [ "active", "invited", "disabled" ] "enum" : [ "active", "invited", "disabled" ]
}, },
"auto_groups" : { "auto_groups" : {
"type" : "array", "type" : "array",
"description" : "Groups to auto-assign to peers registered by this user", "description" : "Groups to auto-assign to peers registered by this user",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "devs"
} }
}, },
"is_current" : { "is_current" : {
"type" : "boolean", "type" : "boolean",
"description" : "Is true if authenticated user is the same as this user", "description" : "Is true if authenticated user is the same as this user",
"readOnly" : true "readOnly" : true,
"example" : true
}, },
"is_service_user" : { "is_service_user" : {
"type" : "boolean", "type" : "boolean",
"description" : "Is true if this user is a service user", "description" : "Is true if this user is a service user",
"readOnly" : true "readOnly" : true,
"example" : false
} }
} }
}, },
@@ -2395,13 +2406,15 @@
"properties" : { "properties" : {
"role" : { "role" : {
"type" : "string", "type" : "string",
"description" : "User's NetBird account role" "description" : "User's NetBird account role",
"example" : "admin"
}, },
"auto_groups" : { "auto_groups" : {
"type" : "array", "type" : "array",
"description" : "Groups to auto-assign to peers registered by this user", "description" : "Groups to auto-assign to peers registered by this user",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "devs"
} }
} }
} }
@@ -2412,26 +2425,31 @@
"properties" : { "properties" : {
"email" : { "email" : {
"type" : "string", "type" : "string",
"description" : "User's Email to send invite to" "description" : "User's Email to send invite to",
"example" : "demo@netbird.io"
}, },
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "User's full name" "description" : "User's full name",
"example" : "Tom Schulz"
}, },
"role" : { "role" : {
"type" : "string", "type" : "string",
"description" : "User's NetBird account role" "description" : "User's NetBird account role",
"example" : "admin"
}, },
"auto_groups" : { "auto_groups" : {
"type" : "array", "type" : "array",
"description" : "Groups to auto-assign to peers registered by this user", "description" : "Groups to auto-assign to peers registered by this user",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "devs"
} }
}, },
"is_service_user" : { "is_service_user" : {
"type" : "boolean", "type" : "boolean",
"description" : "Is true if this user is a service user" "description" : "Is true if this user is a service user",
"example" : false
} }
} }
}, },
@@ -2441,11 +2459,13 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Peer ID" "description" : "Peer ID",
"example" : "chacbco6lnnbn6cg5s90"
}, },
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Peer's hostname" "description" : "Peer's hostname",
"example" : "stage-host-1"
} }
} }
}, },
@@ -2454,13 +2474,16 @@
"type" : "object", "type" : "object",
"properties" : { "properties" : {
"name" : { "name" : {
"type" : "string" "type" : "string",
"example" : "stage-host-1"
}, },
"ssh_enabled" : { "ssh_enabled" : {
"type" : "boolean" "type" : "boolean",
"example" : true
}, },
"login_expiration_enabled" : { "login_expiration_enabled" : {
"type" : "boolean" "type" : "boolean",
"example" : false
} }
} }
}, },
@@ -2473,24 +2496,29 @@
"properties" : { "properties" : {
"ip" : { "ip" : {
"type" : "string", "type" : "string",
"description" : "Peer's IP address" "description" : "Peer's IP address",
"example" : "10.64.0.1"
}, },
"connected" : { "connected" : {
"type" : "boolean", "type" : "boolean",
"description" : "Peer to Management connection status" "description" : "Peer to Management connection status",
"example" : true
}, },
"last_seen" : { "last_seen" : {
"type" : "string", "type" : "string",
"description" : "Last time peer connected to Netbird's management service", "description" : "Last time peer connected to Netbird's management service",
"format" : "date-time" "format" : "date-time",
"example" : "2023-05-05T10:05:26.420578Z"
}, },
"os" : { "os" : {
"type" : "string", "type" : "string",
"description" : "Peer's operating system and version" "description" : "Peer's operating system and version",
"example" : "Darwin 13.2.1"
}, },
"version" : { "version" : {
"type" : "string", "type" : "string",
"description" : "Peer's daemon or cli version" "description" : "Peer's daemon or cli version",
"example" : "0.14.0"
}, },
"groups" : { "groups" : {
"type" : "array", "type" : "array",
@@ -2501,36 +2529,44 @@
}, },
"ssh_enabled" : { "ssh_enabled" : {
"type" : "boolean", "type" : "boolean",
"description" : "Indicates whether SSH server is enabled on this peer" "description" : "Indicates whether SSH server is enabled on this peer",
"example" : true
}, },
"user_id" : { "user_id" : {
"type" : "string", "type" : "string",
"description" : "User ID of the user that enrolled this peer" "description" : "User ID of the user that enrolled this peer",
"example" : "google-oauth2|277474792786460067937"
}, },
"hostname" : { "hostname" : {
"type" : "string", "type" : "string",
"description" : "Hostname of the machine" "description" : "Hostname of the machine",
"example" : "stage-host-1"
}, },
"ui_version" : { "ui_version" : {
"type" : "string", "type" : "string",
"description" : "Peer's desktop UI version" "description" : "Peer's desktop UI version",
"example" : "0.14.0"
}, },
"dns_label" : { "dns_label" : {
"type" : "string", "type" : "string",
"description" : "Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud" "description" : "Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud",
"example" : "stage-host-1.netbird.cloud"
}, },
"login_expiration_enabled" : { "login_expiration_enabled" : {
"type" : "boolean", "type" : "boolean",
"description" : "Indicates whether peer login expiration has been enabled or not" "description" : "Indicates whether peer login expiration has been enabled or not",
"example" : false
}, },
"login_expired" : { "login_expired" : {
"type" : "boolean", "type" : "boolean",
"description" : "Indicates whether peer's login expired or not" "description" : "Indicates whether peer's login expired or not",
"example" : false
}, },
"last_login" : { "last_login" : {
"type" : "string", "type" : "string",
"description" : "Last time this peer performed log in (authentication). E.g., user authenticated.", "description" : "Last time this peer performed log in (authentication). E.g., user authenticated.",
"format" : "date-time" "format" : "date-time",
"example" : "2023-05-05T09:00:35.477782Z"
} }
} }
} ] } ]
@@ -2541,61 +2577,74 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Setup Key ID" "description" : "Setup Key ID",
"example" : "2531583362"
}, },
"key" : { "key" : {
"type" : "string", "type" : "string",
"description" : "Setup Key value" "description" : "Setup Key value",
"example" : "A616097E-FCF0-48FA-9354-CA4A61142761"
}, },
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Setup key name identifier" "description" : "Setup key name identifier",
"example" : "Default key"
}, },
"expires" : { "expires" : {
"type" : "string", "type" : "string",
"description" : "Setup Key expiration date", "description" : "Setup Key expiration date",
"format" : "date-time" "format" : "date-time",
"example" : "2023-06-01T14:47:22.291057Z"
}, },
"type" : { "type" : {
"type" : "string", "type" : "string",
"description" : "Setup key type, one-off for single time usage and reusable" "description" : "Setup key type, one-off for single time usage and reusable",
"example" : "reusable"
}, },
"valid" : { "valid" : {
"type" : "boolean", "type" : "boolean",
"description" : "Setup key validity status" "description" : "Setup key validity status",
"example" : true
}, },
"revoked" : { "revoked" : {
"type" : "boolean", "type" : "boolean",
"description" : "Setup key revocation status" "description" : "Setup key revocation status",
"example" : false
}, },
"used_times" : { "used_times" : {
"type" : "integer", "type" : "integer",
"description" : "Usage count of setup key" "description" : "Usage count of setup key",
"example" : 2
}, },
"last_used" : { "last_used" : {
"type" : "string", "type" : "string",
"description" : "Setup key last usage date", "description" : "Setup key last usage date",
"format" : "date-time" "format" : "date-time",
"example" : "2023-05-05T09:00:35.477782Z"
}, },
"state" : { "state" : {
"type" : "string", "type" : "string",
"description" : "Setup key status, \"valid\", \"overused\",\"expired\" or \"revoked\"" "description" : "Setup key status, \"valid\", \"overused\",\"expired\" or \"revoked\"",
"example" : "valid"
}, },
"auto_groups" : { "auto_groups" : {
"type" : "array", "type" : "array",
"description" : "Setup key groups to auto-assign to peers registered with this key", "description" : "Setup key groups to auto-assign to peers registered with this key",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "devs"
} }
}, },
"updated_at" : { "updated_at" : {
"type" : "string", "type" : "string",
"description" : "Setup key last update date", "description" : "Setup key last update date",
"format" : "date-time" "format" : "date-time",
"example" : "2023-05-05T09:00:35.477782Z"
}, },
"usage_limit" : { "usage_limit" : {
"type" : "integer", "type" : "integer",
"description" : "A number of times this key can be used. The value of 0 indicates the unlimited usage." "description" : "A number of times this key can be used. The value of 0 indicates the unlimited usage.",
"example" : 0
} }
} }
}, },
@@ -2605,30 +2654,36 @@
"properties" : { "properties" : {
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Setup Key name" "description" : "Setup Key name",
"example" : "Default key"
}, },
"type" : { "type" : {
"type" : "string", "type" : "string",
"description" : "Setup key type, one-off for single time usage and reusable" "description" : "Setup key type, one-off for single time usage and reusable",
"example" : "reusable"
}, },
"expires_in" : { "expires_in" : {
"type" : "integer", "type" : "integer",
"description" : "Expiration time in seconds" "description" : "Expiration time in seconds",
"example" : 43200
}, },
"revoked" : { "revoked" : {
"type" : "boolean", "type" : "boolean",
"description" : "Setup key revocation status" "description" : "Setup key revocation status",
"example" : false
}, },
"auto_groups" : { "auto_groups" : {
"type" : "array", "type" : "array",
"description" : "Setup key groups to auto-assign to peers registered with this key", "description" : "Setup key groups to auto-assign to peers registered with this key",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "devs"
} }
}, },
"usage_limit" : { "usage_limit" : {
"type" : "integer", "type" : "integer",
"description" : "A number of times this key can be used. The value of 0 indicates the unlimited usage." "description" : "A number of times this key can be used. The value of 0 indicates the unlimited usage.",
"example" : 0
} }
} }
}, },
@@ -2638,30 +2693,36 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "ID of a token" "description" : "ID of a token",
"example" : "ch8i54g6lnn4g9hqv7n0"
}, },
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Name of the token" "description" : "Name of the token",
"example" : "My first token"
}, },
"expiration_date" : { "expiration_date" : {
"type" : "string", "type" : "string",
"description" : "Date the token expires", "description" : "Date the token expires",
"format" : "date-time" "format" : "date-time",
"example" : "2023-05-05T14:38:28.977616Z"
}, },
"created_by" : { "created_by" : {
"type" : "string", "type" : "string",
"description" : "User ID of the user who created the token" "description" : "User ID of the user who created the token",
"example" : "google-oauth2|277474792786460067937"
}, },
"created_at" : { "created_at" : {
"type" : "string", "type" : "string",
"description" : "Date the token was created", "description" : "Date the token was created",
"format" : "date-time" "format" : "date-time",
"example" : "2023-05-02T14:48:20.465209Z"
}, },
"last_used" : { "last_used" : {
"type" : "string", "type" : "string",
"description" : "Date the token was last used", "description" : "Date the token was last used",
"format" : "date-time" "format" : "date-time",
"example" : "2023-05-04T12:45:25.9723616Z"
} }
} }
}, },
@@ -2671,7 +2732,8 @@
"properties" : { "properties" : {
"plain_token" : { "plain_token" : {
"type" : "string", "type" : "string",
"description" : "Plain text representation of the generated token" "description" : "Plain text representation of the generated token",
"example" : "2023-05-02T14:48:20.465209Z"
}, },
"personal_access_token" : { "personal_access_token" : {
"$ref" : "#/components/schemas/PersonalAccessToken" "$ref" : "#/components/schemas/PersonalAccessToken"
@@ -2684,13 +2746,15 @@
"properties" : { "properties" : {
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Name of the token" "description" : "Name of the token",
"example" : "My first token"
}, },
"expires_in" : { "expires_in" : {
"maximum" : 365, "maximum" : 365,
"minimum" : 1, "minimum" : 1,
"type" : "integer", "type" : "integer",
"description" : "Expiration in days" "description" : "Expiration in days",
"example" : 30
} }
} }
}, },
@@ -2700,15 +2764,18 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Group ID" "description" : "Group ID",
"example" : "ch8i4ug6lnn4g9hqv7m0"
}, },
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Group Name identifier" "description" : "Group Name identifier",
"example" : "devs"
}, },
"peers_count" : { "peers_count" : {
"type" : "integer", "type" : "integer",
"description" : "Count of peers associated to the group" "description" : "Count of peers associated to the group",
"example" : 2
} }
} }
}, },
@@ -2718,11 +2785,13 @@
"properties" : { "properties" : {
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Group name identifier" "description" : "Group name identifier",
"example" : "devs"
}, },
"peers" : { "peers" : {
"type" : "array", "type" : "array",
"description" : "List of peers ids", "description" : "List of peers ids",
"example" : "ch8i4ug6lnn4g9hqv7m1",
"items" : { "items" : {
"type" : "string" "type" : "string"
} }
@@ -2752,19 +2821,23 @@
"properties" : { "properties" : {
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Rule name identifier" "description" : "Rule name identifier",
"example" : "Default"
}, },
"description" : { "description" : {
"type" : "string", "type" : "string",
"description" : "Rule friendly description" "description" : "Rule friendly description",
"example" : "This is a default rule that allows connections between all the resources"
}, },
"disabled" : { "disabled" : {
"type" : "boolean", "type" : "boolean",
"description" : "Rules status" "description" : "Rules status",
"example" : false
}, },
"flow" : { "flow" : {
"type" : "string", "type" : "string",
"description" : "Rule flow, currently, only \"bidirect\" for bi-directional traffic is accepted" "description" : "Rule flow, currently, only \"bidirect\" for bi-directional traffic is accepted",
"example" : "bidirect"
} }
} }
}, },
@@ -2778,14 +2851,16 @@
"type" : "array", "type" : "array",
"description" : "List of source groups", "description" : "List of source groups",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "ch8i4ug6lnn4g9hqv7m1"
} }
}, },
"destinations" : { "destinations" : {
"type" : "array", "type" : "array",
"description" : "List of destination groups", "description" : "List of destination groups",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "ch8i4ug6lnn4g9hqv7m0"
} }
} }
} }
@@ -2798,7 +2873,8 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Rule ID" "description" : "Rule ID",
"example" : "ch8i4ug6lnn4g9hqv7mg"
} }
} }
}, { }, {
@@ -2830,19 +2906,23 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Rule ID" "description" : "Rule ID",
"example" : "ch8i4ug6lnn4g9hqv7mg"
}, },
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Rule name identifier" "description" : "Rule name identifier",
"example" : "Default"
}, },
"description" : { "description" : {
"type" : "string", "type" : "string",
"description" : "Rule friendly description" "description" : "Rule friendly description",
"example" : "This is a default rule that allows connections between all the resources"
}, },
"enabled" : { "enabled" : {
"type" : "boolean", "type" : "boolean",
"description" : "Rules status" "description" : "Rules status",
"example" : true
}, },
"sources" : { "sources" : {
"type" : "array", "type" : "array",
@@ -2861,6 +2941,7 @@
"action" : { "action" : {
"type" : "string", "type" : "string",
"description" : "policy accept or drops packets", "description" : "policy accept or drops packets",
"example" : "accept",
"enum" : [ "accept", "drop" ] "enum" : [ "accept", "drop" ]
} }
} }
@@ -2871,19 +2952,23 @@
"properties" : { "properties" : {
"name" : { "name" : {
"type" : "string", "type" : "string",
"description" : "Policy name identifier" "description" : "Policy name identifier",
"example" : "ch8i4ug6lnn4g9hqv7mg"
}, },
"description" : { "description" : {
"type" : "string", "type" : "string",
"description" : "Policy friendly description" "description" : "Policy friendly description",
"example" : "This is a default policy that allows connections between all the resources"
}, },
"enabled" : { "enabled" : {
"type" : "boolean", "type" : "boolean",
"description" : "Policy status" "description" : "Policy status",
"example" : true
}, },
"query" : { "query" : {
"type" : "string", "type" : "string",
"description" : "Policy Rego query" "description" : "Policy Rego query",
"example" : "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" : {
"type" : "array", "type" : "array",
@@ -2903,7 +2988,8 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Policy ID" "description" : "Policy ID",
"example" : "ch8i4ug6lnn4g9hqv7mg"
} }
} }
} ] } ]
@@ -2914,41 +3000,49 @@
"properties" : { "properties" : {
"description" : { "description" : {
"type" : "string", "type" : "string",
"description" : "Route description" "description" : "Route description",
"example" : "My first route"
}, },
"network_id" : { "network_id" : {
"maxLength" : 40, "maxLength" : 40,
"minLength" : 1, "minLength" : 1,
"type" : "string", "type" : "string",
"description" : "Route network identifier, to group HA routes" "description" : "Route network identifier, to group HA routes",
"example" : "Route 1"
}, },
"enabled" : { "enabled" : {
"type" : "boolean", "type" : "boolean",
"description" : "Route status" "description" : "Route status",
"example" : true
}, },
"peer" : { "peer" : {
"type" : "string", "type" : "string",
"description" : "Peer Identifier associated with route" "description" : "Peer Identifier associated with route",
"example" : "chacbco6lnnbn6cg5s91"
}, },
"network" : { "network" : {
"type" : "string", "type" : "string",
"description" : "Network range in CIDR format" "description" : "Network range in CIDR format",
"example" : "10.64.0.0/24"
}, },
"metric" : { "metric" : {
"maximum" : 9999, "maximum" : 9999,
"minimum" : 1, "minimum" : 1,
"type" : "integer", "type" : "integer",
"description" : "Route metric number. Lowest number has higher priority" "description" : "Route metric number. Lowest number has higher priority",
"example" : 9999
}, },
"masquerade" : { "masquerade" : {
"type" : "boolean", "type" : "boolean",
"description" : "Indicate if peer should masquerade traffic to this route's prefix" "description" : "Indicate if peer should masquerade traffic to this route's prefix",
"example" : true
}, },
"groups" : { "groups" : {
"type" : "array", "type" : "array",
"description" : "Route group tag groups", "description" : "Route group tag groups",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "chacdk86lnnboviihd70"
} }
} }
} }
@@ -2960,11 +3054,13 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Route Id" "description" : "Route Id",
"example" : "chacdk86lnnboviihd7g"
}, },
"network_type" : { "network_type" : {
"type" : "string", "type" : "string",
"description" : "Network type indicating if it is IPv4 or IPv6" "description" : "Network type indicating if it is IPv4 or IPv6",
"example" : "IPv4"
} }
} }
}, { }, {
@@ -2977,16 +3073,19 @@
"properties" : { "properties" : {
"ip" : { "ip" : {
"type" : "string", "type" : "string",
"description" : "Nameserver IP" "description" : "Nameserver IP",
"example" : "8.8.8.8"
}, },
"ns_type" : { "ns_type" : {
"type" : "string", "type" : "string",
"description" : "Nameserver Type", "description" : "Nameserver Type",
"example" : "udp",
"enum" : [ "udp" ] "enum" : [ "udp" ]
}, },
"port" : { "port" : {
"type" : "integer", "type" : "integer",
"description" : "Nameserver Port" "description" : "Nameserver Port",
"example" : 53
} }
} }
}, },
@@ -2998,11 +3097,13 @@
"maxLength" : 40, "maxLength" : 40,
"minLength" : 1, "minLength" : 1,
"type" : "string", "type" : "string",
"description" : "Nameserver group name" "description" : "Nameserver group name",
"example" : "Google DNS"
}, },
"description" : { "description" : {
"type" : "string", "type" : "string",
"description" : "Nameserver group description" "description" : "Nameserver group description",
"example" : "Google DNS servers"
}, },
"nameservers" : { "nameservers" : {
"maxLength" : 2, "maxLength" : 2,
@@ -3015,18 +3116,21 @@
}, },
"enabled" : { "enabled" : {
"type" : "boolean", "type" : "boolean",
"description" : "Nameserver group status" "description" : "Nameserver group status",
"example" : true
}, },
"groups" : { "groups" : {
"type" : "array", "type" : "array",
"description" : "Nameserver group tag groups", "description" : "Nameserver group tag groups",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "ch8i4ug6lnn4g9hqv7m0"
} }
}, },
"primary" : { "primary" : {
"type" : "boolean", "type" : "boolean",
"description" : "Nameserver group primary status" "description" : "Nameserver group primary status",
"example" : true
}, },
"domains" : { "domains" : {
"type" : "array", "type" : "array",
@@ -3034,7 +3138,8 @@
"items" : { "items" : {
"maxLength" : 255, "maxLength" : 255,
"minLength" : 1, "minLength" : 1,
"type" : "string" "type" : "string",
"example" : "example.com"
} }
} }
} }
@@ -3046,7 +3151,8 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Nameserver group ID" "description" : "Nameserver group ID",
"example" : "ch8i4ug6lnn4g9hqv7m0"
} }
} }
}, { }, {
@@ -3061,7 +3167,8 @@
"type" : "array", "type" : "array",
"description" : "Groups whose DNS management is disabled", "description" : "Groups whose DNS management is disabled",
"items" : { "items" : {
"type" : "string" "type" : "string",
"example" : "ch8i4ug6lnn4g9hqv7m0"
} }
} }
} }
@@ -3072,36 +3179,47 @@
"properties" : { "properties" : {
"id" : { "id" : {
"type" : "string", "type" : "string",
"description" : "Event unique identifier" "description" : "Event unique identifier",
"example" : "10"
}, },
"timestamp" : { "timestamp" : {
"type" : "string", "type" : "string",
"description" : "The date and time when the event occurred", "description" : "The date and time when the event occurred",
"format" : "date-time" "format" : "date-time",
"example" : "2023-05-05T10:04:37.473542Z"
}, },
"activity" : { "activity" : {
"type" : "string", "type" : "string",
"description" : "The activity that occurred during the event" "description" : "The activity that occurred during the event",
"example" : "Route created"
}, },
"activity_code" : { "activity_code" : {
"type" : "string", "type" : "string",
"description" : "The string code of the activity that occurred during the event", "description" : "The string code of the activity that occurred during the event",
"example" : "route.add",
"enum" : [ "user.peer.delete", "user.join", "user.invite", "user.peer.add", "user.group.add", "user.group.delete", "user.role.update", "setupkey.peer.add", "setupkey.add", "setupkey.update", "setupkey.revoke", "setupkey.overuse", "setupkey.group.delete", "setupkey.group.add", "rule.add", "rule.delete", "rule.update", "policy.add", "policy.delete", "policy.update", "group.add", "group.update", "dns.setting.disabled.management.group.add", "dns.setting.disabled.management.group.delete", "account.create", "account.setting.peer.login.expiration.update", "account.setting.peer.login.expiration.disable", "account.setting.peer.login.expiration.enable", "route.add", "route.delete", "route.update", "nameserver.group.add", "nameserver.group.delete", "nameserver.group.update", "peer.ssh.disable", "peer.ssh.enable", "peer.rename", "peer.login.expiration.disable", "peer.login.expiration.enable", "service.user.create", "personal.access.token.create", "service.user.delete", "personal.access.token.delete" ] "enum" : [ "user.peer.delete", "user.join", "user.invite", "user.peer.add", "user.group.add", "user.group.delete", "user.role.update", "setupkey.peer.add", "setupkey.add", "setupkey.update", "setupkey.revoke", "setupkey.overuse", "setupkey.group.delete", "setupkey.group.add", "rule.add", "rule.delete", "rule.update", "policy.add", "policy.delete", "policy.update", "group.add", "group.update", "dns.setting.disabled.management.group.add", "dns.setting.disabled.management.group.delete", "account.create", "account.setting.peer.login.expiration.update", "account.setting.peer.login.expiration.disable", "account.setting.peer.login.expiration.enable", "route.add", "route.delete", "route.update", "nameserver.group.add", "nameserver.group.delete", "nameserver.group.update", "peer.ssh.disable", "peer.ssh.enable", "peer.rename", "peer.login.expiration.disable", "peer.login.expiration.enable", "service.user.create", "personal.access.token.create", "service.user.delete", "personal.access.token.delete" ]
}, },
"initiator_id" : { "initiator_id" : {
"type" : "string", "type" : "string",
"description" : "The ID of the initiator of the event. E.g., an ID of a user that triggered the event." "description" : "The ID of the initiator of the event. E.g., an ID of a user that triggered the event.",
"example" : "google-oauth2|123456789012345678901"
}, },
"target_id" : { "target_id" : {
"type" : "string", "type" : "string",
"description" : "The ID of the target of the event. E.g., an ID of the peer that a user removed." "description" : "The ID of the target of the event. E.g., an ID of the peer that a user removed.",
"example" : "chad9d86lnnc59g18ou0"
}, },
"meta" : { "meta" : {
"type" : "object", "type" : "object",
"additionalProperties" : { "additionalProperties" : {
"type" : "string" "type" : "string"
}, },
"description" : "The metadata of the event" "description" : "The metadata of the event",
"example" : {
"name" : "my route",
"network_range" : "10.64.0.0/24",
"peer_id" : "chacbco6lnnbn6cg5s91"
}
} }
} }
} }

View File

@@ -36,6 +36,7 @@ components:
id: id:
description: Account ID description: Account ID
type: string type: string
example: ch8i4ug6lnn4g9hqv7l0
settings: settings:
$ref: '#/components/schemas/AccountSettings' $ref: '#/components/schemas/AccountSettings'
required: required:
@@ -46,9 +47,11 @@ components:
peer_login_expiration_enabled: peer_login_expiration_enabled:
description: Enables or disables peer login expiration globally. After peer's login has expired the user has to log in (authenticate). Applies only to peers that were added by a user (interactive SSO login). description: Enables or disables peer login expiration globally. After peer's login has expired the user has to log in (authenticate). Applies only to peers that were added by a user (interactive SSO login).
type: boolean type: boolean
example: true
peer_login_expiration: peer_login_expiration:
description: Period of time after which peer login expires (seconds). description: Period of time after which peer login expires (seconds).
type: integer type: integer
example: 43200
required: required:
- peer_login_expiration_enabled - peer_login_expiration_enabled
- peer_login_expiration - peer_login_expiration
@@ -58,32 +61,40 @@ components:
id: id:
description: User ID description: User ID
type: string type: string
example: google-oauth2|277474792786460067937
email: email:
description: User's email address description: User's email address
type: string type: string
example: demo@netbird.io
name: name:
description: User's name from idp provider description: User's name from idp provider
type: string type: string
example: Tom Schulz
role: role:
description: User's NetBird account role description: User's NetBird account role
type: string type: string
example: admin
status: status:
description: User's status description: User's status
type: string type: string
enum: [ "active","invited","disabled" ] enum: [ "active","invited","disabled" ]
example: active
auto_groups: auto_groups:
description: Groups to auto-assign to peers registered by this user description: Groups to auto-assign to peers registered by this user
type: array type: array
items: items:
type: string type: string
example: devs
is_current: is_current:
description: Is true if authenticated user is the same as this user description: Is true if authenticated user is the same as this user
type: boolean type: boolean
readOnly: true readOnly: true
example: true
is_service_user: is_service_user:
description: Is true if this user is a service user description: Is true if this user is a service user
type: boolean type: boolean
readOnly: true readOnly: true
example: false
required: required:
- id - id
- email - email
@@ -97,11 +108,13 @@ components:
role: role:
description: User's NetBird account role description: User's NetBird account role
type: string type: string
example: admin
auto_groups: auto_groups:
description: Groups to auto-assign to peers registered by this user description: Groups to auto-assign to peers registered by this user
type: array type: array
items: items:
type: string type: string
example: devs
required: required:
- role - role
- auto_groups - auto_groups
@@ -111,20 +124,25 @@ components:
email: email:
description: User's Email to send invite to description: User's Email to send invite to
type: string type: string
example: demo@netbird.io
name: name:
description: User's full name description: User's full name
type: string type: string
example: Tom Schulz
role: role:
description: User's NetBird account role description: User's NetBird account role
type: string type: string
example: admin
auto_groups: auto_groups:
description: Groups to auto-assign to peers registered by this user description: Groups to auto-assign to peers registered by this user
type: array type: array
items: items:
type: string type: string
example: devs
is_service_user: is_service_user:
description: Is true if this user is a service user description: Is true if this user is a service user
type: boolean type: boolean
example: false
required: required:
- role - role
- auto_groups - auto_groups
@@ -135,9 +153,11 @@ components:
id: id:
description: Peer ID description: Peer ID
type: string type: string
example: chacbco6lnnbn6cg5s90
name: name:
description: Peer's hostname description: Peer's hostname
type: string type: string
example: stage-host-1
required: required:
- id - id
- name - name
@@ -146,10 +166,13 @@ components:
properties: properties:
name: name:
type: string type: string
example: stage-host-1
ssh_enabled: ssh_enabled:
type: boolean type: boolean
example: true
login_expiration_enabled: login_expiration_enabled:
type: boolean type: boolean
example: false
required: required:
- name - name
- ssh_enabled - ssh_enabled
@@ -162,19 +185,24 @@ components:
ip: ip:
description: Peer's IP address description: Peer's IP address
type: string type: string
example: 10.64.0.1
connected: connected:
description: Peer to Management connection status description: Peer to Management connection status
type: boolean type: boolean
example: true
last_seen: last_seen:
description: Last time peer connected to Netbird's management service description: Last time peer connected to Netbird's management service
type: string type: string
format: date-time format: date-time
example: 2023-05-05T10:05:26.420578Z
os: os:
description: Peer's operating system and version description: Peer's operating system and version
type: string type: string
example: Darwin 13.2.1
version: version:
description: Peer's daemon or cli version description: Peer's daemon or cli version
type: string type: string
example: 0.14.0
groups: groups:
description: Groups that the peer belongs to description: Groups that the peer belongs to
type: array type: array
@@ -183,28 +211,36 @@ components:
ssh_enabled: ssh_enabled:
description: Indicates whether SSH server is enabled on this peer description: Indicates whether SSH server is enabled on this peer
type: boolean type: boolean
example: true
user_id: user_id:
description: User ID of the user that enrolled this peer description: User ID of the user that enrolled this peer
type: string type: string
example: google-oauth2|277474792786460067937
hostname: hostname:
description: Hostname of the machine description: Hostname of the machine
type: string type: string
example: stage-host-1
ui_version: ui_version:
description: Peer's desktop UI version description: Peer's desktop UI version
type: string type: string
example: 0.14.0
dns_label: dns_label:
description: Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud description: Peer's DNS label is the parsed peer name for domain resolution. It is used to form an FQDN by appending the account's domain to the peer label. e.g. peer-dns-label.netbird.cloud
type: string type: string
example: stage-host-1.netbird.cloud
login_expiration_enabled: login_expiration_enabled:
description: Indicates whether peer login expiration has been enabled or not description: Indicates whether peer login expiration has been enabled or not
type: boolean type: boolean
example: false
login_expired: login_expired:
description: Indicates whether peer's login expired or not description: Indicates whether peer's login expired or not
type: boolean type: boolean
example: false
last_login: last_login:
description: Last time this peer performed log in (authentication). E.g., user authenticated. description: Last time this peer performed log in (authentication). E.g., user authenticated.
type: string type: string
format: date-time format: date-time
example: 2023-05-05T09:00:35.477782Z
required: required:
- ip - ip
- connected - connected
@@ -224,47 +260,60 @@ components:
id: id:
description: Setup Key ID description: Setup Key ID
type: string type: string
example: 2531583362
key: key:
description: Setup Key value description: Setup Key value
type: string type: string
example: A616097E-FCF0-48FA-9354-CA4A61142761
name: name:
description: Setup key name identifier description: Setup key name identifier
type: string type: string
example: Default key
expires: expires:
description: Setup Key expiration date description: Setup Key expiration date
type: string type: string
format: date-time format: date-time
example: 2023-06-01T14:47:22.291057Z
type: type:
description: Setup key type, one-off for single time usage and reusable description: Setup key type, one-off for single time usage and reusable
type: string type: string
example: reusable
valid: valid:
description: Setup key validity status description: Setup key validity status
type: boolean type: boolean
example: true
revoked: revoked:
description: Setup key revocation status description: Setup key revocation status
type: boolean type: boolean
example: false
used_times: used_times:
description: Usage count of setup key description: Usage count of setup key
type: integer type: integer
example: 2
last_used: last_used:
description: Setup key last usage date description: Setup key last usage date
type: string type: string
format: date-time format: date-time
example: 2023-05-05T09:00:35.477782Z
state: state:
description: Setup key status, "valid", "overused","expired" or "revoked" description: Setup key status, "valid", "overused","expired" or "revoked"
type: string type: string
example: valid
auto_groups: auto_groups:
description: Setup key groups to auto-assign to peers registered with this key description: Setup key groups to auto-assign to peers registered with this key
type: array type: array
items: items:
type: string type: string
example: "devs"
updated_at: updated_at:
description: Setup key last update date description: Setup key last update date
type: string type: string
format: date-time format: date-time
example: 2023-05-05T09:00:35.477782Z
usage_limit: usage_limit:
description: A number of times this key can be used. The value of 0 indicates the unlimited usage. description: A number of times this key can be used. The value of 0 indicates the unlimited usage.
type: integer type: integer
example: 0
required: required:
- id - id
- key - key
@@ -285,23 +334,29 @@ components:
name: name:
description: Setup Key name description: Setup Key name
type: string type: string
example: Default key
type: type:
description: Setup key type, one-off for single time usage and reusable description: Setup key type, one-off for single time usage and reusable
type: string type: string
example: reusable
expires_in: expires_in:
description: Expiration time in seconds description: Expiration time in seconds
type: integer type: integer
example: 43200
revoked: revoked:
description: Setup key revocation status description: Setup key revocation status
type: boolean type: boolean
example: false
auto_groups: auto_groups:
description: Setup key groups to auto-assign to peers registered with this key description: Setup key groups to auto-assign to peers registered with this key
type: array type: array
items: items:
type: string type: string
example: "devs"
usage_limit: usage_limit:
description: A number of times this key can be used. The value of 0 indicates the unlimited usage. description: A number of times this key can be used. The value of 0 indicates the unlimited usage.
type: integer type: integer
example: 0
required: required:
- name - name
- type - type
@@ -315,24 +370,30 @@ components:
id: id:
description: ID of a token description: ID of a token
type: string type: string
example: ch8i54g6lnn4g9hqv7n0
name: name:
description: Name of the token description: Name of the token
type: string type: string
example: My first token
expiration_date: expiration_date:
description: Date the token expires description: Date the token expires
type: string type: string
format: date-time format: date-time
example: 2023-05-05T14:38:28.977616Z
created_by: created_by:
description: User ID of the user who created the token description: User ID of the user who created the token
type: string type: string
example: google-oauth2|277474792786460067937
created_at: created_at:
description: Date the token was created description: Date the token was created
type: string type: string
format: date-time format: date-time
example: 2023-05-02T14:48:20.465209Z
last_used: last_used:
description: Date the token was last used description: Date the token was last used
type: string type: string
format: date-time format: date-time
example: 2023-05-04T12:45:25.9723616Z
required: required:
- id - id
- name - name
@@ -345,6 +406,7 @@ components:
plain_token: plain_token:
description: Plain text representation of the generated token description: Plain text representation of the generated token
type: string type: string
example: 2023-05-02T14:48:20.465209Z
personal_access_token: personal_access_token:
$ref: '#/components/schemas/PersonalAccessToken' $ref: '#/components/schemas/PersonalAccessToken'
required: required:
@@ -356,11 +418,13 @@ components:
name: name:
description: Name of the token description: Name of the token
type: string type: string
example: My first token
expires_in: expires_in:
description: Expiration in days description: Expiration in days
type: integer type: integer
minimum: 1 minimum: 1
maximum: 365 maximum: 365
example: 30
required: required:
- name - name
- expires_in - expires_in
@@ -370,12 +434,15 @@ components:
id: id:
description: Group ID description: Group ID
type: string type: string
example: ch8i4ug6lnn4g9hqv7m0
name: name:
description: Group Name identifier description: Group Name identifier
type: string type: string
example: devs
peers_count: peers_count:
description: Count of peers associated to the group description: Count of peers associated to the group
type: integer type: integer
example: 2
required: required:
- id - id
- name - name
@@ -386,11 +453,13 @@ components:
name: name:
type: string type: string
description: Group name identifier description: Group name identifier
example: devs
peers: peers:
type: array type: array
description: List of peers ids description: List of peers ids
items: items:
type: string type: string
example: "ch8i4ug6lnn4g9hqv7m1"
required: required:
- name - name
Group: Group:
@@ -411,15 +480,19 @@ components:
name: name:
description: Rule name identifier description: Rule name identifier
type: string type: string
example: Default
description: description:
description: Rule friendly description description: Rule friendly description
type: string type: string
example: This is a default rule that allows connections between all the resources
disabled: disabled:
description: Rules status description: Rules status
type: boolean type: boolean
example: false
flow: flow:
description: Rule flow, currently, only "bidirect" for bi-directional traffic is accepted description: Rule flow, currently, only "bidirect" for bi-directional traffic is accepted
type: string type: string
example: bidirect
required: required:
- name - name
- description - description
@@ -435,11 +508,13 @@ components:
description: List of source groups description: List of source groups
items: items:
type: string type: string
example: "ch8i4ug6lnn4g9hqv7m1"
destinations: destinations:
type: array type: array
description: List of destination groups description: List of destination groups
items: items:
type: string type: string
example: "ch8i4ug6lnn4g9hqv7m0"
Rule: Rule:
allOf: allOf:
- type: object - type: object
@@ -447,6 +522,7 @@ components:
id: id:
description: Rule ID description: Rule ID
type: string type: string
example: ch8i4ug6lnn4g9hqv7mg
required: required:
- id - id
- $ref: '#/components/schemas/RuleMinimum' - $ref: '#/components/schemas/RuleMinimum'
@@ -471,15 +547,19 @@ components:
id: id:
description: Rule ID description: Rule ID
type: string type: string
example: ch8i4ug6lnn4g9hqv7mg
name: name:
description: Rule name identifier description: Rule name identifier
type: string type: string
example: Default
description: description:
description: Rule friendly description description: Rule friendly description
type: string type: string
example: This is a default rule that allows connections between all the resources
enabled: enabled:
description: Rules status description: Rules status
type: boolean type: boolean
example: true
sources: sources:
description: policy source groups description: policy source groups
type: array type: array
@@ -494,6 +574,7 @@ components:
description: policy accept or drops packets description: policy accept or drops packets
type: string type: string
enum: ["accept","drop"] enum: ["accept","drop"]
example: accept
required: required:
- name - name
- sources - sources
@@ -506,15 +587,19 @@ components:
name: name:
description: Policy name identifier description: Policy name identifier
type: string type: string
example: ch8i4ug6lnn4g9hqv7mg
description: description:
description: Policy friendly description description: Policy friendly description
type: string type: string
example: This is a default policy that allows connections between all the resources
enabled: enabled:
description: Policy status description: Policy status
type: boolean type: boolean
example: true
query: query:
description: Policy Rego query description: Policy Rego query
type: string type: string
example: 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:
description: Policy rule object for policy UI editor description: Policy rule object for policy UI editor
type: array type: array
@@ -534,6 +619,7 @@ components:
id: id:
description: Policy ID description: Policy ID
type: string type: string
example: ch8i4ug6lnn4g9hqv7mg
required: required:
- id - id
RouteRequest: RouteRequest:
@@ -542,33 +628,41 @@ components:
description: description:
description: Route description description: Route description
type: string type: string
example: My first route
network_id: network_id:
description: Route network identifier, to group HA routes description: Route network identifier, to group HA routes
type: string type: string
maxLength: 40 maxLength: 40
minLength: 1 minLength: 1
example: Route 1
enabled: enabled:
description: Route status description: Route status
type: boolean type: boolean
example: true
peer: peer:
description: Peer Identifier associated with route description: Peer Identifier associated with route
type: string type: string
example: chacbco6lnnbn6cg5s91
network: network:
description: Network range in CIDR format description: Network range in CIDR format
type: string type: string
example: 10.64.0.0/24
metric: metric:
description: Route metric number. Lowest number has higher priority description: Route metric number. Lowest number has higher priority
type: integer type: integer
maximum: 9999 maximum: 9999
minimum: 1 minimum: 1
example: 9999
masquerade: masquerade:
description: Indicate if peer should masquerade traffic to this route's prefix description: Indicate if peer should masquerade traffic to this route's prefix
type: boolean type: boolean
example: true
groups: groups:
description: Route group tag groups description: Route group tag groups
type: array type: array
items: items:
type: string type: string
example: "chacdk86lnnboviihd70"
required: required:
- id - id
- description - description
@@ -586,9 +680,11 @@ components:
id: id:
description: Route Id description: Route Id
type: string type: string
example: chacdk86lnnboviihd7g
network_type: network_type:
description: Network type indicating if it is IPv4 or IPv6 description: Network type indicating if it is IPv4 or IPv6
type: string type: string
example: IPv4
required: required:
- id - id
- network_type - network_type
@@ -599,13 +695,16 @@ components:
ip: ip:
description: Nameserver IP description: Nameserver IP
type: string type: string
example: 8.8.8.8
ns_type: ns_type:
description: Nameserver Type description: Nameserver Type
type: string type: string
enum: [ "udp" ] enum: [ "udp" ]
example: udp
port: port:
description: Nameserver Port description: Nameserver Port
type: integer type: integer
example: 53
required: required:
- ip - ip
- ns_type - ns_type
@@ -618,9 +717,11 @@ components:
type: string type: string
maxLength: 40 maxLength: 40
minLength: 1 minLength: 1
example: Google DNS
description: description:
description: Nameserver group description description: Nameserver group description
type: string type: string
example: Google DNS servers
nameservers: nameservers:
description: Nameserver group description: Nameserver group
minLength: 1 minLength: 1
@@ -631,14 +732,17 @@ components:
enabled: enabled:
description: Nameserver group status description: Nameserver group status
type: boolean type: boolean
example: true
groups: groups:
description: Nameserver group tag groups description: Nameserver group tag groups
type: array type: array
items: items:
type: string type: string
example: ch8i4ug6lnn4g9hqv7m0
primary: primary:
description: Nameserver group primary status description: Nameserver group primary status
type: boolean type: boolean
example: true
domains: domains:
description: Nameserver group domain list description: Nameserver group domain list
type: array type: array
@@ -646,6 +750,7 @@ components:
type: string type: string
minLength: 1 minLength: 1
maxLength: 255 maxLength: 255
example: "example.com"
required: required:
- name - name
- description - description
@@ -661,6 +766,7 @@ components:
id: id:
description: Nameserver group ID description: Nameserver group ID
type: string type: string
example: ch8i4ug6lnn4g9hqv7m0
required: required:
- id - id
- $ref: '#/components/schemas/NameserverGroupRequest' - $ref: '#/components/schemas/NameserverGroupRequest'
@@ -672,6 +778,7 @@ components:
type: array type: array
items: items:
type: string type: string
example: ch8i4ug6lnn4g9hqv7m0
required: required:
- disabled_management_groups - disabled_management_groups
Event: Event:
@@ -680,13 +787,16 @@ components:
id: id:
description: Event unique identifier description: Event unique identifier
type: string type: string
example: 10
timestamp: timestamp:
description: The date and time when the event occurred description: The date and time when the event occurred
type: string type: string
format: date-time format: date-time
example: 2023-05-05T10:04:37.473542Z
activity: activity:
description: The activity that occurred during the event description: The activity that occurred during the event
type: string type: string
example: Route created
activity_code: activity_code:
description: The string code of the activity that occurred during the event description: The string code of the activity that occurred during the event
type: string type: string
@@ -702,17 +812,21 @@ components:
"nameserver.group.add", "nameserver.group.delete", "nameserver.group.update", "nameserver.group.add", "nameserver.group.delete", "nameserver.group.update",
"peer.ssh.disable", "peer.ssh.enable", "peer.rename", "peer.login.expiration.disable", "peer.login.expiration.enable", "peer.ssh.disable", "peer.ssh.enable", "peer.rename", "peer.login.expiration.disable", "peer.login.expiration.enable",
"service.user.create", "personal.access.token.create", "service.user.delete", "personal.access.token.delete" ] "service.user.create", "personal.access.token.create", "service.user.delete", "personal.access.token.delete" ]
example: route.add
initiator_id: initiator_id:
description: The ID of the initiator of the event. E.g., an ID of a user that triggered the event. description: The ID of the initiator of the event. E.g., an ID of a user that triggered the event.
type: string type: string
example: google-oauth2|123456789012345678901
target_id: target_id:
description: The ID of the target of the event. E.g., an ID of the peer that a user removed. description: The ID of the target of the event. E.g., an ID of the peer that a user removed.
type: string type: string
example: chad9d86lnnc59g18ou0
meta: meta:
description: The metadata of the event description: The metadata of the event
type: object type: object
additionalProperties: additionalProperties:
type: string type: string
example: { "name": "my route", "network_range": "10.64.0.0/24", "peer_id": "chacbco6lnnbn6cg5s91"}
required: required:
- id - id
- timestamp - timestamp

View File

@@ -35,7 +35,7 @@ export const title = '<%- tag %>'
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
#### Request-Body Parameters #### Request-Body Parameters
<Properties> <Properties>
<% schemas.get(operation.requestBody?.content['application/json'].schema.$ref.split('/').pop())?.parameters.forEach(function(parameter){ %> <% components.get(operation.requestBody?.content['application/json'].schema.$ref.split('/').pop())?.parameters.forEach(function(parameter){ %>
<Property name="<%- parameter.name %>" type="<%- parameter.type %>" required=\{<%- parameter.required %>\} <Property name="<%- parameter.name %>" type="<%- parameter.type %>" required=\{<%- parameter.required %>\}
<% if(parameter.enum){ %> <% if(parameter.enum){ %>
enumList="<%- parameter.enum %>" enumList="<%- parameter.enum %>"
@@ -68,13 +68,13 @@ curl -X <%- operation.operation.toUpperCase() %> <%- operation.fullPath %> \\
-H 'Accept: application/json' \\<% }; %> -H 'Accept: application/json' \\<% }; %>
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>
-H 'Content-Type: application/json' \\ -H 'Content-Type: application/json' \\
--data-raw '<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>'<% }; %> --data-raw '<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.schema, null, 2) %>'<% }; %>
\`\`\` \`\`\`
\`\`\`js \`\`\`js
const axios = require('axios'); const axios = require('axios');
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>
let data = JSON.stringify(<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>);<% }; -%> let data = JSON.stringify(<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.schema, null, 2) %>);<% }; -%>
let config = { let config = {
method: '<%- operation.operation.toLowerCase() %>', method: '<%- operation.operation.toLowerCase() %>',
@@ -104,7 +104,7 @@ import json
url = "<%- operation.fullPath %>" url = "<%- operation.fullPath %>"
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>
payload = json.dumps(<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>)<% }; -%> payload = json.dumps(<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.schema, null, 2) %>)<% }; -%>
headers = { headers = {
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>'Content-Type': 'application/json',<% }; %> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>'Content-Type': 'application/json',<% }; %>
@@ -132,7 +132,7 @@ func main() {
url := "<%- operation.fullPath %>" url := "<%- operation.fullPath %>"
method := "<%- operation.operation.toUpperCase() %>" method := "<%- operation.operation.toUpperCase() %>"
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
payload := strings.NewReader(\`<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>\`)<% }; -%> payload := strings.NewReader(\`<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.schema, null, 2) %>\`)<% }; -%>
client := &http.Client { client := &http.Client {
} }
@@ -178,7 +178,7 @@ request = Net::HTTP::<%- operation.operation.slice(0,1).toUpperCase() + operatio
<% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>request["Accept"] = "application/json"<% }; %> <% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>request["Accept"] = "application/json"<% }; %>
request["Authorization"] = "Token <TOKEN>" request["Authorization"] = "Token <TOKEN>"
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
request.body = JSON.dump(<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>)<% }; -%> request.body = JSON.dump(<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.schema, null, 2) %>)<% }; -%>
response = https.request(request) response = https.request(request)
puts response.read_body puts response.read_body
@@ -189,7 +189,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
.build(); .build();
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>
MediaType mediaType = MediaType.parse("application/json"); MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, '<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>');<% }; %> RequestBody body = RequestBody.create(mediaType, '<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.schema, null, 2) %>');<% }; %>
Request request = new Request.Builder() Request request = new Request.Builder()
.url("<%- operation.fullPath %>") .url("<%- operation.fullPath %>")
.method("<%- operation.operation.toUpperCase() %>"<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>, body<% }; %>) .method("<%- operation.operation.toUpperCase() %>"<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>, body<% }; %>)
@@ -215,7 +215,7 @@ curl_setopt_array($curl, array(
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => '<%- operation.operation.toUpperCase() %>', CURLOPT_CUSTOMREQUEST => '<%- operation.operation.toUpperCase() %>',
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ %>
CURLOPT_POSTFIELDS =>'<%- JSON.stringify(schemas.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %>',<% }; %> CURLOPT_POSTFIELDS =>'<%- JSON.stringify(components.get(operation.requestBody?.content['application/json'].schema.$ref?.split('/').pop())?.schema, null, 2) %>',<% }; %>
CURLOPT_HTTPHEADER => array( CURLOPT_HTTPHEADER => array(
<% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>'Content-Type: application/json',<% }; %> <% if(operation.requestBody?.content && operation.requestBody?.content['application/json']){ -%>'Content-Type: application/json',<% }; %>
<% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>'Accept: application/json',<% }; %> <% if(operation.responseList[0].content && operation.responseList[0].content['application/json']){ -%>'Accept: application/json',<% }; %>
@@ -234,14 +234,20 @@ echo $response;
<% if(response?.content && response?.content['application/json']){ %> <% if(response?.content && response?.content['application/json']){ %>
<% if(response?.content['application/json'].schema.type === 'array'){ %> <% if(response?.content['application/json'].schema.type === 'array'){ %>
<CodeGroup title="Response"> <CodeGroup title="Response">
\`\`\`json {{ title: '200' }} \`\`\`json {{ title: 'Example' }}
<%- JSON.stringify(new Array(schemas.get(response?.content['application/json'].schema.items.$ref?.split('/').pop())?.examples), null, 2) %> <%- JSON.stringify(new Array(components.get(response?.content['application/json'].schema.items.$ref?.split('/').pop())?.example), null, 2) %>
\`\`\`
\`\`\`json {{ title: 'Schema' }}
<%- JSON.stringify(new Array(components.get(response?.content['application/json'].schema.items.$ref?.split('/').pop())?.schema), null, 2) %>
\`\`\` \`\`\`
</CodeGroup> </CodeGroup>
<% } else { %> <% } else { %>
<CodeGroup title="Response"> <CodeGroup title="Response">
\`\`\`json {{ title: '200' }} \`\`\`json {{ title: 'Example' }}
<%- JSON.stringify(schemas.get(response?.content['application/json'].schema.$ref?.split('/').pop())?.examples, null, 2) %> <%- JSON.stringify(components.get(response?.content['application/json'].schema.$ref?.split('/').pop())?.example, null, 2) %>
\`\`\`
\`\`\`json {{ title: 'Schema' }}
<%- JSON.stringify(components.get(response?.content['application/json'].schema.$ref?.split('/').pop())?.schema, null, 2) %>
\`\`\` \`\`\`
</CodeGroup> </CodeGroup>
<% }; -%> <% }; -%>

View File

@@ -4,7 +4,7 @@ export function HeroPattern() {
return ( return (
<div className="absolute inset-0 -z-10 mx-0 max-w-none overflow-hidden"> <div className="absolute inset-0 -z-10 mx-0 max-w-none overflow-hidden">
<div className="absolute left-1/2 top-0 ml-[-38rem] h-[25rem] w-[81.25rem] dark:[mask-image:linear-gradient(white,transparent)]"> <div className="absolute left-1/2 top-0 ml-[-38rem] h-[25rem] w-[81.25rem] dark:[mask-image:linear-gradient(white,transparent)]">
<div className="absolute inset-0 bg-gradient-to-r from-[#F39C12] to-[#FAD7A0] opacity-40 [mask-image:radial-gradient(farthest-side_at_top,white,transparent)] dark:from-[#F39C12]/30 dark:to-[#FAD7A0]/30 dark:opacity-100"> <div className="absolute inset-0 bg-gradient-to-r from-[#FFAC1C] to-[#FF5F15] opacity-40 [mask-image:radial-gradient(farthest-side_at_top,white,transparent)] dark:from-[#FFAC1C]/30 dark:to-[#FF5F15]/30 dark:opacity-100">
<GridPattern <GridPattern
width={72} width={72}
height={56} height={56}

View File

@@ -173,7 +173,18 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "ch8i4ug6lnn4g9hqv7l0",
"settings": {
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
}
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",
@@ -416,7 +427,16 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7l0",
"settings": {
"peer_login_expiration_enabled": true,
"peer_login_expiration": 43200
}
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"settings": { "settings": {

View File

@@ -173,7 +173,31 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "Google DNS",
"description": "Google DNS servers",
"nameservers": [
{
"ip": "8.8.8.8",
"ns_type": "udp",
"port": 53
}
],
"enabled": true,
"groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"primary": true,
"domains": [
"example.com"
]
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",
@@ -569,7 +593,29 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "Google DNS",
"description": "Google DNS servers",
"nameservers": [
{
"ip": "8.8.8.8",
"ns_type": "udp",
"port": 53
}
],
"enabled": true,
"groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"primary": true,
"domains": [
"example.com"
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",
@@ -778,7 +824,29 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "Google DNS",
"description": "Google DNS servers",
"nameservers": [
{
"ip": "8.8.8.8",
"ns_type": "udp",
"port": 53
}
],
"enabled": true,
"groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"primary": true,
"domains": [
"example.com"
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",
@@ -1180,7 +1248,29 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "Google DNS",
"description": "Google DNS servers",
"nameservers": [
{
"ip": "8.8.8.8",
"ns_type": "udp",
"port": 53
}
],
"enabled": true,
"groups": [
"ch8i4ug6lnn4g9hqv7m0"
],
"primary": true,
"domains": [
"example.com"
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",
@@ -1563,7 +1653,16 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"disabled_management_groups": [
"ch8i4ug6lnn4g9hqv7m0"
]
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"disabled_management_groups": [ "disabled_management_groups": [
@@ -1796,7 +1895,14 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"disabled_management_groups": [
"ch8i4ug6lnn4g9hqv7m0"
]
}
```
```json {{ title: 'Schema' }}
{ {
"disabled_management_groups": [ "disabled_management_groups": [
"string" "string"

View File

@@ -173,7 +173,24 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "10",
"timestamp": "2023-05-05T10:04:37.473542Z",
"activity": "Route created",
"activity_code": "route.add",
"initiator_id": "google-oauth2|123456789012345678901",
"target_id": "chad9d86lnnc59g18ou0",
"meta": {
"name": "my route",
"network_range": "10.64.0.0/24",
"peer_id": "chacbco6lnnbn6cg5s91"
}
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",

View File

@@ -173,7 +173,22 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2,
"peers": [
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1"
}
]
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",
@@ -426,7 +441,20 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2,
"peers": [
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1"
}
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",
@@ -626,7 +654,20 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2,
"peers": [
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1"
}
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",
@@ -885,7 +926,20 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2,
"peers": [
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1"
}
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",

View File

@@ -173,7 +173,35 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1",
"ip": "10.64.0.1",
"connected": true,
"last_seen": "2023-05-05T10:05:26.420578Z",
"os": "Darwin 13.2.1",
"version": "0.14.0",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"ssh_enabled": true,
"user_id": "google-oauth2|277474792786460067937",
"hostname": "stage-host-1",
"ui_version": "0.14.0",
"dns_label": "stage-host-1.netbird.cloud",
"login_expiration_enabled": false,
"login_expired": false,
"last_login": "2023-05-05T09:00:35.477782Z"
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",
@@ -388,7 +416,33 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1",
"ip": "10.64.0.1",
"connected": true,
"last_seen": "2023-05-05T10:05:26.420578Z",
"os": "Darwin 13.2.1",
"version": "0.14.0",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"ssh_enabled": true,
"user_id": "google-oauth2|277474792786460067937",
"hostname": "stage-host-1",
"ui_version": "0.14.0",
"dns_label": "stage-host-1.netbird.cloud",
"login_expiration_enabled": false,
"login_expired": false,
"last_login": "2023-05-05T09:00:35.477782Z"
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",
@@ -660,7 +714,33 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1",
"ip": "10.64.0.1",
"connected": true,
"last_seen": "2023-05-05T10:05:26.420578Z",
"os": "Darwin 13.2.1",
"version": "0.14.0",
"groups": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"ssh_enabled": true,
"user_id": "google-oauth2|277474792786460067937",
"hostname": "stage-host-1",
"ui_version": "0.14.0",
"dns_label": "stage-host-1.netbird.cloud",
"login_expiration_enabled": false,
"login_expired": false,
"last_login": "2023-05-05T09:00:35.477782Z"
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",

View File

@@ -173,7 +173,41 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"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",
"rules": [
{
"id": "ch8i4ug6lnn4g9hqv7mg",
"name": "Default",
"description": "This is a default rule that allows connections between all the resources",
"enabled": true,
"sources": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"destinations": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"action": "accept"
}
],
"id": "ch8i4ug6lnn4g9hqv7mg"
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"name": "string", "name": "string",
@@ -627,7 +661,39 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"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",
"rules": [
{
"id": "ch8i4ug6lnn4g9hqv7mg",
"name": "Default",
"description": "This is a default rule that allows connections between all the resources",
"enabled": true,
"sources": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"destinations": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"action": "accept"
}
],
"id": "ch8i4ug6lnn4g9hqv7mg"
}
```
```json {{ title: 'Schema' }}
{ {
"name": "string", "name": "string",
"description": "string", "description": "string",
@@ -842,7 +908,39 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"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",
"rules": [
{
"id": "ch8i4ug6lnn4g9hqv7mg",
"name": "Default",
"description": "This is a default rule that allows connections between all the resources",
"enabled": true,
"sources": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"destinations": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"action": "accept"
}
],
"id": "ch8i4ug6lnn4g9hqv7mg"
}
```
```json {{ title: 'Schema' }}
{ {
"name": "string", "name": "string",
"description": "string", "description": "string",
@@ -1302,7 +1400,39 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"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",
"rules": [
{
"id": "ch8i4ug6lnn4g9hqv7mg",
"name": "Default",
"description": "This is a default rule that allows connections between all the resources",
"enabled": true,
"sources": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"destinations": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"action": "accept"
}
],
"id": "ch8i4ug6lnn4g9hqv7mg"
}
```
```json {{ title: 'Schema' }}
{ {
"name": "string", "name": "string",
"description": "string", "description": "string",

View File

@@ -173,7 +173,25 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "chacdk86lnnboviihd7g",
"network_type": "IPv4",
"description": "My first route",
"network_id": "Route 1",
"enabled": true,
"peer": "chacbco6lnnbn6cg5s91",
"network": "10.64.0.0/24",
"metric": 9999,
"masquerade": true,
"groups": [
"chacdk86lnnboviihd70"
]
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",
@@ -521,7 +539,23 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "chacdk86lnnboviihd7g",
"network_type": "IPv4",
"description": "My first route",
"network_id": "Route 1",
"enabled": true,
"peer": "chacbco6lnnbn6cg5s91",
"network": "10.64.0.0/24",
"metric": 9999,
"masquerade": true,
"groups": [
"chacdk86lnnboviihd70"
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"network_type": "string", "network_type": "string",
@@ -724,7 +758,23 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "chacdk86lnnboviihd7g",
"network_type": "IPv4",
"description": "My first route",
"network_id": "Route 1",
"enabled": true,
"peer": "chacbco6lnnbn6cg5s91",
"network": "10.64.0.0/24",
"metric": 9999,
"masquerade": true,
"groups": [
"chacdk86lnnboviihd70"
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"network_type": "string", "network_type": "string",
@@ -1078,7 +1128,23 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "chacdk86lnnboviihd7g",
"network_type": "IPv4",
"description": "My first route",
"network_id": "Route 1",
"enabled": true,
"peer": "chacbco6lnnbn6cg5s91",
"network": "10.64.0.0/24",
"metric": 9999,
"masquerade": true,
"groups": [
"chacdk86lnnboviihd70"
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"network_type": "string", "network_type": "string",

View File

@@ -173,7 +173,32 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "ch8i4ug6lnn4g9hqv7mg",
"name": "Default",
"description": "This is a default rule that allows connections between all the resources",
"disabled": false,
"flow": "bidirect",
"sources": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"destinations": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
]
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",
@@ -506,7 +531,30 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7mg",
"name": "Default",
"description": "This is a default rule that allows connections between all the resources",
"disabled": false,
"flow": "bidirect",
"sources": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"destinations": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",
@@ -712,7 +760,30 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7mg",
"name": "Default",
"description": "This is a default rule that allows connections between all the resources",
"disabled": false,
"flow": "bidirect",
"sources": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"destinations": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",
@@ -1051,7 +1122,30 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i4ug6lnn4g9hqv7mg",
"name": "Default",
"description": "This is a default rule that allows connections between all the resources",
"disabled": false,
"flow": "bidirect",
"sources": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
],
"destinations": [
{
"id": "ch8i4ug6lnn4g9hqv7m0",
"name": "devs",
"peers_count": 2
}
]
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",

View File

@@ -173,7 +173,28 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "2531583362",
"key": "A616097E-FCF0-48FA-9354-CA4A61142761",
"name": "Default key",
"expires": "2023-06-01T14:47:22.291057Z",
"type": "reusable",
"valid": true,
"revoked": false,
"used_times": 2,
"last_used": "2023-05-05T09:00:35.477782Z",
"state": "valid",
"auto_groups": [
"devs"
],
"updated_at": "2023-05-05T09:00:35.477782Z",
"usage_limit": 0
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",
@@ -488,7 +509,26 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "2531583362",
"key": "A616097E-FCF0-48FA-9354-CA4A61142761",
"name": "Default key",
"expires": "2023-06-01T14:47:22.291057Z",
"type": "reusable",
"valid": true,
"revoked": false,
"used_times": 2,
"last_used": "2023-05-05T09:00:35.477782Z",
"state": "valid",
"auto_groups": [
"devs"
],
"updated_at": "2023-05-05T09:00:35.477782Z",
"usage_limit": 0
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"key": "string", "key": "string",
@@ -694,7 +734,26 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "2531583362",
"key": "A616097E-FCF0-48FA-9354-CA4A61142761",
"name": "Default key",
"expires": "2023-06-01T14:47:22.291057Z",
"type": "reusable",
"valid": true,
"revoked": false,
"used_times": 2,
"last_used": "2023-05-05T09:00:35.477782Z",
"state": "valid",
"auto_groups": [
"devs"
],
"updated_at": "2023-05-05T09:00:35.477782Z",
"usage_limit": 0
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"key": "string", "key": "string",
@@ -1015,7 +1074,26 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "2531583362",
"key": "A616097E-FCF0-48FA-9354-CA4A61142761",
"name": "Default key",
"expires": "2023-06-01T14:47:22.291057Z",
"type": "reusable",
"valid": true,
"revoked": false,
"used_times": 2,
"last_used": "2023-05-05T09:00:35.477782Z",
"state": "valid",
"auto_groups": [
"devs"
],
"updated_at": "2023-05-05T09:00:35.477782Z",
"usage_limit": 0
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"key": "string", "key": "string",

View File

@@ -181,7 +181,19 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "ch8i54g6lnn4g9hqv7n0",
"name": "My first token",
"expiration_date": "2023-05-05T14:38:28.977616Z",
"created_by": "google-oauth2|277474792786460067937",
"created_at": "2023-05-02T14:48:20.465209Z",
"last_used": "2023-05-04T12:45:25.9723616Z"
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",
@@ -429,7 +441,20 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"plain_token": "2023-05-02T14:48:20.465209Z",
"personal_access_token": {
"id": "ch8i54g6lnn4g9hqv7n0",
"name": "My first token",
"expiration_date": "2023-05-05T14:38:28.977616Z",
"created_by": "google-oauth2|277474792786460067937",
"created_at": "2023-05-02T14:48:20.465209Z",
"last_used": "2023-05-04T12:45:25.9723616Z"
}
}
```
```json {{ title: 'Schema' }}
{ {
"plain_token": "string", "plain_token": "string",
"personal_access_token": { "personal_access_token": {
@@ -633,7 +658,17 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "ch8i54g6lnn4g9hqv7n0",
"name": "My first token",
"expiration_date": "2023-05-05T14:38:28.977616Z",
"created_by": "google-oauth2|277474792786460067937",
"created_at": "2023-05-02T14:48:20.465209Z",
"last_used": "2023-05-04T12:45:25.9723616Z"
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"name": "string", "name": "string",

View File

@@ -6,7 +6,7 @@ export const title = 'Users'
## Retrieve Users {{ tag: 'GET' , label: '/api/users' }} ## List all Users {{ tag: 'GET' , label: '/api/users' }}
<Row> <Row>
<Col> <Col>
@@ -181,7 +181,23 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
[
{
"id": "google-oauth2|277474792786460067937",
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"status": "active",
"auto_groups": [
"devs"
],
"is_current": true,
"is_service_user": false
}
]
```
```json {{ title: 'Schema' }}
[ [
{ {
"id": "string", "id": "string",
@@ -477,7 +493,21 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "google-oauth2|277474792786460067937",
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"status": "active",
"auto_groups": [
"devs"
],
"is_current": true,
"is_service_user": false
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"email": "string", "email": "string",
@@ -737,7 +767,21 @@ echo $response;
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: '200' }} ```json {{ title: 'Example' }}
{
"id": "google-oauth2|277474792786460067937",
"email": "demo@netbird.io",
"name": "Tom Schulz",
"role": "admin",
"status": "active",
"auto_groups": [
"devs"
],
"is_current": true,
"is_service_user": false
}
```
```json {{ title: 'Schema' }}
{ {
"id": "string", "id": "string",
"email": "string", "email": "string",