istio: istio.io/istio/pkg/test/fakes/policy Index | Files

package policy

import "istio.io/istio/pkg/test/fakes/policy"

Index

Package Files

backend.go config.pb.go controller.go controller.pb.go conversion.go doc.go settings.go

Constants

const (
    // DefaultPort for the backend service.
    DefaultPort = 1071
)

Variables

var (
    ErrInvalidLengthConfig = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowConfig   = fmt.Errorf("proto: integer overflow")
)
var (
    ErrInvalidLengthController = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowController   = fmt.Errorf("proto: integer overflow")
)

func RegisterControllerServiceServer Uses

func RegisterControllerServiceServer(s *grpc.Server, srv ControllerServiceServer)

type Backend Uses

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

Backend is the implementation of a Fake policy backend. It can be ran either in a cluster or locally.

func NewPolicyBackend Uses

func NewPolicyBackend(port int) *Backend

NewPolicyBackend returns a new instance of Backend.

func (*Backend) Close Uses

func (b *Backend) Close() error

Close closes the gRPC backend and the associated listener.

func (*Backend) CloseSession Uses

func (b *Backend) CloseSession(ctx context.Context, req *v1beta1.CloseSessionRequest) (
    *v1beta1.CloseSessionResponse, error)

CloseSession is an implementation InfrastructureBackendServer.CloseSession.

func (*Backend) CreateSession Uses

func (b *Backend) CreateSession(ctx context.Context, req *v1beta1.CreateSessionRequest) (
    *v1beta1.CreateSessionResponse, error)

CreateSession is an implementation InfrastructureBackendServer.CreateSession.

func (*Backend) GetReports Uses

func (b *Backend) GetReports(ctx context.Context, req *GetReportsRequest) (*GetReportsResponse, error)

GetReports method of the control service.

func (*Backend) HandleCheckNothing Uses

func (b *Backend) HandleCheckNothing(ctx context.Context, req *checknothing.HandleCheckNothingRequest) (
    *istio_mixer_adapter_model_v1beta11.CheckResult, error)

HandleCheckNothing is an implementation of HandleCheckNothingServiceServer.HandleCheckNothing.

func (*Backend) HandleKeyval Uses

func (b *Backend) HandleKeyval(ctx context.Context, req *keyval.HandleKeyvalRequest) (*keyval.HandleKeyvalResponse, error)

HandleKeyval is an implementation of HandleKeyvalServiceServer.HandleKeyval.

func (*Backend) HandleMetric Uses

func (b *Backend) HandleMetric(ctx context.Context, req *metric.HandleMetricRequest) (
    *istio_mixer_adapter_model_v1beta11.ReportResult, error)

HandleMetric is an implementation HandleMetricServiceServer.HandleMetric.

func (*Backend) Port Uses

func (b *Backend) Port() int

Port returns the port number of the backend.

func (*Backend) Reset Uses

func (b *Backend) Reset(ctx context.Context, req *ResetRequest) (*ResetResponse, error)

Reset the internal state of the service.

func (*Backend) Set Uses

func (b *Backend) Set(ctx context.Context, req *SetRequest) (*SetResponse, error)

Set method of the control service.

func (*Backend) Start Uses

func (b *Backend) Start() error

Start the gRPC service for the policy backend.

func (*Backend) Validate Uses

func (b *Backend) Validate(ctx context.Context, req *v1beta1.ValidateRequest) (
    *v1beta1.ValidateResponse, error)

Validate is an implementation InfrastructureBackendServer.Validate.

type Controller Uses

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

Controller is the control interface for the policy backend. The tests can use the interface to control the fake.

func NewController Uses

func NewController(address string) (*Controller, error)

NewController creates and returns a new instance of a controller client for the backend.

func (*Controller) AllowCheck Uses

func (c *Controller) AllowCheck(d time.Duration, count int32) error

AllowCheck causes the policy backend to allow all check requests with the supplied valid duration and valid count in check result.

func (*Controller) DenyCheck Uses

func (c *Controller) DenyCheck(deny bool) error

DenyCheck causes the policy backend to deny all check requests when set to true.

func (*Controller) GetReports Uses

func (c *Controller) GetReports() ([]proto.Message, error)

GetReports returns the currently accumulated report instances.

func (*Controller) Reset Uses

func (c *Controller) Reset() error

Reset the state of the backend.

type ControllerServiceClient Uses

type ControllerServiceClient interface {
    // Set changes settings of the fake policy backend.
    Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error)
    // Resets the internal state of the policy backend (i.e. all settings are reverted to the default values
    // and all accumulated state is cleared.
    Reset(ctx context.Context, in *ResetRequest, opts ...grpc.CallOption) (*ResetResponse, error)
    // GetReports returns the accumulated set of reports from the service. The server clears out its
    // accumulated cache once the call completes.
    GetReports(ctx context.Context, in *GetReportsRequest, opts ...grpc.CallOption) (*GetReportsResponse, error)
}

ControllerServiceClient is the client API for ControllerService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewControllerServiceClient Uses

func NewControllerServiceClient(cc *grpc.ClientConn) ControllerServiceClient

type ControllerServiceServer Uses

type ControllerServiceServer interface {
    // Set changes settings of the fake policy backend.
    Set(context.Context, *SetRequest) (*SetResponse, error)
    // Resets the internal state of the policy backend (i.e. all settings are reverted to the default values
    // and all accumulated state is cleared.
    Reset(context.Context, *ResetRequest) (*ResetResponse, error)
    // GetReports returns the accumulated set of reports from the service. The server clears out its
    // accumulated cache once the call completes.
    GetReports(context.Context, *GetReportsRequest) (*GetReportsResponse, error)
}

ControllerServiceServer is the server API for ControllerService service.

type GetReportsRequest Uses

type GetReportsRequest struct {
}

func (*GetReportsRequest) Descriptor Uses

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

func (*GetReportsRequest) Equal Uses

func (this *GetReportsRequest) Equal(that interface{}) bool

func (*GetReportsRequest) GoString Uses

func (this *GetReportsRequest) GoString() string

func (*GetReportsRequest) Marshal Uses

func (m *GetReportsRequest) Marshal() (dAtA []byte, err error)

func (*GetReportsRequest) MarshalTo Uses

func (m *GetReportsRequest) MarshalTo(dAtA []byte) (int, error)

func (*GetReportsRequest) MarshalToSizedBuffer Uses

func (m *GetReportsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetReportsRequest) ProtoMessage Uses

func (*GetReportsRequest) ProtoMessage()

func (*GetReportsRequest) Reset Uses

func (m *GetReportsRequest) Reset()

func (*GetReportsRequest) Size Uses

func (m *GetReportsRequest) Size() (n int)

func (*GetReportsRequest) String Uses

func (this *GetReportsRequest) String() string

func (*GetReportsRequest) Unmarshal Uses

func (m *GetReportsRequest) Unmarshal(dAtA []byte) error

func (*GetReportsRequest) XXX_DiscardUnknown Uses

func (m *GetReportsRequest) XXX_DiscardUnknown()

func (*GetReportsRequest) XXX_Marshal Uses

func (m *GetReportsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetReportsRequest) XXX_Merge Uses

func (m *GetReportsRequest) XXX_Merge(src proto.Message)

func (*GetReportsRequest) XXX_Size Uses

func (m *GetReportsRequest) XXX_Size() int

func (*GetReportsRequest) XXX_Unmarshal Uses

func (m *GetReportsRequest) XXX_Unmarshal(b []byte) error

type GetReportsResponse Uses

type GetReportsResponse struct {
    Instances []*types.Any `protobuf:"bytes,1,rep,name=instances,proto3" json:"instances,omitempty"`
}

func (*GetReportsResponse) Descriptor Uses

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

func (*GetReportsResponse) Equal Uses

func (this *GetReportsResponse) Equal(that interface{}) bool

func (*GetReportsResponse) GetInstances Uses

func (m *GetReportsResponse) GetInstances() []*types.Any

func (*GetReportsResponse) GoString Uses

func (this *GetReportsResponse) GoString() string

func (*GetReportsResponse) Marshal Uses

func (m *GetReportsResponse) Marshal() (dAtA []byte, err error)

func (*GetReportsResponse) MarshalTo Uses

func (m *GetReportsResponse) MarshalTo(dAtA []byte) (int, error)

func (*GetReportsResponse) MarshalToSizedBuffer Uses

func (m *GetReportsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetReportsResponse) ProtoMessage Uses

func (*GetReportsResponse) ProtoMessage()

func (*GetReportsResponse) Reset Uses

func (m *GetReportsResponse) Reset()

func (*GetReportsResponse) Size Uses

func (m *GetReportsResponse) Size() (n int)

func (*GetReportsResponse) String Uses

func (this *GetReportsResponse) String() string

func (*GetReportsResponse) Unmarshal Uses

func (m *GetReportsResponse) Unmarshal(dAtA []byte) error

func (*GetReportsResponse) XXX_DiscardUnknown Uses

func (m *GetReportsResponse) XXX_DiscardUnknown()

func (*GetReportsResponse) XXX_Marshal Uses

func (m *GetReportsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetReportsResponse) XXX_Merge Uses

func (m *GetReportsResponse) XXX_Merge(src proto.Message)

func (*GetReportsResponse) XXX_Size Uses

func (m *GetReportsResponse) XXX_Size() int

func (*GetReportsResponse) XXX_Unmarshal Uses

func (m *GetReportsResponse) XXX_Unmarshal(b []byte) error

type Params Uses

type Params struct {
    // Specify check related params.
    CheckParams *Params_CheckParams `protobuf:"bytes,1,opt,name=check_params,json=checkParams,proto3" json:"check_params,omitempty"`
    // Specify route directive related params.
    Table map[string]string `protobuf:"bytes,2,rep,name=table,proto3" json:"table,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}

Config for policy backend, which could be used as a fake adapter for integration test, supports checknothing and keyval template.

func (*Params) Descriptor Uses

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

func (*Params) Equal Uses

func (this *Params) Equal(that interface{}) bool

func (*Params) GetCheckParams Uses

func (m *Params) GetCheckParams() *Params_CheckParams

func (*Params) GetTable Uses

func (m *Params) GetTable() map[string]string

func (*Params) GoString Uses

func (this *Params) GoString() string

func (*Params) Marshal Uses

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo Uses

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer Uses

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ProtoMessage Uses

func (*Params) ProtoMessage()

func (*Params) Reset Uses

func (m *Params) Reset()

func (*Params) Size Uses

func (m *Params) Size() (n int)

func (*Params) String Uses

func (this *Params) String() string

func (*Params) Unmarshal Uses

func (m *Params) Unmarshal(dAtA []byte) error

func (*Params) XXX_DiscardUnknown Uses

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal Uses

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge Uses

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size Uses

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal Uses

func (m *Params) XXX_Unmarshal(b []byte) error

type Params_CheckParams Uses

type Params_CheckParams struct {
    // Controls that request should be allowed or not.
    CheckAllow bool `protobuf:"varint,1,opt,name=check_allow,json=checkAllow,proto3" json:"check_allow,omitempty"`
    // Valid duration of the check result.
    ValidDuration *types.Duration `protobuf:"bytes,2,opt,name=valid_duration,json=validDuration,proto3" json:"valid_duration,omitempty"`
    // Valid request count of the check result.
    ValidCount int64 `protobuf:"varint,3,opt,name=valid_count,json=validCount,proto3" json:"valid_count,omitempty"`
}

Check params which controls check result returned by policy backend.

func (*Params_CheckParams) Descriptor Uses

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

func (*Params_CheckParams) Equal Uses

func (this *Params_CheckParams) Equal(that interface{}) bool

func (*Params_CheckParams) GetCheckAllow Uses

func (m *Params_CheckParams) GetCheckAllow() bool

func (*Params_CheckParams) GetValidCount Uses

func (m *Params_CheckParams) GetValidCount() int64

func (*Params_CheckParams) GetValidDuration Uses

func (m *Params_CheckParams) GetValidDuration() *types.Duration

func (*Params_CheckParams) GoString Uses

func (this *Params_CheckParams) GoString() string

func (*Params_CheckParams) Marshal Uses

func (m *Params_CheckParams) Marshal() (dAtA []byte, err error)

func (*Params_CheckParams) MarshalTo Uses

func (m *Params_CheckParams) MarshalTo(dAtA []byte) (int, error)

func (*Params_CheckParams) MarshalToSizedBuffer Uses

func (m *Params_CheckParams) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params_CheckParams) ProtoMessage Uses

func (*Params_CheckParams) ProtoMessage()

func (*Params_CheckParams) Reset Uses

func (m *Params_CheckParams) Reset()

func (*Params_CheckParams) Size Uses

func (m *Params_CheckParams) Size() (n int)

func (*Params_CheckParams) String Uses

func (this *Params_CheckParams) String() string

func (*Params_CheckParams) Unmarshal Uses

func (m *Params_CheckParams) Unmarshal(dAtA []byte) error

func (*Params_CheckParams) XXX_DiscardUnknown Uses

func (m *Params_CheckParams) XXX_DiscardUnknown()

func (*Params_CheckParams) XXX_Marshal Uses

func (m *Params_CheckParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params_CheckParams) XXX_Merge Uses

func (m *Params_CheckParams) XXX_Merge(src proto.Message)

func (*Params_CheckParams) XXX_Size Uses

func (m *Params_CheckParams) XXX_Size() int

func (*Params_CheckParams) XXX_Unmarshal Uses

func (m *Params_CheckParams) XXX_Unmarshal(b []byte) error

type ResetRequest Uses

type ResetRequest struct {
}

func (*ResetRequest) Descriptor Uses

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

func (*ResetRequest) Equal Uses

func (this *ResetRequest) Equal(that interface{}) bool

func (*ResetRequest) GoString Uses

func (this *ResetRequest) GoString() string

func (*ResetRequest) Marshal Uses

func (m *ResetRequest) Marshal() (dAtA []byte, err error)

func (*ResetRequest) MarshalTo Uses

func (m *ResetRequest) MarshalTo(dAtA []byte) (int, error)

func (*ResetRequest) MarshalToSizedBuffer Uses

func (m *ResetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ResetRequest) ProtoMessage Uses

func (*ResetRequest) ProtoMessage()

func (*ResetRequest) Reset Uses

func (m *ResetRequest) Reset()

func (*ResetRequest) Size Uses

func (m *ResetRequest) Size() (n int)

func (*ResetRequest) String Uses

func (this *ResetRequest) String() string

func (*ResetRequest) Unmarshal Uses

func (m *ResetRequest) Unmarshal(dAtA []byte) error

func (*ResetRequest) XXX_DiscardUnknown Uses

func (m *ResetRequest) XXX_DiscardUnknown()

func (*ResetRequest) XXX_Marshal Uses

func (m *ResetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ResetRequest) XXX_Merge Uses

func (m *ResetRequest) XXX_Merge(src proto.Message)

func (*ResetRequest) XXX_Size Uses

func (m *ResetRequest) XXX_Size() int

func (*ResetRequest) XXX_Unmarshal Uses

func (m *ResetRequest) XXX_Unmarshal(b []byte) error

type ResetResponse Uses

type ResetResponse struct {
}

func (*ResetResponse) Descriptor Uses

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

func (*ResetResponse) Equal Uses

func (this *ResetResponse) Equal(that interface{}) bool

func (*ResetResponse) GoString Uses

func (this *ResetResponse) GoString() string

func (*ResetResponse) Marshal Uses

func (m *ResetResponse) Marshal() (dAtA []byte, err error)

func (*ResetResponse) MarshalTo Uses

func (m *ResetResponse) MarshalTo(dAtA []byte) (int, error)

func (*ResetResponse) MarshalToSizedBuffer Uses

func (m *ResetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ResetResponse) ProtoMessage Uses

func (*ResetResponse) ProtoMessage()

func (*ResetResponse) Reset Uses

func (m *ResetResponse) Reset()

func (*ResetResponse) Size Uses

func (m *ResetResponse) Size() (n int)

func (*ResetResponse) String Uses

func (this *ResetResponse) String() string

func (*ResetResponse) Unmarshal Uses

func (m *ResetResponse) Unmarshal(dAtA []byte) error

func (*ResetResponse) XXX_DiscardUnknown Uses

func (m *ResetResponse) XXX_DiscardUnknown()

func (*ResetResponse) XXX_Marshal Uses

func (m *ResetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ResetResponse) XXX_Merge Uses

func (m *ResetResponse) XXX_Merge(src proto.Message)

func (*ResetResponse) XXX_Size Uses

func (m *ResetResponse) XXX_Size() int

func (*ResetResponse) XXX_Unmarshal Uses

func (m *ResetResponse) XXX_Unmarshal(b []byte) error

type SetRequest Uses

type SetRequest struct {
    // The settings to set on the service.
    Settings map[string]string `protobuf:"bytes,1,rep,name=settings,proto3" json:"settings,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}

func (*SetRequest) Descriptor Uses

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

func (*SetRequest) Equal Uses

func (this *SetRequest) Equal(that interface{}) bool

func (*SetRequest) GetSettings Uses

func (m *SetRequest) GetSettings() map[string]string

func (*SetRequest) GoString Uses

func (this *SetRequest) GoString() string

func (*SetRequest) Marshal Uses

func (m *SetRequest) Marshal() (dAtA []byte, err error)

func (*SetRequest) MarshalTo Uses

func (m *SetRequest) MarshalTo(dAtA []byte) (int, error)

func (*SetRequest) MarshalToSizedBuffer Uses

func (m *SetRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SetRequest) ProtoMessage Uses

func (*SetRequest) ProtoMessage()

func (*SetRequest) Reset Uses

func (m *SetRequest) Reset()

func (*SetRequest) Size Uses

func (m *SetRequest) Size() (n int)

func (*SetRequest) String Uses

func (this *SetRequest) String() string

func (*SetRequest) Unmarshal Uses

func (m *SetRequest) Unmarshal(dAtA []byte) error

func (*SetRequest) XXX_DiscardUnknown Uses

func (m *SetRequest) XXX_DiscardUnknown()

func (*SetRequest) XXX_Marshal Uses

func (m *SetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetRequest) XXX_Merge Uses

func (m *SetRequest) XXX_Merge(src proto.Message)

func (*SetRequest) XXX_Size Uses

func (m *SetRequest) XXX_Size() int

func (*SetRequest) XXX_Unmarshal Uses

func (m *SetRequest) XXX_Unmarshal(b []byte) error

type SetResponse Uses

type SetResponse struct {
}

func (*SetResponse) Descriptor Uses

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

func (*SetResponse) Equal Uses

func (this *SetResponse) Equal(that interface{}) bool

func (*SetResponse) GoString Uses

func (this *SetResponse) GoString() string

func (*SetResponse) Marshal Uses

func (m *SetResponse) Marshal() (dAtA []byte, err error)

func (*SetResponse) MarshalTo Uses

func (m *SetResponse) MarshalTo(dAtA []byte) (int, error)

func (*SetResponse) MarshalToSizedBuffer Uses

func (m *SetResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SetResponse) ProtoMessage Uses

func (*SetResponse) ProtoMessage()

func (*SetResponse) Reset Uses

func (m *SetResponse) Reset()

func (*SetResponse) Size Uses

func (m *SetResponse) Size() (n int)

func (*SetResponse) String Uses

func (this *SetResponse) String() string

func (*SetResponse) Unmarshal Uses

func (m *SetResponse) Unmarshal(dAtA []byte) error

func (*SetResponse) XXX_DiscardUnknown Uses

func (m *SetResponse) XXX_DiscardUnknown()

func (*SetResponse) XXX_Marshal Uses

func (m *SetResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetResponse) XXX_Merge Uses

func (m *SetResponse) XXX_Merge(src proto.Message)

func (*SetResponse) XXX_Size Uses

func (m *SetResponse) XXX_Size() int

func (*SetResponse) XXX_Unmarshal Uses

func (m *SetResponse) XXX_Unmarshal(b []byte) error

type UnimplementedControllerServiceServer Uses

type UnimplementedControllerServiceServer struct {
}

UnimplementedControllerServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedControllerServiceServer) GetReports Uses

func (*UnimplementedControllerServiceServer) GetReports(ctx context.Context, req *GetReportsRequest) (*GetReportsResponse, error)

func (*UnimplementedControllerServiceServer) Reset Uses

func (*UnimplementedControllerServiceServer) Reset(ctx context.Context, req *ResetRequest) (*ResetResponse, error)

func (*UnimplementedControllerServiceServer) Set Uses

func (*UnimplementedControllerServiceServer) Set(ctx context.Context, req *SetRequest) (*SetResponse, error)

Package policy imports 27 packages (graph) and is imported by 2 packages. Updated 2019-10-20. Refresh now. Tools for package owners.