Skip to content

Commit

Permalink
Merge pull request #38 from Cross-Lab-Project/device-service-refactor…
Browse files Browse the repository at this point in the history
…ing-integration

Device service refactoring integration
  • Loading branch information
jonau authored Apr 28, 2023
2 parents e989ae7 + 2ab3f9d commit 0f4cb23
Show file tree
Hide file tree
Showing 323 changed files with 31,499 additions and 20,999 deletions.
6 changes: 6 additions & 0 deletions .jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ services/auth:
- script: lint
dependencies:
- services/auth:build
- script: test
dependencies:
- services/auth:build

services/booking:
- script: build-spec
Expand All @@ -117,6 +120,9 @@ services/device:
- script: build-docker
dependencies:
- services/device:build
- script: test
dependencies:
- services/auth:build

services/experiment:
- script: build-spec
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ The following table shows the status for all jobs in this repository.
| helper/dummy-device/js | | | [![build](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/js/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/js/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/js/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/js/dist/lint.log) | | |
| helper/dummy-device/python | | | [![build](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/python/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/python/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/python/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/helper/dummy-device/python/dist/lint.log) | | |
| services/common | | | [![build](https://ci.goldi-labs.de/crosslab/main/services/common/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/common/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/services/common/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/services/common/dist/lint.log) | | |
| services/auth | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint.log) | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-docker.log) |
| services/auth | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/lint.log) | [![test](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/test.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/test.log) | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/auth/dist/build-docker.log) |
| services/booking | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/booking/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/booking/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/booking/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/booking/dist/lint-spec.log) | | | | |
| services/device | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/device/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build.log) | | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-docker.log) |
| services/device | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/device/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build.log) | | [![test](https://ci.goldi-labs.de/crosslab/main/services/device/dist/test.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/test.log) | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/device/dist/build-docker.log) |
| services/experiment | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build.log) | [![lint](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/lint.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/lint.log) | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/experiment/dist/build-docker.log) |
| services/federation | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build.log) | | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/federation/dist/build-docker.log) |
| services/update | [![build-spec](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build-spec.log) | [![lint-spec](https://ci.goldi-labs.de/crosslab/main/services/update/dist/lint-spec.badge)](https://ci.goldi-labs.de/crosslab/main/services/update/dist/lint-spec.log) | [![build](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build.badge)](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build.log) | | | [![build-docker](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build-docker.badge)](https://ci.goldi-labs.de/crosslab/main/services/update/dist/build-docker.log) |
Expand Down Expand Up @@ -138,6 +138,7 @@ graph LR
services/auth:build-spec[build-spec]
services/auth:lint[lint]
services/auth:lint-spec[lint-spec]
services/auth:test[test]
end
subgraph services/booking
services/booking:build-spec[build-spec]
Expand All @@ -152,6 +153,7 @@ graph LR
services/device:build-docker[build-docker]
services/device:build-spec[build-spec]
services/device:lint-spec[lint-spec]
services/device:test[test]
end
subgraph services/experiment
services/experiment:build[build]
Expand Down Expand Up @@ -235,6 +237,7 @@ helper/python-test-helper --> clients/soa_services/webcam/python
helper/tsdoc-theme --> clients/api/js
services/auth --> clients/api/js
services/auth --> integration-test
services/auth --> services/device
services/auth --> services/openapi
services/booking --> clients/api/js
services/booking --> services/openapi
Expand Down
4 changes: 4 additions & 0 deletions clients/api/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions clients/api/python/src/crosslab/api_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
CreatePeerconnectionResponse,
GetPeerconnectionResponse,
DeletePeerconnectionResponse,
PatchPeerconnectionDeviceStatusRequest,
PatchPeerconnectionDeviceStatusResponse,
ListExperimentsResponse,
CreateExperimentRequest,
CreateExperimentResponse,
Expand Down Expand Up @@ -1160,6 +1162,37 @@ async def delete_peerconnection(self, url: str) -> DeletePeerconnectionResponse:
return resp
raise Exception(f"Unexpected status code: {status}")

async def patch_peerconnection_device_status(self, url: str, body: PatchPeerconnectionDeviceStatusRequest, device_url: str) -> PatchPeerconnectionDeviceStatusResponse: # noqa: E501
"""
Sets the peerconnection status of a single device.
""" # noqa: E501
if not self.BASE_URL:
raise Exception("No base url set")

# match path to url schema
m = re.search(r'^('+re.escape(self.BASE_URL)+r')?\/?(peerconnections\/[^?]*?)(\/device_status)?$', url)
if m is None:
raise Exception("Invalid url")
valid_url = '/'+m.group(2)+'/device_status'
if valid_url.startswith('//'):
valid_url = valid_url[1:]

# build query params
query_params: Dict[str, Union[List[str], str]] = {}
if device_url:
if isinstance(device_url, list):
query_params['device_url'] = device_url
else:
query_params['device_url'] = str(device_url)

# make http call
status, resp = await self._fetch(valid_url, method="patch", body=body, params=query_params)

# transform response
if status == 201:
return resp
raise Exception(f"Unexpected status code: {status}")

async def list_experiments(self, url: str = "/experiments") -> ListExperimentsResponse: # noqa: E501
"""
List experiments
Expand Down
Loading

0 comments on commit 0f4cb23

Please sign in to comment.