Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
bde0fa8b
Commit
bde0fa8b
authored
Sep 15, 2020
by
Manuel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup of swagger .yml files, change main.py to use resource path
parent
f07010d7
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
968 additions
and
1830 deletions
+968
-1830
.swagger.yml.swp
...stage-discovery-microservice/app/configs/.swagger.yml.swp
+0
-0
routes.yml
.../role-stage-discovery-microservice/app/configs/routes.yml
+442
-0
swagger.yml
...role-stage-discovery-microservice/app/configs/swagger.yml
+5
-445
swagger_local.yml
...tage-discovery-microservice/app/configs/swagger_local.yml
+5
-422
main.py
src/data-hub/role-stage-discovery-microservice/app/main.py
+3
-9
routes.yml
...-hub/semantic-linking-microservice/app/configs/routes.yml
+183
-0
swagger.yml
...hub/semantic-linking-microservice/app/configs/swagger.yml
+5
-186
swagger_local.yml
...mantic-linking-microservice/app/configs/swagger_local.yml
+5
-173
routes.yml
src/rest-gateway/app/configs/routes.yml
+220
-0
swagger.yml
src/rest-gateway/app/configs/swagger.yml
+5
-223
swagger_local.yml
src/rest-gateway/app/configs/swagger_local.yml
+5
-212
routes.yml
...ub-in/trace-retrieval-microservice/app/configs/routes.yml
+81
-0
swagger.yml
...b-in/trace-retrieval-microservice/app/configs/swagger.yml
+1
-80
swagger_local.yml
...race-retrieval-microservice/app/configs/swagger_local.yml
+5
-72
main.py
...ansaction-hub-in/trace-retrieval-microservice/app/main.py
+3
-8
No files found.
src/data-hub/role-stage-discovery-microservice/app/configs/.swagger.yml.swp
deleted
100644 → 0
View file @
f07010d7
File deleted
src/data-hub/role-stage-discovery-microservice/app/configs/routes.yml
0 → 100644
View file @
bde0fa8b
This diff is collapsed.
Click to expand it.
src/data-hub/role-stage-discovery-microservice/app/configs/swagger.yml
View file @
bde0fa8b
This diff is collapsed.
Click to expand it.
src/data-hub/role-stage-discovery-microservice/app/configs/swagger_local.yml
View file @
bde0fa8b
This diff is collapsed.
Click to expand it.
src/data-hub/role-stage-discovery-microservice/app/main.py
View file @
bde0fa8b
...
...
@@ -15,7 +15,7 @@ LOGGER = logging.getLogger(__name__)
import
connexion
from
security
import
swagger_util
from
pathlib
import
Path
from
env_info
import
is_running_locally
from
env_info
import
is_running_locally
,
get_resources_path
# load swagger config
app
=
connexion
.
App
(
__name__
,
specification_dir
=
'configs/'
)
...
...
@@ -25,19 +25,13 @@ def api_root():
return
'Endpoint of role-stage-discovery-microservice!'
# SSL configuration
try
:
# should be ../../../modules/certificate local
certificate_path
=
os
.
environ
[
'ARTICONF_CERTIFICATE_PATH'
]
except
KeyError
:
certificate_path
=
'/srv/articonf/'
certificate_path
=
get_resources_path
()
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
():
# Local Mode
print
(
"Running with local settings..."
)
print
(
"Running locally..."
)
app
.
add_api
(
swagger_util
.
get_bundled_specs
(
Path
(
"configs/swagger_local.yml"
)),
resolver
=
connexion
.
RestyResolver
(
"cms_rest_api"
))
context
=
'adhoc'
else
:
app
.
add_api
(
swagger_util
.
get_bundled_specs
(
Path
(
"configs/swagger.yml"
)),
resolver
=
connexion
.
RestyResolver
(
"cms_rest_api"
))
...
...
src/data-hub/semantic-linking-microservice/app/configs/routes.yml
0 → 100644
View file @
bde0fa8b
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"
src/data-hub/semantic-linking-microservice/app/configs/swagger.yml
View file @
bde0fa8b
...
...
@@ -4,10 +4,6 @@ info:
description
:
This is the documentation for the semantic linking microservice.
version
:
"
1.0.0"
# Import security definitions from global security definition
securityDefinitions
:
$ref
:
'
../security/security.yml#securityDefinitions'
consumes
:
-
"
application/json"
produces
:
...
...
@@ -15,186 +11,9 @@ produces:
basePath
:
"
/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"
# Import security definitions from global security definition
securityDefinitions
:
$ref
:
'
../security/security.yml#securityDefinitions'
NodeCollection
:
type
:
array
items
:
$ref
:
"
#/definitions/Node"
paths
:
$ref
:
'
routes.yml#paths'
\ No newline at end of file
src/data-hub/semantic-linking-microservice/app/configs/swagger_local.yml
View file @
bde0fa8b
...
...
@@ -11,177 +11,9 @@ produces:
basePath
:
"
/api"
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"
# 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"
# Import security definitions from global security definition
securityDefinitions
:
$ref
:
'
../../../../modules/security/security_local.yml#securityDefinitions'
/use-cases/{use_case}/layers
:
get
:
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"
paths
:
$ref
:
'
routes.yml#paths'
\ No newline at end of file
src/rest-gateway/app/configs/routes.yml
0 → 100644
View file @
bde0fa8b
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"
src/rest-gateway/app/configs/swagger.yml
View file @
bde0fa8b
...
...
@@ -4,10 +4,6 @@ info:
description
:
This is the documentation for the RESTful API gateway.
version
:
"
1.0.0"
# Import security definitions from seperate file
securityDefinitions
:
$ref
:
'
../security/security.yml#securityDefinitions'
consumes
:
-
"
application/json"
produces
:
...
...
@@ -15,224 +11,10 @@ produces:
basePath
:
"
/api"
# Import security definitions from seperate file
securityDefinitions
:
$ref
:
'
../security/security.yml#securityDefinitions'
# Paths supported by the server application
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"
$ref
:
'
routes.yml#paths'
\ No newline at end of file
src/rest-gateway/app/configs/swagger_local.yml
View file @
bde0fa8b
...
...
@@ -4,7 +4,6 @@ info:
description
:
This is the documentation for the RESTful API gateway.
version
:
"
1.0.0"
consumes
:
-
"
application/json"
produces
:
...
...
@@ -12,216 +11,10 @@ produces:
basePath
:
"
/api"
# Import security definitions from seperate file
securityDefinitions
:
$ref
:
'
../../../modules/security/security_local.yml#securityDefinitions'
# Paths supported by the server application
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
:
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"
$ref
:
'
routes.yml#paths'
\ No newline at end of file
src/transaction-hub-in/trace-retrieval-microservice/app/configs/routes.yml
0 → 100644
View file @
bde0fa8b
# 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
src/transaction-hub-in/trace-retrieval-microservice/app/configs/swagger.yml
View file @
bde0fa8b
...
...
@@ -15,84 +15,5 @@ basePath: "/api"
securityDefinitions
:
$ref
:
'
../security/security.yml#securityDefinitions'
# 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
$ref
:
'
routes.yml#paths'
\ No newline at end of file
src/transaction-hub-in/trace-retrieval-microservice/app/configs/swagger_local.yml
View file @
bde0fa8b
...
...
@@ -11,76 +11,9 @@ produces:
basePath
:
"
/api"
# Paths supported by the server application
paths
:
/transactions
:
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"
# Import security definitions from seperate file
securityDefinitions
:
$ref
:
'
../../../../modules/security/security_local.yml#securityDefinitions'
/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
paths
:
$ref
:
'
routes.yml#paths'
\ No newline at end of file
src/transaction-hub-in/trace-retrieval-microservice/app/main.py
View file @
bde0fa8b
...
...
@@ -17,7 +17,7 @@ LOGGER = logging.getLogger(__name__)
#############################
import
connexion
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
messaging.MessageHandler
import
MessageHandler
...
...
@@ -36,18 +36,13 @@ def api_root():
return
'Endpoint of trace-retrieval-microservice!'
# SSL configuration
try
:
certificate_path
=
os
.
environ
[
'ARTICONF_CERTIFICATE_PATH'
]
except
KeyError
:
certificate_path
=
'/srv/articonf/'
certificate_path
=
get_resources_path
()
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
():
# Local Mode
print
(
"Running with local settings..."
)
print
(
"Running locally..."
)
app
.
add_api
(
swagger_util
.
get_bundled_specs
(
Path
(
"configs/swagger_local.yml"
)),
resolver
=
connexion
.
RestyResolver
(
"cms_rest_api"
))
context
=
'adhoc'
else
:
app
.
add_api
(
swagger_util
.
get_bundled_specs
(
Path
(
"configs/swagger.yml"
)),
resolver
=
connexion
.
RestyResolver
(
"cms_rest_api"
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment