Skip to content

Commit

Permalink
deploy: 0794363
Browse files Browse the repository at this point in the history
  • Loading branch information
dborovcanin committed Jun 27, 2024
1 parent 3f8e14c commit 6641438
Show file tree
Hide file tree
Showing 3 changed files with 289 additions and 2 deletions.
285 changes: 285 additions & 0 deletions apis/api/openapi/journal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0

openapi: 3.0.3
info:
title: Magistrala Journal Log Service
description: |
This is the Journal Log Server based on the OpenAPI 3.0 specification. It is the HTTP API for viewing journal log history. You can now help us improve the API whether it's by making changes to the definition itself or to the code.
Some useful links:
- [The Magistrala repository](https://github.com/absmach/magistrala)
contact:
email: [email protected]
license:
name: Apache 2.0
url: https://github.com/absmach/magistrala/blob/master/LICENSE
version: 0.14.0

servers:
- url: http://localhost:9021
- url: https://localhost:9021

tags:
- name: journal-log
description: Everything about your Journal Log
externalDocs:
description: Find out more about Journal Log
url: http://docs.mainflux.io/

paths:
/journal/{entity_type}/{id}:
get:
tags:
- journal-log
summary: List journal log
description: |
Retrieves a list of journal. Due to performance concerns, data
is retrieved in subsets. The API must ensure that the entire
dataset is consumed either by making subsequent requests, or by
increasing the subset size of the initial request.
parameters:
- $ref: "#/components/parameters/entity_type"
- $ref: "#/components/parameters/id"
- $ref: "#/components/parameters/offset"
- $ref: "#/components/parameters/limit"
- $ref: "#/components/parameters/operation"
- $ref: "#/components/parameters/with_attributes"
- $ref: "#/components/parameters/with_metadata"
- $ref: "#/components/parameters/from"
- $ref: "#/components/parameters/to"
- $ref: "#/components/parameters/dir"
security:
- bearerAuth: []
responses:
"200":
$ref: "#/components/responses/JournalsPageRes"
"400":
description: Failed due to malformed query parameters.
"401":
description: Missing or invalid access token provided.
"403":
description: Failed to perform authorization over the entity.
"404":
description: A non-existent entity request.
"422":
description: Database can't process request.
"500":
$ref: "#/components/responses/ServiceError"

/health:
get:
summary: Retrieves service health check info.
tags:
- health
responses:
"200":
$ref: "#/components/responses/HealthRes"
"500":
$ref: "#/components/responses/ServiceError"

components:
schemas:
Journal:
type: object
properties:
operation:
type: string
example: user.create
description: Journal operation.
occurred_at:
type: string
format: date-time
example: "2024-01-11T12:05:07.449053Z"
description: Time when the journal occurred.
attributes:
type: object
description: Journal attributes.
example:
{
"created_at": "2024-06-12T11:34:32.991591Z",
"id": "29d425c8-542b-4614-8a4d-a5951945d720",
"identity": "[email protected]",
"name": "Newgard-Frisina",
"status": "enabled",
"updated_at": "2024-06-12T11:34:33.116795Z",
"updated_by": "ad228f20-4741-47c5-bef7-d871b541c019",
}
metadata:
type: object
description: Journal payload.
example: { "Update": "Calvo-Felkins" }
xml:
name: journal

JournalPage:
type: object
properties:
journals:
type: array
minItems: 0
uniqueItems: true
items:
$ref: "#/components/schemas/Journal"
total:
type: integer
example: 1
description: Total number of items.
offset:
type: integer
description: Number of items to skip during retrieval.
limit:
type: integer
example: 10
description: Maximum number of items to return in one page.
required:
- journals
- total
- offset

Error:
type: object
properties:
error:
type: string
description: Error message
example: { "error": "malformed entity specification" }

parameters:
entity_type:
name: entity_type
description: Type of entity, e.g. user, group, thing, etc.
in: path
schema:
type: string
enum:
- user
- group
- thing
- channel
required: true
example: user

id:
name: id
description: Unique identifier for an entity, e.g. user, group, domain, etc. Used together with entity_type.
in: path
schema:
type: string
format: uuid
required: true
example: bb7edb32-2eac-4aad-aebe-ed96fe073879

offset:
name: offset
description: Number of items to skip during retrieval.
in: query
schema:
type: integer
default: 0
minimum: 0
required: false
example: "0"

limit:
name: limit
description: Size of the subset to retrieve.
in: query
schema:
type: integer
default: 10
maximum: 10
minimum: 1
required: false
example: "10"

operation:
name: operation
description: Journal operation.
in: query
schema:
type: string
required: false
example: user.create

with_attributes:
name: with_attributes
description: Include journal attributes.
in: query
schema:
type: boolean
required: false
example: true

with_metadata:
name: with_metadata
description: Include journal metadata.
in: query
schema:
type: boolean
required: false
example: true

from:
name: from
description: Start date in unix time.
in: query
schema:
type: string
format: int64
required: false
example: 1966777289

to:
name: to
description: End date in unix time.
in: query
schema:
type: string
format: int64
required: false
example: 1966777289

dir:
name: dir
description: Sort direction.
in: query
schema:
type: string
enum:
- asc
- desc
required: false
example: desc

responses:
JournalsPageRes:
description: Data retrieved.
content:
application/json:
schema:
$ref: "#/components/schemas/JournalPage"

HealthRes:
description: Service Health Check.
content:
application/health+json:
schema:
$ref: "./schemas/HealthInfo.yml"

ServiceError:
description: Unexpected server-side error occurred.
content:
application/json:
schema:
$ref: "#/components/schemas/Error"

securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: |
* User access: "Authorization: Bearer <user_access_token>"
security:
- bearerAuth: []
4 changes: 3 additions & 1 deletion apis/api/openapi/notifiers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ paths:
$ref: "#/components/responses/Create"
"400":
description: Failed due to malformed JSON.
"401":
description: Missing or invalid access token provided.
"403":
description: Failed to perform authorization over the entity.
"409":
Expand Down Expand Up @@ -92,7 +94,7 @@ paths:
"200":
$ref: "#/components/responses/View"
"400":
description: Failed due to malformed query parameters.
description: Failed due to malformed ID.
"401":
description: Missing or invalid access token provided.
"403":
Expand Down
2 changes: 1 addition & 1 deletion swagger-config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"urls":[{"name":"auth.yml","url":"apis/api/openapi/auth.yml"},{"name":"bootstrap.yml","url":"apis/api/openapi/bootstrap.yml"},{"name":"certs.yml","url":"apis/api/openapi/certs.yml"},{"name":"http.yml","url":"apis/api/openapi/http.yml"},{"name":"invitations.yml","url":"apis/api/openapi/invitations.yml"},{"name":"notifiers.yml","url":"apis/api/openapi/notifiers.yml"},{"name":"provision.yml","url":"apis/api/openapi/provision.yml"},{"name":"readers.yml","url":"apis/api/openapi/readers.yml"},{"name":"things.yml","url":"apis/api/openapi/things.yml"},{"name":"twins.yml","url":"apis/api/openapi/twins.yml"},{"name":"users.yml","url":"apis/api/openapi/users.yml"}]}
{"urls":[{"name":"auth.yml","url":"apis/api/openapi/auth.yml"},{"name":"bootstrap.yml","url":"apis/api/openapi/bootstrap.yml"},{"name":"certs.yml","url":"apis/api/openapi/certs.yml"},{"name":"http.yml","url":"apis/api/openapi/http.yml"},{"name":"invitations.yml","url":"apis/api/openapi/invitations.yml"},{"name":"journal.yml","url":"apis/api/openapi/journal.yml"},{"name":"notifiers.yml","url":"apis/api/openapi/notifiers.yml"},{"name":"provision.yml","url":"apis/api/openapi/provision.yml"},{"name":"readers.yml","url":"apis/api/openapi/readers.yml"},{"name":"things.yml","url":"apis/api/openapi/things.yml"},{"name":"twins.yml","url":"apis/api/openapi/twins.yml"},{"name":"users.yml","url":"apis/api/openapi/users.yml"}]}

0 comments on commit 6641438

Please sign in to comment.