elevator

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	Type    string `yaml:"type"`
	Content any    `yaml:"content"`
}

func NewBody

func NewBody(contentType string, content any) Body

type Connection

type Connection struct {
	BaseURL string         `yaml:"baseUrl"`
	Timeout int            `yaml:"timeout"`
	Headers map[string]any `yaml:"headers"`
	Auth    ConnectionAuth `yaml:"auth"`
}

type ConnectionAuth

type ConnectionAuth struct {
	Type           string  `yaml:"type"`
	AccessTokenKey string  `yaml:"accessTokenKey"`
	Request        Request `yaml:"request"`
}

type Elevator

type Elevator struct {
	Config IntegrationConfig
}

func NewElevator

func NewElevator(integrationYmlPath string) Elevator

func (Elevator) AddBody

func (e Elevator) AddBody(body Body, room string, request string) Elevator

func (Elevator) AddHeader

func (e Elevator) AddHeader(header string, value string, room string) Elevator

func (Elevator) JsonData

func (e Elevator) JsonData() ([]byte, error)

type ElevatorEngine

type ElevatorEngine struct {
	Segment        segment.ISegment
	RoomContainers map[string]RoomContainer
	// contains filtered or unexported fields
}

func (*ElevatorEngine) CreateRequest

func (e *ElevatorEngine) CreateRequest(req Request) *room.Request

func (*ElevatorEngine) Execute

func (e *ElevatorEngine) Execute(roomKey, requestKey string) (room.Response, error)

func (*ElevatorEngine) ExecuteConcurrent

func (e *ElevatorEngine) ExecuteConcurrent(concurrentKey string, appliedRooms ...string) map[string]room.Response

func (*ElevatorEngine) GetElapsedTime

func (e *ElevatorEngine) GetElapsedTime() float64

func (*ElevatorEngine) PutBodyParser

func (e *ElevatorEngine) PutBodyParser(roomKey, requestKey string, bodyParser room.IBodyParser) IElevatorEngine

func (*ElevatorEngine) PutQuery

func (e *ElevatorEngine) PutQuery(roomKey, requestKey string, query room.IQuery) IElevatorEngine

func (*ElevatorEngine) WarmUp

func (e *ElevatorEngine) WarmUp() IElevatorEngine

TODO remove panics by a parameter

type Flat

type Flat struct {
	Rooms map[string]Room `yaml:"rooms"`
}

type IElevator

type IElevator interface {
	AddBody(body Body, room string, request string) Elevator
	AddHeader(header string, value string, room string) Elevator
	JsonData() ([]byte, error)
}

type IElevatorEngine

type IElevatorEngine interface {
	Execute(roomKey, requestKey string) (room.Response, error)
	ExecuteConcurrent(concurrentKey string, appliedRooms ...string) map[string]room.Response
	WarmUp() IElevatorEngine
	PutBodyParser(roomKey, requestKey string, bodyParser room.IBodyParser) IElevatorEngine
	PutQuery(roomKey, requestKey string, authStrategy room.IQuery) IElevatorEngine
	GetElapsedTime() float64
}

func NewElevatorEngine

func NewElevatorEngine(elevator Elevator) IElevatorEngine

type IntegrationConfig

type IntegrationConfig struct {
	Flat Flat `yaml:"flat"`
}

func (*IntegrationConfig) UnmarshalJSON

func (r *IntegrationConfig) UnmarshalJSON(data []byte) error

type Request

type Request struct {
	ConcurrentKey string `yaml:"concurrentKey"`
	Method        string `yaml:"method"`
	Path          string `yaml:"path"`
	Body          Body   `yaml:"body"`
}

type Room

type Room struct {
	Connection Connection         `yaml:"connection"`
	Requests   map[string]Request `yaml:"requests"`
}

type RoomContainer

type RoomContainer struct {
	Room     room.IRoom
	Requests map[string]*room.Request
}

type RoomResponseContainer

type RoomResponseContainer struct {
	Responses map[string]room.Response
	// contains filtered or unexported fields
}

func (*RoomResponseContainer) PutResponse

func (c *RoomResponseContainer) PutResponse(key string, response room.Response)

Jump to

Keyboard shortcuts

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