nodes

package
v0.0.0-...-aa13637 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2020 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessToken

func AccessToken(c *gin.Context)

AccessToken receive a id from request url and return the access token of the specific id

AccessToken godoc @Summary Node AccessToken @Description Node AccessToken according to nid @ID Nodes.AccessToken @Security ApiKeyAuth @Tags Nodes @Accept json @Produce json @Param nid path uint true "Node ID" @Param Authorization header string true "Access Token" @Success 200 {object} accessTokenResponse @Failure 403 {object} handler.ErrorResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes/{nid}/token [get]

func Create

func Create(c *gin.Context)

Create receive a id and a node object from request and update the specific record in DB

Create godoc @Summary Create Node @Description Create node from post json object @ID Nodes.Create @Security ApiKeyAuth @Tags Nodes @Accept json @Produce json @Param node body models.Node true "Node Object" @Param Authorization header string true "Access Token" @Success 200 {object} createResponse @Failure 403 {object} handler.ErrorResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes [post]

func Destroy

func Destroy(c *gin.Context)

Destroy receive a id from request and delete in from DB

Destroy godoc @Summary Destroy Node @Description Destroy Node according to nid @ID Nodes.Destroy @Security ApiKeyAuth @Tags Nodes @Accept json @Produce json @Param nid path uint true "Node ID" @Param Authorization header string true "Access Token" @Success 200 {object} destroyResponse @Failure 403 {object} handler.ErrorResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes/{nid} [delete]

func GenerateToken

func GenerateToken(c *gin.Context)

GenerateToken receive a id from request url and return the access token of the specific id

GenerateToken godoc @Summary Generate Node AccessToken @Description Generate Node AccessToken according to nid @ID Nodes.GenerateToken @Security ApiKeyAuth @Tags Nodes @Accept plain @Produce json @Param nid path uint true "Node ID" @Param Authorization header string true "Access Token" @Success 200 {object} accessTokenResponse @Failure 403 {object} handler.ErrorResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes/{nid}/token [post]

func Index

func Index(c *gin.Context)

Index handle GET /nodes which simply list out all nodes accept gid param as filter

Index godoc @Summary All Nodes @Description Simply list out all Nodes @ID Nodes.Index @Security ApiKeyAuth @Tags Nodes @Accept json @Produce json @Param Authorization header string true "Access Token" @Success 200 {object} indexResponse @Failure 403 {object} handler.ErrorResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes [get]

func Services

func Services(c *gin.Context)

Services receive a id from request url and return all the services a node has

Services godoc @Summary Node Services @Description Show services of a node @ID Nodes.Services @Security ApiKeyAuth @Tags Nodes @Accept json @Produce json @Param nid path uint true "Node ID" @Param Authorization header string true "Access Token" @Success 200 {object} servicesResponse @Failure 403 {object} handler.ErrorResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes/{nid}/services [get]

func Show

func Show(c *gin.Context)

Show receive a id from request url and return the node of the specific id

Show godoc @Summary Show Node @Description Show Node according to nid @ID Nodes.Show @Security ApiKeyAuth @Tags Nodes @Accept json @Produce json @Param nid path uint true "Node ID" @Param Authorization header string true "Access Token" @Success 200 {object} showResponse @Failure 403 {object} handler.ErrorResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes/{nid} [get]

func Traffic

func Traffic(c *gin.Context)

Traffic receive traffic info and update it

Traffic godoc @Summary Update user traffic @Description Update user traffic @ID nodes.Traffic @Security ApiKeyAuth @Tags Nodes @Accept json @Produce json @Param traffic body trafficRequest true "Traffic Info Object" @Param nid path uint true "Node ID" @Param username path string true "Username" @Param Authorization header string false "Node Token" @Success 200 {object} trafficResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes/{nid}/users/{username}/traffic [patch]

func Update

func Update(c *gin.Context)

Update receive a id and a node object from request and update the specific record in DB

Update godoc @Summary Update Node @Description Update a Node @ID Nodes.Update @Security ApiKeyAuth @Tags Nodes @Accept json @Produce json @Param nid path uint true "Node ID" @Param node body models.Node true "Node Object" @Param Authorization header string true "Access Token" @Success 200 {object} updateResponse @Failure 403 {object} handler.ErrorResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes/{nid} [patch]

func Users

func Users(c *gin.Context)

Users receive a id from request url and return all the Users a node has

Users godoc @Summary Node Users @Description Show Users of a node @ID Nodes.Users @Security ApiKeyAuth @Tags Nodes @Accept json @Produce json @Param nid path uint true "Node ID" @Param Authorization header string true "Access Token" @Success 200 {object} usersResponse @Failure 403 {object} handler.ErrorResponse @Failure 500 {object} handler.ErrorResponse @Router /nodes/{nid}/users [get]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL