This API is used to demonstrate that the Silicon map application (computer science degree project) is capable of functioning without its local database and can be used with any database external to the project.
However it's not recommended, the Java client connects directly to the database without using the API. This is because it's one of the evaluation criteria to connect the Java client directly to the database with a single connection.
The Rust code is used to inject data into the MySQL database to roughly simulate the behavior of the machines (temp) and their components (load). Thanks to the API, it's possible to perform several actions, such as switching to extreme temperature mode or turning the machines on and off.
- URL:
/get_token
| Name | Type | Required | Description |
|---|---|---|---|
| username | String | Yes | Your id |
| pass_string | String | Yes | Your password |
- Return your token.
- URL:
/stop_machine - Method:
GET
| Name | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | Your login token |
| machine | int | No | ID of the machine to stop |
- If no parameter is provided, this endpoint will stop all machines stored in the database.
- If machine is provided, only the specified machine will be stopped.
- URL:
/start_machine - Method:
GET
| Name | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | Your login token |
| machine | int | No | ID of the machine to start |
- If no parameter machine is provided, this endpoint will start all machines stored in the database.
- If machine is provided, only the specified machine will be started.
- URL:
/set_warning_machine - Method:
GET
| Name | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | Your login token |
| machine | int | No | ID of the machine to set in maintenance mode |
- If no parameter machine is provided, this endpoint will set all machines in maintenance state.
- If machine is provided, only the specified machine will be affected.
- URL:
/create_machine - Method:
GET
| Name | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | Your login token |
| hostname | string | Yes | Machine hostname |
| ip_addr | string | Yes | IPv4 address |
| mac_addr | string | Yes | MAC address |
| os | string | Yes | Operating system |
| machine_type | string | Yes | Machine type (Storage, Compute, GPU, GPU_Compute, switch, router, firewall) |
Creates a new machine in the database.
- URL:
/delete_machine - Method:
GET
| Name | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | Your login token |
| id | int | Yes | ID of the machine to delete |
Deletes a machine from the database.
- URL:
/create_component - Method:
GET
| Name | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | Your login token |
| brand | string | Yes | Component brand |
| model | string | Yes | Component model |
| machine_id | string | No | Associated machine ID |
| spec_value_primary | int | No | Primary specification value |
| spec_value_secondary | int | No | Secondary specification value |
| component_type | string | Yes | Component type (CPU, RAM, GPU, DISK, etc.) |
Creates a new component and optionally attaches it to a machine.
- URL:
/delete_component - Method:
GET
| Name | Type | Required | Description |
|---|---|---|---|
| token | String | Yes | Your login token |
| id | int | Yes | ID of the component to delete |
Deletes a component from the database.
- URL:
/start_high_temperature - Method:
GET
Triggers the high temperature simulation scenario.
The mysql database schema can be found at /struct-sql/db.sql
This project is for educational purposes only and is not intended for production use.