Skip to content

Commit

Permalink
Update API pages with v0.24.4
Browse files Browse the repository at this point in the history
  • Loading branch information
netbirddev committed Dec 8, 2023
1 parent ceddc4b commit 464530a
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 75 deletions.
228 changes: 217 additions & 11 deletions src/pages/ipa/resources/accounts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ echo $response;
"peer_login_expiration": 43200,
"groups_propagation_enabled": true,
"jwt_groups_enabled": true,
"jwt_groups_claim_name": "roles"
"jwt_groups_claim_name": "roles",
"extra": {
"peer_approval_enabled": true
}
}
}
]
Expand All @@ -183,7 +186,10 @@ echo $response;
"peer_login_expiration": "integer",
"groups_propagation_enabled": "boolean",
"jwt_groups_enabled": "boolean",
"jwt_groups_claim_name": "string"
"jwt_groups_claim_name": "string",
"extra": {
"peer_approval_enabled": "boolean"
}
}
}
]
Expand Down Expand Up @@ -250,6 +256,13 @@ echo $response;
>
Name of the claim from which we extract groups names to add it to account groups.
</Property>
<Property name="peer_approval_enabled" type="boolean" required={false}
>
(Cloud only) Enables or disables peer approval globally. If enabled, all peers added will be in pending state until approved by an admin.
</Property>
</Properties>
</Col>
Expand All @@ -267,7 +280,10 @@ curl -X PUT https://api.netbird.io/api/accounts/{accountId} \
"peer_login_expiration": 43200,
"groups_propagation_enabled": true,
"jwt_groups_enabled": true,
"jwt_groups_claim_name": "roles"
"jwt_groups_claim_name": "roles",
"extra": {
"peer_approval_enabled": true
}
}
}'
```
Expand All @@ -280,7 +296,10 @@ let data = JSON.stringify({
"peer_login_expiration": 43200,
"groups_propagation_enabled": true,
"jwt_groups_enabled": true,
"jwt_groups_claim_name": "roles"
"jwt_groups_claim_name": "roles",
"extra": {
"peer_approval_enabled": true
}
}
});
let config = {
Expand Down Expand Up @@ -315,7 +334,10 @@ payload = json.dumps({
"peer_login_expiration": 43200,
"groups_propagation_enabled": true,
"jwt_groups_enabled": true,
"jwt_groups_claim_name": "roles"
"jwt_groups_claim_name": "roles",
"extra": {
"peer_approval_enabled": true
}
}
})
headers: {
Expand Down Expand Up @@ -350,7 +372,10 @@ func main() {
"peer_login_expiration": 43200,
"groups_propagation_enabled": true,
"jwt_groups_enabled": true,
"jwt_groups_claim_name": "roles"
"jwt_groups_claim_name": "roles",
"extra": {
"peer_approval_enabled": true
}
}
}`)
client := &http.Client {
Expand Down Expand Up @@ -403,7 +428,10 @@ request.body = JSON.dump({
"peer_login_expiration": 43200,
"groups_propagation_enabled": true,
"jwt_groups_enabled": true,
"jwt_groups_claim_name": "roles"
"jwt_groups_claim_name": "roles",
"extra": {
"peer_approval_enabled": true
}
}
})
response = https.request(request)
Expand All @@ -420,7 +448,10 @@ RequestBody body = RequestBody.create(mediaType, '{
"peer_login_expiration": 43200,
"groups_propagation_enabled": true,
"jwt_groups_enabled": true,
"jwt_groups_claim_name": "roles"
"jwt_groups_claim_name": "roles",
"extra": {
"peer_approval_enabled": true
}
}
}');
Request request = new Request.Builder()
Expand Down Expand Up @@ -453,7 +484,10 @@ curl_setopt_array($curl, array(
"peer_login_expiration": 43200,
"groups_propagation_enabled": true,
"jwt_groups_enabled": true,
"jwt_groups_claim_name": "roles"
"jwt_groups_claim_name": "roles",
"extra": {
"peer_approval_enabled": true
}
}
}',
CURLOPT_HTTPHEADER => array(
Expand Down Expand Up @@ -482,7 +516,10 @@ echo $response;
"peer_login_expiration": 43200,
"groups_propagation_enabled": true,
"jwt_groups_enabled": true,
"jwt_groups_claim_name": "roles"
"jwt_groups_claim_name": "roles",
"extra": {
"peer_approval_enabled": true
}
}
}
```
Expand All @@ -494,7 +531,10 @@ echo $response;
"peer_login_expiration": "integer",
"groups_propagation_enabled": "boolean",
"jwt_groups_enabled": "boolean",
"jwt_groups_claim_name": "string"
"jwt_groups_claim_name": "string",
"extra": {
"peer_approval_enabled": "boolean"
}
}
}
```
Expand All @@ -504,6 +544,172 @@ echo $response;
</Col>
</Row>
---
## Delete an Account {{ tag: 'DELETE' , label: '/api/accounts/{accountId}' }}
<Row>
<Col>
Deletes an account and all its resources. Only administrators and account owners can delete accounts.
#### Path Parameters
<Properties>
<Property name="accountId" type="string" required={true}>
The unique identifier of an account
</Property>
</Properties>
</Col>
<Col sticky>
<CodeGroup title="Request" tag="DELETE" label="/api/accounts/{accountId}">
```bash {{ title: 'cURL' }}
curl -X DELETE https://api.netbird.io/api/accounts/{accountId} \
-H 'Authorization: Token <TOKEN>'
```
```js
const axios = require('axios');

let config = {
method: 'delete',
maxBodyLength: Infinity,
url: '/api/accounts/{accountId}',
headers: {
'Authorization': 'Token <TOKEN>'
}
};

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/accounts/{accountId}"

headers: {
'Authorization': 'Token <TOKEN>'
}

response = requests.request("DELETE", url, headers=headers)

print(response.text)
```
```go
package main

import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)

func main() {

url := "https://api.netbird.io/api/accounts/{accountId}"
method := "DELETE"

client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)

if err != nil {
fmt.Println(err)
return
{

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/accounts/{accountId}")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["Authorization"] = "Token <TOKEN>"

response = https.request(request)
puts response.read_body
```
```java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();

Request request = new Request.Builder()
.url("https://api.netbird.io/api/accounts/{accountId}")
.method("DELETE")
.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/accounts/{accountId}',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => array(
'Authorization: Token <TOKEN>'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```
</CodeGroup>
</Col>
</Row>
Expand Down
Loading

0 comments on commit 464530a

Please sign in to comment.