rest

package
v0.0.0-...-cefcf51 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceTypeREST = "REST"
)

Variables

This section is empty.

Functions

func EncodeFunctionSpec

func EncodeFunctionSpec(spec Template) *types.Struct

func EncodeRouteExtension

func EncodeRouteExtension(spec RouteExtension) *types.Struct

Types

type Parameters

type Parameters struct {
	// headers that will be used to derive the data for processing the output templates
	// if no syntax containing {variables} are detected in the header value,
	// the whole value will be substituted by its name into the template
	// for example:
	/*
		input:
			header_parmeters:
		      x-header-foo: bar
		output:
			body_template: "{\"path\": {{ path }}}"
	*/
	Headers   map[string]string `json:"headers"`
	Path      string            `json:"path,omitempty"`
	Authority string            `json:"authority"`
}

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

func NewPlugin

func NewPlugin() *Plugin

func (*Plugin) GetDependencies

func (p *Plugin) GetDependencies(_ *v1.Config) *plugin.Dependencies

func (*Plugin) HttpFilters

func (p *Plugin) HttpFilters(_ *plugin.FilterPluginParams) []plugin.StagedFilter

func (*Plugin) ProcessRoute

func (p *Plugin) ProcessRoute(pluginParams *plugin.RoutePluginParams, in *v1.Route, out *envoyroute.Route) error

func (*Plugin) ProcessUpstream

func (p *Plugin) ProcessUpstream(params *plugin.UpstreamPluginParams, in *v1.Upstream, out *envoyapi.Cluster) error

type RouteExtension

type RouteExtension struct {
	Parameters       *Parameters `json:"parameters,omitempty"`
	ResponseTemplate *Template   `json:"response_template,omitempty"`
	ResponseParams   *Parameters `json:"response_parameters,omitempty"`
}

this goes on the route extension

func DecodeRouteExtension

func DecodeRouteExtension(generic *types.Struct) (RouteExtension, error)

type Template

type Template struct {
	Path   string            `json:"path"`
	Header map[string]string `json:"headers"`
	// body is a pointer because, if null, pass through original body
	Body *string `json:"body"`
	// if enabled, the request body will be passed through untouched
	PassthroughBody bool `json:"passthrough_body"`
}

this goes on the function spec or on the response transformation

func DecodeFunctionSpec

func DecodeFunctionSpec(generic *types.Struct) (Template, error)

Jump to

Keyboard shortcuts

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