cloudsourceapi

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package cloudsourceapi is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRepoSourceCloudSource

func IsRepoSourceCloudSource(repoSourceToCompare string) bool

IsRepoSourceCloudSource returns true if the repo source is from cloud source

Types

type AccessToken

type AccessToken struct {
	AccessToken  string    `json:"access_token"`
	Expiry       time.Time `json:"expiry"`
	RefreshToken string    `json:"refresh_token"`
	TokenType    string    `json:"token_type"`
}

AccessToken represents a token to use for api requests

type Client

type Client interface {
	GetAccessToken(ctx context.Context) (accesstoken AccessToken, err error)
	GetEstafetteManifest(ctx context.Context, accesstoken AccessToken, notification PubSubNotification, gitClone func(string, string, string) error) (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 Google Cloud Source Repository api

func NewClient

func NewClient(config *api.APIConfig, tokenSource oauth2.TokenSource, sourcerepoService *sourcerepo.Service) Client

NewClient creates an cloudsource.Client to communicate with the Google Cloud Source Repository api

func NewLoggingClient

func NewLoggingClient(c Client) Client

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

func NewTracingClient(c Client) Client

NewTracingClient returns a new instance of a tracing Client.

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

func (m *MockClient) GetAccessToken(ctx context.Context) (AccessToken, error)

GetAccessToken mocks base method.

func (*MockClient) GetEstafetteManifest

func (m *MockClient) GetEstafetteManifest(ctx context.Context, accesstoken AccessToken, notification PubSubNotification, gitClone func(string, string, string) error) (bool, string, error)

GetEstafetteManifest mocks base method.

func (*MockClient) JobVarsFunc

func (m *MockClient) JobVarsFunc(ctx context.Context) func(context.Context, string, string, string) (string, error)

JobVarsFunc mocks base method.

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) GetAccessToken

func (mr *MockClientMockRecorder) GetAccessToken(ctx interface{}) *gomock.Call

GetAccessToken indicates an expected call of GetAccessToken.

func (*MockClientMockRecorder) GetEstafetteManifest

func (mr *MockClientMockRecorder) GetEstafetteManifest(ctx, accesstoken, notification, gitClone interface{}) *gomock.Call

GetEstafetteManifest indicates an expected call of GetEstafetteManifest.

func (*MockClientMockRecorder) JobVarsFunc

func (mr *MockClientMockRecorder) JobVarsFunc(ctx interface{}) *gomock.Call

JobVarsFunc indicates an expected call of JobVarsFunc.

type PubSubNotification

type PubSubNotification struct {
	Name           string          `json:"name"`
	Url            string          `json:"url"`
	EventTime      time.Time       `json:"eventTime"`
	RefUpdateEvent *RefUpdateEvent `json:"refUpdateEvent,omitempty"`
}

PubSubNotification represents a PubSub message coming from Cloud Source Repo

func (*PubSubNotification) GetRepoName

func (psn *PubSubNotification) GetRepoName() string

GetRepoName returns the repository name

func (*PubSubNotification) GetRepoOwner

func (psn *PubSubNotification) GetRepoOwner() string

GetRepoOwner returns the repository owner

func (*PubSubNotification) GetRepoSource

func (psn *PubSubNotification) GetRepoSource() string

GetRepoSource returns the repository source

func (*PubSubNotification) GetRepository

func (psn *PubSubNotification) GetRepository() string

GetRepository returns the full path to the repository

type RefUpdate

type RefUpdate struct {
	RefName    string `json:"refName"`
	UpdateType string `json:"updateType"`
	OldId      string `json:"oldId"`
	NewId      string `json:"newId"`
}

RefUpdate represents the Update for each reference from a Cloud Source Repo

func (*RefUpdate) GetRepoBranch

func (ru *RefUpdate) GetRepoBranch() string

GetRepoBranch returns the branch of the push event

type RefUpdateEvent

type RefUpdateEvent struct {
	Email      string               `json:"email"`
	RefUpdates map[string]RefUpdate `json:"refUpdates"`
}

RefUpdateEvent represents the Update event from Cloud Source Repo

func (*RefUpdateEvent) GetAuthorName

func (rue *RefUpdateEvent) GetAuthorName() string

GetAuthorName returns the revision of the push event

Jump to

Keyboard shortcuts

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