gitSensor

package
v0.4.26 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Apache-2.0 Imports: 12 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CiPipelineMaterial

type CiPipelineMaterial struct {
	Id            int
	GitMaterialId int
	Type          SourceType
	Value         string
	Active        bool
	GitCommit     GitCommit
}

type ClientRequest

type ClientRequest struct {
	Method       string
	Path         string
	RequestBody  interface{}
	ResponseBody interface{}
}

type CommitMetadataRequest

type CommitMetadataRequest struct {
	PipelineMaterialId int    `json:"pipelineMaterialId"`
	GitHash            string `json:"gitHash"`
	GitTag             string `json:"gitTag"`
	BranchName         string `json:"branchName"`
}

type FetchScmChangesRequest

type FetchScmChangesRequest struct {
	PipelineMaterialId int    `json:"pipelineMaterialId"`
	From               string `json:"from"`
	To                 string `json:"to"`
}

---------------

type GitCommit

type GitCommit struct {
	Commit      string //git hash
	Author      string
	Date        time.Time
	Message     string
	Changes     []string
	WebhookData *WebhookData
}

type GitMaterial

type GitMaterial struct {
	Id               int
	GitProviderId    int
	Url              string
	Name             string
	CheckoutLocation string
	CheckoutStatus   bool
	CheckoutMsgAny   string
	Deleted          bool
	FetchSubmodules  bool
}

type GitProvider

type GitProvider struct {
	Id            int
	Name          string
	Url           string
	UserName      string
	Password      string
	SshPrivateKey string
	AccessToken   string
	Active        bool
	AuthMode      repository.AuthMode
}

type GitSensorApiError

type GitSensorApiError struct {
	HttpStatusCode    int    `json:"-"`
	Code              string `json:"code,omitempty"`
	InternalMessage   string `json:"internalMessage,omitempty"`
	UserMessage       string `json:"userMessage,omitempty"`
	UserDetailMessage string `json:"userDetailMessage,omitempty"`
}

type GitSensorClient

type GitSensorClient interface {
	GetHeadForPipelineMaterials(req *HeadRequest) (material []*CiPipelineMaterial, err error)
	FetchChanges(changeRequest *FetchScmChangesRequest) (materialChangeResp *MaterialChangeResp, err error)
	GetCommitMetadata(commitMetadataRequest *CommitMetadataRequest) (*GitCommit, error)

	SaveGitProvider(provider *GitProvider) (providerRes *GitProvider, err error)
	AddRepo(material []*GitMaterial) (materialRes []*GitMaterial, err error)
	UpdateRepo(material *GitMaterial) (materialRes *GitMaterial, err error)
	SavePipelineMaterial(material []*CiPipelineMaterial) (materialRes []*CiPipelineMaterial, err error)
	RefreshGitMaterial(req *RefreshGitMaterialRequest) (refreshRes *RefreshGitMaterialResponse, err error)

	GetWebhookData(req *WebhookDataRequest) (*WebhookData, error)

	GetAllWebhookEventConfigForHost(req *WebhookEventConfigRequest) (webhookEvents []*WebhookEventConfig, err error)
	GetWebhookEventConfig(req *WebhookEventConfigRequest) (webhookEvent *WebhookEventConfig, err error)
	GetWebhookPayloadDataForPipelineMaterialId(req *WebhookPayloadDataRequest) (response *WebhookPayloadDataResponse, err error)
	GetWebhookPayloadFilterDataForPipelineMaterialId(req *WebhookPayloadFilterDataRequest) (response *WebhookPayloadFilterDataResponse, err error)
}

type GitSensorClientImpl

type GitSensorClientImpl struct {
	// contains filtered or unexported fields
}

func NewGitSensorSession

func NewGitSensorSession(config *GitSensorConfig, logger *zap.SugaredLogger) (session *GitSensorClientImpl, err error)

func (GitSensorClientImpl) AddRepo

func (session GitSensorClientImpl) AddRepo(material []*GitMaterial) (materialRes []*GitMaterial, err error)

func (GitSensorClientImpl) FetchChanges

func (session GitSensorClientImpl) FetchChanges(changeRequest *FetchScmChangesRequest) (materialChangeResp *MaterialChangeResp, err error)

func (GitSensorClientImpl) GetAllWebhookEventConfigForHost added in v0.2.22

func (session GitSensorClientImpl) GetAllWebhookEventConfigForHost(req *WebhookEventConfigRequest) (webhookEvents []*WebhookEventConfig, err error)

func (GitSensorClientImpl) GetCommitMetadata

func (session GitSensorClientImpl) GetCommitMetadata(commitMetadataRequest *CommitMetadataRequest) (*GitCommit, error)

func (GitSensorClientImpl) GetHeadForPipelineMaterials

func (session GitSensorClientImpl) GetHeadForPipelineMaterials(req *HeadRequest) (material []*CiPipelineMaterial, err error)

func (GitSensorClientImpl) GetWebhookData added in v0.2.22

func (session GitSensorClientImpl) GetWebhookData(req *WebhookDataRequest) (*WebhookData, error)

func (GitSensorClientImpl) GetWebhookEventConfig added in v0.2.22

func (session GitSensorClientImpl) GetWebhookEventConfig(req *WebhookEventConfigRequest) (webhookEvent *WebhookEventConfig, err error)

func (GitSensorClientImpl) GetWebhookPayloadDataForPipelineMaterialId added in v0.2.27

func (session GitSensorClientImpl) GetWebhookPayloadDataForPipelineMaterialId(req *WebhookPayloadDataRequest) (response *WebhookPayloadDataResponse, err error)

func (GitSensorClientImpl) GetWebhookPayloadFilterDataForPipelineMaterialId added in v0.2.27

func (session GitSensorClientImpl) GetWebhookPayloadFilterDataForPipelineMaterialId(req *WebhookPayloadFilterDataRequest) (response *WebhookPayloadFilterDataResponse, err error)

func (GitSensorClientImpl) RefreshGitMaterial

func (session GitSensorClientImpl) RefreshGitMaterial(req *RefreshGitMaterialRequest) (refreshRes *RefreshGitMaterialResponse, err error)

func (GitSensorClientImpl) SaveGitProvider

func (session GitSensorClientImpl) SaveGitProvider(provider *GitProvider) (providerRes *GitProvider, err error)

func (GitSensorClientImpl) SavePipelineMaterial

func (session GitSensorClientImpl) SavePipelineMaterial(material []*CiPipelineMaterial) (materialRes []*CiPipelineMaterial, err error)

func (GitSensorClientImpl) UpdateRepo

func (session GitSensorClientImpl) UpdateRepo(material *GitMaterial) (materialRes *GitMaterial, err error)

type GitSensorConfig

type GitSensorConfig struct {
	Url     string `env:"GIT_SENSOR_URL" envDefault:"http://localhost:9999"`
	Timeout int    `env:"GIT_SENSOR_TIMEOUT" envDefault:"0"` // in seconds
}

----------------------impl

func GetGitSensorConfig

func GetGitSensorConfig() (*GitSensorConfig, error)

type GitSensorResponse

type GitSensorResponse struct {
	Code   int                  `json:"code,omitempty"`
	Status string               `json:"status,omitempty"`
	Result json.RawMessage      `json:"result,omitempty"`
	Errors []*GitSensorApiError `json:"errors,omitempty"`
}

-----------

type HeadRequest

type HeadRequest struct {
	MaterialIds []int `json:"materialIds"`
}

type MaterialChangeResp

type MaterialChangeResp struct {
	Commits        []*GitCommit `json:"commits"`
	LastFetchTime  time.Time    `json:"lastFetchTime"`
	IsRepoError    bool         `json:"isRepoError"`
	RepoErrorMsg   string       `json:"repoErrorMsg"`
	IsBranchError  bool         `json:"isBranchError"`
	BranchErrorMsg string       `json:"branchErrorMsg"`
}

type RefreshGitMaterialRequest

type RefreshGitMaterialRequest struct {
	GitMaterialId int `json:"gitMaterialId"`
}

type RefreshGitMaterialResponse

type RefreshGitMaterialResponse struct {
	Message       string    `json:"message"`
	ErrorMsg      string    `json:"errorMsg"`
	LastFetchTime time.Time `json:"lastFetchTime"`
}

type SourceType

type SourceType string

type StatusCode

type StatusCode int

func (StatusCode) IsSuccess

func (code StatusCode) IsSuccess() bool

type WebhookData added in v0.2.22

type WebhookData struct {
	Id              int               `json:"id"`
	EventActionType string            `json:"eventActionType"`
	Data            map[string]string `json:"data"`
}

type WebhookDataRequest added in v0.2.22

type WebhookDataRequest struct {
	Id int `json:"id"`
}

type WebhookEventConfig added in v0.2.22

type WebhookEventConfig struct {
	Id            int       `json:"id"`
	GitHostId     int       `json:"gitHostId"`
	Name          string    `json:"name"`
	EventTypesCsv string    `json:"eventTypesCsv"`
	ActionType    string    `json:"actionType"`
	IsActive      bool      `json:"isActive"`
	CreatedOn     time.Time `json:"createdOn"`
	UpdatedOn     time.Time `json:"updatedOn"`

	Selectors []*WebhookEventSelectors `json:"selectors"`
}

type WebhookEventConfigRequest added in v0.2.22

type WebhookEventConfigRequest struct {
	GitHostId int `json:"gitHostId"`
	EventId   int `json:"eventId"`
}

type WebhookEventSelectors added in v0.2.22

type WebhookEventSelectors struct {
	Id               int       `json:"id"`
	EventId          int       `json:"eventId"`
	Name             string    `json:"name"`
	Selector         string    `json:"selector"`
	ToShow           bool      `json:"toShow"`
	ToShowInCiFilter bool      `json:"toShowInCiFilter"`
	FixValue         string    `json:"fixValue"`
	PossibleValues   string    `json:"possibleValues"`
	IsActive         bool      `json:"isActive"`
	CreatedOn        time.Time `json:"createdOn"`
	UpdatedOn        time.Time `json:"updatedOn"`
}

type WebhookPayloadDataPayloadsResponse added in v0.2.27

type WebhookPayloadDataPayloadsResponse struct {
	ParsedDataId        int       `json:"parsedDataId"`
	EventTime           time.Time `json:"eventTime"`
	MatchedFiltersCount int       `json:"matchedFiltersCount"`
	FailedFiltersCount  int       `json:"failedFiltersCount"`
	MatchedFilters      bool      `json:"matchedFilters"`
}

type WebhookPayloadDataRequest added in v0.2.27

type WebhookPayloadDataRequest struct {
	CiPipelineMaterialId int    `json:"ciPipelineMaterialId"`
	Limit                int    `json:"limit"`
	Offset               int    `json:"offset"`
	EventTimeSortOrder   string `json:"eventTimeSortOrder"`
}

type WebhookPayloadDataResponse added in v0.2.27

type WebhookPayloadDataResponse struct {
	Filters       map[string]string                     `json:"filters"`
	RepositoryUrl string                                `json:"repositoryUrl"`
	Payloads      []*WebhookPayloadDataPayloadsResponse `json:"payloads"`
}

type WebhookPayloadFilterDataRequest added in v0.2.27

type WebhookPayloadFilterDataRequest struct {
	CiPipelineMaterialId int `json:"ciPipelineMaterialId"`
	ParsedDataId         int `json:"parsedDataId"`
}

type WebhookPayloadFilterDataResponse added in v0.2.27

type WebhookPayloadFilterDataResponse struct {
	PayloadId     int                                         `json:"payloadId"`
	PayloadJson   string                                      `json:"payloadJson"`
	SelectorsData []*WebhookPayloadFilterDataSelectorResponse `json:"selectorsData"`
}

type WebhookPayloadFilterDataSelectorResponse added in v0.2.27

type WebhookPayloadFilterDataSelectorResponse struct {
	SelectorName      string `json:"selectorName"`
	SelectorCondition string `json:"selectorCondition"`
	SelectorValue     string `json:"selectorValue"`
	Match             bool   `json:"match"`
}

Jump to

Keyboard shortcuts

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