utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanConditions

func CleanConditions(conditions *data.Conditions) *data.Conditions

func CleanSlice

func CleanSlice(slice []string) []string

func Contains

func Contains(slice []string, item string) bool

func CreateRepoRulesetsData

func CreateRepoRulesetsData(owner string, fileData [][]string) []data.RepoRuleset

func GetAuthToken

func GetAuthToken(token, hostname string) string

func GetValidFields

func GetValidFields(ruleType string) map[string]map[string]struct{}

getValidFields returns the valid fields for a given rule type.

func InitializeClients

func InitializeClients(hostname, authToken string) (api.RESTClient, api.GQLClient, error)

func MapToParameters

func MapToParameters(paramsMap map[string]interface{}, ruleType string) *data.Parameters

func ParametersToMap

func ParametersToMap(params data.Parameters, ruleType string) map[string]string

func ProcessActors

func ProcessActors(actors []data.BypassActor) []string

func ProcessProperties

func ProcessProperties(properties []data.PropertyPattern) []string

func ProcessRules

func ProcessRules(rules []data.Rules) map[string]string

func ShouldRemoveProperty

func ShouldRemoveProperty(propName *data.PropertyPatterns) bool

func ShouldRemoveRefName

func ShouldRemoveRefName(refName *data.RefPatterns) bool

func ShouldRemoveRepositoryName

func ShouldRemoveRepositoryName(repoName *data.NamePatterns) bool

func UpdateTag

func UpdateTag(field reflect.StructField, key, value string) reflect.StructField

Types

type APIGetter

type APIGetter struct {
	// contains filtered or unexported fields
}

func NewAPIGetter

func NewAPIGetter(gqlClient api.GQLClient, restClient api.RESTClient) *APIGetter

func (*APIGetter) CreateOrgLevelRuleset

func (g *APIGetter) CreateOrgLevelRuleset(owner string, data io.Reader) error

func (*APIGetter) CreateRepoLevelRuleset

func (g *APIGetter) CreateRepoLevelRuleset(ownerRepo string, data io.Reader) error

func (*APIGetter) GetOrgLevelRuleset

func (g *APIGetter) GetOrgLevelRuleset(owner string, rulesetId int) ([]byte, error)

func (*APIGetter) GetOrgRulesetsList

func (g *APIGetter) GetOrgRulesetsList(owner string, endCursor *string) (*data.OrgRulesetsQuery, error)

func (*APIGetter) GetRepo

func (g *APIGetter) GetRepo(owner string, name string) (*data.RepoSingleQuery, error)

func (*APIGetter) GetRepoLevelRuleset

func (g *APIGetter) GetRepoLevelRuleset(owner string, repo string, rulesetId int) ([]byte, error)

func (*APIGetter) GetRepoRulesetsList

func (g *APIGetter) GetRepoRulesetsList(owner string, repo string, endCursor *string) (*data.RepoRulesetsQuery, error)

func (*APIGetter) GetReposList

func (g *APIGetter) GetReposList(owner string, endCursor *string) (*data.ReposQuery, error)

type Getter

type Getter interface {
	GetRepo(owner string, name string) ([]data.RepoSingleQuery, error)
	GetReposList(owner string, endCursor *string) ([]data.ReposQuery, error)
	GetOrgRulesetsList(owner string, endCursor *string) (*data.OrgRulesetsQuery, error)
	GetOrgLevelRuleset(owner string, rulesetId int) ([]byte, error)
	GetRepoRulesetsList(owner string, endCursor *string) (*data.RepoRulesetsQuery, error)
	GetRepoLevelRuleset(owner string, repo string, rulesetId int) ([]byte, error)
	CreateOrgLevelRuleset(owner string, data io.Reader) error
}

Jump to

Keyboard shortcuts

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