client

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShardFromContext

func ShardFromContext(ctx context.Context) shard.Name

ShardFromContext returns the value of the shard key on the ctx, or an empty Name if there is no shard key.

func WithCacheServiceRoundTripper added in v0.9.0

func WithCacheServiceRoundTripper(cfg *rest.Config) *rest.Config

WithCacheServiceRoundTripper wraps an existing config's with CacheServiceRoundTripper.

func WithDefaultShardRoundTripper

func WithDefaultShardRoundTripper(cfg *rest.Config, shard clientshard.Name) *rest.Config

WithDefaultShardRoundTripper wraps an existing config's with DefaultShardRoundTripper

Note: it is the caller responsibility to make a copy of the rest config.

func WithShardInContext

func WithShardInContext(parent context.Context, shard shard.Name) context.Context

WithShardInContext returns a context with the given shard set.

func WithShardNameFromContextRoundTripper added in v0.9.0

func WithShardNameFromContextRoundTripper(cfg *rest.Config) *rest.Config

WithShardNameFromContextRoundTripper wraps an existing config's with ShardRoundTripper.

Note: it is the caller responsibility to make a copy of the rest config.

func WithShardNameFromObjectRoundTripper added in v0.9.0

func WithShardNameFromObjectRoundTripper(cfg *rest.Config, requestInfoResolver func(*http.Request) (string, string, error), supportedResources ...string) *rest.Config

WithShardNameFromObjectRoundTripper wraps an existing config with ShardNameFromObjectRoundTripper.

Note: it is the caller responsibility to make a copy of the rest config.

Types

type CacheServiceRoundTripper added in v0.9.0

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

CacheServiceRoundTripper is a http.RoundTripper that appends "/services/cache" prefix to a request.

func NewCacheServiceRoundTripper added in v0.9.0

func NewCacheServiceRoundTripper(delegate http.RoundTripper) *CacheServiceRoundTripper

NewCacheServiceRoundTripper creates a new CacheServiceRoundTripper.

func (*CacheServiceRoundTripper) RoundTrip added in v0.9.0

func (c *CacheServiceRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

func (*CacheServiceRoundTripper) WrappedRoundTripper added in v0.24.0

func (c *CacheServiceRoundTripper) WrappedRoundTripper() http.RoundTripper

type DefaultShardRoundTripper

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

DefaultShardRoundTripper is a http.RoundTripper that sets a default shard name if not specified in the context.

func NewDefaultShardRoundTripper

func NewDefaultShardRoundTripper(delegate http.RoundTripper, shard clientshard.Name) *DefaultShardRoundTripper

NewDefaultShardRoundTripper creates a new round tripper that sets a default shard name.

func (*DefaultShardRoundTripper) RoundTrip

func (c *DefaultShardRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

func (*DefaultShardRoundTripper) WrappedRoundTripper added in v0.24.0

func (c *DefaultShardRoundTripper) WrappedRoundTripper() http.RoundTripper

type ShardNameFromObjectRoundTripper added in v0.9.0

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

ShardNameFromObjectRoundTripper knows how to read a shard name from an object and store it in the context. it should be only used by the internal kube-clients that are not aware of a shard name.

func NewShardNameFromObjectRoundTripper added in v0.9.0

func NewShardNameFromObjectRoundTripper(delegate http.RoundTripper, requestInfoResolver func(*http.Request) (string, string, error), supportedResources ...string) *ShardNameFromObjectRoundTripper

NewShardNameFromObjectRoundTripper creates a new ShardNameFromObjectRoundTripper for the given resources.

func (*ShardNameFromObjectRoundTripper) RoundTrip added in v0.9.0

func (*ShardNameFromObjectRoundTripper) WrappedRoundTripper added in v0.24.0

func (c *ShardNameFromObjectRoundTripper) WrappedRoundTripper() http.RoundTripper

type ShardRoundTripper

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

ShardRoundTripper is a shard aware wrapper around http.RoundTripper. It changes the URL path to target a shard from the context.

For example given "amber" shard name in the context it will change apis/apis.kcp.io/v1alpha1/apiexports to /shards/amber/apis/apis.kcp.io/v1alpha1/apiexports.

func NewShardRoundTripper

func NewShardRoundTripper(delegate http.RoundTripper) *ShardRoundTripper

NewShardRoundTripper creates a new shard aware round tripper.

func (*ShardRoundTripper) RoundTrip

func (c *ShardRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

func (*ShardRoundTripper) WrappedRoundTripper added in v0.24.0

func (c *ShardRoundTripper) WrappedRoundTripper() http.RoundTripper

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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