file

package
v1.3.13 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Code generated by go generate; DO NOT EDIT.

Index

Constants

View Source
const (
	// JSON is JSON file format.
	JSON = "JSON"
	// YAML if YAML file format.
	YAML = "YAML"
)

Variables

This section is empty.

Functions

func Get

func Get(fileContent *Content,
	opt RenderConfig) (*utils.OpaRawState, error)

Get process the fileContent and renders a RawState. IDs of entities are matches based on currentState.

func OpaStateToFile

func OpaStateToFile(OpaState *state.OpaState, config WriteConfig) error

OpaStateToFile writes a state object to file with filename. It will omit timestamps and IDs while writing.

Types

type Content

type Content struct {
	FormatVersion string    `json:"_format_version,omitempty" yaml:"_format_version,omitempty"`
	Policies      []FPolicy `json:"policies,omitempty" yaml:",omitempty"`
}

Content represents a serialized opa state.

func GetContentFromFile

func GetContentFromFile(filename string) (*Content, error)

GetContentFromFile reads in a file with filename and constructs a state. If filename is `-`, then it will read from os.Stdin. If filename represents a directory, it will traverse the tree rooted at filename, read all the files with .yaml, .yml and .json extensions and generate a content after a merge of the content from all the files.

It will return an error if the file representation is invalid or if there is any error during processing.

type FPolicy

type FPolicy struct {
	opa.Policy
}

FPolicy represents a opa Service and it's associated routes and plugins.

func (FPolicy) MarshalJSON

func (s FPolicy) MarshalJSON() ([]byte, error)

MarshalJSON is a custom marshal method to handle foreign references.

func (FPolicy) MarshalYAML

func (s FPolicy) MarshalYAML() (interface{}, error)

MarshalYAML is a custom marshal to handle SNI.

func (*FPolicy) UnmarshalJSON

func (s *FPolicy) UnmarshalJSON(b []byte) error

UnmarshalJSON is a custom marshal method to handle foreign references.

func (*FPolicy) UnmarshalYAML

func (s *FPolicy) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is a custom marshal method to handle foreign references.

type Format

type Format string

Format is a file format for opa's configuration.

type RenderConfig

type RenderConfig struct {
	CurrentState *state.OpaState
	OpaVersion   semver.Version
}

RenderConfig contains necessary information to render a correct OpaConfig from a file.

type WriteConfig

type WriteConfig struct {
	Filename   string
	FileFormat Format
}

WriteConfig holds settings to use to write the state file.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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