Skip to content

Instantly share code, notes, and snippets.

@fgeorgatos
Created October 29, 2021 14:57
Show Gist options
  • Save fgeorgatos/7daa883098e7746c72045e0b092da3f6 to your computer and use it in GitHub Desktop.
Save fgeorgatos/7daa883098e7746c72045e0b092da3f6 to your computer and use it in GitHub Desktop.
openapi.yml
openapi: "3.0.2"
info:
version: "1.0"
title: Custodian API
description: "We offer some API that provides custodian services"
contact:
name: Custodian team
url: https://gitlab.datascience.ch/custodian/contact
servers:
- url: "https://testing.swisscustodian.ch" ## FIXME
description: Test server
tags:
- name: "CME"
description: "Consent Management Engine"
externalDocs:
description: "CME Documentation"
url: "https://data-custodian.gitlab.io/documentation/devdoc/cme.html"
- name: "Access Control"
description: "Endpoints for PDP, PIP, ..."
externalDocs:
description: "ACS Documentation"
url: "https://data-custodian.gitlab.io/documentation/devdoc/acs.html"
- name: "CMS"
description: "Algorithms Deployment"
externalDocs:
description: "CMS Documentation"
url: "https://data-custodian.gitlab.io/documentation/devdoc/cms.html"
- name: "GPS"
description: "Endpoints for the GPS application"
externalDocs:
description: "GPS Documentation"
url: "https://data-custodian.gitlab.io/documentation/userdoc/index.html#userdoc" # FIXME: put link to documentation here
paths:
/accesscontrol-pdp/verify:
get:
tags:
- "Access Control"
summary: "Verify an authorization"
parameters:
- in: query
name: oid
schema:
type: string
required: true
description: OID of the data owner
- in: query
name: consent_author_oid
schema:
type: string
required: true
description: OID of the consent author
- in: query
name: fields
schema:
type: array
items:
type: string
required: true
description: the data fields whose permission must be verified
responses:
'200':
description: OK
/accesscontrol-pip/authorization:
get:
tags:
- "Access Control"
summary: "Get the consent corresponding to the owner oid, consent author oid and requested data fields, if it exists"
parameters:
- in: query
name: oid
schema:
type: string
required: true
description: OID of the data owner
- in: query
name: consent_author_oid
schema:
type: string
required: true
description: OID of the consent author
- in: query
name: fields
schema:
type: array
items:
type: string
required: true
description: the data fields whose permission must be verified
responses:
'200':
description: OK
/cme-signing/sign:
post:
tags:
- "CME"
summary: "Sign a consent"
requestBody:
required: true
description: "Consent signing template"
content:
application/json:
schema:
$ref: '#/components/schemas/ConsentAuthorization'
responses:
'200':
description: OK
/cme-signing/revoke:
put:
tags:
- "CME"
summary: "Revoke a consent consent"
requestBody:
required: true
description: "Consent signing template"
content:
application/json:
schema:
$ref: '#/components/schemas/ConsentAuthorization'
responses:
'200':
description: OK
/cme-consent/upload:
post:
tags:
- "CME"
summary: "Upload a new consent"
requestBody:
required: true
description: "Consent description"
content:
application/json:
schema:
$ref: '#/components/schemas/ConsentEnvelope'
responses:
'200':
description: OK
/cme-consent/modify:
put:
tags:
- "CME"
summary: "Modify consent"
requestBody:
required: true
description: "Consent description"
content:
application/json:
schema:
$ref: '#/components/schemas/ConsentEnvelope'
responses:
'200':
description: OK
/cme-consent/delete:
parameters:
- in: query
name: oid
description: The OID of the consent.
schema:
type: string
delete:
tags:
- "CME"
summary: "Remove an existing consent"
responses:
'200':
description: OK
/gps-cmd/submit:
post:
tags:
- "GPS"
summary: "submit gps data"
requestBody:
required: true
description: "Consent description"
content:
application/json:
schema:
$ref: '#/components/schemas/Submission'
responses:
'200':
description: OK
/gps-read/submission/{OID}:
get:
tags:
- "GPS"
summary: Get a submission by ID
parameters:
- in: path
name: OID
schema:
type: string
required: true
description: OID of the submission to get
responses:
'200':
description: Confirmation
content:
application/json:
schema:
$ref: '#/components/schemas/Submission'
/gps-read/submission/user/{ownerOID}:
get:
tags:
- "GPS"
summary: Get a submission by ID
parameters:
- in: path
name: ownerOID
schema:
type: string
required: true
description: OID of the submissions owner
responses:
'200':
description: Confirmation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Submission'
/ims/create:
post:
tags:
- "IMS"
summary: "Create a new user"
requestBody:
required: true
description: "User Description"
content:
application/json:
schema:
$ref: '#/components/schemas/User'
responses:
'200':
description: OK
/ims/pk:
get:
tags:
- "IMS"
summary: "Get a user's public key base on his/her temporary OID"
parameters:
- in: query
name: oid
schema:
type: string
required: true
description: User's temporary OID
responses:
'200':
description: OK
put:
tags:
- "IMS"
summary: "Add a public key to a user"
parameters:
- in: query
name: username
schema:
type: string
required: true
description: Username
- in: query
name: pk
schema:
type: string
required: true
description: New public key
responses:
'200':
description: OK
/ims/token:
get:
tags:
- "IMS"
summary: "Get an access token for the specified temporary OID"
parameters:
- in: query
name: oid
schema:
type: string
required: true
description: User's temporary OID
responses:
'200':
description: OK
/cms/deploy:
post:
tags:
- "CMS"
summary: "Deploy an algorithm"
security:
- OpenID: []
requestBody:
required: true
description: "Deployment description"
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentOrder'
responses:
'200':
description: OK
/cms/delete:
parameters:
- in: query
name: useroid
description: The OID of the User.
schema:
type: string
- in: query
name: image
description: The docker image of the algorithm.
schema:
type: string
delete:
tags:
- "CMS"
summary: "Stop an existing deployment"
security:
- OpenID: []
responses:
'200':
description: OK
components:
securitySchemes:
OpenID:
type: openIdConnect
openIdConnectUrl: /to/be/defined
responses:
NotFound:
description: The specified resource was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
schemas:
Error:
type: object
properties:
code:
type: string
message:
type: string
required:
- code
- message
ConsentEnvelope:
type: object
required:
- consent_body
- consent_header
properties:
consent_header:
$ref: '#/components/schemas/ConsentHeader'
consent_body:
$ref: '#/components/schemas/ConsentBody'
ConsentHeader:
type: object
required:
- signatory_party_oid
- signed_hash_b64
- timestamp
properties:
signatory_party_oid:
type: string
signed_hash_b64:
type: string
timestamp:
type: string
ConsentBody:
type: object
required:
- title
- description
- field
- creation_date
- expiration_date
- author_oid
properties:
title:
type: string
description:
type: string
field:
type: string
creation_date:
type: string
expiration_date:
type: string
author_oid:
type: string
ConsentAuthorization:
type: object
required:
- user_oid
- consent_oid
- signed_hash_b64
- timestamp
- validity
properties:
user_oid:
type: string
consent_oid:
type: string
signed_hash_b64:
type: string
timestamp:
type: string
validity:
type: boolean
Submission:
type: object
required:
- owner_oid
- data_content
properties:
owner_oid:
type: string
data_content:
type: object
User:
type: object
required:
- username
- attributes
properties:
username:
type: string
attributes:
$ref: '#/components/schemas/Attributes'
DeploymentOrder:
type: object
required:
- useroid
- image
properties:
useroid:
type: string
image:
type: string
Attributes:
type: object
additionalProperties:
type: array
items:
type: string
externalDocs:
description: Documentation and main site
url: https://data-custodian.gitlab.io/documentation/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment