diff --git a/.github/workflows/generate_api_pages.yml b/.github/workflows/generate_api_pages.yml index 39b551f5..3efae213 100644 --- a/.github/workflows/generate_api_pages.yml +++ b/.github/workflows/generate_api_pages.yml @@ -19,42 +19,48 @@ 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: Create directory + run: mkdir -p generator/openapi + + - name: Download openapi.yml + run: curl -L -o generator/openapi/openapi.yml "https://raw.githubusercontent.com/netbirdio/netbird/v${{ steps.semver_parser.outputs.fullversion }}/management/server/http/api/openapi.yml" + + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: '1.21.1' + + - name: Build Go project + run: (cd ./generator && go build -o expandOpenAPIRef) + + - name: Expand openapi.yml + run: (cd ./generator && ./expandOpenAPIRef) + + - name: Npm install + run: npm install + + - name: Generate api pages for netbird main openapi definition + run: npx ts-node generator/index.ts gen --input generator/openapi/expanded.yml --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/.gitignore b/.gitignore index 1ba65dec..8b1254a5 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ package-lock.json /yarn.lock /generator/openapi/ /generator/openapi.yml +/generator/expandOpenAPIRef diff --git a/src/pages/ipa/resources/accounts.mdx b/src/pages/ipa/resources/accounts.mdx index 8bce1721..03f91db7 100644 --- a/src/pages/ipa/resources/accounts.mdx +++ b/src/pages/ipa/resources/accounts.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/accounts" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -166,6 +166,7 @@ echo $response; "settings": { "peer_login_expiration_enabled": true, "peer_login_expiration": 43200, + "regular_users_view_blocked": true, "groups_propagation_enabled": true, "jwt_groups_enabled": true, "jwt_groups_claim_name": "roles", @@ -186,6 +187,7 @@ echo $response; "settings": { "peer_login_expiration_enabled": "boolean", "peer_login_expiration": "integer", + "regular_users_view_blocked": "boolean", "groups_propagation_enabled": "boolean", "jwt_groups_enabled": "boolean", "jwt_groups_claim_name": "string", @@ -212,7 +214,7 @@ echo $response; - Deletes an account and all its resources. Only administrators and account owners can delete accounts. + Deletes an account and all its resources. Only account owners can delete accounts. #### Path Parameters @@ -257,7 +259,7 @@ import json url = "https://api.netbird.io/api/accounts/{accountId}" -headers: { +headers = { 'Authorization': 'Token ' } @@ -403,6 +405,11 @@ echo $response; Period of time after which peer login expires (seconds). + + + + Allows blocking regular users from viewing parts of the system. + @@ -463,6 +470,7 @@ curl -X PUT https://api.netbird.io/api/accounts/{accountId} \ "settings": { "peer_login_expiration_enabled": true, "peer_login_expiration": 43200, + "regular_users_view_blocked": true, "groups_propagation_enabled": true, "jwt_groups_enabled": true, "jwt_groups_claim_name": "roles", @@ -482,6 +490,7 @@ let data = JSON.stringify({ "settings": { "peer_login_expiration_enabled": true, "peer_login_expiration": 43200, + "regular_users_view_blocked": true, "groups_propagation_enabled": true, "jwt_groups_enabled": true, "jwt_groups_claim_name": "roles", @@ -523,6 +532,7 @@ payload = json.dumps({ "settings": { "peer_login_expiration_enabled": true, "peer_login_expiration": 43200, + "regular_users_view_blocked": true, "groups_propagation_enabled": true, "jwt_groups_enabled": true, "jwt_groups_claim_name": "roles", @@ -534,7 +544,7 @@ payload = json.dumps({ } } }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -564,6 +574,7 @@ func main() { "settings": { "peer_login_expiration_enabled": true, "peer_login_expiration": 43200, + "regular_users_view_blocked": true, "groups_propagation_enabled": true, "jwt_groups_enabled": true, "jwt_groups_claim_name": "roles", @@ -623,6 +634,7 @@ request.body = JSON.dump({ "settings": { "peer_login_expiration_enabled": true, "peer_login_expiration": 43200, + "regular_users_view_blocked": true, "groups_propagation_enabled": true, "jwt_groups_enabled": true, "jwt_groups_claim_name": "roles", @@ -646,6 +658,7 @@ RequestBody body = RequestBody.create(mediaType, '{ "settings": { "peer_login_expiration_enabled": true, "peer_login_expiration": 43200, + "regular_users_view_blocked": true, "groups_propagation_enabled": true, "jwt_groups_enabled": true, "jwt_groups_claim_name": "roles", @@ -685,6 +698,7 @@ curl_setopt_array($curl, array( "settings": { "peer_login_expiration_enabled": true, "peer_login_expiration": 43200, + "regular_users_view_blocked": true, "groups_propagation_enabled": true, "jwt_groups_enabled": true, "jwt_groups_claim_name": "roles", @@ -719,6 +733,7 @@ echo $response; "settings": { "peer_login_expiration_enabled": true, "peer_login_expiration": 43200, + "regular_users_view_blocked": true, "groups_propagation_enabled": true, "jwt_groups_enabled": true, "jwt_groups_claim_name": "roles", @@ -737,6 +752,7 @@ echo $response; "settings": { "peer_login_expiration_enabled": "boolean", "peer_login_expiration": "integer", + "regular_users_view_blocked": "boolean", "groups_propagation_enabled": "boolean", "jwt_groups_enabled": "boolean", "jwt_groups_claim_name": "string", diff --git a/src/pages/ipa/resources/dns.mdx b/src/pages/ipa/resources/dns.mdx index c353af76..15d4c6ef 100644 --- a/src/pages/ipa/resources/dns.mdx +++ b/src/pages/ipa/resources/dns.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/dns/nameservers" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -390,7 +390,7 @@ payload = json.dumps({ ], "search_domains_enabled": true }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -695,7 +695,7 @@ import json url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -1044,7 +1044,7 @@ payload = json.dumps({ ], "search_domains_enabled": true }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -1347,7 +1347,7 @@ import json url = "https://api.netbird.io/api/dns/nameservers/{nsgroupId}" -headers: { +headers = { 'Authorization': 'Token ' } @@ -1505,7 +1505,7 @@ import json url = "https://api.netbird.io/api/dns/settings" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -1716,7 +1716,7 @@ payload = json.dumps({ "ch8i4ug6lnn4g9hqv7m0" ] }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' diff --git a/src/pages/ipa/resources/events.mdx b/src/pages/ipa/resources/events.mdx index a2e56060..72159ac5 100644 --- a/src/pages/ipa/resources/events.mdx +++ b/src/pages/ipa/resources/events.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/events" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } diff --git a/src/pages/ipa/resources/geo-locations.mdx b/src/pages/ipa/resources/geo-locations.mdx index 55f87617..07f6e0d4 100644 --- a/src/pages/ipa/resources/geo-locations.mdx +++ b/src/pages/ipa/resources/geo-locations.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/locations/countries" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -229,7 +229,7 @@ import json url = "https://api.netbird.io/api/locations/countries/{country}/cities" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } diff --git a/src/pages/ipa/resources/groups.mdx b/src/pages/ipa/resources/groups.mdx index bc120109..55f9a841 100644 --- a/src/pages/ipa/resources/groups.mdx +++ b/src/pages/ipa/resources/groups.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/groups" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -278,7 +278,7 @@ payload = json.dumps({ "ch8i4ug6lnn4g9hqv7m1" ] }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -509,7 +509,7 @@ import json url = "https://api.netbird.io/api/groups/{groupId}" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -746,7 +746,7 @@ payload = json.dumps({ "ch8i4ug6lnn4g9hqv7m1" ] }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -975,7 +975,7 @@ import json url = "https://api.netbird.io/api/groups/{groupId}" -headers: { +headers = { 'Authorization': 'Token ' } diff --git a/src/pages/ipa/resources/peers.mdx b/src/pages/ipa/resources/peers.mdx index c7375357..5e75ab58 100644 --- a/src/pages/ipa/resources/peers.mdx +++ b/src/pages/ipa/resources/peers.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/peers" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -191,6 +191,7 @@ echo $response; "approval_required": true, "country_code": "DE", "city_name": "Berlin", + "serial_number": "C02XJ0J0JGH7", "accessible_peers_count": 5 } ] @@ -227,6 +228,7 @@ echo $response; "approval_required": "boolean", "country_code": "string", "city_name": "string", + "serial_number": "string", "accessible_peers_count": "integer" } ] @@ -291,7 +293,7 @@ import json url = "https://api.netbird.io/api/peers/{peerId}" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -436,6 +438,7 @@ echo $response; "approval_required": true, "country_code": "DE", "city_name": "Berlin", + "serial_number": "C02XJ0J0JGH7", "accessible_peers": [ { "id": "chacbco6lnnbn6cg5s90", @@ -478,6 +481,7 @@ echo $response; "approval_required": "boolean", "country_code": "string", "city_name": "string", + "serial_number": "string", "accessible_peers": [ { "id": "string", @@ -594,7 +598,7 @@ payload = json.dumps({ "login_expiration_enabled": false, "approval_required": true }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -768,6 +772,7 @@ echo $response; "approval_required": true, "country_code": "DE", "city_name": "Berlin", + "serial_number": "C02XJ0J0JGH7", "accessible_peers": [ { "id": "chacbco6lnnbn6cg5s90", @@ -810,6 +815,7 @@ echo $response; "approval_required": "boolean", "country_code": "string", "city_name": "string", + "serial_number": "string", "accessible_peers": [ { "id": "string", @@ -879,7 +885,7 @@ import json url = "https://api.netbird.io/api/peers/{peerId}" -headers: { +headers = { 'Authorization': 'Token ' } diff --git a/src/pages/ipa/resources/policies.mdx b/src/pages/ipa/resources/policies.mdx index 1e2e2f7f..c5d6b003 100644 --- a/src/pages/ipa/resources/policies.mdx +++ b/src/pages/ipa/resources/policies.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/policies" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -478,7 +478,7 @@ payload = json.dumps({ } ] }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -855,7 +855,7 @@ import json url = "https://api.netbird.io/api/policies/{policyId}" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -1292,7 +1292,7 @@ payload = json.dumps({ } ] }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -1667,7 +1667,7 @@ import json url = "https://api.netbird.io/api/policies/{policyId}" -headers: { +headers = { 'Authorization': 'Token ' } diff --git a/src/pages/ipa/resources/posture-checks.mdx b/src/pages/ipa/resources/posture-checks.mdx index fe8df0de..e87f6962 100644 --- a/src/pages/ipa/resources/posture-checks.mdx +++ b/src/pages/ipa/resources/posture-checks.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/posture-checks" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -646,7 +646,7 @@ payload = json.dumps({ } } }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -1097,7 +1097,7 @@ import json url = "https://api.netbird.io/api/posture-checks/{postureCheckId}" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -1702,7 +1702,7 @@ payload = json.dumps({ } } }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -2151,7 +2151,7 @@ import json url = "https://api.netbird.io/api/posture-checks/{postureCheckId}" -headers: { +headers = { 'Authorization': 'Token ' } diff --git a/src/pages/ipa/resources/routes.mdx b/src/pages/ipa/resources/routes.mdx index 79f28a13..13b62941 100644 --- a/src/pages/ipa/resources/routes.mdx +++ b/src/pages/ipa/resources/routes.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/routes" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -350,7 +350,7 @@ payload = json.dumps({ "chacdk86lnnboviihd70" ] }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -627,7 +627,7 @@ import json url = "https://api.netbird.io/api/routes/{routeId}" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -936,7 +936,7 @@ payload = json.dumps({ "chacdk86lnnboviihd70" ] }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -1211,7 +1211,7 @@ import json url = "https://api.netbird.io/api/routes/{routeId}" -headers: { +headers = { 'Authorization': 'Token ' } diff --git a/src/pages/ipa/resources/setup-keys.mdx b/src/pages/ipa/resources/setup-keys.mdx index 59c8ed9e..fd005192 100644 --- a/src/pages/ipa/resources/setup-keys.mdx +++ b/src/pages/ipa/resources/setup-keys.mdx @@ -45,7 +45,7 @@ import json url = "https://api.netbird.io/api/setup-keys" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -330,7 +330,7 @@ payload = json.dumps({ "usage_limit": 0, "ephemeral": true }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -593,7 +593,7 @@ import json url = "https://api.netbird.io/api/setup-keys/{keyId}" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -882,7 +882,7 @@ payload = json.dumps({ "usage_limit": 0, "ephemeral": true }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' diff --git a/src/pages/ipa/resources/tokens.mdx b/src/pages/ipa/resources/tokens.mdx index e065aff0..6e0f7b5f 100644 --- a/src/pages/ipa/resources/tokens.mdx +++ b/src/pages/ipa/resources/tokens.mdx @@ -53,7 +53,7 @@ import json url = "https://api.netbird.io/api/users/{userId}/tokens" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -280,7 +280,7 @@ payload = json.dumps({ "name": "My first token", "expires_in": 30 }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -505,7 +505,7 @@ import json url = "https://api.netbird.io/api/users/{userId}/tokens/{tokenId}" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -701,7 +701,7 @@ import json url = "https://api.netbird.io/api/users/{userId}/tokens/{tokenId}" -headers: { +headers = { 'Authorization': 'Token ' } diff --git a/src/pages/ipa/resources/users.mdx b/src/pages/ipa/resources/users.mdx index 08dafc4c..a970a3c0 100644 --- a/src/pages/ipa/resources/users.mdx +++ b/src/pages/ipa/resources/users.mdx @@ -53,7 +53,7 @@ import json url = "https://api.netbird.io/api/users" -headers: { +headers = { 'Accept': 'application/json', 'Authorization': 'Token ' } @@ -182,7 +182,10 @@ echo $response; "is_current": true, "is_service_user": false, "is_blocked": false, - "issued": "api" + "issued": "api", + "permissions": { + "dashboard_view": "limited" + } } ] ``` @@ -201,7 +204,10 @@ echo $response; "is_current": "boolean", "is_service_user": "boolean", "is_blocked": "boolean", - "issued": "string" + "issued": "string", + "permissions": { + "dashboard_view": "string" + } } ] ``` @@ -316,7 +322,7 @@ payload = json.dumps({ ], "is_service_user": false }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -485,7 +491,10 @@ echo $response; "is_current": true, "is_service_user": false, "is_blocked": false, - "issued": "api" + "issued": "api", + "permissions": { + "dashboard_view": "limited" + } } ``` ```json {{ title: 'Schema' }} @@ -502,7 +511,10 @@ echo $response; "is_current": "boolean", "is_service_user": "boolean", "is_blocked": "boolean", - "issued": "string" + "issued": "string", + "permissions": { + "dashboard_view": "string" + } } ``` @@ -608,7 +620,7 @@ payload = json.dumps({ ], "is_blocked": false }) -headers: { +headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Token ' @@ -769,7 +781,10 @@ echo $response; "is_current": true, "is_service_user": false, "is_blocked": false, - "issued": "api" + "issued": "api", + "permissions": { + "dashboard_view": "limited" + } } ``` ```json {{ title: 'Schema' }} @@ -786,7 +801,10 @@ echo $response; "is_current": "boolean", "is_service_user": "boolean", "is_blocked": "boolean", - "issued": "string" + "issued": "string", + "permissions": { + "dashboard_view": "string" + } } ``` @@ -847,7 +865,7 @@ import json url = "https://api.netbird.io/api/users/{userId}" -headers: { +headers = { 'Authorization': 'Token ' } @@ -1011,7 +1029,7 @@ import json url = "https://api.netbird.io/api/users/{userId}/invite" -headers: { +headers = { 'Authorization': 'Token ' }