mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-24 11:26:36 +00:00
add first version of tailwind docs
This commit is contained in:
522
src/pages/rules.mdx
Normal file
522
src/pages/rules.mdx
Normal file
@@ -0,0 +1,522 @@
|
||||
---
|
||||
|
||||
|
||||
|
||||
## List all Rules {{ tag: 'GET' , label: '/api/rules' }}
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Returns a list of all Rules
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="GET" label="/api/rules">
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X GET https://api.netbird.io/api/rules \
|
||||
-H "Authorization: Bearer {token}" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
import ApiClient from '@example/protocol-api'
|
||||
|
||||
const client = new ApiClient(token)
|
||||
|
||||
await client.contacts.update('WAz8eIbvDR60rouK', {
|
||||
display_name: 'UncleFrank',
|
||||
})
|
||||
```
|
||||
|
||||
```python
|
||||
from protocol_api import ApiClient
|
||||
|
||||
client = ApiClient(token)
|
||||
|
||||
client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
|
||||
```
|
||||
|
||||
```php
|
||||
$client = new \Protocol\ApiClient($token);
|
||||
|
||||
$client->contacts->update('WAz8eIbvDR60rouK', [
|
||||
'display_name' => 'UncleFrank',
|
||||
]);
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: '200' }}
|
||||
[
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"disabled": "boolean",
|
||||
"flow": "string",
|
||||
"sources": [
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Create a Rule {{ tag: 'POST' , label: '/api/rules' }}
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Creates a Rule
|
||||
|
||||
#### Request-Body Parameters
|
||||
<Properties>
|
||||
|
||||
<Property name="name" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Rule name identifier
|
||||
</Property>
|
||||
|
||||
<Property name="description" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Rule friendly description
|
||||
</Property>
|
||||
|
||||
<Property name="disabled" type="boolean" required={true}
|
||||
|
||||
|
||||
>
|
||||
Rules status
|
||||
</Property>
|
||||
|
||||
<Property name="flow" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Rule flow, currently, only "bidirect" for bi-directional traffic is accepted
|
||||
</Property>
|
||||
|
||||
<Property name="sources" type="string[]" required={false}
|
||||
|
||||
|
||||
>
|
||||
List of source groups
|
||||
</Property>
|
||||
|
||||
<Property name="destinations" type="string[]" required={false}
|
||||
|
||||
|
||||
>
|
||||
List of destination groups
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="POST" label="/api/rules">
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X POST https://api.netbird.io/api/rules \
|
||||
-H "Authorization: Bearer {token}" \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"disabled": "boolean",
|
||||
"flow": "string",
|
||||
"sources": [
|
||||
"string"
|
||||
],
|
||||
"destinations": [
|
||||
"string"
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
```js
|
||||
import ApiClient from '@example/protocol-api'
|
||||
|
||||
const client = new ApiClient(token)
|
||||
|
||||
await client.contacts.update('WAz8eIbvDR60rouK', {
|
||||
display_name: 'UncleFrank',
|
||||
})
|
||||
```
|
||||
|
||||
```python
|
||||
from protocol_api import ApiClient
|
||||
|
||||
client = ApiClient(token)
|
||||
|
||||
client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
|
||||
```
|
||||
|
||||
```php
|
||||
$client = new \Protocol\ApiClient($token);
|
||||
|
||||
$client->contacts->update('WAz8eIbvDR60rouK', [
|
||||
'display_name' => 'UncleFrank',
|
||||
]);
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: '200' }}
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"disabled": "boolean",
|
||||
"flow": "string",
|
||||
"sources": [
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Retrieve a Rule {{ tag: 'GET' , label: '/api/rules/{ruleId}' }}
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Get information about a Rules
|
||||
|
||||
#### Path Parameters
|
||||
<Properties>
|
||||
|
||||
<Property name="ruleId" type="string" required={true}>
|
||||
The unique identifier of a rule
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="GET" label="/api/rules/{ruleId}">
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X GET https://api.netbird.io/api/rules/{ruleId} \
|
||||
-H "Authorization: Bearer {token}" \
|
||||
-H 'Accept: application/json' \
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
import ApiClient from '@example/protocol-api'
|
||||
|
||||
const client = new ApiClient(token)
|
||||
|
||||
await client.contacts.update('WAz8eIbvDR60rouK', {
|
||||
display_name: 'UncleFrank',
|
||||
})
|
||||
```
|
||||
|
||||
```python
|
||||
from protocol_api import ApiClient
|
||||
|
||||
client = ApiClient(token)
|
||||
|
||||
client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
|
||||
```
|
||||
|
||||
```php
|
||||
$client = new \Protocol\ApiClient($token);
|
||||
|
||||
$client->contacts->update('WAz8eIbvDR60rouK', [
|
||||
'display_name' => 'UncleFrank',
|
||||
]);
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: '200' }}
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"disabled": "boolean",
|
||||
"flow": "string",
|
||||
"sources": [
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Update a Rule {{ tag: 'PUT' , label: '/api/rules/{ruleId}' }}
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Update/Replace a Rule
|
||||
|
||||
#### Path Parameters
|
||||
<Properties>
|
||||
|
||||
<Property name="ruleId" type="string" required={true}>
|
||||
The unique identifier of a rule
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
#### Request-Body Parameters
|
||||
<Properties>
|
||||
|
||||
<Property name="name" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Rule name identifier
|
||||
</Property>
|
||||
|
||||
<Property name="description" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Rule friendly description
|
||||
</Property>
|
||||
|
||||
<Property name="disabled" type="boolean" required={true}
|
||||
|
||||
|
||||
>
|
||||
Rules status
|
||||
</Property>
|
||||
|
||||
<Property name="flow" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Rule flow, currently, only "bidirect" for bi-directional traffic is accepted
|
||||
</Property>
|
||||
|
||||
<Property name="sources" type="string[]" required={false}
|
||||
|
||||
|
||||
>
|
||||
List of source groups
|
||||
</Property>
|
||||
|
||||
<Property name="destinations" type="string[]" required={false}
|
||||
|
||||
|
||||
>
|
||||
List of destination groups
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="PUT" label="/api/rules/{ruleId}">
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X PUT https://api.netbird.io/api/rules/{ruleId} \
|
||||
-H "Authorization: Bearer {token}" \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"disabled": "boolean",
|
||||
"flow": "string",
|
||||
"sources": [
|
||||
"string"
|
||||
],
|
||||
"destinations": [
|
||||
"string"
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
```js
|
||||
import ApiClient from '@example/protocol-api'
|
||||
|
||||
const client = new ApiClient(token)
|
||||
|
||||
await client.contacts.update('WAz8eIbvDR60rouK', {
|
||||
display_name: 'UncleFrank',
|
||||
})
|
||||
```
|
||||
|
||||
```python
|
||||
from protocol_api import ApiClient
|
||||
|
||||
client = ApiClient(token)
|
||||
|
||||
client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
|
||||
```
|
||||
|
||||
```php
|
||||
$client = new \Protocol\ApiClient($token);
|
||||
|
||||
$client->contacts->update('WAz8eIbvDR60rouK', [
|
||||
'display_name' => 'UncleFrank',
|
||||
]);
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: '200' }}
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"disabled": "boolean",
|
||||
"flow": "string",
|
||||
"sources": [
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
],
|
||||
"destinations": [
|
||||
{
|
||||
"id": "string",
|
||||
"name": "string",
|
||||
"peers_count": "integer"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Delete a Rule {{ tag: 'DELETE' , label: '/api/rules/{ruleId}' }}
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
Delete a Rule
|
||||
|
||||
#### Path Parameters
|
||||
<Properties>
|
||||
|
||||
<Property name="ruleId" type="string" required={true}>
|
||||
The unique identifier of a rule
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
<CodeGroup title="Request" tag="DELETE" label="/api/rules/{ruleId}">
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl -X DELETE https://api.netbird.io/api/rules/{ruleId} \
|
||||
-H "Authorization: Bearer {token}" \
|
||||
|
||||
|
||||
```
|
||||
|
||||
```js
|
||||
import ApiClient from '@example/protocol-api'
|
||||
|
||||
const client = new ApiClient(token)
|
||||
|
||||
await client.contacts.update('WAz8eIbvDR60rouK', {
|
||||
display_name: 'UncleFrank',
|
||||
})
|
||||
```
|
||||
|
||||
```python
|
||||
from protocol_api import ApiClient
|
||||
|
||||
client = ApiClient(token)
|
||||
|
||||
client.contacts.update("WAz8eIbvDR60rouK", display_name="UncleFrank")
|
||||
```
|
||||
|
||||
```php
|
||||
$client = new \Protocol\ApiClient($token);
|
||||
|
||||
$client->contacts->update('WAz8eIbvDR60rouK', [
|
||||
'display_name' => 'UncleFrank',
|
||||
]);
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user