From 203150749d576d10f4f8d22d9e8b0c01c1a5edf6 Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Fri, 25 Jul 2025 00:57:05 +0200 Subject: [PATCH] add http files --- .gitignore | 1 + doc/dependency.md | 6 --- http/account-registry/account.http | 41 +++++++++++++++++ http/account-registry/accounts.http | 8 ++++ http/account-registry/actuator.http | 2 + http/account-registry/authentication.http | 44 +++++++++++++++++++ .../account-registry/http-client.env.json-dev | 11 +++++ http/device-api/actuator.http | 2 + http/device-api/configuration.http | 3 ++ http/device-api/http-client.env.json-dev | 14 ++++++ http/device-api/measurement.http | 23 ++++++++++ http/device-configuration/actuator.http | 2 + .../http-client.env.json-dev | 11 +++++ http/device-configuration/node.http | 11 +++++ http/device-data/actuator.http | 2 + http/device-data/http-client.env.json-dev | 11 +++++ http/device-data/measurement.http | 34 ++++++++++++++ http/device-registry/actuator.http | 2 + http/device-registry/device.http | 10 +++++ http/device-registry/http-client.env.json-dev | 11 +++++ http/device-registry/identity.http | 2 + http/device-registry/node.http | 9 ++++ http/device-registry/type.http | 20 +++++++++ http/device-registry/types.http | 17 +++++++ http/registry-api/actuator.http | 5 +++ http/registry-api/authentication.http | 8 ++++ http/registry-api/http-client.env.json-dev | 14 ++++++ http/registry-api/registry.http | 8 ++++ 28 files changed, 326 insertions(+), 6 deletions(-) create mode 100644 http/account-registry/account.http create mode 100644 http/account-registry/accounts.http create mode 100644 http/account-registry/actuator.http create mode 100644 http/account-registry/authentication.http create mode 100644 http/account-registry/http-client.env.json-dev create mode 100644 http/device-api/actuator.http create mode 100644 http/device-api/configuration.http create mode 100644 http/device-api/http-client.env.json-dev create mode 100644 http/device-api/measurement.http create mode 100644 http/device-configuration/actuator.http create mode 100644 http/device-configuration/http-client.env.json-dev create mode 100644 http/device-configuration/node.http create mode 100644 http/device-data/actuator.http create mode 100644 http/device-data/http-client.env.json-dev create mode 100644 http/device-data/measurement.http create mode 100644 http/device-registry/actuator.http create mode 100644 http/device-registry/device.http create mode 100644 http/device-registry/http-client.env.json-dev create mode 100644 http/device-registry/identity.http create mode 100644 http/device-registry/node.http create mode 100644 http/device-registry/type.http create mode 100644 http/device-registry/types.http create mode 100644 http/registry-api/actuator.http create mode 100644 http/registry-api/authentication.http create mode 100644 http/registry-api/http-client.env.json-dev create mode 100644 http/registry-api/registry.http diff --git a/.gitignore b/.gitignore index 81b810c..be89694 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ cert/ +http/*/http-client.env.json diff --git a/doc/dependency.md b/doc/dependency.md index d5a5cf8..ed2bfd8 100644 --- a/doc/dependency.md +++ b/doc/dependency.md @@ -29,13 +29,7 @@ graph TD subgraph HM[Hlæja Management] HMS[Service] -.-> HMR[(Redis)] end - subgraph HG[Hlæja Gateway] - HGE[Nginx] - end - HG -.-> HDA - HG -.-> HRA - HG -.-> HM HM --> HAR HM -.-> HDR diff --git a/http/account-registry/account.http b/http/account-registry/account.http new file mode 100644 index 0000000..776278b --- /dev/null +++ b/http/account-registry/account.http @@ -0,0 +1,41 @@ +### get user by id +GET {{hostname}}/account-00000000-0000-7000-0000-000000000001 + +### add user +POST {{hostname}}/account +Content-Type: application/json + +{ + "username": "user01010101", + "password": "p4ssw0rd", + "enabled": true, + "roles": [ + "ROLE_ADMIN", + "ROLE_TEST" + ] +} + +### update user all information +PUT {{hostname}}/account-00000000-0000-7000-0000-000000000002 +Content-Type: application/json + +{ + "username": "user", + "password": "pass", + "enabled": true, + "roles": [ + "ROLE_TEST" + ] +} + +### update user information +PUT {{hostname}}/account-00000000-0000-7000-0000-000000000002 +Content-Type: application/json + +{ + "username": "user", + "enabled": true, + "roles": [ + "ROLE_TEST" + ] +} diff --git a/http/account-registry/accounts.http b/http/account-registry/accounts.http new file mode 100644 index 0000000..ae3593d --- /dev/null +++ b/http/account-registry/accounts.http @@ -0,0 +1,8 @@ +### Get accounts +GET {{hostname}}/accounts + +### Get accounts by page +GET {{hostname}}/accounts/page-1 + +### Get accounts by page and size +GET {{hostname}}/accounts/page-1/show-1 diff --git a/http/account-registry/actuator.http b/http/account-registry/actuator.http new file mode 100644 index 0000000..4d03087 --- /dev/null +++ b/http/account-registry/actuator.http @@ -0,0 +1,2 @@ +### get actuator +GET {{hostname}}/actuator diff --git a/http/account-registry/authentication.http b/http/account-registry/authentication.http new file mode 100644 index 0000000..b7bb4b1 --- /dev/null +++ b/http/account-registry/authentication.http @@ -0,0 +1,44 @@ +### Get admin information +POST {{hostname}}/authenticate +Content-Type: application/json + +{ + "username": "admin", + "password": "pass" +} + +### Get user information +POST {{hostname}}/authenticate +Content-Type: application/json + +{ + "username": "user", + "password": "pass" +} + +### Get bad user +POST {{hostname}}/authenticate +Content-Type: application/json + +{ + "username": "bad user", + "password": "pass" +} + +### Get bad pass +POST {{hostname}}/authenticate +Content-Type: application/json + +{ + "username": "user", + "password": "bad pass" +} + +### Get disabled user +POST {{hostname}}/authenticate +Content-Type: application/json + +{ + "username": "disabled", + "password": "pass" +} diff --git a/http/account-registry/http-client.env.json-dev b/http/account-registry/http-client.env.json-dev new file mode 100644 index 0000000..4c65a8f --- /dev/null +++ b/http/account-registry/http-client.env.json-dev @@ -0,0 +1,11 @@ +{ + "development": { + "hostname": "http://localhost:8080" + }, + "docker": { + "hostname": "http://localhost:9050" + }, + "testing": { + "hostname": "http://10.0.x.x" + } +} diff --git a/http/device-api/actuator.http b/http/device-api/actuator.http new file mode 100644 index 0000000..4d03087 --- /dev/null +++ b/http/device-api/actuator.http @@ -0,0 +1,2 @@ +### get actuator +GET {{hostname}}/actuator diff --git a/http/device-api/configuration.http b/http/device-api/configuration.http new file mode 100644 index 0000000..869dab4 --- /dev/null +++ b/http/device-api/configuration.http @@ -0,0 +1,3 @@ +### get configuration +GET {{hostname}}/configuration +Identity: {{identity}} diff --git a/http/device-api/http-client.env.json-dev b/http/device-api/http-client.env.json-dev new file mode 100644 index 0000000..50ecb47 --- /dev/null +++ b/http/device-api/http-client.env.json-dev @@ -0,0 +1,14 @@ +{ + "development": { + "hostname": "https://localhost:8443", + "identity": "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + }, + "docker": { + "hostname": "https://localhost:9000", + "identity": "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + }, + "testing": { + "hostname": "https://10.0.x.x", + "identity": "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + } +} diff --git a/http/device-api/measurement.http b/http/device-api/measurement.http new file mode 100644 index 0000000..40367f3 --- /dev/null +++ b/http/device-api/measurement.http @@ -0,0 +1,23 @@ +### get measurement +GET {{hostname}}/measurement +Identity: {{identity}} + +### add measurement for all +POST {{hostname}}/measurement +Content-Type: application/json +Identity: {{identity}} + +{ + "button0": 0, + "button1": 1, + "button2": 0 +} + +### add measurement for one +POST {{hostname}}/measurement +Content-Type: application/json +Identity: {{identity}} + +{ + "button0": 1 +} diff --git a/http/device-configuration/actuator.http b/http/device-configuration/actuator.http new file mode 100644 index 0000000..4d03087 --- /dev/null +++ b/http/device-configuration/actuator.http @@ -0,0 +1,2 @@ +### get actuator +GET {{hostname}}/actuator diff --git a/http/device-configuration/http-client.env.json-dev b/http/device-configuration/http-client.env.json-dev new file mode 100644 index 0000000..451d92b --- /dev/null +++ b/http/device-configuration/http-client.env.json-dev @@ -0,0 +1,11 @@ +{ + "development": { + "hostname": "http://localhost:8080" + }, + "docker": { + "hostname": "http://localhost:9030" + }, + "testing": { + "hostname": "http://10.0.x.x" + } +} diff --git a/http/device-configuration/node.http b/http/device-configuration/node.http new file mode 100644 index 0000000..b1a78db --- /dev/null +++ b/http/device-configuration/node.http @@ -0,0 +1,11 @@ +### +GET {{hostname}}/node-00000000-0000-7000-0000-000000000001 + + +### add measurement for one +PUT {{hostname}}/node-01983d73-3a1e-792e-b910-5673f366fb3b +Content-Type: application/json + +{ + "configuration": "test" +} diff --git a/http/device-data/actuator.http b/http/device-data/actuator.http new file mode 100644 index 0000000..4d03087 --- /dev/null +++ b/http/device-data/actuator.http @@ -0,0 +1,2 @@ +### get actuator +GET {{hostname}}/actuator diff --git a/http/device-data/http-client.env.json-dev b/http/device-data/http-client.env.json-dev new file mode 100644 index 0000000..400d42c --- /dev/null +++ b/http/device-data/http-client.env.json-dev @@ -0,0 +1,11 @@ +{ + "development": { + "hostname": "http://localhost:8080" + }, + "docker": { + "hostname": "http://localhost:9020" + }, + "testing": { + "hostname": "http://10.0.x.x" + } +} diff --git a/http/device-data/measurement.http b/http/device-data/measurement.http new file mode 100644 index 0000000..ad1f385 --- /dev/null +++ b/http/device-data/measurement.http @@ -0,0 +1,34 @@ + + +### add measurement for all +POST {{hostname}}/client-00000000-0000-7000-0001-000000000001 +Content-Type: application/json + +{ + "tags": { + "device": "00000000-0000-7000-0002-000000000001", + "node": "00000000-0000-7000-0003-000000000001" + }, + "fields": { + "button0": 1, + "button1": 0, + "button2": 1 + } +} + +### add measurement for one +POST {{hostname}}/client-00000000-0000-7000-0001-000000000001 +Content-Type: application/json + +{ + "tags": { + "device": "00000000-0000-7000-0002-000000000001", + "node": "00000000-0000-7000-0003-000000000001" + }, + "fields": { + "button1": 0 + } +} + +### add measurement +GET {{hostname}}/client-00000000-0000-7000-0001-000000000001/node-00000000-0000-7000-0003-000000000001 diff --git a/http/device-registry/actuator.http b/http/device-registry/actuator.http new file mode 100644 index 0000000..4d03087 --- /dev/null +++ b/http/device-registry/actuator.http @@ -0,0 +1,2 @@ +### get actuator +GET {{hostname}}/actuator diff --git a/http/device-registry/device.http b/http/device-registry/device.http new file mode 100644 index 0000000..fbfd232 --- /dev/null +++ b/http/device-registry/device.http @@ -0,0 +1,10 @@ +### register device for a type +POST {{hostname}}/device +Content-Type: application/json + +{ + "type": "00000000-0000-0000-0000-000000000000" +} + +### register device for a type +GET {{hostname}}/device-00000000-0000-0000-0000-000000000000 diff --git a/http/device-registry/http-client.env.json-dev b/http/device-registry/http-client.env.json-dev new file mode 100644 index 0000000..4c65a8f --- /dev/null +++ b/http/device-registry/http-client.env.json-dev @@ -0,0 +1,11 @@ +{ + "development": { + "hostname": "http://localhost:8080" + }, + "docker": { + "hostname": "http://localhost:9050" + }, + "testing": { + "hostname": "http://10.0.x.x" + } +} diff --git a/http/device-registry/identity.http b/http/device-registry/identity.http new file mode 100644 index 0000000..523b36e --- /dev/null +++ b/http/device-registry/identity.http @@ -0,0 +1,2 @@ +### get identity +GET {{hostname}}/identity/device-00000000-0000-0000-0000-000000000001 diff --git a/http/device-registry/node.http b/http/device-registry/node.http new file mode 100644 index 0000000..a218e7c --- /dev/null +++ b/http/device-registry/node.http @@ -0,0 +1,9 @@ +### register node for a client and device with name +POST {{hostname}}/node +Content-Type: application/json + +{ + "client": "00000000-0000-0000-0000-000000000000", + "device": "01983d72-476e-77ab-9b17-5ba7045b15fa", + "name": "my test device" +} diff --git a/http/device-registry/type.http b/http/device-registry/type.http new file mode 100644 index 0000000..4b92960 --- /dev/null +++ b/http/device-registry/type.http @@ -0,0 +1,20 @@ +### add type +POST {{hostname}}/type +Content-Type: application/json + +{ + "name": "Test Device 001", + "description": "Description of test device." +} + +### get type by id +GET {{hostname}}/type-00000000-0000-0000-0000-000000000000 + +### update type by id +PUT {{hostname}}/type-00000000-0000-0000-0000-000000000000 +Content-Type: application/json + +{ + "name": "Test Device 001", + "description": "Description of test device." +} diff --git a/http/device-registry/types.http b/http/device-registry/types.http new file mode 100644 index 0000000..4fcd4f2 --- /dev/null +++ b/http/device-registry/types.http @@ -0,0 +1,17 @@ +### get all types +GET {{hostname}}/types + +### get all types +GET {{hostname}}/types/page-1 + +### get all types +GET {{hostname}}/types/page-1/show-2 + +### get all types +GET {{hostname}}/types/filter-{filter} + +### get all types +GET {{hostname}}/types/filter-{filter}/page-1 + +### get all types +GET {{hostname}}/types/filter-{filter}/page-1/show-2 diff --git a/http/registry-api/actuator.http b/http/registry-api/actuator.http new file mode 100644 index 0000000..8612a02 --- /dev/null +++ b/http/registry-api/actuator.http @@ -0,0 +1,5 @@ +### get actuator +GET {{hostname}}/actuator` +Authorization: Bearer {{token}} +Content-Type: application/json` + diff --git a/http/registry-api/authentication.http b/http/registry-api/authentication.http new file mode 100644 index 0000000..1ae5779 --- /dev/null +++ b/http/registry-api/authentication.http @@ -0,0 +1,8 @@ +### account login +POST {{hostname}}/login +Content-Type: application/json + +{ + "username": "admin", + "password": "pass" +} diff --git a/http/registry-api/http-client.env.json-dev b/http/registry-api/http-client.env.json-dev new file mode 100644 index 0000000..43d2b3c --- /dev/null +++ b/http/registry-api/http-client.env.json-dev @@ -0,0 +1,14 @@ +{ + "development": { + "hostname": "https://localhost:8443", + "token": "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + }, + "docker": { + "hostname": "https://localhost:9040", + "token": "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + }, + "testing": { + "hostname": "https://10.0.x.x", + "token": "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + } +} diff --git a/http/registry-api/registry.http b/http/registry-api/registry.http new file mode 100644 index 0000000..114d9d1 --- /dev/null +++ b/http/registry-api/registry.http @@ -0,0 +1,8 @@ +### register device for a type +POST {{hostname}}/register +Authorization: Bearer {{token}} +Content-Type: application/json + +{ + "type": "00000000-0000-0000-0000-000000000000" +}