mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-18 16:36:35 +00:00
[API] add cloud and experimantal badges + new pages (#292)
This commit is contained in:
@@ -49,6 +49,7 @@ export default async function gen(inputFileName: string, outputDir: string) {
|
||||
|
||||
type v3OperationWithPath = OpenAPIV3.OperationObject & {
|
||||
path: string
|
||||
|
||||
}
|
||||
|
||||
export type objectRepresentation = {
|
||||
@@ -104,22 +105,16 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string) {
|
||||
}
|
||||
}
|
||||
|
||||
// if(operation.summary == "List all Tokens") {
|
||||
// console.log(response.example)
|
||||
// console.log(operation.responses["200"]["content"]["application/json"].schema.items.properties)
|
||||
// }
|
||||
|
||||
|
||||
const enriched = {
|
||||
...operation,
|
||||
path: key,
|
||||
fullPath,
|
||||
operationId: slugify(operation.summary!),
|
||||
|
||||
responseList: toArrayWithKey(operation.responses!, 'responseCode') || [],
|
||||
request: request,
|
||||
response: response,
|
||||
}
|
||||
|
||||
let tag = operation.tags.pop()
|
||||
let tagOperations = tagGroups.get(tag) ?? []
|
||||
tagGroups.set(tag, tagOperations.concat(enriched))
|
||||
|
||||
@@ -4,7 +4,7 @@ export const title = '<%- tag %>'
|
||||
|
||||
<% operations.forEach(function(operation){ %>
|
||||
|
||||
## <%- operation.summary %> {{ tag: '<%- operation.operation.toUpperCase() %>' , label: '<%- operation.path %>' }} <% if(operation.deprecated) { %><Badge status="warning" text="Deprecated" /><% } %>
|
||||
## <%- operation.summary %> <% if(operation.deprecated) { %> <Badge status="warning" text="Deprecated" /> <% } %><% if(operation["x-cloud-only"]) { %> <Badge status="cloud-only" text="Cloud-Only" /> <% } %><% if(operation["x-experimental"]) { %> <Badge status="experimental" text="Experimental" /> <% } %> {{ tag: '<%- operation.operation.toUpperCase() %>' , label: '<%- operation.path %>' }}
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
|
||||
@@ -9,6 +9,10 @@ export function Badge({ status, text }) {
|
||||
case 'error':
|
||||
// Never tested colors
|
||||
return 'bg-red-300/30 text-red-400 dark:bg-red-400/10 dark:text-red-400';
|
||||
case 'cloud-only':
|
||||
return 'bg-orange-200/50 text-orange-400 dark:bg-orange-600/20 dark:text-orange-400';
|
||||
case 'experimental':
|
||||
return 'bg-teal-200/50 text-teal-400 dark:bg-teal-500/15 dark:text-teal-400';
|
||||
default:
|
||||
return 'bg-gray-500/30 text-gray-600 dark:bg-gray-400/10 dark:text-gray-400';
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ export const apiNavigation = [
|
||||
{ title: 'Users', href: '/api/resources/users' },
|
||||
{ title: 'Tokens', href: '/api/resources/tokens' },
|
||||
{ title: 'Peers', href: '/api/resources/peers' },
|
||||
{ title: 'Ingress Ports', href: '/api/resources/ingress-ports' },
|
||||
{ title: 'Setup Keys', href: '/api/resources/setup-keys' },
|
||||
{ title: 'Groups', href: '/api/resources/groups' },
|
||||
{ title: 'Policies', href: '/api/resources/policies' },
|
||||
|
||||
@@ -177,7 +177,9 @@ echo $response;
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": true,
|
||||
"extra": {
|
||||
"peer_approval_enabled": true
|
||||
"peer_approval_enabled": true,
|
||||
"network_traffic_logs_enabled": true,
|
||||
"network_traffic_packet_counter_enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -201,7 +203,9 @@ echo $response;
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": "boolean",
|
||||
"extra": {
|
||||
"peer_approval_enabled": "boolean"
|
||||
"peer_approval_enabled": "boolean",
|
||||
"network_traffic_logs_enabled": "boolean",
|
||||
"network_traffic_packet_counter_enabled": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -458,10 +462,20 @@ echo $response;
|
||||
<summary>More Information</summary>
|
||||
<Properties>
|
||||
|
||||
<Properties><Property name="peer_approval_enabled" type="boolean" required={false}>
|
||||
<Properties><Property name="peer_approval_enabled" type="boolean" required={true}>
|
||||
|
||||
(Cloud only) Enables or disables peer approval globally. If enabled, all peers added will be in pending state until approved by an admin.
|
||||
|
||||
</Property>
|
||||
<Property name="network_traffic_logs_enabled" type="boolean" required={true}>
|
||||
|
||||
Enables or disables network traffic logs. If enabled, all network traffic logs from peers will be stored.
|
||||
|
||||
</Property>
|
||||
<Property name="network_traffic_packet_counter_enabled" type="boolean" required={true}>
|
||||
|
||||
Enables or disables network traffic packet counter. If enabled, network packets and their size will be counted and reported. (This can have an slight impact on performance)
|
||||
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
@@ -502,7 +516,9 @@ curl -X PUT https://api.netbird.io/api/accounts/{accountId} \
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": true,
|
||||
"extra": {
|
||||
"peer_approval_enabled": true
|
||||
"peer_approval_enabled": true,
|
||||
"network_traffic_logs_enabled": true,
|
||||
"network_traffic_packet_counter_enabled": true
|
||||
}
|
||||
}
|
||||
}'
|
||||
@@ -525,7 +541,9 @@ let data = JSON.stringify({
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": true,
|
||||
"extra": {
|
||||
"peer_approval_enabled": true
|
||||
"peer_approval_enabled": true,
|
||||
"network_traffic_logs_enabled": true,
|
||||
"network_traffic_packet_counter_enabled": true
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -570,7 +588,9 @@ payload = json.dumps({
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": true,
|
||||
"extra": {
|
||||
"peer_approval_enabled": true
|
||||
"peer_approval_enabled": true,
|
||||
"network_traffic_logs_enabled": true,
|
||||
"network_traffic_packet_counter_enabled": true
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -615,7 +635,9 @@ func main() {
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": true,
|
||||
"extra": {
|
||||
"peer_approval_enabled": true
|
||||
"peer_approval_enabled": true,
|
||||
"network_traffic_logs_enabled": true,
|
||||
"network_traffic_packet_counter_enabled": true
|
||||
}
|
||||
}
|
||||
}`)
|
||||
@@ -678,7 +700,9 @@ request.body = JSON.dump({
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": true,
|
||||
"extra": {
|
||||
"peer_approval_enabled": true
|
||||
"peer_approval_enabled": true,
|
||||
"network_traffic_logs_enabled": true,
|
||||
"network_traffic_packet_counter_enabled": true
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -705,7 +729,9 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": true,
|
||||
"extra": {
|
||||
"peer_approval_enabled": true
|
||||
"peer_approval_enabled": true,
|
||||
"network_traffic_logs_enabled": true,
|
||||
"network_traffic_packet_counter_enabled": true
|
||||
}
|
||||
}
|
||||
}');
|
||||
@@ -748,7 +774,9 @@ curl_setopt_array($curl, array(
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": true,
|
||||
"extra": {
|
||||
"peer_approval_enabled": true
|
||||
"peer_approval_enabled": true,
|
||||
"network_traffic_logs_enabled": true,
|
||||
"network_traffic_packet_counter_enabled": true
|
||||
}
|
||||
}
|
||||
}',
|
||||
@@ -786,7 +814,9 @@ echo $response;
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": true,
|
||||
"extra": {
|
||||
"peer_approval_enabled": true
|
||||
"peer_approval_enabled": true,
|
||||
"network_traffic_logs_enabled": true,
|
||||
"network_traffic_packet_counter_enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -808,7 +838,9 @@ echo $response;
|
||||
],
|
||||
"routing_peer_dns_resolution_enabled": "boolean",
|
||||
"extra": {
|
||||
"peer_approval_enabled": "boolean"
|
||||
"peer_approval_enabled": "boolean",
|
||||
"network_traffic_logs_enabled": "boolean",
|
||||
"network_traffic_packet_counter_enabled": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@ export const title = 'Events'
|
||||
|
||||
|
||||
|
||||
## List all Events {{ tag: 'GET' , label: '/api/events' }}
|
||||
## List all Audit Events {{ tag: 'GET' , label: '/api/events/audit' }}
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Returns a list of all events
|
||||
Returns a list of all audit events
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="GET" label="/api/events">
|
||||
<CodeGroup title="Request" tag="GET" label="/api/events/audit">
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X GET https://api.netbird.io/api/events \
|
||||
curl -X GET https://api.netbird.io/api/events/audit \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Authorization: Token <TOKEN>'
|
||||
```
|
||||
@@ -23,7 +23,7 @@ const axios = require('axios');
|
||||
let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/events',
|
||||
url: '/api/events/audit',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
@@ -43,7 +43,7 @@ axios(config)
|
||||
import requests
|
||||
import json
|
||||
|
||||
url = "https://api.netbird.io/api/events"
|
||||
url = "https://api.netbird.io/api/events/audit"
|
||||
|
||||
headers = {
|
||||
'Accept': 'application/json',
|
||||
@@ -67,7 +67,7 @@ import (
|
||||
|
||||
func main() {
|
||||
|
||||
url := "https://api.netbird.io/api/events"
|
||||
url := "https://api.netbird.io/api/events/audit"
|
||||
method := "GET"
|
||||
|
||||
client := &http.Client {
|
||||
@@ -103,7 +103,7 @@ require "uri"
|
||||
require "json"
|
||||
require "net/http"
|
||||
|
||||
url = URI("https://api.netbird.io/api/events")
|
||||
url = URI("https://api.netbird.io/api/events/audit")
|
||||
|
||||
https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
@@ -121,7 +121,7 @@ OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/events")
|
||||
.url("https://api.netbird.io/api/events/audit")
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
@@ -135,7 +135,7 @@ Response response = client.newCall(request).execute();
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => 'https://api.netbird.io/api/events',
|
||||
CURLOPT_URL => 'https://api.netbird.io/api/events/audit',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
@@ -209,3 +209,265 @@ echo $response;
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## List all Network Traffic Events <Badge status="cloud-only" text="Cloud-Only" /> <Badge status="experimental" text="Experimental" /> {{ tag: 'GET' , label: '/api/events/network-traffic' }}
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Returns a list of all network traffic events
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="GET" label="/api/events/network-traffic">
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X GET https://api.netbird.io/api/events/network-traffic \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Authorization: Token <TOKEN>'
|
||||
```
|
||||
|
||||
```js
|
||||
const axios = require('axios');
|
||||
|
||||
let config = {
|
||||
method: 'get',
|
||||
maxBodyLength: Infinity,
|
||||
url: '/api/events/network-traffic',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then((response) => {
|
||||
console.log(JSON.stringify(response.data));
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
```
|
||||
|
||||
```python
|
||||
import requests
|
||||
import json
|
||||
|
||||
url = "https://api.netbird.io/api/events/network-traffic"
|
||||
|
||||
headers = {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': 'Token <TOKEN>'
|
||||
}
|
||||
|
||||
response = requests.request("GET", url, headers=headers)
|
||||
|
||||
print(response.text)
|
||||
```
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"net/http"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
url := "https://api.netbird.io/api/events/network-traffic"
|
||||
method := "GET"
|
||||
|
||||
client := &http.Client {
|
||||
}
|
||||
req, err := http.NewRequest(method, url, nil)
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
{
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
req.Header.Add("Authorization", "Token <TOKEN>")
|
||||
|
||||
res, err := client.Do(req)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
defer res.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println(string(body))
|
||||
}
|
||||
```
|
||||
|
||||
```ruby
|
||||
require "uri"
|
||||
require "json"
|
||||
require "net/http"
|
||||
|
||||
url = URI("https://api.netbird.io/api/events/network-traffic")
|
||||
|
||||
https = Net::HTTP.new(url.host, url.port)
|
||||
https.use_ssl = true
|
||||
|
||||
request = Net::HTTP::Get.new(url)
|
||||
request["Accept"] = "application/json"
|
||||
request["Authorization"] = "Token <TOKEN>"
|
||||
|
||||
response = https.request(request)
|
||||
puts response.read_body
|
||||
```
|
||||
|
||||
```java
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.netbird.io/api/events/network-traffic")
|
||||
.method("GET")
|
||||
.addHeader("Accept", "application/json")
|
||||
.addHeader("Authorization: Token <TOKEN>")
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
```
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => 'https://api.netbird.io/api/events/network-traffic',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Accept: application/json',
|
||||
'Authorization: Token <TOKEN>'
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
echo $response;
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
[
|
||||
{
|
||||
"id": "18e204d6-f7c6-405d-8025-70becb216add",
|
||||
"flow_id": "61092452-b17c-4b14-b7cf-a2158c549826",
|
||||
"reporter_id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"timestamp": "2025-03-20T16:23:58.125397Z",
|
||||
"source": {
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"type": "PEER",
|
||||
"name": "My Peer",
|
||||
"geo_location": {
|
||||
"city_name": "Berlin",
|
||||
"country_code": "DE"
|
||||
},
|
||||
"os": "Linux",
|
||||
"address": "100.64.0.10:51820",
|
||||
"dns_label": "*.mydomain.com"
|
||||
},
|
||||
"user_id": "google-oauth2|123456789012345678901",
|
||||
"user_email": "alice@netbird.io",
|
||||
"user_name": "Alice Smith",
|
||||
"destination": {
|
||||
"id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"type": "PEER",
|
||||
"name": "My Peer",
|
||||
"geo_location": {
|
||||
"city_name": "Berlin",
|
||||
"country_code": "DE"
|
||||
},
|
||||
"os": "Linux",
|
||||
"address": "100.64.0.10:51820",
|
||||
"dns_label": "*.mydomain.com"
|
||||
},
|
||||
"protocol": 6,
|
||||
"type": "TYPE_START",
|
||||
"direction": "INGRESS",
|
||||
"rx_bytes": 1234,
|
||||
"rx_packets": 5,
|
||||
"tx_bytes": 1234,
|
||||
"tx_packets": 5,
|
||||
"policy_id": "ch8i4ug6lnn4g9hqv7m0",
|
||||
"policy_name": "All to All",
|
||||
"icmp_type": 8,
|
||||
"icmp_code": 0
|
||||
}
|
||||
]
|
||||
```
|
||||
```json {{ title: 'Schema' }}
|
||||
[
|
||||
{
|
||||
"id": "string",
|
||||
"flow_id": "string",
|
||||
"reporter_id": "string",
|
||||
"timestamp": "string",
|
||||
"source": {
|
||||
"id": "string",
|
||||
"type": "string",
|
||||
"name": "string",
|
||||
"geo_location": {
|
||||
"city_name": "string",
|
||||
"country_code": "string"
|
||||
},
|
||||
"os": "string",
|
||||
"address": "string",
|
||||
"dns_label": "string"
|
||||
},
|
||||
"user_id": "string",
|
||||
"user_email": "string",
|
||||
"user_name": "string",
|
||||
"destination": {
|
||||
"id": "string",
|
||||
"type": "string",
|
||||
"name": "string",
|
||||
"geo_location": {
|
||||
"city_name": "string",
|
||||
"country_code": "string"
|
||||
},
|
||||
"os": "string",
|
||||
"address": "string",
|
||||
"dns_label": "string"
|
||||
},
|
||||
"protocol": "integer",
|
||||
"type": "string",
|
||||
"direction": "string",
|
||||
"rx_bytes": "integer",
|
||||
"rx_packets": "integer",
|
||||
"tx_bytes": "integer",
|
||||
"tx_packets": "integer",
|
||||
"policy_id": "string",
|
||||
"policy_name": "string",
|
||||
"icmp_type": "integer",
|
||||
"icmp_code": "integer"
|
||||
}
|
||||
]
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
2470
src/pages/ipa/resources/ingress-ports.mdx
Normal file
2470
src/pages/ipa/resources/ingress-ports.mdx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,18 @@ export const title = 'Peers'
|
||||
<Row>
|
||||
<Col>
|
||||
Returns a list of all peers
|
||||
|
||||
### Query Parameters
|
||||
<Properties>
|
||||
|
||||
<Property name="name" type="string" required={false}>
|
||||
Filter peers by name
|
||||
</Property>
|
||||
|
||||
<Property name="ip" type="string" required={false}>
|
||||
Filter peers by IP address
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
|
||||
Reference in New Issue
Block a user