Documentation ¶
Index ¶
- Constants
- func CompareEntities[A Comparable, B Comparable](a map[string]A, b map[string]B, compareFunction CompareEqualAB[A, B], ...)
- func LoadUsersFromGithubOrgSaml(client github.GitHubClient) (map[string]*entity.User, error)
- func RegisterPlugin(name string, plugin UserSyncPlugin)
- type Comparable
- type CompareCallback
- type CompareEqualAB
- type CreateRepositoryResponse
- type CreateTeamResponse
- type GHESInfo
- type GithubRepoComparable
- type GithubRepository
- type GithubRuleSet
- type GithubRuleSetApp
- type GithubRuleSetRule
- type GithubRuleSetRuleStatusCheck
- type GithubTeam
- type GithubTeamRepo
- type GoliacLocal
- type GoliacLocalGit
- type GoliacLocalImpl
- func (g *GoliacLocalImpl) ArchiveRepos(reposToArchiveList []string, accesstoken string, branch string, tagname string) error
- func (g *GoliacLocalImpl) CheckoutCommit(commit *object.Commit) error
- func (g *GoliacLocalImpl) Clone(accesstoken, repositoryUrl, branch string) error
- func (g *GoliacLocalImpl) Close()
- func (g *GoliacLocalImpl) ExternalUsers() map[string]*entity.User
- func (g *GoliacLocalImpl) GetHeadCommit() (*object.Commit, error)
- func (g *GoliacLocalImpl) ListCommitsFromTag(tagname string) ([]*object.Commit, error)
- func (g *GoliacLocalImpl) LoadAndValidate() ([]error, []entity.Warning)
- func (g *GoliacLocalImpl) LoadAndValidateLocal(fs afero.Fs, orgDirectory string) ([]error, []entity.Warning)
- func (g *GoliacLocalImpl) LoadRepoConfig() (error, *config.RepositoryConfig)
- func (g *GoliacLocalImpl) PushTag(tagname string, hash plumbing.Hash, accesstoken string) error
- func (g *GoliacLocalImpl) Repositories() map[string]*entity.Repository
- func (g *GoliacLocalImpl) RuleSets() map[string]*entity.RuleSet
- func (g *GoliacLocalImpl) SyncUsersAndTeams(repoconfig *config.RepositoryConfig, userplugin UserSyncPlugin, ...) error
- func (g *GoliacLocalImpl) Teams() map[string]*entity.Team
- func (g *GoliacLocalImpl) UpdateAndCommitCodeOwners(repoconfig *config.RepositoryConfig, dryrun bool, accesstoken string, ...) error
- func (g *GoliacLocalImpl) Users() map[string]*entity.User
- type GoliacLocalResources
- type GoliacReconciliator
- type GoliacReconciliatorImpl
- func (r *GoliacReconciliatorImpl) AddRuleset(ctx context.Context, dryrun bool, ruleset *GithubRuleSet)
- func (r *GoliacReconciliatorImpl) AddUserToOrg(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) Begin(ctx context.Context, dryrun bool)
- func (r *GoliacReconciliatorImpl) Commit(ctx context.Context, dryrun bool)
- func (r *GoliacReconciliatorImpl) CreateRepository(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) CreateTeam(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) DeleteRepository(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) DeleteRuleset(ctx context.Context, dryrun bool, rulesetid int)
- func (r *GoliacReconciliatorImpl) DeleteTeam(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) Reconciliate(ctx context.Context, local GoliacLocal, remote GoliacRemote, ...) error
- func (r *GoliacReconciliatorImpl) RemoveUserFromOrg(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) Rollback(ctx context.Context, dryrun bool, err error)
- func (r *GoliacReconciliatorImpl) UpdateRepositoryAddTeamAccess(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) UpdateRepositoryRemoveExternalUser(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) UpdateRepositoryRemoveTeamAccess(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) UpdateRepositorySetExternalUser(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) UpdateRepositoryUpdateArchived(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) UpdateRepositoryUpdatePrivate(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) UpdateRepositoryUpdateTeamAccess(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) UpdateRuleset(ctx context.Context, dryrun bool, ruleset *GithubRuleSet)
- func (r *GoliacReconciliatorImpl) UpdateTeamAddMember(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- func (r *GoliacReconciliatorImpl) UpdateTeamRemoveMember(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- type GoliacRemote
- type GoliacRemoteExecutor
- type GoliacRemoteImpl
- func (g *GoliacRemoteImpl) AddRuleset(dryrun bool, ruleset *GithubRuleSet)
- func (g *GoliacRemoteImpl) AddUserToOrg(dryrun bool, ghuserid string)
- func (g *GoliacRemoteImpl) AppIds() map[string]int
- func (g *GoliacRemoteImpl) Begin(dryrun bool)
- func (g *GoliacRemoteImpl) Commit(dryrun bool)
- func (g *GoliacRemoteImpl) CreateRepository(dryrun bool, reponame string, description string, writers []string, ...)
- func (g *GoliacRemoteImpl) CreateTeam(dryrun bool, teamname string, description string, members []string)
- func (g *GoliacRemoteImpl) DeleteRepository(dryrun bool, reponame string)
- func (g *GoliacRemoteImpl) DeleteRuleset(dryrun bool, rulesetid int)
- func (g *GoliacRemoteImpl) DeleteTeam(dryrun bool, teamslug string)
- func (g *GoliacRemoteImpl) FlushCache()
- func (g *GoliacRemoteImpl) IsEnterprise() bool
- func (g *GoliacRemoteImpl) Load(continueOnError bool) error
- func (g *GoliacRemoteImpl) RemoveUserFromOrg(dryrun bool, ghuserid string)
- func (g *GoliacRemoteImpl) Repositories() map[string]*GithubRepository
- func (g *GoliacRemoteImpl) Rollback(dryrun bool, err error)
- func (g *GoliacRemoteImpl) RuleSets() map[string]*GithubRuleSet
- func (g *GoliacRemoteImpl) TeamRepositories() map[string]map[string]*GithubTeamRepo
- func (g *GoliacRemoteImpl) TeamSlugByName() map[string]string
- func (g *GoliacRemoteImpl) Teams() map[string]*GithubTeam
- func (g *GoliacRemoteImpl) UpdateRepositoryAddTeamAccess(dryrun bool, reponame string, teamslug string, permission string)
- func (g *GoliacRemoteImpl) UpdateRepositoryRemoveExternalUser(dryrun bool, reponame string, githubid string)
- func (g *GoliacRemoteImpl) UpdateRepositoryRemoveTeamAccess(dryrun bool, reponame string, teamslug string)
- func (g *GoliacRemoteImpl) UpdateRepositorySetExternalUser(dryrun bool, reponame string, githubid string, permission string)
- func (g *GoliacRemoteImpl) UpdateRepositoryUpdateArchived(dryrun bool, reponame string, archived bool)
- func (g *GoliacRemoteImpl) UpdateRepositoryUpdatePrivate(dryrun bool, reponame string, private bool)
- func (g *GoliacRemoteImpl) UpdateRepositoryUpdateTeamAccess(dryrun bool, reponame string, teamslug string, permission string)
- func (g *GoliacRemoteImpl) UpdateRuleset(dryrun bool, ruleset *GithubRuleSet)
- func (g *GoliacRemoteImpl) UpdateTeamAddMember(dryrun bool, teamslug string, username string, role string)
- func (g *GoliacRemoteImpl) UpdateTeamRemoveMember(dryrun bool, teamslug string, username string)
- func (g *GoliacRemoteImpl) Users() map[string]string
- type GraphQLGithubRuleSet
- type GraplQLRepositories
- type GraplQLRuleSets
- type GraplQLTeamMembers
- type GraplQLTeams
- type GraplQLTeamsRepos
- type GraplQLUsers
- type GraplQLUsersFromGithubOrgSaml
- type MutableGoliacRemoteImpl
- func (m *MutableGoliacRemoteImpl) AddRuleset(ruleset *GithubRuleSet)
- func (m *MutableGoliacRemoteImpl) AddUserToOrg(ghuserid string)
- func (g *MutableGoliacRemoteImpl) AppIds() map[string]int
- func (m *MutableGoliacRemoteImpl) CreateRepository(reponame string, descrition string, writers []string, readers []string, ...)
- func (m *MutableGoliacRemoteImpl) CreateTeam(teamname string, description string, members []string)
- func (m *MutableGoliacRemoteImpl) DeleteRepository(reponame string)
- func (m *MutableGoliacRemoteImpl) DeleteRuleset(rulesetid int)
- func (m *MutableGoliacRemoteImpl) DeleteTeam(teamslug string)
- func (m *MutableGoliacRemoteImpl) RemoveUserFromOrg(ghuserid string)
- func (m *MutableGoliacRemoteImpl) Repositories() map[string]*GithubRepository
- func (m *MutableGoliacRemoteImpl) RuleSets() map[string]*GithubRuleSet
- func (m *MutableGoliacRemoteImpl) TeamRepositories() map[string]map[string]*GithubTeamRepo
- func (m *MutableGoliacRemoteImpl) TeamSlugByName() map[string]string
- func (m *MutableGoliacRemoteImpl) Teams() map[string]*GithubTeam
- func (m *MutableGoliacRemoteImpl) UpdateRepositoryAddTeamAccess(reponame string, teamslug string, permission string)
- func (m *MutableGoliacRemoteImpl) UpdateRepositoryRemoveExternalUser(reponame string, collaboatorGithubId string)
- func (m *MutableGoliacRemoteImpl) UpdateRepositoryRemoveTeamAccess(reponame string, teamslug string)
- func (m *MutableGoliacRemoteImpl) UpdateRepositorySetExternalUser(reponame string, collaboatorGithubId string, permission string)
- func (m *MutableGoliacRemoteImpl) UpdateRepositoryUpdateArchived(reponame string, archived bool)
- func (m *MutableGoliacRemoteImpl) UpdateRepositoryUpdatePrivate(reponame string, private bool)
- func (m *MutableGoliacRemoteImpl) UpdateRepositoryUpdateTeamAccess(reponame string, teamslug string, permission string)
- func (m *MutableGoliacRemoteImpl) UpdateRuleset(ruleset *GithubRuleSet)
- func (m *MutableGoliacRemoteImpl) UpdateTeamAddMember(teamslug string, username string, role string)
- func (m *MutableGoliacRemoteImpl) UpdateTeamRemoveMember(teamslug string, username string)
- func (m *MutableGoliacRemoteImpl) Users() map[string]string
- type OrgInfo
- type ReconciliatorExecutor
- type UserSyncPlugin
Constants ¶
const FORLOOP_STOP = 100
const (
KeyAuthor key = "author"
)
Variables ¶
This section is empty.
Functions ¶
func CompareEntities ¶
func CompareEntities[A Comparable, B Comparable](a map[string]A, b map[string]B, compareFunction CompareEqualAB[A, B], onAdded CompareCallback[A, B], onRemoved CompareCallback[A, B], onChanged CompareCallback[A, B])
func LoadUsersFromGithubOrgSaml ¶
* This function works only for Github organization that have the Entreprise plan ANAD use SAML integration
func RegisterPlugin ¶
func RegisterPlugin(name string, plugin UserSyncPlugin)
Types ¶
type Comparable ¶
type Comparable interface { *GithubTeam | *GithubRepoComparable | *GithubRuleSet }
type CompareCallback ¶
type CompareCallback[A Comparable, B Comparable] func(key string, value1 A, value2 B)
type CompareEqualAB ¶
type CompareEqualAB[A Comparable, B Comparable] func(value1 A, value2 B) bool
type CreateTeamResponse ¶
type GHESInfo ¶ added in v0.3.0
type GHESInfo struct {
InstalledVersion string `json:"installed_version"`
}
type GithubRepoComparable ¶
type GithubRepository ¶
type GithubRuleSet ¶
type GithubRuleSet struct { Name string Id int // for tracking purpose Enforcement string // disabled, active, evaluate BypassApps map[string]string // appname, mode (always, pull_request) OnInclude []string // ~DEFAULT_BRANCH, ~ALL, branch_name, ... OnExclude []string // branch_name, ... Rules map[string]entity.RuleSetParameters Repositories []string }
type GithubRuleSetApp ¶
type GithubRuleSetRule ¶
type GithubRuleSetRule struct { Parameters struct { // PullRequestParameters DismissStaleReviewsOnPush bool RequireCodeOwnerReview bool RequiredApprovingReviewCount int RequiredReviewThreadResolution bool RequireLastPushApproval bool // RequiredStatusChecksParameters RequiredStatusChecks []GithubRuleSetRuleStatusCheck StrictRequiredStatusChecksPolicy bool } ID int Type string // CREATION, UPDATE, DELETION, REQUIRED_LINEAR_HISTORY, REQUIRED_DEPLOYMENTS, REQUIRED_SIGNATURES, PULL_REQUEST, REQUIRED_STATUS_CHECKS, NON_FAST_FORWARD, COMMIT_MESSAGE_PATTERN, COMMIT_AUTHOR_EMAIL_PATTERN, COMMITTER_EMAIL_PATTERN, BRANCH_NAME_PATTERN, TAG_NAME_PATTERN }
type GithubTeam ¶
type GithubTeamRepo ¶
type GoliacLocal ¶
type GoliacLocal interface { GoliacLocalGit GoliacLocalResources }
* GoliacLocal * This interface is used to load the goliac organization from a local directory * and mount it in memory
func NewGoliacLocalImpl ¶
func NewGoliacLocalImpl() GoliacLocal
type GoliacLocalGit ¶
type GoliacLocalGit interface { Clone(accesstoken, repositoryUrl, branch string) error // Return commits from tagname to HEAD ListCommitsFromTag(tagname string) ([]*object.Commit, error) GetHeadCommit() (*object.Commit, error) CheckoutCommit(commit *object.Commit) error PushTag(tagname string, hash plumbing.Hash, accesstoken string) error LoadRepoConfig() (error, *config.RepositoryConfig) // Load and Validate from a github repository LoadAndValidate() ([]error, []entity.Warning) // whenever someone create/delete a team, we must update the github CODEOWNERS UpdateAndCommitCodeOwners(repoconfig *config.RepositoryConfig, dryrun bool, accesstoken string, branch string, tagname string) error // whenever repos are not deleted but archived ArchiveRepos(reposToArchiveList []string, accesstoken string, branch string, tagname string) error // whenever the users list is changing, reload users and teams, and commit them SyncUsersAndTeams(repoconfig *config.RepositoryConfig, plugin UserSyncPlugin, accesstoken string, dryrun bool, force bool) error Close() // Load and Validate from a local directory LoadAndValidateLocal(fs afero.Fs, path string) ([]error, []entity.Warning) }
type GoliacLocalImpl ¶
type GoliacLocalImpl struct {
// contains filtered or unexported fields
}
func (*GoliacLocalImpl) ArchiveRepos ¶ added in v0.4.3
func (*GoliacLocalImpl) CheckoutCommit ¶
func (g *GoliacLocalImpl) CheckoutCommit(commit *object.Commit) error
func (*GoliacLocalImpl) Clone ¶
func (g *GoliacLocalImpl) Clone(accesstoken, repositoryUrl, branch string) error
func (*GoliacLocalImpl) Close ¶
func (g *GoliacLocalImpl) Close()
func (*GoliacLocalImpl) ExternalUsers ¶
func (g *GoliacLocalImpl) ExternalUsers() map[string]*entity.User
func (*GoliacLocalImpl) GetHeadCommit ¶ added in v0.2.3
func (g *GoliacLocalImpl) GetHeadCommit() (*object.Commit, error)
func (*GoliacLocalImpl) ListCommitsFromTag ¶
func (g *GoliacLocalImpl) ListCommitsFromTag(tagname string) ([]*object.Commit, error)
func (*GoliacLocalImpl) LoadAndValidate ¶
func (g *GoliacLocalImpl) LoadAndValidate() ([]error, []entity.Warning)
* Load the goliac organization from Github (after the repository has been cloned) * - read the organization files * - validate the organization
func (*GoliacLocalImpl) LoadAndValidateLocal ¶
func (g *GoliacLocalImpl) LoadAndValidateLocal(fs afero.Fs, orgDirectory string) ([]error, []entity.Warning)
*
- readOrganization reads all the organization files and returns
- - a slice of errors that must stop the vlidation process
- - a slice of warning that must not stop the validation process
func (*GoliacLocalImpl) LoadRepoConfig ¶
func (g *GoliacLocalImpl) LoadRepoConfig() (error, *config.RepositoryConfig)
func (*GoliacLocalImpl) Repositories ¶
func (g *GoliacLocalImpl) Repositories() map[string]*entity.Repository
func (*GoliacLocalImpl) SyncUsersAndTeams ¶
func (g *GoliacLocalImpl) SyncUsersAndTeams(repoconfig *config.RepositoryConfig, userplugin UserSyncPlugin, accesstoken string, dryrun bool, force bool) error
func (*GoliacLocalImpl) UpdateAndCommitCodeOwners ¶
func (g *GoliacLocalImpl) UpdateAndCommitCodeOwners(repoconfig *config.RepositoryConfig, dryrun bool, accesstoken string, branch string, tagname string) error
* UpdateAndCommitCodeOwners will collects all teams definition to update the .github/CODEOWNERS file * cf https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
type GoliacLocalResources ¶
type GoliacLocalResources interface { Teams() map[string]*entity.Team // teamname, team definition Repositories() map[string]*entity.Repository // reponame, repo definition Users() map[string]*entity.User // github username, user definition ExternalUsers() map[string]*entity.User RuleSets() map[string]*entity.RuleSet }
type GoliacReconciliator ¶
type GoliacReconciliator interface {
Reconciliate(ctx context.Context, local GoliacLocal, remote GoliacRemote, teamreponame string, dryrun bool, reposToArchive map[string]*GithubRepoComparable) error
}
* GoliacReconciliator is here to sync the local state to the remote state
func NewGoliacReconciliatorImpl ¶
func NewGoliacReconciliatorImpl(executor ReconciliatorExecutor, repoconfig *config.RepositoryConfig) GoliacReconciliator
type GoliacReconciliatorImpl ¶
type GoliacReconciliatorImpl struct {
// contains filtered or unexported fields
}
func (*GoliacReconciliatorImpl) AddRuleset ¶
func (r *GoliacReconciliatorImpl) AddRuleset(ctx context.Context, dryrun bool, ruleset *GithubRuleSet)
func (*GoliacReconciliatorImpl) AddUserToOrg ¶
func (r *GoliacReconciliatorImpl) AddUserToOrg(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ghuserid string)
func (*GoliacReconciliatorImpl) Begin ¶
func (r *GoliacReconciliatorImpl) Begin(ctx context.Context, dryrun bool)
func (*GoliacReconciliatorImpl) Commit ¶
func (r *GoliacReconciliatorImpl) Commit(ctx context.Context, dryrun bool)
func (*GoliacReconciliatorImpl) CreateRepository ¶
func (r *GoliacReconciliatorImpl) CreateRepository(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string, descrition string, writers []string, readers []string, public bool)
func (*GoliacReconciliatorImpl) CreateTeam ¶
func (r *GoliacReconciliatorImpl) CreateTeam(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, teamname string, description string, members []string)
func (*GoliacReconciliatorImpl) DeleteRepository ¶
func (r *GoliacReconciliatorImpl) DeleteRepository(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string)
func (*GoliacReconciliatorImpl) DeleteRuleset ¶
func (r *GoliacReconciliatorImpl) DeleteRuleset(ctx context.Context, dryrun bool, rulesetid int)
func (*GoliacReconciliatorImpl) DeleteTeam ¶
func (r *GoliacReconciliatorImpl) DeleteTeam(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, teamslug string)
func (*GoliacReconciliatorImpl) Reconciliate ¶
func (r *GoliacReconciliatorImpl) Reconciliate(ctx context.Context, local GoliacLocal, remote GoliacRemote, teamsreponame string, dryrun bool, reposToArchive map[string]*GithubRepoComparable) error
func (*GoliacReconciliatorImpl) RemoveUserFromOrg ¶
func (r *GoliacReconciliatorImpl) RemoveUserFromOrg(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ghuserid string)
func (*GoliacReconciliatorImpl) Rollback ¶
func (r *GoliacReconciliatorImpl) Rollback(ctx context.Context, dryrun bool, err error)
func (*GoliacReconciliatorImpl) UpdateRepositoryAddTeamAccess ¶
func (r *GoliacReconciliatorImpl) UpdateRepositoryAddTeamAccess(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string, teamslug string, permission string)
func (*GoliacReconciliatorImpl) UpdateRepositoryRemoveExternalUser ¶ added in v0.2.1
func (r *GoliacReconciliatorImpl) UpdateRepositoryRemoveExternalUser(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string, collaboatorGithubId string)
func (*GoliacReconciliatorImpl) UpdateRepositoryRemoveTeamAccess ¶
func (r *GoliacReconciliatorImpl) UpdateRepositoryRemoveTeamAccess(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string, teamslug string)
func (*GoliacReconciliatorImpl) UpdateRepositorySetExternalUser ¶ added in v0.2.1
func (r *GoliacReconciliatorImpl) UpdateRepositorySetExternalUser(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string, collaboatorGithubId string, permission string)
func (*GoliacReconciliatorImpl) UpdateRepositoryUpdateArchived ¶
func (r *GoliacReconciliatorImpl) UpdateRepositoryUpdateArchived(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string, archived bool)
func (*GoliacReconciliatorImpl) UpdateRepositoryUpdatePrivate ¶
func (r *GoliacReconciliatorImpl) UpdateRepositoryUpdatePrivate(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string, private bool)
func (*GoliacReconciliatorImpl) UpdateRepositoryUpdateTeamAccess ¶
func (r *GoliacReconciliatorImpl) UpdateRepositoryUpdateTeamAccess(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string, teamslug string, permission string)
func (*GoliacReconciliatorImpl) UpdateRuleset ¶
func (r *GoliacReconciliatorImpl) UpdateRuleset(ctx context.Context, dryrun bool, ruleset *GithubRuleSet)
func (*GoliacReconciliatorImpl) UpdateTeamAddMember ¶
func (r *GoliacReconciliatorImpl) UpdateTeamAddMember(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, teamslug string, username string, role string)
func (*GoliacReconciliatorImpl) UpdateTeamRemoveMember ¶
func (r *GoliacReconciliatorImpl) UpdateTeamRemoveMember(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, teamslug string, username string)
type GoliacRemote ¶
type GoliacRemote interface { // Load from a github repository. continueOnError is used for scaffolding Load(continueOnError bool) error FlushCache() Users() map[string]string TeamSlugByName() map[string]string Teams() map[string]*GithubTeam // the key is the team slug Repositories() map[string]*GithubRepository // the key is the repository name TeamRepositories() map[string]map[string]*GithubTeamRepo // key is team slug, second key is repo name RuleSets() map[string]*GithubRuleSet AppIds() map[string]int IsEnterprise() bool // check if we are on an Enterprise version, or if we are on GHES 3.11+ }
* GoliacRemote * This interface is used to load the goliac organization from a Github * and mount it in memory
type GoliacRemoteExecutor ¶
type GoliacRemoteExecutor interface { GoliacRemote ReconciliatorExecutor }
type GoliacRemoteImpl ¶
type GoliacRemoteImpl struct {
// contains filtered or unexported fields
}
func NewGoliacRemoteImpl ¶
func NewGoliacRemoteImpl(client github.GitHubClient) *GoliacRemoteImpl
func (*GoliacRemoteImpl) AddRuleset ¶
func (g *GoliacRemoteImpl) AddRuleset(dryrun bool, ruleset *GithubRuleSet)
func (*GoliacRemoteImpl) AddUserToOrg ¶
func (g *GoliacRemoteImpl) AddUserToOrg(dryrun bool, ghuserid string)
func (*GoliacRemoteImpl) AppIds ¶
func (g *GoliacRemoteImpl) AppIds() map[string]int
func (*GoliacRemoteImpl) Begin ¶
func (g *GoliacRemoteImpl) Begin(dryrun bool)
func (*GoliacRemoteImpl) Commit ¶
func (g *GoliacRemoteImpl) Commit(dryrun bool)
func (*GoliacRemoteImpl) CreateRepository ¶
func (*GoliacRemoteImpl) CreateTeam ¶
func (g *GoliacRemoteImpl) CreateTeam(dryrun bool, teamname string, description string, members []string)
func (*GoliacRemoteImpl) DeleteRepository ¶
func (g *GoliacRemoteImpl) DeleteRepository(dryrun bool, reponame string)
func (*GoliacRemoteImpl) DeleteRuleset ¶
func (g *GoliacRemoteImpl) DeleteRuleset(dryrun bool, rulesetid int)
func (*GoliacRemoteImpl) DeleteTeam ¶
func (g *GoliacRemoteImpl) DeleteTeam(dryrun bool, teamslug string)
func (*GoliacRemoteImpl) FlushCache ¶
func (g *GoliacRemoteImpl) FlushCache()
func (*GoliacRemoteImpl) IsEnterprise ¶ added in v0.3.0
func (g *GoliacRemoteImpl) IsEnterprise() bool
func (*GoliacRemoteImpl) Load ¶
func (g *GoliacRemoteImpl) Load(continueOnError bool) error
func (*GoliacRemoteImpl) RemoveUserFromOrg ¶
func (g *GoliacRemoteImpl) RemoveUserFromOrg(dryrun bool, ghuserid string)
func (*GoliacRemoteImpl) Repositories ¶
func (g *GoliacRemoteImpl) Repositories() map[string]*GithubRepository
func (*GoliacRemoteImpl) Rollback ¶
func (g *GoliacRemoteImpl) Rollback(dryrun bool, err error)
func (*GoliacRemoteImpl) RuleSets ¶
func (g *GoliacRemoteImpl) RuleSets() map[string]*GithubRuleSet
func (*GoliacRemoteImpl) TeamRepositories ¶
func (g *GoliacRemoteImpl) TeamRepositories() map[string]map[string]*GithubTeamRepo
func (*GoliacRemoteImpl) TeamSlugByName ¶
func (g *GoliacRemoteImpl) TeamSlugByName() map[string]string
func (*GoliacRemoteImpl) Teams ¶
func (g *GoliacRemoteImpl) Teams() map[string]*GithubTeam
func (*GoliacRemoteImpl) UpdateRepositoryAddTeamAccess ¶
func (g *GoliacRemoteImpl) UpdateRepositoryAddTeamAccess(dryrun bool, reponame string, teamslug string, permission string)
func (*GoliacRemoteImpl) UpdateRepositoryRemoveExternalUser ¶ added in v0.2.1
func (g *GoliacRemoteImpl) UpdateRepositoryRemoveExternalUser(dryrun bool, reponame string, githubid string)
func (*GoliacRemoteImpl) UpdateRepositoryRemoveTeamAccess ¶
func (g *GoliacRemoteImpl) UpdateRepositoryRemoveTeamAccess(dryrun bool, reponame string, teamslug string)
func (*GoliacRemoteImpl) UpdateRepositorySetExternalUser ¶ added in v0.2.1
func (g *GoliacRemoteImpl) UpdateRepositorySetExternalUser(dryrun bool, reponame string, githubid string, permission string)
func (*GoliacRemoteImpl) UpdateRepositoryUpdateArchived ¶
func (g *GoliacRemoteImpl) UpdateRepositoryUpdateArchived(dryrun bool, reponame string, archived bool)
func (*GoliacRemoteImpl) UpdateRepositoryUpdatePrivate ¶
func (g *GoliacRemoteImpl) UpdateRepositoryUpdatePrivate(dryrun bool, reponame string, private bool)
func (*GoliacRemoteImpl) UpdateRepositoryUpdateTeamAccess ¶
func (g *GoliacRemoteImpl) UpdateRepositoryUpdateTeamAccess(dryrun bool, reponame string, teamslug string, permission string)
func (*GoliacRemoteImpl) UpdateRuleset ¶
func (g *GoliacRemoteImpl) UpdateRuleset(dryrun bool, ruleset *GithubRuleSet)
func (*GoliacRemoteImpl) UpdateTeamAddMember ¶
func (g *GoliacRemoteImpl) UpdateTeamAddMember(dryrun bool, teamslug string, username string, role string)
role = member or maintainer (usually we use member)
func (*GoliacRemoteImpl) UpdateTeamRemoveMember ¶
func (g *GoliacRemoteImpl) UpdateTeamRemoveMember(dryrun bool, teamslug string, username string)
func (*GoliacRemoteImpl) Users ¶
func (g *GoliacRemoteImpl) Users() map[string]string
type GraphQLGithubRuleSet ¶
type GraphQLGithubRuleSet struct { DatabaseId int Name string Target string // BRANCH, TAG Enforcement string // DISABLED, ACTIVE, EVALUATE BypassActors struct { App []GithubRuleSetApp } Conditions struct { RefName struct { Include []string // ~DEFAULT_BRANCH, ~ALL, Exclude []string } RepositoryName struct { Include []string Exclude []string Protected bool } RepositoryId struct { RepositoryIds []string } } Rules struct { Nodes []GithubRuleSetRule } }
type GraplQLRepositories ¶
type GraplQLRepositories struct { Data struct { Organization struct { Repositories struct { Nodes []struct { Name string Id string DatabaseId int IsArchived bool IsPrivate bool Collaborators struct { Edges []struct { Node struct { Login string } Permission string } } } `json:"nodes"` PageInfo struct { HasNextPage bool EndCursor string } `json:"pageInfo"` TotalCount int `json:"totalCount"` } `json:"repositories"` } } Errors []struct { Path []interface{} `json:"path"` Extensions struct { Code string ErrorMessage string } `json:"extensions"` Message string } `json:"errors"` }
type GraplQLRuleSets ¶
type GraplQLRuleSets struct { Data struct { Organization struct { Rulesets struct { Nodes []GraphQLGithubRuleSet PageInfo struct { HasNextPage bool EndCursor string } `json:"pageInfo"` TotalCount int `json:"totalCount"` } `json:"rulesets"` } } Errors []struct { Path []string `json:"path"` Extensions struct { Code string ErrorMessage string } `json:"extensions"` Message string } `json:"errors"` }
type GraplQLTeamMembers ¶
type GraplQLTeamMembers struct { Data struct { Organization struct { Team struct { Members struct { Edges []struct { Node struct { Login string } } `json:"edges"` PageInfo struct { HasNextPage bool EndCursor string } `json:"pageInfo"` TotalCount int `json:"totalCount"` } `json:"members"` } `json:"team"` } } Errors []struct { Path []interface{} `json:"path"` Extensions struct { Code string ErrorMessage string } `json:"extensions"` Message string } `json:"errors"` }
type GraplQLTeams ¶
type GraplQLTeams struct { Data struct { Organization struct { Teams struct { Nodes []struct { Name string Slug string } `json:"nodes"` PageInfo struct { HasNextPage bool EndCursor string } `json:"pageInfo"` TotalCount int `json:"totalCount"` } `json:"teams"` } } Errors []struct { Path []interface{} `json:"path"` Extensions struct { Code string ErrorMessage string } `json:"extensions"` Message string } `json:"errors"` }
type GraplQLTeamsRepos ¶
type GraplQLTeamsRepos struct { Data struct { Organization struct { Team struct { Repository struct { Edges []struct { Permission string Node struct { Name string } } `json:"edges"` PageInfo struct { HasNextPage bool EndCursor string } `json:"pageInfo"` TotalCount int `json:"totalCount"` } `json:"repositories"` } `json:"team"` } } Errors []struct { Path []interface{} `json:"path"` Extensions struct { Code string ErrorMessage string } `json:"extensions"` Message string } `json:"errors"` }
type GraplQLUsers ¶
type GraplQLUsers struct { Data struct { Organization struct { MembersWithRole struct { Nodes []struct { Login string } `json:"nodes"` PageInfo struct { HasNextPage bool EndCursor string } `json:"pageInfo"` TotalCount int `json:"totalCount"` } `json:"membersWithRole"` } } Errors []struct { Path []interface{} `json:"path"` Extensions struct { Code string ErrorMessage string } `json:"extensions"` Message string } `json:"errors"` }
type GraplQLUsersFromGithubOrgSaml ¶
type GraplQLUsersFromGithubOrgSaml struct { Data struct { Organization struct { SamlIdentityProvider struct { ExternalIdentities struct { Edges []struct { Node struct { Guid string SamlIdentity struct { NameId string } User struct { Login string } } } PageInfo struct { HasNextPage bool EndCursor string } `json:"pageInfo"` TotalCount int `json:"totalCount"` } `json:"externalIdentities"` } } } Errors []struct { Path []struct { Query string `json:"query"` } `json:"path"` Extensions struct { Code string ErrorMessage string } `json:"extensions"` Message string } `json:"errors"` }
type MutableGoliacRemoteImpl ¶
type MutableGoliacRemoteImpl struct {
// contains filtered or unexported fields
}
* MutableGoliacRemoteImpl is used by GoliacReconciliatorImpl to update * the internal status of Github representation before appyling it for real * (or running in drymode)
func NewMutableGoliacRemoteImpl ¶
func NewMutableGoliacRemoteImpl(remote GoliacRemote) *MutableGoliacRemoteImpl
func (*MutableGoliacRemoteImpl) AddRuleset ¶
func (m *MutableGoliacRemoteImpl) AddRuleset(ruleset *GithubRuleSet)
func (*MutableGoliacRemoteImpl) AddUserToOrg ¶
func (m *MutableGoliacRemoteImpl) AddUserToOrg(ghuserid string)
func (*MutableGoliacRemoteImpl) AppIds ¶
func (g *MutableGoliacRemoteImpl) AppIds() map[string]int
func (*MutableGoliacRemoteImpl) CreateRepository ¶
func (*MutableGoliacRemoteImpl) CreateTeam ¶
func (m *MutableGoliacRemoteImpl) CreateTeam(teamname string, description string, members []string)
func (*MutableGoliacRemoteImpl) DeleteRepository ¶
func (m *MutableGoliacRemoteImpl) DeleteRepository(reponame string)
func (*MutableGoliacRemoteImpl) DeleteRuleset ¶
func (m *MutableGoliacRemoteImpl) DeleteRuleset(rulesetid int)
func (*MutableGoliacRemoteImpl) DeleteTeam ¶
func (m *MutableGoliacRemoteImpl) DeleteTeam(teamslug string)
func (*MutableGoliacRemoteImpl) RemoveUserFromOrg ¶
func (m *MutableGoliacRemoteImpl) RemoveUserFromOrg(ghuserid string)
func (*MutableGoliacRemoteImpl) Repositories ¶
func (m *MutableGoliacRemoteImpl) Repositories() map[string]*GithubRepository
func (*MutableGoliacRemoteImpl) RuleSets ¶
func (m *MutableGoliacRemoteImpl) RuleSets() map[string]*GithubRuleSet
func (*MutableGoliacRemoteImpl) TeamRepositories ¶
func (m *MutableGoliacRemoteImpl) TeamRepositories() map[string]map[string]*GithubTeamRepo
func (*MutableGoliacRemoteImpl) TeamSlugByName ¶
func (m *MutableGoliacRemoteImpl) TeamSlugByName() map[string]string
func (*MutableGoliacRemoteImpl) Teams ¶
func (m *MutableGoliacRemoteImpl) Teams() map[string]*GithubTeam
func (*MutableGoliacRemoteImpl) UpdateRepositoryAddTeamAccess ¶
func (m *MutableGoliacRemoteImpl) UpdateRepositoryAddTeamAccess(reponame string, teamslug string, permission string)
func (*MutableGoliacRemoteImpl) UpdateRepositoryRemoveExternalUser ¶ added in v0.2.1
func (m *MutableGoliacRemoteImpl) UpdateRepositoryRemoveExternalUser(reponame string, collaboatorGithubId string)
func (*MutableGoliacRemoteImpl) UpdateRepositoryRemoveTeamAccess ¶
func (m *MutableGoliacRemoteImpl) UpdateRepositoryRemoveTeamAccess(reponame string, teamslug string)
func (*MutableGoliacRemoteImpl) UpdateRepositorySetExternalUser ¶ added in v0.2.1
func (m *MutableGoliacRemoteImpl) UpdateRepositorySetExternalUser(reponame string, collaboatorGithubId string, permission string)
func (*MutableGoliacRemoteImpl) UpdateRepositoryUpdateArchived ¶
func (m *MutableGoliacRemoteImpl) UpdateRepositoryUpdateArchived(reponame string, archived bool)
func (*MutableGoliacRemoteImpl) UpdateRepositoryUpdatePrivate ¶
func (m *MutableGoliacRemoteImpl) UpdateRepositoryUpdatePrivate(reponame string, private bool)
func (*MutableGoliacRemoteImpl) UpdateRepositoryUpdateTeamAccess ¶
func (m *MutableGoliacRemoteImpl) UpdateRepositoryUpdateTeamAccess(reponame string, teamslug string, permission string)
func (*MutableGoliacRemoteImpl) UpdateRuleset ¶
func (m *MutableGoliacRemoteImpl) UpdateRuleset(ruleset *GithubRuleSet)
func (*MutableGoliacRemoteImpl) UpdateTeamAddMember ¶
func (m *MutableGoliacRemoteImpl) UpdateTeamAddMember(teamslug string, username string, role string)
func (*MutableGoliacRemoteImpl) UpdateTeamRemoveMember ¶
func (m *MutableGoliacRemoteImpl) UpdateTeamRemoveMember(teamslug string, username string)
func (*MutableGoliacRemoteImpl) Users ¶
func (m *MutableGoliacRemoteImpl) Users() map[string]string
type ReconciliatorExecutor ¶
type ReconciliatorExecutor interface { AddUserToOrg(dryrun bool, ghuserid string) RemoveUserFromOrg(dryrun bool, ghuserid string) CreateTeam(dryrun bool, teamname string, description string, members []string) UpdateTeamAddMember(dryrun bool, teamslug string, username string, role string) // role can be 'member' or 'maintainer' //UpdateTeamUpdateMember(dryrun bool, teamslug string, username string, role string) // role can be 'member' or 'maintainer' UpdateTeamRemoveMember(dryrun bool, teamslug string, username string) DeleteTeam(dryrun bool, teamslug string) CreateRepository(dryrun bool, reponame string, descrition string, writers []string, readers []string, public bool) UpdateRepositoryUpdateArchived(dryrun bool, reponame string, archived bool) UpdateRepositoryUpdatePrivate(dryrun bool, reponame string, private bool) UpdateRepositoryAddTeamAccess(dryrun bool, reponame string, teamslug string, permission string) // permission can be "pull", "push", or "admin" which correspond to read, write, and admin access. UpdateRepositoryUpdateTeamAccess(dryrun bool, reponame string, teamslug string, permission string) // permission can be "pull", "push", or "admin" which correspond to read, write, and admin access. UpdateRepositoryRemoveTeamAccess(dryrun bool, reponame string, teamslug string) AddRuleset(dryrun bool, ruleset *GithubRuleSet) UpdateRuleset(dryrun bool, ruleset *GithubRuleSet) DeleteRuleset(dryrun bool, rulesetid int) UpdateRepositorySetExternalUser(dryrun bool, reponame string, githubid string, permission string) // permission can be "pull" or "push" UpdateRepositoryRemoveExternalUser(dryrun bool, reponame string, githubid string) DeleteRepository(dryrun bool, reponame string) Begin(dryrun bool) Rollback(dryrun bool, err error) Commit(dryrun bool) }
type UserSyncPlugin ¶
type UserSyncPlugin interface { // Get the current user list directory path, returns the new user list UpdateUsers(repoconfig *config.RepositoryConfig, orguserdirrectorypath string) (map[string]*entity.User, error) }
func GetUserSyncPlugin ¶
func GetUserSyncPlugin(pluginname string) (UserSyncPlugin, bool)