models

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2016 License: Apache-2.0 Imports: 17 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateResponseDelayJson

func ValidateResponseDelayJson(j ResponseDelayJson) (err error)

Types

type Payload

type Payload struct {
	Response ResponseDetails `json:"response"`
	Request  RequestDetails  `json:"request"`
}

Payload structure holds request and response structure

func NewPayloadFromBytes

func NewPayloadFromBytes(data []byte) (*Payload, error)

NewPayloadFromBytes decodes supplied bytes into Payload structure

func NewPayloadFromPayloadView added in v0.8.0

func NewPayloadFromPayloadView(data views.PayloadView) Payload

func (*Payload) ConvertToPayloadView

func (p *Payload) ConvertToPayloadView() *views.PayloadView

func (*Payload) Encode

func (p *Payload) Encode() ([]byte, error)

Encode method encodes all exported Payload fields to bytes

func (Payload) Id

func (p Payload) Id() string

func (Payload) IdWithoutHost

func (p Payload) IdWithoutHost() string

type RequestDetails

type RequestDetails struct {
	Path        string              `json:"path"`
	Method      string              `json:"method"`
	Destination string              `json:"destination"`
	Scheme      string              `json:"scheme"`
	Query       string              `json:"query"`
	Body        string              `json:"body"`
	Headers     map[string][]string `json:"headers"`
}

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

func NewRequestDetailsFromRequestDetailsView added in v0.8.0

func NewRequestDetailsFromRequestDetailsView(data views.RequestDetailsView) RequestDetails

func (*RequestDetails) ConvertToRequestDetailsView

func (r *RequestDetails) ConvertToRequestDetailsView() views.RequestDetailsView

func (*RequestDetails) Hash

func (r *RequestDetails) Hash() string

func (*RequestDetails) HashWithoutHost

func (r *RequestDetails) HashWithoutHost() string

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 ResponseDelayJson

type ResponseDelayJson struct {
	Data *ResponseDelayList `json:"data"`
}

type ResponseDelayList added in v0.7.1

type ResponseDelayList []ResponseDelay

func (*ResponseDelayList) GetDelay added in v0.7.1

func (this *ResponseDelayList) GetDelay(url, httpMethod string) *ResponseDelay

func (*ResponseDelayList) Json added in v0.7.1

func (this *ResponseDelayList) Json() []byte

func (*ResponseDelayList) Len added in v0.7.1

func (this *ResponseDelayList) Len() int

type ResponseDelays added in v0.7.1

type ResponseDelays interface {
	Json() []byte
	GetDelay(url, httpMethod string) *ResponseDelay
	Len() int
}

type ResponseDetails

type ResponseDetails struct {
	Status  int                 `json:"status"`
	Body    string              `json:"body"`
	Headers map[string][]string `json:"headers"`
}

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 NewResponseDetialsFromResponseDetailsView added in v0.8.0

func NewResponseDetialsFromResponseDetailsView(data views.ResponseDetailsView) ResponseDetails

func (*ResponseDetails) ConvertToResponseDetailsView

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

Jump to

Keyboard shortcuts

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