file

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 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 added in v0.3.0

func GetStateFromContent(fileContent *Content) (*state.KongState,
	[]string, 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, 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. TODO return a struct than 4 args

func KongStateToFile

func KongStateToFile(kongState *state.KongState,

	selectTags []string, workspace, filename string) error

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

Types

type CACertificate added in v0.5.0

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

CACertificate represents a Kong CACertificate.

type Certificate added in v0.3.0

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

Certificate represents a Kong Certificate.

type Consumer added in v0.3.0

type Consumer struct {
	kong.Consumer `yaml:",inline,omitempty"`
	Plugins       []*Plugin         `yaml:",omitempty"`
	KeyAuths      []*kong.KeyAuth   `yaml:"keyauth_credentials,omitempty"`
	HMACAuths     []*kong.HMACAuth  `yaml:"hmacauth_credentials,omitempty"`
	JWTAuths      []*kong.JWTAuth   `yaml:"jwt_secrets,omitempty"`
	BasicAuths    []*kong.BasicAuth `yaml:"basicauth_credentials,omitempty"`
	ACLGroups     []*kong.ACLGroup  `yaml:"acls,omitempty"`
}

Consumer represents a consumer in Kong.

type Content added in v0.3.0

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

Content represents a serialized Kong state.

type Info added in v0.3.0

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

Info contains meta-data of the file.

type Plugin added in v0.3.0

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

Plugin represents a plugin in Kong.

type Route added in v0.3.0

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

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

type Service added in v0.3.0

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 added in v0.3.0

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

Target represents a Kong Target.

type Upstream added in v0.3.0

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