fix the api and disable the automation (#172)

This commit is contained in:
pascal-fischer
2024-03-19 10:13:43 +01:00
committed by GitHub
parent 3012df5f57
commit a3eb5be0f8
14 changed files with 5214 additions and 567 deletions

View File

@@ -160,18 +160,76 @@ echo $response;
<CodeGroup title="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"
}
}
]
```
</CodeGroup>
@@ -349,12 +407,86 @@ echo $response;
<CodeGroup title="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"
}
]
}
```
</CodeGroup>
@@ -379,7 +511,33 @@ echo $response;
The unique identifier of a peer
</Property>
</Properties>
</Col>
#### Request-Body Parameters
<Properties><Property name="name" type="string" required={true}>
</Property>
<Property name="ssh_enabled" type="boolean" required={true}>
</Property>
<Property name="login_expiration_enabled" type="boolean" required={true}>
</Property>
<Property name="approval_required" type="boolean" required={false}>
(Cloud only) Indicates whether peer needs approval
</Property>
</Properties>
</Col>
<Col sticky>
<CodeGroup title="Request" tag="PUT" label="/api/peers/{peerId}">
@@ -389,14 +547,20 @@ curl -X PUT https://api.netbird.io/api/peers/{peerId} \
-H 'Content-Type: application/json' \
-H 'Authorization: Token <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 <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;
<CodeGroup title="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"
}
]
}
```
</CodeGroup>