Documentation ¶
Index ¶
- func EncodeBool(v interface{}, ba []byte) ([]byte, error)
- func EncodeDouble(v interface{}, ba []byte) ([]byte, error)
- func EncodeEnum(v interface{}, ba []byte, enumValues []*descriptor.EnumValueDescriptorProto) ([]byte, error)
- func EncodeFixed32(v interface{}, ba []byte) ([]byte, error)
- func EncodeFixed64(v interface{}, ba []byte) ([]byte, error)
- func EncodeFloat(v interface{}, ba []byte) ([]byte, error)
- func EncodeInt(v interface{}, ba []byte) ([]byte, error)
- func EncodeSInt32(v interface{}, ba []byte) ([]byte, error)
- func EncodeSInt64(v interface{}, ba []byte) ([]byte, error)
- func EncodeString(v interface{}, ba []byte) ([]byte, error)
- func EncodeVarint(buf []byte, x uint64) ([]byte, int)
- func EncodeVarintZeroExtend(ba []byte, x uint64, minBytes int) []byte
- type Builder
- type CheckOutput
- type Codec
- type Encoder
- type Handler
- func (h *Handler) Close() error
- func (h *Handler) HandleRemoteCheck(ctx context.Context, encodedInstance *adapter.EncodedInstance, ...) (*adapter.CheckResult, error)
- func (h *Handler) HandleRemoteGenAttrs(ctx context.Context, encodedInstance *adapter.EncodedInstance, ...) error
- func (h *Handler) HandleRemoteQuota(ctx context.Context, encodedInstance *adapter.EncodedInstance, ...) (*adapter.QuotaResult, error)
- func (h *Handler) HandleRemoteReport(ctx context.Context, encodedInstances []*adapter.EncodedInstance) error
- type NamedEncoderBuilderFunc
- type Svc
- type TemplateConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeBool ¶
EncodeBool encodes input as boolean.
func EncodeDouble ¶
EncodeDouble encode Double.
func EncodeEnum ¶
func EncodeEnum(v interface{}, ba []byte, enumValues []*descriptor.EnumValueDescriptorProto) ([]byte, error)
EncodeEnum encodes enum from string or int inputs
func EncodeFixed32 ¶
EncodeFixed32 encodes FIXED32, SFIXED32
func EncodeFixed64 ¶
EncodeFixed64 encodes FIXED64, SFIXED64
func EncodeFloat ¶
EncodeFloat encode Float.
func EncodeSInt32 ¶
EncodeSInt32 encodes sint32 as zigzag
func EncodeSInt64 ¶
EncodeSInt64 encodes sint64 as zigzag
func EncodeString ¶
EncodeString encodes string
func EncodeVarint ¶
EncodeVarint -- encodeVarint no allocations
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder builds encoder based on data
func NewEncoderBuilder ¶
NewEncoderBuilder creates an EncoderBuilder.
type CheckOutput ¶
type CheckOutput struct {
// contains filtered or unexported fields
}
CheckOutput is a generic container for the response of remote check calls with output. It is used to unpack the value using a combination of the static and dynamic decoders.
func (*CheckOutput) Bytes ¶
func (out *CheckOutput) Bytes(n wire.Number, v []byte)
Bytes implements proto decoding interface
func (*CheckOutput) Fixed32 ¶
func (out *CheckOutput) Fixed32(wire.Number, uint32)
Fixed32 implements proto decoding interface
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec in no-op on the way out and unmarshals using either normal means or a custom dynamic decoder on the way in
type Encoder ¶
Encoder transforms yaml/json that represents protobuf data into []byte String values (rvalues) are treated as expressions that are evaluated using attribute bag at runtime. Quoted String values are treated as literals.
func BuildPrimitiveEncoder ¶
func BuildPrimitiveEncoder(v interface{}, fld *descriptor.FieldDescriptorProto) (Encoder, error)
BuildPrimitiveEncoder encodes the given data and returns a static encoder.
func BuildPrimitiveEvalEncoder ¶
func BuildPrimitiveEvalEncoder(expr compiled.Expression, vt v1beta1.ValueType, fld *descriptor.FieldDescriptorProto) (Encoder, error)
BuildPrimitiveEvalEncoder returns an eval encoder given an expression and a target fieldEncoder
type Handler ¶
type Handler struct { // Name is used for debug Name string // contains filtered or unexported fields }
Handler is the dynamic handler implementation
func BuildHandler ¶
func BuildHandler(name string, connConfig *policypb.Connection, sessionBased bool, adapterConfig proto.Marshaler, templateConfig []*TemplateConfig, insecureSkipVerify bool) (hh *Handler, err error)
BuildHandler creates a dynamic handler object exposing specific handler interfaces.
func (*Handler) HandleRemoteCheck ¶
func (h *Handler) HandleRemoteCheck(ctx context.Context, encodedInstance *adapter.EncodedInstance, output *attribute.MutableBag, outPrefix string) (*adapter.CheckResult, error)
HandleRemoteCheck implements adapter.RemoteCheckHandler api
func (*Handler) HandleRemoteGenAttrs ¶
func (h *Handler) HandleRemoteGenAttrs(ctx context.Context, encodedInstance *adapter.EncodedInstance, out *attribute.MutableBag) error
HandleRemoteGenAttrs implements remote handler API.
func (*Handler) HandleRemoteQuota ¶
func (h *Handler) HandleRemoteQuota(ctx context.Context, encodedInstance *adapter.EncodedInstance, args *adapter.QuotaArgs) (*adapter.QuotaResult, error)
HandleRemoteQuota implements adapter.RemoteQuotaHandler api
func (*Handler) HandleRemoteReport ¶
func (h *Handler) HandleRemoteReport(ctx context.Context, encodedInstances []*adapter.EncodedInstance) error
HandleRemoteReport implements adapter.RemoteReportHandler api
type NamedEncoderBuilderFunc ¶
type NamedEncoderBuilderFunc func(m *descriptor.DescriptorProto, fd *descriptor.FieldDescriptorProto, v interface{}, compiler lang.Compiler) (Encoder, error)
NamedEncoderBuilderFunc funcs have a special way to process input for encoding specific types for example istio...Value field accepts user input in a specific way
type Svc ¶
type Svc struct { Name string Pkg string MethodName string InputType string OutputType string TemplateName string // contains filtered or unexported fields }
Svc encapsulates abstract service
type TemplateConfig ¶
type TemplateConfig struct { Name string TemplateName string FileDescSet *descriptor.FileDescriptorSet Variety v1beta1.TemplateVariety }
TemplateConfig is template configuration