controller

package
v0.0.0-...-b6f1020 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// EntryName name of entry
	EntryName = "ws-controller"
	// EntryType type of entry
	EntryType = "ws-controller"
	// EntryDescription description of entry
	EntryDescription = "Entry for controller entry."
)
View Source
const (
	PerPageDefault = 10
	PageDefault    = 1
)

Variables

This section is empty.

Functions

func CreateOrg

func CreateOrg(ctx *gin.Context)

CreateOrg @Summary Create organization @Id 3 @version 1.0 @Tags organization @produce application/json @Param orgName query string true "Organization name" @Success 200 {object} CreateOrgResponse @Router /v1/org [put]

func CreateProj

func CreateProj(ctx *gin.Context)

CreateProj @Summary create project @Id 8 @version 1.0 @Tags project @produce application/json @Param project body CreateProjRequest true "Project" @Success 200 {object} CreateProjResponse @Router /v1/proj [put]

func CreateSource

func CreateSource(ctx *gin.Context)

CreateSource @Summary create source @Id 11 @version 1.0 @Tags source @produce application/json @Param projId query int true "Project Id" @Param source body CreateSourceRequest true "Source" @Success 200 {object} CreateSourceResponse @Router /v1/source [put]

func DeleteOrg

func DeleteOrg(ctx *gin.Context)

DeleteOrg @Summary Delete organization @Id 4 @version 1.0 @Tags organization @produce application/json @Param orgId path int true "Organization Id" @Success 200 {object} DeleteOrgResponse @Router /v1/org/{orgId} [delete]

func DeleteProj

func DeleteProj(ctx *gin.Context)

DeleteProj @Summary delete project @Id 9 @version 1.0 @Tags project @produce application/json @Param projId path int true "Project Id" @Success 200 {object} DeleteProjResponse @Router /v1/proj/{projId} [delete]

func DeleteSource

func DeleteSource(ctx *gin.Context)

DeleteSource @Summary delete source @Id 12 @version 1.0 @Tags source @produce application/json @Param sourceId path int true "Source Id" @Success 200 {object} DeleteProjResponse @Router /v1/source/{sourceId} [delete]

func GetOrg

func GetOrg(ctx *gin.Context)

GetOrg @Summary Get organization @Id 2 @version 1.0 @Tags organization @produce application/json @Param orgId path int true "Organization Id" @Success 200 {object} GetOrgResponse @Router /v1/org/{orgId} [get]

func GetProj

func GetProj(ctx *gin.Context)

GetProj @Summary Get project @Id 7 @version 1.0 @Tags project @produce application/json @Param projId path int true "Project Id" @Success 200 {object} GetProjResponse @Router /v1/proj/{projId} [get]

func ListBranchesAndTags

func ListBranchesAndTags(ctx *gin.Context)

ListBranchesAndTags @Summary List branches and tags @Id 16 @version 1.0 @Tags installation @produce application/json @Param sourceId path int true "Source Id" @Param perPage query int false "Number of commits per page" @Param page query int false "Page number to fetch" @Success 200 @Router /v1/source/{sourceId}/branches [get]

func ListBranchesAndTagsFromGithub

func ListBranchesAndTagsFromGithub(src *repository.Source, accessToken string, perPage, page int) ([]string, []string, error)

ListBranchesAndTagsFromGithub returns branches and taqs from github repository.

func ListCommits

func ListCommits(ctx *gin.Context)

ListCommits @Summary List user installation commits @Id 15 @version 1.0 @Tags installation @produce application/json @Param sourceId path int true "Source Id" @Param branch query string true "Branch" @Param perPage query int false "Number of commits per page" @Param page query int false "Page number to fetch" @Success 200 @Router /v1/source/{sourceId}/commits [get]

func ListOrg

func ListOrg(ctx *gin.Context)

ListOrg @Summary List organizations @Id 1 @version 1.0 @Tags organization @produce application/json @Success 200 {object} ListOrgResponse @Router /v1/org [get]

func ListPipelineTemplate

func ListPipelineTemplate(ctx *gin.Context)

ListPipelineTemplate @Summary List pipeline templates @Id 14 @version 1.0 @Tags pipeline @produce application/json @Success 200 {object} ListPipelineTemplateResponse @Router /v1/pipeline/template [get]

func ListProj

func ListProj(ctx *gin.Context)

ListProj @Summary List projects @Id 6 @version 1.0 @Tags project @produce application/json @Param orgId query int false "Organization Id" @Success 200 {object} ListProjResponse @Router /v1/proj [get]

func ListUserInstallations

func ListUserInstallations(ctx *gin.Context)

ListUserInstallations @Summary List user installations @Id 13 @version 1.0 @Tags installation @produce application/json @Param source query string true "Source" @Param user query string true "user" @Success 200 @Router /v1/user/installations [get]

func RegisterControllerFromConfig

func RegisterControllerFromConfig(configFilePath string) map[string]rkentry.Entry

RegisterControllerFromConfig is an implementation of: type EntryRegFunc func(string) map[string]rkentry.Entry

func UpdateOrg

func UpdateOrg(ctx *gin.Context)

UpdateOrg @Summary Update organization @Id 5 @version 1.0 @Tags organization @produce application/json @Param org body UpdateOrgRequest true "Organization" @Param orgId path int true "Organization Id" @Success 200 {object} UpdateOrgResponse @Router /v1/org/{orgId} [post]

func UpdateProj

func UpdateProj(ctx *gin.Context)

UpdateProj @Summary update project @Id 10 @version 1.0 @Tags project @produce application/json @Param projId path int true "Project Id" @Param project body UpdateProjRequest true "Project" @Success 200 {object} UpdateProjResponse @Router /v1/proj/{projId} [post]

Types

type Artifact

type Artifact struct {
	Id   int    `yaml:"id" json:"id"`
	Name string `yaml:"name" json:"name"`
}

type BootConfig

type BootConfig struct {
	Controller struct {
		Enabled bool `yaml:"enabled" json:"enabled"`
		Logger  struct {
			ZapLogger struct {
				Ref string `yaml:"ref" json:"ref"`
			} `yaml:"zapLogger" json:"zapLogger"`
			EventLogger struct {
				Ref string `yaml:"ref" json:"ref"`
			} `yaml:"eventLogger" json:"eventLogger"`
		} `yaml:"logger" json:"logger"`
	} `yaml:"controller" json:"controller"`
}

BootConfig is a struct which is for unmarshalled YAML

type Commit

type Commit struct {
	Id           string    `yaml:"id" json:"id"`
	Url          string    `yaml:"url" json:"url"`
	Message      string    `yaml:"message" json:"message"`
	Date         time.Time `yaml:"date" json:"date"`
	Committer    string    `yaml:"committer" json:"committer"`
	CommitterUrl string    `yaml:"committerUrl" json:"committerUrl"`
	Artifact     *Artifact `yaml:"artifact" json:"artifact"`
}

func ListCommitsFromGithub

func ListCommitsFromGithub(src *repository.Source, branch, accessToken string, perPage, page int) ([]*Commit, error)

ListCommitsFromGithub returns commits from remote github repository. The repos would have access permission with Github app named as workstation.

type Controller

type Controller struct {
	EntryName        string                    `json:"entryName" yaml:"entryName"`
	EntryType        string                    `json:"entryType" yaml:"entryType"`
	EntryDescription string                    `json:"entryDescription" yaml:"entryDescription"`
	ZapLoggerEntry   *rkentry.ZapLoggerEntry   `json:"zapLoggerEntry" yaml:"zapLoggerEntry"`
	EventLoggerEntry *rkentry.EventLoggerEntry `json:"eventLoggerEntry" yaml:"eventLoggerEntry"`
	Repo             repository.Repository     `json:"repository" yaml:"repository"`
}

Controller performs as manager of project and organizations

func GetController

func GetController() *Controller

GetController returns ProjectEntry.

func RegisterController

func RegisterController(opts ...ControllerOption) *Controller

RegisterController will register Entry into GlobalAppCtx

func (*Controller) Bootstrap

func (con *Controller) Bootstrap(context.Context)

Bootstrap entry

func (*Controller) GetDescription

func (con *Controller) GetDescription() string

GetDescription returns entry description

func (*Controller) GetName

func (con *Controller) GetName() string

GetName returns entry name

func (*Controller) GetType

func (con *Controller) GetType() string

GetType returns entry type as project

func (*Controller) Interrupt

func (con *Controller) Interrupt(context.Context)

Interrupt entry

func (*Controller) String

func (con *Controller) String() string

String returns entry as string

type ControllerOption

type ControllerOption func(*Controller)

ControllerOption will be extended in future.

type CreateOrgResponse

type CreateOrgResponse struct {
	OrgId int `yaml:"orgId" json:"orgId"`
}

CreateOrgResponse response of create organization

type CreateProjRequest

type CreateProjRequest struct {
	OrgId   int    `yaml:"orgId" json:"orgId"`
	OrgName string `yaml:"orgName" json:"orgName"`
	Name    string `yaml:"name" json:"name"`
}

CreateProjRequest request body

type CreateProjResponse

type CreateProjResponse struct {
	OrgId  int `yaml:"orgId" json:"orgId"`
	ProjId int `yaml:"projId" json:"projId"`
}

CreateProjResponse response of create project

type CreateSourceRequest

type CreateSourceRequest struct {
	Type       string `yaml:"type" json:"type"`
	Repository string `yaml:"repository" json:"repository"`
}

CreateSourceRequest request body

type CreateSourceResponse

type CreateSourceResponse struct {
	ProjId   int `yaml:"projId" json:"projId"`
	SourceId int `yaml:"sourceId" json:"sourceId"`
}

CreateSourceResponse response of create source

type DeleteOrgResponse

type DeleteOrgResponse struct {
	Status bool `yaml:"status" json:"status"`
}

DeleteOrgResponse response of delete organization

type DeleteProjResponse

type DeleteProjResponse struct {
	Status bool `yaml:"status" json:"status"`
}

DeleteProjResponse response of delete project

type DeleteSourceResponse

type DeleteSourceResponse struct {
	Status bool `yaml:"status" json:"status"`
}

DeleteSourceResponse response of delete source

type GetOrgResponse

type GetOrgResponse struct {
	Org *Org `yaml:"org" json:"org"`
}

GetOrgResponse response of get organization

type GetProjResponse

type GetProjResponse struct {
	Proj *Proj `yaml:"proj" json:"proj"`
}

GetProjResponse response of get project

type Installation

type Installation struct {
	RepoSource   string        `yaml:"repoSource" json:"repoSource"`
	Organization string        `yaml:"organization" json:"organization"`
	AvatarUrl    string        `yaml:"avatarUrl" json:"avatarUrl"`
	Repos        []*Repository `yaml:"repos" json:"repos"`
}

func ListUserInstallationsFromGithub

func ListUserInstallationsFromGithub(user string) ([]*Installation, error)

ListUserInstallations returns repositories from code repo created by user. The repos would have access permission with Github app named as workstation.

type ListBranchesAndTagsResponse

type ListBranchesAndTagsResponse struct {
	Branches []string `yaml:"branches" json:"branches"`
	Tags     []string `yaml:"tags" json:"tags"`
}

type ListCommitsResponse

type ListCommitsResponse struct {
	Commits []*Commit `yaml:"commits" json:"commits"`
}

ListCommitsResponse response of user commits of source

type ListOrgResponse

type ListOrgResponse struct {
	OrgList []*Org `yaml:"orgList" json:"orgList"`
}

ListOrgResponse response of list organization

type ListPipelineTemplateResponse

type ListPipelineTemplateResponse struct {
	TemplateList []*PipelineTemplate `yaml:"templateList" json:"templateList"`
}

ListPipelineTemplateResponse response of list organization

type ListProjResponse

type ListProjResponse struct {
	ProjList []*Proj `yaml:"projList" json:"projList"`
}

ListProjResponse response of list projects

type Org

type Org struct {
	Meta    *repository.Org `yaml:"meta" json:"meta"`
	ProjIds []int           `yaml:"projIds" json:"projIds"`
}

Org is model for API response

type PipelineTemplate

type PipelineTemplate struct {
	Meta *repository.PipelineTemplate `yaml:"meta" json:"meta"`
}

PipelineTemplate is model for API response

type Proj

type Proj struct {
	Meta *repository.Proj `yaml:"meta" json:"meta"`
}

Proj is model for API response

type Repository

type Repository struct {
	FullName string `yaml:"fullName" json:"fullName"`
	Name     string `yaml:"name" json:"name"`
}

type UpdateOrgRequest

type UpdateOrgRequest struct {
	Name string `yaml:"name" json:"name"`
}

UpdateOrgRequest request body of update organization

type UpdateOrgResponse

type UpdateOrgResponse struct {
	Status bool `yaml:"status" json:"status"`
}

UpdateOrgResponse response of update organization

type UpdateProjRequest

type UpdateProjRequest struct {
	Name string `yaml:"name" json:"name"`
}

UpdateProjRequest request body

type UpdateProjResponse

type UpdateProjResponse struct {
	Status bool `yaml:"status" json:"status"`
}

UpdateProjResponse response of update project

Jump to

Keyboard shortcuts

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