Help us shape the future of Go! Take the 2026 Go Developer Survey

models

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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"
)
View Source
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

func (*ActionDispatcher) Validate

func (m *ActionDispatcher) Validate(formats strfmt.Registry) error

Validate validates this action dispatcher

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

func (*ActionPerformed) Validate added in v0.3.2

func (m *ActionPerformed) Validate(formats strfmt.Registry) error

Validate validates this action performed

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

func (*ActionPublishAMQP) Validate

func (m *ActionPublishAMQP) Validate(formats strfmt.Registry) error

Validate validates this action publish a m q p

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

func (*ActionPublishKafka) Validate

func (m *ActionPublishKafka) Validate(formats strfmt.Registry) error

Validate validates this action publish kafka

type ActionRedis

type ActionRedis []string

ActionRedis a list of redis commands to run when the

swagger:model ActionRedis

func (ActionRedis) Validate

func (m ActionRedis) Validate(formats strfmt.Registry) error

Validate validates this action redis

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

func (*ActionReplyGRPC) Validate added in v0.3.0

func (m *ActionReplyGRPC) Validate(formats strfmt.Registry) error

Validate validates this action reply g RPC

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

func (*ActionReplyHTTP) Validate

func (m *ActionReplyHTTP) Validate(formats strfmt.Registry) error

Validate validates this action reply HTTP

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

func (*ActionSendHTTP) Validate

func (m *ActionSendHTTP) Validate(formats strfmt.Registry) error

Validate validates this action send HTTP

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

func (*ActionSleep) Validate

func (m *ActionSleep) Validate(formats strfmt.Registry) error

Validate validates this action sleep

type Error

type Error struct {

	// message
	// Min Length: 1
	Message string `json:"message,omitempty"`
}

Error error

swagger:model error

func (*Error) MarshalBinary

func (m *Error) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*Error) UnmarshalBinary

func (m *Error) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*Error) Validate

func (m *Error) Validate(formats strfmt.Registry) error

Validate validates this error

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

func (*EvalContext) Validate added in v0.3.2

func (m *EvalContext) Validate(formats strfmt.Registry) error

Validate validates this eval context

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

func (*EvalHTTPContext) Validate added in v0.3.2

func (m *EvalHTTPContext) Validate(formats strfmt.Registry) error

Validate validates this eval HTTP context

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

func (*EvalKafkaContext) Validate added in v0.3.2

func (m *EvalKafkaContext) Validate(formats strfmt.Registry) error

Validate validates this eval kafka context

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

func (m *Expect) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*Expect) UnmarshalBinary

func (m *Expect) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*Expect) Validate

func (m *Expect) Validate(formats strfmt.Registry) error

Validate validates this expect

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

func (*ExpectAMQP) Validate

func (m *ExpectAMQP) Validate(formats strfmt.Registry) error

Validate validates this expect a m q p

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

func (*ExpectGRPC) Validate added in v0.3.0

func (m *ExpectGRPC) Validate(formats strfmt.Registry) error

Validate validates this expect g RPC

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

func (*ExpectHTTP) Validate

func (m *ExpectHTTP) Validate(formats strfmt.Registry) error

Validate validates this expect HTTP

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

func (*ExpectKafka) Validate

func (m *ExpectKafka) Validate(formats strfmt.Registry) error

Validate validates this expect kafka

type Health

type Health struct {

	// status
	Status string `json:"status,omitempty"`
}

Health health

swagger:model health

func (*Health) MarshalBinary

func (m *Health) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*Health) UnmarshalBinary

func (m *Health) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*Health) Validate

func (m *Health) Validate(formats strfmt.Registry) error

Validate validates this health

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

func (m *Mock) MarshalBinary() ([]byte, error)

MarshalBinary interface implementation

func (*Mock) UnmarshalBinary

func (m *Mock) UnmarshalBinary(b []byte) error

UnmarshalBinary interface implementation

func (*Mock) Validate

func (m *Mock) Validate(formats strfmt.Registry) error

Validate validates this mock

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

func (*MockEvalRequest) Validate added in v0.3.2

func (m *MockEvalRequest) Validate(formats strfmt.Registry) error

Validate validates this mock eval request

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

func (*MockEvalResponse) Validate added in v0.3.2

func (m *MockEvalResponse) Validate(formats strfmt.Registry) error

Validate validates this mock eval response

type Mocks

type Mocks []*Mock

Mocks collection of mocks

swagger:model Mocks

func (Mocks) Validate

func (m Mocks) Validate(formats strfmt.Registry) error

Validate validates this mocks

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

func (*PublishKafkaActionPerformed) Validate added in v0.3.2

func (m *PublishKafkaActionPerformed) Validate(formats strfmt.Registry) error

Validate validates this publish kafka action performed

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

func (*ReplyHTTPActionPerformed) Validate added in v0.3.2

func (m *ReplyHTTPActionPerformed) Validate(formats strfmt.Registry) error

Validate validates this reply HTTP action performed

Jump to

Keyboard shortcuts

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