api

package
v0.0.0-...-d8065e1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNamespace

func CreateNamespace(nameSpace string) (string, error)

To create a new namespace as part of login.

func CreateRandomCode

func CreateRandomCode(lenCode int) string

Create a random code of given length.

func GetNamespace

func GetNamespace(userInfo UserInfo) (string, error)

Get the namespace for user, from DB.

func New

func New() *mux.Router

New returns new API router for app-controller

func RemoveSpecialChars

func RemoveSpecialChars(specialChar string) (string, error)

Remove all special characters and convert to lowercase alphanumeric string.

func ValidateToken

func ValidateToken(r *http.Request) (jwt.Claims, error)

Fetch the token and validate it.

Types

type App

type App struct {
	Name  string `json:"name"`
	Image string `json:"image"`
	Port  string `json:"port"`
	Envs  []struct {
		Key   string `json:"key"`
		Value string `json:"value"`
	} `json:"envs"`
	UserName string `json:"username"`
	Password string `json:"password"`
}

App structure.

type UserInfo

type UserInfo struct {
	Name     string  `json:"name"`
	Email    string  `json:"email"`
	NickName string  `json:"nickname"`
	Aud      string  `json:"aud"`
	Sub      string  `json:"sub"`
	Exp      float64 `json:"exp"`
}

User information structure.

func GetUserClaims

func GetUserClaims(claims jwt.Claims) (*UserInfo, error)

Get the UserInfo from claims.

Jump to

Keyboard shortcuts

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