Skip to content

Commit

Permalink
feat: PPT-1733 Add reload driver endpoint (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvis authored Dec 6, 2024
1 parent bec04df commit 9a26de2
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 3 deletions.
74 changes: 71 additions & 3 deletions OPENAPI_DOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6328,14 +6328,82 @@ paths:
schema:
type: string
responses:
208:
description: Already Reported
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceOS__Model__Driver'
$ref: '#/components/schemas/String'
409:
description: Conflict
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceOS__Api__Application__CommonError'
401:
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceOS__Api__Application__CommonError'
403:
description: Forbidden
404:
description: Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceOS__Api__Application__CommonError'
408:
description: Request Timeout
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceOS__Api__Application__CommonError'
400:
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceOS__Api__Application__ParameterError'
422:
description: Unprocessable Entity
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceOS__Api__Application__ParameterError'
406:
description: Not Acceptable
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceOS__Api__Application__ContentError'
415:
description: Unsupported Media Type
content:
application/json:
schema:
$ref: '#/components/schemas/PlaceOS__Api__Application__ContentError'
/api/engine/v2/drivers/{id}/reload:
post:
summary: download and reload driver on core cluster, useful when reloading a
re-compiled driver
tags:
- Drivers
operationId: PlaceOS::Api::Drivers_reload
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/String'
409:
description: Conflict
content:
Expand Down
7 changes: 7 additions & 0 deletions src/placeos-rest-api/controllers/drivers.cr
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ module PlaceOS::Api
render status: resp.first, text: resp.last
end

# download and reload driver on core cluster, useful when reloading a re-compiled driver
@[AC::Route::POST("/:id/reload")]
def reload : String
resp = self.class.driver_reload(current_driver, request_id)
render status: resp.first, text: resp.last
end

def self.driver_recompile(driver : ::PlaceOS::Model::Driver, repository : ::PlaceOS::Model::Repository, request_id : String)
Api::Systems.core_for(driver.file_name, request_id) do |core_client|
core_client.driver_recompile(
Expand Down

0 comments on commit 9a26de2

Please sign in to comment.