controller

package
v0.0.0-...-cf93416 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructSearchORFilter

func ConstructSearchORFilter(sign string, names []string) string

ConstructSearchORFilter constructing string like 'names[0] OR names[1] OR ... OR names[n]'

func CreateTask

func CreateTask(r *http.Request) (*interfaces.TaskEntry, error)

CreateTask creates a task.

func CreateTaskFromRequest

func CreateTaskFromRequest(resource string, userID string,
	req *deployerRequest) (*interfaces.TaskEntry, error)

CreateTaskFromRequest creating task that spec in fields of deployerRequest. Also check for task existing by resource and name.

func CreateUser

func CreateUser(r *http.Request) (*interfaces.UserEntry, error)

CreateUser creates user in database.

func DeleteUserByID

func DeleteUserByID(r *http.Request) error

DeleteUserByID delete user from database.

func GetAllAppModules

func GetAllAppModules(parameters *APIParameters) ([]interfaces.AppModuleEntry,
	error)

GetAllAppModules return modules information.

func GetAllTasks

func GetAllTasks(parameters *APIParameters) ([]interfaces.TaskEntry, error)

GetAllTasks return tasks information.

func GetAllUsers

func GetAllUsers(parameters *APIParameters) ([]interfaces.UserEntry, error)

GetAllUsers return users information.

func GetAppModuleByID

func GetAppModuleByID(
	r *http.Request) (*interfaces.AppModuleEntry, error)

GetAppModuleByID return struct with module information. Information get by id.

func GetCompleteDeployersForResourceByName

func GetCompleteDeployersForResourceByName(resource string, name string) (*interfaces.TaskEntry, error)

GetCompleteDeployersForResourceByName returns the timestamp of the last deployment task for the specified resource.

func GetDeployerByID

func GetDeployerByID(r *http.Request) (*interfaces.TaskEntry, error)

GetDeployerByID return task with the specified ID.

func GetNodesData

func GetNodesData(filter string) map[string][]map[string]interface{}

GetNodesData return a map with node information for each node, with filter.

func GetResourceBySearch

func GetResourceBySearch(index, val string, dontCutParseResult bool) ([]map[string]interface{}, error)

GetResourceBySearch return list what contains list of Resource on the server with specified search.

func GetRolesData

func GetRolesData(Filter string,
	roles []string) map[string][]map[string]interface{}

GetRolesData return a map with node information for each role, specified by roles[]

func GetUserByID

func GetUserByID(r *http.Request) (*interfaces.UserEntry, error)

GetUserByID return struct with user information. Information get by id.

func GetUserBySession

func GetUserBySession(r *http.Request) (*interfaces.UserEntry, error)

GetUserBySession return struct with user information. Information get by user from session.

func GetUserIsBlocked

func GetUserIsBlocked(r *http.Request) bool

GetUserIsBlocked delete session.

func ImplementToAppModuleInfo

func ImplementToAppModuleInfo(
	module *interfaces.AppModuleEntry,
	updatedModule *moduleRequest)

ImplementToAppModuleInfo implement some updated fields into AppModule's entry.

func ImplementToProfileUserInfo

func ImplementToProfileUserInfo(profile *ProfileUserRequest,
	user *interfaces.UserEntry)

ImplementToProfileUserInfo implement all needed fields into user's entry.

func ImplementToUserUpdatedInfo

func ImplementToUserUpdatedInfo(currentUserID string, user *interfaces.UserEntry,
	updatedUser *userRequest)

ImplementToUserUpdatedInfo implement some updated fields into user's entry.

func IsUserBlocked

func IsUserBlocked(w http.ResponseWriter, r *http.Request) bool

IsUserBlocked checks if the user is locked.

func Logout

func Logout(r *http.Request) error

Logout delete session.

func SetAppKeyByID

func SetAppKeyByID(r *http.Request) error

SetAppKeyByID updates key information. Information update by id.

func UpdateAppModuleByID

func UpdateAppModuleByID(
	r *http.Request) error

UpdateAppModuleByID updates module information. Information update by id

func UpdateCurrentUserProfile

func UpdateCurrentUserProfile(r *http.Request) error

UpdateCurrentUserProfile updates user information. Information update by id.

func UpdateUserByID

func UpdateUserByID(r *http.Request) error

UpdateUserByID updates user information. Information update by id.

Types

type APIParameters

type APIParameters struct {
	Start                       int64
	End                         int64
	Sort                        string
	Order                       string
	Q                           string
	ID                          []string
	IncludeAllIntoParseResource bool
}

APIParameters contains all parameter, which can be processing ftom url query.

func GetURLAPIParameters

func GetURLAPIParameters(r *http.Request) *APIParameters

GetURLAPIParameters return APIParameters from url args.

type AuthenticationPing

type AuthenticationPing struct {
	Authenticate       bool `json:"authenticate"`
	NeedPasswordChange bool `json:"needPasswordChange"`
}

AuthenticationPing contains is answer of question of user authenticate.

func CheckSession

func CheckSession(r *http.Request) (*AuthenticationPing, error)

CheckSession will check the existence of the session.

type AuthenticationSessionInfo

type AuthenticationSessionInfo struct {
	Session string `json:"session"`
}

AuthenticationSessionInfo contains session information.

func Authenticate

func Authenticate(r *http.Request) (*AuthenticationSessionInfo, error)

Authenticate is a function to authenticate a user.

type AuthenticationUserInfo

type AuthenticationUserInfo struct {
	ID                 string `json:"id"`
	Username           string `json:"username"`
	FullName           string `json:"fullName"`
	Avatar             string `json:"avatar"`
	LastLogin          string `json:"lastLogin"`
	NeedPasswordChange bool   `json:"needPasswordChange"`
}

AuthenticationUserInfo contains user information.

func ExtractAuthenticationUserInfo

func ExtractAuthenticationUserInfo(
	user *interfaces.UserEntry) *AuthenticationUserInfo

ExtractAuthenticationUserInfo extracts all needed fields from the user's record..

type AuthenticationUserPermissions

type AuthenticationUserPermissions struct {
	IsAdmin bool `json:"admin"`
}

AuthenticationUserPermissions contains admin flag.

func ExtractAuthenticationUserPermissions

func ExtractAuthenticationUserPermissions(
	user *interfaces.UserEntry) *AuthenticationUserPermissions

ExtractAuthenticationUserPermissions extract permissions fields of user.

type Cookbook

type Cookbook struct {
	ID   string                `json:"id"`
	Meta chef.CookbookVersions `json:"meta"`
}

Cookbook is a structure describing cookbook.

func GetCookbooks

func GetCookbooks(parameters *APIParameters) ([]Cookbook,
	error)

GetCookbooks returns cookbook list on server.

type KeyEntry

type KeyEntry struct {
	Name  string `json:"id"`
	Value string `json:"value"`
}

KeyEntry is a struct describes application key.

func GetAllAppKeys

func GetAllAppKeys(parameters *APIParameters) ([]KeyEntry, error)

GetAllAppKeys return all application keys.

func GetAppKeyByID

func GetAppKeyByID(r *http.Request) (*KeyEntry, error)

GetAppKeyByID return struct with key information. Information get by id.

type Node

type Node struct {
	ID   string                   `json:"id"`
	Date string                   `json:"date"`
	Data []map[string]interface{} `json:"data"`
}

Node is a structure describing node.

func GetNodes

func GetNodes(parameters *APIParameters) ([]Node, error)

GetNodes returns node list on server.

type NodeTaskRequest

type NodeTaskRequest struct {
	Node
	OnlyResource bool `json:"onlyResource"`
}

NodeTaskRequest for create task for node.

func CreateTaskForNode

func CreateTaskForNode(r *http.Request) (*NodeTaskRequest, error)

CreateTaskForNode creates task by spec request.

type ProfileUserInfo

type ProfileUserInfo struct {
	ID       string `json:"id"`
	FullName string `json:"fullName"`
	Avatar   string `json:"avatar"`
	Username string `json:"username,omitempty"`
	UserID   string `json:"userID,omitempty"`
}

ProfileUserInfo containы profile info.

func ExtractProfileUserInfo

func ExtractProfileUserInfo(
	user *interfaces.UserEntry) *ProfileUserInfo

ExtractProfileUserInfo extract all needed fields from user's entry.

func GetUserProfileByID

func GetUserProfileByID(r *http.Request) (*ProfileUserInfo, error)

GetUserProfileByID returns information about the user's profile. Information is requested by id.

func GetUserProfiles

func GetUserProfiles(params *APIParameters) ([]ProfileUserInfo, error)

GetUserProfiles return user profile information. Information get only by id in url query.

type ProfileUserRequest

type ProfileUserRequest struct {
	ProfileUserInfo
	Password string `json:"password"`
}

ProfileUserRequest contains request of profile.

type Role

type Role struct {
	ID   string                   `json:"id"`
	Date string                   `json:"date"`
	Data []map[string]interface{} `json:"data"`
}

Role is a structure describing role.

func GetRoles

func GetRoles(parameters *APIParameters) ([]Role, error)

GetRoles returns role list on server.

type RoleTaskRequest

type RoleTaskRequest struct {
	Role
	OnlyResource bool `json:"onlyResource"`
}

RoleTaskRequest for create task for role.

func CreateTaskForRole

func CreateTaskForRole(r *http.Request) (*RoleTaskRequest, error)

CreateTaskForRole creates task by spec request.

Jump to

Keyboard shortcuts

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