engine

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const FORLOOP_STOP = 100
View Source
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(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 {
	*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 CreateRepositoryResponse

type CreateRepositoryResponse struct {
	Id     int    `json:"id"`
	NodeId string `json:"node_id"`
}

type CreateTeamResponse

type CreateTeamResponse struct {
	Name string
	Slug string
}

type GHESInfo added in v0.3.0

type GHESInfo struct {
	InstalledVersion string `json:"installed_version"`
}

type GithubRepoComparable

type GithubRepoComparable struct {
	IsPublic            bool
	IsArchived          bool
	Writers             []string
	Readers             []string
	ExternalUserReaders []string // githubids
	ExternalUserWriters []string // githubids
}

type GithubRepository

type GithubRepository struct {
	Name          string
	Id            int
	RefId         string
	IsArchived    bool
	IsPrivate     bool
	ExternalUsers map[string]string // [githubid]permission
}

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 GithubRuleSetApp struct {
	Actor struct {
		DatabaseId int
		Name       string
	}
	BypassMode string // ALWAYS, PULL_REQUEST
}

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 GithubRuleSetRuleStatusCheck

type GithubRuleSetRuleStatusCheck struct {
	Context       string
	IntegrationId int
}

type GithubTeam

type GithubTeam struct {
	Name    string
	Slug    string
	Members []string // user login
}

type GithubTeamRepo

type GithubTeamRepo struct {
	Name       string // repository name
	Permission string // possible values: ADMIN, MAINTAIN, WRITE, TRIAGE, READ
}

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 (g *GoliacLocalImpl) ArchiveRepos(reposToArchiveList []string, accesstoken string, branch string, tagname string) error

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) PushTag

func (g *GoliacLocalImpl) PushTag(tagname string, hash plumbing.Hash, accesstoken string) error

func (*GoliacLocalImpl) Repositories

func (g *GoliacLocalImpl) Repositories() map[string]*entity.Repository

func (*GoliacLocalImpl) RuleSets

func (g *GoliacLocalImpl) RuleSets() map[string]*entity.RuleSet

func (*GoliacLocalImpl) SyncUsersAndTeams

func (g *GoliacLocalImpl) SyncUsersAndTeams(repoconfig *config.RepositoryConfig, userplugin UserSyncPlugin, accesstoken string, dryrun bool, force bool) error

func (*GoliacLocalImpl) Teams

func (g *GoliacLocalImpl) Teams() map[string]*entity.Team

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

func (*GoliacLocalImpl) Users

func (g *GoliacLocalImpl) Users() map[string]*entity.User

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 (g *GoliacRemoteImpl) CreateRepository(dryrun bool, reponame string, description string, writers []string, readers []string, public bool)

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 (m *MutableGoliacRemoteImpl) CreateRepository(reponame string, descrition string, writers []string, readers []string, public bool)

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 OrgInfo added in v0.3.0

type OrgInfo struct {
	TwoFactorRequirementEnabled bool `json:"two_factor_requirement_enabled"`
	Plan                        struct {
		Name string `json:"name"` // enterprise
	} `json:"plan"`
}

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)

Jump to

Keyboard shortcuts

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