web

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActionJWTRevokeAll

func ActionJWTRevokeAll(c *fiber.Ctx) error

ActionJWTRevokeAll godoc @Summary Reload server authentication configuration @Description Reload server authentication configuration @ID server-jwt-revoke-all @Accept json @Produce json @Tags Admin @success 200 {object} web.JSONResultSuccess{} "successful operation" @Router /api/v1//admin/jwt/revoke [post]

func AddRoutes

func AddRoutes(app *fiber.App)

func AddSwaggerRoute

func AddSwaggerRoute(a *fiber.App)

SwaggerRoute func for describe group of API Docs routes.

func ApiServerReloadAuth

func ApiServerReloadAuth(c *fiber.Ctx) error

ApiServerReloadAuth godoc @Summary Reload server authentication configuration @Description Reload server authentication configuration @ID server-reload-auth @Accept json @Produce json @Tags Admin @success 200 {object} web.JSONResultSuccess{} "successful operation" @Router /api/v1//admin/server/reload/auth [post]

func ApiServerShutdown

func ApiServerShutdown(c *fiber.Ctx) error

ApiServerShutdown godoc @Summary Shutdown server @Description Shutdown server @ID server-shutdown @Accept json @Produce json @Tags Admin @success 200 {object} web.JSONResultSuccess{} "successful operation" @Router /api/v1//admin/server/shutdown [post]

func ApiServerUtilsPbkdf2

func ApiServerUtilsPbkdf2(c *fiber.Ctx) error

ApiServerUtilsPbkdf2 godoc @Summary Generate hash from password @Description Generate hash from password @ID utils-pbkdf2 @Accept json @Produce json @Tags Utils @Param payload body Pbkdf2Payload true "Pbkdf2Payload" Format(Pbkdf2Payload) @Success 200 {object} web.JSONResultPbkdf2 "successful operation" @Failure 400 {object} apierror.APIError @Router /api/v1/utils/pbkdf2 [post]

func CloseRecordsIterator

func CloseRecordsIterator(c *fiber.Ctx) error

CloseRecordsIterator godoc @Summary Close a stream records iterator @Description Close an existing stream records iterator by it's UUID @ID stream-close-records-iterator @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Param streamiteratoruuid path string true "Stream iterator UUID" Format(uuid.UUID) @Success 200 {object} stream.CloseRecordsIteratorResponse "successful operation" @Success 400 {object} apierror.APIError @Router /api/v1/stream/{streamuuid}/iterator/{streamiteratoruuid} [delete]

func CreateRecordsIterator

func CreateRecordsIterator(c *fiber.Ctx) error

CreateRecordsIterator godoc @Summary Create stream records iterator @Description Create a record iterator to get records from a given position for the given stream UUID @ID stream-create-records-iterator @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Success 200 {object} stream.CreateRecordsIteratorResponse @Success 400 {object} apierror.APIError @Router /api/v1/stream/{streamuuid}/iterator [post]

func CreateStream

func CreateStream(c *fiber.Ctx) error

CreateStream godoc @Summary Create a stream @Description Create a new stream @ID stream-create @Accept json @Produce json @Tags Stream @Success 201 {array} types.StreamInfo @Success 400 {object} apierror.APIError @Router /api/v1/stream [post]

func DeleteStream

func DeleteStream(c *fiber.Ctx) error

DeleteStream godoc @Summary Delete a stream @Description Delete a stream @ID stream-delete @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @success 200 {object} web.JSONResultSuccess{} "successful operation" @Success 400 {object} apierror.APIError @Router /api/v1/stream/{streamuuid} [delete]

func GenerateJWT

func GenerateJWT(accountId string, isSuperUser bool, accessKeyId string, secretAccessKey string) (bool, string, *jwt.MapClaims, *rbac.User, error)

func GetAccount

func GetAccount(c *fiber.Ctx) error

GetAccount godoc @Summary Get account @Description Get account details @ID account-get @Accept json @Produce json @Tags Account @success 200 {object} web.JSONResult{data=web.GetAccountHTTPJsonResult{accountSettings=account.AccountSettings}} "successful operation" @Router /api/v1/account [get]

func GetFiberConfig

func GetFiberConfig() fiber.Config

func GetFiberLogger

func GetFiberLogger() logger.Config

func GetJWTClaim

func GetJWTClaim(c *fiber.Ctx, key string) (interface{}, error)

func GetPayload

func GetPayload(c *fiber.Ctx, payload interface{}) *apierror.APIError

func GetRecords

func GetRecords(c *fiber.Ctx) error

GetRecords godoc @Summary Get stream records @Description Get records for the given stream UUID @ID stream-get-records @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Param streamiteratoruuid path string true "Stream iterator UUID" Format(uuid.UUID) @Param maxRecords query int false "int max records" example(10) @Success 200 {object} stream.GetStreamRecordsResponse "successful operation" @Success 400 {object} apierror.APIError @Success 500 {object} apierror.APIError @Router /api/v1/stream/{streamuuid}/iterator/{streamiteratoruuid}/records [get]

func GetRecordsIteratorStats

func GetRecordsIteratorStats(c *fiber.Ctx) error

GetRecordsIteratorStats godoc @Summary Get statistics about a stream records iterator @Description Get statistics for the given stream UUID and stream record iterator UUID @ID stream-get-records-iterator-stats @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Param streamiteratoruuid path string true "Stream iterator UUID" Format(uuid.UUID) @Success 200 {object} stream.GetRecordsIteratorStatsResponse "successful operation" @Success 400 {object} apierror.APIError @Success 500 {object} apierror.APIError @Router /api/v1/stream/{streamuuid}/iterator/{streamiteratoruuid}/stats [get]

func GetStreamFromParameter

func GetStreamFromParameter(c *fiber.Ctx) (types.StreamUUID, *stream.Stream, *apierror.APIError)

func GetStreamInformation

func GetStreamInformation(c *fiber.Ctx) error

GetStreamInformation godoc @Summary Get stream information @Description Get information for the given stream UUID @ID stream-get-information @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Success 200 {object} types.StreamInfo @Success 400 {object} apierror.APIError @Router /api/v1/stream/{streamuuid} [get]

func GetStreamProperties

func GetStreamProperties(c *fiber.Ctx) error

GetStreamProperties godoc @Summary Get stream properties @Description Get the properties for the given stream UUID @ID stream-get-properties @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Success 200 {object} types.StreamProperties "successful operation" @Success 400 {object} apierror.APIError @Router /api/v1/stream/{streamuuid}/properties [get]

func GetStreamPropertiesForABAC

func GetStreamPropertiesForABAC(c *fiber.Ctx) (interface{}, error)

func GetStreamUUIDFromParameter

func GetStreamUUIDFromParameter(c *fiber.Ctx) (types.StreamUUID, *apierror.APIError)

func GoServer

func GoServer()

func JWTInit

func JWTInit()

func JWTPostValidate

func JWTPostValidate(c *fiber.Ctx) error

func JWTProtected

func JWTProtected() func(*fiber.Ctx) error

func JWTRevokeAll

func JWTRevokeAll()

func ListStreams

func ListStreams(c *fiber.Ctx) error

ListStreams godoc @Summary List streams @Description Get the list of all streams UUIDs @ID stream-list @Accept json @Produce json @Tags Stream @Param jq query string false "string jq filter" example(".name == \"test 8\"") @Success 200 {array} types.StreamUUID "successful operation" @Failure 403 {object} apierror.APIError @Router /api/v1/streams [get]

func ListStreamsProperties

func ListStreamsProperties(c *fiber.Ctx) error

ListStreamsProperties godoc @Summary List streams properties @Description Get the streams UUIDs and their properties @ID stream-list-and-properties @Accept json @Produce json @Tags Stream @Param jq query string false "string jq filter" example(".name == \"test 8\"") @Success 200 {object} web.JSONResultListStreamsProperties "successful operation" @Failure 403 {object} apierror.APIError @Router /api/v1/streams/properties [get]

func ListUsers

func ListUsers(c *fiber.Ctx) error

ListUsers godoc @Summary List users @Description Get the list of users @ID user-list @Accept json @Produce json @Tags User @Success 200 {object} web.JSONResultListUsers "successful operation" @Router /api/v1/users [get]

func LoginAccount

func LoginAccount(c *fiber.Ctx) error

LoginAccount godoc @Summary Account login @Description Account login @ID account-login @Accept json @Produce json @Tags Account @Param API-KEY header string true "API-KEY" @Success 200 {object} stream.LoginAccountResponse "successful operation" @Failure 400 {object} apierror.APIError @Failure 403 {object} apierror.APIError @Router /api/v1/account/login [get]

func LoginUser

func LoginUser(c *fiber.Ctx) error

LoginUser godoc @Summary Logs user into the system @Description Logs user into the system @ID user-login @Accept json @Produce json @Tags User @Param ACCESS-KEY-ID header string true "ACCESS-KEY-ID" @Param SECRET-ACCESS-KEY header string true "SECRET-ACCESS-KEY" @Success 200 {object} stream.LoginUserResponse "successful operation" @Success 400 {object} apierror.APIError @Success 403 {object} apierror.APIError @Success 500 {object} apierror.APIError @Router /api/v1/user/login [get]

func Ping

func Ping(c *fiber.Ctx) error

Ping godoc @Summary Ping server @Description Ping server @ID utils-ping @Produce plain @Tags Utils @Success 200 {string} string "ok" @Router /api/v1/utils/ping [get]

func PutRecord

func PutRecord(c *fiber.Ctx) error

PutRecord godoc @Summary Put one record into a stream @Description Put a single record into a stream @ID stream-put-record @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Success 202 {object} stream.PutStreamRecordsResponse "successful operation" @Success 400 {object} apierror.APIError @Success 500 {object} apierror.APIError @Router /api/v1/stream/{streamuuid}/record [put]

func PutRecords

func PutRecords(c *fiber.Ctx) error

PutRecords godoc @Summary Put one or multiple records into a stream @Description Put one or multiple records into a stream @ID stream-put-records @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Success 202 {object} stream.PutStreamRecordsResponse "successful operation" @Success 400 {object} apierror.APIError @Success 500 {object} apierror.APIError @Router /api/v1/stream/{streamuuid}/records [put]

func RateLimiterAccounts

func RateLimiterAccounts() func(*fiber.Ctx) error

func RateLimiterJobs

func RateLimiterJobs() func(*fiber.Ctx) error

func RateLimiterStreams

func RateLimiterStreams() func(*fiber.Ctx) error

func RateLimiterUtils

func RateLimiterUtils() func(*fiber.Ctx) error

func RebuildIndex

func RebuildIndex(c *fiber.Ctx) error

RebuildIndex godoc @Summary Rebuild the stream index @Description Build or rebuild the stream index @ID stream-rebuild-index @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Success 200 {object} stream.RebuildStreamIndexResponse @Success 500 {object} apierror.APIError @Router /api/v1/stream/index/{streamuuid}/rebuild [post]

func SetStreamProperties

func SetStreamProperties(c *fiber.Ctx) error

SetStreamProperties godoc @Summary Set stream properties @Description Set and replace properties for the given stream @ID stream-set-properties @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Success 200 {object} types.StreamProperties "successful operation" @Success 400 {object} apierror.APIError @Router /api/v1/stream/{streamuuid}/properties [post]

func StartMinistreamServer

func StartMinistreamServer(errs chan error) *fiber.App

func StartSwaggerServer

func StartSwaggerServer(errs chan error) *fiber.App

func StopServer

func StopServer()

func UpdateStreamProperties

func UpdateStreamProperties(c *fiber.Ctx) error

UpdateStreamProperties godoc @Summary Update stream properties @Description update properties for the given stream @ID stream-update-properties @Accept json @Produce json @Tags Stream @Param streamuuid path string true "Stream UUID" Format(uuid.UUID) @Success 200 {object} types.StreamProperties "successful operation" @Success 400 {object} apierror.APIError @Router /api/v1/stream/{streamuuid}/properties [patch]

func ValidateApiKey

func ValidateApiKey(c *fiber.Ctx) error

ValidateApiKey godoc @Summary Validate API Key @Description Log in a user @ID account-validate-api-key @Accept json @Produce json @Tags Account @Param API-KEY header string true "API-KEY" @success 200 {object} web.JSONResultSuccess{} "successful operation" @Failure 400 {object} apierror.APIError @Failure 403 {object} apierror.APIError @Router /api/v1/account/validate [get]

func ValidateStruct

func ValidateStruct(obj interface{}) []*apierror.ValidationError

Types

type GetAccountHTTPJsonResult

type GetAccountHTTPJsonResult struct {
	ID   uuid.UUID `json:"id" example:"123489e2-b483-467b-8b59-758b33981234"`
	Name string    `json:"name" example:"account name"`
}

type HTTPError

type HTTPError struct {
	Code    int    `json:"code" example:"400"`
	Message string `json:"message" example:"error"`
}

type JSONResult

type JSONResult struct {
	Code    int         `json:"code" example:"200"`
	Message string      `json:"message" example:"success"`
	Data    interface{} `json:"data"`
}

type JSONResultListStreamsProperties

type JSONResultListStreamsProperties struct {
	Code   int                                    `json:"code" example:"200"`
	Result *JSONResultListStreamsPropertiesResult `json:"result"`
}

type JSONResultListStreamsPropertiesResult

type JSONResultListStreamsPropertiesResult struct {
	Total int                                         `json:"total" example:"5"`
	Rows  *[]JSONResultListStreamsPropertiesResultRow `json:"rows"`
}

type JSONResultListStreamsPropertiesResultRow

type JSONResultListStreamsPropertiesResultRow struct {
	UUID         types.StreamUUID       `json:"uuid" example:"4ce589e2-b483-467b-8b59-758b339801db"`
	CptMessages  types.Size64           `json:"cptMessages" example:"12345"`
	SizeInBytes  types.Size64           `json:"sizeInBytes" example:"4567890"`
	CreationDate time.Time              `json:"creationDate"`
	LastUpdate   time.Time              `json:"lastUpdate"`
	Properties   types.StreamProperties `json:"properties"`
	LastMsgId    types.MessageId        `json:"lastMsgId"`
}

type JSONResultListUsers

type JSONResultListUsers struct {
	Code  int      `json:"code" example:"200"`
	Users []string `json:"users"`
}

type JSONResultPbkdf2

type JSONResultPbkdf2 struct {
	Code       int    `json:"code" example:"200"`
	Message    string `json:"message" example:"success"`
	Hash       string `json:"hash"`
	Digest     string `json:"digest"`
	Iterations int    `json:"iterations"`
	Salt       string `json:"salt"`
}

type JSONResultSuccess

type JSONResultSuccess struct {
	Code    int    `json:"code" example:"200"`
	Message string `json:"message" example:"success"`
}

type Pbkdf2Payload

type Pbkdf2Payload struct {
	Digest     string `json:"digest" validate:"required" example:"sha256"`
	Iterations int    `json:"iterations" validate:"min=1,max=10000"`
	Salt       string `json:"salt" validate:"required" example:"thisisarandomsalt"`
	Password   string `json:"password" validate:"required" example:"thisismysecretpassword"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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