Documentation ¶
Overview ¶
Package api implements REST API for sftpgo. REST API allows to manage users and quota and to get real time reports for the active connections with possibility of forcibly closing a connection. The OpenAPI 3 schema for the exposed API can be found inside the source tree: https://github.com/drakkan/ sftpgo/tree/master/api/schema/openapi.yaml
Index ¶
- func AddUser(user dataprovider.User, expectedStatusCode int) (dataprovider.User, []byte, error)
- func CloseConnection(connectionID string, expectedStatusCode int) ([]byte, error)
- func GetConnections(expectedStatusCode int) ([]serv.ConnectionStatus, []byte, error)
- func GetHTTPRouter() http.Handler
- func GetQuotaScans(expectedStatusCode int) ([]serv.ActiveQuotaScan, []byte, error)
- func GetUserByID(userID int64, expectedStatusCode int) (dataprovider.User, []byte, error)
- func GetUsers(limit int64, offset int64, username string, expectedStatusCode int) ([]dataprovider.User, []byte, error)
- func GetVersion(expectedStatusCode int) (utils.VersionInfo, []byte, error)
- func RemoveUser(user dataprovider.User, expectedStatusCode int) ([]byte, error)
- func SetBaseURL(url string)
- func SetDataProvider(provider dataprovider.Provider)
- func StartQuotaScan(user dataprovider.User, expectedStatusCode int) ([]byte, error)
- func UpdateUser(user dataprovider.User, expectedStatusCode int) (dataprovider.User, []byte, error)
- type HTTPDConf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddUser ¶
func AddUser(user dataprovider.User, expectedStatusCode int) (dataprovider.User, []byte, error)
AddUser adds a new user and checks the received HTTP Status code against expectedStatusCode.
func CloseConnection ¶
CloseConnection closes an active connection identified by connectionID
func GetConnections ¶
func GetConnections(expectedStatusCode int) ([]serv.ConnectionStatus, []byte, error)
GetConnections returns status and stats for active SFTP/SCP connections
func GetHTTPRouter ¶
GetHTTPRouter returns the configured HTTP handler
func GetQuotaScans ¶
func GetQuotaScans(expectedStatusCode int) ([]serv.ActiveQuotaScan, []byte, error)
GetQuotaScans gets active quota scans and checks the received HTTP Status code against expectedStatusCode.
func GetUserByID ¶
GetUserByID gets an user by database id and checks the received HTTP Status code against expectedStatusCode.
func GetUsers ¶
func GetUsers(limit int64, offset int64, username string, expectedStatusCode int) ([]dataprovider.User, []byte, error)
GetUsers allows to get a list of users and checks the received HTTP Status code against expectedStatusCode. The number of results can be limited specifying a limit. Some results can be skipped specifying an offset. The results can be filtered specifying an username, the username filter is an exact match
func GetVersion ¶
func GetVersion(expectedStatusCode int) (utils.VersionInfo, []byte, error)
GetVersion returns version details
func RemoveUser ¶
func RemoveUser(user dataprovider.User, expectedStatusCode int) ([]byte, error)
RemoveUser removes an existing user and checks the received HTTP Status code against expectedStatusCode.
func SetBaseURL ¶
func SetBaseURL(url string)
SetBaseURL sets the base url to use for HTTP requests, default is "http://127.0.0.1:8080"
func SetDataProvider ¶
func SetDataProvider(provider dataprovider.Provider)
SetDataProvider sets the data provider to use to fetch the data about users
func StartQuotaScan ¶
func StartQuotaScan(user dataprovider.User, expectedStatusCode int) ([]byte, error)
StartQuotaScan start a new quota scan for the given user and checks the received HTTP Status code against expectedStatusCode.
func UpdateUser ¶
func UpdateUser(user dataprovider.User, expectedStatusCode int) (dataprovider.User, []byte, error)
UpdateUser updates an existing user and checks the received HTTP Status code against expectedStatusCode.
Types ¶
type HTTPDConf ¶
type HTTPDConf struct { // The port used for serving HTTP requests. 0 disable the HTTP server. Default: 8080 BindPort int `json:"bind_port" mapstructure:"bind_port"` // The address to listen on. A blank value means listen on all available network interfaces. Default: "127.0.0.1" BindAddress string `json:"bind_address" mapstructure:"bind_address"` }
HTTPDConf httpd daemon configuration