models

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: Apache-2.0 Imports: 26 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRequestFieldMatchersFromMapView added in v0.17.0

func NewRequestFieldMatchersFromMapView(mapMatchers map[string][]v2.MatcherViewV5) map[string][]RequestFieldMatchers

func ValidateResponseDelayLogNormalPayload added in v1.0.0

func ValidateResponseDelayLogNormalPayload(j v1.ResponseDelayLogNormalPayloadView) (err error)

func ValidateResponseDelayPayload added in v0.9.0

func ValidateResponseDelayPayload(j v1.ResponseDelayPayloadView) (err error)

func ValidateVariablePayload added in v1.5.0

func ValidateVariablePayload(variables []v2.GlobalVariableViewV5, helperMethodMap map[string]interface{}) (err error)

Types

type CachedResponse added in v0.11.0

type CachedResponse struct {
	Request                  RequestDetails
	MatchingPair             *RequestMatcherResponsePair
	ClosestMiss              *ClosestMiss
	ResponseStateTemplates   map[string]*raymond.Template
	ResponseTemplate         *raymond.Template
	ResponseHeadersTemplates map[string][]*raymond.Template
}

type ClosestMiss added in v0.12.0

type ClosestMiss struct {
	RequestDetails RequestDetails
	Response       v2.ResponseDetailsViewV5
	RequestMatcher v2.RequestMatcherViewV5
	MissedFields   []string
	State          map[string]string
}

func (*ClosestMiss) BuildView added in v0.12.0

func (this *ClosestMiss) BuildView() *v2.ClosestMissView

func (*ClosestMiss) GetMessage added in v0.12.0

func (this *ClosestMiss) GetMessage() string

type DelayGenerator added in v1.0.0

type DelayGenerator interface {
	GenerateDelay() int
}

type Literal added in v1.5.0

type Literal struct {
	Name  string
	Value interface{}
}

type Literals added in v1.5.0

type Literals []Literal

func ImportLiterals added in v1.5.0

func ImportLiterals(literals []v2.GlobalLiteralViewV5) *Literals

func (*Literals) ConvertToGlobalLiteralsPayloadView added in v1.5.0

func (literals *Literals) ConvertToGlobalLiteralsPayloadView() []v2.GlobalLiteralViewV5

type MatchError added in v0.12.2

type MatchError struct {
	ClosestMiss *ClosestMiss
	// contains filtered or unexported fields
}

func NewMatchError added in v0.12.2

func NewMatchError(error string) *MatchError

func NewMatchErrorWithClosestMiss added in v0.12.2

func NewMatchErrorWithClosestMiss(closestMiss *ClosestMiss, error string) *MatchError

func (MatchError) Error added in v0.12.2

func (this MatchError) Error() string

type QueryRequestFieldMatchers added in v0.17.3

type QueryRequestFieldMatchers map[string][]RequestFieldMatchers

func NewQueryRequestFieldMatchersFromMapView added in v0.17.3

func NewQueryRequestFieldMatchersFromMapView(mapMatchers *v2.QueryMatcherViewV5) *QueryRequestFieldMatchers

func (*QueryRequestFieldMatchers) Add added in v0.17.3

func (*QueryRequestFieldMatchers) Get added in v1.3.5

type RequestDetails

type RequestDetails struct {
	Path        string
	Method      string
	Destination string
	Scheme      string
	Query       map[string][]string
	Body        string
	FormData    map[string][]string
	Headers     map[string][]string
	// contains filtered or unexported fields
}

RequestDetails stores information about request, it's used for creating unique hash and also as a payload structure

func NewRequestDetailsFromHttpRequest added in v0.8.2

func NewRequestDetailsFromHttpRequest(req *http.Request) (RequestDetails, error)

func NewRequestDetailsFromRequest added in v0.9.0

func NewRequestDetailsFromRequest(data interfaces.Request) RequestDetails

func (*RequestDetails) ConvertToRequestDetailsView

func (this *RequestDetails) ConvertToRequestDetailsView() v2.RequestDetailsView

func (RequestDetails) GetRawQuery added in v0.14.1

func (this RequestDetails) GetRawQuery() string

func (*RequestDetails) Hash

func (r *RequestDetails) Hash() string

func (*RequestDetails) HashWithoutHost

func (r *RequestDetails) HashWithoutHost() string

func (*RequestDetails) QueryString added in v0.13.0

func (this *RequestDetails) QueryString() string

TODO: Remove this This only exists as there are parts of Hoverfly that still require the request query parameters to be a string and not a map

type RequestFieldMatchers added in v0.11.0

type RequestFieldMatchers struct {
	Matcher string
	Value   interface{}
	Config  map[string]interface{}
	DoMatch *RequestFieldMatchers
}

func NewRequestFieldMatchersFromView added in v0.11.0

func NewRequestFieldMatchersFromView(matchers []v2.MatcherViewV5) []RequestFieldMatchers

func (RequestFieldMatchers) BuildView added in v0.11.0

func (this RequestFieldMatchers) BuildView() v2.MatcherViewV5

type RequestMatcher added in v0.11.0

type RequestMatcher struct {
	Path            []RequestFieldMatchers
	Method          []RequestFieldMatchers
	Destination     []RequestFieldMatchers
	Scheme          []RequestFieldMatchers
	DeprecatedQuery []RequestFieldMatchers
	Body            []RequestFieldMatchers
	Headers         map[string][]RequestFieldMatchers
	Query           *QueryRequestFieldMatchers
	RequiresState   map[string]string
}

func (RequestMatcher) IncludesHeaderMatching added in v0.12.2

func (this RequestMatcher) IncludesHeaderMatching() bool

func (RequestMatcher) IncludesStateMatching added in v0.14.0

func (this RequestMatcher) IncludesStateMatching() bool

func (RequestMatcher) ToEagerlyCacheable added in v1.3.4

func (this RequestMatcher) ToEagerlyCacheable() *RequestDetails

type RequestMatcherResponsePair added in v0.11.0

type RequestMatcherResponsePair struct {
	RequestMatcher RequestMatcher
	Response       ResponseDetails
}

func NewRequestMatcherResponsePairFromView added in v0.11.0

func NewRequestMatcherResponsePairFromView(view *v2.RequestMatcherResponsePairViewV5) *RequestMatcherResponsePair

func (*RequestMatcherResponsePair) BuildView added in v0.11.0

type RequestResponsePair added in v0.8.1

type RequestResponsePair struct {
	Response ResponseDetails
	Request  RequestDetails
}

Payload structure holds request and response structure

func NewRequestResponsePairFromRequestResponsePairView added in v0.8.1

func NewRequestResponsePairFromRequestResponsePairView(pairView interfaces.RequestResponsePair) RequestResponsePair

func (*RequestResponsePair) ConvertToRequestResponsePairView added in v0.8.1

func (this *RequestResponsePair) ConvertToRequestResponsePairView() v2.RequestResponsePairViewV1

type ResponseDelay

type ResponseDelay struct {
	UrlPattern string `json:"urlPattern"`
	HttpMethod string `json:"httpMethod"`
	Delay      int    `json:"delay"`
}

func (*ResponseDelay) Execute

func (this *ResponseDelay) Execute()

type ResponseDelayList added in v0.7.1

type ResponseDelayList []ResponseDelay

func (ResponseDelayList) ConvertToResponseDelayPayloadView added in v0.9.0

func (this ResponseDelayList) ConvertToResponseDelayPayloadView() v1.ResponseDelayPayloadView

func (*ResponseDelayList) GetDelay added in v0.7.1

func (this *ResponseDelayList) GetDelay(request RequestDetails) *ResponseDelay

type ResponseDelayLogNormal added in v1.0.0

type ResponseDelayLogNormal struct {
	UrlPattern     string         `json:"urlPattern"`
	HttpMethod     string         `json:"httpMethod"`
	DelayGenerator DelayGenerator `json:"-"`
	Min            int            `json:"min"`
	Max            int            `json:"max"`
	Mean           int            `json:"mean"`
	Median         int            `json:"median"`
}

func (*ResponseDelayLogNormal) Execute added in v1.0.0

func (this *ResponseDelayLogNormal) Execute()

type ResponseDelayLogNormalList added in v1.0.0

type ResponseDelayLogNormalList []ResponseDelayLogNormal

func (ResponseDelayLogNormalList) ConvertToResponseDelayLogNormalPayloadView added in v1.0.0

func (this ResponseDelayLogNormalList) ConvertToResponseDelayLogNormalPayloadView() v1.ResponseDelayLogNormalPayloadView

func (*ResponseDelayLogNormalList) GetDelay added in v1.0.0

type ResponseDelays added in v0.7.1

type ResponseDelays interface {
	GetDelay(request RequestDetails) *ResponseDelay
	ConvertToResponseDelayPayloadView() v1.ResponseDelayPayloadView
}

type ResponseDelaysLogNormal added in v1.0.0

type ResponseDelaysLogNormal interface {
	GetDelay(request RequestDetails) *ResponseDelayLogNormal
	ConvertToResponseDelayLogNormalPayloadView() v1.ResponseDelayLogNormalPayloadView
}

type ResponseDetails

type ResponseDetails struct {
	Status           int
	Body             string
	BodyFile         string
	Headers          map[string][]string
	Templated        bool
	TransitionsState map[string]string
	RemovesState     []string
	FixedDelay       int
	LogNormalDelay   *ResponseDetailsLogNormal
	PostServeAction  string
}

ResponseDetails structure hold response body from external service, body is not decoded and is supposed to be bytes, however headers should provide all required information for later decoding by the client.

func NewResponseDetailsFromResponse added in v0.9.0

func NewResponseDetailsFromResponse(data interfaces.Response) ResponseDetails

func (*ResponseDetails) ConvertToResponseDetailsView

func (r *ResponseDetails) ConvertToResponseDetailsView() v2.ResponseDetailsView

This function will create a JSON appropriate version of ResponseDetails for the v2 API If the response headers indicate that the content is encoded, or it has a non-matching supported mimetype, we base64 encode it.

func (*ResponseDetails) ConvertToResponseDetailsViewV5 added in v0.17.0

func (r *ResponseDetails) ConvertToResponseDetailsViewV5() v2.ResponseDetailsViewV5

type ResponseDetailsLogNormal added in v1.3.0

type ResponseDetailsLogNormal struct {
	Min    int
	Max    int
	Mean   int
	Median int
}

type Simulation added in v0.10.2

type Simulation struct {
	ResponseDelays          ResponseDelays
	ResponseDelaysLogNormal ResponseDelaysLogNormal
	Vars                    *Variables
	Literals                *Literals
	RWMutex                 sync.RWMutex
	// contains filtered or unexported fields
}

func NewSimulation added in v0.10.2

func NewSimulation() *Simulation

func (*Simulation) AddLiterals added in v1.5.0

func (this *Simulation) AddLiterals(literals *Literals)

func (*Simulation) AddPair added in v0.17.0

func (this *Simulation) AddPair(pair *RequestMatcherResponsePair) bool

Return a boolean indicates if the pair is added or not.

func (*Simulation) AddPairInSequence added in v0.17.0

func (this *Simulation) AddPairInSequence(pair *RequestMatcherResponsePair, state *state.State)

func (*Simulation) AddPairWithOverwritingDuplicate added in v1.1.1

func (this *Simulation) AddPairWithOverwritingDuplicate(pair *RequestMatcherResponsePair) bool

func (*Simulation) AddPairWithoutCheck added in v1.1.0

func (this *Simulation) AddPairWithoutCheck(pair *RequestMatcherResponsePair)

func (*Simulation) AddVariables added in v1.5.0

func (this *Simulation) AddVariables(variables *Variables)

func (*Simulation) DeleteMatchingPairsAlongWithCustomData added in v1.5.0

func (this *Simulation) DeleteMatchingPairsAlongWithCustomData()

func (*Simulation) GetMatchingPairs added in v0.14.2

func (this *Simulation) GetMatchingPairs() []RequestMatcherResponsePair

type Variable added in v1.5.0

type Variable struct {
	Name      string
	Function  string
	Arguments []interface{}
}

type Variables added in v1.5.0

type Variables []Variable

func ImportVariables added in v1.5.0

func ImportVariables(variables []v2.GlobalVariableViewV5) *Variables

func (*Variables) ConvertToGlobalVariablesPayloadView added in v1.5.0

func (variables *Variables) ConvertToGlobalVariablesPayloadView() []v2.GlobalVariableViewV5

Jump to

Keyboard shortcuts

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