Documentation
¶
Index ¶
- Variables
- type Config
- type Discord
- type DiscordPermissionSet
- type GitHubDeployKey
- type GitHubOrgMember
- type GitHubRepo
- type GitHubRepoBranchProtectionRule
- type GitHubRepoCollaborator
- type GitHubState
- func (state *GitHubState) LoadMembers(ctx context.Context, client *githubv4.Client) error
- func (state *GitHubState) LoadRepos(ctx context.Context, client *githubv4.Client) error
- func (state *GitHubState) LoadTeams(ctx context.Context, client *githubv4.Client) error
- func (state GitHubState) Member(login string) (GitHubOrgMember, bool)
- func (state GitHubState) Repo(name string) (GitHubRepo, bool)
- func (state GitHubState) Team(name string) (GitHubTeam, bool)
- type GitHubTeam
- type GitHubTeamMember
- type GitHubTeamRepoAccess
- type MailgunRoute
- type MailgunState
- type OrgRole
- type Person
- type Repo
- type RepoBranchProtection
- type RepoDeployKey
- type RepoLabel
- type RepoPages
- type RepoPermission
- type Team
- type TeamRole
Constants ¶
This section is empty.
Variables ¶
View Source
var DiscordPermissions = map[string]int64{
"CREATE_INSTANT_INVITE": 0x00000001,
"KICK_MEMBERS": 0x00000002,
"BAN_MEMBERS": 0x00000004,
"ADMINISTRATOR": 0x00000008,
"MANAGE_CHANNELS": 0x00000010,
"MANAGE_SERVER": 0x00000020,
"ADD_REACTIONS": 0x00000040,
"VIEW_AUDIT_LOG": 0x00000080,
"PRIORITY_SPEAKER": 0x00000100,
"STREAM": 0x00000200,
"VIEW_CHANNEL": 0x00000400,
"SEND_MESSAGES": 0x00000800,
"SEND_TTS_MESSAGES": 0x00001000,
"MANAGE_MESSAGES": 0x00002000,
"EMBED_LINKS": 0x00004000,
"ATTACH_FILES": 0x00008000,
"READ_MESSAGE_HISTORY": 0x00010000,
"MENTION_EVERYONE": 0x00020000,
"USE_EXTERNAL_EMOJIS": 0x00040000,
"VIEW_SERVER_INSIGHTS": 0x00080000,
"CONNECT": 0x00100000,
"SPEAK": 0x00200000,
"MUTE_MEMBERS": 0x00400000,
"DEAFEN_MEMBERS": 0x00800000,
"MOVE_MEMBERS": 0x01000000,
"USE_VAD": 0x02000000,
"CHANGE_NICKNAME": 0x04000000,
"MANAGE_NICKNAMES": 0x08000000,
"MANAGE_ROLES": 0x10000000,
"MANAGE_WEBHOOKS": 0x20000000,
"MANAGE_EMOJIS": 0x40000000,
}
1. copied from https://discord.com/developers/docs/topics/permissions#permissions-bitwise-permission-flags 2. replaced GUILD with SERVER
View Source
var TeamRoleBasePermissions = DiscordPermissionSet{
"VIEW_CHANNEL",
"CREATE_INSTANT_INVITE",
"CHANGE_NICKNAME",
"SEND_MESSAGES",
"EMBED_LINKS",
"ATTACH_FILES",
"ADD_REACTIONS",
"USE_EXTERNAL_EMOJIS",
"MENTION_EVERYONE",
"READ_MESSAGE_HISTORY",
"SEND_TTS_MESSAGES",
"CONNECT",
"SPEAK",
"STREAM",
"USE_VAD",
}
Functions ¶
This section is empty.
Types ¶
type Config ¶
func (*Config) DesiredGitHubState ¶
func (cfg *Config) DesiredGitHubState() GitHubState
func (*Config) DesiredMailgunState ¶
func (config *Config) DesiredMailgunState(domain string) *MailgunState
type Discord ¶
type Discord struct {
Role string `yaml:"role,omitempty"`
Color int `yaml:"color,omitempty"`
Priority int `yaml:"priority,omitempty"`
AddedPermissions DiscordPermissionSet `yaml:"added_permissions,omitempty"`
// if set, the role will never be removed. this is primarily to
// grandfather in users who have roles which predated the governance
// automation, i.e. the 'contributors' role.
Sticky bool `yaml:"sticky,omitempty"`
}
type DiscordPermissionSet ¶
type DiscordPermissionSet []string
defaults copied from newly created role; may be worth tuning later
func (DiscordPermissionSet) Permissions ¶
func (set DiscordPermissionSet) Permissions() (int64, error)
type GitHubDeployKey ¶
type GitHubOrgMember ¶
type GitHubRepo ¶
type GitHubRepo struct {
Name string
Description string
IsPrivate bool
Topics []string
HomepageURL string
HasIssues bool
HasWiki bool
HasProjects bool
DirectCollaborators []GitHubRepoCollaborator
BranchProtectionRules []GitHubRepoBranchProtectionRule
DeployKeys []GitHubDeployKey
}
func (GitHubRepo) Collaborator ¶
func (repo GitHubRepo) Collaborator(login string) (GitHubRepoCollaborator, bool)
type GitHubRepoBranchProtectionRule ¶
type GitHubRepoBranchProtectionRule struct {
Pattern string
IsAdminEnforced bool
AllowsDeletions bool
AllowsForcePushes bool
RequiresStatusChecks bool
RequiresStrictStatusChecks bool
RequiredStatusCheckContexts []string
RestrictsPushes bool
RequiresLinearHistory bool
RequiresCommitSignatures bool
RequiresApprovingReviews bool
RequiredApprovingReviewCount int
DismissesStaleReviews bool
RequiresCodeOwnerReviews bool
RestrictsReviewDismissals bool
}
type GitHubRepoCollaborator ¶
type GitHubRepoCollaborator struct {
Login string
Permission RepoPermission
}
type GitHubState ¶
type GitHubState struct {
Organization string
Members []GitHubOrgMember
Teams []GitHubTeam
Repos []GitHubRepo
}
func LoadGitHubState ¶
func LoadGitHubState(orgName string) (*GitHubState, error)
func (*GitHubState) LoadMembers ¶
func (GitHubState) Member ¶
func (state GitHubState) Member(login string) (GitHubOrgMember, bool)
func (GitHubState) Repo ¶
func (state GitHubState) Repo(name string) (GitHubRepo, bool)
func (GitHubState) Team ¶
func (state GitHubState) Team(name string) (GitHubTeam, bool)
type GitHubTeam ¶
type GitHubTeam struct {
ID int
Name string
Description string
Members []GitHubTeamMember
Repos []GitHubTeamRepoAccess
}
func (GitHubTeam) Member ¶
func (team GitHubTeam) Member(login string) (GitHubTeamMember, bool)
func (GitHubTeam) Repo ¶
func (team GitHubTeam) Repo(name string) (GitHubTeamRepoAccess, bool)
type GitHubTeamMember ¶
type GitHubTeamRepoAccess ¶
type GitHubTeamRepoAccess struct {
Name string
Permission RepoPermission
}
type MailgunRoute ¶
type MailgunState ¶
type MailgunState struct {
Routes []MailgunRoute
}
func LoadMailgunState ¶
func LoadMailgunState(domain string) (*MailgunState, error)
type OrgRole ¶
type OrgRole string
const OrgRoleAdmin OrgRole = "ADMIN"
const OrgRoleMember OrgRole = "MEMBER"
type Repo ¶
type Repo struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Private bool `yaml:"private,omitempty"`
Topics []string `yaml:"topics,omitempty"`
HomepageURL string `yaml:"homepage_url,omitempty"`
HasIssues bool `yaml:"has_issues,omitempty"`
HasProjects bool `yaml:"has_projects,omitempty"`
HasWiki bool `yaml:"has_wiki,omitempty"`
HasDiscussions bool `yaml:"has_discussions,omitempty"`
Pages *RepoPages `yaml:"pages,omitempty"`
BranchProtection []RepoBranchProtection `yaml:"branch_protection,omitempty"`
Labels []RepoLabel `yaml:"labels,omitempty"`
DeployKeys []RepoDeployKey `yaml:"deploy_keys"`
}
type RepoBranchProtection ¶
type RepoBranchProtection struct {
Pattern string `yaml:"pattern"`
AllowsDeletions bool `yaml:"allows_deletions,omitempty"`
RequiredChecks []string `yaml:"required_checks,omitempty"`
StrictChecks bool `yaml:"strict_checks,omitempty"`
RequiredReviews int `yaml:"required_reviews,omitempty"`
DismissStaleReviews bool `yaml:"dismiss_stale_reviews,omitempty"`
RequireCodeOwnerReviews bool `yaml:"require_code_owner_reviews,omitempty"`
}
type RepoDeployKey ¶
type RepoPermission ¶
type RepoPermission string
const RepoPermissionAdmin RepoPermission = "ADMIN"
const RepoPermissionMaintain RepoPermission = "MAINTAIN"
const RepoPermissionRead RepoPermission = "READ"
const RepoPermissionTriage RepoPermission = "TRIAGE"
const RepoPermissionWrite RepoPermission = "WRITE"
type Team ¶
type Team struct {
Name string `yaml:"name"`
Purpose string `yaml:"purpose"`
Responsibilities []string `yaml:"responsibilities"`
Discord Discord `yaml:"discord,omitempty"`
AllContributors bool `yaml:"all_contributors"`
RawMembers []string `yaml:"members"`
RequiresEmail bool `yaml:"requires_email,omitempty"`
RawRepoPermission string `yaml:"repo_permission"`
Repos []string `yaml:"repos,omitempty"`
}
func (Team) RepoPermission ¶
func (team Team) RepoPermission() RepoPermission
Click to show internal directories.
Click to hide internal directories.