Handle merge api component conflicts (#539)

* Handle merge api component conflicts

Added a fixConflictingEnumAllOf() function in generator/api.ts that pre-processes the spec before merging

* Update API pages with v0.62.2

---------

Co-authored-by: netbirddev <dev@netbird.io>
This commit is contained in:
Maycon Santos
2026-01-10 12:16:22 +01:00
committed by GitHub
parent 881fbfcb49
commit aef978f63d
10 changed files with 4450 additions and 336 deletions

View File

@@ -176,6 +176,7 @@ echo $response;
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1",
"created_at": "2023-05-05T09:00:35.477782Z",
"ip": "10.64.0.1",
"connection_ip": "35.64.0.1",
"connected": true,
@@ -203,6 +204,10 @@ echo $response;
"last_login": "2023-05-05T09:00:35.477782Z",
"inactivity_expiration_enabled": false,
"approval_required": true,
"disapproval_reason": {
"description": "(Cloud only) Reason why the peer requires approval",
"type": "string"
},
"country_code": "DE",
"city_name": "Berlin",
"serial_number": "C02XJ0J0JGH7",
@@ -210,6 +215,18 @@ echo $response;
"stage-host-1"
],
"ephemeral": false,
"local_flags": {
"rosenpass_enabled": true,
"rosenpass_permissive": false,
"server_ssh_allowed": true,
"disable_client_routes": false,
"disable_server_routes": false,
"disable_dns": false,
"disable_firewall": false,
"block_lan_access": false,
"block_inbound": false,
"lazy_connection_enabled": false
},
"accessible_peers_count": 5
}
]
@@ -219,6 +236,7 @@ echo $response;
{
"id": "string",
"name": "string",
"created_at": "string",
"ip": "string",
"connection_ip": "string",
"connected": "boolean",
@@ -246,6 +264,7 @@ echo $response;
"last_login": "string",
"inactivity_expiration_enabled": "boolean",
"approval_required": "boolean",
"disapproval_reason": "string",
"country_code": "string",
"city_name": "string",
"serial_number": "string",
@@ -253,6 +272,18 @@ echo $response;
"string"
],
"ephemeral": "boolean",
"local_flags": {
"rosenpass_enabled": "boolean",
"rosenpass_permissive": "boolean",
"server_ssh_allowed": "boolean",
"disable_client_routes": "boolean",
"disable_server_routes": "boolean",
"disable_dns": "boolean",
"disable_firewall": "boolean",
"block_lan_access": "boolean",
"block_inbound": "boolean",
"lazy_connection_enabled": "boolean"
},
"accessible_peers_count": "integer"
}
]
@@ -435,6 +466,7 @@ echo $response;
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1",
"created_at": "2023-05-05T09:00:35.477782Z",
"ip": "10.64.0.1",
"connection_ip": "35.64.0.1",
"connected": true,
@@ -462,19 +494,36 @@ echo $response;
"last_login": "2023-05-05T09:00:35.477782Z",
"inactivity_expiration_enabled": false,
"approval_required": true,
"disapproval_reason": {
"description": "(Cloud only) Reason why the peer requires approval",
"type": "string"
},
"country_code": "DE",
"city_name": "Berlin",
"serial_number": "C02XJ0J0JGH7",
"extra_dns_labels": [
"stage-host-1"
],
"ephemeral": false
"ephemeral": false,
"local_flags": {
"rosenpass_enabled": true,
"rosenpass_permissive": false,
"server_ssh_allowed": true,
"disable_client_routes": false,
"disable_server_routes": false,
"disable_dns": false,
"disable_firewall": false,
"block_lan_access": false,
"block_inbound": false,
"lazy_connection_enabled": false
}
}
```
```json {{ title: 'Schema' }}
{
"id": "string",
"name": "string",
"created_at": "string",
"ip": "string",
"connection_ip": "string",
"connected": "boolean",
@@ -502,13 +551,26 @@ echo $response;
"last_login": "string",
"inactivity_expiration_enabled": "boolean",
"approval_required": "boolean",
"disapproval_reason": "string",
"country_code": "string",
"city_name": "string",
"serial_number": "string",
"extra_dns_labels": [
"string"
],
"ephemeral": "boolean"
"ephemeral": "boolean",
"local_flags": {
"rosenpass_enabled": "boolean",
"rosenpass_permissive": "boolean",
"server_ssh_allowed": "boolean",
"disable_client_routes": "boolean",
"disable_server_routes": "boolean",
"disable_dns": "boolean",
"disable_firewall": "boolean",
"block_lan_access": "boolean",
"block_inbound": "boolean",
"lazy_connection_enabled": "boolean"
}
}
```
</CodeGroup>
@@ -787,6 +849,7 @@ echo $response;
{
"id": "chacbco6lnnbn6cg5s90",
"name": "stage-host-1",
"created_at": "2023-05-05T09:00:35.477782Z",
"ip": "10.64.0.1",
"connection_ip": "35.64.0.1",
"connected": true,
@@ -814,19 +877,36 @@ echo $response;
"last_login": "2023-05-05T09:00:35.477782Z",
"inactivity_expiration_enabled": false,
"approval_required": true,
"disapproval_reason": {
"description": "(Cloud only) Reason why the peer requires approval",
"type": "string"
},
"country_code": "DE",
"city_name": "Berlin",
"serial_number": "C02XJ0J0JGH7",
"extra_dns_labels": [
"stage-host-1"
],
"ephemeral": false
"ephemeral": false,
"local_flags": {
"rosenpass_enabled": true,
"rosenpass_permissive": false,
"server_ssh_allowed": true,
"disable_client_routes": false,
"disable_server_routes": false,
"disable_dns": false,
"disable_firewall": false,
"block_lan_access": false,
"block_inbound": false,
"lazy_connection_enabled": false
}
}
```
```json {{ title: 'Schema' }}
{
"id": "string",
"name": "string",
"created_at": "string",
"ip": "string",
"connection_ip": "string",
"connected": "boolean",
@@ -854,13 +934,26 @@ echo $response;
"last_login": "string",
"inactivity_expiration_enabled": "boolean",
"approval_required": "boolean",
"disapproval_reason": "string",
"country_code": "string",
"city_name": "string",
"serial_number": "string",
"extra_dns_labels": [
"string"
],
"ephemeral": "boolean"
"ephemeral": "boolean",
"local_flags": {
"rosenpass_enabled": "boolean",
"rosenpass_permissive": "boolean",
"server_ssh_allowed": "boolean",
"disable_client_routes": "boolean",
"disable_server_routes": "boolean",
"disable_dns": "boolean",
"disable_firewall": "boolean",
"block_lan_access": "boolean",
"block_inbound": "boolean",
"lazy_connection_enabled": "boolean"
}
}
```
</CodeGroup>
@@ -1242,3 +1335,271 @@ echo $response;
</Row>
---
## Create a Temporary Access Peer {{ tag: 'POST' , label: '/api/peers/{peerId}/temporary-access' }}
<Row>
<Col>
Creates a temporary access peer that can be used to access this peer and this peer only. The temporary access peer and its access policies will be automatically deleted after it disconnects.
### Path Parameters
<Properties>
<Property name="peerId" type="string" required={true}>
The unique identifier of a peer
</Property>
</Properties>
### Request-Body Parameters
<Properties><Property name="name" type="string" required={true}>
Peer's hostname
</Property>
<Property name="wg_pub_key" type="string" required={true}>
Peer's WireGuard public key
</Property>
<Property name="rules" type="string[]" required={true}>
List of temporary access rules
</Property>
</Properties>
</Col>
<Col sticky>
<CodeGroup title="Request" tag="POST" label="/api/peers/{peerId}/temporary-access">
```bash {{ title: 'cURL' }}
curl -X POST https://api.netbird.io/api/peers/{peerId}/temporary-access \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Token <TOKEN>' \
--data-raw '{
"name": "temp-host-1",
"wg_pub_key": "n0r3pL4c3h0ld3rK3y==",
"rules": [
"tcp/80"
]
}'
```
```js
const axios = require('axios');
let data = JSON.stringify({
"name": "temp-host-1",
"wg_pub_key": "n0r3pL4c3h0ld3rK3y==",
"rules": [
"tcp/80"
]
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: '/api/peers/{peerId}/temporary-access',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Token <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/peers/{peerId}/temporary-access"
payload = json.dumps({
"name": "temp-host-1",
"wg_pub_key": "n0r3pL4c3h0ld3rK3y==",
"rules": [
"tcp/80"
]
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Token <TOKEN>'
}
response = requests.request("POST", 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/peers/{peerId}/temporary-access"
method := "POST"
payload := strings.NewReader(`{
"name": "temp-host-1",
"wg_pub_key": "n0r3pL4c3h0ld3rK3y==",
"rules": [
"tcp/80"
]
}`)
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 <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/peers/{peerId}/temporary-access")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Authorization"] = "Token <TOKEN>"
request.body = JSON.dump({
"name": "temp-host-1",
"wg_pub_key": "n0r3pL4c3h0ld3rK3y==",
"rules": [
"tcp/80"
]
})
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, '{
"name": "temp-host-1",
"wg_pub_key": "n0r3pL4c3h0ld3rK3y==",
"rules": [
"tcp/80"
]
}');
Request request = new Request.Builder()
.url("https://api.netbird.io/api/peers/{peerId}/temporary-access")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization: Token <TOKEN>")
.build();
Response response = client.newCall(request).execute();
```
```php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.netbird.io/api/peers/{peerId}/temporary-access',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"name": "temp-host-1",
"wg_pub_key": "n0r3pL4c3h0ld3rK3y==",
"rules": [
"tcp/80"
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Token <TOKEN>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
```
</CodeGroup>
<CodeGroup title="Response">
```json {{ title: 'Example' }}
{
"name": "temp-host-1",
"id": "chacbco6lnnbn6cg5s90",
"rules": [
"tcp/80"
]
}
```
```json {{ title: 'Schema' }}
{
"name": "string",
"id": "string",
"rules": [
"string"
]
}
```
</CodeGroup>
</Col>
</Row>
---