Documentation
¶
Overview ¶
Package policies provides the Policy configuration type for kat.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ValidKinds contains the valid kind values for policy configurations. ValidKinds = []string{"Policy"} // DefaultValidator validates policy configuration against the JSON schema. DefaultValidator = yaml.MustNewValidator("/policies.v1beta1.json", policySchemaJSON) )
Functions ¶
func WriteDefault ¶
WriteDefault writes the embedded default policy.yaml to the specified path.
Types ¶
type Policy ¶
type Policy struct {
Projects *ProjectsPolicyConfig `json:"projects,omitempty" jsonschema:"title=Projects"`
v1beta1.TypeMeta `json:",inline"`
}
Policy represents the policy configuration file.
func (*Policy) EnsureDefaults ¶
func (p *Policy) EnsureDefaults()
EnsureDefaults initializes nil fields to their default values.
func (Policy) JSONSchemaExtend ¶
func (p Policy) JSONSchemaExtend(jss *jsonschema.Schema)
func (Policy) MarshalYAML ¶
MarshalYAML serializes the policy to YAML.
func (*Policy) TrustProject ¶
TrustProject adds a project to the trust list and persists it to the policy file. This function preserves comments and structure in the policy file.
type ProjectsPolicyConfig ¶
type ProjectsPolicyConfig struct {
// Trust contains a list of trusted projects.
// Projects in this list will have their configs loaded without prompting.
// NOTE: You can also use `--trust` or `--no-trust` flags to control this behavior.
Trust []*TrustedProject `json:"trust,omitempty" jsonschema:"title=Trust"`
}
ProjectsPolicyConfig controls handling of project-specific configurations (.katrc.yaml files).
func (*ProjectsPolicyConfig) EnsureDefaults ¶
func (c *ProjectsPolicyConfig) EnsureDefaults()
EnsureDefaults initializes nil fields to their default values.
type TrustedProject ¶
type TrustedProject struct {
// Path is the absolute path to a trusted directory.
Path string `json:"path" jsonschema:"title=Path"`
}
TrustedProject represents a trusted project.
Click to show internal directories.
Click to hide internal directories.