Documentation
¶
Overview ¶
Package githubapi is a generated GoMock package.
Index ¶
- func IsRepoSourceGithub(repoSourceToCompare string) bool
- type AccessToken
- type AnyEvent
- type Author
- type Client
- type Commit
- type Installation
- type MockClient
- func (m *MockClient) EXPECT() *MockClientMockRecorder
- func (m *MockClient) GetEstafetteManifest(ctx context.Context, accesstoken AccessToken, event PushEvent) (bool, string, error)
- func (m *MockClient) GetGithubAppToken(ctx context.Context) (string, error)
- func (m *MockClient) GetInstallationID(ctx context.Context, repoOwner string) (int, error)
- func (m *MockClient) GetInstallationToken(ctx context.Context, installationID int) (AccessToken, error)
- func (m *MockClient) JobVarsFunc(ctx context.Context) func(context.Context, string, string, string) (string, error)
- type MockClientMockRecorder
- func (mr *MockClientMockRecorder) GetEstafetteManifest(ctx, accesstoken, event interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) GetGithubAppToken(ctx interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) GetInstallationID(ctx, repoOwner interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) GetInstallationToken(ctx, installationID interface{}) *gomock.Call
- func (mr *MockClientMockRecorder) JobVarsFunc(ctx interface{}) *gomock.Call
- type PushEvent
- func (pe *PushEvent) GetRepoBranch() string
- func (pe *PushEvent) GetRepoFullName() string
- func (pe *PushEvent) GetRepoName() string
- func (pe *PushEvent) GetRepoOwner() string
- func (pe *PushEvent) GetRepoRevision() string
- func (pe *PushEvent) GetRepoSource() string
- func (pe *PushEvent) GetRepository() string
- type Pusher
- type Repository
- type RepositoryChanges
- type RepositoryChangesRepository
- type RepositoryChangesRepositoryName
- type RepositoryContent
- type RepositoryEvent
- func (pe *RepositoryEvent) GetNewRepoName() string
- func (pe *RepositoryEvent) GetNewRepoOwner() string
- func (pe *RepositoryEvent) GetOldRepoName() string
- func (pe *RepositoryEvent) GetOldRepoOwner() string
- func (pe *RepositoryEvent) GetRepoName() string
- func (pe *RepositoryEvent) GetRepoOwner() string
- func (pe *RepositoryEvent) GetRepoSource() string
- func (pe *RepositoryEvent) IsValidRenameEvent() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRepoSourceGithub ¶
IsRepoSourceGithub returns true if the repo source is from github
Types ¶
type AccessToken ¶
AccessToken represents a Github access token
type AnyEvent ¶
type AnyEvent struct { Installation Installation `json:"installation"` Repository *Repository `json:"repository"` }
AnyEvent represents any of the Github webhook events, to check if installation is allowed
func (*AnyEvent) GetRepository ¶
type Author ¶
type Author struct { Email string `json:"email"` Name string `json:"name"` UserName string `json:"username"` }
Author represents a Github author
type Client ¶
type Client interface { GetGithubAppToken(ctx context.Context) (token string, err error) GetInstallationID(ctx context.Context, repoOwner string) (installationID int, err error) GetInstallationToken(ctx context.Context, installationID int) (token AccessToken, err error) GetEstafetteManifest(ctx context.Context, accesstoken AccessToken, event PushEvent) (valid bool, manifest string, err error) JobVarsFunc(ctx context.Context) func(ctx context.Context, repoSource, repoOwner, repoName string) (token string, err error) }
Client is the interface for communicating with the github api
func NewLoggingClient ¶
NewLoggingClient returns a new instance of a logging Client.
func NewMetricsClient ¶
func NewMetricsClient(c Client, requestCount metrics.Counter, requestLatency metrics.Histogram) Client
NewMetricsClient returns a new instance of a metrics Client.
func NewTracingClient ¶
NewTracingClient returns a new instance of a tracing Client.
type Commit ¶
type Commit struct { Author Author `json:"author"` Message string `json:"message"` ID string `json:"id"` }
Commit represents a Github commit
type Installation ¶
type Installation struct {
ID int `json:"id"`
}
Installation represents an installation of a Github app
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockClient) GetEstafetteManifest ¶
func (m *MockClient) GetEstafetteManifest(ctx context.Context, accesstoken AccessToken, event PushEvent) (bool, string, error)
GetEstafetteManifest mocks base method.
func (*MockClient) GetGithubAppToken ¶
func (m *MockClient) GetGithubAppToken(ctx context.Context) (string, error)
GetGithubAppToken mocks base method.
func (*MockClient) GetInstallationID ¶
GetInstallationID mocks base method.
func (*MockClient) GetInstallationToken ¶
func (m *MockClient) GetInstallationToken(ctx context.Context, installationID int) (AccessToken, error)
GetInstallationToken mocks base method.
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.
func (*MockClientMockRecorder) GetEstafetteManifest ¶
func (mr *MockClientMockRecorder) GetEstafetteManifest(ctx, accesstoken, event interface{}) *gomock.Call
GetEstafetteManifest indicates an expected call of GetEstafetteManifest.
func (*MockClientMockRecorder) GetGithubAppToken ¶
func (mr *MockClientMockRecorder) GetGithubAppToken(ctx interface{}) *gomock.Call
GetGithubAppToken indicates an expected call of GetGithubAppToken.
func (*MockClientMockRecorder) GetInstallationID ¶
func (mr *MockClientMockRecorder) GetInstallationID(ctx, repoOwner interface{}) *gomock.Call
GetInstallationID indicates an expected call of GetInstallationID.
func (*MockClientMockRecorder) GetInstallationToken ¶
func (mr *MockClientMockRecorder) GetInstallationToken(ctx, installationID interface{}) *gomock.Call
GetInstallationToken indicates an expected call of GetInstallationToken.
func (*MockClientMockRecorder) JobVarsFunc ¶
func (mr *MockClientMockRecorder) JobVarsFunc(ctx interface{}) *gomock.Call
JobVarsFunc indicates an expected call of JobVarsFunc.
type PushEvent ¶
type PushEvent struct { After string `json:"after"` Commits []Commit `json:"commits"` HeadCommit Commit `json:"head_commit"` Pusher Pusher `json:"pusher"` Repository Repository `json:"repository"` Installation Installation `json:"installation"` Ref string `json:"ref"` }
PushEvent represents a Github webhook push event
func (*PushEvent) GetRepoBranch ¶
GetRepoBranch returns the branch of the push event
func (*PushEvent) GetRepoFullName ¶
GetRepoFullName returns the repository owner and name
func (*PushEvent) GetRepoName ¶
GetRepoName returns the repository name
func (*PushEvent) GetRepoOwner ¶
GetRepoOwner returns the repository owner
func (*PushEvent) GetRepoRevision ¶
GetRepoRevision returns the revision of the push event
func (*PushEvent) GetRepoSource ¶
GetRepoSource returns the repository source
func (*PushEvent) GetRepository ¶
GetRepository returns the full path to the repository
type Repository ¶
type Repository struct { GitURL string `json:"git_url"` HTMLURL string `json:"html_url"` Name string `json:"name"` FullName string `json:"full_name"` }
Repository represents a Github repository
type RepositoryChanges ¶
type RepositoryChanges struct {
Repository RepositoryChangesRepository `json:"repository"`
}
RepositoryChanges records changes made to a repository
type RepositoryChangesRepository ¶
type RepositoryChangesRepository struct {
Name RepositoryChangesRepositoryName `json:"name"`
}
RepositoryChangesRepository records changes made to a repository
type RepositoryChangesRepositoryName ¶
type RepositoryChangesRepositoryName struct {
From string `json:"from"`
}
RepositoryChangesRepositoryName records changes made to a repository's name
type RepositoryContent ¶
type RepositoryContent struct { Type string `json:"type"` Encoding string `json:"encoding"` Size int `json:"size"` Name string `json:"name"` Path string `json:"path"` Content string `json:"content"` Sha string `json:"sha"` }
RepositoryContent represents a file retrieved via the Github api
type RepositoryEvent ¶
type RepositoryEvent struct { Action string `json:"action"` Changes RepositoryChanges `json:"changes"` Repository Repository `json:"repository"` Installation Installation `json:"installation"` }
RepositoryEvent represents a Github webhook repository event
func (*RepositoryEvent) GetNewRepoName ¶
func (pe *RepositoryEvent) GetNewRepoName() string
GetNewRepoName returns the new repository name
func (*RepositoryEvent) GetNewRepoOwner ¶
func (pe *RepositoryEvent) GetNewRepoOwner() string
GetNewRepoOwner returns the new repository owner
func (*RepositoryEvent) GetOldRepoName ¶
func (pe *RepositoryEvent) GetOldRepoName() string
GetOldRepoName returns the former repository name
func (*RepositoryEvent) GetOldRepoOwner ¶
func (pe *RepositoryEvent) GetOldRepoOwner() string
GetOldRepoOwner returns the former repository owner
func (*RepositoryEvent) GetRepoName ¶
func (pe *RepositoryEvent) GetRepoName() string
GetRepoName returns the current repository name
func (*RepositoryEvent) GetRepoOwner ¶
func (pe *RepositoryEvent) GetRepoOwner() string
GetRepoOwner returns the current repository owner
func (*RepositoryEvent) GetRepoSource ¶
func (pe *RepositoryEvent) GetRepoSource() string
GetRepoSource returns the repository source
func (*RepositoryEvent) IsValidRenameEvent ¶
func (pe *RepositoryEvent) IsValidRenameEvent() bool
IsValidRenameEvent returns true if all fields for a repo rename are set