Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: PPT-1733 Add reload driver endpoint #396

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading