document heathz endpoint

This commit is contained in:
Nicola Murino 2020-11-01 10:39:10 +01:00
parent 641493e31a
commit 57bec976ae
No known key found for this signature in database
GPG key ID: 2F1FB59433D5A8CB
3 changed files with 95 additions and 79 deletions

10
go.mod
View file

@ -11,7 +11,7 @@ require (
github.com/aws/aws-sdk-go v1.35.19
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/eikenb/pipeat v0.0.0-20200430215831-470df5986b6d
github.com/fclairamb/ftpserverlib v0.8.1-0.20201007044523-7c6c9f869560
github.com/fclairamb/ftpserverlib v0.9.0
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-chi/chi v4.1.2+incompatible
github.com/go-chi/render v1.0.1
@ -26,7 +26,7 @@ require (
github.com/mitchellh/mapstructure v1.3.3 // indirect
github.com/otiai10/copy v1.2.0
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/pires/go-proxyproto v0.3.0
github.com/pires/go-proxyproto v0.3.1
github.com/pkg/sftp v1.12.1-0.20201002132022-fcaa492add82
github.com/prometheus/client_golang v1.8.0
github.com/rs/cors v1.7.1-0.20200626170627-8b4a00bd362b
@ -42,10 +42,10 @@ require (
go.etcd.io/bbolt v1.3.5
go.uber.org/automaxprocs v1.3.0
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
golang.org/x/net v0.0.0-20201029221708-28c70e62bb1d
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102
golang.org/x/sys v0.0.0-20201029080932-201ba4db2418
golang.org/x/text v0.3.4 // indirect
golang.org/x/tools v0.0.0-20201030174515-8da1a626af69 // indirect
golang.org/x/tools v0.0.0-20201031021630-582c62ec74d0 // indirect
google.golang.org/api v0.34.0
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20201030142918-24207fddd1c3 // indirect
@ -57,5 +57,5 @@ require (
replace (
github.com/jlaffaye/ftp => github.com/drakkan/ftp v0.0.0-20200730125632-b21eac28818c
golang.org/x/crypto => github.com/drakkan/crypto v0.0.0-20201017144935-4e8324213ac3
golang.org/x/net => github.com/drakkan/net v0.0.0-20201030182451-5fdd610a97c6
golang.org/x/net => github.com/drakkan/net v0.0.0-20201101072345-49fbbaa64b66
)

14
go.sum
View file

@ -119,8 +119,8 @@ github.com/drakkan/crypto v0.0.0-20201017144935-4e8324213ac3 h1:zMCXHTGF8QJ7GWQ2
github.com/drakkan/crypto v0.0.0-20201017144935-4e8324213ac3/go.mod h1:v3bhWOXGYda7H5d2s5t9XA6th3fxW3s0MQxU1R96G/w=
github.com/drakkan/ftp v0.0.0-20200730125632-b21eac28818c h1:QSXIWohSNn0negBVSKEjKTpdpGEsW7weVW8QNzviLHY=
github.com/drakkan/ftp v0.0.0-20200730125632-b21eac28818c/go.mod h1:2lmrmq866uF2tnje75wQHzmPXhmSWUt7Gyx2vgK1RCU=
github.com/drakkan/net v0.0.0-20201030182451-5fdd610a97c6 h1:fjOkkszqlkEO81L1kJgtQ1Hc4rxuLc3cVhIP5arbVeo=
github.com/drakkan/net v0.0.0-20201030182451-5fdd610a97c6/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
github.com/drakkan/net v0.0.0-20201101072345-49fbbaa64b66 h1:Y92YgfaycEmjy9L6CY633pCrxGtAlV3wh5n4vS7U+os=
github.com/drakkan/net v0.0.0-20201101072345-49fbbaa64b66/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
@ -134,8 +134,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fclairamb/ftpserverlib v0.8.1-0.20201007044523-7c6c9f869560 h1:rBqKb2pMRScNXenAhRo3HCS3DBfBW/fNQnYGidNXMtI=
github.com/fclairamb/ftpserverlib v0.8.1-0.20201007044523-7c6c9f869560/go.mod h1:sMPjxPuoVwwoV87gdPkyTb0dVofmCKpVZCQ3rMVokjc=
github.com/fclairamb/ftpserverlib v0.9.0 h1:RW20tmYTY06WQdY5l9+iK7ES7Xi/ICgnG/sTXhSwsCY=
github.com/fclairamb/ftpserverlib v0.9.0/go.mod h1:sMPjxPuoVwwoV87gdPkyTb0dVofmCKpVZCQ3rMVokjc=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
@ -378,8 +378,8 @@ github.com/pelletier/go-toml v1.8.1/go.mod h1:T2/BmBdy8dvIRq1a/8aqjN41wvWlN4lrap
github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pires/go-proxyproto v0.3.0 h1:++BY4zWOpWha50IDjdnp7+NRTLuOHqMQC5PkgS7I4u4=
github.com/pires/go-proxyproto v0.3.0/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY=
github.com/pires/go-proxyproto v0.3.1 h1:eWb52zeDUbSUDBV+8aVCfOy0pnEG6DrDW3cJ/WKdQsk=
github.com/pires/go-proxyproto v0.3.1/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@ -675,7 +675,7 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u
golang.org/x/tools v0.0.0-20200915173823-2db8f0ff891c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20201017001424-6003fad69a88/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU=
golang.org/x/tools v0.0.0-20201030174515-8da1a626af69/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20201031021630-582c62ec74d0/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View file

@ -2,17 +2,33 @@ openapi: 3.0.3
info:
title: SFTPGo
description: 'SFTPGo REST API'
version: 2.0.1
version: 2.0.2
servers:
- url: /api/v1
- url: /api/v1
security:
- BasicAuth: []
- BasicAuth: []
paths:
/healthz:
get:
servers:
- url : /
tags:
- healthcheck
summary: health check
description: Health endpoint to check if the application is still running and responding to requests
responses:
200:
description: successful operation
content:
text/plain:
schema:
type: string
example: ok
/version:
get:
tags:
- version
- version
summary: Get version details
operationId: get_version
responses:
@ -33,7 +49,7 @@ paths:
/providerstatus:
get:
tags:
- providerstatus
- providerstatus
summary: Get data provider status
operationId: get_provider_status
responses:
@ -56,7 +72,7 @@ paths:
/connection:
get:
tags:
- connections
- connections
summary: Get the active users and info about their uploads/downloads
operationId: get_connections
responses:
@ -79,16 +95,16 @@ paths:
/connection/{connectionID}:
delete:
tags:
- connections
- connections
summary: Terminate an active connection
operationId: close_connection
parameters:
- name: connectionID
in: path
description: ID of the connection to close
required: true
schema:
type: string
- name: connectionID
in: path
description: ID of the connection to close
required: true
schema:
type: string
responses:
200:
description: successful operation
@ -111,7 +127,7 @@ paths:
/quota_scan:
get:
tags:
- quota
- quota
summary: Get the active quota scans for users home directories
operationId: get_quota_scans
responses:
@ -133,7 +149,7 @@ paths:
$ref: '#/components/responses/DefaultResponse'
post:
tags:
- quota
- quota
summary: start a new user quota scan
description: A quota scan update the number of files and their total size for the specified user
operationId: start_quota_scan
@ -169,7 +185,7 @@ paths:
/quota_update:
put:
tags:
- quota
- quota
summary: update the user used quota limits
description: Set the current used quota limits for the given user
operationId: quota_update
@ -219,7 +235,7 @@ paths:
/folder_quota_update:
put:
tags:
- quota
- quota
summary: update the folder used quota limits
description: Set the current used quota limits for the given folder
operationId: folder_quota_update
@ -269,7 +285,7 @@ paths:
/folder_quota_scan:
get:
tags:
- quota
- quota
summary: Get the active quota scans for folders
operationId: get_folders_quota_scans
responses:
@ -291,7 +307,7 @@ paths:
$ref: '#/components/responses/DefaultResponse'
post:
tags:
- quota
- quota
summary: start a new folder quota scan
description: A quota scan update the number of files and their total size for the specified folder
operationId: start_folder_quota_scan
@ -327,7 +343,7 @@ paths:
/folder:
get:
tags:
- folders
- folders
summary: Returns an array with one or more folders
operationId: get_folders
parameters:
@ -384,7 +400,7 @@ paths:
$ref: '#/components/responses/DefaultResponse'
post:
tags:
- folders
- folders
summary: Adds a new folder
operationId: add_folder
description: a new folder with the specified mapped_path will be added. To update the used quota parameters a quota scan is needed
@ -413,16 +429,16 @@ paths:
$ref: '#/components/responses/DefaultResponse'
delete:
tags:
- folders
- folders
summary: Delete an existing folder
operationId: delete_folder
parameters:
- name: folder_path
in: query
description: path to the folder to delete
required: true
schema:
type: string
- name: folder_path
in: query
description: path to the folder to delete
required: true
schema:
type: string
responses:
200:
description: successful operation
@ -447,7 +463,7 @@ paths:
/user:
get:
tags:
- users
- users
summary: Returns an array with one or more users
description: For security reasons hashed passwords are omitted in the response
operationId: get_users
@ -505,7 +521,7 @@ paths:
$ref: '#/components/responses/DefaultResponse'
post:
tags:
- users
- users
summary: Adds a new user
operationId: add_user
requestBody:
@ -534,18 +550,18 @@ paths:
/user/{userID}:
get:
tags:
- users
- users
summary: Find user by ID
description: For security reasons the hashed password is omitted in the response
operationId: get_user_by_id
parameters:
- name: userID
in: path
description: ID of the user to retrieve
required: true
schema:
type: integer
format: int32
- name: userID
in: path
description: ID of the user to retrieve
required: true
schema:
type: integer
format: int32
responses:
200:
description: successful operation
@ -567,28 +583,28 @@ paths:
$ref: '#/components/responses/DefaultResponse'
put:
tags:
- users
- users
summary: Update an existing user
operationId: update_user
parameters:
- name: userID
in: path
description: ID of the user to update
required: true
schema:
type: integer
format: int32
- in: query
name: disconnect
schema:
type: integer
enum:
- 0
- 1
description: >
Disconnect:
* `0` The user will not be disconnected and it will continue to use the old configuration until connected. This is the default
* `1` The user will be disconnected after a successful update. It must login again and so it will be forced to use the new configuration
- name: userID
in: path
description: ID of the user to update
required: true
schema:
type: integer
format: int32
- in: query
name: disconnect
schema:
type: integer
enum:
- 0
- 1
description: >
Disconnect:
* `0` The user will not be disconnected and it will continue to use the old configuration until connected. This is the default
* `1` The user will be disconnected after a successful update. It must login again and so it will be forced to use the new configuration
requestBody:
required: true
content:
@ -618,17 +634,17 @@ paths:
$ref: '#/components/responses/DefaultResponse'
delete:
tags:
- users
- users
summary: Delete an existing user
operationId: delete_user
parameters:
- name: userID
in: path
description: ID of the user to delete
required: true
schema:
type: integer
format: int32
- name: userID
in: path
description: ID of the user to delete
required: true
schema:
type: integer
format: int32
responses:
200:
description: successful operation
@ -653,7 +669,7 @@ paths:
/dumpdata:
get:
tags:
- maintenance
- maintenance
summary: Backup SFTPGo data serializing them as JSON
description: The backup is saved to a local file to avoid to expose users hashed passwords over the network. The output of dumpdata can be used as input for loaddata
operationId: dumpdata
@ -697,7 +713,7 @@ paths:
/loaddata:
get:
tags:
- maintenance
- maintenance
summary: Restore SFTPGo data from a JSON backup
description: Users and folders will be restored one by one and the restore is stopped if a user/folder cannot be added or updated, so it could happen a partial restore
operationId: loaddata