Documentation ¶
Overview ¶
Package transformation is a generated protocol buffer package.
It is generated from these files:
spec.proto
It has these top-level messages:
RouteExtension Parameters TransformationSpec
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
- func EncodeRouteExtension(spec RouteExtension) *types.Struct
- type Extraction
- type GetTransformationFunction
- type HeaderBodyTransform
- type InjaTemplate
- type MergeExtractorsToBody
- type Parameters
- func (*Parameters) Descriptor() ([]byte, []int)
- func (this *Parameters) Equal(that interface{}) bool
- func (m *Parameters) GetHeaders() map[string]string
- func (m *Parameters) GetPath() *google_protobuf1.StringValue
- func (*Parameters) ProtoMessage()
- func (m *Parameters) Reset()
- func (m *Parameters) String() string
- type Passthrough
- type Plugin
- type RouteExtension
- func (*RouteExtension) Descriptor() ([]byte, []int)
- func (this *RouteExtension) Equal(that interface{}) bool
- func (m *RouteExtension) GetParameters() *Parameters
- func (m *RouteExtension) GetResponseParams() *Parameters
- func (m *RouteExtension) GetResponseTransformation() *TransformationSpec
- func (*RouteExtension) ProtoMessage()
- func (m *RouteExtension) Reset()
- func (m *RouteExtension) String() string
- type RouteTransformations
- func (*RouteTransformations) Descriptor() ([]byte, []int)
- func (m *RouteTransformations) GetRequestTransformation() *Transformation
- func (m *RouteTransformations) GetResponseTransformation() *Transformation
- func (*RouteTransformations) ProtoMessage()
- func (m *RouteTransformations) Reset()
- func (m *RouteTransformations) String() string
- type Transformation
- func (*Transformation) Descriptor() ([]byte, []int)
- func (m *Transformation) GetHeaderBodyTransform() *HeaderBodyTransform
- func (m *Transformation) GetTransformationTemplate() *TransformationTemplate
- func (m *Transformation) GetTransformationType() isTransformation_TransformationType
- func (*Transformation) ProtoMessage()
- func (m *Transformation) Reset()
- func (m *Transformation) String() string
- func (*Transformation) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type TransformationSpec
- func (*TransformationSpec) Descriptor() ([]byte, []int)
- func (this *TransformationSpec) Equal(that interface{}) bool
- func (m *TransformationSpec) GetBody() *google_protobuf1.StringValue
- func (m *TransformationSpec) GetHeaders() map[string]string
- func (m *TransformationSpec) GetPath() string
- func (*TransformationSpec) ProtoMessage()
- func (m *TransformationSpec) Reset()
- func (m *TransformationSpec) String() string
- type TransformationTemplate
- func (*TransformationTemplate) Descriptor() ([]byte, []int)
- func (m *TransformationTemplate) GetAdvancedTemplates() bool
- func (m *TransformationTemplate) GetBody() *InjaTemplate
- func (m *TransformationTemplate) GetBodyTransformation() isTransformationTemplate_BodyTransformation
- func (m *TransformationTemplate) GetExtractors() map[string]*Extraction
- func (m *TransformationTemplate) GetHeaders() map[string]*InjaTemplate
- func (m *TransformationTemplate) GetMergeExtractorsToBody() *MergeExtractorsToBody
- func (m *TransformationTemplate) GetPassthrough() *Passthrough
- func (*TransformationTemplate) ProtoMessage()
- func (m *TransformationTemplate) Reset()
- func (m *TransformationTemplate) String() string
- func (*TransformationTemplate) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type TransformationTemplate_Body
- type TransformationTemplate_MergeExtractorsToBody
- type TransformationTemplate_Passthrough
- type Transformation_HeaderBodyTransform
- type Transformation_TransformationTemplate
- type Transformations
Constants ¶
const (
ServiceTypeTransformation = "HTTP-Functions"
)
Variables ¶
This section is empty.
Functions ¶
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 extract data for processing output templates // Gloo will search for parameters by their name in header value strings, enclosed in single // curly braces // Example: // extensions: // parameters: // headers: // x-user-id: { userId } Headers map[string]string `` /* 148-byte string literal not displayed */ // part of the (or the entire) path that will be used extract data for processing output templates // Gloo will search for parameters by their name in header value strings, enclosed in single // curly braces // Example: // extensions: // parameters: // path: /users/{ userId } Path *google_protobuf1.StringValue `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` }
Parameters define a set of parameters for REST Transformations Parameters can be extracted from HTTP Headers and Request Path Parameters can also be extracted from the HTTP Body, provided that it is valid JSON-encoded Gloo will search for parameters by their name in strings, enclosed in single curly braces, and attempt to match them to the variables in REST Function Templates for example:
# route match: {...} destination: {...} extensions: parameters: headers: x-user-id: { userId } --- # function name: myfunc spec: body: | { "id": {{ userId }} }
func (*Parameters) Descriptor ¶ added in v0.4.2
func (*Parameters) Descriptor() ([]byte, []int)
func (*Parameters) Equal ¶ added in v0.4.2
func (this *Parameters) Equal(that interface{}) bool
func (*Parameters) GetHeaders ¶ added in v0.4.2
func (m *Parameters) GetHeaders() map[string]string
func (*Parameters) GetPath ¶ added in v0.4.2
func (m *Parameters) GetPath() *google_protobuf1.StringValue
func (*Parameters) ProtoMessage ¶ added in v0.4.2
func (*Parameters) ProtoMessage()
func (*Parameters) Reset ¶ added in v0.4.2
func (m *Parameters) Reset()
func (*Parameters) String ¶ added in v0.4.2
func (m *Parameters) String() string
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 { // If specified, these parameters will be used as inputs for REST templates for // the destination function for the route // (if the route destination is a functional destination that has a REST transformation) Parameters *Parameters `protobuf:"bytes,1,opt,name=parameters" json:"parameters,omitempty"` // If specified, responses on this route will be transformed according to the template(s) provided // in the transformation spec here ResponseTransformation *TransformationSpec `protobuf:"bytes,2,opt,name=response_transformation,json=responseTransformation" json:"response_transformation,omitempty"` // If specified, paremeters for the response transformation will be extracted from these sources ResponseParams *Parameters `protobuf:"bytes,3,opt,name=response_params,json=responseParams" json:"response_params,omitempty"` }
The REST Route Extension contains two components: * parameters for calling REST functions * Response Transformation
func DecodeRouteExtension ¶
func DecodeRouteExtension(generic *types.Struct) (RouteExtension, error)
func (*RouteExtension) Descriptor ¶ added in v0.4.2
func (*RouteExtension) Descriptor() ([]byte, []int)
func (*RouteExtension) Equal ¶ added in v0.4.2
func (this *RouteExtension) Equal(that interface{}) bool
func (*RouteExtension) GetParameters ¶ added in v0.4.2
func (m *RouteExtension) GetParameters() *Parameters
func (*RouteExtension) GetResponseParams ¶ added in v0.4.2
func (m *RouteExtension) GetResponseParams() *Parameters
func (*RouteExtension) GetResponseTransformation ¶ added in v0.4.2
func (m *RouteExtension) GetResponseTransformation() *TransformationSpec
func (*RouteExtension) ProtoMessage ¶ added in v0.4.2
func (*RouteExtension) ProtoMessage()
func (*RouteExtension) Reset ¶ added in v0.4.2
func (m *RouteExtension) Reset()
func (*RouteExtension) String ¶ added in v0.4.2
func (m *RouteExtension) String() string
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 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 TransformationSpec ¶ added in v0.4.2
type TransformationSpec struct { // a Jinja-style Template string for the outbound request path. Only useful for request transformation Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` // a map of keys to Jinja-style Template strings HTTP Headers. Useful for request and response transformations Headers map[string]string `` /* 148-byte string literal not displayed */ // a Jinja-style Template string for the outbound HTTP Body. Useful for request and response transformations // If this is nil, the body will be passed through unmodified. If set to an empty string, the body will be removed // from the HTTP message. Body *google_protobuf1.StringValue `protobuf:"bytes,3,opt,name=body" json:"body,omitempty"` }
TransformationSpec can act as part of a Route Extension (as a Response Transformation), or as a FunctionSpec (as a Request Transformation). Use TransformationSpec as the Function Spec for REST Services (where `Upstream.ServiceInfo.Type == "REST"`) TransformationSpec contains a set of templates that will be used to modify the Path, Headers, and Body Parameters for the tempalte come from the following sources: path: HTTP Request path (if present) method: HTTP Request method (if present) parameters specified in the RouteExtension.Parameters (or, in the case of ResponseTransformation, RouteExtension.ResponseParams) Parameters can also be extracted from the Request / Response Body provided that they are JSON To do so, specify the field using JSONPath syntax any field from the request body, assuming it's json (http://goessner.net/articles/JsonPath/index.html#e2)
func (*TransformationSpec) Descriptor ¶ added in v0.4.2
func (*TransformationSpec) Descriptor() ([]byte, []int)
func (*TransformationSpec) Equal ¶ added in v0.4.2
func (this *TransformationSpec) Equal(that interface{}) bool
func (*TransformationSpec) GetBody ¶ added in v0.4.2
func (m *TransformationSpec) GetBody() *google_protobuf1.StringValue
func (*TransformationSpec) GetHeaders ¶ added in v0.4.2
func (m *TransformationSpec) GetHeaders() map[string]string
func (*TransformationSpec) GetPath ¶ added in v0.4.2
func (m *TransformationSpec) GetPath() string
func (*TransformationSpec) ProtoMessage ¶ added in v0.4.2
func (*TransformationSpec) ProtoMessage()
func (*TransformationSpec) Reset ¶ added in v0.4.2
func (m *TransformationSpec) Reset()
func (*TransformationSpec) String ¶ added in v0.4.2
func (m *TransformationSpec) String() string
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