endpoint

package
v0.3.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAuthenticationStrategyHookFunc

func DecodeAuthenticationStrategyHookFunc() mapstructure.DecodeHookFunc

Types

type APIKeyStrategy

type APIKeyStrategy struct {
	In    string `mapstructure:"in"`
	Name  string `mapstructure:"name"`
	Value string `mapstructure:"value"`
}

func (*APIKeyStrategy) Apply

func (c *APIKeyStrategy) Apply(_ context.Context, req *http.Request) error

func (*APIKeyStrategy) Hash

func (c *APIKeyStrategy) Hash() string

type AuthenticationStrategy

type AuthenticationStrategy interface {
	Apply(context.Context, *http.Request) error
	Hash() string
}

type BasicAuthStrategy

type BasicAuthStrategy struct {
	User     string `mapstructure:"user"`
	Password string `mapstructure:"password"`
}

func (*BasicAuthStrategy) Apply

func (c *BasicAuthStrategy) Apply(_ context.Context, req *http.Request) error

func (*BasicAuthStrategy) Hash

func (c *BasicAuthStrategy) Hash() string

type ClientCredentialsStrategy

type ClientCredentialsStrategy struct {
	ClientID     string   `mapstructure:"client_id"`
	ClientSecret string   `mapstructure:"client_secret"`
	Scopes       []string `mapstructure:"scopes"`
	TokenURL     string   `mapstructure:"token_url"`
}

func (*ClientCredentialsStrategy) Apply

func (*ClientCredentialsStrategy) Hash

type Endpoint

type Endpoint struct {
	URL          string                 `mapstructure:"url"`
	Method       string                 `mapstructure:"method"`
	Retry        *Retry                 `mapstructure:"retry"`
	AuthStrategy AuthenticationStrategy `mapstructure:"auth"`
	Headers      map[string]string      `mapstructure:"headers"`
}

func (Endpoint) CreateClient

func (e Endpoint) CreateClient(peerName string) *http.Client

func (Endpoint) CreateRequest

func (e Endpoint) CreateRequest(ctx context.Context, body io.Reader, rndr renderer.Renderer) (*http.Request, error)

func (Endpoint) Hash

func (e Endpoint) Hash() string

func (Endpoint) SendRequest

func (e Endpoint) SendRequest(ctx context.Context, body io.Reader, renderer renderer.Renderer) ([]byte, error)

func (Endpoint) Validate

func (e Endpoint) Validate() error

type Retry

type Retry struct {
	GiveUpAfter time.Duration `mapstructure:"give_up_after"`
	MaxDelay    time.Duration `mapstructure:"max_delay"`
}

Jump to

Keyboard shortcuts

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