{"modulePath":"github.com/jetstack/preflight","version":"v0.1.15","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package packaging\n\n## Functions\n\n```go\nfunc EvalPackage(ctx context.Context, pkg *Package, input interface{}) (*results.ResultCollection, error)\n```\nEvalPackage evaluates the rules in a package given an input.\n\n```go\nfunc TestPackage(ctx context.Context, pkg *Package, verbose bool, timeout time.Duration) (int, int, error)\n```\nTestPackage executes the test for a package\n\n## Types\n\n```go\ntype Package struct {\n\t// PolicyManifest is the manifest data about the policy in struct format.\n\tPolicyManifest *PolicyManifest\n\t// Rego is any rego files, with their names as the keys and their\n\t// content as strings.\n\tRego map[string]string\n\t// RegoTests is any rego test files, with their names as the keys and\n\t// their content as strings.\n\tRegoTests map[string]string\n}\n```\nPackage is a stuct to represent a Preflight package. Packages are loaded from PackageSources.\n\n```go\ntype PolicyManifest struct {\n\t// SchemaVersion is the version of the PolicyManifest schema, and thus the version of the Preflight Package format. It follows semver.\n\tSchemaVersion string `yaml:\"schema-version\"`\n\t// PackageVersion is the version of the package. No format is enforced, but it is recommended to follow semver.\n\tPackageVersion string `yaml:\"package-version\"`\n\t// Namespace is the namespace of the package. We recommend to use FQDNs.\n\tNamespace string `yaml:\"namespace\"`\n\t// ID is the ID of the package itself.\n\tID string `yaml:\"id\"`\n\t// DataGatherers is the list of data-gatherers the package depends on.\n\tDataGatherers []string `yaml:\"data-gatherers,omitempty\"`\n\t// RootQuery is the query needed in the Rego context to access the result of the checks.\n\tRootQuery string `yaml:\"root-query\"`\n\t// Name is the name of the package.\n\tName string `yaml:\"name\"`\n\t// Description is a text describing the package.\n\tDescription string `yaml:\"description,omitempty\"`\n\t// Sections contains the different sections inside the package.\n\tSections []Section `yaml:\"sections,omitempty\"`\n}\n```\nPolicyManifest contains all the information about the policy manifest of the package.\n\n```go\nfunc (m *PolicyManifest) GlobalID() string\n```\nGlobalID returns a global unique ID that contains the namespace and the ID.\n\n```go\nfunc (m *PolicyManifest) RuleIDs() []string\n```\nRuleIDs returns a list of the IDs of all the rules in this policy manifest\n\n```go\nfunc (m *PolicyManifest) SupportsPreflightPrefix() (bool, error)\n```\nSupportsPreflightPrefix returns true if the SchemaVersion used supports rego rules with \\`preflight\\_\\` prefix over the IDs in the policy manifest. That behaviour was deprecated.\n\n```go\ntype Rule struct {\n\t// ID is the id of the rule.\n\tID string `yaml:\"id\"`\n\t// Name is a shortname for the rule.\n\tName string `yaml:\"name\"`\n\t// Description is a text describing what the rule is about.\n\tDescription string `yaml:\"description,omitempty\"`\n\t// Manual indicated whether the rule can be evaluated automatically by Preflight or requires manual intervention.\n\tManual bool `yaml:\"manual,omitempty\"`\n\t// Remediation is a text describing how to fix a failure of the rule.\n\tRemediation string `yaml:\"remediation,omitempty\"`\n\t// Links contains useful links related to the rule.\n\tLinks []string `yaml:\"links,omitempty\"`\n}\n```\nRule holds the information for a rule.\n\n```go\ntype Section struct {\n\t// ID is the ID of the section.\n\tID string `yaml:\"id\"`\n\t// Name is the name of the section.\n\tName string `yaml:\"name\"`\n\t// Description is the description of the section.\n\tDescription string `yaml:\"description,omitempty\"`\n\t// Rules contain all the rules in the section.\n\tRules []Rule `yaml:\"rules,omitempty\"`\n}\n```\nSection holds the information for a section of the policy manifest.\n\n","path":"github.com/jetstack/preflight/pkg/packaging","name":"packaging","synopsis":"","isRedistributable":true}
