Documentation
¶
Index ¶
- Constants
- func CompareEntities[A Comparable, B Comparable](a map[string]A, b map[string]B, compareFunction CompareEqualAB[A, B], ...)
- func LoadUsersFromGithubOrgSaml(ctx context.Context, 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 GithubTeamComparable
- 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(fs billy.Filesystem, accesstoken, repositoryUrl, branch string) error
- func (g *GoliacLocalImpl) Close(fs billy.Filesystem)
- 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 billy.Filesystem) ([]error, []entity.Warning)
- func (g *GoliacLocalImpl) LoadRepoConfig() (*config.RepositoryConfig, error)
- 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, ...) (bool, 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) error
- 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, ...) (*UnmanagedResources, 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) UpdateRepositoryUpdateBoolProperty(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, ...)
- func (r *GoliacReconciliatorImpl) UpdateTeamSetParent(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, ...)
- type GoliacRemote
- type GoliacRemoteExecutor
- type GoliacRemoteImpl
- func (g *GoliacRemoteImpl) AddRuleset(ctx context.Context, dryrun bool, ruleset *GithubRuleSet)
- func (g *GoliacRemoteImpl) AddUserToOrg(ctx context.Context, dryrun bool, ghuserid string)
- func (g *GoliacRemoteImpl) AppIds(ctx context.Context) map[string]int
- func (g *GoliacRemoteImpl) Begin(dryrun bool)
- func (g *GoliacRemoteImpl) Commit(ctx context.Context, dryrun bool) error
- func (g *GoliacRemoteImpl) CreateRepository(ctx context.Context, dryrun bool, reponame string, description string, ...)
- func (g *GoliacRemoteImpl) CreateTeam(ctx context.Context, dryrun bool, teamname string, description string, ...)
- func (g *GoliacRemoteImpl) DeleteRepository(ctx context.Context, dryrun bool, reponame string)
- func (g *GoliacRemoteImpl) DeleteRuleset(ctx context.Context, dryrun bool, rulesetid int)
- func (g *GoliacRemoteImpl) DeleteTeam(ctx context.Context, dryrun bool, teamslug string)
- func (g *GoliacRemoteImpl) FlushCache()
- func (g *GoliacRemoteImpl) FlushCacheUsersTeamsOnly()
- func (g *GoliacRemoteImpl) IsEnterprise() bool
- func (g *GoliacRemoteImpl) Load(ctx context.Context, continueOnError bool) error
- func (g *GoliacRemoteImpl) RemoveUserFromOrg(ctx context.Context, dryrun bool, ghuserid string)
- func (g *GoliacRemoteImpl) Repositories(ctx context.Context) map[string]*GithubRepository
- func (g *GoliacRemoteImpl) Rollback(dryrun bool, err error)
- func (g *GoliacRemoteImpl) RuleSets(ctx context.Context) map[string]*GithubRuleSet
- func (g *GoliacRemoteImpl) TeamRepositories(ctx context.Context) map[string]map[string]*GithubTeamRepo
- func (g *GoliacRemoteImpl) TeamSlugByName(ctx context.Context) map[string]string
- func (g *GoliacRemoteImpl) Teams(ctx context.Context) map[string]*GithubTeam
- func (g *GoliacRemoteImpl) UpdateRepositoryAddTeamAccess(ctx context.Context, dryrun bool, reponame string, teamslug string, ...)
- func (g *GoliacRemoteImpl) UpdateRepositoryRemoveExternalUser(ctx context.Context, dryrun bool, reponame string, githubid string)
- func (g *GoliacRemoteImpl) UpdateRepositoryRemoveTeamAccess(ctx context.Context, dryrun bool, reponame string, teamslug string)
- func (g *GoliacRemoteImpl) UpdateRepositorySetExternalUser(ctx context.Context, dryrun bool, reponame string, githubid string, ...)
- func (g *GoliacRemoteImpl) UpdateRepositoryUpdateBoolProperty(ctx context.Context, dryrun bool, reponame string, propertyName string, ...)
- func (g *GoliacRemoteImpl) UpdateRepositoryUpdateTeamAccess(ctx context.Context, dryrun bool, reponame string, teamslug string, ...)
- func (g *GoliacRemoteImpl) UpdateRuleset(ctx context.Context, dryrun bool, ruleset *GithubRuleSet)
- func (g *GoliacRemoteImpl) UpdateTeamAddMember(ctx context.Context, dryrun bool, teamslug string, username string, ...)
- func (g *GoliacRemoteImpl) UpdateTeamRemoveMember(ctx context.Context, dryrun bool, teamslug string, username string)
- func (g *GoliacRemoteImpl) UpdateTeamSetParent(ctx context.Context, dryrun bool, teamslug string, parentTeam *int)
- func (g *GoliacRemoteImpl) Users(ctx context.Context) map[string]string
- type GraphQLGithubRuleSet
- type GraplQLRepositories
- type GraplQLRuleSets
- type GraplQLTeamMembers
- type GraplQLTeams
- 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) UpdateRepositoryUpdateBoolProperty(reponame string, propertyName string, propertyValue 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) UpdateTeamSetParent(ctx context.Context, dryrun bool, teamslug string, parentTeam *int)
- func (m *MutableGoliacRemoteImpl) Users() map[string]string
- type OrgInfo
- type ReconciliatorExecutor
- type TeamsRepoResponse
- type UnmanagedResources
- 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 ¶
func LoadUsersFromGithubOrgSaml(ctx context.Context, client github.GitHubClient) (map[string]*entity.User, error)
* 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 { *GithubTeamComparable | *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 GithubTeamComparable ¶ added in v0.8.0
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
func NewGoliacLocalImplWithRepo ¶ added in v0.9.7
func NewGoliacLocalImplWithRepo(repo *git.Repository) GoliacLocal
NewMockGoliacLocalImpl is used for testing purposes
type GoliacLocalGit ¶
type GoliacLocalGit interface { Clone(fs billy.Filesystem, 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() (*config.RepositoryConfig, error) // 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, githubOrganization 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 // (force will bypass the max_changesets check) // return true if some changes were done SyncUsersAndTeams(repoconfig *config.RepositoryConfig, plugin UserSyncPlugin, accesstoken string, dryrun bool, force bool) (bool, error) Close(fs billy.Filesystem) // Load and Validate from a local directory LoadAndValidateLocal(fs billy.Filesystem) ([]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(fs billy.Filesystem, accesstoken, repositoryUrl, branch string) error
func (*GoliacLocalImpl) Close ¶
func (g *GoliacLocalImpl) Close(fs billy.Filesystem)
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 billy.Filesystem) ([]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() (*config.RepositoryConfig, error)
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) (bool, error)
func (*GoliacLocalImpl) UpdateAndCommitCodeOwners ¶
func (g *GoliacLocalImpl) UpdateAndCommitCodeOwners(repoconfig *config.RepositoryConfig, dryrun bool, accesstoken string, branch string, tagname string, githubOrganization 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) (*UnmanagedResources, 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) error
func (*GoliacReconciliatorImpl) CreateRepository ¶
func (*GoliacReconciliatorImpl) CreateTeam ¶
func (r *GoliacReconciliatorImpl) CreateTeam(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, teamname string, description string, parentTeam *int, 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) (*UnmanagedResources, 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) UpdateRepositoryUpdateBoolProperty ¶ added in v0.5.0
func (r *GoliacReconciliatorImpl) UpdateRepositoryUpdateBoolProperty(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, reponame string, propertyName string, propertyValue 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)
func (*GoliacReconciliatorImpl) UpdateTeamSetParent ¶ added in v0.8.0
func (r *GoliacReconciliatorImpl) UpdateTeamSetParent(ctx context.Context, dryrun bool, remote *MutableGoliacRemoteImpl, teamslug string, parentTeam *int)
type GoliacRemote ¶
type GoliacRemote interface { // Load from a github repository. continueOnError is used for scaffolding Load(ctx context.Context, continueOnError bool) error // Flush all assets from the cache FlushCache() // Flush only the users, and teams from the cache FlushCacheUsersTeamsOnly() Users(ctx context.Context) map[string]string // key is the login, value is the role (member, admin) TeamSlugByName(ctx context.Context) map[string]string Teams(ctx context.Context) map[string]*GithubTeam // the key is the team slug Repositories(ctx context.Context) map[string]*GithubRepository // the key is the repository name TeamRepositories(ctx context.Context) map[string]map[string]*GithubTeamRepo // key is team slug, second key is repo name RuleSets(ctx context.Context) map[string]*GithubRuleSet AppIds(ctx context.Context) 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(ctx context.Context, dryrun bool, ruleset *GithubRuleSet)
func (*GoliacRemoteImpl) AddUserToOrg ¶
func (g *GoliacRemoteImpl) AddUserToOrg(ctx context.Context, dryrun bool, ghuserid string)
func (*GoliacRemoteImpl) AppIds ¶
func (g *GoliacRemoteImpl) AppIds(ctx context.Context) map[string]int
func (*GoliacRemoteImpl) Begin ¶
func (g *GoliacRemoteImpl) Begin(dryrun bool)
func (*GoliacRemoteImpl) Commit ¶
func (g *GoliacRemoteImpl) Commit(ctx context.Context, dryrun bool) error
func (*GoliacRemoteImpl) CreateRepository ¶
func (g *GoliacRemoteImpl) CreateRepository(ctx context.Context, dryrun bool, reponame string, description string, writers []string, readers []string, boolProperties map[string]bool)
boolProperties are: - private - archived - allow_auto_merge - delete_branch_on_merge - allow_update_branch - ...
func (*GoliacRemoteImpl) CreateTeam ¶
func (*GoliacRemoteImpl) DeleteRepository ¶
func (g *GoliacRemoteImpl) DeleteRepository(ctx context.Context, dryrun bool, reponame string)
func (*GoliacRemoteImpl) DeleteRuleset ¶
func (g *GoliacRemoteImpl) DeleteRuleset(ctx context.Context, dryrun bool, rulesetid int)
func (*GoliacRemoteImpl) DeleteTeam ¶
func (g *GoliacRemoteImpl) DeleteTeam(ctx context.Context, dryrun bool, teamslug string)
func (*GoliacRemoteImpl) FlushCache ¶
func (g *GoliacRemoteImpl) FlushCache()
func (*GoliacRemoteImpl) FlushCacheUsersTeamsOnly ¶ added in v0.9.7
func (g *GoliacRemoteImpl) FlushCacheUsersTeamsOnly()
func (*GoliacRemoteImpl) IsEnterprise ¶ added in v0.3.0
func (g *GoliacRemoteImpl) IsEnterprise() bool
func (*GoliacRemoteImpl) Load ¶
func (g *GoliacRemoteImpl) Load(ctx context.Context, continueOnError bool) error
func (*GoliacRemoteImpl) RemoveUserFromOrg ¶
func (g *GoliacRemoteImpl) RemoveUserFromOrg(ctx context.Context, dryrun bool, ghuserid string)
func (*GoliacRemoteImpl) Repositories ¶
func (g *GoliacRemoteImpl) Repositories(ctx context.Context) map[string]*GithubRepository
func (*GoliacRemoteImpl) Rollback ¶
func (g *GoliacRemoteImpl) Rollback(dryrun bool, err error)
func (*GoliacRemoteImpl) RuleSets ¶
func (g *GoliacRemoteImpl) RuleSets(ctx context.Context) map[string]*GithubRuleSet
func (*GoliacRemoteImpl) TeamRepositories ¶
func (g *GoliacRemoteImpl) TeamRepositories(ctx context.Context) map[string]map[string]*GithubTeamRepo
func (*GoliacRemoteImpl) TeamSlugByName ¶
func (g *GoliacRemoteImpl) TeamSlugByName(ctx context.Context) map[string]string
func (*GoliacRemoteImpl) Teams ¶
func (g *GoliacRemoteImpl) Teams(ctx context.Context) map[string]*GithubTeam
func (*GoliacRemoteImpl) UpdateRepositoryAddTeamAccess ¶
func (*GoliacRemoteImpl) UpdateRepositoryRemoveExternalUser ¶ added in v0.2.1
func (*GoliacRemoteImpl) UpdateRepositoryRemoveTeamAccess ¶
func (*GoliacRemoteImpl) UpdateRepositorySetExternalUser ¶ added in v0.2.1
func (*GoliacRemoteImpl) UpdateRepositoryUpdateBoolProperty ¶ added in v0.5.0
func (g *GoliacRemoteImpl) UpdateRepositoryUpdateBoolProperty(ctx context.Context, dryrun bool, reponame string, propertyName string, propertyValue bool)
Used for - private - allow_auto_merge - delete_branch_on_merge - allow_update_branch - archived
func (*GoliacRemoteImpl) UpdateRepositoryUpdateTeamAccess ¶
func (*GoliacRemoteImpl) UpdateRuleset ¶
func (g *GoliacRemoteImpl) UpdateRuleset(ctx context.Context, dryrun bool, ruleset *GithubRuleSet)
func (*GoliacRemoteImpl) UpdateTeamAddMember ¶
func (g *GoliacRemoteImpl) UpdateTeamAddMember(ctx context.Context, dryrun bool, teamslug string, username string, role string)
role = member or maintainer (usually we use member)
func (*GoliacRemoteImpl) UpdateTeamRemoveMember ¶
func (*GoliacRemoteImpl) UpdateTeamSetParent ¶ added in v0.8.0
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 AutoMergeAllowed bool DeleteBranchOnMerge bool AllowUpdateBranch 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 DatabaseId int `json:"databaseId"` Slug string ParentTeam struct { DatabaseId int `json:"databaseId"` } `json:"parentTeam"` } `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 GraplQLUsers ¶
type GraplQLUsers struct { Data struct { Organization struct { MembersWithRole struct { Edges []struct { Node struct { Login string } `json:"node"` Role string `json:"role"` } `json:"edges"` 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(ctx context.Context, 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) UpdateRepositoryUpdateBoolProperty ¶ added in v0.5.0
func (m *MutableGoliacRemoteImpl) UpdateRepositoryUpdateBoolProperty(reponame string, propertyName string, propertyValue bool)
UpdateRepositoryUpdateBoolProperty is used for - private - archived - allow_auto_merge - delete_branch_on_merge - allow_update_branch
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) UpdateTeamSetParent ¶ added in v0.8.0
func (*MutableGoliacRemoteImpl) Users ¶
func (m *MutableGoliacRemoteImpl) Users() map[string]string
type ReconciliatorExecutor ¶
type ReconciliatorExecutor interface { AddUserToOrg(ctx context.Context, dryrun bool, ghuserid string) RemoveUserFromOrg(ctx context.Context, dryrun bool, ghuserid string) CreateTeam(ctx context.Context, dryrun bool, teamname string, description string, parentTeam *int, members []string) UpdateTeamAddMember(ctx context.Context, 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(ctx context.Context, dryrun bool, teamslug string, username string) UpdateTeamSetParent(ctx context.Context, dryrun bool, teamslug string, parentTeam *int) DeleteTeam(ctx context.Context, dryrun bool, teamslug string) CreateRepository(ctx context.Context, dryrun bool, reponame string, descrition string, writers []string, readers []string, boolProperties map[string]bool) UpdateRepositoryUpdateBoolProperty(ctx context.Context, dryrun bool, reponame string, propertyName string, propertyValue bool) UpdateRepositoryAddTeamAccess(ctx context.Context, dryrun bool, reponame string, teamslug string, permission string) // permission can be "pull", "push", or "admin" which correspond to read, write, and admin access. UpdateRepositoryUpdateTeamAccess(ctx context.Context, dryrun bool, reponame string, teamslug string, permission string) // permission can be "pull", "push", or "admin" which correspond to read, write, and admin access. UpdateRepositoryRemoveTeamAccess(ctx context.Context, dryrun bool, reponame string, teamslug string) AddRuleset(ctx context.Context, dryrun bool, ruleset *GithubRuleSet) UpdateRuleset(ctx context.Context, dryrun bool, ruleset *GithubRuleSet) DeleteRuleset(ctx context.Context, dryrun bool, rulesetid int) UpdateRepositorySetExternalUser(ctx context.Context, dryrun bool, reponame string, githubid string, permission string) // permission can be "pull" or "push" UpdateRepositoryRemoveExternalUser(ctx context.Context, dryrun bool, reponame string, githubid string) DeleteRepository(ctx context.Context, dryrun bool, reponame string) Begin(dryrun bool) Rollback(dryrun bool, err error) Commit(ctx context.Context, dryrun bool) error }
type TeamsRepoResponse ¶ added in v0.9.0
type UnmanagedResources ¶ added in v0.7.1
type UserSyncPlugin ¶
type UserSyncPlugin interface { // Get the current user list directory path, returns the new user list UpdateUsers(repoconfig *config.RepositoryConfig, fs billy.Filesystem, orguserdirrectorypath string) (map[string]*entity.User, error) }
func GetUserSyncPlugin ¶
func GetUserSyncPlugin(pluginname string) (UserSyncPlugin, bool)