server

package
v0.3.19 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IssueCommentEventFromJSON

func IssueCommentEventFromJSON(data io.Reader) (*github.IssueCommentEvent, error)

IssueCommentEventFromJSON parses json to a github.IssueCommentEvent

func NewBool

func NewBool(b bool) *bool

NewBool return a bool pointer

func NewInt

func NewInt(n int) *int

NewInt return an int pointer

func NewInt32

func NewInt32(n int32) *int32

NewInt32 return an int32 pointer

func NewInt64

func NewInt64(n int64) *int64

NewInt64 return an int64 pointer

func NewString

func NewString(s string) *string

NewString return a string pointer

func PingEventFromJSON

func PingEventFromJSON(data io.Reader) (*github.PingEvent, error)

PingEventFromJSON parses json to a github.PingEvent

func PullRequestEventFromJSON

func PullRequestEventFromJSON(data io.Reader) (*github.PullRequestEvent, error)

PullRequestEventFromJSON parses json to a github.PullRequestEvent

func ValidateSignature

func ValidateSignature(receivedHash []string, bodyBuffer []byte, secretKey string) error

ValidateSignature function used for validation of webhook requests based on config secret.

Types

type Builds

type Builds struct{}

Builds implements buildsInterface for working with external CI/CD systems.

type CWS

type CWS struct {
	Database                   string
	CWSSiteURL                 string
	CWSSMTPUsername            string
	CWSSMTPPassword            string
	CWSSMTPServer              string
	CWSSMTPPort                string
	CWSSMTPServerTimeout       string
	CWSSMTPConnectionSecurity  string
	CWSEmailReplyToName        string
	CWSEmailReplyToAddress     string
	CWSEmailBCCAddress         string
	CWSCloudURL                string
	CWSStripeKey               string
	CWSCloudDNSDomain          string
	CWSCloudGroupID            string
	CWSBlapiURL                string
	CWSBlapiToken              string
	CWSLicenseGeneratorURL     string
	CWSLicenseGeneratorKey     string
	CWSDisableRenewalChecks    string
	CWSSplitKey                string
	CWSSplitServerID           string
	CloudDefaultProductID      string
	CloudDefaultTrialProductID string
	DockerHubCredentials       string
	CWSPublicPort              string
	CWSPrivatePort             string
}

CWS contains all configuration for the Customer Web Server

type Deployment

type Deployment struct {
	Namespace      string
	PR             int
	ImageTag       string
	DeployFilePath string
	Environment    CWS
}

Deployment contains information needed to create a deployment in Kubernetes

type MatterwickConfig

type MatterwickConfig struct {
	ListenAddress       string
	MatterWickURL       string
	GithubAccessToken   string
	GitHubTokenReserve  int
	GithubUsername      string
	GitHubWebhookSecret string
	Org                 string
	Username            string

	SetupSpinWick        string
	SetupSpinWickHA      string
	SetupSpinWickWithCWS string
	SpinWickHALicense    string
	ProvisionerServer    string
	AWSAPIKey            string
	DNSNameTestServer    string

	CloudGroupID               string
	SetupSpinmintMessage       string
	SetupSpinmintFailedMessage string
	DestroyedSpinmintMessage   string

	DockerRegistryURL string
	DockerUsername    string
	DockerPassword    string

	MattermostWebhookURL    string
	MattermostWebhookFooter string

	KubeClusterName   string
	KubeClusterRegion string

	LogSettings struct {
		EnableDebug bool
		ConsoleJSON bool
	}

	CWSPublicAPIAddress   string
	CWSInternalAPIAddress string
	CWSAPIKey             string
	CWSUserPassword       string
	CWSSpinwickGroupID    string

	CWS CWS
}

MatterwickConfig defines all config for to run the server

func GetConfig

func GetConfig(fileName string) (*MatterwickConfig, error)

GetConfig gets the config

type MockedBuilds

type MockedBuilds struct {
	Version string
}

MockedBuilds implements buildsInterface but returns hardcoded information. This is used for local development and/or testing.

type Server

type Server struct {
	Config *MatterwickConfig
	Router *mux.Router

	Builds buildsInterface

	StartTime time.Time

	Logger logrus.FieldLogger
	// contains filtered or unexported fields
}

Server is the MatterWick server.

func New

func New(config *MatterwickConfig) *Server

New returns a new server with the desired configuration

func (*Server) CheckLimitRateAndAbortRequest

func (s *Server) CheckLimitRateAndAbortRequest() bool

CheckLimitRateAndAbortRequest checks the api rate and abort the request if needed

func (*Server) CheckLimitRateAndSleep

func (s *Server) CheckLimitRateAndSleep()

CheckLimitRateAndSleep checks the api rate and sleep if needed

func (*Server) GetPullRequestFromGithub

func (s *Server) GetPullRequestFromGithub(pullRequest *github.PullRequest) (*model.PullRequest, error)

GetPullRequestFromGithub get updated pr info

func (*Server) GetUpdateChecks

func (s *Server) GetUpdateChecks(owner, repoName string, prNumber int) (*model.PullRequest, error)

GetUpdateChecks retrieve updated status checks from GH

func (*Server) Start

func (s *Server) Start()

Start starts a server

func (*Server) Stop

func (s *Server) Stop()

Stop stops a server

type WebhookRequest

type WebhookRequest struct {
	Username string `json:"username"`
	Text     string `json:"text"`
}

WebhookRequest defines the message to send to MM

Jump to

Keyboard shortcuts

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