policy

package
v0.0.0-...-fe632b3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package policy is a generated protocol buffer package.

It is generated from these files:

controller.proto

It has these top-level messages:

SetRequest
SetResponse
ResetRequest
ResetResponse
GetReportsRequest
GetReportsResponse

Index

Constants

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

Variables

This section is empty.

Functions

func RegisterControllerServiceServer

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

Types

type Backend

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

func NewPolicyBackend(port int) *Backend

NewPolicyBackend returns a new instance of Backend.

func (*Backend) Close

func (b *Backend) Close() error

Close closes the gRPC backend and the associated listener.

func (*Backend) CloseSession

CloseSession is an implementation InfrastructureBackendServer.CloseSession.

func (*Backend) CreateSession

CreateSession is an implementation InfrastructureBackendServer.CreateSession.

func (*Backend) GetReports

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

GetReports method of the control service.

func (*Backend) HandleCheckNothing

HandleCheckNothing is an implementation of HandleCheckNothingServiceServer.HandleCheckNothing.

func (*Backend) HandleMetric

HandleMetric is an implementation HandleMetricServiceServer.HandleMetric.

func (*Backend) Port

func (b *Backend) Port() int

Port returns the port number of the backend.

func (*Backend) Reset

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

Reset the internal state of the service.

func (*Backend) Set

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

Set method of the control service.

func (*Backend) Start

func (b *Backend) Start() error

Start the gRPC service for the policy backend.

func (*Backend) Validate

Validate is an implementation InfrastructureBackendServer.Validate.

type Controller

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

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

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

func (*Controller) DenyCheck

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

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

func (*Controller) GetReports

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

GetReports returns the currently accumulated report instances.

func (*Controller) Reset

func (c *Controller) Reset() error

Reset the state of the backend.

type ControllerServiceClient

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)
}

func NewControllerServiceClient

func NewControllerServiceClient(cc *grpc.ClientConn) ControllerServiceClient

type ControllerServiceServer

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)
}

type GetReportsRequest

type GetReportsRequest struct {
}

func (*GetReportsRequest) Descriptor

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

func (*GetReportsRequest) ProtoMessage

func (*GetReportsRequest) ProtoMessage()

func (*GetReportsRequest) Reset

func (m *GetReportsRequest) Reset()

func (*GetReportsRequest) String

func (m *GetReportsRequest) String() string

type GetReportsResponse

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

func (*GetReportsResponse) Descriptor

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

func (*GetReportsResponse) GetInstances

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

func (*GetReportsResponse) ProtoMessage

func (*GetReportsResponse) ProtoMessage()

func (*GetReportsResponse) Reset

func (m *GetReportsResponse) Reset()

func (*GetReportsResponse) String

func (m *GetReportsResponse) String() string

type ResetRequest

type ResetRequest struct {
}

func (*ResetRequest) Descriptor

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

func (*ResetRequest) ProtoMessage

func (*ResetRequest) ProtoMessage()

func (*ResetRequest) Reset

func (m *ResetRequest) Reset()

func (*ResetRequest) String

func (m *ResetRequest) String() string

type ResetResponse

type ResetResponse struct {
}

func (*ResetResponse) Descriptor

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

func (*ResetResponse) ProtoMessage

func (*ResetResponse) ProtoMessage()

func (*ResetResponse) Reset

func (m *ResetResponse) Reset()

func (*ResetResponse) String

func (m *ResetResponse) String() string

type SetRequest

type SetRequest struct {
	// The settings to set on the service.
	Settings map[string]string `` /* 150-byte string literal not displayed */
}

func (*SetRequest) Descriptor

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

func (*SetRequest) GetSettings

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

func (*SetRequest) ProtoMessage

func (*SetRequest) ProtoMessage()

func (*SetRequest) Reset

func (m *SetRequest) Reset()

func (*SetRequest) String

func (m *SetRequest) String() string

type SetResponse

type SetResponse struct {
}

func (*SetResponse) Descriptor

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

func (*SetResponse) ProtoMessage

func (*SetResponse) ProtoMessage()

func (*SetResponse) Reset

func (m *SetResponse) Reset()

func (*SetResponse) String

func (m *SetResponse) String() string

Jump to

Keyboard shortcuts

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