capabilities

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package capabilities provides convenient access to OPA capabilities definitions that are embedded within Regal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func List

func List() (map[string][]string, error)

List returns a map with keys being Rego engine types, and values being lists of capabilities versions present in the embedded capabilities database for that version. Versions are sorted descending according to semver (e.g. index 0 is the newest version), with version strings that are not valid semver versions sorting after all valid versions strings but otherwise being compared lexicographically.

func Lookup

func Lookup(ctx context.Context, rawURL string) (*ast.Capabilities, error)

Lookup attempts to retrieve capabilities from the requested RFC3986 compliant URL.

If the URL scheme is 'http', 'https', or 'file' then the specified document will be retrieved and parsed as JSON using ast.LoadCapabilitiesJSON().

If the URL scheme is 'regal', then Lookup will retrieve the capabilities from Regal's embedded capabilities database. The path for the URL is treated according to the following rules:

'regal://capabilities/default' loads the capabilities from ast.CapabilitiesForThisVersion().

'regal://capabilities/{engine}' loads the latest capabilities for the specified engine, sorted according to semver. Versions that are not valid semver strings are sorted lexicographically, but are always sorted after valid semver strings.

'regal://capabilities/{engine}/{version}' loads the requested capabilities version for the specified engine.

func LookupURL

func LookupURL(ctx context.Context, parsedURL *url.URL) (*ast.Capabilities, error)

LookupURL behaves identically to Lookup(), but allows using a pre-parsed URL to avoid a needless round-trip through a string.

Types

This section is empty.

Directories

Path Synopsis
Package embedded handles embedding and access JSON files directly included in Regal from it's source repository
Package embedded handles embedding and access JSON files directly included in Regal from it's source repository

Jump to

Keyboard shortcuts

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