pkg

package
v0.0.0-...-268fab5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config config
View Source
var DB *gorm.DB
View Source
var GoogleOauthConfig *oauth2.Config

Functions

func AddAdmin

func AddAdmin(name, fullname, mail string) error

func AddClusterToUser

func AddClusterToUser(email string, clusterName string) error

func AddUsers

func AddUsers(mail, cluster, name, fullname string) error

func AdminExists

func AdminExists(email string) bool

func ClusterExists

func ClusterExists(name string) bool

func CountDirectories

func CountDirectories(path string) int

func CreateCluster

func CreateCluster(name, token string) error

func DeleteCluster

func DeleteCluster(name string) error

func DeleteDir

func DeleteDir(root string, name string) error

func DirectoryExists

func DirectoryExists(path string) bool

func GenerateToken

func GenerateToken(length int) (string, error)

func GetGroupFromMail

func GetGroupFromMail(rootDir string, mail string) (string, error)

func GetSubdirs

func GetSubdirs(path string) ([]string, error)

func InitConfig

func InitConfig() error

func InitDB

func InitDB()

func RemoveClusterFromUser

func RemoveClusterFromUser(mail, clusterName string) error

func UpdateCluster

func UpdateCluster(name, api string) error

func UploadFile

func UploadFile(path string, r *http.Request) error

func UserExists

func UserExists(email string) bool

func UserInCluster

func UserInCluster(email, clusterName string) (bool, error)

Types

type Admin

type Admin struct {
	gorm.Model
	Name     string
	Mail     string `gorm:"unique"`
	FullName string
}

func GetAdminByEmail

func GetAdminByEmail(email string) (*Admin, error)

type Cluster

type Cluster struct {
	gorm.Model
	Name   string `gorm:";not null"`
	Status bool
	Token  string
	API    string
}

func GetAllClusters

func GetAllClusters() ([]Cluster, error)

func GetClusterByName

func GetClusterByName(name string) (Cluster, error)

func GetClustersByUser

func GetClustersByUser(email string) ([]Cluster, error)

type ClusterResponse

type ClusterResponse struct {
	Status   string    `json:"status"`
	Message  string    `json:"message"`
	Clusters []Cluster `json:"clusters"`
}

type ClusterUser

type ClusterUser struct {
	gorm.Model
	Name     string    `gorm:"not null"`
	FullName string    `gorm:"not null"`
	Email    string    `gorm:"unique;not null"`
	Clusters []Cluster `gorm:"many2many:user_clusters;"`
}

func GetAllUsers

func GetAllUsers() ([]ClusterUser, error)

func GetUserByEmail

func GetUserByEmail(email string) (ClusterUser, error)

func GetUsersByCluster

func GetUsersByCluster(clusterName string) ([]ClusterUser, error)

type Response

type Response struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

type User

type User struct {
	ID            string `json:"id"`
	Email         string `json:"email"`
	VerifiedEmail bool   `json:"verified_email"`
	Picture       string `json:"picture"`
}

type UserCluster

type UserCluster struct {
	gorm.Model
	ClusterID uint
	UserID    uint
}

type UserResponse

type UserResponse struct {
	Status       string        `json:"status"`
	Message      string        `json:"message"`
	ClusterUsers []ClusterUser `json:"clusterusers"`
}

Jump to

Keyboard shortcuts

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