 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- type ActionDispatcher
- type ActionPerformed
- type ActionPublishAMQP
- type ActionPublishKafka
- type ActionRedis
- type ActionReplyGRPC
- type ActionReplyHTTP
- type ActionSendHTTP
- type ActionSleep
- type Error
- type EvalContext
- type EvalHTTPContext
- type EvalKafkaContext
- type Expect
- type ExpectAMQP
- type ExpectGRPC
- type ExpectHTTP
- type ExpectKafka
- type Health
- type Mock
- type MockEvalRequest
- type MockEvalResponse
- type Mocks
- type PublishKafkaActionPerformed
- type ReplyHTTPActionPerformed
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 ActionPerformed ¶ added in v0.3.2
type ActionPerformed struct {
	// publish kafka action performed
	PublishKafkaActionPerformed *PublishKafkaActionPerformed `json:"publish_kafka_action_performed,omitempty"`
	// reply http action performed
	ReplyHTTPActionPerformed *ReplyHTTPActionPerformed `json:"reply_http_action_performed,omitempty"`
}
    ActionPerformed when evaluating a mock, an object capturing what would happen if the mock's action is performed
swagger:model ActionPerformed
func (*ActionPerformed) MarshalBinary ¶ added in v0.3.2
func (m *ActionPerformed) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ActionPerformed) UnmarshalBinary ¶ added in v0.3.2
func (m *ActionPerformed) 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 EvalContext ¶ added in v0.3.2
type EvalContext struct {
	// http context
	HTTPContext *EvalHTTPContext `json:"http_context,omitempty"`
	// kafka context
	KafkaContext *EvalKafkaContext `json:"kafka_context,omitempty"`
}
    EvalContext when evaluating a mock, the input context to evaluate. Contains subfields specific to each channel openmock supports
swagger:model EvalContext
func (*EvalContext) MarshalBinary ¶ added in v0.3.2
func (m *EvalContext) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*EvalContext) UnmarshalBinary ¶ added in v0.3.2
func (m *EvalContext) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type EvalHTTPContext ¶ added in v0.3.2
type EvalHTTPContext struct {
	// body
	Body string `json:"body,omitempty"`
	// headers
	Headers interface{} `json:"headers,omitempty"`
	// method
	Method string `json:"method,omitempty"`
	// path
	Path string `json:"path,omitempty"`
	// query string
	QueryString string `json:"query_string,omitempty"`
}
    EvalHTTPContext input context for ExpectHTTP mock
swagger:model EvalHTTPContext
func (*EvalHTTPContext) MarshalBinary ¶ added in v0.3.2
func (m *EvalHTTPContext) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*EvalHTTPContext) UnmarshalBinary ¶ added in v0.3.2
func (m *EvalHTTPContext) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type EvalKafkaContext ¶ added in v0.3.2
type EvalKafkaContext struct {
	// payload
	Payload string `json:"payload,omitempty"`
	// topic
	Topic string `json:"topic,omitempty"`
}
    EvalKafkaContext input context for ExpectKafka mock
swagger:model EvalKafkaContext
func (*EvalKafkaContext) MarshalBinary ¶ added in v0.3.2
func (m *EvalKafkaContext) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*EvalKafkaContext) UnmarshalBinary ¶ added in v0.3.2
func (m *EvalKafkaContext) UnmarshalBinary(b []byte) error
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
type MockEvalRequest ¶ added in v0.3.2
type MockEvalRequest struct {
	// The context to evaluate the mock
	Context *EvalContext `json:"context,omitempty"`
	// The mock to evaluate
	Mock *Mock `json:"mock,omitempty"`
}
    MockEvalRequest Request to evaluate a mock's behavior given an input context
swagger:model MockEvalRequest
func (*MockEvalRequest) MarshalBinary ¶ added in v0.3.2
func (m *MockEvalRequest) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*MockEvalRequest) UnmarshalBinary ¶ added in v0.3.2
func (m *MockEvalRequest) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type MockEvalResponse ¶ added in v0.3.2
type MockEvalResponse struct {
	// list of responses the mock performed (assuming the condition passed)
	ActionsPerformed []*ActionPerformed `json:"actions_performed"`
	// whether the condition passed when evaluated, so the actions would take place
	ConditionPassed bool `json:"condition_passed,omitempty"`
	// the rendered value of the mock's expect's condition when evaluating with the context
	ConditionRendered string `json:"condition_rendered,omitempty"`
	// whether the channel-specific condition of the evaluation passed. For example for a mock with ExpectHTTP, this returns true if the HTTP path and method in the input context matched the ExpectHTTP.
	ExpectPassed bool `json:"expect_passed,omitempty"`
}
    MockEvalResponse Result of evaluating mock, indicates what the mock would be expected to do given the input
swagger:model MockEvalResponse
func (*MockEvalResponse) MarshalBinary ¶ added in v0.3.2
func (m *MockEvalResponse) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*MockEvalResponse) UnmarshalBinary ¶ added in v0.3.2
func (m *MockEvalResponse) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type PublishKafkaActionPerformed ¶ added in v0.3.2
type PublishKafkaActionPerformed struct {
	// rendered payload
	Payload string `json:"payload,omitempty"`
	// the kafka topic to send to
	Topic string `json:"topic,omitempty"`
}
    PublishKafkaActionPerformed kafka reply info that would be replied when an evaluated mock did PublishKafka action
swagger:model PublishKafkaActionPerformed
func (*PublishKafkaActionPerformed) MarshalBinary ¶ added in v0.3.2
func (m *PublishKafkaActionPerformed) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*PublishKafkaActionPerformed) UnmarshalBinary ¶ added in v0.3.2
func (m *PublishKafkaActionPerformed) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
type ReplyHTTPActionPerformed ¶ added in v0.3.2
type ReplyHTTPActionPerformed struct {
	// body bytes-converted-to-string returned in HTTP reply
	Body string `json:"body,omitempty"`
	// the HTTP content-type of the reply
	ContentType string `json:"content_type,omitempty"`
	// Key-value pair HTTP headers attached to the reply
	Headers interface{} `json:"headers,omitempty"`
	// HTTP status code in the reply
	StatusCode string `json:"status_code,omitempty"`
}
    ReplyHTTPActionPerformed http info that would be replied when an evaluated mock did ReplyHTTP action
swagger:model ReplyHTTPActionPerformed
func (*ReplyHTTPActionPerformed) MarshalBinary ¶ added in v0.3.2
func (m *ReplyHTTPActionPerformed) MarshalBinary() ([]byte, error)
MarshalBinary interface implementation
func (*ReplyHTTPActionPerformed) UnmarshalBinary ¶ added in v0.3.2
func (m *ReplyHTTPActionPerformed) UnmarshalBinary(b []byte) error
UnmarshalBinary interface implementation
       Source Files
      ¶
      Source Files
      ¶
    
- action_dispatcher.go
- action_performed.go
- action_publish_a_m_q_p.go
- action_publish_kafka.go
- action_redis.go
- action_reply_g_rpc.go
- action_reply_http.go
- action_send_http.go
- action_sleep.go
- error.go
- eval_context.go
- eval_http_context.go
- eval_kafka_context.go
- expect.go
- expect_a_m_q_p.go
- expect_g_rpc.go
- expect_http.go
- expect_kafka.go
- health.go
- mock.go
- mock_eval_request.go
- mock_eval_response.go
- mocks.go
- publish_kafka_action_performed.go
- reply_http_action_performed.go