client

package
v0.2.45 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 18 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResponse = errors.New("unexpected http response")
)

Functions

func DynamicClientFromContext

func DynamicClientFromContext(ctx context.Context) client.Client

func NewContextWithDynamicClient

func NewContextWithDynamicClient(ctx context.Context, client client.Client) context.Context

func NewContextWithStaticClient

func NewContextWithStaticClient(ctx context.Context, client client.Client) context.Context

func RequestMutator added in v0.2.30

func RequestMutator(accessToken AccessTokener) func(context.Context, *http.Request) error

RequestMutator implements OAuth2 bearer token authorization.

func StaticClientFromContext

func StaticClientFromContext(ctx context.Context) client.Client

Types

type AccessTokenGetter added in v0.2.44

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

func (*AccessTokenGetter) Get added in v0.2.44

func (a *AccessTokenGetter) Get() string

type AccessTokener added in v0.2.44

type AccessTokener interface {
	Get() string
}

AccessTokener provides an interface to retrieve an access token.

type Client added in v0.2.7

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

Client wraps up the raw OpenAPI client with things to make it useable e.g. authorization and TLS.

func New

func New(client client.Client, options *Options, clientOptions *coreclient.HTTPClientOptions) *Client

New creates a new client.

func (*Client) Client added in v0.2.7

func (c *Client) Client(ctx context.Context, accessToken AccessTokener) (*openapi.ClientWithResponses, error)

Client returns a new OpenAPI client that can be used to access the API.

func (*Client) HTTPClient added in v0.2.30

func (c *Client) HTTPClient(ctx context.Context) (*http.Client, error)

HTTPClient returns a new http client that will transparently do oauth2 header injection and refresh token updates.

type Options added in v0.2.8

type Options = coreclient.HTTPOptions

func NewOptions added in v0.2.30

func NewOptions() *Options

NewOptions must be used to create options for consistency.

type TokenIssuer added in v0.2.30

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

func NewTokenIssuer added in v0.2.30

func NewTokenIssuer(client client.Client, identityOptions *Options, clientOptions *coreclient.HTTPClientOptions, serviceName, serviceVersion string) *TokenIssuer

func (*TokenIssuer) Issue added in v0.2.44

func (i *TokenIssuer) Issue(ctx context.Context, traceName string) (*AccessTokenGetter, error)

Issue issues an access token for the non-user client/service.

Jump to

Keyboard shortcuts

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