Documentation
¶
Overview ¶
Package secretaccess holds the helpers shared by the ActionsSecretAccess and DependabotSecretAccess controllers.
Index ¶
- Constants
- func ListRepoIDs(ctx context.Context, l RepoLister, org, name string) (map[string]int64, error)
- func ListRepoNames(ctx context.Context, l RepoLister, org, name string) ([]string, error)
- func RenamedRepoError(known map[string]int64, added []string, addedIDs []int64) error
- func RepoNames(refs []v1alpha1.SecretSelectedRepo) []string
- func RepoObservations(names []string) []v1alpha1.SecretSelectedRepoObservation
- func SameRepos(spec []v1alpha1.SecretSelectedRepo, ghNames []string) bool
- func SecretNotFound(name string) xpv2.Condition
- func SecretNotFoundError(name string) error
- func VisibilityMismatch(ghVisibility, specVisibility string) xpv2.Condition
- type RepoLister
Constants ¶
const VisibilitySelected = "selected"
VisibilitySelected is the visibility under which a secret has a repository list.
Variables ¶
This section is empty.
Functions ¶
func ListRepoIDs ¶
ListRepoIDs returns the ID of every repository that can use the secret on GitHub, keyed by lowercased name: GitHub repository names are case-insensitive, so callers must look names up lowercased.
func ListRepoNames ¶
ListRepoNames returns the names of all repositories that can use the secret on GitHub, spelled as GitHub reports them.
func RenamedRepoError ¶
RenamedRepoError returns an error if a declared name absent from the list (added) resolved to an ID the list (known, from ListRepoIDs) already holds under another name. That repository was renamed on GitHub and the spec still uses the old name: writing would change nothing and repeat every poll, so fail loud instead. addedIDs are the IDs of added, in the same order.
func RepoNames ¶
func RepoNames(refs []v1alpha1.SecretSelectedRepo) []string
RepoNames returns the distinct repository names declared in spec, in spec order, keeping the first spelling of names that differ only in case. The declared list is a set: a duplicate must not read as drift or be sent to GitHub twice, or the provider rewrites the list every poll.
func RepoObservations ¶
func RepoObservations(names []string) []v1alpha1.SecretSelectedRepoObservation
RepoObservations returns names as observed repositories, sorted.
func SameRepos ¶
func SameRepos(spec []v1alpha1.SecretSelectedRepo, ghNames []string) bool
SameRepos reports whether the spec and GitHub list the same repositories, in any order and ignoring case. GitHub repository names are case-insensitive, so a case difference must not read as drift or Update rewrites the list every poll.
func SecretNotFound ¶
SecretNotFound is the Ready condition for a secret missing on GitHub.
func SecretNotFoundError ¶
SecretNotFoundError is the Create error: the secret must exist on GitHub first.
func VisibilityMismatch ¶
VisibilityMismatch is the Ready condition for a visibility the provider cannot change.
Types ¶
type RepoLister ¶
type RepoLister interface {
ListSelectedReposForOrgSecret(ctx context.Context, org, name string, opts *github.ListOptions) (*github.SelectedReposList, *github.Response, error)
}
RepoLister lists the repositories that can use an organization secret.