diff --git a/OPENAPI_DOC.yml b/OPENAPI_DOC.yml index ea83d87b..5889cc80 100644 --- a/OPENAPI_DOC.yml +++ b/OPENAPI_DOC.yml @@ -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: diff --git a/src/placeos-rest-api/controllers/drivers.cr b/src/placeos-rest-api/controllers/drivers.cr index 8590e62e..523f55bb 100644 --- a/src/placeos-rest-api/controllers/drivers.cr +++ b/src/placeos-rest-api/controllers/drivers.cr @@ -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(