Commit bde0fa8b authored by Manuel's avatar Manuel

cleanup of swagger .yml files, change main.py to use resource path

parent f07010d7
paths:
/debug:
post:
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
#region Layers
/layers:
post:
operationId: "routes.layers.post"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Add a new layer [TODO: or overwrite an existing one]"
parameters:
- in: body
name: "layer"
description: "The layer data to be added"
required: true
schema:
$ref: "#/definitions/Layer"
responses:
'201':
description: "Successful operation"
'400':
description: "Invalid input"
get:
operationId: "routes.layers.get"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get all layer data"
parameters: []
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/LayerCollection"
/layers/{name}:
get:
operationId: "routes.layers.get_by_name"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get single layer data"
parameters:
- name: "name"
in: "path"
description: "Name of the requested layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/Layer"
'404':
description: "Layer not found"
/layers/{name}/nodes:
get:
operationId: "routes.layers.get_nodes"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get all individual nodes for the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/NodeCollection"
'404':
description: "Layer not found"
post:
operationId: "routes.layers.post_nodes"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Adds a single or multiple nodes to the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
- name: "node"
in: body
description: "The node(s) to be added"
required: true
schema:
$ref: "#/definitions/NodeCollection"
responses:
'201':
description: "Successful operation"
'400':
description: "Invalid input"
/layers/{name}/clusters:
get:
operationId: "routes.clustersets.get_by_name"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get all clusters for the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ClusterCollection"
'404':
description: "Layer not found"
/layers/{name}/timeslices:
get:
operationId: "routes.timeslices.get_by_name"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get all timeslices for the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/TimeSliceCollection"
'404':
description: "Layer not found"
#endregion
#region Function Calls
/rfc/run:
post:
operationId: "routes.functions.run_agi_clustering_and_graph_creation"
security:
- JwtRegular: []
tags:
- "Remote function calls"
summary: "Insert locations from AGI, create clusters for starting time and location layers, create graphs for the location clusters"
parameters: []
responses:
'204':
description: "Successful operation"
#endregion
################################################################################
/connectedClusters:
get:
operationId: "routes.connClusters.get_conn_clusters"
security:
- JwtRegular: []
tags:
- "Connected"
summary: "Get connected Clusters data"
description: "Returns a dictionary of cluster. The clusters contain the associated connected clusters and connected nodes data."
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ConnectedDict"
/clusterSimilarity:
get:
operationId: "routes.similarity.get_similarity"
security:
- JwtRegular: []
tags:
- "Similarity"
summary: "Get data of the similarity between clusters."
parameters:
- name: "layer_name"
in: "query"
description: "Name of the layer"
required: true
type: "string"
- name: "batchNr"
in: "query"
description: "Batch number (starting from 0)"
required: true
type: "integer"
description: "Data is returned in batches of size 1000. Returns a dictionary where the key is a tuple of cluster_labels (i.e. [0,319]) and the value is the computed similarity between 2 clusters in the tuple, in regard to each layer in the input. \n Note: the tuple clusters have the same layer and the computed similarity is in regard to clusters from OTHER layers."
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ClusterSimilarityArray"
/clusterRunArray:
get:
operationId: "routes.connRun.get_connected_run"
security:
- JwtRegular: []
tags:
- "RunId"
summary: "Get RunId"
description: "Returns the RunId and the associated datetime when a connection of clusters/simillarity of clusters was computed."
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ClusterRunArray"
definitions:
Cluster:
type: object
properties:
layer_name:
type: string
cluster_label:
type: number
nodes:
type: array
items:
$ref: "#/definitions/Node"
ClusterCollection:
type: array
items:
$ref: "#/definitions/Cluster"
Layer:
type: object
properties:
layer_name:
type: string
properties:
type: array
items:
type: string
use_case:
type: string
LayerCollection:
type: array
items:
$ref: "#/definitions/Layer"
Node:
type: object
example:
"UniqueID": "4437d98b4516e899fb7d93cef0bea6111574473703f0aab9d8c2f02aaa673f5c"
"use_case": "string"
"layer_name": "some_layer_name"
"Finished_time": 1576631193265951
"Latitude_Destination": -5.973257
"Longitude_Destination": 37.416316
"TravelID": "5e57ec9159bc0668543f156a"
"TravelPrice": 15
"UserID": "a95075f5042b1b27060080156d87fe34ec7e712c"
NodeCollection:
type: array
items:
$ref: "#/definitions/Node"
TimeSlice:
type: object
properties:
time:
type: object
example: "(2020, 52)"
layer_name:
type: string
clusters:
type: object
additionalProperties:
type: array
items:
type: object
properties:
UniqueID:
type: string
example:
"0":
- UniqueID: abc
- UniqueID: def
TimeSliceCollection:
type: array
items:
$ref: "#/definitions/TimeSlice"
##################################################################
ConnectedDict:
type: array
items:
$ref: "#/definitions/ConnectedCluster"
ConnectedCluster:
type: object
properties:
cluster_label:
type: string
example: "6"
cluster_layer:
type: string
example: "Price_Layer"
cluster_runId:
type: string
example: "5efdc04ac43add0aba567d76"
cluster_containedNodesDict:
type: array
items:
type: string
example: "2696718d7a33ab3dbf28e9c88411afcfe9a933a45e57ec9159bc0668543f1568"
cluster_connNodesDict:
type: array
items:
$ref: "#/definitions/ConnectedNode"
cluster_connClustDict:
type: array
items:
$ref: "#/definitions/ConnectedClusterAux"
ConnectedClusterAux:
type: object
properties:
cluster_label:
type: string
example: "-1"
cluster_layer:
type: string
example: "FinishedTime_Layer"
connectionWeight:
type: number
example: 42
ConnectedNode:
type: object
properties:
node_id:
type: string
node_cluster:
type: string
node_layer:
type: string
example:
"node_id": "27a08ed0facc7d68a0818c7695dad391cf48d6095e57ec9159bc0668543f159b"
"node_cluster": "2230"
"node_layer": "Destination_Layer"
#not used, should be removed?
#finished_time
#latitude_Destination
#longitude_Destination
#travelID
#travelPrice
#userID
ClusterSimilarityArray:
type: array
items:
$ref: "#/definitions/ClusterSimilarityDictionary"
ClusterSimilarityDictionary:
properties:
cluster1_label:
type: string
example: "0"
cluster2_label:
type: string
example: "1"
cluster_layer:
type: string
example: "Price_Layer"
similarityValues:
type: object
additionalProperties:
type: number
example:
"layer_name": similarityValue
"StartingPoint_Layer": 39.0,
"StartingTime_Layer": 99.0101004948485
runId:
type: string
example: "5efdc04ac43add0aba567d76"
ClusterRunArray:
type: array
items:
$ref: "#/definitions/ClusterRun"
ClusterRun:
type: object
properties:
_id:
type: string
example: "5efdc04ac43add0aba567d76"
Datetime:
type: string
example: "2020-07-02 14:19:51.651764"
\ No newline at end of file
...@@ -4,10 +4,6 @@ info: ...@@ -4,10 +4,6 @@ info:
description: This is the documentation for the role stage discovery microservice. description: This is the documentation for the role stage discovery microservice.
version: "1.0.0" version: "1.0.0"
# Import security definitions from global security definition
securityDefinitions:
$ref: '../security/security.yml#securityDefinitions'
consumes: consumes:
- "application/json" - "application/json"
produces: produces:
...@@ -15,445 +11,9 @@ produces: ...@@ -15,445 +11,9 @@ produces:
basePath: "/api" basePath: "/api"
paths: # Import security definitions from global security definition
/debug: securityDefinitions:
post: $ref: '../security/security.yml#securityDefinitions'
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
#region Layers
/layers:
post:
operationId: "routes.layers.post"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Add a new layer [TODO: or overwrite an existing one]"
parameters:
- in: body
name: "layer"
description: "The layer data to be added"
required: true
schema:
$ref: "#/definitions/Layer"
responses:
'201':
description: "Successful operation"
'400':
description: "Invalid input"
get:
operationId: "routes.layers.get"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get all layer data"
parameters: []
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/LayerCollection"
/layers/{name}:
get:
operationId: "routes.layers.get_by_name"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get single layer data"
parameters:
- name: "name"
in: "path"
description: "Name of the requested layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/Layer"
'404':
description: "Layer not found"
/layers/{name}/nodes:
get:
operationId: "routes.layers.get_nodes"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get all individual nodes for the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/NodeCollection"
'404':
description: "Layer not found"
post:
operationId: "routes.layers.post_nodes"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Adds a single or multiple nodes to the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
- name: "node"
in: body
description: "The node(s) to be added"
required: true
schema:
$ref: "#/definitions/NodeCollection"
responses:
'201':
description: "Successful operation"
'400':
description: "Invalid input"
/layers/{name}/clusters:
get:
operationId: "routes.clustersets.get_by_name"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get all clusters for the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ClusterCollection"
'404':
description: "Layer not found"
/layers/{name}/timeslices:
get:
operationId: "routes.timeslices.get_by_name"
security:
- JwtRegular: []
tags:
- "Layers"
summary: "Get all timeslices for the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/TimeSliceCollection"
'404':
description: "Layer not found"
#endregion
#region Function Calls
/rfc/run:
post:
operationId: "routes.functions.run_agi_clustering_and_graph_creation"
security:
- JwtRegular: []
tags:
- "Remote function calls"
summary: "Insert locations from AGI, create clusters for starting time and location layers, create graphs for the location clusters"
parameters: []
responses:
'204':
description: "Successful operation"
#endregion
################################################################################
/connectedClusters:
get:
operationId: "routes.connClusters.get_conn_clusters"
security:
- JwtRegular: []
tags:
- "Connected"
summary: "Get connected Clusters data"
description: "Returns a dictionary of cluster. The clusters contain the associated connected clusters and connected nodes data."
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ConnectedDict"
/clusterSimilarity:
get:
operationId: "routes.similarity.get_similarity"
security:
- JwtRegular: []
tags:
- "Similarity"
summary: "Get data of the similarity between clusters."
parameters:
- name: "layer_name"
in: "query"
description: "Name of the layer"
required: true
type: "string"
- name: "batchNr"
in: "query"
description: "Batch number (starting from 0)"
required: true
type: "integer"
description: "Data is returned in batches of size 1000. Returns a dictionary where the key is a tuple of cluster_labels (i.e. [0,319]) and the value is the computed similarity between 2 clusters in the tuple, in regard to each layer in the input. \n Note: the tuple clusters have the same layer and the computed similarity is in regard to clusters from OTHER layers."
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ClusterSimilarityArray"
/clusterRunArray:
get:
operationId: "routes.connRun.get_connected_run"
security:
- JwtRegular: []
tags:
- "RunId"
summary: "Get RunId"
description: "Returns the RunId and the associated datetime when a connection of clusters/simillarity of clusters was computed."
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ClusterRunArray"
definitions:
Cluster:
type: object
properties:
layer_name:
type: string
cluster_label:
type: number
nodes:
type: array
items:
$ref: "#/definitions/Node"
ClusterCollection:
type: array
items:
$ref: "#/definitions/Cluster"
Layer:
type: object
properties:
layer_name:
type: string
properties:
type: array
items:
type: string
use_case:
type: string
LayerCollection:
type: array
items:
$ref: "#/definitions/Layer"
Node:
type: object
example:
"UniqueID": "4437d98b4516e899fb7d93cef0bea6111574473703f0aab9d8c2f02aaa673f5c"
"use_case": "string"
"layer_name": "some_layer_name"
"Finished_time": 1576631193265951
"Latitude_Destination": -5.973257
"Longitude_Destination": 37.416316
"TravelID": "5e57ec9159bc0668543f156a"
"TravelPrice": 15
"UserID": "a95075f5042b1b27060080156d87fe34ec7e712c"
NodeCollection:
type: array
items:
$ref: "#/definitions/Node"
TimeSlice:
type: object
properties:
time:
type: object
example: "(2020, 52)"
layer_name:
type: string
clusters:
type: object
additionalProperties:
type: array
items:
type: object
properties:
UniqueID:
type: string
example:
"0":
- UniqueID: abc
- UniqueID: def
TimeSliceCollection:
type: array
items:
$ref: "#/definitions/TimeSlice"
##################################################################
ConnectedDict:
type: array
items:
$ref: "#/definitions/ConnectedCluster"
ConnectedCluster:
type: object
properties:
cluster_label:
type: string
example: "6"
cluster_layer:
type: string
example: "Price_Layer"
cluster_runId:
type: string
example: "5efdc04ac43add0aba567d76"
cluster_containedNodesDict:
type: array
items:
type: string
example: "2696718d7a33ab3dbf28e9c88411afcfe9a933a45e57ec9159bc0668543f1568"
cluster_connNodesDict:
type: array
items:
$ref: "#/definitions/ConnectedNode"
cluster_connClustDict:
type: array
items:
$ref: "#/definitions/ConnectedClusterAux"
ConnectedClusterAux:
type: object
properties:
cluster_label:
type: string
example: "-1"
cluster_layer:
type: string
example: "FinishedTime_Layer"
connectionWeight:
type: number
example: 42
ConnectedNode: paths:
type: object $ref: 'routes.yml#paths'
properties: \ No newline at end of file
node_id:
type: string
node_cluster:
type: string
node_layer:
type: string
example:
"node_id": "27a08ed0facc7d68a0818c7695dad391cf48d6095e57ec9159bc0668543f159b"
"node_cluster": "2230"
"node_layer": "Destination_Layer"
#not used, should be removed?
#finished_time
#latitude_Destination
#longitude_Destination
#travelID
#travelPrice
#userID
ClusterSimilarityArray:
type: array
items:
$ref: "#/definitions/ClusterSimilarityDictionary"
ClusterSimilarityDictionary:
properties:
cluster1_label:
type: string
example: "0"
cluster2_label:
type: string
example: "1"
cluster_layer:
type: string
example: "Price_Layer"
similarityValues:
type: object
additionalProperties:
type: number
example:
"layer_name": similarityValue
"StartingPoint_Layer": 39.0,
"StartingTime_Layer": 99.0101004948485
runId:
type: string
example: "5efdc04ac43add0aba567d76"
ClusterRunArray:
type: array
items:
$ref: "#/definitions/ClusterRun"
ClusterRun:
type: object
properties:
_id:
type: string
example: "5efdc04ac43add0aba567d76"
Datetime:
type: string
example: "2020-07-02 14:19:51.651764"
\ No newline at end of file
...@@ -4,9 +4,6 @@ info: ...@@ -4,9 +4,6 @@ info:
description: This is the documentation for the role stage discovery microservice. description: This is the documentation for the role stage discovery microservice.
version: "1.0.0" version: "1.0.0"
# Import security definitions from global security definition
consumes: consumes:
- "application/json" - "application/json"
produces: produces:
...@@ -14,423 +11,9 @@ produces: ...@@ -14,423 +11,9 @@ produces:
basePath: "/api" basePath: "/api"
paths: # Import security definitions from global security definition
/debug: securityDefinitions:
post: $ref: '../../../../modules/security/security_local.yml#securityDefinitions'
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
#region Layers
/layers:
post:
operationId: "routes.layers.post"
tags:
- "Layers"
summary: "Add a new layer [TODO: or overwrite an existing one]"
parameters:
- in: body
name: "layer"
description: "The layer data to be added"
required: true
schema:
$ref: "#/definitions/Layer"
responses:
'201':
description: "Successful operation"
'400':
description: "Invalid input"
get:
operationId: "routes.layers.get"
tags:
- "Layers"
summary: "Get all layer data"
parameters: []
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/LayerCollection"
/layers/{name}:
get:
operationId: "routes.layers.get_by_name"
tags:
- "Layers"
summary: "Get single layer data"
parameters:
- name: "name"
in: "path"
description: "Name of the requested layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/Layer"
'404':
description: "Layer not found"
/layers/{name}/nodes:
get:
operationId: "routes.layers.get_nodes"
tags:
- "Layers"
summary: "Get all individual nodes for the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/NodeCollection"
'404':
description: "Layer not found"
post:
operationId: "routes.layers.post_nodes"
tags:
- "Layers"
summary: "Adds a single or multiple nodes to the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
- name: "node"
in: body
description: "The node(s) to be added"
required: true
schema:
$ref: "#/definitions/NodeCollection"
responses:
'201':
description: "Successful operation"
'400':
description: "Invalid input"
/layers/{name}/clusters:
get:
operationId: "routes.clustersets.get_by_name"
tags:
- "Layers"
summary: "Get all clusters for the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ClusterCollection"
'404':
description: "Layer not found"
/layers/{name}/timeslices:
get:
operationId: "routes.timeslices.get_by_name"
tags:
- "Layers"
summary: "Get all timeslices for the layer"
parameters:
- name: "name"
in: "path"
description: "Name of the layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/TimeSliceCollection"
'404':
description: "Layer not found"
#endregion
#region Function Calls
/rfc/run:
post:
operationId: "routes.functions.run_agi_clustering_and_graph_creation"
tags:
- "Remote function calls"
summary: "Insert locations from AGI, create clusters for starting time and location layers, create graphs for the location clusters"
parameters: []
responses:
'204':
description: "Successful operation"
#endregion
################################################################################
/connectedClusters:
get:
operationId: "routes.connClusters.get_conn_clusters"
tags:
- "Connected"
summary: "Get connected Clusters data"
description: "Returns a dictionary of cluster. The clusters contain the associated connected clusters and connected nodes data."
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ConnectedDict"
/clusterSimilarity:
get:
operationId: "routes.similarity.get_similarity"
tags:
- "Similarity"
summary: "Get data of the similarity between clusters."
parameters:
- name: "layer_name"
in: "query"
description: "Name of the layer"
required: true
type: "string"
- name: "batchNr"
in: "query"
description: "Batch number (starting from 0)"
required: true
type: "integer"
description: "Data is returned in batches of size 1000. Returns a dictionary where the key is a tuple of cluster_labels (i.e. [0,319]) and the value is the computed similarity between 2 clusters in the tuple, in regard to each layer in the input. \n Note: the tuple clusters have the same layer and the computed similarity is in regard to clusters from OTHER layers."
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ClusterSimilarityArray"
/clusterRunArray:
get:
operationId: "routes.connRun.get_connected_run"
tags:
- "RunId"
summary: "Get RunId"
description: "Returns the RunId and the associated datetime when a connection of clusters/simillarity of clusters was computed."
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/ClusterRunArray"
definitions:
Cluster:
type: object
properties:
layer_name:
type: string
cluster_label:
type: number
nodes:
type: array
items:
$ref: "#/definitions/Node"
ClusterCollection:
type: array
items:
$ref: "#/definitions/Cluster"
Layer:
type: object
properties:
layer_name:
type: string
properties:
type: array
items:
type: string
use_case:
type: string
LayerCollection:
type: array
items:
$ref: "#/definitions/Layer"
Node:
type: object
example:
"UniqueID": "4437d98b4516e899fb7d93cef0bea6111574473703f0aab9d8c2f02aaa673f5c"
"use_case": "string"
"layer_name": "some_layer_name"
"Finished_time": 1576631193265951
"Latitude_Destination": -5.973257
"Longitude_Destination": 37.416316
"TravelID": "5e57ec9159bc0668543f156a"
"TravelPrice": 15
"UserID": "a95075f5042b1b27060080156d87fe34ec7e712c"
NodeCollection:
type: array
items:
$ref: "#/definitions/Node"
TimeSlice:
type: object
properties:
time:
type: object
example: "(2020, 52)"
layer_name:
type: string
clusters:
type: object
additionalProperties:
type: array
items:
type: object
properties:
UniqueID:
type: string
example:
"0":
- UniqueID: abc
- UniqueID: def
TimeSliceCollection:
type: array
items:
$ref: "#/definitions/TimeSlice"
##################################################################
ConnectedDict:
type: array
items:
$ref: "#/definitions/ConnectedCluster"
ConnectedCluster:
type: object
properties:
cluster_label:
type: string
example: "6"
cluster_layer:
type: string
example: "Price_Layer"
cluster_runId:
type: string
example: "5efdc04ac43add0aba567d76"
cluster_containedNodesDict:
type: array
items:
type: string
example: "2696718d7a33ab3dbf28e9c88411afcfe9a933a45e57ec9159bc0668543f1568"
cluster_connNodesDict:
type: array
items:
$ref: "#/definitions/ConnectedNode"
cluster_connClustDict:
type: array
items:
$ref: "#/definitions/ConnectedClusterAux"
ConnectedClusterAux:
type: object
properties:
cluster_label:
type: string
example: "-1"
cluster_layer:
type: string
example: "FinishedTime_Layer"
connectionWeight:
type: number
example: 42
ConnectedNode: paths:
type: object $ref: 'routes.yml#paths'
properties: \ No newline at end of file
node_id:
type: string
node_cluster:
type: string
node_layer:
type: string
example:
"node_id": "27a08ed0facc7d68a0818c7695dad391cf48d6095e57ec9159bc0668543f159b"
"node_cluster": "2230"
"node_layer": "Destination_Layer"
#not used, should be removed?
#finished_time
#latitude_Destination
#longitude_Destination
#travelID
#travelPrice
#userID
ClusterSimilarityArray:
type: array
items:
$ref: "#/definitions/ClusterSimilarityDictionary"
ClusterSimilarityDictionary:
properties:
cluster1_label:
type: string
example: "0"
cluster2_label:
type: string
example: "1"
cluster_layer:
type: string
example: "Price_Layer"
similarityValues:
type: object
additionalProperties:
type: number
example:
"layer_name": similarityValue
"StartingPoint_Layer": 39.0,
"StartingTime_Layer": 99.0101004948485
runId:
type: string
example: "5efdc04ac43add0aba567d76"
ClusterRunArray:
type: array
items:
$ref: "#/definitions/ClusterRun"
ClusterRun:
type: object
properties:
_id:
type: string
example: "5efdc04ac43add0aba567d76"
Datetime:
type: string
example: "2020-07-02 14:19:51.651764"
\ No newline at end of file
...@@ -15,7 +15,7 @@ LOGGER = logging.getLogger(__name__) ...@@ -15,7 +15,7 @@ LOGGER = logging.getLogger(__name__)
import connexion import connexion
from security import swagger_util from security import swagger_util
from pathlib import Path from pathlib import Path
from env_info import is_running_locally from env_info import is_running_locally, get_resources_path
# load swagger config # load swagger config
app = connexion.App(__name__, specification_dir='configs/') app = connexion.App(__name__, specification_dir='configs/')
...@@ -25,19 +25,13 @@ def api_root(): ...@@ -25,19 +25,13 @@ def api_root():
return 'Endpoint of role-stage-discovery-microservice!' return 'Endpoint of role-stage-discovery-microservice!'
# SSL configuration # SSL configuration
try: certificate_path = get_resources_path()
# should be ../../../modules/certificate local
certificate_path = os.environ['ARTICONF_CERTIFICATE_PATH']
except KeyError:
certificate_path = '/srv/articonf/'
context = (os.path.normpath(f'{certificate_path}/articonf1.crt'), os.path.normpath(f'{certificate_path}/articonf1.key')) # certificate and key files context = (os.path.normpath(f'{certificate_path}/articonf1.crt'), os.path.normpath(f'{certificate_path}/articonf1.key')) # certificate and key files
if is_running_locally(): if is_running_locally():
# Local Mode print("Running locally...")
print("Running with local settings...")
app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger_local.yml")), app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger_local.yml")),
resolver = connexion.RestyResolver("cms_rest_api")) resolver = connexion.RestyResolver("cms_rest_api"))
context = 'adhoc'
else: else:
app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger.yml")), app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger.yml")),
resolver = connexion.RestyResolver("cms_rest_api")) resolver = connexion.RestyResolver("cms_rest_api"))
......
paths:
/debug:
post:
security:
- JwtRegular: []
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
# nodes region
/use-cases/{use_case}/layers/{layer_name}/nodes:
get:
security:
- JwtRegular: []
operationId: "routes.nodes.nodes_for_use_case_and_layer"
tags:
- "Nodes"
summary: "Get all nodes for a Layer"
parameters:
- name: "use_case"
in: "path"
description: "Name of the requested Use-Case"
required: true
type: "string"
- name: "layer_name"
in: "path"
description: "Name of the requested Layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/Node"
'404':
description: "No nodes found"
# endregion nodes
# Layers region
/layers:
get:
security:
- JwtRegular: []
operationId: "routes.layers.get"
tags:
- "Layers"
summary: "Get all layer data"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/LayerCollection"
/use-cases/{use_case}/layers/{name}:
get:
security:
- JwtRegular: []
operationId: "routes.layers.get_by_name_and_use_case"
tags:
- "Layers"
summary: "Get single layer data"
parameters:
- name: "use_case"
in: "path"
description: "Name of the requested Use-Case"
required: true
type: "string"
- name: "name"
in: "path"
description: "Name of the requested layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/Layer"
'404':
description: "Layer not found"
/use-cases/{use_case}/layers:
get:
security:
- JwtRegular: []
operationId: "routes.layers.get_by_use_case"
tags:
- "Layers"
summary: "Get all layer data for single use case"
parameters:
- name: "use_case"
in: "path"
description: "Name of the requested Use-Case"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/LayerCollection"
'404':
description: "No layers found"
# endregion layers
definitions:
NodeInfo:
type: "object"
properties:
label:
type: string
centrality:
type: number
adjacencies:
type: integer
degree:
type: number
betweenness:
type: object
properties:
to_node:
type: integer
value:
type: number
betweenness_centrality:
type: number
Layer:
type: object
properties:
use_case:
type: string
layer_name:
type: string
properties:
type: array
items:
type: string
total_properties:
type: array
items:
type: string
LayerCollection:
type: array
items:
$ref: "#/definitions/Layer"
Dataset:
type: object
properties:
usecase_name:
type: string
properties:
type: array
items:
type: string
DatasetCollection:
type: array
items:
$ref: "#/definitions/Dataset"
Node:
type: object
example:
"Finished_time": 1576631193265951
"Latitude_Destination": -5.973257
"Longitude_Destination": 37.416316
"TravelID": "5e57ec9159bc0668543f156a"
"TravelPrice": 15
"UniqueID": "a95075f5042b1b27060080156d87fe34ec7e712c5e57ec9159bc0668543f156a"
"UserID": "a95075f5042b1b27060080156d87fe34ec7e712c"
NodeCollection:
type: array
items:
$ref: "#/definitions/Node"
...@@ -4,10 +4,6 @@ info: ...@@ -4,10 +4,6 @@ info:
description: This is the documentation for the semantic linking microservice. description: This is the documentation for the semantic linking microservice.
version: "1.0.0" version: "1.0.0"
# Import security definitions from global security definition
securityDefinitions:
$ref: '../security/security.yml#securityDefinitions'
consumes: consumes:
- "application/json" - "application/json"
produces: produces:
...@@ -15,186 +11,9 @@ produces: ...@@ -15,186 +11,9 @@ produces:
basePath: "/api" basePath: "/api"
paths: # Import security definitions from global security definition
/debug: securityDefinitions:
post: $ref: '../security/security.yml#securityDefinitions'
security:
- JwtRegular: []
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
# nodes region
/use-cases/{use_case}/layers/{layer_name}/nodes:
get:
security:
- JwtRegular: []
operationId: "routes.nodes.nodes_for_use_case_and_layer"
tags:
- "Nodes"
summary: "Get all nodes for a Layer"
parameters:
- name: "use_case"
in: "path"
description: "Name of the requested Use-Case"
required: true
type: "string"
- name: "layer_name"
in: "path"
description: "Name of the requested Layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/Node"
'404':
description: "No nodes found"
# endregion nodes
# Layers region
/layers:
get:
security:
- JwtRegular: []
operationId: "routes.layers.get"
tags:
- "Layers"
summary: "Get all layer data"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/LayerCollection"
/use-cases/{use_case}/layers/{name}:
get:
security:
- JwtRegular: []
operationId: "routes.layers.get_by_name_and_use_case"
tags:
- "Layers"
summary: "Get single layer data"
parameters:
- name: "use_case"
in: "path"
description: "Name of the requested Use-Case"
required: true
type: "string"
- name: "name"
in: "path"
description: "Name of the requested layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/Layer"
'404':
description: "Layer not found"
/use-cases/{use_case}/layers:
get:
security:
- JwtRegular: []
operationId: "routes.layers.get_by_use_case"
tags:
- "Layers"
summary: "Get all layer data for single use case"
parameters:
- name: "use_case"
in: "path"
description: "Name of the requested Use-Case"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/LayerCollection"
'404':
description: "No layers found"
# endregion layers
definitions:
NodeInfo:
type: "object"
properties:
label:
type: string
centrality:
type: number
adjacencies:
type: integer
degree:
type: number
betweenness:
type: object
properties:
to_node:
type: integer
value:
type: number
betweenness_centrality:
type: number
Layer:
type: object
properties:
use_case:
type: string
layer_name:
type: string
properties:
type: array
items:
type: string
total_properties:
type: array
items:
type: string
LayerCollection:
type: array
items:
$ref: "#/definitions/Layer"
Dataset:
type: object
properties:
usecase_name:
type: string
properties:
type: array
items:
type: string
DatasetCollection:
type: array
items:
$ref: "#/definitions/Dataset"
Node:
type: object
example:
"Finished_time": 1576631193265951
"Latitude_Destination": -5.973257
"Longitude_Destination": 37.416316
"TravelID": "5e57ec9159bc0668543f156a"
"TravelPrice": 15
"UniqueID": "a95075f5042b1b27060080156d87fe34ec7e712c5e57ec9159bc0668543f156a"
"UserID": "a95075f5042b1b27060080156d87fe34ec7e712c"
NodeCollection: paths:
type: array $ref: 'routes.yml#paths'
items: \ No newline at end of file
$ref: "#/definitions/Node"
...@@ -11,177 +11,9 @@ produces: ...@@ -11,177 +11,9 @@ produces:
basePath: "/api" basePath: "/api"
paths: # Import security definitions from global security definition
/debug: securityDefinitions:
post: $ref: '../../../../modules/security/security_local.yml#securityDefinitions'
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
# nodes region
/use-cases/{use_case}/layers/{layer_name}/nodes:
get:
operationId: "routes.nodes.nodes_for_use_case_and_layer"
tags:
- "Nodes"
summary: "Get all nodes for a Layer"
parameters:
- name: "use_case"
in: "path"
description: "Name of the requested Use-Case"
required: true
type: "string"
- name: "layer_name"
in: "path"
description: "Name of the requested Layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/Node"
'404':
description: "No nodes found"
# endregion nodes
# Layers region
/layers:
get:
operationId: "routes.layers.get"
tags:
- "Layers"
summary: "Get all layer data"
parameters: []
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/LayerCollection"
/use-cases/{use_case}/layers/{name}:
get:
operationId: "routes.layers.get_by_name_and_use_case"
tags:
- "Layers"
summary: "Get single layer data"
parameters:
- name: "use_case"
in: "path"
description: "Name of the requested Use-Case"
required: true
type: "string"
- name: "name"
in: "path"
description: "Name of the requested layer"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/Layer"
'404':
description: "Layer not found"
/use-cases/{use_case}/layers: paths:
get: $ref: 'routes.yml#paths'
operationId: "routes.layers.get_by_use_case" \ No newline at end of file
tags:
- "Layers"
summary: "Get all layer data for single use case"
parameters:
- name: "use_case"
in: "path"
description: "Name of the requested Use-Case"
required: true
type: "string"
responses:
'200':
description: "Successful operation"
schema:
$ref: "#/definitions/LayerCollection"
'404':
description: "No layers found"
# endregion layers
definitions:
NodeInfo:
type: "object"
properties:
label:
type: string
centrality:
type: number
adjacencies:
type: integer
degree:
type: number
betweenness:
type: object
properties:
to_node:
type: integer
value:
type: number
betweenness_centrality:
type: number
Layer:
type: object
properties:
use_case:
type: string
layer_name:
type: string
properties:
type: array
items:
type: string
total_properties:
type: array
items:
type: string
LayerCollection:
type: array
items:
$ref: "#/definitions/Layer"
Dataset:
type: object
properties:
usecase_name:
type: string
properties:
type: array
items:
type: string
DatasetCollection:
type: array
items:
$ref: "#/definitions/Dataset"
Node:
type: object
example:
"Finished_time": 1576631193265951
"Latitude_Destination": -5.973257
"Longitude_Destination": 37.416316
"TravelID": "5e57ec9159bc0668543f156a"
"TravelPrice": 15
"UniqueID": "a95075f5042b1b27060080156d87fe34ec7e712c5e57ec9159bc0668543f156a"
"UserID": "a95075f5042b1b27060080156d87fe34ec7e712c"
NodeCollection:
type: array
items:
$ref: "#/definitions/Node"
paths:
/tokens/{token}:
post:
operationId: "routes.user.verify"
tags:
- "User"
summary: "Verifies a user token"
description: "Verifies a user token"
parameters:
- name: "token"
in: "path"
description: "Target token that will be verified"
required: true
type: "string"
responses:
'200':
description: "Verification successful"
'401':
description: "Invalid token"
/tokens:
post:
operationId: "routes.user.authenticate"
tags:
- "User"
summary: "Authenticates user at the backend"
description: "Authenticates user at the backend creating a JWT token in the backend"
parameters:
- in: body
name: "Object"
required: true
schema:
$ref: '#/definitions/TokenRequest'
responses:
'200':
description: "Authentication successful"
schema:
$ref: "#/definitions/TokenReply"
'400':
description: "Wrong credentials"
/users/username/{username}:
delete:
security:
- JwtAdmin: []
operationId: "routes.user.delete"
tags:
- "User"
summary: "Deletes a user identified by the username from the database"
description: "Deletes a user identified by the username from the database"
parameters:
- name: "username"
in: "path"
description: "Username of the user to be deleted"
required: true
type: "string"
responses:
'204':
description: "Deletion succeeded"
'400':
description: "User does not exist"
/users:
get:
security:
- JwtAdmin: []
operationId: "routes.user.all"
tags:
- "User"
summary: "Retrieves all users from the database"
description: "Retrieves all users from the database"
responses:
'200':
description: complete user object including numeric ID
schema:
type: array
items:
$ref: "#/definitions/User"
'400':
description: wrong username or password
post:
security:
- JwtAdmin: []
operationId: "routes.user.add"
tags:
- "User"
summary: "Adds a new user to the database"
description: "Adds a new user to the database"
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
properties:
username:
type: string
example: "username@domain.com"
password:
type: string
example: "secure_passw0rd"
responses:
'201':
description: "User was added to the database"
'400':
description: "User already exists"
/debug:
post:
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
/trace:
post:
security:
- JwtRegular: []
operationId: "routes.blockchain_trace.receive"
tags:
- "Blockchain Trace"
summary: "Add a new blockchain trace to SMART"
description: "Receives a new blockchain trace to store in SMART."
parameters:
- in: body
name: "BlockchainTrace"
description: "The trace to be added"
required: true
schema:
$ref: "#/definitions/BlockchainTrace"
responses:
'201':
description: "Successfully added"
'400':
description: "Invalid input"
definitions:
TokenReply:
type: "object"
required:
- token
properties:
token:
type: string
example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InVzZXJuYW1lQGRvbWFpbi5jb20iLCJjcmVhdGVkX2F0IjoiMjAyMC0wNy0xNSAxNTo0Mzo0OC43MjQ4MjciLCJ2YWxpZF91bnRpbCI6IjIwMjAtMDctMTYgMTU6NDM6NDguNzI0ODI3In0.aR2Xe3pXj_MBS9UJKqhiq4u9M6Bv41ILPaKpA8BVzIY"
TokenRequest:
type: "object"
required:
- username
- password
properties:
username:
type: string
example: "username@domain.com"
password:
type: string
example: "secure_passw0rd"
User:
type: "object"
required:
- username
- password
- role
- created_at
- last_login
properties:
username:
type: string
example: "username@domain.com"
password:
type: string
example: "secure_passw0rd"
role:
type: string
example: "u"
created_at:
type: string
example: "2020-07-14 14:37:31.670671"
last_login:
type: string
example: "2020-07-14 14:37:31.670671"
BlockchainTrace:
type: "object"
properties:
TransactionId:
type: string
format: uuid
Timestamp:
type: "string"
format: "date-time"
ApplicationType:
type: "string"
TransactionFrom:
type: "string"
format: "uuid"
TransactionFromLatLng:
type: "string"
TransactionTo:
type: "string"
format: "uuid"
TransactionToLatLng:
type: "string"
TransferredAsset:
type: "string"
ResourceIds:
type: "string"
ResourceMd5:
type: "string"
ResourceState:
type: "string"
Metadata:
type: "string"
...@@ -4,10 +4,6 @@ info: ...@@ -4,10 +4,6 @@ info:
description: This is the documentation for the RESTful API gateway. description: This is the documentation for the RESTful API gateway.
version: "1.0.0" version: "1.0.0"
# Import security definitions from seperate file
securityDefinitions:
$ref: '../security/security.yml#securityDefinitions'
consumes: consumes:
- "application/json" - "application/json"
produces: produces:
...@@ -15,224 +11,10 @@ produces: ...@@ -15,224 +11,10 @@ produces:
basePath: "/api" basePath: "/api"
# Import security definitions from seperate file
securityDefinitions:
$ref: '../security/security.yml#securityDefinitions'
# Paths supported by the server application # Paths supported by the server application
paths: paths:
/tokens/{token}: $ref: 'routes.yml#paths'
post: \ No newline at end of file
operationId: "routes.user.verify"
tags:
- "User"
summary: "Verifies a user token"
description: "Verifies a user token"
parameters:
- name: "token"
in: "path"
description: "Target token that will be verified"
required: true
type: "string"
responses:
'200':
description: "Verification successful"
'401':
description: "Invalid token"
/tokens:
post:
operationId: "routes.user.authenticate"
tags:
- "User"
summary: "Authenticates user at the backend"
description: "Authenticates user at the backend creating a JWT token in the backend"
parameters:
- in: body
name: "Object"
required: true
schema:
$ref: '#/definitions/TokenRequest'
responses:
'200':
description: "Authentication successful"
schema:
$ref: "#/definitions/TokenReply"
'400':
description: "Wrong credentials"
/users/username/{username}:
delete:
security:
- JwtAdmin: []
operationId: "routes.user.delete"
tags:
- "User"
summary: "Deletes a user identified by the username from the database"
description: "Deletes a user identified by the username from the database"
parameters:
- name: "username"
in: "path"
description: "Username of the user to be deleted"
required: true
type: "string"
responses:
'204':
description: "Deletion succeeded"
'400':
description: "User does not exist"
/users:
get:
security:
- JwtAdmin: []
operationId: "routes.user.all"
tags:
- "User"
summary: "Retrieves all users from the database"
description: "Retrieves all users from the database"
responses:
'200':
description: complete user object including numeric ID
schema:
type: array
items:
$ref: "#/definitions/User"
'400':
description: wrong username or password
post:
security:
- JwtAdmin: []
operationId: "routes.user.add"
tags:
- "User"
summary: "Adds a new user to the database"
description: "Adds a new user to the database"
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
properties:
username:
type: string
example: "username@domain.com"
password:
type: string
example: "secure_passw0rd"
responses:
'201':
description: "User was added to the database"
'400':
description: "User already exists"
/debug:
post:
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
/trace:
post:
security:
- JwtRegular: []
operationId: "routes.blockchain_trace.receive"
tags:
- "Blockchain Trace"
summary: "Add a new blockchain trace to SMART"
description: "Receives a new blockchain trace to store in SMART."
parameters:
- in: body
name: "BlockchainTrace"
description: "The trace to be added"
required: true
schema:
$ref: "#/definitions/BlockchainTrace"
responses:
'201':
description: "Successfully added"
'400':
description: "Invalid input"
definitions:
TokenReply:
type: "object"
required:
- token
properties:
token:
type: string
example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InVzZXJuYW1lQGRvbWFpbi5jb20iLCJjcmVhdGVkX2F0IjoiMjAyMC0wNy0xNSAxNTo0Mzo0OC43MjQ4MjciLCJ2YWxpZF91bnRpbCI6IjIwMjAtMDctMTYgMTU6NDM6NDguNzI0ODI3In0.aR2Xe3pXj_MBS9UJKqhiq4u9M6Bv41ILPaKpA8BVzIY"
TokenRequest:
type: "object"
required:
- username
- password
properties:
username:
type: string
example: "username@domain.com"
password:
type: string
example: "secure_passw0rd"
User:
type: "object"
required:
- username
- password
- role
- created_at
- last_login
properties:
username:
type: string
example: "username@domain.com"
password:
type: string
example: "secure_passw0rd"
role:
type: string
example: "u"
created_at:
type: string
example: "2020-07-14 14:37:31.670671"
last_login:
type: string
example: "2020-07-14 14:37:31.670671"
BlockchainTrace:
type: "object"
properties:
TransactionId:
type: string
format: uuid
Timestamp:
type: "string"
format: "date-time"
ApplicationType:
type: "string"
TransactionFrom:
type: "string"
format: "uuid"
TransactionFromLatLng:
type: "string"
TransactionTo:
type: "string"
format: "uuid"
TransactionToLatLng:
type: "string"
TransferredAsset:
type: "string"
ResourceIds:
type: "string"
ResourceMd5:
type: "string"
ResourceState:
type: "string"
Metadata:
type: "string"
...@@ -4,7 +4,6 @@ info: ...@@ -4,7 +4,6 @@ info:
description: This is the documentation for the RESTful API gateway. description: This is the documentation for the RESTful API gateway.
version: "1.0.0" version: "1.0.0"
consumes: consumes:
- "application/json" - "application/json"
produces: produces:
...@@ -12,216 +11,10 @@ produces: ...@@ -12,216 +11,10 @@ produces:
basePath: "/api" basePath: "/api"
# Import security definitions from seperate file
securityDefinitions:
$ref: '../../../modules/security/security_local.yml#securityDefinitions'
# Paths supported by the server application # Paths supported by the server application
paths: paths:
/tokens/{token}: $ref: 'routes.yml#paths'
post: \ No newline at end of file
operationId: "routes.user.verify"
tags:
- "User"
summary: "Verifies a user token"
description: "Verifies a user token"
parameters:
- name: "token"
in: "path"
description: "Target token that will be verified"
required: true
type: "string"
responses:
'200':
description: "Verification successful"
'401':
description: "Invalid token"
/tokens:
post:
operationId: "routes.user.authenticate"
tags:
- "User"
summary: "Authenticates user at the backend"
description: "Authenticates user at the backend creating a JWT token in the backend"
parameters:
- in: body
name: "Object"
required: true
schema:
$ref: '#/definitions/TokenRequest'
responses:
'200':
description: "Authentication successful"
schema:
$ref: "#/definitions/TokenReply"
'400':
description: "Wrong credentials"
/users/username/{username}:
delete:
operationId: "routes.user.delete"
tags:
- "User"
summary: "Deletes a user identified by the username from the database"
description: "Deletes a user identified by the username from the database"
parameters:
- name: "username"
in: "path"
description: "Username of the user to be deleted"
required: true
type: "string"
responses:
'204':
description: "Deletion succeeded"
'400':
description: "User does not exist"
/users:
get:
operationId: "routes.user.all"
tags:
- "User"
summary: "Retrieves all users from the database"
description: "Retrieves all users from the database"
responses:
'200':
description: complete user object including numeric ID
schema:
type: array
items:
$ref: "#/definitions/User"
'400':
description: wrong username or password
post:
operationId: "routes.user.add"
tags:
- "User"
summary: "Adds a new user to the database"
description: "Adds a new user to the database"
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
properties:
username:
type: string
example: "username@domain.com"
password:
type: string
example: "secure_passw0rd"
responses:
'201':
description: "User was added to the database"
'400':
description: "User already exists"
/debug:
post:
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
/trace:
post:
operationId: "routes.blockchain_trace.receive"
tags:
- "Blockchain Trace"
summary: "Add a new blockchain trace to SMART"
description: "Receives a new blockchain trace to store in SMART."
parameters:
- in: body
name: "BlockchainTrace"
description: "The trace to be added"
required: true
schema:
$ref: "#/definitions/BlockchainTrace"
responses:
'201':
description: "Successfully added"
'400':
description: "Invalid input"
definitions:
TokenReply:
type: "object"
required:
- token
properties:
token:
type: string
example: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InVzZXJuYW1lQGRvbWFpbi5jb20iLCJjcmVhdGVkX2F0IjoiMjAyMC0wNy0xNSAxNTo0Mzo0OC43MjQ4MjciLCJ2YWxpZF91bnRpbCI6IjIwMjAtMDctMTYgMTU6NDM6NDguNzI0ODI3In0.aR2Xe3pXj_MBS9UJKqhiq4u9M6Bv41ILPaKpA8BVzIY"
TokenRequest:
type: "object"
required:
- username
- password
properties:
username:
type: string
example: "username@domain.com"
password:
type: string
example: "secure_passw0rd"
User:
type: "object"
required:
- username
- password
- role
- created_at
- last_login
properties:
username:
type: string
example: "username@domain.com"
password:
type: string
example: "secure_passw0rd"
role:
type: string
example: "u"
created_at:
type: string
example: "2020-07-14 14:37:31.670671"
last_login:
type: string
example: "2020-07-14 14:37:31.670671"
BlockchainTrace:
type: "object"
properties:
TransactionId:
type: string
format: uuid
Timestamp:
type: "string"
format: "date-time"
ApplicationType:
type: "string"
TransactionFrom:
type: "string"
format: "uuid"
TransactionFromLatLng:
type: "string"
TransactionTo:
type: "string"
format: "uuid"
TransactionToLatLng:
type: "string"
TransferredAsset:
type: "string"
ResourceIds:
type: "string"
ResourceMd5:
type: "string"
ResourceState:
type: "string"
Metadata:
type: "string"
# Paths supported by the server application
paths:
/transactions:
delete:
security:
- JwtRegular: []
operationId: "routes.transactions.delete_all_transactions"
tags:
- "Transactions"
summary: "Delete all Transactions in the DB"
description: "Delete all Transactions in the DB"
responses:
'200':
description: "Successful Request"
/use_cases/{use_case}/transactions-failed:
delete:
security:
- JwtRegular: []
operationId: "routes.transactions.delete_all_failed_for_use_case"
tags:
- "Transactions"
summary: "Deletes all failed Transactions in the given Use-Case"
description: "Deletes all failed Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
get:
security:
- JwtRegular: []
operationId: "routes.transactions.all_failed_for_use_case"
tags:
- "Transactions"
summary: "Retrieves all failed Transactions in the given Use-Case"
description: "Retrieves all failed Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
/use_cases/{use_case}/transactions:
get:
security:
- JwtRegular: []
operationId: "routes.transactions.all_for_use_case"
tags:
- "Transactions"
summary: "Retrieves all Transactions in the given Use-Case"
description: "Retrieves all Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
/debug:
post:
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
\ No newline at end of file
...@@ -15,84 +15,5 @@ basePath: "/api" ...@@ -15,84 +15,5 @@ basePath: "/api"
securityDefinitions: securityDefinitions:
$ref: '../security/security.yml#securityDefinitions' $ref: '../security/security.yml#securityDefinitions'
# Paths supported by the server application
paths: paths:
/transactions: $ref: 'routes.yml#paths'
delete: \ No newline at end of file
security:
- JwtRegular: []
operationId: "routes.transactions.delete_all_transactions"
tags:
- "Transactions"
summary: "Delete all Transactions in the DB"
description: "Delete all Transactions in the DB"
responses:
'200':
description: "Successful Request"
/use_cases/{use_case}/transactions-failed:
delete:
security:
- JwtRegular: []
operationId: "routes.transactions.delete_all_failed_for_use_case"
tags:
- "Transactions"
summary: "Deletes all failed Transactions in the given Use-Case"
description: "Deletes all failed Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
get:
security:
- JwtRegular: []
operationId: "routes.transactions.all_failed_for_use_case"
tags:
- "Transactions"
summary: "Retrieves all failed Transactions in the given Use-Case"
description: "Retrieves all failed Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
/use_cases/{use_case}/transactions:
get:
security:
- JwtRegular: []
operationId: "routes.transactions.all_for_use_case"
tags:
- "Transactions"
summary: "Retrieves all Transactions in the given Use-Case"
description: "Retrieves all Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
/debug:
post:
operationId: "routes.debug.echo"
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
\ No newline at end of file
...@@ -11,76 +11,9 @@ produces: ...@@ -11,76 +11,9 @@ produces:
basePath: "/api" basePath: "/api"
# Paths supported by the server application # Import security definitions from seperate file
paths: securityDefinitions:
/transactions: $ref: '../../../../modules/security/security_local.yml#securityDefinitions'
delete:
operationId: "routes.transactions.delete_all_transactions"
tags:
- "Transactions"
summary: "Delete all Transactions in the DB"
description: "Delete all Transactions in the DB"
responses:
'200':
description: "Successful Request"
/use_cases/{use_case}/transactions-failed:
delete:
operationId: "routes.transactions.delete_all_failed_for_use_case"
tags:
- "Transactions"
summary: "Deletes all failed Transactions in the given Use-Case"
description: "Deletes all failed Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
get:
operationId: "routes.transactions.all_failed_for_use_case"
tags:
- "Transactions"
summary: "Retrieves all failed Transactions in the given Use-Case"
description: "Retrieves all failed Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
/use_cases/{use_case}/transactions:
get:
operationId: "routes.transactions.all_for_use_case"
tags:
- "Transactions"
summary: "Retrieves all Transactions in the given Use-Case"
description: "Retrieves all Transactions in the given Use-Case"
parameters:
- in: path
name: "use_case"
required: true
type: "string"
responses:
'200':
description: "Successful Request"
/debug: paths:
post: $ref: 'routes.yml#paths'
operationId: "routes.debug.echo" \ No newline at end of file
tags:
- "Echo"
summary: "Echo function for debugging purposes"
description: "Echoes the input back to the caller."
parameters:
- in: body
name: "Object"
required: true
schema:
type: object
responses:
'200':
description: "Successful echo of request data"
\ No newline at end of file
...@@ -17,7 +17,7 @@ LOGGER = logging.getLogger(__name__) ...@@ -17,7 +17,7 @@ LOGGER = logging.getLogger(__name__)
############################# #############################
import connexion import connexion
from security import swagger_util from security import swagger_util
from env_info import is_running_locally from env_info import is_running_locally, get_resources_path
from database.repository import Repository from database.repository import Repository
from messaging.MessageHandler import MessageHandler from messaging.MessageHandler import MessageHandler
...@@ -36,18 +36,13 @@ def api_root(): ...@@ -36,18 +36,13 @@ def api_root():
return 'Endpoint of trace-retrieval-microservice!' return 'Endpoint of trace-retrieval-microservice!'
# SSL configuration # SSL configuration
try: certificate_path = get_resources_path()
certificate_path = os.environ['ARTICONF_CERTIFICATE_PATH']
except KeyError:
certificate_path = '/srv/articonf/'
context = (os.path.normpath(f'{certificate_path}/articonf1.crt'), os.path.normpath(f'{certificate_path}/articonf1.key')) # certificate and key files context = (os.path.normpath(f'{certificate_path}/articonf1.crt'), os.path.normpath(f'{certificate_path}/articonf1.key')) # certificate and key files
if is_running_locally(): if is_running_locally():
# Local Mode print("Running locally...")
print("Running with local settings...")
app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger_local.yml")), app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger_local.yml")),
resolver = connexion.RestyResolver("cms_rest_api")) resolver = connexion.RestyResolver("cms_rest_api"))
context = 'adhoc'
else: else:
app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger.yml")), app.add_api(swagger_util.get_bundled_specs(Path("configs/swagger.yml")),
resolver = connexion.RestyResolver("cms_rest_api")) resolver = connexion.RestyResolver("cms_rest_api"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment