gitregostore

package
v0.0.186 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControlRuleRelationsFileName = "ControlID_RuleName"
)

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 {
	Frameworks                []opapolicy.Framework
	Controls                  []opapolicy.Control
	Rules                     []opapolicy.PolicyRule
	FrameworkControlRelations dataframe.DataFrame
	ControlRuleRelations      dataframe.DataFrame
	DefaultConfigInputs       armotypes.CustomerConfig

	DefaultConfigInputsLock sync.RWMutex
	URL                     string

	BaseUrl                     string
	Owner                       string
	Repository                  string
	Path                        string
	Tag                         string
	Branch                      string
	FrequencyPullFromGitMinutes int
	CurGitVersion               string
	Watch                       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

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) 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) GetOPAControlByID

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

GetOPAControlByID returns specific control by the ID

func (*GitRegoStore) GetOPAControlByName

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

GetOPAControlByName returns specific control 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) 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