gitSensor

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

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"`
}

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
}

type GitMaterial

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

type GitProvider

type GitProvider struct {
	Id          int
	Name        string
	Url         string
	UserName    string
	Password    string
	SshKey      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)
}

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) GetCommitMetadata

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

func (GitSensorClientImpl) GetHeadForPipelineMaterials

func (session GitSensorClientImpl) GetHeadForPipelineMaterials(req *HeadRequest) (material []*CiPipelineMaterial, 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

Jump to

Keyboard shortcuts

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