models

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateResponseDelayPayload added in v0.9.0

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

Types

type CachedResponse added in v0.11.0

type CachedResponse struct {
	Request      RequestDetails
	MatchingPair *RequestMatcherResponsePair
	HeaderMatch  bool
}

func NewCachedResponseFromBytes added in v0.11.0

func NewCachedResponseFromBytes(data []byte) (*CachedResponse, error)

func (CachedResponse) Encode added in v0.11.0

func (this CachedResponse) Encode() ([]byte, error)

type RequestDetails

type RequestDetails struct {
	Path        string
	Method      string
	Destination string
	Scheme      string
	Query       string
	Body        string
	Headers     map[string][]string
}

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.RequestDetailsViewV1

func (*RequestDetails) Hash

func (r *RequestDetails) Hash() string

func (*RequestDetails) HashWithoutHost

func (r *RequestDetails) HashWithoutHost() string

type RequestFieldMatchers added in v0.11.0

type RequestFieldMatchers struct {
	ExactMatch    *string
	XmlMatch      *string
	XpathMatch    *string
	JsonMatch     *string
	JsonPathMatch *string
	RegexMatch    *string
	GlobMatch     *string
}

func NewRequestFieldMatchersFromView added in v0.11.0

func NewRequestFieldMatchersFromView(matchers *v2.RequestFieldMatchersView) *RequestFieldMatchers

func (RequestFieldMatchers) BuildView added in v0.11.0

type RequestMatcher added in v0.11.0

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

func (RequestMatcher) BuildRequestDetailsFromExactMatches added in v0.11.0

func (this RequestMatcher) BuildRequestDetailsFromExactMatches() *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.RequestResponsePairViewV2) *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 ResponseDelays added in v0.7.1

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

type ResponseDetails

type ResponseDetails struct {
	Status  int
	Body    string
	Headers map[string][]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 appriopriate 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.

type Simulation added in v0.10.2

type Simulation struct {
	MatchingPairs  []RequestMatcherResponsePair
	ResponseDelays ResponseDelays
}

func NewSimulation added in v0.10.2

func NewSimulation() *Simulation

func (*Simulation) AddRequestMatcherResponsePair added in v0.11.0

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

Jump to

Keyboard shortcuts

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