diff --git a/.github/workflows/generate_api_pages.yml b/.github/workflows/generate_api_pages.yml index dbfab526..39b551f5 100644 --- a/.github/workflows/generate_api_pages.yml +++ b/.github/workflows/generate_api_pages.yml @@ -19,42 +19,42 @@ jobs: input_string: ${{ github.event.inputs.tag }} version_extractor_regex: '\/v(.*)$' - - uses: actions/checkout@v2 - with: - token: ${{ secrets.DEV_GITHUB_TOKEN }} - - - name: Install swagger-codegen - run: brew install swagger-codegen - - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - - - name: Npm install - run: npm install - - - name: Generate api pages for netbird main openapi definition - run: | - swagger-codegen generate -i https://raw.githubusercontent.com/netbirdio/netbird/v${{ steps.semver_parser.outputs.fullversion }}/management/server/http/api/openapi.yml -l openapi -o generator/openapi - npx ts-node generator/index.ts gen --input generator/openapi/openapi.json --output src/pages/ipa/resources - - - name: Check git diff and send to output - id: git_diff - run: | - if git --no-pager diff --exit-code; then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" - fi - - - name: Commit and push changes - if: steps.git_diff.outputs.changed == 'true' - run: | - git config --global user.email "dev@netbird.io" - git config --global user.name "netbirddev" - - git add -A - git commit -m "Update API pages with v${{ steps.semver_parser.outputs.fullversion }}" - git push +# - uses: actions/checkout@v2 +# with: +# token: ${{ secrets.DEV_GITHUB_TOKEN }} +# +# - name: Install swagger-codegen +# run: brew install swagger-codegen +# +# - name: Set up JDK 11 +# uses: actions/setup-java@v2 +# with: +# java-version: '11' +# distribution: 'adopt' +# +# - name: Npm install +# run: npm install +# +# - name: Generate api pages for netbird main openapi definition +# run: | +# swagger-codegen generate -i https://raw.githubusercontent.com/netbirdio/netbird/v${{ steps.semver_parser.outputs.fullversion }}/management/server/http/api/openapi.yml -l openapi -o generator/openapi +# npx ts-node generator/index.ts gen --input generator/openapi/openapi.json --output src/pages/ipa/resources +# +# - name: Check git diff and send to output +# id: git_diff +# run: | +# if git --no-pager diff --exit-code; then +# echo "changed=false" >> "$GITHUB_OUTPUT" +# else +# echo "changed=true" >> "$GITHUB_OUTPUT" +# fi +# +# - name: Commit and push changes +# if: steps.git_diff.outputs.changed == 'true' +# run: | +# git config --global user.email "dev@netbird.io" +# git config --global user.name "netbirddev" +# +# git add -A +# git commit -m "Update API pages with v${{ steps.semver_parser.outputs.fullversion }}" +# git push diff --git a/src/pages/ipa/resources/accounts.mdx b/src/pages/ipa/resources/accounts.mdx index 201068e4..8bce1721 100644 --- a/src/pages/ipa/resources/accounts.mdx +++ b/src/pages/ipa/resources/accounts.mdx @@ -160,229 +160,44 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/Account" +[ + { + "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 + } + } } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/Account" +[ + { + "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" + } + } } -} -``` - - - - - - ---- - - -## Update an Account {{ tag: 'PUT' , label: '/api/accounts/{accountId}' }} - - - - Update information about an account - - #### Path Parameters - - - - The unique identifier of an account - - - - - - -```bash {{ title: 'cURL' }} -curl -X PUT https://api.netbird.io/api/accounts/{accountId} \ --H 'Accept: application/json' \ --H 'Content-Type: application/json' \ --H 'Authorization: Token ' \ ---data-raw '{ - "$ref": "#/components/schemas/AccountRequest" -}' -``` - -```js -const axios = require('axios'); -let data = JSON.stringify({ - "$ref": "#/components/schemas/AccountRequest" -}); -let config = { - method: 'put', - maxBodyLength: Infinity, - url: '/api/accounts/{accountId}', - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json', - 'Authorization': 'Token ' - }, - data : data -}; - -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}" -payload = json.dumps({ - "$ref": "#/components/schemas/AccountRequest" -}) -headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json', - 'Authorization': 'Token ' -} - -response = requests.request("PUT", url, headers=headers, data=payload) - -print(response.text) -``` - -```go -package main - -import ( - "fmt" - "strings" - "net/http" - "io/ioutil" -) - -func main() { - - url := "https://api.netbird.io/api/accounts/{accountId}" - method := "PUT" - - payload := strings.NewReader(`{ - "$ref": "#/components/schemas/AccountRequest" -}`) - client := &http.Client { - } - req, err := http.NewRequest(method, url, payload) - - if err != nil { - fmt.Println(err) - return - { - - req.Header.Add("Content-Type", "application/json") - req.Header.Add("Accept", "application/json") - 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::Put.new(url) -request["Content-Type"] = "application/json" -request["Accept"] = "application/json" -request["Authorization"] = "Token " - -request.body = JSON.dump({ - "$ref": "#/components/schemas/AccountRequest" -}) -response = https.request(request) -puts response.read_body -``` - -```java -OkHttpClient client = new OkHttpClient().newBuilder() - .build(); -MediaType mediaType = MediaType.parse("application/json"); -RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/AccountRequest" -}'); -Request request = new Request.Builder() - .url("https://api.netbird.io/api/accounts/{accountId}") - .method("PUT", body) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .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 => 'PUT', - CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/AccountRequest" -}', - CURLOPT_HTTPHEADER => array( - 'Content-Type: application/json', - 'Accept: application/json', - 'Authorization: Token ' - ), -)); - -$response = curl_exec($curl); - -curl_close($curl); -echo $response; -``` - - - - - -```json {{ title: 'Example' }} -{ - "$ref": "#/components/schemas/Account" -} -``` -```json {{ title: 'Schema' }} -{ - "$ref": "#/components/schemas/Account" -} +] ``` @@ -555,3 +370,389 @@ echo $response; --- + + +## Update an Account {{ tag: 'PUT' , label: '/api/accounts/{accountId}' }} + + + + Update information about an account + + #### Path Parameters + + + + 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. + + + + + +
+ +
+
+ +
+
+ +
+
+ + + + + + +```bash {{ title: 'cURL' }} +curl -X PUT https://api.netbird.io/api/accounts/{accountId} \ +-H 'Accept: application/json' \ +-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 + } + } +}' +``` + +```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 + } + } +}); +let config = { + method: 'put', + maxBodyLength: Infinity, + url: '/api/accounts/{accountId}', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'Authorization': 'Token ' + }, + data : data +}; + +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}" +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 + } + } +}) +headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + 'Authorization': 'Token ' +} + +response = requests.request("PUT", url, headers=headers, data=payload) + +print(response.text) +``` + +```go +package main + +import ( + "fmt" + "strings" + "net/http" + "io/ioutil" +) + +func main() { + + url := "https://api.netbird.io/api/accounts/{accountId}" + 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 + } + } +}`) + client := &http.Client { + } + req, err := http.NewRequest(method, url, payload) + + if err != nil { + fmt.Println(err) + return + { + + req.Header.Add("Content-Type", "application/json") + req.Header.Add("Accept", "application/json") + 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::Put.new(url) +request["Content-Type"] = "application/json" +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 + } + } +}) +response = https.request(request) +puts response.read_body +``` + +```java +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 + } + } +}'); +Request request = new Request.Builder() + .url("https://api.netbird.io/api/accounts/{accountId}") + .method("PUT", body) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .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 => '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 + } + } +}', + CURLOPT_HTTPHEADER => array( + 'Content-Type: application/json', + 'Accept: application/json', + 'Authorization: Token ' + ), +)); + +$response = curl_exec($curl); + +curl_close($curl); +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 + } + } +} +``` +```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" + } + } +} +``` + + + + +
+ +--- diff --git a/src/pages/ipa/resources/dns.mdx b/src/pages/ipa/resources/dns.mdx index 41164ec6..c353af76 100644 --- a/src/pages/ipa/resources/dns.mdx +++ b/src/pages/ipa/resources/dns.mdx @@ -160,18 +160,54 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/NameserverGroup" +[ + { + "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 } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/NameserverGroup" +[ + { + "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" } -} +] ``` @@ -187,7 +223,75 @@ 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. + + +
+ + + @@ -197,14 +301,48 @@ curl -X POST https://api.netbird.io/api/dns/nameservers \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }); let config = { method: 'post', @@ -233,7 +371,24 @@ import json url = "https://api.netbird.io/api/dns/nameservers" payload = json.dumps({ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }) headers: { 'Content-Type': 'application/json', @@ -262,7 +417,24 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }`) client := &http.Client { } @@ -309,7 +481,24 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }) response = https.request(request) puts response.read_body @@ -320,7 +509,24 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers") @@ -347,7 +553,24 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -368,12 +591,48 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/NameserverGroup" + "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 } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/NameserverGroup" + "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" } ``` @@ -552,12 +811,48 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/NameserverGroup" + "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 } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/NameserverGroup" + "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" } ``` @@ -582,7 +877,75 @@ 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. + + +
+ + + @@ -592,14 +955,48 @@ curl -X PUT https://api.netbird.io/api/dns/nameservers/{nsgroupId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }); let config = { method: 'put', @@ -628,7 +1025,24 @@ import json url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" payload = json.dumps({ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }) headers: { 'Content-Type': 'application/json', @@ -657,7 +1071,24 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }`) client := &http.Client { } @@ -704,7 +1135,24 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }) response = https.request(request) puts response.read_body @@ -715,7 +1163,24 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/nameservers/{nsgroupId}") @@ -742,7 +1207,24 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/NameserverGroupRequest" + "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 }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -763,12 +1245,48 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/NameserverGroup" + "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 } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/NameserverGroup" + "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" } ``` @@ -1104,14 +1622,18 @@ echo $response; ```json {{ title: 'Example' }} { "items": { - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] } } ``` ```json {{ title: 'Schema' }} { "items": { - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "string" + ] } } ``` @@ -1129,7 +1651,18 @@ echo $response; Updates a DNS settings object - + + #### Request-Body Parameters + + + + Groups whose DNS management is disabled + + + + + + @@ -1139,14 +1672,18 @@ curl -X PUT https://api.netbird.io/api/dns/settings \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }); let config = { method: 'put', @@ -1175,7 +1712,9 @@ import json url = "https://api.netbird.io/api/dns/settings" payload = json.dumps({ - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }) headers: { 'Content-Type': 'application/json', @@ -1204,7 +1743,9 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }`) client := &http.Client { } @@ -1251,7 +1792,9 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }) response = https.request(request) puts response.read_body @@ -1262,7 +1805,9 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/dns/settings") @@ -1289,7 +1834,9 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -1310,12 +1857,16 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/DNSSettings" + "disabled_management_groups": [ + "string" + ] } ``` diff --git a/src/pages/ipa/resources/events.mdx b/src/pages/ipa/resources/events.mdx index 902a9681..a2e56060 100644 --- a/src/pages/ipa/resources/events.mdx +++ b/src/pages/ipa/resources/events.mdx @@ -160,18 +160,47 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/Event" +[ + { + "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" + } } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/Event" +[ + { + "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" + } + } } -} +] ``` diff --git a/src/pages/ipa/resources/geo-locations.mdx b/src/pages/ipa/resources/geo-locations.mdx index 8d9a9156..55f87617 100644 --- a/src/pages/ipa/resources/geo-locations.mdx +++ b/src/pages/ipa/resources/geo-locations.mdx @@ -160,16 +160,14 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": "DE" -} +[ + "DE" +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "example": "DE" - } -} +[ + "string" +] ``` @@ -347,12 +345,14 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/City" + "geoname_id": 2950158, + "city_name": "Berlin" } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/City" + "geoname_id": "integer", + "city_name": "string" } ``` diff --git a/src/pages/ipa/resources/groups.mdx b/src/pages/ipa/resources/groups.mdx index a7aaf1a5..bc120109 100644 --- a/src/pages/ipa/resources/groups.mdx +++ b/src/pages/ipa/resources/groups.mdx @@ -160,18 +160,36 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/Group" +[ + { + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "devs", + "peers_count": 2, + "issued": "api", + "peers": [ + { + "id": "chacbco6lnnbn6cg5s90", + "name": "stage-host-1" + } + ] } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/Group" +[ + { + "id": "string", + "name": "string", + "peers_count": "integer", + "issued": "string", + "peers": [ + { + "id": "string", + "name": "string" + } + ] } -} +] ``` @@ -187,7 +205,23 @@ echo $response; Creates a group - + + #### Request-Body Parameters + + + + Group name identifier + + + + + List of peers ids + + + + + + @@ -197,14 +231,20 @@ curl -X POST https://api.netbird.io/api/groups \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }); let config = { method: 'post', @@ -233,7 +273,10 @@ import json url = "https://api.netbird.io/api/groups" payload = json.dumps({ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }) headers: { 'Content-Type': 'application/json', @@ -262,7 +305,10 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }`) client := &http.Client { } @@ -309,7 +355,10 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }) response = https.request(request) puts response.read_body @@ -320,7 +369,10 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/groups") @@ -347,7 +399,10 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -368,12 +423,30 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Group" + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "devs", + "peers_count": 2, + "issued": "api", + "peers": [ + { + "id": "chacbco6lnnbn6cg5s90", + "name": "stage-host-1" + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Group" + "id": "string", + "name": "string", + "peers_count": "integer", + "issued": "string", + "peers": [ + { + "id": "string", + "name": "string" + } + ] } ``` @@ -552,12 +625,30 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Group" + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "devs", + "peers_count": 2, + "issued": "api", + "peers": [ + { + "id": "chacbco6lnnbn6cg5s90", + "name": "stage-host-1" + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Group" + "id": "string", + "name": "string", + "peers_count": "integer", + "issued": "string", + "peers": [ + { + "id": "string", + "name": "string" + } + ] } ``` @@ -582,7 +673,23 @@ echo $response; The unique identifier of a group - + + #### Request-Body Parameters + + + + Group name identifier + + + + + List of peers ids + + + + + + @@ -592,14 +699,20 @@ curl -X PUT https://api.netbird.io/api/groups/{groupId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }); let config = { method: 'put', @@ -628,7 +741,10 @@ import json url = "https://api.netbird.io/api/groups/{groupId}" payload = json.dumps({ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }) headers: { 'Content-Type': 'application/json', @@ -657,7 +773,10 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }`) client := &http.Client { } @@ -704,7 +823,10 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }) response = https.request(request) puts response.read_body @@ -715,7 +837,10 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/groups/{groupId}") @@ -742,7 +867,10 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/GroupRequest" + "name": "devs", + "peers": [ + "ch8i4ug6lnn4g9hqv7m1" + ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -763,12 +891,30 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Group" + "id": "ch8i4ug6lnn4g9hqv7m0", + "name": "devs", + "peers_count": 2, + "issued": "api", + "peers": [ + { + "id": "chacbco6lnnbn6cg5s90", + "name": "stage-host-1" + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Group" + "id": "string", + "name": "string", + "peers_count": "integer", + "issued": "string", + "peers": [ + { + "id": "string", + "name": "string" + } + ] } ``` diff --git a/src/pages/ipa/resources/peers.mdx b/src/pages/ipa/resources/peers.mdx index 9a89c398..c7375357 100644 --- a/src/pages/ipa/resources/peers.mdx +++ b/src/pages/ipa/resources/peers.mdx @@ -160,18 +160,76 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/PeerBatch" +[ + { + "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 } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/PeerBatch" +[ + { + "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" } -} +] ``` @@ -349,12 +407,86 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Peer" + "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" + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Peer" + "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" + } + ] } ``` @@ -379,7 +511,33 @@ echo $response; The unique identifier of a peer - + + #### Request-Body Parameters + + + + + + + + + + + + + + + + + + + (Cloud only) Indicates whether peer needs approval + + + + + + @@ -389,14 +547,20 @@ curl -X PUT https://api.netbird.io/api/peers/{peerId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/PeerRequest" + "name": "stage-host-1", + "ssh_enabled": true, + "login_expiration_enabled": false, + "approval_required": true }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/PeerRequest" + "name": "stage-host-1", + "ssh_enabled": true, + "login_expiration_enabled": false, + "approval_required": true }); let config = { method: 'put', @@ -425,7 +589,10 @@ import json url = "https://api.netbird.io/api/peers/{peerId}" payload = json.dumps({ - "$ref": "#/components/schemas/PeerRequest" + "name": "stage-host-1", + "ssh_enabled": true, + "login_expiration_enabled": false, + "approval_required": true }) headers: { 'Content-Type': 'application/json', @@ -454,7 +621,10 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/PeerRequest" + "name": "stage-host-1", + "ssh_enabled": true, + "login_expiration_enabled": false, + "approval_required": true }`) client := &http.Client { } @@ -501,7 +671,10 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/PeerRequest" + "name": "stage-host-1", + "ssh_enabled": true, + "login_expiration_enabled": false, + "approval_required": true }) response = https.request(request) puts response.read_body @@ -512,7 +685,10 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/PeerRequest" + "name": "stage-host-1", + "ssh_enabled": true, + "login_expiration_enabled": false, + "approval_required": true }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/peers/{peerId}") @@ -539,7 +715,10 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/PeerRequest" + "name": "stage-host-1", + "ssh_enabled": true, + "login_expiration_enabled": false, + "approval_required": true }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -560,12 +739,86 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Peer" + "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" + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Peer" + "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" + } + ] } ``` diff --git a/src/pages/ipa/resources/policies.mdx b/src/pages/ipa/resources/policies.mdx index b79b1ab7..1e2e2f7f 100644 --- a/src/pages/ipa/resources/policies.mdx +++ b/src/pages/ipa/resources/policies.mdx @@ -160,18 +160,90 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/Policy" +[ + { + "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" + } + ] + } + ] } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/Policy" +[ + { + "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" + } + ] + } + ] } -} +] ``` @@ -187,7 +259,100 @@ 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 + + + + + +
+ +
+
+ + + @@ -197,14 +362,66 @@ curl -X POST https://api.netbird.io/api/policies \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }); let config = { method: 'post', @@ -233,7 +450,33 @@ import json url = "https://api.netbird.io/api/policies" payload = json.dumps({ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }) headers: { 'Content-Type': 'application/json', @@ -262,7 +505,33 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }`) client := &http.Client { } @@ -309,7 +578,33 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }) response = https.request(request) puts response.read_body @@ -320,7 +615,33 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/policies") @@ -347,7 +668,33 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -368,12 +715,84 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Policy" + "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" + } + ] + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Policy" + "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" + } + ] + } + ] } ``` @@ -552,12 +971,84 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Policy" + "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" + } + ] + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Policy" + "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" + } + ] + } + ] } ``` @@ -582,7 +1073,100 @@ 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 + + + + + +
+ +
+
+ + + @@ -592,14 +1176,66 @@ curl -X PUT https://api.netbird.io/api/policies/{policyId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }); let config = { method: 'put', @@ -628,7 +1264,33 @@ import json url = "https://api.netbird.io/api/policies/{policyId}" payload = json.dumps({ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }) headers: { 'Content-Type': 'application/json', @@ -657,7 +1319,33 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }`) client := &http.Client { } @@ -704,7 +1392,33 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }) response = https.request(request) puts response.read_body @@ -715,7 +1429,33 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/policies/{policyId}") @@ -742,7 +1482,33 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/PolicyUpdate" + "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" + ] + } + ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -763,12 +1529,84 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Policy" + "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" + } + ] + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Policy" + "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" + } + ] + } + ] } ``` diff --git a/src/pages/ipa/resources/posture-checks.mdx b/src/pages/ipa/resources/posture-checks.mdx index 01f50066..fe8df0de 100644 --- a/src/pages/ipa/resources/posture-checks.mdx +++ b/src/pages/ipa/resources/posture-checks.mdx @@ -160,18 +160,100 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/PostureCheck" +[ + { + "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" + } + } } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/PostureCheck" +[ + { + "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" + } + } } -} +] ``` @@ -187,7 +269,210 @@ echo $response; 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 + + + + + +
+ +
+
+ +
+
+ +
+
+ + + @@ -197,14 +482,98 @@ curl -X POST https://api.netbird.io/api/posture-checks \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }); let config = { method: 'post', @@ -233,7 +602,49 @@ import json url = "https://api.netbird.io/api/posture-checks" payload = json.dumps({ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }) headers: { 'Content-Type': 'application/json', @@ -262,7 +673,49 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }`) client := &http.Client { } @@ -309,7 +762,49 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }) response = https.request(request) puts response.read_body @@ -320,7 +815,49 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/posture-checks") @@ -347,7 +884,49 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -368,12 +947,94 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/PostureCheck" + "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" + } + } } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/PostureCheck" + "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" + } + } } ``` @@ -552,12 +1213,94 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/PostureCheck" + "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" + } + } } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/PostureCheck" + "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" + } + } } ``` @@ -582,7 +1325,210 @@ 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 + + + + + +
+ +
+
+ +
+
+ +
+
+ + + @@ -592,14 +1538,98 @@ curl -X PUT https://api.netbird.io/api/posture-checks/{postureCheckId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }); let config = { method: 'put', @@ -628,7 +1658,49 @@ import json url = "https://api.netbird.io/api/posture-checks/{postureCheckId}" payload = json.dumps({ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }) headers: { 'Content-Type': 'application/json', @@ -657,7 +1729,49 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }`) client := &http.Client { } @@ -704,7 +1818,49 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }) response = https.request(request) puts response.read_body @@ -715,7 +1871,49 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/posture-checks/{postureCheckId}") @@ -742,7 +1940,49 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/PostureCheckUpdate" + "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" + } + } }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -763,12 +2003,94 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/PostureCheck" + "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" + } + } } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/PostureCheck" + "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" + } + } } ``` diff --git a/src/pages/ipa/resources/routes.mdx b/src/pages/ipa/resources/routes.mdx index cacc0b20..79f28a13 100644 --- a/src/pages/ipa/resources/routes.mdx +++ b/src/pages/ipa/resources/routes.mdx @@ -160,18 +160,46 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/Route" +[ + { + "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" + ] } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/Route" +[ + { + "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" + ] } -} +] ``` @@ -187,7 +215,58 @@ 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 + + + + + + @@ -197,14 +276,38 @@ curl -X POST https://api.netbird.io/api/routes \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }); let config = { method: 'post', @@ -233,7 +336,19 @@ import json url = "https://api.netbird.io/api/routes" payload = json.dumps({ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }) headers: { 'Content-Type': 'application/json', @@ -262,7 +377,19 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }`) client := &http.Client { } @@ -309,7 +436,19 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }) response = https.request(request) puts response.read_body @@ -320,7 +459,19 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/routes") @@ -347,7 +498,19 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -368,12 +531,40 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Route" + "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" + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Route" + "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" + ] } ``` @@ -552,12 +743,40 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Route" + "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" + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Route" + "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" + ] } ``` @@ -582,7 +801,58 @@ 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 + + + + + + @@ -592,14 +862,38 @@ curl -X PUT https://api.netbird.io/api/routes/{routeId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }); let config = { method: 'put', @@ -628,7 +922,19 @@ import json url = "https://api.netbird.io/api/routes/{routeId}" payload = json.dumps({ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }) headers: { 'Content-Type': 'application/json', @@ -657,7 +963,19 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }`) client := &http.Client { } @@ -704,7 +1022,19 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }) response = https.request(request) puts response.read_body @@ -715,7 +1045,19 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/routes/{routeId}") @@ -742,7 +1084,19 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/RouteRequest" + "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" + ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -763,12 +1117,40 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Route" + "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" + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Route" + "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" + ] } ``` diff --git a/src/pages/ipa/resources/rules.mdx b/src/pages/ipa/resources/rules.mdx index ab300081..86094baa 100644 --- a/src/pages/ipa/resources/rules.mdx +++ b/src/pages/ipa/resources/rules.mdx @@ -160,18 +160,58 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/Rule" +[ + { + "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" + } + ] } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/Rule" +[ + { + "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" + } + ] } -} +] ``` @@ -187,7 +227,43 @@ 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 + + + + + + @@ -197,14 +273,32 @@ curl -X POST https://api.netbird.io/api/rules \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }); let config = { method: 'post', @@ -233,7 +327,16 @@ import json url = "https://api.netbird.io/api/rules" payload = json.dumps({ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }) headers: { 'Content-Type': 'application/json', @@ -262,7 +365,16 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }`) client := &http.Client { } @@ -309,7 +421,16 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }) response = https.request(request) puts response.read_body @@ -320,7 +441,16 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/rules") @@ -347,7 +477,16 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -368,12 +507,52 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Rule" + "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" + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Rule" + "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" + } + ] } ``` @@ -552,12 +731,52 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Rule" + "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" + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Rule" + "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" + } + ] } ``` @@ -582,7 +801,43 @@ 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 + + + + + + @@ -592,14 +847,32 @@ curl -X PUT https://api.netbird.io/api/rules/{ruleId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }); let config = { method: 'put', @@ -628,7 +901,16 @@ import json url = "https://api.netbird.io/api/rules/{ruleId}" payload = json.dumps({ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }) headers: { 'Content-Type': 'application/json', @@ -657,7 +939,16 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }`) client := &http.Client { } @@ -704,7 +995,16 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }) response = https.request(request) puts response.read_body @@ -715,7 +1015,16 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/rules/{ruleId}") @@ -742,7 +1051,16 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/RuleRequest" + "name": "Default", + "description": "This is a default rule that allows connections between all the resources", + "disabled": false, + "flow": "bidirect", + "sources": [ + "ch8i4ug6lnn4g9hqv7m1" + ], + "destinations": [ + "ch8i4ug6lnn4g9hqv7m0" + ] }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -763,12 +1081,52 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/Rule" + "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" + } + ] } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/Rule" + "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" + } + ] } ``` diff --git a/src/pages/ipa/resources/setup-keys.mdx b/src/pages/ipa/resources/setup-keys.mdx index 9e73a38e..59c8ed9e 100644 --- a/src/pages/ipa/resources/setup-keys.mdx +++ b/src/pages/ipa/resources/setup-keys.mdx @@ -160,18 +160,48 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/SetupKey" +[ + { + "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 } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/SetupKey" +[ + { + "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" } -} +] ``` @@ -187,7 +217,48 @@ 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 + + + + + + @@ -197,14 +268,30 @@ curl -X POST https://api.netbird.io/api/setup-keys \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }); let config = { method: 'post', @@ -233,7 +320,15 @@ import json url = "https://api.netbird.io/api/setup-keys" payload = json.dumps({ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }) headers: { 'Content-Type': 'application/json', @@ -262,7 +357,15 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }`) client := &http.Client { } @@ -309,7 +412,15 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }) response = https.request(request) puts response.read_body @@ -320,7 +431,15 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/setup-keys") @@ -347,7 +466,15 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -368,12 +495,42 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/SetupKey" + "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 } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/SetupKey" + "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" } ``` @@ -552,12 +709,42 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/SetupKey" + "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 } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/SetupKey" + "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" } ``` @@ -582,7 +769,48 @@ 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 + + + + + + @@ -592,14 +820,30 @@ curl -X PUT https://api.netbird.io/api/setup-keys/{keyId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }); let config = { method: 'put', @@ -628,7 +872,15 @@ import json url = "https://api.netbird.io/api/setup-keys/{keyId}" payload = json.dumps({ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }) headers: { 'Content-Type': 'application/json', @@ -657,7 +909,15 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }`) client := &http.Client { } @@ -704,7 +964,15 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }) response = https.request(request) puts response.read_body @@ -715,7 +983,15 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/setup-keys/{keyId}") @@ -742,7 +1018,15 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/SetupKeyRequest" + "name": "Default key", + "type": "reusable", + "expires_in": 86400, + "revoked": false, + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "usage_limit": 0, + "ephemeral": true }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -763,12 +1047,42 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/SetupKey" + "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 } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/SetupKey" + "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" } ``` diff --git a/src/pages/ipa/resources/tokens.mdx b/src/pages/ipa/resources/tokens.mdx index 1a0a30a0..e065aff0 100644 --- a/src/pages/ipa/resources/tokens.mdx +++ b/src/pages/ipa/resources/tokens.mdx @@ -168,18 +168,28 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/PersonalAccessToken" +[ + { + "id": "ch8i54g6lnn4g9hqv7n0", + "name": "My first token", + "expiration_date": "2023-05-05T14:38:28.977616Z", + "created_by": "google-oauth2|277474792786460067937", + "created_at": "2023-05-02T14:48:20.465209Z", + "last_used": "2023-05-04T12:45:25.9723616Z" } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/PersonalAccessToken" +[ + { + "id": "string", + "name": "string", + "expiration_date": "string", + "created_by": "string", + "created_at": "string", + "last_used": "string" } -} +] ``` @@ -203,7 +213,23 @@ echo $response; The unique identifier of a user - + + #### Request-Body Parameters + + + + Name of the token + + + + + Expiration in days + + + + + + @@ -213,14 +239,16 @@ curl -X POST https://api.netbird.io/api/users/{userId}/tokens \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/PersonalAccessTokenRequest" + "name": "My first token", + "expires_in": 30 }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/PersonalAccessTokenRequest" + "name": "My first token", + "expires_in": 30 }); let config = { method: 'post', @@ -249,7 +277,8 @@ import json url = "https://api.netbird.io/api/users/{userId}/tokens" payload = json.dumps({ - "$ref": "#/components/schemas/PersonalAccessTokenRequest" + "name": "My first token", + "expires_in": 30 }) headers: { 'Content-Type': 'application/json', @@ -278,7 +307,8 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/PersonalAccessTokenRequest" + "name": "My first token", + "expires_in": 30 }`) client := &http.Client { } @@ -325,7 +355,8 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/PersonalAccessTokenRequest" + "name": "My first token", + "expires_in": 30 }) response = https.request(request) puts response.read_body @@ -336,7 +367,8 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/PersonalAccessTokenRequest" + "name": "My first token", + "expires_in": 30 }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/users/{userId}/tokens") @@ -363,7 +395,8 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/PersonalAccessTokenRequest" + "name": "My first token", + "expires_in": 30 }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -384,12 +417,28 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/PersonalAccessTokenGenerated" + "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" + } } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/PersonalAccessTokenGenerated" + "plain_token": "string", + "personal_access_token": { + "id": "string", + "name": "string", + "expiration_date": "string", + "created_by": "string", + "created_at": "string", + "last_used": "string" + } } ``` @@ -572,12 +621,22 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/PersonalAccessToken" + "id": "ch8i54g6lnn4g9hqv7n0", + "name": "My first token", + "expiration_date": "2023-05-05T14:38:28.977616Z", + "created_by": "google-oauth2|277474792786460067937", + "created_at": "2023-05-02T14:48:20.465209Z", + "last_used": "2023-05-04T12:45:25.9723616Z" } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/PersonalAccessToken" + "id": "string", + "name": "string", + "expiration_date": "string", + "created_by": "string", + "created_at": "string", + "last_used": "string" } ``` diff --git a/src/pages/ipa/resources/users.mdx b/src/pages/ipa/resources/users.mdx index 8b366004..08dafc4c 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,18 +168,42 @@ echo $response; ```json {{ title: 'Example' }} -{ - "items": { - "$ref": "#/components/schemas/User" +[ + { + "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" } -} +] ``` ```json {{ title: 'Schema' }} -{ - "items": { - "$ref": "#/components/schemas/User" +[ + { + "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" } -} +] ``` @@ -195,7 +219,38 @@ 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 + + + + + + @@ -205,14 +260,26 @@ curl -X POST https://api.netbird.io/api/users \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/UserCreateRequest" + "email": "demo@netbird.io", + "name": "Tom Schulz", + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_service_user": false }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/UserCreateRequest" + "email": "demo@netbird.io", + "name": "Tom Schulz", + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_service_user": false }); let config = { method: 'post', @@ -241,7 +308,13 @@ import json url = "https://api.netbird.io/api/users" payload = json.dumps({ - "$ref": "#/components/schemas/UserCreateRequest" + "email": "demo@netbird.io", + "name": "Tom Schulz", + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_service_user": false }) headers: { 'Content-Type': 'application/json', @@ -270,7 +343,13 @@ func main() { method := "POST" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/UserCreateRequest" + "email": "demo@netbird.io", + "name": "Tom Schulz", + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_service_user": false }`) client := &http.Client { } @@ -317,7 +396,13 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/UserCreateRequest" + "email": "demo@netbird.io", + "name": "Tom Schulz", + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_service_user": false }) response = https.request(request) puts response.read_body @@ -328,7 +413,13 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/UserCreateRequest" + "email": "demo@netbird.io", + "name": "Tom Schulz", + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_service_user": false }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/users") @@ -355,7 +446,13 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/UserCreateRequest" + "email": "demo@netbird.io", + "name": "Tom Schulz", + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_service_user": false }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -376,12 +473,36 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/User" + "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" } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/User" + "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" } ``` @@ -406,7 +527,28 @@ 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 + + + + + + @@ -416,14 +558,22 @@ curl -X PUT https://api.netbird.io/api/users/{userId} \ -H 'Content-Type: application/json' \ -H 'Authorization: Token ' \ --data-raw '{ - "$ref": "#/components/schemas/UserRequest" + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_blocked": false }' ``` ```js const axios = require('axios'); let data = JSON.stringify({ - "$ref": "#/components/schemas/UserRequest" + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_blocked": false }); let config = { method: 'put', @@ -452,7 +602,11 @@ import json url = "https://api.netbird.io/api/users/{userId}" payload = json.dumps({ - "$ref": "#/components/schemas/UserRequest" + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_blocked": false }) headers: { 'Content-Type': 'application/json', @@ -481,7 +635,11 @@ func main() { method := "PUT" payload := strings.NewReader(`{ - "$ref": "#/components/schemas/UserRequest" + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_blocked": false }`) client := &http.Client { } @@ -528,7 +686,11 @@ request["Accept"] = "application/json" request["Authorization"] = "Token " request.body = JSON.dump({ - "$ref": "#/components/schemas/UserRequest" + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_blocked": false }) response = https.request(request) puts response.read_body @@ -539,7 +701,11 @@ OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, '{ - "$ref": "#/components/schemas/UserRequest" + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_blocked": false }'); Request request = new Request.Builder() .url("https://api.netbird.io/api/users/{userId}") @@ -566,7 +732,11 @@ curl_setopt_array($curl, array( CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => '{ - "$ref": "#/components/schemas/UserRequest" + "role": "admin", + "auto_groups": [ + "ch8i4ug6lnn4g9hqv7m0" + ], + "is_blocked": false }', CURLOPT_HTTPHEADER => array( 'Content-Type: application/json', @@ -587,12 +757,36 @@ echo $response; ```json {{ title: 'Example' }} { - "$ref": "#/components/schemas/User" + "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" } ``` ```json {{ title: 'Schema' }} { - "$ref": "#/components/schemas/User" + "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" } ```