Documentation ¶
Overview ¶
Package properties provides utility functions for fetching and managing properties
Package properties provides utility functions for fetching and managing properties ¶
Package properties provides utility functions for fetching and managing properties
Index ¶
- Constants
- func ArtifactV1FromProperties(props *properties.Properties) (*minderv1.Artifact, error)
- func GitHubRepoToMap(repo *go_github.Repository) map[string]any
- func PullRequestV1FromProperties(props *properties.Properties) (*minderv1.PullRequest, error)
- func RepoV1FromProperties(repoProperties *properties.Properties) (*minderv1.Repository, error)
- type ArtifactFetcher
- type GhPropertyFetcher
- type GhPropertyFetcherFactory
- type GhPropertyWrapper
- type PullRequestFetcher
- func (pfb PullRequestFetcher) AllPropertyWrappers() []GhPropertyWrapper
- func (_ *PullRequestFetcher) GetName(props *properties.Properties) (string, error)
- func (pfb PullRequestFetcher) OperationalProperties() []string
- func (pfb PullRequestFetcher) WrapperForProperty(propertyKey string) GhPropertyWrapper
- type RepositoryFetcher
- func (pfb RepositoryFetcher) AllPropertyWrappers() []GhPropertyWrapper
- func (_ *RepositoryFetcher) GetName(props *properties.Properties) (string, error)
- func (pfb RepositoryFetcher) OperationalProperties() []string
- func (pfb RepositoryFetcher) WrapperForProperty(propertyKey string) GhPropertyWrapper
Constants ¶
const ( // ArtifactPropertyOwner is the owner of the artifact ArtifactPropertyOwner = "github/owner" // ArtifactPropertyName is the name of the artifact ArtifactPropertyName = "github/name" // ArtifactPropertyCreatedAt is the time the artifact was created ArtifactPropertyCreatedAt = "github/created_at" // ArtifactPropertyRepoOwner is the owner of the repository the artifact is in ArtifactPropertyRepoOwner = "github/repo_owner" // ArtifactPropertyRepoName is the name of the repository the artifact is in ArtifactPropertyRepoName = "github/repo_name" // ArtifactPropertyRepo is the full name of the repository the artifact is in ArtifactPropertyRepo = "github/repo" // ArtifactPropertyType is the type of the artifact ArtifactPropertyType = "github/type" // ArtifactPropertyVisibility is the visibility of the artifact ArtifactPropertyVisibility = "github/visibility" )
const ( // PullPropertyURL is the URL of the pull request PullPropertyURL = "github/pull_url" // PullPropertyNumber is the number of the pull request PullPropertyNumber = "github/pull_number" // PullPropertySha is the sha of the pull request PullPropertySha = "github/pull_sha" // PullPropertyRepoOwner is the owner of the repository PullPropertyRepoOwner = "github/repo_owner" // PullPropertyRepoName is the name of the repository PullPropertyRepoName = "github/repo_name" // PullPropertyAuthorID is the ID of the author of the pull request PullPropertyAuthorID = "github/pull_author_id" // PullPropertyAuthorLogin is the login of the author of the pull request PullPropertyAuthorLogin = "github/pull_author_login" // PullPropertyAction is an operational property that represents the action that was taken on the pull request PullPropertyAction = "github/pull_action" // PullPropertyBaseCloneURL is the URL used to clone the repository PullPropertyBaseCloneURL = "github/clone_url" // PullPropertyTargetCloneURL is the URL used to clone the target repository PullPropertyTargetCloneURL = "github/target_url" // PullPropertyBaseRef is the base ref of the pull request PullPropertyBaseRef = "github/base_ref" // PullPropertyTargetRef is the target ref of the pull request PullPropertyTargetRef = "github/pull_ref" )
const ( // RepoPropertyId represents the github repository ID (numerical) RepoPropertyId = "github/repo_id" // RepoPropertyName represents the github repository name RepoPropertyName = "github/repo_name" // RepoPropertyOwner represents the github repository owner RepoPropertyOwner = "github/repo_owner" // RepoPropertyDeployURL represents the github repository deployment URL RepoPropertyDeployURL = "github/deploy_url" // RepoPropertyCloneURL represents the github repository clone URL RepoPropertyCloneURL = "github/clone_url" // RepoPropertyDefaultBranch represents the github repository default branch RepoPropertyDefaultBranch = "github/default_branch" // RepoPropertyLicense represents the github repository license RepoPropertyLicense = "github/license" // RepoPropertyPrimaryLanguage represents the github repository language RepoPropertyPrimaryLanguage = "github/primary_language" // RepoPropertyHookId represents the github repository hook ID RepoPropertyHookId = "github/hook_id" // RepoPropertyHookUrl represents the github repository hook URL RepoPropertyHookUrl = "github/hook_url" // RepoPropertyHookName represents the github repository hook name RepoPropertyHookName = "github/hook_name" // RepoPropertyHookType represents the github repository hook type RepoPropertyHookType = "github/hook_type" // RepoPropertyHookUiid represents the github repository hook UIID RepoPropertyHookUiid = "github/hook_uiid" )
Variables ¶
This section is empty.
Functions ¶
func ArtifactV1FromProperties ¶
func ArtifactV1FromProperties(props *properties.Properties) (*minderv1.Artifact, error)
ArtifactV1FromProperties creates a minder v1 artifact from properties
func GitHubRepoToMap ¶
func GitHubRepoToMap(repo *go_github.Repository) map[string]any
GitHubRepoToMap converts a github repository to a map
func PullRequestV1FromProperties ¶
func PullRequestV1FromProperties(props *properties.Properties) (*minderv1.PullRequest, error)
PullRequestV1FromProperties creates a PullRequestV1 from a properties object
func RepoV1FromProperties ¶
func RepoV1FromProperties(repoProperties *properties.Properties) (*minderv1.Repository, error)
RepoV1FromProperties creates a minderv1.Repository from a properties.Properties
Types ¶
type ArtifactFetcher ¶
type ArtifactFetcher struct {
// contains filtered or unexported fields
}
ArtifactFetcher fetches artifact properties
func NewArtifactFetcher ¶
func NewArtifactFetcher() *ArtifactFetcher
NewArtifactFetcher creates a new ArtifactFetcher
func (ArtifactFetcher) AllPropertyWrappers ¶
func (pfb ArtifactFetcher) AllPropertyWrappers() []GhPropertyWrapper
AllPropertyWrappers returns all property wrappers for the repository
func (*ArtifactFetcher) GetName ¶
func (_ *ArtifactFetcher) GetName(props *properties.Properties) (string, error)
GetName returns the name of the artifact
func (ArtifactFetcher) OperationalProperties ¶
func (pfb ArtifactFetcher) OperationalProperties() []string
OperationalProperties returns the operational properties for the repository
func (ArtifactFetcher) WrapperForProperty ¶
func (pfb ArtifactFetcher) WrapperForProperty(propertyKey string) GhPropertyWrapper
WrapperForProperty returns the property wrapper for the given property key
type GhPropertyFetcher ¶
type GhPropertyFetcher interface { GetName(props *properties.Properties) (string, error) // contains filtered or unexported methods }
GhPropertyFetcher is an interface for fetching properties from the GitHub API
type GhPropertyFetcherFactory ¶
type GhPropertyFetcherFactory interface {
EntityPropertyFetcher(entType minderv1.Entity) GhPropertyFetcher
}
GhPropertyFetcherFactory is an interface for creating GhPropertyFetcher instances
func NewPropertyFetcherFactory ¶
func NewPropertyFetcherFactory() GhPropertyFetcherFactory
NewPropertyFetcherFactory creates a new GhPropertyFetcherFactory
type GhPropertyWrapper ¶
type GhPropertyWrapper func( ctx context.Context, ghCli *go_github.Client, isOrg bool, lookupProperties *properties.Properties, ) (map[string]any, error)
GhPropertyWrapper is a function that fetches a property from the GitHub API
type PullRequestFetcher ¶
type PullRequestFetcher struct {
// contains filtered or unexported fields
}
PullRequestFetcher is a property fetcher for github repositories
func NewPullRequestFetcher ¶
func NewPullRequestFetcher() *PullRequestFetcher
NewPullRequestFetcher creates a new PullRequestFetcher
func (PullRequestFetcher) AllPropertyWrappers ¶
func (pfb PullRequestFetcher) AllPropertyWrappers() []GhPropertyWrapper
AllPropertyWrappers returns all property wrappers for the repository
func (*PullRequestFetcher) GetName ¶
func (_ *PullRequestFetcher) GetName(props *properties.Properties) (string, error)
GetName returns the name of the pull request
func (PullRequestFetcher) OperationalProperties ¶
func (pfb PullRequestFetcher) OperationalProperties() []string
OperationalProperties returns the operational properties for the repository
func (PullRequestFetcher) WrapperForProperty ¶
func (pfb PullRequestFetcher) WrapperForProperty(propertyKey string) GhPropertyWrapper
WrapperForProperty returns the property wrapper for the given property key
type RepositoryFetcher ¶
type RepositoryFetcher struct {
// contains filtered or unexported fields
}
RepositoryFetcher is a property fetcher for github repositories
func NewRepositoryFetcher ¶
func NewRepositoryFetcher() *RepositoryFetcher
NewRepositoryFetcher creates a new RepositoryFetcher
func (RepositoryFetcher) AllPropertyWrappers ¶
func (pfb RepositoryFetcher) AllPropertyWrappers() []GhPropertyWrapper
AllPropertyWrappers returns all property wrappers for the repository
func (*RepositoryFetcher) GetName ¶
func (_ *RepositoryFetcher) GetName(props *properties.Properties) (string, error)
GetName returns the name of the repository
func (RepositoryFetcher) OperationalProperties ¶
func (pfb RepositoryFetcher) OperationalProperties() []string
OperationalProperties returns the operational properties for the repository
func (RepositoryFetcher) WrapperForProperty ¶
func (pfb RepositoryFetcher) WrapperForProperty(propertyKey string) GhPropertyWrapper
WrapperForProperty returns the property wrapper for the given property key