Documentation ¶
Index ¶
Constants ¶
View Source
const ( DateLayout = "2006-01-02" CycleOperatorLessThan CycleOperator = "LT" CycleOperatorLessThanOrEqual CycleOperator = "LTE" CycleOperatorEqual CycleOperator = "EQ" PolicyScopeGlobal PolicyScope = "global" PolicyScopeProject PolicyScope = "project" PolicyScopeSoftware PolicyScope = "software" // set a max days for deny/warn policies // to avoid overflow/underflow errors when // calculating dates. 10 years should be // more than enough for most use cases MaxNumDays = 10 * 365 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByPolicyScope ¶
type ByPolicyScope []Policy
func (ByPolicyScope) Len ¶
func (a ByPolicyScope) Len() int
func (ByPolicyScope) Less ¶
func (a ByPolicyScope) Less(i, j int) bool
func (ByPolicyScope) Swap ¶
func (a ByPolicyScope) Swap(i, j int)
type CycleOperator ¶
type CycleOperator string
type Policy ¶
type Policy struct { ID string `json:"ID"` PolicyType types.PolicyType `json:"PolicyType"` // the policy scope can be one of: global, project, software // global: the policy applies to all projects and software // project: the policy applies to all software in a project // software: the policy applies to a specific software PolicyScope PolicyScope `json:"PolicyScope"` // the date which to start warning xeol scans WarnDate string `json:"WarnDate,omitempty"` // the date which to start failing xeol scans DenyDate string `json:"DenyDate,omitempty"` // the days before eol to start warning xeol scans WarnDays *int `json:"WarnDays,omitempty"` // the days before eol to start failing xeol scans DenyDays *int `json:"DenyDays,omitempty"` // the project name to match policy against. Valid when PolicyScope is 'project' ProjectName string `json:"ProjectName,omitempty"` // // the following fields are only used when PolicyScope is 'software' // // the product name to match policy against. ProductName string `json:"ProductName,omitempty"` // the cycle to match policy against. Cycle string `json:"Cycle,omitempty"` // the cycle operator to match policy against. CycleOperator CycleOperator `json:"CycleOperator,omitempty"` }
type PolicyScope ¶
type PolicyScope string
type PolicyWrapper ¶
type PolicyWrapper struct { PolicyType types.PolicyType `json:"PolicyType"` Policies []Policy `json:"Policies"` }
func (PolicyWrapper) Evaluate ¶
func (e PolicyWrapper) Evaluate(matches match.Matches, projectName string, _ string, _ string) (bool, types.PolicyEvaluationResult)
func (PolicyWrapper) GetPolicyType ¶
func (e PolicyWrapper) GetPolicyType() types.PolicyType
Click to show internal directories.
Click to hide internal directories.