Skip to content

Commit

Permalink
[server] Add admin status endpoint #1297 (#1305)
Browse files Browse the repository at this point in the history
* wip

* implement admin status

* update apis

* Update server.en-US.md
  • Loading branch information
michaelvlach authored Oct 11, 2024
1 parent 84903ed commit 29845e7
Show file tree
Hide file tree
Showing 123 changed files with 1,454 additions and 152 deletions.
4 changes: 3 additions & 1 deletion agdb_api/php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Class | Method | HTTP request | Description
*AgdbApi* | [**adminDbUserList**](docs/Api/AgdbApi.md#admindbuserlist) | **GET** /api/v1/admin/db/{owner}/{db}/user/list |
*AgdbApi* | [**adminDbUserRemove**](docs/Api/AgdbApi.md#admindbuserremove) | **DELETE** /api/v1/admin/db/{owner}/{db}/user/{username}/remove |
*AgdbApi* | [**adminShutdown**](docs/Api/AgdbApi.md#adminshutdown) | **POST** /api/v1/admin/shutdown |
*AgdbApi* | [**adminStatus**](docs/Api/AgdbApi.md#adminstatus) | **GET** /api/v1/admin/status |
*AgdbApi* | [**adminUserAdd**](docs/Api/AgdbApi.md#adminuseradd) | **POST** /api/v1/admin/user/{username}/add |
*AgdbApi* | [**adminUserChangePassword**](docs/Api/AgdbApi.md#adminuserchangepassword) | **PUT** /api/v1/admin/user/{username}/change_password |
*AgdbApi* | [**adminUserList**](docs/Api/AgdbApi.md#adminuserlist) | **GET** /api/v1/admin/user/list |
Expand Down Expand Up @@ -119,6 +120,7 @@ Class | Method | HTTP request | Description

## Models

- [AdminStatus](docs/Model/AdminStatus.md)
- [ChangePassword](docs/Model/ChangePassword.md)
- [ClusterStatus](docs/Model/ClusterStatus.md)
- [Comparison](docs/Model/Comparison.md)
Expand Down Expand Up @@ -238,7 +240,7 @@ vendor/bin/phpunit

This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: `0.8.2`
- API version: `0.9.0`
- Package version: `0.7.2`
- Generator version: `7.8.0`
- Build package: `org.openapitools.codegen.languages.PhpClientCodegen`
12 changes: 0 additions & 12 deletions agdb_api/php/ci.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
function coverage() {
rm -f agdb_server.yaml
rm -f .agdb_server.agdb
rm -f agdb_server.agdb
rm -rf agdb_server_data

echo "bind: \"0.0.0.0:3000\"
address: localhost:3000
basepath: \"\"
admin: admin
data_dir: agdb_server_data
cluster_token: test
cluster: []" > agdb_server.yaml

cargo build --release -p agdb_server
cargo run --release -p agdb_server &
sleep 3
Expand Down Expand Up @@ -49,8 +39,6 @@ cluster: []" > agdb_server.yaml
curl -H "Authorization: Bearer $token" -X POST http://localhost:3000/api/v1/admin/shutdown

rm -f agdb_server.yaml
rm -f .agdb_server.agdb
rm -f agdb_server.agdb
rm -rf agdb_server_data

echo ""
Expand Down
65 changes: 61 additions & 4 deletions agdb_api/php/docs/Api/AgdbApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ All URIs are relative to http://localhost:3000, except if the operation defines
| [**adminDbUserList()**](AgdbApi.md#adminDbUserList) | **GET** /api/v1/admin/db/{owner}/{db}/user/list | |
| [**adminDbUserRemove()**](AgdbApi.md#adminDbUserRemove) | **DELETE** /api/v1/admin/db/{owner}/{db}/user/{username}/remove | |
| [**adminShutdown()**](AgdbApi.md#adminShutdown) | **POST** /api/v1/admin/shutdown | |
| [**adminStatus()**](AgdbApi.md#adminStatus) | **GET** /api/v1/admin/status | |
| [**adminUserAdd()**](AgdbApi.md#adminUserAdd) | **POST** /api/v1/admin/user/{username}/add | |
| [**adminUserChangePassword()**](AgdbApi.md#adminUserChangePassword) | **PUT** /api/v1/admin/user/{username}/change_password | |
| [**adminUserList()**](AgdbApi.md#adminUserList) | **GET** /api/v1/admin/user/list | |
Expand Down Expand Up @@ -939,6 +940,61 @@ void (empty response body)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `adminStatus()`

```php
adminStatus(): \Agnesoft\AgdbApi\Model\AdminStatus
```



### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: Token
$config = Agnesoft\AgdbApi\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);

try {
$result = $apiInstance->adminStatus();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AgdbApi->adminStatus: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

This endpoint does not need any parameter.

### Return type

[**\Agnesoft\AgdbApi\Model\AdminStatus**](../Model/AdminStatus.md)

### Authorization

[Token](../../README.md#Token)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
[[Back to README]](../../README.md)

## `adminUserAdd()`

```php
Expand Down Expand Up @@ -2005,7 +2061,7 @@ void (empty response body)
## `dbUserList()`

```php
dbUserList($owner, $db)
dbUserList($owner, $db): \Agnesoft\AgdbApi\Model\DbUser[]
```


Expand All @@ -2031,7 +2087,8 @@ $owner = 'owner_example'; // string | db owner user name
$db = 'db_example'; // string | db name

try {
$apiInstance->dbUserList($owner, $db);
$result = $apiInstance->dbUserList($owner, $db);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AgdbApi->dbUserList: ', $e->getMessage(), PHP_EOL;
}
Expand All @@ -2046,7 +2103,7 @@ try {

### Return type

void (empty response body)
[**\Agnesoft\AgdbApi\Model\DbUser[]**](../Model/DbUser.md)

### Authorization

Expand All @@ -2055,7 +2112,7 @@ void (empty response body)
### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to Model list]](../../README.md#models)
Expand Down
13 changes: 13 additions & 0 deletions agdb_api/php/docs/Model/AdminStatus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# # AdminStatus

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**dbs** | **int** | |
**logged_in_users** | **int** | |
**size** | **int** | |
**uptime** | **int** | |
**users** | **int** | |

[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)
Loading

0 comments on commit 29845e7

Please sign in to comment.