reconcilers

package
v0.0.0-...-96f7096 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManagedByLabelName  = "managed-by"
	ManagedByLabelValue = "teams-backend"

	// TeamNamePrefix Prefix that can be used for team-like objects in external systems
	TeamNamePrefix              = "nais-team-"
	CnrmServiceAccountAccountID = "nais-sa-cnrm"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureState

type AzureState struct {
	GroupID *uuid.UUID `json:"groupId"`
}

type DependencyTrackState

type DependencyTrackState struct {
	TeamID  string   `json:"teamId"`
	Members []string `json:"members"`
}

type GitHubRepository

type GitHubRepository struct {
	Name        string                        `json:"name"`
	Permissions []*GitHubRepositoryPermission `json:"permissions"`
	Archived    bool                          `json:"archived"`
	RoleName    string                        `json:"roleName"`
	TeamSlug    *slug.Slug                    `json:"-"`
}

type GitHubRepositoryPermission

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

type GitHubState

type GitHubState struct {
	Slug         *slug.Slug          `json:"slug"`
	Repositories []*GitHubRepository `json:"repositories"`
}

type GoogleGarState

type GoogleGarState struct {
	RepositoryName *string `json:"repopsitoryName"`
}

type GoogleGcpEnvironmentProject

type GoogleGcpEnvironmentProject struct {
	ProjectID string `json:"projectId"` // Unique of the project, for instance `my-project-123`
}

type GoogleGcpProjectState

type GoogleGcpProjectState struct {
	Projects map[string]GoogleGcpEnvironmentProject `json:"projects"` // environment name is used as key
}

type GoogleWorkspaceState

type GoogleWorkspaceState struct {
	GroupEmail *string `json:"groupEmail"`
}

type Input

type Input struct {
	CorrelationID uuid.UUID
	Team          db.Team
	TeamMembers   []*db.User
}

Input Input for reconcilers

func CreateReconcilerInput

func CreateReconcilerInput(ctx context.Context, database db.Database, team db.Team, reconcilerName sqlc.ReconcilerName) (Input, error)

CreateReconcilerInput Helper function to create input for reconcilers

type MockReconciler

type MockReconciler struct {
	mock.Mock
}

MockReconciler is an autogenerated mock type for the Reconciler type

func NewMockReconciler

func NewMockReconciler(t interface {
	mock.TestingT
	Cleanup(func())
},
) *MockReconciler

NewMockReconciler creates a new instance of MockReconciler. 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 (*MockReconciler) Delete

func (_m *MockReconciler) Delete(ctx context.Context, teamSlug slug.Slug, correlationID uuid.UUID) error

Delete provides a mock function with given fields: ctx, teamSlug, correlationID

func (*MockReconciler) EXPECT

func (*MockReconciler) Name

func (_m *MockReconciler) Name() sqlc.ReconcilerName

Name provides a mock function with given fields:

func (*MockReconciler) Reconcile

func (_m *MockReconciler) Reconcile(ctx context.Context, input Input) error

Reconcile provides a mock function with given fields: ctx, input

type MockReconciler_Delete_Call

type MockReconciler_Delete_Call struct {
	*mock.Call
}

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

func (*MockReconciler_Delete_Call) Return

func (*MockReconciler_Delete_Call) Run

func (_c *MockReconciler_Delete_Call) Run(run func(ctx context.Context, teamSlug slug.Slug, correlationID uuid.UUID)) *MockReconciler_Delete_Call

func (*MockReconciler_Delete_Call) RunAndReturn

type MockReconciler_Expecter

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

func (*MockReconciler_Expecter) Delete

func (_e *MockReconciler_Expecter) Delete(ctx interface{}, teamSlug interface{}, correlationID interface{}) *MockReconciler_Delete_Call

Delete is a helper method to define mock.On call

  • ctx context.Context
  • teamSlug slug.Slug
  • correlationID uuid.UUID

func (*MockReconciler_Expecter) Name

Name is a helper method to define mock.On call

func (*MockReconciler_Expecter) Reconcile

func (_e *MockReconciler_Expecter) Reconcile(ctx interface{}, input interface{}) *MockReconciler_Reconcile_Call

Reconcile is a helper method to define mock.On call

  • ctx context.Context
  • input Input

type MockReconciler_Name_Call

type MockReconciler_Name_Call struct {
	*mock.Call
}

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

func (*MockReconciler_Name_Call) Return

func (*MockReconciler_Name_Call) Run

func (*MockReconciler_Name_Call) RunAndReturn

type MockReconciler_Reconcile_Call

type MockReconciler_Reconcile_Call struct {
	*mock.Call
}

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

func (*MockReconciler_Reconcile_Call) Return

func (*MockReconciler_Reconcile_Call) Run

func (*MockReconciler_Reconcile_Call) RunAndReturn

type NaisDeployKeyState

type NaisDeployKeyState struct {
	Provisioned *time.Time `json:"provisioned"`
}

type NaisNamespaceState

type NaisNamespaceState struct {
	Namespaces map[string]slug.Slug `json:"namespaces"` // Key is the environment for the team namespace
}

type Reconciler

type Reconciler interface {
	Reconcile(ctx context.Context, input Input) error
	Delete(ctx context.Context, teamSlug slug.Slug, correlationID uuid.UUID) error
	Name() sqlc.ReconcilerName
}

Reconciler Interface for all reconcilers

type ReconcilerFactory

type ReconcilerFactory func(context.Context, db.Database, *config.Config, logger.Logger) (Reconciler, error)

ReconcilerFactory The constructor function for all reconcilers

Directories

Path Synopsis
azure
github
google
gar
gcp
nais

Jump to

Keyboard shortcuts

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