client

package
v0.0.0-...-22a1e08 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: BSD-3-Clause Imports: 16 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTsuruTargetNotProvided       = errors.New("Tsuru target not provided")
	ErrTsuruTokenNotProvided        = errors.New("Tsuru token not provided")
	ErrTsuruServiceNameNotProvided  = errors.New("Tsuru service name not provided")
	ErrTsuruInstanceNameNotProvided = errors.New("Tsuru instance name not provided")
)
View Source
var DefaultBackoff = wait.Backoff{
	Steps:    100,
	Duration: 10 * time.Millisecond,
	Factor:   5.0,
	Jitter:   0.1,
}

Functions

func ClientFromEnvironment

func ClientFromEnvironment(cfg *tsuru.Configuration) (*tsuru.APIClient, error)

func IsTsuruEventLocked

func IsTsuruEventLocked(r *http.Response, err error) bool

func NewOIDCTokenSource

func NewOIDCTokenSource(tokenV2 *config.TokenV2) oauth2.TokenSource

func NewTokenV1RoundTripper

func NewTokenV1RoundTripper() http.RoundTripper

func RetryOnTsuruEventLocked

func RetryOnTsuruEventLocked(ctx context.Context, fn LikelyRetriableFunc) error

func RetryWithBackoff

func RetryWithBackoff(ctx context.Context, backoff wait.Backoff, retriable IsRetriableFunc, fn LikelyRetriableFunc) error

func RoundTripperAndTokenProvider

func RoundTripperAndTokenProvider() (http.RoundTripper, config.TokenProvider, error)

Types

type IsRetriableFunc

type IsRetriableFunc func(r *http.Response, err error) bool

type LikelyRetriableFunc

type LikelyRetriableFunc func() (*http.Response, error)

type OIDCTokenProvider

type OIDCTokenProvider struct {
	OAuthTokenSource oauth2.TokenSource
}

func (*OIDCTokenProvider) Token

func (ts *OIDCTokenProvider) Token() (string, error)

type TokenSourceFSStorage

type TokenSourceFSStorage struct {
	BaseTokenSource oauth2.TokenSource
	LastToken       *config.TokenV2
}

func (*TokenSourceFSStorage) Token

func (t *TokenSourceFSStorage) Token() (*oauth2.Token, error)

type TokenV1RoundTripper

type TokenV1RoundTripper struct {
	http.RoundTripper
}

func (*TokenV1RoundTripper) RoundTrip

func (v *TokenV1RoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type TsuruProxyTransport

type TsuruProxyTransport struct {
	Target   string
	Token    string
	Service  string
	Instance string

	Base http.RoundTripper
}

func (*TsuruProxyTransport) RoundTrip

func (tpt *TsuruProxyTransport) RoundTrip(r *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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