mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-19 00:46:35 +00:00
Change API parser to handle nested objects (#159)
* rewrite parser to handle new format and nested objects * add properties section also to nested properties * update docs manually
This commit is contained in:
@@ -157,9 +157,8 @@ echo $response;
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
<CodeGroup title="Response">
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
[
|
||||
{
|
||||
@@ -167,6 +166,10 @@ echo $response;
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -207,6 +210,9 @@ echo $response;
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
"source_posture_checks": [
|
||||
"string"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "string",
|
||||
@@ -240,13 +246,10 @@ echo $response;
|
||||
}
|
||||
]
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Col>
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
@@ -259,43 +262,97 @@ echo $response;
|
||||
Creates a policy
|
||||
|
||||
#### Request-Body Parameters
|
||||
<Properties>
|
||||
|
||||
<Properties><Property name="id" type="string" required={false}>
|
||||
|
||||
<Property name="id" type="string" required={false}
|
||||
|
||||
|
||||
>
|
||||
Policy ID
|
||||
</Property>
|
||||
Policy ID
|
||||
|
||||
<Property name="name" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Policy name identifier
|
||||
</Property>
|
||||
</Property>
|
||||
<Property name="name" type="string" required={true}>
|
||||
|
||||
<Property name="description" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Policy friendly description
|
||||
</Property>
|
||||
Policy name identifier
|
||||
|
||||
<Property name="enabled" type="boolean" required={true}
|
||||
|
||||
|
||||
>
|
||||
Policy status
|
||||
</Property>
|
||||
</Property>
|
||||
<Property name="description" type="string" required={true}>
|
||||
|
||||
<Property name="rules" type="PolicyRuleUpdate[]" required={true}
|
||||
|
||||
|
||||
>
|
||||
Policy rule object for policy UI editor
|
||||
</Property>
|
||||
</Properties>
|
||||
Policy friendly description
|
||||
|
||||
</Property>
|
||||
<Property name="enabled" type="boolean" required={true}>
|
||||
|
||||
Policy status
|
||||
|
||||
</Property>
|
||||
<Property name="source_posture_checks" type="string[]" required={false}>
|
||||
|
||||
Posture checks ID's applied to policy source groups
|
||||
|
||||
</Property>
|
||||
<Property name="rules" type="object[]" required={true}>
|
||||
|
||||
<details class="custom-details" open>
|
||||
<summary>Policy rule object for policy UI editor</summary>
|
||||
<Properties>
|
||||
|
||||
<Properties><Property name="id" type="string" required={false}>
|
||||
|
||||
Policy rule ID
|
||||
|
||||
</Property>
|
||||
<Property name="name" type="string" required={true}>
|
||||
|
||||
Policy rule name identifier
|
||||
|
||||
</Property>
|
||||
<Property name="description" type="string" required={false}>
|
||||
|
||||
Policy rule friendly description
|
||||
|
||||
</Property>
|
||||
<Property name="enabled" type="boolean" required={true}>
|
||||
|
||||
Policy rule status
|
||||
|
||||
</Property>
|
||||
<Property name="action" type="string" required={true} enumList={["accept","drop"]}>
|
||||
|
||||
Policy rule accept or drops packets
|
||||
|
||||
</Property>
|
||||
<Property name="bidirectional" type="boolean" required={true}>
|
||||
|
||||
Define if the rule is applicable in both directions, sources, and destinations.
|
||||
|
||||
</Property>
|
||||
<Property name="protocol" type="string" required={true} enumList={["all","tcp","udp","icmp"]}>
|
||||
|
||||
Policy rule type of the traffic
|
||||
|
||||
</Property>
|
||||
<Property name="ports" type="string[]" required={false}>
|
||||
|
||||
Policy rule affected ports or it ranges list
|
||||
|
||||
</Property>
|
||||
<Property name="sources" type="string[]" required={true}>
|
||||
|
||||
Policy rule source group IDs
|
||||
|
||||
</Property>
|
||||
<Property name="destinations" type="string[]" required={true}>
|
||||
|
||||
Policy rule destination group IDs
|
||||
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
</Properties>
|
||||
</details>
|
||||
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
@@ -310,6 +367,9 @@ curl -X POST https://api.netbird.io/api/policies \
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -340,6 +400,9 @@ let data = JSON.stringify({
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -392,6 +455,9 @@ payload = json.dumps({
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -444,6 +510,9 @@ func main() {
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -514,6 +583,9 @@ request.body = JSON.dump({
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -548,6 +620,9 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -598,6 +673,9 @@ curl_setopt_array($curl, array(
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -634,15 +712,17 @@ echo $response;
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
<CodeGroup title="Response">
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
{
|
||||
"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",
|
||||
@@ -681,6 +761,9 @@ echo $response;
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
"source_posture_checks": [
|
||||
"string"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "string",
|
||||
@@ -713,9 +796,10 @@ echo $response;
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
</Col>
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
@@ -884,15 +968,17 @@ echo $response;
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
<CodeGroup title="Response">
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
{
|
||||
"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",
|
||||
@@ -931,6 +1017,9 @@ echo $response;
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
"source_posture_checks": [
|
||||
"string"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "string",
|
||||
@@ -963,13 +1052,10 @@ echo $response;
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Col>
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
@@ -990,43 +1076,97 @@ echo $response;
|
||||
</Properties>
|
||||
|
||||
#### Request-Body Parameters
|
||||
<Properties>
|
||||
|
||||
<Properties><Property name="id" type="string" required={false}>
|
||||
|
||||
<Property name="id" type="string" required={false}
|
||||
|
||||
|
||||
>
|
||||
Policy ID
|
||||
</Property>
|
||||
Policy ID
|
||||
|
||||
<Property name="name" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Policy name identifier
|
||||
</Property>
|
||||
</Property>
|
||||
<Property name="name" type="string" required={true}>
|
||||
|
||||
<Property name="description" type="string" required={true}
|
||||
|
||||
|
||||
>
|
||||
Policy friendly description
|
||||
</Property>
|
||||
Policy name identifier
|
||||
|
||||
<Property name="enabled" type="boolean" required={true}
|
||||
|
||||
|
||||
>
|
||||
Policy status
|
||||
</Property>
|
||||
</Property>
|
||||
<Property name="description" type="string" required={true}>
|
||||
|
||||
<Property name="rules" type="PolicyRuleUpdate[]" required={true}
|
||||
|
||||
|
||||
>
|
||||
Policy rule object for policy UI editor
|
||||
</Property>
|
||||
</Properties>
|
||||
Policy friendly description
|
||||
|
||||
</Property>
|
||||
<Property name="enabled" type="boolean" required={true}>
|
||||
|
||||
Policy status
|
||||
|
||||
</Property>
|
||||
<Property name="source_posture_checks" type="string[]" required={false}>
|
||||
|
||||
Posture checks ID's applied to policy source groups
|
||||
|
||||
</Property>
|
||||
<Property name="rules" type="object[]" required={true}>
|
||||
|
||||
<details class="custom-details" open>
|
||||
<summary>Policy rule object for policy UI editor</summary>
|
||||
<Properties>
|
||||
|
||||
<Properties><Property name="id" type="string" required={false}>
|
||||
|
||||
Policy rule ID
|
||||
|
||||
</Property>
|
||||
<Property name="name" type="string" required={true}>
|
||||
|
||||
Policy rule name identifier
|
||||
|
||||
</Property>
|
||||
<Property name="description" type="string" required={false}>
|
||||
|
||||
Policy rule friendly description
|
||||
|
||||
</Property>
|
||||
<Property name="enabled" type="boolean" required={true}>
|
||||
|
||||
Policy rule status
|
||||
|
||||
</Property>
|
||||
<Property name="action" type="string" required={true} enumList={["accept","drop"]}>
|
||||
|
||||
Policy rule accept or drops packets
|
||||
|
||||
</Property>
|
||||
<Property name="bidirectional" type="boolean" required={true}>
|
||||
|
||||
Define if the rule is applicable in both directions, sources, and destinations.
|
||||
|
||||
</Property>
|
||||
<Property name="protocol" type="string" required={true} enumList={["all","tcp","udp","icmp"]}>
|
||||
|
||||
Policy rule type of the traffic
|
||||
|
||||
</Property>
|
||||
<Property name="ports" type="string[]" required={false}>
|
||||
|
||||
Policy rule affected ports or it ranges list
|
||||
|
||||
</Property>
|
||||
<Property name="sources" type="string[]" required={true}>
|
||||
|
||||
Policy rule source group IDs
|
||||
|
||||
</Property>
|
||||
<Property name="destinations" type="string[]" required={true}>
|
||||
|
||||
Policy rule destination group IDs
|
||||
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
</Properties>
|
||||
</details>
|
||||
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
|
||||
</Col>
|
||||
|
||||
<Col sticky>
|
||||
@@ -1041,6 +1181,9 @@ curl -X PUT https://api.netbird.io/api/policies/{policyId} \
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -1071,6 +1214,9 @@ let data = JSON.stringify({
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -1123,6 +1269,9 @@ payload = json.dumps({
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -1175,6 +1324,9 @@ func main() {
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -1245,6 +1397,9 @@ request.body = JSON.dump({
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -1279,6 +1434,9 @@ RequestBody body = RequestBody.create(mediaType, '{
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -1329,6 +1487,9 @@ curl_setopt_array($curl, array(
|
||||
"name": "ch8i4ug6lnn4g9hqv7mg",
|
||||
"description": "This is a default policy that allows connections between all the resources",
|
||||
"enabled": true,
|
||||
"source_posture_checks": [
|
||||
"chacdk86lnnboviihd70"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "ch8i4ug6lnn4g9hqv7mg",
|
||||
@@ -1365,15 +1526,17 @@ echo $response;
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
<CodeGroup title="Response">
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Example' }}
|
||||
{
|
||||
"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",
|
||||
@@ -1412,6 +1575,9 @@ echo $response;
|
||||
"name": "string",
|
||||
"description": "string",
|
||||
"enabled": "boolean",
|
||||
"source_posture_checks": [
|
||||
"string"
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"id": "string",
|
||||
@@ -1444,13 +1610,10 @@ echo $response;
|
||||
]
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Col>
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
@@ -1612,11 +1775,9 @@ echo $response;
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</Col>
|
||||
|
||||
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user