first complete draft of the openapi spec
This commit is contained in:
parent
ec7f25e81a
commit
8bc20c6667
1 changed files with 151 additions and 20 deletions
|
@ -3,7 +3,9 @@ info:
|
||||||
version: v0.1.0
|
version: v0.1.0
|
||||||
title: Guichet API
|
title: Guichet API
|
||||||
description: |
|
description: |
|
||||||
*TODO DESCRIPTION*
|
Programmatic API for managing a user account in Deuxfleurs' Guichet.
|
||||||
|
|
||||||
|
*Disclaimer: this API is currently unstable and does not yet cover all the features availble from Guichet's web interface.*
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
/website:
|
/website:
|
||||||
|
@ -13,47 +15,94 @@ paths:
|
||||||
operationId: "ListWebsites"
|
operationId: "ListWebsites"
|
||||||
summary: "List all websites"
|
summary: "List all websites"
|
||||||
description: |
|
description: |
|
||||||
*TODO*
|
List all the user's websites
|
||||||
responses:
|
responses:
|
||||||
'500':
|
'500':
|
||||||
description: |
|
description: |
|
||||||
The server can not answer your request because it is in a bad state
|
The server can not answer your request because it is in a bad state
|
||||||
|
'200':
|
||||||
|
description: |
|
||||||
|
Returns information about all the user's websites, and user information related to websites.
|
||||||
|
The website quota (`quota_website_count`) indicates a quota in number of websites that the user is allowed to create.
|
||||||
|
TODO: document burst_bucket_quota_size
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
example: "user"
|
||||||
|
quota_website_count:
|
||||||
|
$ref: '#/components/schemas/Quota'
|
||||||
|
burst_bucket_quota_size:
|
||||||
|
type: string # TODO: improve?
|
||||||
|
example: "200 Mio"
|
||||||
|
vhosts:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Vhost'
|
||||||
|
|
||||||
/website/{vhost}:
|
/website/{vhost}:
|
||||||
|
parameters:
|
||||||
|
- name: vhost
|
||||||
|
in: path
|
||||||
|
description: "Website identifier"
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
style: simple
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Website
|
- Website
|
||||||
operationId: "GetWebsite"
|
operationId: "GetWebsite"
|
||||||
summary: "Get Website"
|
summary: "Details on a website"
|
||||||
description: |
|
description: |
|
||||||
*TODO*
|
Gets the configuration and status for the website `vhost`.
|
||||||
|
This includes information about domains, bucket access keys, and quotas.
|
||||||
|
|
||||||
|
`quota_size` is given in bytes.
|
||||||
|
`quota_files` indicates a number of files.
|
||||||
responses:
|
responses:
|
||||||
'500':
|
'500':
|
||||||
description: |
|
description: |
|
||||||
The server can not answer your request because it is in a bad state
|
The server can not answer your request because it is in a bad state
|
||||||
|
'404':
|
||||||
|
description: |
|
||||||
|
Website not found
|
||||||
|
'200':
|
||||||
|
description: |
|
||||||
|
Returns information about the website.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/WebsiteInfo'
|
||||||
|
|
||||||
post:
|
post:
|
||||||
tags:
|
tags:
|
||||||
- Website
|
- Website
|
||||||
operationId: "CreateWebsite"
|
operationId: "CreateWebsite"
|
||||||
summary: "Create a new website"
|
summary: "Create a new website"
|
||||||
description: |
|
description: |
|
||||||
Instructs this Garage node to connect to other Garage nodes at specified `<node_id>@<net_address>`. `node_id` is generated automatically on node start.
|
Creates a new website with identifier `vhost`.
|
||||||
requestBody:
|
|
||||||
required: true
|
|
||||||
content:
|
|
||||||
application/json:
|
|
||||||
schema:
|
|
||||||
# todo
|
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'500':
|
'500':
|
||||||
description: |
|
description: |
|
||||||
The server can not answer your request because it is in a bad state
|
The server can not answer your request because it is in a bad state
|
||||||
'400':
|
'400':
|
||||||
description: |
|
description: |
|
||||||
Your request is malformed, check your JSON
|
Your request is malformed, `vhost` must be non-empty.
|
||||||
|
'403':
|
||||||
|
description: |
|
||||||
|
Request forbidden, you have reached your quota of maximum number of websites allowed.
|
||||||
|
'200':
|
||||||
|
description: |
|
||||||
|
Returns information about the website that has been created.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/WebsiteInfo'
|
||||||
|
|
||||||
patch:
|
patch:
|
||||||
tags:
|
tags:
|
||||||
|
@ -61,14 +110,29 @@ paths:
|
||||||
operationId: "ConfigureWebsite"
|
operationId: "ConfigureWebsite"
|
||||||
summary: "Configure website"
|
summary: "Configure website"
|
||||||
description: |
|
description: |
|
||||||
Instructs this Garage node to connect to other Garage nodes at specified `<node_id>@<net_address>`. `node_id` is generated automatically on node start.
|
Modifies configuration of the website with identifier `vhost`.
|
||||||
|
|
||||||
requestBody:
|
requestBody:
|
||||||
required: true
|
required: true
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
# todo
|
type: object
|
||||||
|
properties:
|
||||||
|
quota_size:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
nullable: true
|
||||||
|
example: null
|
||||||
|
vhost:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
example: "my-website"
|
||||||
|
rotate_key:
|
||||||
|
type: boolean
|
||||||
|
nullable: true
|
||||||
|
example: true
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'500':
|
'500':
|
||||||
description: |
|
description: |
|
||||||
|
@ -76,6 +140,16 @@ paths:
|
||||||
'400':
|
'400':
|
||||||
description: |
|
description: |
|
||||||
Your request is malformed, check your JSON
|
Your request is malformed, check your JSON
|
||||||
|
'404':
|
||||||
|
description: |
|
||||||
|
Website not found
|
||||||
|
'200':
|
||||||
|
description: |
|
||||||
|
Returns updated information about the website
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/WebsiteInfo'
|
||||||
|
|
||||||
delete:
|
delete:
|
||||||
tags:
|
tags:
|
||||||
|
@ -83,21 +157,78 @@ paths:
|
||||||
operationId: "DeleteWebsite"
|
operationId: "DeleteWebsite"
|
||||||
summary: "Delete Website"
|
summary: "Delete Website"
|
||||||
description: |
|
description: |
|
||||||
*TODO*
|
Delete the website with identifier `vhost`.
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
'500':
|
'500':
|
||||||
description: |
|
description: |
|
||||||
The server can not answer your request because it is in a bad state
|
The server can not answer your request because it is in a bad state
|
||||||
|
'400':
|
||||||
|
description: |
|
||||||
|
Bad request, empty website identifier or website has unfinished uploads
|
||||||
|
'404':
|
||||||
|
description: |
|
||||||
|
Website not found
|
||||||
|
'204':
|
||||||
|
description: |
|
||||||
|
Success
|
||||||
|
|
||||||
|
|
||||||
components:
|
components:
|
||||||
securitySchemes:
|
securitySchemes:
|
||||||
basicAuth:
|
basicAuth:
|
||||||
type: http
|
type: http
|
||||||
scheme: basic
|
scheme: basic
|
||||||
schemas:
|
schemas:
|
||||||
# todo
|
WebsiteInfo:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
vhost:
|
||||||
|
$ref: '#/components/schemas/Vhost'
|
||||||
|
access_key_id:
|
||||||
|
type: string
|
||||||
|
example: "GK31c2f218a2e44f485b94239e"
|
||||||
|
secret_access_key:
|
||||||
|
type: string
|
||||||
|
example: "b892c0665f0ada8a4755dae98baa3b133590e11dae3bcc1f9d769d67f16c3835"
|
||||||
|
quota_size:
|
||||||
|
$ref: '#/components/schemas/Quota'
|
||||||
|
quota_files:
|
||||||
|
$ref: '#/components/schemas/Quota'
|
||||||
|
Vhost:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
example: "my-website"
|
||||||
|
alt_name:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
example: "my-other-website-name"
|
||||||
|
expanded:
|
||||||
|
type: boolean
|
||||||
|
example: false
|
||||||
|
domain:
|
||||||
|
type: string
|
||||||
|
example: "my-website.web.deuxfleurs.fr"
|
||||||
|
Quota:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
current:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
example: 1000
|
||||||
|
max:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
example: 5000
|
||||||
|
ratio:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
example: 0.2
|
||||||
|
burstable:
|
||||||
|
type: boolean
|
||||||
|
example: true
|
||||||
|
|
||||||
security:
|
security:
|
||||||
- basicAuth: []
|
- basicAuth: []
|
||||||
|
|
Loading…
Add table
Reference in a new issue