Documentation
¶
Index ¶
Constants ¶
const ( // ActionSendHTTPMethodPOST captures enum value "POST" ActionSendHTTPMethodPOST string = "POST" // ActionSendHTTPMethodGET captures enum value "GET" ActionSendHTTPMethodGET string = "GET" // ActionSendHTTPMethodDELETE captures enum value "DELETE" ActionSendHTTPMethodDELETE string = "DELETE" // ActionSendHTTPMethodPUT captures enum value "PUT" ActionSendHTTPMethodPUT string = "PUT" // ActionSendHTTPMethodOPTIONS captures enum value "OPTIONS" ActionSendHTTPMethodOPTIONS string = "OPTIONS" // ActionSendHTTPMethodHEAD captures enum value "HEAD" ActionSendHTTPMethodHEAD string = "HEAD" )
const ( // ExpectHTTPMethodPOST captures enum value "POST" ExpectHTTPMethodPOST string = "POST" // ExpectHTTPMethodGET captures enum value "GET" ExpectHTTPMethodGET string = "GET" // ExpectHTTPMethodDELETE captures enum value "DELETE" ExpectHTTPMethodDELETE string = "DELETE" // ExpectHTTPMethodPUT captures enum value "PUT" ExpectHTTPMethodPUT string = "PUT" // ExpectHTTPMethodOPTIONS captures enum value "OPTIONS" ExpectHTTPMethodOPTIONS string = "OPTIONS" // ExpectHTTPMethodHEAD captures enum value "HEAD" ExpectHTTPMethodHEAD string = "HEAD" )
const ( // MockKindBehavior captures enum value "Behavior" MockKindBehavior string = "Behavior" // MockKindAbstractBehavior captures enum value "AbstractBehavior" MockKindAbstractBehavior string = "AbstractBehavior" // MockKindTemplate captures enum value "Template" MockKindTemplate string = "Template" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionDispatcher ¶
type ActionDispatcher struct {
// used to explicitly order the actions run when a behavior triggers
Order int64 `json:"order,omitempty"`
// publish amqp
PublishAmqp *ActionPublishAMQP `json:"publish_amqp,omitempty"`
// publish kafka
PublishKafka *ActionPublishKafka `json:"publish_kafka,omitempty"`
// redis
Redis ActionRedis `json:"redis,omitempty"`
// reply grpc
ReplyGrpc *ActionReplyGRPC `json:"reply_grpc,omitempty"`
// reply http
ReplyHTTP *ActionReplyHTTP `json:"reply_http,omitempty"`
// send http
SendHTTP *ActionSendHTTP `json:"send_http,omitempty"`
// sleep
Sleep *ActionSleep `json:"sleep,omitempty"`
}
ActionDispatcher action dispatcher
swagger:model ActionDispatcher
func (*ActionDispatcher) MarshalBinary ¶
func (m *ActionDispatcher) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ActionDispatcher) UnmarshalBinary ¶
func (m *ActionDispatcher) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ActionPublishAMQP ¶
type ActionPublishAMQP struct {
// AMQP exchange name
Exchange string `json:"exchange,omitempty"`
// string payload to send on AMQP
Payload string `json:"payload,omitempty"`
// file path (relative to OPENMOCK_TEMPLATES_DIR of OM) to load body from
PayloadFromFile string `json:"payload_from_file,omitempty"`
// AMQP routing key
RoutingKey string `json:"routing_key,omitempty"`
}
ActionPublishAMQP publish a message on AMQP if this behaviors condition is met
swagger:model ActionPublishAMQP
func (*ActionPublishAMQP) MarshalBinary ¶
func (m *ActionPublishAMQP) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ActionPublishAMQP) UnmarshalBinary ¶
func (m *ActionPublishAMQP) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ActionPublishKafka ¶
type ActionPublishKafka struct {
// string payload to send on AMQP
Payload string `json:"payload,omitempty"`
// file path (relative to OPENMOCK_TEMPLATES_DIR of OM) to load body from
PayloadFromFile string `json:"payload_from_file,omitempty"`
// kafka topic to publish on
Topic string `json:"topic,omitempty"`
}
ActionPublishKafka publish a message on kafka
swagger:model ActionPublishKafka
func (*ActionPublishKafka) MarshalBinary ¶
func (m *ActionPublishKafka) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ActionPublishKafka) UnmarshalBinary ¶
func (m *ActionPublishKafka) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ActionRedis ¶
type ActionRedis []string
ActionRedis a list of redis commands to run when the
swagger:model ActionRedis
type ActionReplyGRPC ¶ added in v0.3.0
type ActionReplyGRPC struct {
// map of string to string specifying gRPC headers to attach to our message
Headers interface{} `json:"headers,omitempty"`
// string payload to send via GRPC, this should be a json string that maps to the protobuf response object
Payload string `json:"payload,omitempty"`
// file path (relative to OPENMOCK_TEMPLATES_DIR of OM) to load payload from, this should be a json string that maps to the protobuf response object
PayloadFromFile string `json:"payload_from_file,omitempty"`
}
ActionReplyGRPC reply to incoming GRPC that triggered this behavior with a response
swagger:model ActionReplyGRPC
func (*ActionReplyGRPC) MarshalBinary ¶ added in v0.3.0
func (m *ActionReplyGRPC) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ActionReplyGRPC) UnmarshalBinary ¶ added in v0.3.0
func (m *ActionReplyGRPC) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ActionReplyHTTP ¶
type ActionReplyHTTP struct {
// Text body to send over HTTP, can use templating
Body string `json:"body,omitempty"`
// file name (relative to working directory of OM) to load HTTP body from
BodyFromFile string `json:"body_from_file,omitempty"`
// map of string to string specifying HTTP headers to attach to our message
Headers interface{} `json:"headers,omitempty"`
// HTTP status code to reply with
StatusCode *int64 `json:"status_code,omitempty"`
}
ActionReplyHTTP reply to incoming HTTP that triggered this behavior with a response
swagger:model ActionReplyHTTP
func (*ActionReplyHTTP) MarshalBinary ¶
func (m *ActionReplyHTTP) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ActionReplyHTTP) UnmarshalBinary ¶
func (m *ActionReplyHTTP) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ActionSendHTTP ¶
type ActionSendHTTP struct {
// Text body to send over HTTP, can use templating
Body string `json:"body,omitempty"`
// file path (relative to OPENMOCK_TEMPLATES_DIR of OM) to load HTTP body from
BodyFromFile string `json:"body_from_file,omitempty"`
// map of string to string specifying HTTP headers to attach to our message
Headers interface{} `json:"headers,omitempty"`
// HTTP method to use for the send
// Enum: [POST GET DELETE PUT OPTIONS HEAD]
Method string `json:"method,omitempty"`
// The URL to send HTTP to
URL string `json:"url,omitempty"`
}
ActionSendHTTP Send a HTTP message as an action
swagger:model ActionSendHTTP
func (*ActionSendHTTP) MarshalBinary ¶
func (m *ActionSendHTTP) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ActionSendHTTP) UnmarshalBinary ¶
func (m *ActionSendHTTP) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ActionSleep ¶
type ActionSleep struct {
// time to wait in seconds; e.g. '1s'
Duration string `json:"duration,omitempty"`
}
ActionSleep pause the action thread for a time
swagger:model ActionSleep
func (*ActionSleep) MarshalBinary ¶
func (m *ActionSleep) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ActionSleep) UnmarshalBinary ¶
func (m *ActionSleep) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type Error ¶
type Error struct {
// message
// Min Length: 1
Message string `json:"message,omitempty"`
}
Error error
swagger:model error
func (*Error) MarshalBinary ¶
MarshalBinary interface implementation
func (*Error) UnmarshalBinary ¶
UnmarshalBinary interface implementation
type Expect ¶
type Expect struct {
// amqp
Amqp *ExpectAMQP `json:"amqp,omitempty"`
// a go template that determines if this behavior triggers
Condition string `json:"condition,omitempty"`
// grpc
Grpc *ExpectGRPC `json:"grpc,omitempty"`
// http
HTTP *ExpectHTTP `json:"http,omitempty"`
// kafka
Kafka *ExpectKafka `json:"kafka,omitempty"`
}
Expect expect
swagger:model Expect
func (*Expect) MarshalBinary ¶
MarshalBinary interface implementation
func (*Expect) UnmarshalBinary ¶
UnmarshalBinary interface implementation
type ExpectAMQP ¶
type ExpectAMQP struct {
// TODO
Exchange string `json:"exchange,omitempty"`
// TODO
Queue string `json:"queue,omitempty"`
// TODO
RoutingKey string `json:"routing_key,omitempty"`
}
ExpectAMQP expect a m q p
swagger:model ExpectAMQP
func (*ExpectAMQP) MarshalBinary ¶
func (m *ExpectAMQP) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExpectAMQP) UnmarshalBinary ¶
func (m *ExpectAMQP) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ExpectGRPC ¶ added in v0.3.0
type ExpectGRPC struct {
// GRPC method to expect to trigger this behavior
Method string `json:"method,omitempty"`
// GRPC service to expect to trigger this behavior
Service string `json:"service,omitempty"`
}
ExpectGRPC expect g RPC
swagger:model ExpectGRPC
func (*ExpectGRPC) MarshalBinary ¶ added in v0.3.0
func (m *ExpectGRPC) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExpectGRPC) UnmarshalBinary ¶ added in v0.3.0
func (m *ExpectGRPC) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ExpectHTTP ¶
type ExpectHTTP struct {
// HTTP method to expect to trigger this behavior
// Enum: [POST GET DELETE PUT OPTIONS HEAD]
Method string `json:"method,omitempty"`
// HTTP path to expect to trigger this behavior
Path string `json:"path,omitempty"`
}
ExpectHTTP expect HTTP
swagger:model ExpectHTTP
func (*ExpectHTTP) MarshalBinary ¶
func (m *ExpectHTTP) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExpectHTTP) UnmarshalBinary ¶
func (m *ExpectHTTP) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ExpectKafka ¶
type ExpectKafka struct {
// kafka topic to listen on
Topic string `json:"topic,omitempty"`
}
ExpectKafka expect kafka
swagger:model ExpectKafka
func (*ExpectKafka) MarshalBinary ¶
func (m *ExpectKafka) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ExpectKafka) UnmarshalBinary ¶
func (m *ExpectKafka) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type Health ¶
type Health struct {
// status
Status string `json:"status,omitempty"`
}
Health health
swagger:model health
func (*Health) MarshalBinary ¶
MarshalBinary interface implementation
func (*Health) UnmarshalBinary ¶
UnmarshalBinary interface implementation
type Mock ¶
type Mock struct {
// for behaviors, the actions this mock would do when the expect is met
Actions []*ActionDispatcher `json:"actions"`
// expect
Expect *Expect `json:"expect,omitempty"`
// for behaviors, makes this behavior extend a specified AbstractBehavior
Extend string `json:"extend,omitempty"`
// Unique key for the item in OM's model
// Pattern: [\w_\-\.]+
Key string `json:"key,omitempty"`
// The type of item this is. possible types are: Behavior - creates a new mock behavior AbstractBehavior - allows behaviors to use common features from this item Template - used in template language rendering to do fancy stuff
//
// Enum: [Behavior AbstractBehavior Template]
Kind string `json:"kind,omitempty"`
// a go template to be embedded in other templates
Template string `json:"template,omitempty"`
// Arbitrary values that can be used in go templates rendered by this item
Values interface{} `json:"values,omitempty"`
}
Mock mock
swagger:model Mock
func (*Mock) MarshalBinary ¶
MarshalBinary interface implementation
func (*Mock) UnmarshalBinary ¶
UnmarshalBinary interface implementation