diff --git a/api/openapi.yaml b/api/openapi.yaml index 992d0a7..a7a3e35 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -1,90 +1,218 @@ openapi: 3.1.0 info: - title: Prediction Microservice - description: |- - This is prediction microservice as part of the Novel Metadata Fabric based on the OpenAPI 3.1 specification. It provides a forecasting functionality for pre-defined metrics such as daily energy consumption metrics on the GLACIATION platform. You can retrieve the most recent history and prediction of energy consumption of the platform. - - You can find out more about - the prediction microservice at [https://github.com/glaciation-heu/IceStream/tree/development/prediction_service](https://github.com/glaciation-heu/IceStream/tree/development/prediction_service). - + title: Template web service + description: This is a template of a web service contact: - email: Guangyuan.Piao@dell.com + name: HIRO-MicroDataCenters + email: all-hiro@hiro-microdatacenters.nl license: - name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html + name: MIT + url: https://github.com/HIRO-MicroDataCenters-BV/template-python/blob/main/LICENSE version: 0.1.0 -externalDocs: - description: Find out more about prediction microservice - url: https://github.com/glaciation-heu/IceStream/tree/development/prediction_service -servers: - - url: http://0.0.0.0:8080 +paths: + /metrics: + get: + summary: Metrics + description: Endpoint that serves Prometheus metrics. + operationId: metrics_metrics_get + responses: + '200': + description: Successful Response + content: + application/json: + schema: {} + /: + get: + summary: Example endpoint + description: Example endpoint that returns test data + operationId: example__get + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ExampleResponse' + /item/: + get: + tags: + - items + summary: Read all items + description: Read all items from the storage + operationId: items__read_all + responses: + '200': + description: Successful Response + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Item' + type: array + title: Response Items Read All + post: + tags: + - items + summary: Create an item + description: Create a new item in the storage + operationId: items__create + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + required: true + responses: + '201': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + /item/{id}/: + get: + tags: + - items + summary: Read an item + description: Read item from the storage + operationId: items__read_item + parameters: + - name: id + in: path + required: true + schema: + type: integer + title: Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + put: + tags: + - items + summary: Update an item + description: Update an item in the storage + operationId: items__update_item + parameters: + - name: id + in: path + required: true + schema: + type: integer + title: Id + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Item' + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + delete: + tags: + - items + summary: Delete an item + description: Delete an item from the storage + operationId: items__delete_item + parameters: + - name: id + in: path + required: true + schema: + type: integer + title: Id + responses: + '204': + description: Successful Response + '422': + description: Validation Error + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' components: schemas: - Metric: - type: object + ExampleResponse: properties: - metricId: + value: type: string - examples: ['1234'] - timeseries: - type: array - items: - type: number - format: float - forecasting_values: - type: array + title: Value + type: object + required: + - value + title: ExampleResponse + description: Example data + examples: + - value: test value + HTTPValidationError: + properties: + detail: items: - type: number - format: float - forecasting_upper_bounds: + $ref: '#/components/schemas/ValidationError' type: array + title: Detail + type: object + title: HTTPValidationError + Item: + properties: + id: + type: integer + title: Id + name: + type: string + title: Name + type: object + required: + - id + - name + title: Item + examples: + - id: 1 + name: test name + ValidationError: + properties: + loc: items: - type: number - format: float - forecasting_lower_bounds: + anyOf: + - type: string + - type: integer type: array - items: - type: number - format: float - forecasting_model: + title: Location + msg: type: string - forecasting_period: - type: integer - format: int32 - examples: [1] - time: - type: array - items: - type: string - format: date - aggregation_interval: - type: integer - format: int64 - examples: [86400] -paths: - /prediction/{metricId}: - get: - summary: Retrieve historical and predicted time series by ID - description: Returns a time series metric - operationId: getMetricById - parameters: - - name: metricId - in: path - description: Id of the metric to return - required: true - schema: - type: string - responses: - '200': - description: successful operation - content: - applicatin/json: - schema: - $ref: '#/components/schemas/Metric' - '400': - description: Invalid Id supplied - '404': - description: Metric not found - - - + title: Message + type: + type: string + title: Error Type + type: object + required: + - loc + - msg + - type + title: ValidationError