file

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStateFromContent

func GetStateFromContent(fileContent *Content) (*state.KongState,
	[]string, error)

GetStateFromContent takes the serialized state and returns a Kong. It will return an error if the file representation is invalid or if there is any error during processing. All entities without an ID will get a `placeholder-{iota}` ID assigned to them.

func GetStateFromFile

func GetStateFromFile(filename string) (*state.KongState, []string, error)

GetStateFromFile 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 and .yml extensions and generate a state 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. All entities without an ID will get a `placeholder-{iota}` ID assigned to them.

func KongStateToFile

func KongStateToFile(kongState *state.KongState,
	selectTags []string, filename string) error

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

Types

type Certificate

type Certificate struct {
	kong.Certificate `yaml:",inline,omitempty"`
}

Certificate represents a Kong Certificate.

type Consumer

type Consumer struct {
	kong.Consumer `yaml:",inline,omitempty"`
	Plugins       []*Plugin `yaml:",omitempty"`
}

Consumer represents a consumer in Kong.

type Content

type Content struct {
	FormatVersion string        `yaml:"_format_version,omitempty"`
	Info          Info          `yaml:"_info,omitempty"`
	Services      []Service     `yaml:",omitempty"`
	Upstreams     []Upstream    `yaml:",omitempty"`
	Certificates  []Certificate `yaml:",omitempty"`
	Plugins       []Plugin      `yaml:",omitempty"`
	Consumers     []Consumer    `yaml:",omitempty"`
}

Content represents a serialized Kong state.

type Info

type Info struct {
	SelectorTags []string `yaml:"select_tags,omitempty"`
}

Info contains meta-data of the file.

type Plugin

type Plugin struct {
	kong.Plugin `yaml:",inline,omitempty"`
}

Plugin represents a plugin in Kong.

type Route

type Route struct {
	kong.Route `yaml:",inline,omitempty"`
	Plugins    []*Plugin `yaml:",omitempty"`
}

Route represents a Kong Route and it's associated plugins.

type Service

type Service struct {
	kong.Service `yaml:",inline,omitempty"`
	Routes       []*Route  `yaml:",omitempty"`
	Plugins      []*Plugin `yaml:",omitempty"`
}

Service represents a Kong Service and it's associated routes and plugins.

type Target

type Target struct {
	kong.Target `yaml:",inline,omitempty"`
}

Target represents a Kong Target.

type Upstream

type Upstream struct {
	kong.Upstream `yaml:",inline,omitempty"`
	Targets       []*Target `yaml:",omitempty"`
}

Upstream represents a Kong Upstream and it's associated targets.

Jump to

Keyboard shortcuts

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