Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions generator/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default async function gen(inputFileName: string, outputDir: string) {

type v3OperationWithPath = OpenAPIV3.OperationObject & {
path: string

}

export type objectRepresentation = {
Expand Down Expand Up @@ -104,22 +105,16 @@ async function gen_v3(spec: OpenAPIV3.Document, dest: string) {
}
}

// if(operation.summary == "List all Tokens") {
// console.log(response.example)
// console.log(operation.responses["200"]["content"]["application/json"].schema.items.properties)
// }


const enriched = {
...operation,
path: key,
fullPath,
operationId: slugify(operation.summary!),

responseList: toArrayWithKey(operation.responses!, 'responseCode') || [],
request: request,
response: response,
}

let tag = operation.tags.pop()
let tagOperations = tagGroups.get(tag) ?? []
tagGroups.set(tag, tagOperations.concat(enriched))
Expand Down
2 changes: 1 addition & 1 deletion generator/templates/ApiTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const title = '<%- tag %>'

<% operations.forEach(function(operation){ %>

## <%- operation.summary %> {{ tag: '<%- operation.operation.toUpperCase() %>' , label: '<%- operation.path %>' }} <% if(operation.deprecated) { %><Badge status="warning" text="Deprecated" /><% } %>
## <%- operation.summary %> <% if(operation.deprecated) { %> <Badge status="warning" text="Deprecated" /> <% } %><% if(operation["x-cloud-only"]) { %> <Badge status="cloud-only" text="Cloud-Only" /> <% } %><% if(operation["x-experimental"]) { %> <Badge status="experimental" text="Experimental" /> <% } %> {{ tag: '<%- operation.operation.toUpperCase() %>' , label: '<%- operation.path %>' }}

<Row>
<Col>
Expand Down
4 changes: 4 additions & 0 deletions src/components/Badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ export function Badge({ status, text }) {
case 'error':
// Never tested colors
return 'bg-red-300/30 text-red-400 dark:bg-red-400/10 dark:text-red-400';
case 'cloud-only':
return 'bg-orange-200/50 text-orange-400 dark:bg-orange-600/20 dark:text-orange-400';
case 'experimental':
return 'bg-teal-200/50 text-teal-400 dark:bg-teal-500/15 dark:text-teal-400';
default:
return 'bg-gray-500/30 text-gray-600 dark:bg-gray-400/10 dark:text-gray-400';
}
Expand Down
1 change: 1 addition & 0 deletions src/components/NavigationAPI.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const apiNavigation = [
{ title: 'Users', href: '/api/resources/users' },
{ title: 'Tokens', href: '/api/resources/tokens' },
{ title: 'Peers', href: '/api/resources/peers' },
{ title: 'Ingress Ports', href: '/api/resources/ingress-ports' },
{ title: 'Setup Keys', href: '/api/resources/setup-keys' },
{ title: 'Groups', href: '/api/resources/groups' },
{ title: 'Policies', href: '/api/resources/policies' },
Expand Down
62 changes: 47 additions & 15 deletions src/pages/ipa/resources/accounts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const title = 'Accounts'



## List all Accounts {{ tag: 'GET' , label: '/api/accounts' }}
## List all Accounts {{ tag: 'GET' , label: '/api/accounts' }}

<Row>
<Col>
Expand Down Expand Up @@ -177,7 +177,9 @@ echo $response;
],
"routing_peer_dns_resolution_enabled": true,
"extra": {
"peer_approval_enabled": true
"peer_approval_enabled": true,
"network_traffic_logs_enabled": true,
"network_traffic_packet_counter_enabled": true
}
}
}
Expand All @@ -201,7 +203,9 @@ echo $response;
],
"routing_peer_dns_resolution_enabled": "boolean",
"extra": {
"peer_approval_enabled": "boolean"
"peer_approval_enabled": "boolean",
"network_traffic_logs_enabled": "boolean",
"network_traffic_packet_counter_enabled": "boolean"
}
}
}
Expand All @@ -216,7 +220,7 @@ echo $response;
---


## Delete an Account {{ tag: 'DELETE' , label: '/api/accounts/{accountId}' }}
## Delete an Account {{ tag: 'DELETE' , label: '/api/accounts/{accountId}' }}

<Row>
<Col>
Expand Down Expand Up @@ -380,7 +384,7 @@ echo $response;
---


## Update an Account {{ tag: 'PUT' , label: '/api/accounts/{accountId}' }}
## Update an Account {{ tag: 'PUT' , label: '/api/accounts/{accountId}' }}

<Row>
<Col>
Expand Down Expand Up @@ -458,10 +462,20 @@ echo $response;
<summary>More Information</summary>
<Properties>

<Properties><Property name="peer_approval_enabled" type="boolean" required={false}>
<Properties><Property name="peer_approval_enabled" type="boolean" required={true}>

(Cloud only) Enables or disables peer approval globally. If enabled, all peers added will be in pending state until approved by an admin.

</Property>
<Property name="network_traffic_logs_enabled" type="boolean" required={true}>

Enables or disables network traffic logs. If enabled, all network traffic logs from peers will be stored.

</Property>
<Property name="network_traffic_packet_counter_enabled" type="boolean" required={true}>

Enables or disables network traffic packet counter. If enabled, network packets and their size will be counted and reported. (This can have an slight impact on performance)

</Property>
</Properties>

Expand Down Expand Up @@ -502,7 +516,9 @@ curl -X PUT https://api.netbird.io/api/accounts/{accountId} \
],
"routing_peer_dns_resolution_enabled": true,
"extra": {
"peer_approval_enabled": true
"peer_approval_enabled": true,
"network_traffic_logs_enabled": true,
"network_traffic_packet_counter_enabled": true
}
}
}'
Expand All @@ -525,7 +541,9 @@ let data = JSON.stringify({
],
"routing_peer_dns_resolution_enabled": true,
"extra": {
"peer_approval_enabled": true
"peer_approval_enabled": true,
"network_traffic_logs_enabled": true,
"network_traffic_packet_counter_enabled": true
}
}
});
Expand Down Expand Up @@ -570,7 +588,9 @@ payload = json.dumps({
],
"routing_peer_dns_resolution_enabled": true,
"extra": {
"peer_approval_enabled": true
"peer_approval_enabled": true,
"network_traffic_logs_enabled": true,
"network_traffic_packet_counter_enabled": true
}
}
})
Expand Down Expand Up @@ -615,7 +635,9 @@ func main() {
],
"routing_peer_dns_resolution_enabled": true,
"extra": {
"peer_approval_enabled": true
"peer_approval_enabled": true,
"network_traffic_logs_enabled": true,
"network_traffic_packet_counter_enabled": true
}
}
}`)
Expand Down Expand Up @@ -678,7 +700,9 @@ request.body = JSON.dump({
],
"routing_peer_dns_resolution_enabled": true,
"extra": {
"peer_approval_enabled": true
"peer_approval_enabled": true,
"network_traffic_logs_enabled": true,
"network_traffic_packet_counter_enabled": true
}
}
})
Expand All @@ -705,7 +729,9 @@ RequestBody body = RequestBody.create(mediaType, '{
],
"routing_peer_dns_resolution_enabled": true,
"extra": {
"peer_approval_enabled": true
"peer_approval_enabled": true,
"network_traffic_logs_enabled": true,
"network_traffic_packet_counter_enabled": true
}
}
}');
Expand Down Expand Up @@ -748,7 +774,9 @@ curl_setopt_array($curl, array(
],
"routing_peer_dns_resolution_enabled": true,
"extra": {
"peer_approval_enabled": true
"peer_approval_enabled": true,
"network_traffic_logs_enabled": true,
"network_traffic_packet_counter_enabled": true
}
}
}',
Expand Down Expand Up @@ -786,7 +814,9 @@ echo $response;
],
"routing_peer_dns_resolution_enabled": true,
"extra": {
"peer_approval_enabled": true
"peer_approval_enabled": true,
"network_traffic_logs_enabled": true,
"network_traffic_packet_counter_enabled": true
}
}
}
Expand All @@ -808,7 +838,9 @@ echo $response;
],
"routing_peer_dns_resolution_enabled": "boolean",
"extra": {
"peer_approval_enabled": "boolean"
"peer_approval_enabled": "boolean",
"network_traffic_logs_enabled": "boolean",
"network_traffic_packet_counter_enabled": "boolean"
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/pages/ipa/resources/dns.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const title = 'DNS'



## List all Nameserver Groups {{ tag: 'GET' , label: '/api/dns/nameservers' }}
## List all Nameserver Groups {{ tag: 'GET' , label: '/api/dns/nameservers' }}

<Row>
<Col>
Expand Down Expand Up @@ -218,7 +218,7 @@ echo $response;
---


## Create a Nameserver Group {{ tag: 'POST' , label: '/api/dns/nameservers' }}
## Create a Nameserver Group {{ tag: 'POST' , label: '/api/dns/nameservers' }}

<Row>
<Col>
Expand Down Expand Up @@ -644,7 +644,7 @@ echo $response;
---


## Retrieve a Nameserver Group {{ tag: 'GET' , label: '/api/dns/nameservers/{nsgroupId}' }}
## Retrieve a Nameserver Group {{ tag: 'GET' , label: '/api/dns/nameservers/{nsgroupId}' }}

<Row>
<Col>
Expand Down Expand Up @@ -864,7 +864,7 @@ echo $response;
---


## Update a Nameserver Group {{ tag: 'PUT' , label: '/api/dns/nameservers/{nsgroupId}' }}
## Update a Nameserver Group {{ tag: 'PUT' , label: '/api/dns/nameservers/{nsgroupId}' }}

<Row>
<Col>
Expand Down Expand Up @@ -1298,7 +1298,7 @@ echo $response;
---


## Delete a Nameserver Group {{ tag: 'DELETE' , label: '/api/dns/nameservers/{nsgroupId}' }}
## Delete a Nameserver Group {{ tag: 'DELETE' , label: '/api/dns/nameservers/{nsgroupId}' }}

<Row>
<Col>
Expand Down Expand Up @@ -1462,7 +1462,7 @@ echo $response;
---


## Retrieve DNS settings {{ tag: 'GET' , label: '/api/dns/settings' }}
## Retrieve DNS settings {{ tag: 'GET' , label: '/api/dns/settings' }}

<Row>
<Col>
Expand Down Expand Up @@ -1646,7 +1646,7 @@ echo $response;
---


## Update DNS Settings {{ tag: 'PUT' , label: '/api/dns/settings' }}
## Update DNS Settings {{ tag: 'PUT' , label: '/api/dns/settings' }}

<Row>
<Col>
Expand Down
Loading