gitregostore

package
v0.0.231 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControlRuleRelationsFileName = "ControlID_RuleName.csv"
)

Variables

This section is empty.

Functions

func HTTPRespToString

func HTTPRespToString(resp *http.Response) (string, error)

HTTPRespToString parses the body as string and checks the HTTP status code, it closes the body reader at the end TODO: FIX BUG: status code is not being checked when the body is empty

func HttpGetter

func HttpGetter(httpClient *http.Client, fullURL string) (string, error)

func JSONDecoder

func JSONDecoder(origin string) *json.Decoder

JSONDecoder returns JSON decoder for given string

Types

type GitRegoStore

type GitRegoStore struct {
	DefaultConfigInputsLock sync.RWMutex

	ControlRuleRelations      dataframe.DataFrame
	FrameworkControlRelations dataframe.DataFrame

	Tag                            string
	Owner                          string
	CurGitVersion                  string
	Branch                         string
	URL                            string
	Path                           string
	BaseUrl                        string
	Repository                     string
	DefaultConfigInputs            armotypes.CustomerConfig
	AttackTracks                   []v1alpha1.AttackTrack
	Frameworks                     []opapolicy.Framework
	Controls                       []opapolicy.Control
	Rules                          []opapolicy.PolicyRule
	SystemPostureExceptionPolicies []armotypes.PostureExceptionPolicy
	FrequencyPullFromGitMinutes    int
	Watch                          bool
	StripFilesExtension            bool
	// contains filtered or unexported fields
}

func InitDefaultGitRegoStore

func InitDefaultGitRegoStore(frequency int) *GitRegoStore

Deprecated

func InitGitRegoStore

func InitGitRegoStore(baseUrl string, owner string, repository string, path string, tag string, branch string, frequency int) *GitRegoStore

Deprecated if frequency < 0 will pull only once

func NewDefaultGitRegoStore

func NewDefaultGitRegoStore(frequency int) *GitRegoStore

NewDefaultGitRegoStore - generates git store object for production regolibrary release files. Release files source: "https://github.com/kubescape/regolibrary/releases/latest/download"

func NewDevGitRegoStore added in v0.0.206

func NewDevGitRegoStore(frequency int) *GitRegoStore

NewDevGitRegoStore - generates git store object for dev regolibrary release files Release files source: "https://raw.githubusercontent.com/kubescape/regolibrary/dev/releaseDev"

func NewGitRegoStore

func NewGitRegoStore(baseUrl string, owner string, repository string, path string, tag string, branch string, frequency int) *GitRegoStore

NewGitRegoStore return gitregostore obj with basic fields, before pulling from git

func (*GitRegoStore) GetAttackTracks added in v0.0.187

func (gs *GitRegoStore) GetAttackTracks() ([]v1alpha1.AttackTrack, error)

func (*GitRegoStore) GetDefaultConfigInputs

func (gs *GitRegoStore) GetDefaultConfigInputs() (armotypes.CustomerConfig, error)

func (*GitRegoStore) GetOPAControl

func (gs *GitRegoStore) GetOPAControl(c string) (*opapolicy.Control, error)

GetOPAControl returns specific control by the name or ID

func (*GitRegoStore) GetOPAControlByFrameworkNameAndControlName added in v0.0.221

func (gs *GitRegoStore) GetOPAControlByFrameworkNameAndControlName(frameworkName string, controlName string) (*opapolicy.Control, error)

GetOPAControlByFrameworkNameAndControlName - get framework name and control name and return the relevant control object

func (*GitRegoStore) GetOPAControlByID

func (gs *GitRegoStore) GetOPAControlByID(controlID string) (*opapolicy.Control, error)

GetOPAControlByID returns specific BaseControl by the ID

func (*GitRegoStore) GetOPAControlByName

func (gs *GitRegoStore) GetOPAControlByName(controlName string) (*opapolicy.Control, error)

DEPECATED GetOPAControlByName returns specific BaseControl by the name

func (*GitRegoStore) GetOPAControls

func (gs *GitRegoStore) GetOPAControls() ([]opapolicy.Control, error)

GetOPAControls returns all the controls of given customer

func (*GitRegoStore) GetOPAControlsIDsList

func (gs *GitRegoStore) GetOPAControlsIDsList() ([]string, error)

func (*GitRegoStore) GetOPAControlsNamesList

func (gs *GitRegoStore) GetOPAControlsNamesList() ([]string, error)

func (*GitRegoStore) GetOPAFrameworkByName

func (gs *GitRegoStore) GetOPAFrameworkByName(frameworkName string) (*opapolicy.Framework, error)

GetOPAFrameworkByName returns specific framework by the name

func (*GitRegoStore) GetOPAFrameworks

func (gs *GitRegoStore) GetOPAFrameworks() ([]opapolicy.Framework, error)

GetOPAFrameworks returns all the frameworks of given customer

func (*GitRegoStore) GetOPAFrameworksNamesList

func (gs *GitRegoStore) GetOPAFrameworksNamesList() ([]string, error)

func (*GitRegoStore) GetOPAPolicies

func (gs *GitRegoStore) GetOPAPolicies() ([]opapolicy.PolicyRule, error)

GetOPAPolicies returns all the policies of given customer

func (*GitRegoStore) GetOPAPoliciesNamesList

func (gs *GitRegoStore) GetOPAPoliciesNamesList() ([]string, error)

func (*GitRegoStore) GetOPAPolicyByName

func (gs *GitRegoStore) GetOPAPolicyByName(ruleName string) (*opapolicy.PolicyRule, error)

GetOPAPolicyByName returns specific policy by the name

func (*GitRegoStore) GetOpaFrameworkListByControlID

func (gs *GitRegoStore) GetOpaFrameworkListByControlID(controlID string) []string

GetOpaFrameworkListByControlID return a list of fw names this control is in

func (*GitRegoStore) GetOpaFrameworkListByControlName

func (gs *GitRegoStore) GetOpaFrameworkListByControlName(controlName string) []string

GetOpaFrameworkListByControlName return a list of fw names this control is in

func (*GitRegoStore) GetSystemPostureExceptionPolicies added in v0.0.195

func (gs *GitRegoStore) GetSystemPostureExceptionPolicies() ([]armotypes.PostureExceptionPolicy, error)

func (*GitRegoStore) SetRegoObjects

func (gs *GitRegoStore) SetRegoObjects() error

SetRegoObjects pulls opa obj from git and stores in gitregostore

type InnerTree

type InnerTree []struct {
	PATH string `json:"path"`
}

type Tree

type Tree struct {
	TREE InnerTree `json:"tree"`
}

Jump to

Keyboard shortcuts

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