internal

package
v0.11.12 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GOLIAC_GIT_TAG = "goliac"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GithubBatchExecutor

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

* GithubBatchExecutor will collects all commands to apply * if there the number of changes to apply is not too big, it will apply on the `Commit()` * Usage: * gal := NewGithubBatchExecutor(client) * gal.Begin() * gal.Create... * gal.Update... * ... * gal.Commit()

func NewGithubBatchExecutor

func NewGithubBatchExecutor(client engine.ReconciliatorExecutor, maxChangesets int) *GithubBatchExecutor

func (*GithubBatchExecutor) AddRuleset

func (g *GithubBatchExecutor) AddRuleset(ctx context.Context, dryrun bool, ruleset *engine.GithubRuleSet)

func (*GithubBatchExecutor) AddUserToOrg

func (g *GithubBatchExecutor) AddUserToOrg(ctx context.Context, dryrun bool, ghuserid string)

func (*GithubBatchExecutor) Begin

func (g *GithubBatchExecutor) Begin(dryrun bool)

func (*GithubBatchExecutor) Commit

func (g *GithubBatchExecutor) Commit(ctx context.Context, dryrun bool) error

func (*GithubBatchExecutor) CreateRepository

func (g *GithubBatchExecutor) CreateRepository(ctx context.Context, dryrun bool, reponame string, description string, writers []string, readers []string, boolProperties map[string]bool)

func (*GithubBatchExecutor) CreateTeam

func (g *GithubBatchExecutor) CreateTeam(ctx context.Context, dryrun bool, teamname string, description string, parentTeam *int, members []string)

func (*GithubBatchExecutor) DeleteRepository

func (g *GithubBatchExecutor) DeleteRepository(ctx context.Context, dryrun bool, reponame string)

func (*GithubBatchExecutor) DeleteRuleset

func (g *GithubBatchExecutor) DeleteRuleset(ctx context.Context, dryrun bool, rulesetid int)

func (*GithubBatchExecutor) DeleteTeam

func (g *GithubBatchExecutor) DeleteTeam(ctx context.Context, dryrun bool, teamslug string)

func (*GithubBatchExecutor) RemoveUserFromOrg

func (g *GithubBatchExecutor) RemoveUserFromOrg(ctx context.Context, dryrun bool, ghuserid string)

func (*GithubBatchExecutor) Rollback

func (g *GithubBatchExecutor) Rollback(dryrun bool, err error)

func (*GithubBatchExecutor) UpdateRepositoryAddTeamAccess

func (g *GithubBatchExecutor) UpdateRepositoryAddTeamAccess(ctx context.Context, dryrun bool, reponame string, teamslug string, permission string)

func (*GithubBatchExecutor) UpdateRepositoryRemoveExternalUser added in v0.2.1

func (g *GithubBatchExecutor) UpdateRepositoryRemoveExternalUser(ctx context.Context, dryrun bool, reponame string, githubid string)

func (*GithubBatchExecutor) UpdateRepositoryRemoveInternalUser added in v0.11.8

func (g *GithubBatchExecutor) UpdateRepositoryRemoveInternalUser(ctx context.Context, dryrun bool, reponame string, githubid string)

func (*GithubBatchExecutor) UpdateRepositoryRemoveTeamAccess

func (g *GithubBatchExecutor) UpdateRepositoryRemoveTeamAccess(ctx context.Context, dryrun bool, reponame string, teamslug string)

func (*GithubBatchExecutor) UpdateRepositorySetExternalUser added in v0.2.1

func (g *GithubBatchExecutor) UpdateRepositorySetExternalUser(ctx context.Context, dryrun bool, reponame string, githubid string, permission string)

func (*GithubBatchExecutor) UpdateRepositoryUpdateBoolProperty added in v0.5.0

func (g *GithubBatchExecutor) UpdateRepositoryUpdateBoolProperty(ctx context.Context, dryrun bool, reponame string, propertyName string, propertyValue bool)

func (*GithubBatchExecutor) UpdateRepositoryUpdateTeamAccess

func (g *GithubBatchExecutor) UpdateRepositoryUpdateTeamAccess(ctx context.Context, dryrun bool, reponame string, teamslug string, permission string)

func (*GithubBatchExecutor) UpdateRuleset

func (g *GithubBatchExecutor) UpdateRuleset(ctx context.Context, dryrun bool, ruleset *engine.GithubRuleSet)

func (*GithubBatchExecutor) UpdateTeamAddMember

func (g *GithubBatchExecutor) UpdateTeamAddMember(ctx context.Context, dryrun bool, teamslug string, username string, role string)

role = member or maintainer (usually we use member)

func (*GithubBatchExecutor) UpdateTeamRemoveMember

func (g *GithubBatchExecutor) UpdateTeamRemoveMember(ctx context.Context, dryrun bool, teamslug string, username string)

func (*GithubBatchExecutor) UpdateTeamSetParent added in v0.8.0

func (g *GithubBatchExecutor) UpdateTeamSetParent(ctx context.Context, dryrun bool, teamslug string, parentTeam *int)

func (*GithubBatchExecutor) UpdateTeamUpdateMember added in v0.10.5

func (g *GithubBatchExecutor) UpdateTeamUpdateMember(ctx context.Context, dryrun bool, teamslug string, username string, role string)

role = member or maintainer (usually we use member)

type GithubCommand

type GithubCommand interface {
	Apply(ctx context.Context)
}

*

  • Each command/mutation we want to perform will be isloated into a GithubCommand
  • object, so we can regroup all of them to apply (or cancel) them in batch

type GithubCommandAddRuletset

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

func (*GithubCommandAddRuletset) Apply

type GithubCommandAddUserToOrg

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

func (*GithubCommandAddUserToOrg) Apply

type GithubCommandCreateRepository

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

func (*GithubCommandCreateRepository) Apply

type GithubCommandCreateTeam

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

func (*GithubCommandCreateTeam) Apply

func (g *GithubCommandCreateTeam) Apply(ctx context.Context)

type GithubCommandDeleteRepository

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

func (*GithubCommandDeleteRepository) Apply

type GithubCommandDeleteRuletset

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

func (*GithubCommandDeleteRuletset) Apply

type GithubCommandDeleteTeam

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

func (*GithubCommandDeleteTeam) Apply

func (g *GithubCommandDeleteTeam) Apply(ctx context.Context)

type GithubCommandRemoveUserFromOrg

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

func (*GithubCommandRemoveUserFromOrg) Apply

type GithubCommandUpdateRepositoryAddTeamAccess

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

func (*GithubCommandUpdateRepositoryAddTeamAccess) Apply

type GithubCommandUpdateRepositoryRemoveExternalUser added in v0.2.1

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

func (*GithubCommandUpdateRepositoryRemoveExternalUser) Apply added in v0.2.1

type GithubCommandUpdateRepositoryRemoveInternalUser added in v0.11.8

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

func (*GithubCommandUpdateRepositoryRemoveInternalUser) Apply added in v0.11.8

type GithubCommandUpdateRepositoryRemoveTeamAccess

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

func (*GithubCommandUpdateRepositoryRemoveTeamAccess) Apply

type GithubCommandUpdateRepositorySetExternalUser added in v0.2.1

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

func (*GithubCommandUpdateRepositorySetExternalUser) Apply added in v0.2.1

type GithubCommandUpdateRepositoryUpdateBoolProperty added in v0.5.0

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

func (*GithubCommandUpdateRepositoryUpdateBoolProperty) Apply added in v0.5.0

type GithubCommandUpdateRepositoryUpdateTeamAccess

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

func (*GithubCommandUpdateRepositoryUpdateTeamAccess) Apply

type GithubCommandUpdateRuletset

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

func (*GithubCommandUpdateRuletset) Apply

type GithubCommandUpdateTeamAddMember

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

func (*GithubCommandUpdateTeamAddMember) Apply

type GithubCommandUpdateTeamRemoveMember

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

func (*GithubCommandUpdateTeamRemoveMember) Apply

type GithubCommandUpdateTeamSetParent added in v0.8.0

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

func (*GithubCommandUpdateTeamSetParent) Apply added in v0.8.0

type GithubCommandUpdateTeamUpdateMember added in v0.10.5

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

func (*GithubCommandUpdateTeamUpdateMember) Apply added in v0.10.5

type GithubWebhookServer added in v0.6.0

type GithubWebhookServer interface {
	// Start the server
	Start() error
	Shutdown() error
}

GithubWebhookServer is the interface for the webhook server It will wait for a Github webhook event and call the callback function when a merge event is received on the main branch

func NewGithubWebhookServerImpl added in v0.6.0

func NewGithubWebhookServerImpl(httpaddr string, httpport int, webhookPath string, secret string, mainBranch string, callback GithubWebhookServerCallback) GithubWebhookServer

type GithubWebhookServerCallback added in v0.6.0

type GithubWebhookServerCallback func()

type GithubWebhookServerImpl added in v0.6.0

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

func (*GithubWebhookServerImpl) Shutdown added in v0.6.0

func (s *GithubWebhookServerImpl) Shutdown() error

func (*GithubWebhookServerImpl) Start added in v0.6.0

func (s *GithubWebhookServerImpl) Start() error

func (*GithubWebhookServerImpl) WebhookHandler added in v0.6.0

func (s *GithubWebhookServerImpl) WebhookHandler(w http.ResponseWriter, r *http.Request)

type Goliac

type Goliac interface {
	GoliacObservability

	// will run and apply the reconciliation,
	// it returns an error if something went wrong, and a detailed list of errors and warnings
	Apply(ctx context.Context, fs billy.Filesystem, dryrun bool, repositoryUrl, branch string) (error, []error, []entity.Warning, *engine.UnmanagedResources)

	// will clone run the user-plugin to sync users, and will commit to the team repository, return true if a change was done
	UsersUpdate(ctx context.Context, fs billy.Filesystem, repositoryUrl, branch string, dryrun bool, force bool) (bool, error)

	// flush remote cache
	FlushCache()

	GetLocal() engine.GoliacLocalResources
}

* Goliac is the main interface of the application. * It is used to load and validate a goliac repository and apply it to github.

func NewGoliacImpl

func NewGoliacImpl() (Goliac, error)

type GoliacImpl

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

func (*GoliacImpl) Apply added in v0.3.0

func (g *GoliacImpl) Apply(ctx context.Context, fs billy.Filesystem, dryrun bool, repositoryUrl, branch string) (error, []error, []entity.Warning, *engine.UnmanagedResources)

func (*GoliacImpl) FlushCache

func (g *GoliacImpl) FlushCache()

func (*GoliacImpl) GetLocal added in v0.2.0

func (g *GoliacImpl) GetLocal() engine.GoliacLocalResources

func (*GoliacImpl) SetRemoteObservability added in v0.11.0

func (g *GoliacImpl) SetRemoteObservability(feedback observability.RemoteObservability) error

func (*GoliacImpl) UsersUpdate

func (g *GoliacImpl) UsersUpdate(ctx context.Context, fs billy.Filesystem, repositoryUrl, branch string, dryrun bool, force bool) (bool, error)

type GoliacLight added in v0.2.0

type GoliacLight interface {
	// Validate a local teams directory
	Validate(path string) error
}

* This "version" of Goliac is here just to validate a local * teams directory. It is mainly used for CI purpose when we need to validate * a PR

func NewGoliacLightImpl added in v0.2.0

func NewGoliacLightImpl() (GoliacLight, error)

type GoliacLightImpl added in v0.2.0

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

func (*GoliacLightImpl) Validate added in v0.2.0

func (g *GoliacLightImpl) Validate(path string) error

type GoliacObservability added in v0.11.0

type GoliacObservability interface {
	SetRemoteObservability(feedback observability.RemoteObservability) error // if you want to get feedback on the loading process
}

type GoliacServer

* GoliacServer is here to run as a serve that * - sync/reconciliate periodically * - provide a REST API server

func NewGoliacServer

func NewGoliacServer(goliac Goliac, notificationService notification.NotificationService) GoliacServer

type GoliacServerImpl

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

func (*GoliacServerImpl) GetCollaborator added in v0.2.2

func (g *GoliacServerImpl) GetCollaborator(params app.GetCollaboratorParams) middleware.Responder

func (*GoliacServerImpl) GetCollaborators added in v0.2.2

func (*GoliacServerImpl) GetLiveness

func (*GoliacServerImpl) GetReadiness

func (*GoliacServerImpl) GetRepositories added in v0.2.0

func (*GoliacServerImpl) GetRepository added in v0.2.0

func (g *GoliacServerImpl) GetRepository(params app.GetRepositoryParams) middleware.Responder

func (*GoliacServerImpl) GetStatistics added in v0.7.0

func (*GoliacServerImpl) GetStatus added in v0.2.0

func (*GoliacServerImpl) GetTeam added in v0.2.0

func (*GoliacServerImpl) GetTeams added in v0.2.0

func (*GoliacServerImpl) GetUnmanaged added in v0.7.1

func (*GoliacServerImpl) GetUser added in v0.2.0

func (*GoliacServerImpl) GetUsers added in v0.2.0

func (*GoliacServerImpl) PostFlushCache added in v0.2.0

func (*GoliacServerImpl) PostResync added in v0.2.0

func (*GoliacServerImpl) Serve

func (g *GoliacServerImpl) Serve()

func (*GoliacServerImpl) StartRESTApi

func (g *GoliacServerImpl) StartRESTApi() (*restapi.Server, error)

type LoadGithubSamlUsers

type LoadGithubSamlUsers func(observability.RemoteObservability) (map[string]*entity.User, error)

type PushEvent added in v0.6.0

type PushEvent struct {
	Ref string `json:"ref"`
}

type Scaffold

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

func NewScaffold

func NewScaffold() (*Scaffold, error)

func (*Scaffold) Generate

func (s *Scaffold) Generate(rootpath string, adminteam string) error

* Generate will generate a full teams directory structure compatible with Goliac

func (*Scaffold) SetRemoteObservability added in v0.11.0

func (s *Scaffold) SetRemoteObservability(feedback observability.RemoteObservability) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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