spybackend

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: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	// manipulate the behavior of the backend.
	Behavior *Behavior

	// observed inputs by the backend
	Requests *Requests
}

Args specify captured requests and programmed behavior

func DefaultArgs

func DefaultArgs() *Args

DefaultArgs returns default arguments

type Behavior

type Behavior struct {
	ValidateResponse *adptModel.ValidateResponse
	ValidateError    error

	CreateSessionResponse *adptModel.CreateSessionResponse
	CreateSessionError    error

	CloseSessionResponse *adptModel.CloseSessionResponse
	CloseSessionError    error

	// report metric IBP
	HandleMetricResult *adptModel.ReportResult
	HandleMetricError  error
	HandleMetricSleep  time.Duration

	// check listEntry IBP
	HandleListEntryResult *adptModel.CheckResult
	HandleListEntryError  error
	HandleListEntrySleep  time.Duration

	// quota IBP
	HandleQuotaResult *adptModel.QuotaResult
	HandleQuotaError  error
	HandleQuotaSleep  time.Duration

	// sample quota IBP
	HandleSampleQuotaResult *adptModel.QuotaResult
	HandleSampleQuotaError  error
	HandleSampleQuotaSleep  time.Duration

	// sample check IBP
	HandleSampleCheckResult *adptModel.CheckResult
	HandleSampleCheckError  error
	HandleCheckOutput       *checkoutputTmpl.OutputMsg
	HandleSampleCheckSleep  time.Duration

	// sample report IBP
	HandleSampleReportResult *adptModel.ReportResult
	HandleSampleReportError  error
	HandleSampleReportSleep  time.Duration

	// sample APA IBP
	HandleSampleApaResult *apaTmpl.OutputMsg
	HandleSampleApaError  error
	HandleSampleApaSleep  time.Duration

	// Auth
	RequireTLS               bool
	RequireMTls              bool
	HeaderKey                string
	HeaderToken              string
	CredsPath                string
	KeyPath                  string
	CertPath                 string
	InsecureSkipVerification bool
}

Behavior specifies programmed behavior

type NoSessionServer

type NoSessionServer struct {
	Behavior      *Behavior
	Requests      *Requests
	CapturedCalls []spyadapter.CapturedCall
	// contains filtered or unexported fields
}

NoSessionServer models no session adapter backend.

func (*NoSessionServer) Addr

func (s *NoSessionServer) Addr() net.Addr

Addr returns the listening address of the server

func (*NoSessionServer) Close

func (s *NoSessionServer) Close() error

Close gracefully shuts down the server

func (*NoSessionServer) GetCapturedCalls

func (s *NoSessionServer) GetCapturedCalls() []spyadapter.CapturedCall

GetCapturedCalls ...

func (*NoSessionServer) GetState

func (s *NoSessionServer) GetState() interface{}

GetState returns the adapters observed state.

func (*NoSessionServer) HandleCheckProducer

HandleCheckProducer records checkoutput and responds with the programmed response

func (*NoSessionServer) HandleListEntry

HandleListEntry records listrequest and responds with the programmed response

func (*NoSessionServer) HandleMetric

HandleMetric records metric entries and responds with the programmed response

func (*NoSessionServer) HandleQuota

HandleQuota records quotarequest and responds with the programmed response

func (*NoSessionServer) HandleSampleApa

HandleSampleApa records sampleapa and responds with the programmed response

func (*NoSessionServer) HandleSampleCheck

HandleSampleCheck records samplecheck and responds with the programmed response

func (*NoSessionServer) HandleSampleQuota

HandleSampleQuota records samplequota and responds with the programmed response

func (*NoSessionServer) HandleSampleReport

HandleSampleReport records samplereport and responds with the programmed response

func (*NoSessionServer) Run

func (s *NoSessionServer) Run()

Run starts the server run

func (*NoSessionServer) Wait

func (s *NoSessionServer) Wait() error

Wait waits for server to stop

type Requests

type Requests struct {
	ValidateRequest []*adptModel.ValidateRequest

	CreateSessionRequest []*adptModel.CreateSessionRequest

	CloseSessionRequest []*adptModel.CloseSessionRequest

	HandleMetricRequest []*metric.HandleMetricRequest

	HandleListEntryRequest []*listentry.HandleListEntryRequest

	HandleQuotaRequest []*quota.HandleQuotaRequest

	HandleSampleCheckRequest []*checkTmpl.HandleSampleCheckRequest

	HandleSampleQuotaRequest []*quotaTmpl.HandleSampleQuotaRequest

	HandleSampleReportRequest []*reportTmpl.HandleSampleReportRequest

	HandleSampleApaRequest []*apaTmpl.HandleSampleApaRequest
	// contains filtered or unexported fields
}

Requests record captured requests by the spy

type Server

type Server interface {
	Addr() net.Addr
	Close() error
	Run()
	GetCapturedCalls() []spyadapter.CapturedCall
}

Server is basic server interface

func NewNoSessionServer

func NewNoSessionServer(a *Args) (Server, error)

NewNoSessionServer creates a new no session server from given args.

Jump to

Keyboard shortcuts

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