http

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultEnable is default state for metrics
	DefaultEnable = true

	// DefaultDebugResponse let's you debug your HTTP Responses
	DefaultDebugResponse = false

	// DefaultLogStatusCodes let's you debug your HTTP Responses
	DefaultLogStatusCodes = false

	// DefaultSignJWT sign requests using jwt
	DefaultSignJWT = true

	// DefaultIssuer for jwt
	DefaultIssuer = "issuer"

	// DefaultJWTSubject for jwt
	DefaultJWTSubject = "0"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled       bool          `toml:"enabled"`
	DebugResponse bool          `toml:"debug-response"`
	LogHTTPStatus bool          `toml:"log-http-status"`
	SignJWT       bool          `toml:"use-jwt-signing"`
	Issuer        string        `toml:"jwt-issuer"`
	JWTExpires    toml.Duration `toml:"jwt-expires"`
	JWTSubject    string        `toml:"jwt-subject"`
	JWTSecret     string        `toml:"jwt-secret"`
}

Config represents the meta configuration.

func NewConfig

func NewConfig() Config

NewConfig builds a new configuration with default values.

func (Config) Validate

func (c Config) Validate() error

Validate the config

type ExecutionData

type ExecutionData struct {
	URL    string `json:"url"`
	Method string `json:"method"`
}

ExecutionData is used to determine settings for the request

type ExecutionProvider

type ExecutionProvider struct {
	Logger   *logrus.Logger
	Executor Executor
	Config   Config
}

ExecutionProvider fills in the interface

func NewExecutionProvider

func NewExecutionProvider(conf Config, logger *logrus.Logger) *ExecutionProvider

NewExecutionProvider creates a new ExecutionProvider

func (*ExecutionProvider) Execute

func (p *ExecutionProvider) Execute(t interface{}, r *provider.Response) error

Execute runs a task

type Executor

type Executor struct {
	Logger         *logrus.Logger
	ErrorCounter   metrics.Counter
	SuccessCounter metrics.Counter
	RequestTiming  metrics.Timer
	HTTPConfig     Config
}

Executor executes jobs

func NewExecutor

func NewExecutor(logger *logrus.Logger) Executor

NewExecutor returns a new executionService

func (*Executor) FromTask

func (e *Executor) FromTask(t ExecutionData, res *provider.Response) error

FromTask runs a task definition

func (*Executor) Request

func (e *Executor) Request(url, method string, resq *provider.Response) (response *http.Response, erro error)

Request performs an actual http request

Jump to

Keyboard shortcuts

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