controllers

package
v0.0.0-...-88c21d1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(userId string) (string, error)

func GetUsernameFromToken

func GetUsernameFromToken(token string) (string, error)

func IsValidToken

func IsValidToken(jwtToken string) (*jwt.Token, error)

Types

type ComputingController

type ComputingController struct {
	beego.Controller
}

All operations related to the rType computing

func (*ComputingController) GetMultipleComputing

func (o *ComputingController) GetMultipleComputing(IDs []string)

@Title Get multiple computing by IDs @Description Return Computing objects if found in the DB. Not found IDs will be ignored @Param IDs path []string true "List of computing IDs" @Success 200 {object} []models.ComputingModel @Failure 403 IDs are empty @router /multi/:IDs [get]

func (*ComputingController) GetOneComputing

func (o *ComputingController) GetOneComputing(ID string)

@Title Get computing by ID @Description Find a computing resource based on ID @Param ID path string true "The ID of the resource" @Success 200 {object} models.ComputingModel @Failure 403 ID is empty @router /:ID [get]

func (*ComputingController) PostComputing

func (o *ComputingController) PostComputing(body models.ComputingNEWModel)

@Title Add computing @Description Submit a computing object @Param body body models.ComputingNEWModel true "The object content" @Success 200 {string} ID @Failure 403 Missing body or fields @router / [post]

type DataController

type DataController struct {
	beego.Controller
}

All operations related to the rType data

func (*DataController) GetMultipleData

func (o *DataController) GetMultipleData(IDs []string)

@Title Get multiple data by IDs @Description Return Data object if found in the DB. Not found IDs will be ignored @Param IDs path []string true "List of data IDs" @Success 200 {object} []models.DataModel @Failure 403 IDs are empty @router /multi/:IDs [get]

func (*DataController) GetOneData

func (o *DataController) GetOneData(ID string)

@Title Get data by ID @Description Find rType data based on ID @Param ID path string true "The ID of the data resource" @Success 200 {object} models.DataModel @Failure 403 ID is empty @router /:ID [get]

func (*DataController) PostData

func (o *DataController) PostData(body models.DataNEWModel)

@Title Create Data @Description Submit data object @Param body body models.DataNEWModel true "The object content" @Success 200 {string} ID @Failure 403 Missing body or fields @router / [post]

type DatacenterController

type DatacenterController struct {
	beego.Controller
}

DatacenterController operations about datacenters

func (*DatacenterController) GetMultipleDatacenter

func (o *DatacenterController) GetMultipleDatacenter(IDs []string)

@Title Get multiple datacenters by IDs @Description Return Datacenter objects if found in the DB. Not found IDs will be ignored @Param IDs path []string true "List of datacenter IDs" @Success 200 {object} []models.ComputingModel @Failure 403 IDs are empty @router /multi/:IDs [get]

func (*DatacenterController) GetOneDatacenter

func (o *DatacenterController) GetOneDatacenter(ID string)

@Title GetOneDatacenter @Description find datacenter by ID @Param ID path string true "the ID you want to get" @Success 200 {object} models.DatacenterModel @Failure 403 ID is empty @router /:ID [get]

func (*DatacenterController) PostDatacenter

func (o *DatacenterController) PostDatacenter(body models.DatacenterNEWModel)

@Title Create Datacenter @Description submit Datacenter object @Param body body models.DatacenterNEWModel true "The object content" @Success 200 {string} models.DatacenterModel @Failure 403 Missing body or fields @router / [post]

type ScheduleController

type ScheduleController struct {
	beego.Controller
}

func (*ScheduleController) CheckSchedule

func (u *ScheduleController) CheckSchedule(cron string, duration uint, startDate, stopDate time.Time, requirements models.ExecutionRequirementsModel)

@Title Check if schedule can be created in this DC @Description Check for availability of this DC @Param cron query string true "Cron syntax" @Param duration query uint true "Duration in seconds" @Param startDate query time.Time true "RFC3339 time for startDate" @Param stopDate query time.Time true "RFC3339 time for stopDate" @Param requirements body models.ExecutionRequirementsModel true "The object content" @Success 200 The schedule can be created @Failure 403 Authentication issue @Failure 400 Other error. Check the output // @Security jwtAPIToken @router /check [post]

func (*ScheduleController) CreateSchedule

func (u *ScheduleController) CreateSchedule(dcName, workflowName, cron string, duration uint, startDate, stopDate time.Time, requirements models.ExecutionRequirementsModel)

@Title Create schedule @Description Create schedule for a workflow. It will return some future executions just as information @Param dcName query string true "Name of the node (oc-catalog) from where the workflow comes." @Param workflowName query string true "Workflow Name" @Param cron query string true "Cron syntax with year. If no year is specified, will use the current" @Param duration query uint true "Duration in seconds" @Param startDate query time.Time true "RFC3339 time for startDate" @Param stopDate query time.Time true "RFC3339 time for stopDate" @Param requirements body models.ExecutionRequirementsModel true "The object content" @Success 200 {object} models.ScheduleInfo @Failure 403 Authentication issue @Failure 400 workflowName not found or empty // @Security jwtAPIToken @router /book [post]

func (*ScheduleController) GetNextSchedules

func (u *ScheduleController) GetNextSchedules(baseDate time.Time)

@Title Get next schedule @Description Give a date, get the next date where there are at least on schedule. If no hours specified, will assume 00:00 @Param baseDate query time.Time true "Base date" @Success 200 {object} *time.Time @Failure 403 Authentication issue @Failure 400 Other error. Check the output // @Security jwtAPIToken @router /next [get]

func (*ScheduleController) GetPreviousSchedules

func (u *ScheduleController) GetPreviousSchedules(baseDate time.Time)

@Title Get previous schedule @Description Give a date, get the previous date where there are at least on schedule. If no hours specified, will assume 00:00 @Param baseDate query time.Time true "Base date" @Success 200 {object} *time.Time @Failure 403 Authentication issue @Failure 400 Other error. Check the output // @Security jwtAPIToken @router /previous [get]

func (*ScheduleController) GetSchedules

func (u *ScheduleController) GetSchedules(startDate time.Time, stopDate time.Time)

@Title Get schedules @Description Get a list of next startDates schedules (inclusive). If timezone is not specified, will assume UTC @Param startDate query time.Time true "Start date" @Param stopDate query time.Time true "End date" @Success 200 {object} []models.ScheduleDB @Success 201 Too much elements within the range of dates @Failure 403 Authentication issue @Failure 400 Other error. Check the output // @Security jwtAPIToken @router / [get]

type SearchController

type SearchController struct {
	beego.Controller
}

func (*SearchController) FindByWord

func (o *SearchController) FindByWord(word string)

TODO: Search by word is very very inneficent for not small databases @Title Search by word @Description find resources by word @Param word query string true "Word to search across all resources" @Success 200 {object} models.SearchResult @Failure 503 Internal error @router /byWord [get]

type StorageController

type StorageController struct {
	beego.Controller
}

StorageController operations about storage

func (*StorageController) GetMultipleStorage

func (o *StorageController) GetMultipleStorage(IDs []string)

@Title Get multiple storages by IDs @Description Return Storage objects if found in the DB. Not found IDs will be ignored @Param IDs path []string true "List of storage IDs" @Success 200 {object} []models.ComputingModel @Failure 403 IDs are empty @router /multi/:IDs [get]

func (*StorageController) GetOneStorage

func (o *StorageController) GetOneStorage(ID string)

@Title Get @Description find storage by ID @Param ID path string true "the ID you want to get" @Success 200 {object} models.StorageModel @Failure 403 ID is empty @router /:ID [get]

func (*StorageController) PostStorage

func (o *StorageController) PostStorage(body models.StorageNEWModel)

@Title Create Storage @Description submit storage object @Param body body models.StorageNEWModel true "The object content" @Success 200 {string} models.StorageModel @Failure 403 Missing body or fields @router / [post]

type UserController

type UserController struct {
	beego.Controller
}

func (*UserController) Login

func (u *UserController) Login()

@Title Login @Description Logs user into the system @Param username query string true "The username for login" @Param password query string true "The password for login" @Success 200 {string} login success @Failure 403 user not exist @router /login [get]

func (*UserController) Logout

func (u *UserController) Logout()

@Title logout @Description Logs out current logged in user session @Success 200 {string} logout success // @Security mySecurityPathNameApiKey @router /logout [get]

type WorkflowController

type WorkflowController struct {
	beego.Controller
}

func (*WorkflowController) AddElementWorkflow

func (u *WorkflowController) AddElementWorkflow(workflowName, rID string)

@Title Add new object to a Workflow @Description Create a Rtype object from already added resources to the workspace @Param workflowName path string true "workflow Name" @Param rID query string true "rID of already existing item in Workspace" @Success 200 {string} ID of the new object (rObjID) @Failure 403 Authentication issue @Failure 400 {string} Other error // @Security jwtAPIToken @router /:workflowName/add [post]

func (*WorkflowController) BookWorkflowSchedule

func (u *WorkflowController) BookWorkflowSchedule(workflowName string)

@Title Book Schedule @Description Book a schedule in all DCs of the workflow. Must set a desired schedule first! @Param workflowName path string true "Workflow Name" @Success 200 {object} []models.DCstatus @Failure 403 Authentication issue @Failure 401 Other error. Check output @router /:workflowName/schedule/book [post]

func (*WorkflowController) CheckWorkflowSchedule

func (u *WorkflowController) CheckWorkflowSchedule(workflowName string)

@Title Check Schedule @Description Check if we can schedule the project in other DCs. Must set a desired schedule first! @Param workflowName path string true "Workflow Name" @Success 200 {object} []models.DCstatus @Failure 403 Authentication issue @Failure 401 Other error @router /:workflowName/schedule/check [get]

func (*WorkflowController) CreateWorkflow

func (u *WorkflowController) CreateWorkflow(workflowName string)

@Title Create a new workflow @Description Create a name for the new workflow @Param workflowName query string true "Name of the workflow" @Success 200 {string} Workflow created succeful @Failure 403 Authentication issue @Failure 400 {string} Other error // @Security jwtAPIToken @router / [post]

func (*WorkflowController) GetWorkflow

func (u *WorkflowController) GetWorkflow(workflowName string)

@Title Get Workflow @Description Get a workflow by name @Param workflowName path string true "Workflow Name" @Success 200 {object} models.Workflow @Failure 403 Authentication issue @Failure 400 {string} Other error // @Security jwtAPIToken @router /:workflowName [get]

func (*WorkflowController) GetWorkflowSchedule

func (u *WorkflowController) GetWorkflowSchedule(workflowName string)

@Title Get Schedule @Description Obtain the desired schedule of this workflow @Param workflowName path string true "Workflow Name" @Success 200 {object} models.ScheduleTime @Failure 403 Authentication issue @Failure 400 Workflow doesn't exist @Failure 401 Other error @router /:workflowName/schedule [get]

func (*WorkflowController) LinkElementsWorkflow

func (u *WorkflowController) LinkElementsWorkflow(workflowName, rObjIDsource, rObjIDtarger string, isInput bool)

@Title Create a realtionship between two Robjects @Description Create a Rtype object from already added resources to the workspace @Param workflowName path string true "Workflow Name" @Param rObjIDsource query string true "Robject source. Usually Data" @Param isInput query bool true "If the operation is for input (true) linkage or output (false)" @Param rObjIDtarger query string true "Robject where will be written the association" @Success 200 {string} ID of the new object (rObjID) @Failure 403 Authentication issue @Failure 400 {string} Other error // @Security jwtAPIToken @router /:workflowName/link [post]

func (*WorkflowController) ListWorkflows

func (u *WorkflowController) ListWorkflows()

@Title List workflows @Description List available workflows @Success 200 []string List of workflows @Failure 403 Authentication issue @Failure 400 {string} Other error // @Security jwtAPIToken @router / [get]

func (*WorkflowController) MxGraphParser

func (u *WorkflowController) MxGraphParser(workflowName, xmlData string)

@Title Parse mxGraph @Description If we use this aproach to transofrm mxgraph representation in our representation, we should not use other API calls for modify the project structure or we'll have inconsistencies. @Param workflowName path string true "Workflow Name" @Param xmlData body string true "Xml representation of the workflow" @Success 200 The xmlgraph consumed correctly @Success 201 The xmlgraph consumed with issues @Failure 403 Authentication issue @Failure 400 {string} Other error @router /:workflowName/mxGraphParser [post]

func (*WorkflowController) MxGraphParserConsume

func (u *WorkflowController) MxGraphParserConsume(workflowName string)

@Title Get mxGraph last status @Description Obtain the last mxgraph XML status from the workflow @Param workflowName path string true "Workflow Name" @Success 200 The xmlgraph @Success 201 Empty workflow @Failure 403 Authentication issue @Failure 400 {string} Other error @router /:workflowName/mxGraphParser [get]

func (*WorkflowController) SetWorkflowSchedule

func (u *WorkflowController) SetWorkflowSchedule(workflowName, cronString, events string, isService bool, startDate, stopDate time.Time, duration uint)

@Title Set Schedule @Description Set desired schedule by the user. No other effects a part of saving the user input @Param workflowName path string true "Workflow Name" @Param isService query bool true "True: Service, False: Task" @Param startDate query time.Time true "RFC3339 time for startDate" @Param stopDate query time.Time true "RFC3339 time for stopDate" @Param events query string false "List of events separated by comma" @Param cronString query string false "Cron string" @Param duration query uint false "Duration in seconds" @Success 200 {object} models.ScheduleInfo @Failure 403 Authentication issue @Failure 400 Workflow doesn't exist @Failure 401 Other error @Failure 402 Bad user input @router /:workflowName/schedule [put]

type WorkspaceController

type WorkspaceController struct {
	beego.Controller
}

func (*WorkspaceController) AddModel

func (u *WorkspaceController) AddModel(id, rtype string)

@Title Add model to workspace @Description Insert a resource in the workspace @Param id query string true "ID of a resource" @Param rtype query string true "Type of resource" @Success 200 {string} login success @Failure 403 Authentication issue @Failure 400 {string} Other error // @Security jwtAPIToken @router / [post]

func (*WorkspaceController) DeleteElement

func (u *WorkspaceController) DeleteElement(id, rtype string)

@Title Delete element from user workspace @Description Remove a resource from the workspace @Param id query string true "ID of a resource" @Param rtype query string true "Type of resource" @Success 200 {string} Removed succeful @Failure 403 Authentication issue @Failure 400 {string} Other error // @Security jwtAPIToken @router / [delete]

func (*WorkspaceController) ListWorkspace

func (u *WorkspaceController) ListWorkspace()

@Title Get workspace @Description Get workspace elements based on user_id token @Success 200 {object} models.Workspace @Failure 403 Authentication issue // @Security jwtAPIToken @router /list [get]

func (*WorkspaceController) ListWorkspaceModel

func (u *WorkspaceController) ListWorkspaceModel()

@Title Get full workspace @Description Get full workspace elements based on user_id token @Success 200 {object} models.WorkspaceModel @Failure 403 Authentication issue // @Security jwtAPIToken @router /list_model [get]

Jump to

Keyboard shortcuts

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