configure

package
v0.0.0-...-b5fe2b3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2016 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleHttp

func HandleHttp(endpoints []HttpEndpoint) http.HandlerFunc

Types

type ApiOnlyServiceType

type ApiOnlyServiceType struct {
	// contains filtered or unexported fields
}

func (ApiOnlyServiceType) Configure

func (s ApiOnlyServiceType) Configure()

func (ApiOnlyServiceType) Name

func (s ApiOnlyServiceType) Name() string

func (ApiOnlyServiceType) Serve

func (s ApiOnlyServiceType) Serve()

type HostHttpMatcher

type HostHttpMatcher struct {
	// contains filtered or unexported fields
}

func NewHostHttpMatcher

func NewHostHttpMatcher(regularExpr string) (matcher HostHttpMatcher, err error)

func (HostHttpMatcher) Match

func (m HostHttpMatcher) Match(req *http.Request) bool

func (HostHttpMatcher) MatchHost

func (m HostHttpMatcher) MatchHost(host string) bool

type HttpEndpoint

type HttpEndpoint interface {
	Match(req *http.Request) bool
	Respond(res http.ResponseWriter, req *http.Request)
}

type HttpEndpointConfig

type HttpEndpointConfig struct {
	Name             string
	MatcherConfigs   []HttpRequestMatcherConfig `yaml:"matchers"`
	ResponderConfigs []HttpResponderConfig      `yaml:"responders"`
}

type HttpMatcher

type HttpMatcher interface {
	Match(req *http.Request) bool
}

type HttpRequestMatcher

type HttpRequestMatcher struct {
	Name     string
	Matchers []HttpMatcher
}

func (HttpRequestMatcher) Match

func (m HttpRequestMatcher) Match(req *http.Request) bool

type HttpRequestMatcherConfig

type HttpRequestMatcherConfig struct {
	Name            string
	VerbRegexString string                       `yaml:"verb_regex"`
	HostRegexString string                       `yaml:"host_regex"`
	PathRegexString string                       `yaml:"path_regex"`
	QueryParams     []KeyValuesHttpMatcherConfig `yaml:"query_params"`
	Headers         []KeyValuesHttpMatcherConfig `yaml:"headers"`
}

func (HttpRequestMatcherConfig) NewMatcher

func (m HttpRequestMatcherConfig) NewMatcher() (matcher HttpMatcher, err error)

type HttpResponderConfig

type HttpResponderConfig struct {
	Name    string
	Mode    string
	Content HttpResponderContent
}

type HttpResponderContent

type HttpResponderContent struct {
	ContentType string `yaml:"type"`
	SourceDir   string `yaml:"source_dir"`
	TmpDir      string `yaml:"tmp_dir"`
	Script      string
	SourceFile  string `yaml:"source_file"`
}

type HttpServiceType

type HttpServiceType struct {
	// contains filtered or unexported fields
}

func (HttpServiceType) Configure

func (s HttpServiceType) Configure()

func (HttpServiceType) Name

func (s HttpServiceType) Name() string

func (HttpServiceType) Serve

func (s HttpServiceType) Serve()

type KeyValuesHttpMatcher

type KeyValuesHttpMatcher struct {
	KeyRegex   *regexp.Regexp
	ValueRegex *regexp.Regexp
}

func (KeyValuesHttpMatcher) Match

func (m KeyValuesHttpMatcher) Match(req *http.Request) bool

func (KeyValuesHttpMatcher) MatchKeyValues

func (m KeyValuesHttpMatcher) MatchKeyValues(params map[string][]string) bool

type KeyValuesHttpMatcherConfig

type KeyValuesHttpMatcherConfig struct {
	KeyRegexString   string `yaml:"key_regex"`
	ValueRegexString string `yaml:"value_regex"`
}

func (KeyValuesHttpMatcherConfig) NewMatcher

func (m KeyValuesHttpMatcherConfig) NewMatcher() (matcher QueryParamHttpMatcher, err error)

type ModeConfig

type ModeConfig struct {
	Name string
}

type NamedHttpEndpoint

type NamedHttpEndpoint struct {
	Name     string
	Matchers []HttpMatcher
}

func (NamedHttpEndpoint) Match

func (e NamedHttpEndpoint) Match(req *http.Request) bool

func (NamedHttpEndpoint) Respond

func (e NamedHttpEndpoint) Respond(res http.ResponseWriter, req *http.Request)

type QueryParamHttpMatcher

type QueryParamHttpMatcher struct {
	KeyValuesHttpMatcher
}

func (QueryParamHttpMatcher) Match

func (m QueryParamHttpMatcher) Match(req *http.Request) bool

type ResembleConfig

type ResembleConfig struct {
	TypeName        string               `yaml:"type"`
	EndpointConfigs []HttpEndpointConfig `yaml:"endpoints"`
	ModeConfigs     []ModeConfig         `yaml:"modes"`
}

func ReadHttpConfiguration

func ReadHttpConfiguration(configYaml string) (resembleConfig ResembleConfig, err error)

type RestServiceType

type RestServiceType struct {
	// contains filtered or unexported fields
}

func (RestServiceType) Configure

func (s RestServiceType) Configure()

func (RestServiceType) Name

func (s RestServiceType) Name() string

func (RestServiceType) Serve

func (s RestServiceType) Serve()

type ServiceType

type ServiceType interface {
	Name() string
	Configure()
	Serve()
}

func ConfigureService

func ConfigureService(configYaml string) (s ServiceType, err error)

type UrlPathHttpMatcher

type UrlPathHttpMatcher struct {
	// contains filtered or unexported fields
}

func NewUrlPathHttpMatcher

func NewUrlPathHttpMatcher(regularExpr string) (matcher UrlPathHttpMatcher, err error)

func (UrlPathHttpMatcher) Match

func (m UrlPathHttpMatcher) Match(req *http.Request) bool

func (UrlPathHttpMatcher) MatchUrlPath

func (m UrlPathHttpMatcher) MatchUrlPath(urlPath string) bool

type VerbHttpMatcher

type VerbHttpMatcher struct {
	// contains filtered or unexported fields
}

func NewVerbHttpMatcher

func NewVerbHttpMatcher(regularExpr string) (matcher VerbHttpMatcher, err error)

func (VerbHttpMatcher) Match

func (m VerbHttpMatcher) Match(req *http.Request) bool

func (VerbHttpMatcher) MatchVerb

func (m VerbHttpMatcher) MatchVerb(verb string) bool

Jump to

Keyboard shortcuts

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