transformation

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package transformation is a generated protocol buffer package.

It is generated from these files:

transformation_filter.proto

It has these top-level messages:

Transformations
Transformation
RouteTransformations
Extraction
TransformationTemplate
InjaTemplate
Passthrough
MergeExtractorsToBody
HeaderBodyTransform

Index

Constants

View Source
const (
	ServiceTypeTransformation = "HTTP-Functions"
)

Variables

This section is empty.

Functions

func EncodeFunctionSpec

func EncodeFunctionSpec(spec Template) *types.Struct

func EncodeRouteExtension

func EncodeRouteExtension(spec RouteExtension) *types.Struct

Types

type Extraction

type Extraction struct {
	Header string `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// what information to extract. if extraction fails the result is
	// an empty value.
	Regex    string `protobuf:"bytes,2,opt,name=regex,proto3" json:"regex,omitempty"`
	Subgroup uint32 `protobuf:"varint,3,opt,name=subgroup,proto3" json:"subgroup,omitempty"`
}

func (*Extraction) Descriptor

func (*Extraction) Descriptor() ([]byte, []int)

func (*Extraction) GetHeader

func (m *Extraction) GetHeader() string

func (*Extraction) GetRegex

func (m *Extraction) GetRegex() string

func (*Extraction) GetSubgroup

func (m *Extraction) GetSubgroup() uint32

func (*Extraction) ProtoMessage

func (*Extraction) ProtoMessage()

func (*Extraction) Reset

func (m *Extraction) Reset()

func (*Extraction) String

func (m *Extraction) String() string

type GetTransformationFunction

type GetTransformationFunction func(destination *v1.Destination_Function) (*TransformationTemplate, error)

type HeaderBodyTransform

type HeaderBodyTransform struct {
}

func (*HeaderBodyTransform) Descriptor

func (*HeaderBodyTransform) Descriptor() ([]byte, []int)

func (*HeaderBodyTransform) ProtoMessage

func (*HeaderBodyTransform) ProtoMessage()

func (*HeaderBodyTransform) Reset

func (m *HeaderBodyTransform) Reset()

func (*HeaderBodyTransform) String

func (m *HeaderBodyTransform) String() string

type InjaTemplate

type InjaTemplate struct {
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
}

custom functions: header_value(name) -> from the original headers extracted_value(name, index) -> from the extracted values

func (*InjaTemplate) Descriptor

func (*InjaTemplate) Descriptor() ([]byte, []int)

func (*InjaTemplate) GetText

func (m *InjaTemplate) GetText() string

func (*InjaTemplate) ProtoMessage

func (*InjaTemplate) ProtoMessage()

func (*InjaTemplate) Reset

func (m *InjaTemplate) Reset()

func (*InjaTemplate) String

func (m *InjaTemplate) String() string

type MergeExtractorsToBody

type MergeExtractorsToBody struct {
}

func (*MergeExtractorsToBody) Descriptor

func (*MergeExtractorsToBody) Descriptor() ([]byte, []int)

func (*MergeExtractorsToBody) ProtoMessage

func (*MergeExtractorsToBody) ProtoMessage()

func (*MergeExtractorsToBody) Reset

func (m *MergeExtractorsToBody) Reset()

func (*MergeExtractorsToBody) String

func (m *MergeExtractorsToBody) String() string

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,omitempty"`
	Path      *string           `json:"path,omitempty"`
	Authority *string           `json:"authority,omitempty"`
}

type Passthrough

type Passthrough struct {
}

func (*Passthrough) Descriptor

func (*Passthrough) Descriptor() ([]byte, []int)

func (*Passthrough) ProtoMessage

func (*Passthrough) ProtoMessage()

func (*Passthrough) Reset

func (m *Passthrough) Reset()

func (*Passthrough) String

func (m *Passthrough) String() string

type Plugin

type Plugin interface {
	ActivateFilterForCluster(out *envoyapi.Cluster)
	AddRequestTransformationsToRoute(getTemplate GetTransformationFunction, in *v1.Route, out *envoyroute.Route) error
	AddResponseTransformationsToRoute(in *v1.Route, out *envoyroute.Route) error
	GetTransformationFilter() *plugins.StagedHttpFilter
}

func NewTransformationPlugin

func NewTransformationPlugin() Plugin

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 RouteTransformations

type RouteTransformations struct {
	RequestTransformation  *Transformation `protobuf:"bytes,1,opt,name=request_transformation,json=requestTransformation" json:"request_transformation,omitempty"`
	ResponseTransformation *Transformation `protobuf:"bytes,2,opt,name=response_transformation,json=responseTransformation" json:"response_transformation,omitempty"`
}

func (*RouteTransformations) Descriptor

func (*RouteTransformations) Descriptor() ([]byte, []int)

func (*RouteTransformations) GetRequestTransformation

func (m *RouteTransformations) GetRequestTransformation() *Transformation

func (*RouteTransformations) GetResponseTransformation

func (m *RouteTransformations) GetResponseTransformation() *Transformation

func (*RouteTransformations) ProtoMessage

func (*RouteTransformations) ProtoMessage()

func (*RouteTransformations) Reset

func (m *RouteTransformations) Reset()

func (*RouteTransformations) String

func (m *RouteTransformations) String() string

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)

type Transformation

type Transformation struct {
	// Template is in the transformed request language domain
	// currently both are JSON
	//
	// Types that are valid to be assigned to TransformationType:
	//	*Transformation_TransformationTemplate
	//	*Transformation_HeaderBodyTransform
	TransformationType isTransformation_TransformationType `protobuf_oneof:"transformation_type"`
}

[#proto-status: experimental]

func (*Transformation) Descriptor

func (*Transformation) Descriptor() ([]byte, []int)

func (*Transformation) GetHeaderBodyTransform

func (m *Transformation) GetHeaderBodyTransform() *HeaderBodyTransform

func (*Transformation) GetTransformationTemplate

func (m *Transformation) GetTransformationTemplate() *TransformationTemplate

func (*Transformation) GetTransformationType

func (m *Transformation) GetTransformationType() isTransformation_TransformationType

func (*Transformation) ProtoMessage

func (*Transformation) ProtoMessage()

func (*Transformation) Reset

func (m *Transformation) Reset()

func (*Transformation) String

func (m *Transformation) String() string

func (*Transformation) XXX_OneofFuncs

func (*Transformation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type TransformationTemplate

type TransformationTemplate struct {
	AdvancedTemplates bool `protobuf:"varint,1,opt,name=advanced_templates,json=advancedTemplates,proto3" json:"advanced_templates,omitempty"`
	// Extractors are in the origin request language domain
	Extractors map[string]*Extraction   `` /* 147-byte string literal not displayed */
	Headers    map[string]*InjaTemplate `` /* 141-byte string literal not displayed */
	// Types that are valid to be assigned to BodyTransformation:
	//	*TransformationTemplate_Body
	//	*TransformationTemplate_Passthrough
	//	*TransformationTemplate_MergeExtractorsToBody
	BodyTransformation isTransformationTemplate_BodyTransformation `protobuf_oneof:"body_transformation"`
}

func (*TransformationTemplate) Descriptor

func (*TransformationTemplate) Descriptor() ([]byte, []int)

func (*TransformationTemplate) GetAdvancedTemplates

func (m *TransformationTemplate) GetAdvancedTemplates() bool

func (*TransformationTemplate) GetBody

func (m *TransformationTemplate) GetBody() *InjaTemplate

func (*TransformationTemplate) GetBodyTransformation

func (m *TransformationTemplate) GetBodyTransformation() isTransformationTemplate_BodyTransformation

func (*TransformationTemplate) GetExtractors

func (m *TransformationTemplate) GetExtractors() map[string]*Extraction

func (*TransformationTemplate) GetHeaders

func (m *TransformationTemplate) GetHeaders() map[string]*InjaTemplate

func (*TransformationTemplate) GetMergeExtractorsToBody

func (m *TransformationTemplate) GetMergeExtractorsToBody() *MergeExtractorsToBody

func (*TransformationTemplate) GetPassthrough

func (m *TransformationTemplate) GetPassthrough() *Passthrough

func (*TransformationTemplate) ProtoMessage

func (*TransformationTemplate) ProtoMessage()

func (*TransformationTemplate) Reset

func (m *TransformationTemplate) Reset()

func (*TransformationTemplate) String

func (m *TransformationTemplate) String() string

func (*TransformationTemplate) XXX_OneofFuncs

func (*TransformationTemplate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type TransformationTemplate_Body

type TransformationTemplate_Body struct {
	Body *InjaTemplate `protobuf:"bytes,4,opt,name=body,oneof"`
}

type TransformationTemplate_MergeExtractorsToBody

type TransformationTemplate_MergeExtractorsToBody struct {
	MergeExtractorsToBody *MergeExtractorsToBody `protobuf:"bytes,6,opt,name=merge_extractors_to_body,json=mergeExtractorsToBody,oneof"`
}

type TransformationTemplate_Passthrough

type TransformationTemplate_Passthrough struct {
	Passthrough *Passthrough `protobuf:"bytes,5,opt,name=passthrough,oneof"`
}

type Transformation_HeaderBodyTransform

type Transformation_HeaderBodyTransform struct {
	HeaderBodyTransform *HeaderBodyTransform `protobuf:"bytes,2,opt,name=header_body_transform,json=headerBodyTransform,oneof"`
}

type Transformation_TransformationTemplate

type Transformation_TransformationTemplate struct {
	TransformationTemplate *TransformationTemplate `protobuf:"bytes,1,opt,name=transformation_template,json=transformationTemplate,oneof"`
}

type Transformations

type Transformations struct {
	Transformations map[string]*Transformation `` /* 157-byte string literal not displayed */
	// if use_routes_for_config is set transformations will be ignored. the plan
	// is to eventually deprecate it. Ideally they should be in a oneof, but a map
	// can't be in a oneof...
	UseRoutesForConfig bool `protobuf:"varint,2,opt,name=use_routes_for_config,json=useRoutesForConfig,proto3" json:"use_routes_for_config,omitempty"`
}

func (*Transformations) Descriptor

func (*Transformations) Descriptor() ([]byte, []int)

func (*Transformations) GetTransformations

func (m *Transformations) GetTransformations() map[string]*Transformation

func (*Transformations) GetUseRoutesForConfig

func (m *Transformations) GetUseRoutesForConfig() bool

func (*Transformations) ProtoMessage

func (*Transformations) ProtoMessage()

func (*Transformations) Reset

func (m *Transformations) Reset()

func (*Transformations) String

func (m *Transformations) String() string

Jump to

Keyboard shortcuts

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