vcs

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: BSD-3-Clause Imports: 23 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryString

func QueryString(r *http.Request, s string) string

QueryString return a string from a query parameter

Types

type BitbucketCloudConfiguration

type BitbucketCloudConfiguration struct {
	ClientID     string `toml:"clientId" json:"-" default:"xxxxx" comment:"Bitbucket cloud OAuth Application Client ID"`
	ClientSecret string `toml:"clientSecret" json:"-" default:"xxxxx" comment:"Bitbucket Cloud OAuth Application Client Secret"`
	Status       struct {
		Disable    bool `` /* 141-byte string literal not displayed */
		ShowDetail bool `` /* 159-byte string literal not displayed */
	}
	DisableWebHooks bool `toml:"disableWebHooks" comment:"Does webhooks are supported by VCS Server" json:"disable_web_hook"`
	// DisablePolling  bool   `toml:"disablePolling" comment:"Does polling is supported by VCS Server" json:"disable_polling"`
	ProxyWebhook string `` /* 272-byte string literal not displayed */

}

BitbucketCloudConfiguration represents the bitbucket configuration

type BitbucketServerConfiguration

type BitbucketServerConfiguration struct {
	ConsumerKey string `toml:"consumerKey" json:"-" default:"xxxxx" comment:"You can change the consumeKey if you want"`
	PrivateKey  string `toml:"privateKey" json:"-" default:"xxxxx"`
	Status      struct {
		Disable bool `` /* 141-byte string literal not displayed */
	}
	DisableWebHooks bool   `toml:"disableWebHooks" comment:"Does webhooks are supported by VCS Server" json:"disable_web_hook"`
	DisablePolling  bool   `toml:"disablePolling" comment:"Does polling is supported by VCS Server" json:"disable_polling"`
	ProxyWebhook    string `` /* 272-byte string literal not displayed */
	Username        string `` /* 171-byte string literal not displayed */
	Token           string `` /* 164-byte string literal not displayed */
}

BitbucketServerConfiguration represents the bitbucket configuration

type Configuration

type Configuration struct {
	Name  string                          `toml:"name" comment:"Name of this CDS VCS Service\n Enter a name to enable this service" json:"name"`
	HTTP  service.HTTPRouterConfiguration `toml:"http" comment:"######################\n CDS VCS HTTP Configuration \n######################" json:"http"`
	URL   string                          `default:"http://localhost:8084" json:"url"`
	API   service.APIServiceConfiguration `toml:"api" comment:"######################\n CDS API Settings \n######################" json:"api"`
	Cache struct {
		TTL   int `toml:"ttl" default:"60" json:"ttl"`
		Redis struct {
			Host     string `` /* 192-byte string literal not displayed */
			Password string `toml:"password" json:"-"`
			DbIndex  int    `toml:"dbindex" default:"0" json:"dbindex"`
		} `toml:"redis" json:"redis"`
	} `toml:"cache" comment:"######################\n CDS VCS Cache Settings \n######################" json:"cache"`
	ProxyWebhook string                         `` /* 272-byte string literal not displayed */
	Servers      map[string]ServerConfiguration `toml:"servers" comment:"######################\n CDS VCS Server Settings \n######################" json:"servers"`
}

Configuration is the vcs configuration structure

type GerritServerConfiguration

type GerritServerConfiguration struct {
	Status struct {
		Disable    bool `` /* 141-byte string literal not displayed */
		ShowDetail bool `` /* 159-byte string literal not displayed */
	} `json:"status"`
	DisableGerritEvent bool `toml:"disableGerritEvent" comment:"Does gerrit event stream are supported by VCS Server" json:"disable_gerrit_event"`
	SSHPort            int  `toml:"sshport" default:"" commented:"true" comment:"SSH port of gerrit, example: 29418" json:"ssh_port"`
	EventStream        struct {
		User       string `toml:"user" default:"" commented:"true" comment:"User to access to gerrit event stream" json:"user"`
		PrivateKey string `toml:"privateKey" default:"" commented:"true" comment:"Private key of the user who access to gerrit event stream" json:"-"`
	} `json:"event_stream"`
	Reviewer struct {
		User  string `toml:"user" default:"" commented:"true" comment:"User that review changes" json:"user"`
		Token string `toml:"token" default:"" commented:"true" comment:"Token of the reviewer" json:"-"`
	} `json:"reviewer"`
}

GerritServerConfiguration represents the gerrit configuration

type GithubServerConfiguration

type GithubServerConfiguration struct {
	ClientID     string `toml:"clientId" json:"-" default:"xxxxx" comment:"GitHub OAuth Application Client ID"`
	ClientSecret string `toml:"clientSecret" json:"-" default:"xxxxx" comment:"GitHub OAuth Application Client Secret"`
	APIURL       string `toml:"apiUrl" json:"-" default:"https://api.github.com" comment:"The URL for the GitHub API."`
	Status       struct {
		Disable    bool `` /* 141-byte string literal not displayed */
		ShowDetail bool `` /* 159-byte string literal not displayed */
	}
	DisableWebHooks bool   `toml:"disableWebHooks" comment:"Does webhooks are supported by VCS Server" json:"disable_web_hook"`
	DisablePolling  bool   `toml:"disablePolling" comment:"Does polling is supported by VCS Server" json:"disable_polling"`
	ProxyWebhook    string `` /* 272-byte string literal not displayed */
	Username        string `` /* 168-byte string literal not displayed */
	Token           string `` /* 161-byte string literal not displayed */
}

GithubServerConfiguration represents the github configuration

type GitlabServerConfiguration

type GitlabServerConfiguration struct {
	AppID       string `toml:"appId" json:"-" default:"xxxxx" comment:"GitLab Application ID"`
	Secret      string `toml:"secret" json:"-" default:"xxxxx" comment:"GitLab Application Secret"`
	CallbackURL string `` /* 154-byte string literal not displayed */
	Status      struct {
		Disable    bool `` /* 141-byte string literal not displayed */
		ShowDetail bool `` /* 159-byte string literal not displayed */
	}
	DisableWebHooks bool   `toml:"disableWebHooks" comment:"Does webhooks are supported by VCS Server" json:"disable_web_hook"`
	DisablePolling  bool   `toml:"disablePolling" comment:"Does polling is supported by VCS Server" json:"disable_polling"`
	ProxyWebhook    string `` /* 272-byte string literal not displayed */
}

GitlabServerConfiguration represents the gitlab configuration

type ServerConfiguration

type ServerConfiguration struct {
	URL            string                        `toml:"url" comment:"URL of this VCS Server" json:"url"`
	Github         *GithubServerConfiguration    `` /* 178-byte string literal not displayed */
	Gitlab         *GitlabServerConfiguration    `` /* 178-byte string literal not displayed */
	Bitbucket      *BitbucketServerConfiguration `` /* 171-byte string literal not displayed */
	BitbucketCloud *BitbucketCloudConfiguration  `` /* 185-byte string literal not displayed */
	Gerrit         *GerritServerConfiguration    `` /* 152-byte string literal not displayed */
}

ServerConfiguration is the configuration for a VCS server

type Service

type Service struct {
	service.Common
	Cfg    Configuration
	Router *api.Router
	Cache  cache.Store
	UI     struct {
		HTTP struct {
			URL string
		}
	}
}

Service is the stuct representing a vcs µService

func New

func New() *Service

New returns a new service

func (*Service) ApplyConfiguration

func (s *Service) ApplyConfiguration(config interface{}) error

ApplyConfiguration apply an object of type hooks.Configuration after checking it

func (*Service) CheckConfiguration

func (s *Service) CheckConfiguration(config interface{}) error

CheckConfiguration checks the validity of the configuration object

func (*Service) Init

func (s *Service) Init(config interface{}) (cdsclient.ServiceConfig, error)

func (*Service) SearchPullRequestHandler added in v0.53.0

func (s *Service) SearchPullRequestHandler() service.Handler

func (*Service) Serve

func (s *Service) Serve(c context.Context) error

Serve will start the http api server

func (*Service) Status

func (s *Service) Status(ctx context.Context) *sdk.MonitoringStatus

Status returns sdk.MonitoringStatus, implements interface service.Service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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