connection

package
v1.49.9 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialConnection

func DialConnection(_ context.Context, opts ...common.ClientOption) (*grpc.ClientConn, error)

DialConnection creates a gRPC connection with the provided options.

func NewHTTPClient

func NewHTTPClient(ctx context.Context, opts ...options.HTTPOption) *http.Client

NewHTTPClient creates a new HTTP client with the provided options. If no transport is specified, it defaults to otelhttp.NewTransport(http.DefaultTransport).

func VersionGo

func VersionGo() string

VersionGo returns a normalized Go runtime version string with no whitespace. The returned string is suitable for inclusion in headers or metrics tags.

func XAntHeader

func XAntHeader(pairs ...string) string

XAntHeader constructs a space-separated "key/value" header string suitable for the ant service. It expects an even number of arguments:

XAntHeader("lang", "go", "version", "1.22") => "lang/go version/1.22"

If no arguments are provided, it returns an empty string. Panics if an odd number of arguments is passed.

Types

type ConnectClientBase added in v1.47.6

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

func NewConnectClientBase added in v1.47.6

func NewConnectClientBase(ctx context.Context, opts ...common.ClientOption) (*ConnectClientBase, error)

func (*ConnectClientBase) Client added in v1.47.6

func (ccb *ConnectClientBase) Client() *http.Client

Client obtains the http client for the API service. User should always use this client is required.

func (*ConnectClientBase) Endpoint added in v1.47.6

func (ccb *ConnectClientBase) Endpoint() string

Endpoint obtains the http uri for the API service.

func (*ConnectClientBase) GetInfo added in v1.47.6

func (ccb *ConnectClientBase) GetInfo() string

func (*ConnectClientBase) Options added in v1.47.6

func (ccb *ConnectClientBase) Options(opts ...connect.ClientOption) []connect.ClientOption

Options returns the API client can use to configure itself.

func (*ConnectClientBase) SetInfo added in v1.47.6

func (ccb *ConnectClientBase) SetInfo(keyval ...string)

SetInfo sets the name and version of the application in the `x-goog-api-client` header passed on each request. Intended for use by Google-written clients.

func (*ConnectClientBase) SetTenancyInfo added in v1.49.6

func (ccb *ConnectClientBase) SetTenancyInfo(
	ctx context.Context,
	tenancyInfo util.TenancyInfo,
) context.Context

type GrpcClientBase

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

func NewGrpcClientBase added in v1.47.6

func NewGrpcClientBase(ctx context.Context, opts ...common.ClientOption) (*GrpcClientBase, error)

func (*GrpcClientBase) Close

func (gbc *GrpcClientBase) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*GrpcClientBase) Connection

func (gbc *GrpcClientBase) Connection() *grpc.ClientConn

Connection obtains the connection to the API service. User should invoke this connection is required.

func (*GrpcClientBase) GetInfo

func (gbc *GrpcClientBase) GetInfo() metadata.MD

func (*GrpcClientBase) SetInfo

func (gbc *GrpcClientBase) SetInfo(keyval ...string)

SetInfo sets the name and version of the application in the `x-goog-api-client` header passed on each request. Intended for use by Google-written clients.

type JWTInterceptor

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

func (*JWTInterceptor) StreamClientInterceptor

func (jwt *JWTInterceptor) StreamClientInterceptor(
	ctx context.Context,
	desc *grpc.StreamDesc,
	cc *grpc.ClientConn,
	method string,
	streamer grpc.Streamer,
	opts ...grpc.CallOption,
) (grpc.ClientStream, error)

func (*JWTInterceptor) UnaryClientInterceptor

func (jwt *JWTInterceptor) UnaryClientInterceptor(
	ctx context.Context,
	method string,
	req interface{},
	reply interface{},
	cc *grpc.ClientConn,
	invoker grpc.UnaryInvoker,
	opts ...grpc.CallOption) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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