teams

package
v0.0.0-...-be2aeb8 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	AuthorizeRepository(ctx context.Context, authorization model.RepositoryAuthorization, team, repository string) (*model.GithubRepository, error)
	DeauthorizeRepository(ctx context.Context, authorization model.RepositoryAuthorization, team, repository string) (*model.GithubRepository, error)
	Search(ctx context.Context, query string, filter *model.SearchFilter) []*search.Result
	GetTeam(ctx context.Context, teamSlug string) (*model.Team, error)
	GetGithubRepositories(ctx context.Context, teamSlug string) ([]GitHubRepository, error)
	GetTeamMembers(ctx context.Context, teamSlug string) ([]Member, error)
	GetTeams(ctx context.Context) ([]Team, error)
	GetTeamsForUser(ctx context.Context, email string) ([]TeamMembership, error)
	GetUserByID(ctx context.Context, id string) (*model.User, error)
	GetUser(ctx context.Context, email string) (*User, error)
	TeamExists(ctx context.Context, teamSlug string) bool
}

func New

func New(cfg config.Teams, errors metric.Int64Counter, log logrus.FieldLogger) Client

type GcpProject

type GcpProject struct {
	ProjectID   string `json:"projectId"`
	ProjectName string `json:"projectName"`
	Environment string `json:"environment"`
}

type GitHubRepository

type GitHubRepository struct {
	Name           string                       `json:"name"`
	Permissions    []GitHubRepositoryPermission `json:"permissions"`
	Authorizations []RepositoryAuthorization    `json:"authorizations"`
	Archived       bool                         `json:"archived"`
	RoleName       string                       `json:"roleName"`
}

type GitHubRepositoryPermission

type GitHubRepositoryPermission struct {
	Name    string `json:"name"`
	Granted bool   `json:"granted"`
}

type Member

type Member struct {
	Role string   `json:"role"`
	User TeamUser `json:"user"`
}

type MockClient

type MockClient struct {
	mock.Mock
}

MockClient is an autogenerated mock type for the Client type

func NewMockClient

func NewMockClient(t interface {
	mock.TestingT
	Cleanup(func())
},
) *MockClient

NewMockClient creates a new instance of MockClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockClient) AuthorizeRepository

func (_m *MockClient) AuthorizeRepository(ctx context.Context, authorization model.RepositoryAuthorization, team string, repository string) (*model.GithubRepository, error)

AuthorizeRepository provides a mock function with given fields: ctx, authorization, team, repository

func (*MockClient) DeauthorizeRepository

func (_m *MockClient) DeauthorizeRepository(ctx context.Context, authorization model.RepositoryAuthorization, team string, repository string) (*model.GithubRepository, error)

DeauthorizeRepository provides a mock function with given fields: ctx, authorization, team, repository

func (*MockClient) EXPECT

func (_m *MockClient) EXPECT() *MockClient_Expecter

func (*MockClient) GetGithubRepositories

func (_m *MockClient) GetGithubRepositories(ctx context.Context, teamSlug string) ([]GitHubRepository, error)

GetGithubRepositories provides a mock function with given fields: ctx, teamSlug

func (*MockClient) GetTeam

func (_m *MockClient) GetTeam(ctx context.Context, teamSlug string) (*model.Team, error)

GetTeam provides a mock function with given fields: ctx, teamSlug

func (*MockClient) GetTeamMembers

func (_m *MockClient) GetTeamMembers(ctx context.Context, teamSlug string) ([]Member, error)

GetTeamMembers provides a mock function with given fields: ctx, teamSlug

func (*MockClient) GetTeams

func (_m *MockClient) GetTeams(ctx context.Context) ([]Team, error)

GetTeams provides a mock function with given fields: ctx

func (*MockClient) GetTeamsForUser

func (_m *MockClient) GetTeamsForUser(ctx context.Context, email string) ([]TeamMembership, error)

GetTeamsForUser provides a mock function with given fields: ctx, email

func (*MockClient) GetUser

func (_m *MockClient) GetUser(ctx context.Context, email string) (*User, error)

GetUser provides a mock function with given fields: ctx, email

func (*MockClient) GetUserByID

func (_m *MockClient) GetUserByID(ctx context.Context, id string) (*model.User, error)

GetUserByID provides a mock function with given fields: ctx, id

func (*MockClient) Search

func (_m *MockClient) Search(ctx context.Context, query string, filter *model.SearchFilter) []*search.Result

Search provides a mock function with given fields: ctx, query, filter

func (*MockClient) TeamExists

func (_m *MockClient) TeamExists(ctx context.Context, teamSlug string) bool

TeamExists provides a mock function with given fields: ctx, teamSlug

type MockClient_AuthorizeRepository_Call

type MockClient_AuthorizeRepository_Call struct {
	*mock.Call
}

MockClient_AuthorizeRepository_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthorizeRepository'

func (*MockClient_AuthorizeRepository_Call) Return

func (*MockClient_AuthorizeRepository_Call) Run

type MockClient_DeauthorizeRepository_Call

type MockClient_DeauthorizeRepository_Call struct {
	*mock.Call
}

MockClient_DeauthorizeRepository_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeauthorizeRepository'

func (*MockClient_DeauthorizeRepository_Call) Return

func (*MockClient_DeauthorizeRepository_Call) Run

type MockClient_Expecter

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

func (*MockClient_Expecter) AuthorizeRepository

func (_e *MockClient_Expecter) AuthorizeRepository(ctx interface{}, authorization interface{}, team interface{}, repository interface{}) *MockClient_AuthorizeRepository_Call

AuthorizeRepository is a helper method to define mock.On call

  • ctx context.Context
  • authorization model.RepositoryAuthorization
  • team string
  • repository string

func (*MockClient_Expecter) DeauthorizeRepository

func (_e *MockClient_Expecter) DeauthorizeRepository(ctx interface{}, authorization interface{}, team interface{}, repository interface{}) *MockClient_DeauthorizeRepository_Call

DeauthorizeRepository is a helper method to define mock.On call

  • ctx context.Context
  • authorization model.RepositoryAuthorization
  • team string
  • repository string

func (*MockClient_Expecter) GetGithubRepositories

func (_e *MockClient_Expecter) GetGithubRepositories(ctx interface{}, teamSlug interface{}) *MockClient_GetGithubRepositories_Call

GetGithubRepositories is a helper method to define mock.On call

  • ctx context.Context
  • teamSlug string

func (*MockClient_Expecter) GetTeam

func (_e *MockClient_Expecter) GetTeam(ctx interface{}, teamSlug interface{}) *MockClient_GetTeam_Call

GetTeam is a helper method to define mock.On call

  • ctx context.Context
  • teamSlug string

func (*MockClient_Expecter) GetTeamMembers

func (_e *MockClient_Expecter) GetTeamMembers(ctx interface{}, teamSlug interface{}) *MockClient_GetTeamMembers_Call

GetTeamMembers is a helper method to define mock.On call

  • ctx context.Context
  • teamSlug string

func (*MockClient_Expecter) GetTeams

func (_e *MockClient_Expecter) GetTeams(ctx interface{}) *MockClient_GetTeams_Call

GetTeams is a helper method to define mock.On call

  • ctx context.Context

func (*MockClient_Expecter) GetTeamsForUser

func (_e *MockClient_Expecter) GetTeamsForUser(ctx interface{}, email interface{}) *MockClient_GetTeamsForUser_Call

GetTeamsForUser is a helper method to define mock.On call

  • ctx context.Context
  • email string

func (*MockClient_Expecter) GetUser

func (_e *MockClient_Expecter) GetUser(ctx interface{}, email interface{}) *MockClient_GetUser_Call

GetUser is a helper method to define mock.On call

  • ctx context.Context
  • email string

func (*MockClient_Expecter) GetUserByID

func (_e *MockClient_Expecter) GetUserByID(ctx interface{}, id interface{}) *MockClient_GetUserByID_Call

GetUserByID is a helper method to define mock.On call

  • ctx context.Context
  • id string

func (*MockClient_Expecter) Search

func (_e *MockClient_Expecter) Search(ctx interface{}, query interface{}, filter interface{}) *MockClient_Search_Call

Search is a helper method to define mock.On call

  • ctx context.Context
  • query string
  • filter *model.SearchFilter

func (*MockClient_Expecter) TeamExists

func (_e *MockClient_Expecter) TeamExists(ctx interface{}, teamSlug interface{}) *MockClient_TeamExists_Call

TeamExists is a helper method to define mock.On call

  • ctx context.Context
  • teamSlug string

type MockClient_GetGithubRepositories_Call

type MockClient_GetGithubRepositories_Call struct {
	*mock.Call
}

MockClient_GetGithubRepositories_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetGithubRepositories'

func (*MockClient_GetGithubRepositories_Call) Return

func (*MockClient_GetGithubRepositories_Call) Run

func (*MockClient_GetGithubRepositories_Call) RunAndReturn

type MockClient_GetTeamMembers_Call

type MockClient_GetTeamMembers_Call struct {
	*mock.Call
}

MockClient_GetTeamMembers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTeamMembers'

func (*MockClient_GetTeamMembers_Call) Return

func (*MockClient_GetTeamMembers_Call) Run

func (*MockClient_GetTeamMembers_Call) RunAndReturn

type MockClient_GetTeam_Call

type MockClient_GetTeam_Call struct {
	*mock.Call
}

MockClient_GetTeam_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTeam'

func (*MockClient_GetTeam_Call) Return

func (*MockClient_GetTeam_Call) Run

func (_c *MockClient_GetTeam_Call) Run(run func(ctx context.Context, teamSlug string)) *MockClient_GetTeam_Call

func (*MockClient_GetTeam_Call) RunAndReturn

type MockClient_GetTeamsForUser_Call

type MockClient_GetTeamsForUser_Call struct {
	*mock.Call
}

MockClient_GetTeamsForUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTeamsForUser'

func (*MockClient_GetTeamsForUser_Call) Return

func (*MockClient_GetTeamsForUser_Call) Run

func (*MockClient_GetTeamsForUser_Call) RunAndReturn

type MockClient_GetTeams_Call

type MockClient_GetTeams_Call struct {
	*mock.Call
}

MockClient_GetTeams_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTeams'

func (*MockClient_GetTeams_Call) Return

func (*MockClient_GetTeams_Call) Run

func (*MockClient_GetTeams_Call) RunAndReturn

func (_c *MockClient_GetTeams_Call) RunAndReturn(run func(context.Context) ([]Team, error)) *MockClient_GetTeams_Call

type MockClient_GetUserByID_Call

type MockClient_GetUserByID_Call struct {
	*mock.Call
}

MockClient_GetUserByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserByID'

func (*MockClient_GetUserByID_Call) Return

func (*MockClient_GetUserByID_Call) Run

func (*MockClient_GetUserByID_Call) RunAndReturn

type MockClient_GetUser_Call

type MockClient_GetUser_Call struct {
	*mock.Call
}

MockClient_GetUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUser'

func (*MockClient_GetUser_Call) Return

func (*MockClient_GetUser_Call) Run

func (_c *MockClient_GetUser_Call) Run(run func(ctx context.Context, email string)) *MockClient_GetUser_Call

func (*MockClient_GetUser_Call) RunAndReturn

type MockClient_Search_Call

type MockClient_Search_Call struct {
	*mock.Call
}

MockClient_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search'

func (*MockClient_Search_Call) Return

func (*MockClient_Search_Call) Run

func (_c *MockClient_Search_Call) Run(run func(ctx context.Context, query string, filter *model.SearchFilter)) *MockClient_Search_Call

func (*MockClient_Search_Call) RunAndReturn

type MockClient_TeamExists_Call

type MockClient_TeamExists_Call struct {
	*mock.Call
}

MockClient_TeamExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TeamExists'

func (*MockClient_TeamExists_Call) Return

func (*MockClient_TeamExists_Call) Run

func (*MockClient_TeamExists_Call) RunAndReturn

type ReconcilerState

type ReconcilerState struct {
	GcpProjects []GcpProject `json:"gcpProjects"`
}

type RepositoryAuthorization

type RepositoryAuthorization string

Repository authorizations.

const (
	// Authorize for NAIS deployment.
	RepositoryAuthorizationDeploy RepositoryAuthorization = "DEPLOY"
)

type SlackAlertsChannel

type SlackAlertsChannel struct {
	Environment string `json:"environment"`
	ChannelName string `json:"channelName"`
}

type Team

type Team struct {
	Slug                string               `json:"slug"`
	Purpose             string               `json:"purpose"`
	SlackChannel        string               `json:"slackChannel"`
	GitHubRepositories  []GitHubRepository   `json:"gitHubRepositories"`
	SlackAlertsChannels []SlackAlertsChannel `json:"slackAlertsChannels"`
	Members             []Member             `json:"members"`
	ReconcilerState     ReconcilerState      `json:"reconcilerState"`
}

type TeamMembership

type TeamMembership struct {
	Team Team `json:"team"`
}

type TeamUser

type TeamUser struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type User

type User struct {
	Name  string           `json:"name"`
	ID    uuid.UUID        `json:"id"`
	Teams []TeamMembership `json:"teams"`
}

Jump to

Keyboard shortcuts

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