models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2017 License: MIT Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeServices

func InitializeServices() error

InitializeServices grabs all the services from the configuration and initializes the All variable

Types

type Build

type Build struct {
	ID           int
	Number       int
	Event        string
	Status       string
	EnqueuedAt   time.Time
	CreatedAt    time.Time
	StartedAt    time.Time
	FinishedAt   time.Time
	DeployTo     string
	Commit       string
	Branch       string
	Ref          string
	Refspec      string
	Remote       string
	Title        string
	Message      string
	Timestamp    time.Time
	Author       string
	AuthorAvatar string
	AuthorEmail  string
	LinkURL      string
	Duration     time.Duration
}

Build is the parsed CI response

type Builds

type Builds []Build

Builds represent multiple builds

type CI

type CI struct {
	API string `json:"api"`
	URL string `json:"url"`
}

CI represents data from the CI

type Commit

type Commit struct {
	Sha    string `json:"sha"`
	Commit struct {
		Author struct {
			Name  string    `json:"name"`
			Email string    `json:"email"`
			Date  time.Time `json:"date"`
		} `json:"author"`
		Committer struct {
			Name  string    `json:"name"`
			Email string    `json:"email"`
			Date  time.Time `json:"date"`
		} `json:"committer"`
		Message string `json:"message"`
		Tree    struct {
			Sha string `json:"sha"`
			URL string `json:"url"`
		} `json:"tree"`
		URL          string `json:"url"`
		CommentCount int    `json:"comment_count"`
		Verification struct {
			Verified  bool        `json:"verified"`
			Reason    string      `json:"reason"`
			Signature interface{} `json:"signature"`
			Payload   interface{} `json:"payload"`
		} `json:"verification"`
	} `json:"commit"`
	URL         string `json:"url"`
	HTMLURL     string `json:"html_url"`
	CommentsURL string `json:"comments_url"`
	Author      GHUser `json:"author"`
	Committer   GHUser `json:"committer"`
	Parents     []struct {
		Sha     string `json:"sha"`
		URL     string `json:"url"`
		HTMLURL string `json:"html_url"`
	} `json:"parents"`
}

Commit represents a single commit

type Commits

type Commits []Commit

Commits represents multiple commits

type GHOrganization

type GHOrganization struct {
	Login             string `json:"login"`
	ID                int    `json:"id"`
	AvatarURL         string `json:"avatar_url"`
	GravatarID        string `json:"gravatar_id"`
	URL               string `json:"url"`
	HTMLURL           string `json:"html_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	OrganizationsURL  string `json:"organizations_url"`
	ReposURL          string `json:"repos_url"`
	EventsURL         string `json:"events_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	Type              string `json:"type"`
	SiteAdmin         bool   `json:"site_admin"`
}

GHOrganization represents a single Github organization

type GHPermissions

type GHPermissions struct {
	Admin bool `json:"admin"`
	Push  bool `json:"push"`
	Pull  bool `json:"pull"`
}

GHPermissions represents Github permissions

type GHRepo

type GHRepo struct {
	ID               int            `json:"id"`
	Owner            GHUser         `json:"owner"`
	Name             string         `json:"name"`
	FullName         string         `json:"full_name"`
	Description      string         `json:"description"`
	Private          bool           `json:"private"`
	Fork             bool           `json:"fork"`
	URL              string         `json:"url"`
	HTMLURL          string         `json:"html_url"`
	ArchiveURL       string         `json:"archive_url"`
	AssigneesURL     string         `json:"assignees_url"`
	BlobsURL         string         `json:"blobs_url"`
	BranchesURL      string         `json:"branches_url"`
	CloneURL         string         `json:"clone_url"`
	CollaboratorsURL string         `json:"collaborators_url"`
	CommentsURL      string         `json:"comments_url"`
	CommitsURL       string         `json:"commits_url"`
	CompareURL       string         `json:"compare_url"`
	ContentsURL      string         `json:"contents_url"`
	ContributorsURL  string         `json:"contributors_url"`
	DeploymentsURL   string         `json:"deployments_url"`
	DownloadsURL     string         `json:"downloads_url"`
	EventsURL        string         `json:"events_url"`
	ForksURL         string         `json:"forks_url"`
	GitCommitsURL    string         `json:"git_commits_url"`
	GitRefsURL       string         `json:"git_refs_url"`
	GitTagsURL       string         `json:"git_tags_url"`
	GitURL           string         `json:"git_url"`
	HooksURL         string         `json:"hooks_url"`
	IssueCommentURL  string         `json:"issue_comment_url"`
	IssueEventsURL   string         `json:"issue_events_url"`
	IssuesURL        string         `json:"issues_url"`
	KeysURL          string         `json:"keys_url"`
	LabelsURL        string         `json:"labels_url"`
	LanguagesURL     string         `json:"languages_url"`
	MergesURL        string         `json:"merges_url"`
	MilestonesURL    string         `json:"milestones_url"`
	MirrorURL        string         `json:"mirror_url"`
	NotificationsURL string         `json:"notifications_url"`
	PullsURL         string         `json:"pulls_url"`
	ReleasesURL      string         `json:"releases_url"`
	SSHURL           string         `json:"ssh_url"`
	StargazersURL    string         `json:"stargazers_url"`
	StatusesURL      string         `json:"statuses_url"`
	SubscribersURL   string         `json:"subscribers_url"`
	SubscriptionURL  string         `json:"subscription_url"`
	SvnURL           string         `json:"svn_url"`
	TagsURL          string         `json:"tags_url"`
	TeamsURL         string         `json:"teams_url"`
	TreesURL         string         `json:"trees_url"`
	Homepage         string         `json:"homepage"`
	Language         interface{}    `json:"language"`
	ForksCount       int            `json:"forks_count"`
	StargazersCount  int            `json:"stargazers_count"`
	WatchersCount    int            `json:"watchers_count"`
	Size             int            `json:"size"`
	DefaultBranch    string         `json:"default_branch"`
	OpenIssuesCount  int            `json:"open_issues_count"`
	HasIssues        bool           `json:"has_issues"`
	HasWiki          bool           `json:"has_wiki"`
	HasPages         bool           `json:"has_pages"`
	HasDownloads     bool           `json:"has_downloads"`
	PushedAt         time.Time      `json:"pushed_at"`
	CreatedAt        time.Time      `json:"created_at"`
	UpdatedAt        time.Time      `json:"updated_at"`
	Permissions      GHPermissions  `json:"permissions"`
	SubscribersCount int            `json:"subscribers_count"`
	Organization     GHOrganization `json:"organization"`
}

GHRepo represents a single Github repository

type GHUser

type GHUser struct {
	Login             string `json:"login"`
	ID                int    `json:"id"`
	AvatarURL         string `json:"avatar_url"`
	GravatarID        string `json:"gravatar_id"`
	URL               string `json:"url"`
	HTMLURL           string `json:"html_url"`
	FollowersURL      string `json:"followers_url"`
	FollowingURL      string `json:"following_url"`
	GistsURL          string `json:"gists_url"`
	StarredURL        string `json:"starred_url"`
	SubscriptionsURL  string `json:"subscriptions_url"`
	OrganizationsURL  string `json:"organizations_url"`
	ReposURL          string `json:"repos_url"`
	EventsURL         string `json:"events_url"`
	ReceivedEventsURL string `json:"received_events_url"`
	Type              string `json:"type"`
	SiteAdmin         bool   `json:"site_admin"`
}

GHUser represents a github user

type LoginForm

type LoginForm struct {
	Login    string `form:"login" binding:"required"`
	Password string `form:"password" binding:"required"`
}

LoginForm is a struct representing the form to login.

type Repo

type Repo struct {
	URL  string `json:"url"`
	Path string `json:"path"`
	Type string `json:"type"`
	Host string `json:"host"`

	Description string `json:"description"`
	Stars       int    `json:"stars"`
	Forks       int    `json:"forks"`
	Watchers    int    `json:"watchers"`
}

Repo holds information on a repository

type Service

type Service struct {
	ID              string        `json:"id"`
	Name            string        `json:"name"`
	URL             string        `json:"url"`
	ShortURL        string        `json:"short_url"`
	Host            string        `json:"host"`
	ServiceInterval time.Duration `json:"service_interval"`

	Repo *Repo `json:"repo,omitempty"`
	CI   *CI   `json:"ci,omitempty"`

	Last            string        `json:"last"`
	RespTime        time.Duration `json:"resp_time"`
	Status          int           `json:"status"`
	Icon            string        `json:"icon"`
	CurrentBuildURL string        `json:"current_build"`
	LastBuilds      Builds        `json:"last_builds"`
	LastCommits     Commits       `json:"last_commits"`
	Own             bool          `json:"own"`
}

Service is a single service

func NewServiceFromConf

func NewServiceFromConf(cs conf.Service) (*Service, error)

NewServiceFromConf parses a configured service and returns a service

func (*Service) FetchBuilds

func (s *Service) FetchBuilds()

FetchBuilds checks the last build

func (*Service) FetchCommits

func (s *Service) FetchCommits()

FetchCommits fetches the last commits associated to the repository

func (*Service) FetchRepoInfos

func (s *Service) FetchRepoInfos()

FetchRepoInfos fetches the repository information

func (*Service) FetchStatus

func (s *Service) FetchStatus()

FetchStatus checks if the service is running

type ServiceForm

type ServiceForm struct {
	Name     string `form:"name" binding:"required"`
	URL      string `form:"url" binding:"required"`
	ShortURL string `form:"shorturl" binding:"required"`
}

ServiceForm is the struct representing a Service (to add, or modify)

type Services

type Services []*Service

Services represents a list of services

var All Services

All represents all the services

func ParseServicesFromConf

func ParseServicesFromConf(c conf.Conf) (Services, error)

ParseServicesFromConf parses all the services in the configuration struct and returns a slice of pointers to Service

func (Services) Monitor

func (ss Services) Monitor()

Monitor allows to monitor Services every interval delay

type UnparsedBuild

type UnparsedBuild struct {
	ID           int    `json:"id"`
	Number       int    `json:"number"`
	Event        string `json:"event"`
	Status       string `json:"status"`
	EnqueuedAt   int64  `json:"enqueued_at"`
	CreatedAt    int64  `json:"created_at"`
	StartedAt    int64  `json:"started_at"`
	FinishedAt   int64  `json:"finished_at"`
	DeployTo     string `json:"deploy_to"`
	Commit       string `json:"commit"`
	Branch       string `json:"branch"`
	Ref          string `json:"ref"`
	Refspec      string `json:"refspec"`
	Remote       string `json:"remote"`
	Title        string `json:"title"`
	Message      string `json:"message"`
	Timestamp    int64  `json:"timestamp"`
	Author       string `json:"author"`
	AuthorAvatar string `json:"author_avatar"`
	AuthorEmail  string `json:"author_email"`
	LinkURL      string `json:"link_url"`
}

UnparsedBuild represents the unparsed response from the CI

func (UnparsedBuild) Parse

func (u UnparsedBuild) Parse() Build

Parse parses the times in the UnparsedBuild and returns a Build

type UnparsedBuilds

type UnparsedBuilds []UnparsedBuild

UnparsedBuilds represents a list of UnparsedBuild

type User

type User struct {
	Login    string
	Password string
}

User represents a single user

Jump to

Keyboard shortcuts

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