From 126bc9694882f4d5d283eeea2ccdc51c644740f3 Mon Sep 17 00:00:00 2001 From: netbirddev Date: Tue, 12 Mar 2024 18:32:05 +0000 Subject: [PATCH] Update API pages with v0.26.3 --- src/pages/ipa/resources/accounts.mdx | 412 +----- src/pages/ipa/resources/dns.mdx | 635 +-------- src/pages/ipa/resources/events.mdx | 45 +- src/pages/ipa/resources/geo-locations.mdx | 24 +- src/pages/ipa/resources/groups.mdx | 206 +-- src/pages/ipa/resources/peers.mdx | 293 +--- src/pages/ipa/resources/policies.mdx | 899 +------------ src/pages/ipa/resources/posture-checks.mdx | 1392 +------------------- src/pages/ipa/resources/routes.mdx | 442 +------ src/pages/ipa/resources/rules.mdx | 418 +----- src/pages/ipa/resources/setup-keys.mdx | 374 +----- src/pages/ipa/resources/tokens.mdx | 99 +- src/pages/ipa/resources/users.mdx | 252 +--- 13 files changed, 338 insertions(+), 5153 deletions(-) diff --git a/src/pages/ipa/resources/accounts.mdx b/src/pages/ipa/resources/accounts.mdx index 89376811..201068e4 100644 --- a/src/pages/ipa/resources/accounts.mdx +++ b/src/pages/ipa/resources/accounts.mdx @@ -160,211 +160,21 @@ echo $response; ```json {{ title: 'Example' }} -[ - { - "id": "ch8i4ug6lnn4g9hqv7l0", - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "extra": { - "peer_approval_enabled": true - } - } +{ + "items": { + "$ref": "#/components/schemas/Account" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "settings": { - "peer_login_expiration_enabled": "boolean", - "peer_login_expiration": "integer", - "groups_propagation_enabled": "boolean", - "jwt_groups_enabled": "boolean", - "jwt_groups_claim_name": "string", - "jwt_allow_groups": [ - "string" - ], - "extra": { - "peer_approval_enabled": "boolean" - } - } +{ + "items": { + "$ref": "#/components/schemas/Account" } -] -``` - - - - - - ---- - - -## Delete an Account {{ tag: 'DELETE' , label: '/api/accounts/{accountId}' }} - - - - Deletes an account and all its resources. Only administrators and account owners can delete accounts. - - #### Path Parameters - - - - The unique identifier of an account - - - - - - -```bash {{ title: 'cURL' }} -curl -X DELETE https://api.netbird.io/api/accounts/{accountId} \ --H 'Authorization: Token ' -``` - -```js -const axios = require('axios'); - -let config = { - method: 'delete', - maxBodyLength: Infinity, - url: '/api/accounts/{accountId}', - headers: { - 'Authorization': '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/accounts/{accountId}" - -headers: { - 'Authorization': 'Token ' -} - -response = requests.request("DELETE", url, headers=headers) - -print(response.text) -``` - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io/ioutil" -) - -func main() { - - url := "https://api.netbird.io/api/accounts/{accountId}" - method := "DELETE" - - client := &http.Client { - } - req, err := http.NewRequest(method, url, nil) - - if err != nil { - fmt.Println(err) - return - { - - req.Header.Add("Authorization", "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/accounts/{accountId}") - -https = Net::HTTP.new(url.host, url.port) -https.use_ssl = true - -request = Net::HTTP::Delete.new(url) -request["Authorization"] = "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/accounts/{accountId}") - .method("DELETE") - .addHeader("Authorization: Token ") - .build(); -Response response = client.newCall(request).execute(); -``` - -```php - 'https://api.netbird.io/api/accounts/{accountId}', - CURLOPT_RETURNTRANSFER => true, - CURLOPT_ENCODING => '', - CURLOPT_MAXREDIRS => 10, - CURLOPT_TIMEOUT => 0, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_HTTPHEADER => array( - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - @@ -385,72 +195,7 @@ echo $response; The unique identifier of an account - - #### Request-Body Parameters - - - -
- More Information - - - - - 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). - - - - - Period of time after which peer login expires (seconds). - - - - - Allows propagate the new user auto groups to peers that belongs to the user - - - - - Allows extract groups from JWT claim and add it to account groups. - - - - - Name of the claim from which we extract groups names to add it to account groups. - - - - - List of groups to which users are allowed access - - - - -
- More Information - - - - - (Cloud only) Enables or disables peer approval globally. If enabled, all peers added will be in pending state until approved by an admin. - - - - - -
- -
-
- -
-
- -
-
- - - + @@ -460,38 +205,14 @@ curl -X PUT https://api.netbird.io/api/accounts/{accountId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "extra": { - "peer_approval_enabled": true - } - } + "$ref": "#/components/schemas/AccountRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "extra": { - "peer_approval_enabled": true - } - } + "$ref": "#/components/schemas/AccountRequest" }); let config = { method: 'put', @@ -520,19 +241,7 @@ import json url = "https://api.netbird.io/api/accounts/{accountId}" payload = json.dumps({ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "extra": { - "peer_approval_enabled": true - } - } + "$ref": "#/components/schemas/AccountRequest" }) headers: { 'Content-Type': 'application/json', @@ -561,19 +270,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "extra": { - "peer_approval_enabled": true - } - } + "$ref": "#/components/schemas/AccountRequest" }`) client := &http.Client { } @@ -620,19 +317,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "extra": { - "peer_approval_enabled": true - } - } + "$ref": "#/components/schemas/AccountRequest" }) response = https.request(request) puts response.read_body @@ -643,19 +328,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "extra": { - "peer_approval_enabled": true - } - } + "$ref": "#/components/schemas/AccountRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/accounts/{accountId}") @@ -682,19 +355,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "extra": { - "peer_approval_enabled": true - } - } + "$ref": "#/components/schemas/AccountRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -715,48 +376,18 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7l0", - "settings": { - "peer_login_expiration_enabled": true, - "peer_login_expiration": 43200, - "groups_propagation_enabled": true, - "jwt_groups_enabled": true, - "jwt_groups_claim_name": "roles", - "jwt_allow_groups": [ - "Administrators" - ], - "extra": { - "peer_approval_enabled": true - } - } + "$ref": "#/components/schemas/Account" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "settings": { - "peer_login_expiration_enabled": "boolean", - "peer_login_expiration": "integer", - "groups_propagation_enabled": "boolean", - "jwt_groups_enabled": "boolean", - "jwt_groups_claim_name": "string", - "jwt_allow_groups": [ - "string" - ], - "extra": { - "peer_approval_enabled": "boolean" - } - } + "$ref": "#/components/schemas/Account" } ``` - - - - - - - - + + + + --- @@ -918,6 +549,7 @@ echo $response; + diff --git a/src/pages/ipa/resources/dns.mdx b/src/pages/ipa/resources/dns.mdx index c353af76..41164ec6 100644 --- a/src/pages/ipa/resources/dns.mdx +++ b/src/pages/ipa/resources/dns.mdx @@ -160,54 +160,18 @@ echo $response; ```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" - ], - "search_domains_enabled": true +{ + "items": { + "$ref": "#/components/schemas/NameserverGroup" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "description": "string", - "nameservers": [ - { - "ip": "string", - "ns_type": "string", - "port": "integer" - } - ], - "enabled": "boolean", - "groups": [ - "string" - ], - "primary": "boolean", - "domains": [ - "string" - ], - "search_domains_enabled": "boolean" +{ + "items": { + "$ref": "#/components/schemas/NameserverGroup" } -] +} ``` @@ -223,75 +187,7 @@ echo $response; Creates a Nameserver Group - - #### Request-Body Parameters - - - - Name of nameserver group name - - - - - Description of the nameserver group - - - - -
- Nameserver list - - - - - Nameserver IP - - - - - Nameserver Type - - - - - Nameserver Port - - - - - -
- -
- - - Nameserver group status - - - - - Distribution group IDs that defines group of peers that will use this nameserver group - - - - - Defines if a nameserver group is primary that resolves all domains. It should be true only if domains list is empty. - - - - - Match domain list. It should be empty only if primary is true. - - - - - Search domain status for match domains. It should be true only if domains list is not empty. - - -
- - - + @@ -301,48 +197,14 @@ curl -X POST https://api.netbird.io/api/dns/nameservers \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }); let config = { method: 'post', @@ -371,24 +233,7 @@ import json url = "https://api.netbird.io/api/dns/nameservers" payload = json.dumps({ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }) headers: { 'Content-Type': 'application/json', @@ -417,24 +262,7 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }`) client := &http.Client { } @@ -481,24 +309,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }) response = https.request(request) puts response.read_body @@ -509,24 +320,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers") @@ -553,24 +347,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -591,48 +368,12 @@ echo $response; ```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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroup" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "nameservers": [ - { - "ip": "string", - "ns_type": "string", - "port": "integer" - } - ], - "enabled": "boolean", - "groups": [ - "string" - ], - "primary": "boolean", - "domains": [ - "string" - ], - "search_domains_enabled": "boolean" + "$ref": "#/components/schemas/NameserverGroup" } ``` @@ -811,48 +552,12 @@ echo $response; ```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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroup" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "nameservers": [ - { - "ip": "string", - "ns_type": "string", - "port": "integer" - } - ], - "enabled": "boolean", - "groups": [ - "string" - ], - "primary": "boolean", - "domains": [ - "string" - ], - "search_domains_enabled": "boolean" + "$ref": "#/components/schemas/NameserverGroup" } ``` @@ -877,75 +582,7 @@ echo $response; The unique identifier of a Nameserver Group - - #### Request-Body Parameters - - - - Name of nameserver group name - - - - - Description of the nameserver group - - - - -
- Nameserver list - - - - - Nameserver IP - - - - - Nameserver Type - - - - - Nameserver Port - - - - - -
- -
- - - Nameserver group status - - - - - Distribution group IDs that defines group of peers that will use this nameserver group - - - - - Defines if a nameserver group is primary that resolves all domains. It should be true only if domains list is empty. - - - - - Match domain list. It should be empty only if primary is true. - - - - - Search domain status for match domains. It should be true only if domains list is not empty. - - -
- - - + @@ -955,48 +592,14 @@ curl -X PUT https://api.netbird.io/api/dns/nameservers/{nsgroupId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }); let config = { method: 'put', @@ -1025,24 +628,7 @@ import json url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" payload = json.dumps({ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }) headers: { 'Content-Type': 'application/json', @@ -1071,24 +657,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }`) client := &http.Client { } @@ -1135,24 +704,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }) response = https.request(request) puts response.read_body @@ -1163,24 +715,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") @@ -1207,24 +742,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroupRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -1245,48 +763,12 @@ echo $response; ```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" - ], - "search_domains_enabled": true + "$ref": "#/components/schemas/NameserverGroup" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "nameservers": [ - { - "ip": "string", - "ns_type": "string", - "port": "integer" - } - ], - "enabled": "boolean", - "groups": [ - "string" - ], - "primary": "boolean", - "domains": [ - "string" - ], - "search_domains_enabled": "boolean" + "$ref": "#/components/schemas/NameserverGroup" } ``` @@ -1622,18 +1104,14 @@ echo $response; ```json {{ title: 'Example' }} { "items": { - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/DNSSettings" } } ``` ```json {{ title: 'Schema' }} { "items": { - "disabled_management_groups": [ - "string" - ] + "$ref": "#/components/schemas/DNSSettings" } } ``` @@ -1651,18 +1129,7 @@ echo $response; Updates a DNS settings object - - #### Request-Body Parameters - - - - Groups whose DNS management is disabled - - - - - - + @@ -1672,18 +1139,14 @@ curl -X PUT https://api.netbird.io/api/dns/settings \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/DNSSettings" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/DNSSettings" }); let config = { method: 'put', @@ -1712,9 +1175,7 @@ import json url = "https://api.netbird.io/api/dns/settings" payload = json.dumps({ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/DNSSettings" }) headers: { 'Content-Type': 'application/json', @@ -1743,9 +1204,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/DNSSettings" }`) client := &http.Client { } @@ -1792,9 +1251,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/DNSSettings" }) response = https.request(request) puts response.read_body @@ -1805,9 +1262,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/DNSSettings" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/settings") @@ -1834,9 +1289,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/DNSSettings" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -1857,16 +1310,12 @@ echo $response; ```json {{ title: 'Example' }} { - "disabled_management_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/DNSSettings" } ``` ```json {{ title: 'Schema' }} { - "disabled_management_groups": [ - "string" - ] + "$ref": "#/components/schemas/DNSSettings" } ``` diff --git a/src/pages/ipa/resources/events.mdx b/src/pages/ipa/resources/events.mdx index a2e56060..902a9681 100644 --- a/src/pages/ipa/resources/events.mdx +++ b/src/pages/ipa/resources/events.mdx @@ -160,47 +160,18 @@ echo $response; ```json {{ title: 'Example' }} -[ - { - "id": 10, - "timestamp": "2023-05-05T10:04:37.473542Z", - "activity": "Route created", - "activity_code": "route.add", - "initiator_id": "google-oauth2|123456789012345678901", - "initiator_name": "John Doe", - "initiator_email": "demo@netbird.io", - "target_id": "chad9d86lnnc59g18ou0", - "meta": { - "name": "my route", - "network_range": "10.64.0.0/24", - "peer_id": "chacbco6lnnbn6cg5s91" - } +{ + "items": { + "$ref": "#/components/schemas/Event" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "timestamp": "string", - "activity": "string", - "activity_code": "string", - "initiator_id": "string", - "initiator_name": "string", - "initiator_email": "string", - "target_id": "string", - "meta": { - "description": "The metadata of the event", - "type": "object", - "additionalProperties": "string", - "example": { - "name": "my route", - "network_range": "10.64.0.0/24", - "peer_id": "chacbco6lnnbn6cg5s91" - } - } +{ + "items": { + "$ref": "#/components/schemas/Event" } -] +} ``` diff --git a/src/pages/ipa/resources/geo-locations.mdx b/src/pages/ipa/resources/geo-locations.mdx index 27ffac9e..8d9a9156 100644 --- a/src/pages/ipa/resources/geo-locations.mdx +++ b/src/pages/ipa/resources/geo-locations.mdx @@ -2,7 +2,7 @@ export const title = 'Geo Locations' -## List all country codes {{ tag: 'GET' , label: '/api/locations/countries' }} +## List all country codes {{ tag: 'GET' , label: '/api/locations/countries' }} @@ -160,14 +160,16 @@ echo $response; ```json {{ title: 'Example' }} -[ - "DE" -] +{ + "items": "DE" +} ``` ```json {{ title: 'Schema' }} -[ - "string" -] +{ + "items": { + "example": "DE" + } +} ``` @@ -178,7 +180,7 @@ echo $response; --- -## List all city names by country {{ tag: 'GET' , label: '/api/locations/countries/{country}/cities' }} +## List all city names by country {{ tag: 'GET' , label: '/api/locations/countries/{country}/cities' }} @@ -345,14 +347,12 @@ echo $response; ```json {{ title: 'Example' }} { - "geoname_id": 2950158, - "city_name": "Berlin" + "$ref": "#/components/schemas/City" } ``` ```json {{ title: 'Schema' }} { - "geoname_id": "integer", - "city_name": "string" + "$ref": "#/components/schemas/City" } ``` diff --git a/src/pages/ipa/resources/groups.mdx b/src/pages/ipa/resources/groups.mdx index bc120109..a7aaf1a5 100644 --- a/src/pages/ipa/resources/groups.mdx +++ b/src/pages/ipa/resources/groups.mdx @@ -160,36 +160,18 @@ echo $response; ```json {{ title: 'Example' }} -[ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api", - "peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1" - } - ] +{ + "items": { + "$ref": "#/components/schemas/Group" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string", - "peers": [ - { - "id": "string", - "name": "string" - } - ] +{ + "items": { + "$ref": "#/components/schemas/Group" } -] +} ``` @@ -205,23 +187,7 @@ echo $response; Creates a group - - #### Request-Body Parameters - - - - Group name identifier - - - - - List of peers ids - - - - - - + @@ -231,20 +197,14 @@ curl -X POST https://api.netbird.io/api/groups \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }); let config = { method: 'post', @@ -273,10 +233,7 @@ import json url = "https://api.netbird.io/api/groups" payload = json.dumps({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }) headers: { 'Content-Type': 'application/json', @@ -305,10 +262,7 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }`) client := &http.Client { } @@ -355,10 +309,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }) response = https.request(request) puts response.read_body @@ -369,10 +320,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/groups") @@ -399,10 +347,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -423,30 +368,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api", - "peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1" - } - ] + "$ref": "#/components/schemas/Group" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string", - "peers": [ - { - "id": "string", - "name": "string" - } - ] + "$ref": "#/components/schemas/Group" } ``` @@ -625,30 +552,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api", - "peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1" - } - ] + "$ref": "#/components/schemas/Group" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string", - "peers": [ - { - "id": "string", - "name": "string" - } - ] + "$ref": "#/components/schemas/Group" } ``` @@ -673,23 +582,7 @@ echo $response; The unique identifier of a group - - #### Request-Body Parameters - - - - Group name identifier - - - - - List of peers ids - - - - - - + @@ -699,20 +592,14 @@ curl -X PUT https://api.netbird.io/api/groups/{groupId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }); let config = { method: 'put', @@ -741,10 +628,7 @@ import json url = "https://api.netbird.io/api/groups/{groupId}" payload = json.dumps({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }) headers: { 'Content-Type': 'application/json', @@ -773,10 +657,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }`) client := &http.Client { } @@ -823,10 +704,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }) response = https.request(request) puts response.read_body @@ -837,10 +715,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/groups/{groupId}") @@ -867,10 +742,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "name": "devs", - "peers": [ - "ch8i4ug6lnn4g9hqv7m1" - ] + "$ref": "#/components/schemas/GroupRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -891,30 +763,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api", - "peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1" - } - ] + "$ref": "#/components/schemas/Group" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string", - "peers": [ - { - "id": "string", - "name": "string" - } - ] + "$ref": "#/components/schemas/Group" } ``` diff --git a/src/pages/ipa/resources/peers.mdx b/src/pages/ipa/resources/peers.mdx index c7375357..9a89c398 100644 --- a/src/pages/ipa/resources/peers.mdx +++ b/src/pages/ipa/resources/peers.mdx @@ -160,76 +160,18 @@ echo $response; ```json {{ title: 'Example' }} -[ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1", - "ip": "10.64.0.1", - "connection_ip": "35.64.0.1", - "connected": true, - "last_seen": "2023-05-05T10:05:26.420578Z", - "os": "Darwin 13.2.1", - "kernel_version": "23.2.0", - "geoname_id": 2643743, - "version": "0.14.0", - "groups": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ], - "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", - "approval_required": true, - "country_code": "DE", - "city_name": "Berlin", - "accessible_peers_count": 5 +{ + "items": { + "$ref": "#/components/schemas/PeerBatch" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "ip": "string", - "connection_ip": "string", - "connected": "boolean", - "last_seen": "string", - "os": "string", - "kernel_version": "string", - "geoname_id": "integer", - "version": "string", - "groups": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "ssh_enabled": "boolean", - "user_id": "string", - "hostname": "string", - "ui_version": "string", - "dns_label": "string", - "login_expiration_enabled": "boolean", - "login_expired": "boolean", - "last_login": "string", - "approval_required": "boolean", - "country_code": "string", - "city_name": "string", - "accessible_peers_count": "integer" +{ + "items": { + "$ref": "#/components/schemas/PeerBatch" } -] +} ``` @@ -407,86 +349,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1", - "ip": "10.64.0.1", - "connection_ip": "35.64.0.1", - "connected": true, - "last_seen": "2023-05-05T10:05:26.420578Z", - "os": "Darwin 13.2.1", - "kernel_version": "23.2.0", - "geoname_id": 2643743, - "version": "0.14.0", - "groups": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ], - "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", - "approval_required": true, - "country_code": "DE", - "city_name": "Berlin", - "accessible_peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1", - "ip": "10.64.0.1", - "dns_label": "stage-host-1.netbird.cloud", - "user_id": "google-oauth2|277474792786460067937" - } - ] + "$ref": "#/components/schemas/Peer" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "ip": "string", - "connection_ip": "string", - "connected": "boolean", - "last_seen": "string", - "os": "string", - "kernel_version": "string", - "geoname_id": "integer", - "version": "string", - "groups": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "ssh_enabled": "boolean", - "user_id": "string", - "hostname": "string", - "ui_version": "string", - "dns_label": "string", - "login_expiration_enabled": "boolean", - "login_expired": "boolean", - "last_login": "string", - "approval_required": "boolean", - "country_code": "string", - "city_name": "string", - "accessible_peers": [ - { - "id": "string", - "name": "string", - "ip": "string", - "dns_label": "string", - "user_id": "string" - } - ] + "$ref": "#/components/schemas/Peer" } ``` @@ -511,33 +379,7 @@ echo $response; The unique identifier of a peer - - #### Request-Body Parameters - - - - - - - - - - - - - - - - - - - (Cloud only) Indicates whether peer needs approval - - - - - - + @@ -547,20 +389,14 @@ curl -X PUT https://api.netbird.io/api/peers/{peerId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "approval_required": true + "$ref": "#/components/schemas/PeerRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "approval_required": true + "$ref": "#/components/schemas/PeerRequest" }); let config = { method: 'put', @@ -589,10 +425,7 @@ import json url = "https://api.netbird.io/api/peers/{peerId}" payload = json.dumps({ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "approval_required": true + "$ref": "#/components/schemas/PeerRequest" }) headers: { 'Content-Type': 'application/json', @@ -621,10 +454,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "approval_required": true + "$ref": "#/components/schemas/PeerRequest" }`) client := &http.Client { } @@ -671,10 +501,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "approval_required": true + "$ref": "#/components/schemas/PeerRequest" }) response = https.request(request) puts response.read_body @@ -685,10 +512,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "approval_required": true + "$ref": "#/components/schemas/PeerRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/peers/{peerId}") @@ -715,10 +539,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "name": "stage-host-1", - "ssh_enabled": true, - "login_expiration_enabled": false, - "approval_required": true + "$ref": "#/components/schemas/PeerRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -739,86 +560,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1", - "ip": "10.64.0.1", - "connection_ip": "35.64.0.1", - "connected": true, - "last_seen": "2023-05-05T10:05:26.420578Z", - "os": "Darwin 13.2.1", - "kernel_version": "23.2.0", - "geoname_id": 2643743, - "version": "0.14.0", - "groups": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ], - "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", - "approval_required": true, - "country_code": "DE", - "city_name": "Berlin", - "accessible_peers": [ - { - "id": "chacbco6lnnbn6cg5s90", - "name": "stage-host-1", - "ip": "10.64.0.1", - "dns_label": "stage-host-1.netbird.cloud", - "user_id": "google-oauth2|277474792786460067937" - } - ] + "$ref": "#/components/schemas/Peer" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "ip": "string", - "connection_ip": "string", - "connected": "boolean", - "last_seen": "string", - "os": "string", - "kernel_version": "string", - "geoname_id": "integer", - "version": "string", - "groups": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "ssh_enabled": "boolean", - "user_id": "string", - "hostname": "string", - "ui_version": "string", - "dns_label": "string", - "login_expiration_enabled": "boolean", - "login_expired": "boolean", - "last_login": "string", - "approval_required": "boolean", - "country_code": "string", - "city_name": "string", - "accessible_peers": [ - { - "id": "string", - "name": "string", - "ip": "string", - "dns_label": "string", - "user_id": "string" - } - ] + "$ref": "#/components/schemas/Peer" } ``` diff --git a/src/pages/ipa/resources/policies.mdx b/src/pages/ipa/resources/policies.mdx index 3df44a33..b79b1ab7 100644 --- a/src/pages/ipa/resources/policies.mdx +++ b/src/pages/ipa/resources/policies.mdx @@ -160,91 +160,18 @@ echo $response; ```json {{ title: 'Example' }} -[ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ], - "destinations": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ] - } - ] +{ + "items": { + "$ref": "#/components/schemas/Policy" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "description": "string", - "enabled": "boolean", - "source_posture_checks": [ - "string" - ], - "rules": [ - { - "id": "string", - "name": "string", - "description": "string", - "enabled": "boolean", - "action": "string", - "bidirectional": "boolean", - "protocol": "string", - "ports": [ - "string" - ], - "sources": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "destinations": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ] - } - ] +{ + "items": { + "$ref": "#/components/schemas/Policy" } -] +} ``` @@ -260,100 +187,7 @@ echo $response; Creates a policy - - #### Request-Body Parameters - - - - Policy ID - - - - - Policy name identifier - - - - - Policy friendly description - - - - - Policy status - - - - - Posture checks ID's applied to policy source groups - - - - -
- Policy rule object for policy UI editor - - - - - Policy rule ID - - - - - Policy rule name identifier - - - - - Policy rule friendly description - - - - - Policy rule status - - - - - Policy rule accept or drops packets - - - - - Define if the rule is applicable in both directions, sources, and destinations. - - - - - Policy rule type of the traffic - - - - - Policy rule affected ports or it ranges list - - - - - Policy rule source group IDs - - - - - Policy rule destination group IDs - - - - - -
- -
-
- - - + @@ -363,66 +197,14 @@ curl -X POST https://api.netbird.io/api/policies \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }); let config = { method: 'post', @@ -451,33 +233,7 @@ import json url = "https://api.netbird.io/api/policies" payload = json.dumps({ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }) headers: { 'Content-Type': 'application/json', @@ -506,33 +262,7 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }`) client := &http.Client { } @@ -579,33 +309,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }) response = https.request(request) puts response.read_body @@ -616,33 +320,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/policies") @@ -669,33 +347,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -716,84 +368,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ], - "destinations": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ] - } - ] + "$ref": "#/components/schemas/Policy" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "enabled": "boolean", - "source_posture_checks": [ - "string" - ], - "rules": [ - { - "id": "string", - "name": "string", - "description": "string", - "enabled": "boolean", - "action": "string", - "bidirectional": "boolean", - "protocol": "string", - "ports": [ - "string" - ], - "sources": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "destinations": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ] - } - ] + "$ref": "#/components/schemas/Policy" } ``` @@ -972,84 +552,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ], - "destinations": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ] - } - ] + "$ref": "#/components/schemas/Policy" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "enabled": "boolean", - "source_posture_checks": [ - "string" - ], - "rules": [ - { - "id": "string", - "name": "string", - "description": "string", - "enabled": "boolean", - "action": "string", - "bidirectional": "boolean", - "protocol": "string", - "ports": [ - "string" - ], - "sources": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "destinations": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ] - } - ] + "$ref": "#/components/schemas/Policy" } ``` @@ -1074,100 +582,7 @@ echo $response; The unique identifier of a policy - - #### Request-Body Parameters - - - - Policy ID - - - - - Policy name identifier - - - - - Policy friendly description - - - - - Policy status - - - - - Posture checks ID's applied to policy source groups - - - - -
- Policy rule object for policy UI editor - - - - - Policy rule ID - - - - - Policy rule name identifier - - - - - Policy rule friendly description - - - - - Policy rule status - - - - - Policy rule accept or drops packets - - - - - Define if the rule is applicable in both directions, sources, and destinations. - - - - - Policy rule type of the traffic - - - - - Policy rule affected ports or it ranges list - - - - - Policy rule source group IDs - - - - - Policy rule destination group IDs - - - - - -
- -
-
- - - + @@ -1177,66 +592,14 @@ curl -X PUT https://api.netbird.io/api/policies/{policyId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }); let config = { method: 'put', @@ -1265,33 +628,7 @@ import json url = "https://api.netbird.io/api/policies/{policyId}" payload = json.dumps({ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }) headers: { 'Content-Type': 'application/json', @@ -1320,33 +657,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }`) client := &http.Client { } @@ -1393,33 +704,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }) response = https.request(request) puts response.read_body @@ -1430,33 +715,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/policies/{policyId}") @@ -1483,33 +742,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - "ch8i4ug6lnn4g9hqv797" - ], - "destinations": [ - "ch8i4ug6lnn4g9h7v7m0" - ] - } - ] + "$ref": "#/components/schemas/PolicyUpdate" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -1530,84 +763,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "ch8i4ug6lnn4g9hqv7mg", - "description": "This is a default policy that allows connections between all the resources", - "enabled": true, - "source_posture_checks": [ - "chacdk86lnnboviihd70" - ], - "rules": [ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "enabled": true, - "action": "accept", - "bidirectional": true, - "protocol": "tcp", - "ports": [ - "80" - ], - "sources": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ], - "destinations": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ] - } - ] + "$ref": "#/components/schemas/Policy" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "enabled": "boolean", - "source_posture_checks": [ - "string" - ], - "rules": [ - { - "id": "string", - "name": "string", - "description": "string", - "enabled": "boolean", - "action": "string", - "bidirectional": "boolean", - "protocol": "string", - "ports": [ - "string" - ], - "sources": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "destinations": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ] - } - ] + "$ref": "#/components/schemas/Policy" } ``` diff --git a/src/pages/ipa/resources/posture-checks.mdx b/src/pages/ipa/resources/posture-checks.mdx index 1da50b3b..01f50066 100644 --- a/src/pages/ipa/resources/posture-checks.mdx +++ b/src/pages/ipa/resources/posture-checks.mdx @@ -2,7 +2,7 @@ export const title = 'Posture Checks' -## List all Posture Checks {{ tag: 'GET' , label: '/api/posture-checks' }} +## List all Posture Checks {{ tag: 'GET' , label: '/api/posture-checks' }} @@ -160,100 +160,18 @@ echo $response; ```json {{ title: 'Example' }} -[ - { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } +{ + "items": { + "$ref": "#/components/schemas/PostureCheck" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "description": "string", - "checks": { - "nb_version_check": { - "min_version": "string" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "string", - "city_name": "string" - } - ], - "action": "string" - }, - "peer_network_range_check": { - "ranges": [ - "string" - ], - "action": "string" - } - } +{ + "items": { + "$ref": "#/components/schemas/PostureCheck" } -] +} ``` @@ -264,215 +182,12 @@ echo $response; --- -## Create a Posture Check {{ tag: 'POST' , label: '/api/posture-checks' }} +## Create a Posture Check {{ tag: 'POST' , label: '/api/posture-checks' }} Creates a posture check - - #### Request-Body Parameters - - - - Posture check name identifier - - - - - Posture check friendly description - - - - -
- List of objects that perform the actual checks - - - - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check with the kernel version - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check with the kernel version - - - - - Minimum acceptable version - - - - - -
- -
-
- -
-
- -
- - -
- Posture check for geo location - - - - -
- List of geo locations to which the policy applies - - - - - 2-letter ISO 3166-1 alpha-2 code that represents the country - - - - - Commonly used English name of the city - - - - - -
- -
- - - Action to take upon policy match - - -
- -
-
- -
- - -
- Posture check for allow or deny access based on peer local network addresses - - - - - List of peer network ranges in CIDR notation - - - - - Action to take upon policy match - - - - - -
- -
-
- -
-
- -
-
- - - + @@ -482,98 +197,14 @@ curl -X POST https://api.netbird.io/api/posture-checks \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }); let config = { method: 'post', @@ -602,49 +233,7 @@ import json url = "https://api.netbird.io/api/posture-checks" payload = json.dumps({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }) headers: { 'Content-Type': 'application/json', @@ -673,49 +262,7 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }`) client := &http.Client { } @@ -762,49 +309,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }) response = https.request(request) puts response.read_body @@ -815,49 +320,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/posture-checks") @@ -884,49 +347,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -947,94 +368,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheck" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "checks": { - "nb_version_check": { - "min_version": "string" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "string", - "city_name": "string" - } - ], - "action": "string" - }, - "peer_network_range_check": { - "ranges": [ - "string" - ], - "action": "string" - } - } + "$ref": "#/components/schemas/PostureCheck" } ``` @@ -1046,7 +385,7 @@ echo $response; --- -## Retrieve a Posture Check {{ tag: 'GET' , label: '/api/posture-checks/{postureCheckId}' }} +## Retrieve a Posture Check {{ tag: 'GET' , label: '/api/posture-checks/{postureCheckId}' }} @@ -1213,94 +552,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheck" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "checks": { - "nb_version_check": { - "min_version": "string" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "string", - "city_name": "string" - } - ], - "action": "string" - }, - "peer_network_range_check": { - "ranges": [ - "string" - ], - "action": "string" - } - } + "$ref": "#/components/schemas/PostureCheck" } ``` @@ -1312,7 +569,7 @@ echo $response; --- -## Update a Posture Check {{ tag: 'PUT' , label: '/api/posture-checks/{postureCheckId}' }} +## Update a Posture Check {{ tag: 'PUT' , label: '/api/posture-checks/{postureCheckId}' }} @@ -1325,210 +582,7 @@ echo $response; The unique identifier of a posture check - - #### Request-Body Parameters - - - - Posture check name identifier - - - - - Posture check friendly description - - - - -
- List of objects that perform the actual checks - - - - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check for the version of operating system - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check with the kernel version - - - - - Minimum acceptable version - - - - - -
- -
- - -
- Posture check with the kernel version - - - - - Minimum acceptable version - - - - - -
- -
-
- -
-
- -
- - -
- Posture check for geo location - - - - -
- List of geo locations to which the policy applies - - - - - 2-letter ISO 3166-1 alpha-2 code that represents the country - - - - - Commonly used English name of the city - - - - - -
- -
- - - Action to take upon policy match - - -
- -
-
- -
- - -
- Posture check for allow or deny access based on peer local network addresses - - - - - List of peer network ranges in CIDR notation - - - - - Action to take upon policy match - - - - - -
- -
-
- -
-
- -
-
- - - + @@ -1538,98 +592,14 @@ curl -X PUT https://api.netbird.io/api/posture-checks/{postureCheckId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }); let config = { method: 'put', @@ -1658,49 +628,7 @@ import json url = "https://api.netbird.io/api/posture-checks/{postureCheckId}" payload = json.dumps({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }) headers: { 'Content-Type': 'application/json', @@ -1729,49 +657,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }`) client := &http.Client { } @@ -1818,49 +704,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }) response = https.request(request) puts response.read_body @@ -1871,49 +715,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/posture-checks/{postureCheckId}") @@ -1940,49 +742,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheckUpdate" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -2003,94 +763,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "ch8i4ug6lnn4g9hqv7mg", - "name": "Default", - "description": "This checks if the peer is running required NetBird's version", - "checks": { - "nb_version_check": { - "min_version": "14.3" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "DE", - "city_name": "Berlin" - } - ], - "action": "allow" - }, - "peer_network_range_check": { - "ranges": [ - [ - "192.168.1.0/24", - "10.0.0.0/8", - "2001:db8:1234:1a00::/56" - ] - ], - "action": "allow" - } - } + "$ref": "#/components/schemas/PostureCheck" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "checks": { - "nb_version_check": { - "min_version": "string" - }, - "os_version_check": { - "android": { - "min_version": "13" - }, - "ios": { - "min_version": "17.3.1" - }, - "darwin": { - "min_version": "14.2.1" - }, - "linux": { - "min_kernel_version": "5.3.3" - }, - "windows": { - "min_kernel_version": "10.0.1234" - } - }, - "geo_location_check": { - "locations": [ - { - "country_code": "string", - "city_name": "string" - } - ], - "action": "string" - }, - "peer_network_range_check": { - "ranges": [ - "string" - ], - "action": "string" - } - } + "$ref": "#/components/schemas/PostureCheck" } ``` @@ -2102,7 +780,7 @@ echo $response; --- -## Delete a Posture Check {{ tag: 'DELETE' , label: '/api/posture-checks/{postureCheckId}' }} +## Delete a Posture Check {{ tag: 'DELETE' , label: '/api/posture-checks/{postureCheckId}' }} diff --git a/src/pages/ipa/resources/routes.mdx b/src/pages/ipa/resources/routes.mdx index 79f28a13..cacc0b20 100644 --- a/src/pages/ipa/resources/routes.mdx +++ b/src/pages/ipa/resources/routes.mdx @@ -160,46 +160,18 @@ echo $response; ```json {{ title: 'Example' }} -[ - { - "id": "chacdk86lnnboviihd7g", - "network_type": "IPv4", - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] +{ + "items": { + "$ref": "#/components/schemas/Route" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "network_type": "string", - "description": "string", - "network_id": "string", - "enabled": "boolean", - "peer": "string", - "peer_groups": [ - "string" - ], - "network": "string", - "metric": "integer", - "masquerade": "boolean", - "groups": [ - "string" - ] +{ + "items": { + "$ref": "#/components/schemas/Route" } -] +} ``` @@ -215,58 +187,7 @@ echo $response; Creates a Route - - #### Request-Body Parameters - - - - Route description - - - - - Route network identifier, to group HA routes - - - - - Route status - - - - - Peer Identifier associated with route. This property can not be set together with `peer_groups` - - - - - Peers Group Identifier associated with route. This property can not be set together with `peer` - - - - - Network range in CIDR format - - - - - Route metric number. Lowest number has higher priority - - - - - Indicate if peer should masquerade traffic to this route's prefix - - - - - Group IDs containing routing peers - - - - - - + @@ -276,38 +197,14 @@ curl -X POST https://api.netbird.io/api/routes \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }); let config = { method: 'post', @@ -336,19 +233,7 @@ import json url = "https://api.netbird.io/api/routes" payload = json.dumps({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }) headers: { 'Content-Type': 'application/json', @@ -377,19 +262,7 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }`) client := &http.Client { } @@ -436,19 +309,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }) response = https.request(request) puts response.read_body @@ -459,19 +320,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/routes") @@ -498,19 +347,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -531,40 +368,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "chacdk86lnnboviihd7g", - "network_type": "IPv4", - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/Route" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "network_type": "string", - "description": "string", - "network_id": "string", - "enabled": "boolean", - "peer": "string", - "peer_groups": [ - "string" - ], - "network": "string", - "metric": "integer", - "masquerade": "boolean", - "groups": [ - "string" - ] + "$ref": "#/components/schemas/Route" } ``` @@ -743,40 +552,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "chacdk86lnnboviihd7g", - "network_type": "IPv4", - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/Route" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "network_type": "string", - "description": "string", - "network_id": "string", - "enabled": "boolean", - "peer": "string", - "peer_groups": [ - "string" - ], - "network": "string", - "metric": "integer", - "masquerade": "boolean", - "groups": [ - "string" - ] + "$ref": "#/components/schemas/Route" } ``` @@ -801,58 +582,7 @@ echo $response; The unique identifier of a route - - #### Request-Body Parameters - - - - Route description - - - - - Route network identifier, to group HA routes - - - - - Route status - - - - - Peer Identifier associated with route. This property can not be set together with `peer_groups` - - - - - Peers Group Identifier associated with route. This property can not be set together with `peer` - - - - - Network range in CIDR format - - - - - Route metric number. Lowest number has higher priority - - - - - Indicate if peer should masquerade traffic to this route's prefix - - - - - Group IDs containing routing peers - - - - - - + @@ -862,38 +592,14 @@ curl -X PUT https://api.netbird.io/api/routes/{routeId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }); let config = { method: 'put', @@ -922,19 +628,7 @@ import json url = "https://api.netbird.io/api/routes/{routeId}" payload = json.dumps({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }) headers: { 'Content-Type': 'application/json', @@ -963,19 +657,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }`) client := &http.Client { } @@ -1022,19 +704,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }) response = https.request(request) puts response.read_body @@ -1045,19 +715,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/routes/{routeId}") @@ -1084,19 +742,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/RouteRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -1117,40 +763,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "chacdk86lnnboviihd7g", - "network_type": "IPv4", - "description": "My first route", - "network_id": "Route 1", - "enabled": true, - "peer": "chacbco6lnnbn6cg5s91", - "peer_groups": [ - "chacbco6lnnbn6cg5s91" - ], - "network": "10.64.0.0/24", - "metric": 9999, - "masquerade": true, - "groups": [ - "chacdk86lnnboviihd70" - ] + "$ref": "#/components/schemas/Route" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "network_type": "string", - "description": "string", - "network_id": "string", - "enabled": "boolean", - "peer": "string", - "peer_groups": [ - "string" - ], - "network": "string", - "metric": "integer", - "masquerade": "boolean", - "groups": [ - "string" - ] + "$ref": "#/components/schemas/Route" } ``` diff --git a/src/pages/ipa/resources/rules.mdx b/src/pages/ipa/resources/rules.mdx index 86094baa..ab300081 100644 --- a/src/pages/ipa/resources/rules.mdx +++ b/src/pages/ipa/resources/rules.mdx @@ -160,58 +160,18 @@ echo $response; ```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, - "issued": "api" - } - ], - "destinations": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ] +{ + "items": { + "$ref": "#/components/schemas/Rule" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "description": "string", - "disabled": "boolean", - "flow": "string", - "sources": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "destinations": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ] +{ + "items": { + "$ref": "#/components/schemas/Rule" } -] +} ``` @@ -227,43 +187,7 @@ echo $response; Creates a rule. This will be deprecated in favour of `/api/policies`. - - #### Request-Body Parameters - - - - Rule name identifier - - - - - Rule friendly description - - - - - Rules status - - - - - Rule flow, currently, only "bidirect" for bi-directional traffic is accepted - - - - - List of source group IDs - - - - - List of destination group IDs - - - - - - + @@ -273,32 +197,14 @@ curl -X POST https://api.netbird.io/api/rules \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }); let config = { method: 'post', @@ -327,16 +233,7 @@ import json url = "https://api.netbird.io/api/rules" payload = json.dumps({ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }) headers: { 'Content-Type': 'application/json', @@ -365,16 +262,7 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }`) client := &http.Client { } @@ -421,16 +309,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }) response = https.request(request) puts response.read_body @@ -441,16 +320,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/rules") @@ -477,16 +347,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -507,52 +368,12 @@ echo $response; ```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, - "issued": "api" - } - ], - "destinations": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ] + "$ref": "#/components/schemas/Rule" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "disabled": "boolean", - "flow": "string", - "sources": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "destinations": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ] + "$ref": "#/components/schemas/Rule" } ``` @@ -731,52 +552,12 @@ echo $response; ```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, - "issued": "api" - } - ], - "destinations": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ] + "$ref": "#/components/schemas/Rule" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "disabled": "boolean", - "flow": "string", - "sources": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "destinations": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ] + "$ref": "#/components/schemas/Rule" } ``` @@ -801,43 +582,7 @@ echo $response; The unique identifier of a rule - - #### Request-Body Parameters - - - - Rule name identifier - - - - - Rule friendly description - - - - - Rules status - - - - - Rule flow, currently, only "bidirect" for bi-directional traffic is accepted - - - - - List of source group IDs - - - - - List of destination group IDs - - - - - - + @@ -847,32 +592,14 @@ curl -X PUT https://api.netbird.io/api/rules/{ruleId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }); let config = { method: 'put', @@ -901,16 +628,7 @@ import json url = "https://api.netbird.io/api/rules/{ruleId}" payload = json.dumps({ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }) headers: { 'Content-Type': 'application/json', @@ -939,16 +657,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }`) client := &http.Client { } @@ -995,16 +704,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }) response = https.request(request) puts response.read_body @@ -1015,16 +715,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/rules/{ruleId}") @@ -1051,16 +742,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "name": "Default", - "description": "This is a default rule that allows connections between all the resources", - "disabled": false, - "flow": "bidirect", - "sources": [ - "ch8i4ug6lnn4g9hqv7m1" - ], - "destinations": [ - "ch8i4ug6lnn4g9hqv7m0" - ] + "$ref": "#/components/schemas/RuleRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -1081,52 +763,12 @@ echo $response; ```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, - "issued": "api" - } - ], - "destinations": [ - { - "id": "ch8i4ug6lnn4g9hqv7m0", - "name": "devs", - "peers_count": 2, - "issued": "api" - } - ] + "$ref": "#/components/schemas/Rule" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "description": "string", - "disabled": "boolean", - "flow": "string", - "sources": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ], - "destinations": [ - { - "id": "string", - "name": "string", - "peers_count": "integer", - "issued": "string" - } - ] + "$ref": "#/components/schemas/Rule" } ``` diff --git a/src/pages/ipa/resources/setup-keys.mdx b/src/pages/ipa/resources/setup-keys.mdx index 59c8ed9e..9e73a38e 100644 --- a/src/pages/ipa/resources/setup-keys.mdx +++ b/src/pages/ipa/resources/setup-keys.mdx @@ -160,48 +160,18 @@ echo $response; ```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": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "updated_at": "2023-05-05T09:00:35.477782Z", - "usage_limit": 0, - "ephemeral": true +{ + "items": { + "$ref": "#/components/schemas/SetupKey" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "key": "string", - "name": "string", - "expires": "string", - "type": "string", - "valid": "boolean", - "revoked": "boolean", - "used_times": "integer", - "last_used": "string", - "state": "string", - "auto_groups": [ - "string" - ], - "updated_at": "string", - "usage_limit": "integer", - "ephemeral": "boolean" +{ + "items": { + "$ref": "#/components/schemas/SetupKey" } -] +} ``` @@ -217,48 +187,7 @@ echo $response; Creates a setup key - - #### Request-Body Parameters - - - - Setup Key name - - - - - Setup key type, one-off for single time usage and reusable - - - - - Expiration time in seconds - - - - - Setup key revocation status - - - - - List of group IDs to auto-assign to peers registered with this key - - - - - A number of times this key can be used. The value of 0 indicates the unlimited usage. - - - - - Indicate that the peer will be ephemeral or not - - - - - - + @@ -268,30 +197,14 @@ curl -X POST https://api.netbird.io/api/setup-keys \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }); let config = { method: 'post', @@ -320,15 +233,7 @@ import json url = "https://api.netbird.io/api/setup-keys" payload = json.dumps({ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }) headers: { 'Content-Type': 'application/json', @@ -357,15 +262,7 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }`) client := &http.Client { } @@ -412,15 +309,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }) response = https.request(request) puts response.read_body @@ -431,15 +320,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/setup-keys") @@ -466,15 +347,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -495,42 +368,12 @@ echo $response; ```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": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "updated_at": "2023-05-05T09:00:35.477782Z", - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKey" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "key": "string", - "name": "string", - "expires": "string", - "type": "string", - "valid": "boolean", - "revoked": "boolean", - "used_times": "integer", - "last_used": "string", - "state": "string", - "auto_groups": [ - "string" - ], - "updated_at": "string", - "usage_limit": "integer", - "ephemeral": "boolean" + "$ref": "#/components/schemas/SetupKey" } ``` @@ -709,42 +552,12 @@ echo $response; ```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": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "updated_at": "2023-05-05T09:00:35.477782Z", - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKey" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "key": "string", - "name": "string", - "expires": "string", - "type": "string", - "valid": "boolean", - "revoked": "boolean", - "used_times": "integer", - "last_used": "string", - "state": "string", - "auto_groups": [ - "string" - ], - "updated_at": "string", - "usage_limit": "integer", - "ephemeral": "boolean" + "$ref": "#/components/schemas/SetupKey" } ``` @@ -769,48 +582,7 @@ echo $response; The unique identifier of a setup key - - #### Request-Body Parameters - - - - Setup Key name - - - - - Setup key type, one-off for single time usage and reusable - - - - - Expiration time in seconds - - - - - Setup key revocation status - - - - - List of group IDs to auto-assign to peers registered with this key - - - - - A number of times this key can be used. The value of 0 indicates the unlimited usage. - - - - - Indicate that the peer will be ephemeral or not - - - - - - + @@ -820,30 +592,14 @@ curl -X PUT https://api.netbird.io/api/setup-keys/{keyId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }); let config = { method: 'put', @@ -872,15 +628,7 @@ import json url = "https://api.netbird.io/api/setup-keys/{keyId}" payload = json.dumps({ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }) headers: { 'Content-Type': 'application/json', @@ -909,15 +657,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }`) client := &http.Client { } @@ -964,15 +704,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }) response = https.request(request) puts response.read_body @@ -983,15 +715,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/setup-keys/{keyId}") @@ -1018,15 +742,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "name": "Default key", - "type": "reusable", - "expires_in": 86400, - "revoked": false, - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKeyRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -1047,42 +763,12 @@ echo $response; ```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": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "updated_at": "2023-05-05T09:00:35.477782Z", - "usage_limit": 0, - "ephemeral": true + "$ref": "#/components/schemas/SetupKey" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "key": "string", - "name": "string", - "expires": "string", - "type": "string", - "valid": "boolean", - "revoked": "boolean", - "used_times": "integer", - "last_used": "string", - "state": "string", - "auto_groups": [ - "string" - ], - "updated_at": "string", - "usage_limit": "integer", - "ephemeral": "boolean" + "$ref": "#/components/schemas/SetupKey" } ``` diff --git a/src/pages/ipa/resources/tokens.mdx b/src/pages/ipa/resources/tokens.mdx index e065aff0..1a0a30a0 100644 --- a/src/pages/ipa/resources/tokens.mdx +++ b/src/pages/ipa/resources/tokens.mdx @@ -168,28 +168,18 @@ echo $response; ```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" +{ + "items": { + "$ref": "#/components/schemas/PersonalAccessToken" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "name": "string", - "expiration_date": "string", - "created_by": "string", - "created_at": "string", - "last_used": "string" +{ + "items": { + "$ref": "#/components/schemas/PersonalAccessToken" } -] +} ``` @@ -213,23 +203,7 @@ echo $response; The unique identifier of a user - - #### Request-Body Parameters - - - - Name of the token - - - - - Expiration in days - - - - - - + @@ -239,16 +213,14 @@ curl -X POST https://api.netbird.io/api/users/{userId}/tokens \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "name": "My first token", - "expires_in": 30 + "$ref": "#/components/schemas/PersonalAccessTokenRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "name": "My first token", - "expires_in": 30 + "$ref": "#/components/schemas/PersonalAccessTokenRequest" }); let config = { method: 'post', @@ -277,8 +249,7 @@ import json url = "https://api.netbird.io/api/users/{userId}/tokens" payload = json.dumps({ - "name": "My first token", - "expires_in": 30 + "$ref": "#/components/schemas/PersonalAccessTokenRequest" }) headers: { 'Content-Type': 'application/json', @@ -307,8 +278,7 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "name": "My first token", - "expires_in": 30 + "$ref": "#/components/schemas/PersonalAccessTokenRequest" }`) client := &http.Client { } @@ -355,8 +325,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "name": "My first token", - "expires_in": 30 + "$ref": "#/components/schemas/PersonalAccessTokenRequest" }) response = https.request(request) puts response.read_body @@ -367,8 +336,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "name": "My first token", - "expires_in": 30 + "$ref": "#/components/schemas/PersonalAccessTokenRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/users/{userId}/tokens") @@ -395,8 +363,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "name": "My first token", - "expires_in": 30 + "$ref": "#/components/schemas/PersonalAccessTokenRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -417,28 +384,12 @@ echo $response; ```json {{ title: 'Example' }} { - "plain_token": {}, - "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" - } + "$ref": "#/components/schemas/PersonalAccessTokenGenerated" } ``` ```json {{ title: 'Schema' }} { - "plain_token": "string", - "personal_access_token": { - "id": "string", - "name": "string", - "expiration_date": "string", - "created_by": "string", - "created_at": "string", - "last_used": "string" - } + "$ref": "#/components/schemas/PersonalAccessTokenGenerated" } ``` @@ -621,22 +572,12 @@ echo $response; ```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" + "$ref": "#/components/schemas/PersonalAccessToken" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "name": "string", - "expiration_date": "string", - "created_by": "string", - "created_at": "string", - "last_used": "string" + "$ref": "#/components/schemas/PersonalAccessToken" } ``` diff --git a/src/pages/ipa/resources/users.mdx b/src/pages/ipa/resources/users.mdx index 08dafc4c..8b366004 100644 --- a/src/pages/ipa/resources/users.mdx +++ b/src/pages/ipa/resources/users.mdx @@ -11,7 +11,7 @@ export const title = 'Users' #### Query Parameters - + Filters users and returns either regular users or service users @@ -168,42 +168,18 @@ echo $response; ```json {{ title: 'Example' }} -[ - { - "id": "google-oauth2|277474792786460067937", - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "status": "active", - "last_login": "2023-05-05T09:00:35.477782Z", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_current": true, - "is_service_user": false, - "is_blocked": false, - "issued": "api" +{ + "items": { + "$ref": "#/components/schemas/User" } -] +} ``` ```json {{ title: 'Schema' }} -[ - { - "id": "string", - "email": "string", - "name": "string", - "role": "string", - "status": "string", - "last_login": "string", - "auto_groups": [ - "string" - ], - "is_current": "boolean", - "is_service_user": "boolean", - "is_blocked": "boolean", - "issued": "string" +{ + "items": { + "$ref": "#/components/schemas/User" } -] +} ``` @@ -219,38 +195,7 @@ echo $response; Creates a new service user or sends an invite to a regular user - - #### Request-Body Parameters - - - - User's Email to send invite to - - - - - User's full name - - - - - User's NetBird account role - - - - - Group IDs to auto-assign to peers registered by this user - - - - - Is true if this user is a service user - - - - - - + @@ -260,26 +205,14 @@ curl -X POST https://api.netbird.io/api/users \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false + "$ref": "#/components/schemas/UserCreateRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false + "$ref": "#/components/schemas/UserCreateRequest" }); let config = { method: 'post', @@ -308,13 +241,7 @@ import json url = "https://api.netbird.io/api/users" payload = json.dumps({ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false + "$ref": "#/components/schemas/UserCreateRequest" }) headers: { 'Content-Type': 'application/json', @@ -343,13 +270,7 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false + "$ref": "#/components/schemas/UserCreateRequest" }`) client := &http.Client { } @@ -396,13 +317,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false + "$ref": "#/components/schemas/UserCreateRequest" }) response = https.request(request) puts response.read_body @@ -413,13 +328,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false + "$ref": "#/components/schemas/UserCreateRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/users") @@ -446,13 +355,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_service_user": false + "$ref": "#/components/schemas/UserCreateRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -473,36 +376,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "google-oauth2|277474792786460067937", - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "status": "active", - "last_login": "2023-05-05T09:00:35.477782Z", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_current": true, - "is_service_user": false, - "is_blocked": false, - "issued": "api" + "$ref": "#/components/schemas/User" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "email": "string", - "name": "string", - "role": "string", - "status": "string", - "last_login": "string", - "auto_groups": [ - "string" - ], - "is_current": "boolean", - "is_service_user": "boolean", - "is_blocked": "boolean", - "issued": "string" + "$ref": "#/components/schemas/User" } ``` @@ -527,28 +406,7 @@ echo $response; The unique identifier of a user - - #### Request-Body Parameters - - - - User's NetBird account role - - - - - Group IDs to auto-assign to peers registered by this user - - - - - If set to true then user is blocked and can't use the system - - - - - - + @@ -558,22 +416,14 @@ curl -X PUT https://api.netbird.io/api/users/{userId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false + "$ref": "#/components/schemas/UserRequest" }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false + "$ref": "#/components/schemas/UserRequest" }); let config = { method: 'put', @@ -602,11 +452,7 @@ import json url = "https://api.netbird.io/api/users/{userId}" payload = json.dumps({ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false + "$ref": "#/components/schemas/UserRequest" }) headers: { 'Content-Type': 'application/json', @@ -635,11 +481,7 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false + "$ref": "#/components/schemas/UserRequest" }`) client := &http.Client { } @@ -686,11 +528,7 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false + "$ref": "#/components/schemas/UserRequest" }) response = https.request(request) puts response.read_body @@ -701,11 +539,7 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false + "$ref": "#/components/schemas/UserRequest" }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/users/{userId}") @@ -732,11 +566,7 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "role": "admin", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_blocked": false + "$ref": "#/components/schemas/UserRequest" }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -757,36 +587,12 @@ echo $response; ```json {{ title: 'Example' }} { - "id": "google-oauth2|277474792786460067937", - "email": "demo@netbird.io", - "name": "Tom Schulz", - "role": "admin", - "status": "active", - "last_login": "2023-05-05T09:00:35.477782Z", - "auto_groups": [ - "ch8i4ug6lnn4g9hqv7m0" - ], - "is_current": true, - "is_service_user": false, - "is_blocked": false, - "issued": "api" + "$ref": "#/components/schemas/User" } ``` ```json {{ title: 'Schema' }} { - "id": "string", - "email": "string", - "name": "string", - "role": "string", - "status": "string", - "last_login": "string", - "auto_groups": [ - "string" - ], - "is_current": "boolean", - "is_service_user": "boolean", - "is_blocked": "boolean", - "issued": "string" + "$ref": "#/components/schemas/User" } ```