grpcclient

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package auth contains the domain concept definitions needed to support SuperMQ auth functionality.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSvcNotServing = errors.New("service is not serving")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	URL               string        `env:"URL"              envDefault:""`
	Timeout           time.Duration `env:"TIMEOUT"          envDefault:"1s"`
	ClientCert        string        `env:"CLIENT_CERT"      envDefault:""`
	ClientKey         string        `env:"CLIENT_KEY"       envDefault:""`
	ServerCAFile      string        `env:"SERVER_CA_CERTS"  envDefault:""`
	BypassHealthCheck bool
}

type Handler

type Handler interface {
	// Close closes gRPC connection.
	Close() error

	// Secure is used for pretty printing TLS info.
	Secure() string

	// Connection returns the gRPC connection.
	Connection() *grpc.ClientConn
}

Handler is used to handle gRPC connection.

func NewHandler

func NewHandler(cfg Config) (Handler, error)

func SetupChannelsClient

func SetupChannelsClient(ctx context.Context, cfg Config) (grpcChannelsV1.ChannelsServiceClient, Handler, error)

SetupChannelsClient loads channels gRPC configuration and creates new channels gRPC client.

For example:

channelClient, channelHandler, err := grpcclient.SetupChannelsClient(ctx, grpcclient.Config{}).

func SetupClientsClient

func SetupClientsClient(ctx context.Context, cfg Config) (grpcClientsV1.ClientsServiceClient, Handler, error)

SetupClientsClient loads clients gRPC configuration and creates new clients gRPC client.

For example:

clientClient, clientHandler, err := grpcclient.SetupClients(ctx, grpcclient.Config{}).

func SetupDomainsClient

func SetupDomainsClient(ctx context.Context, cfg Config) (grpcDomainsV1.DomainsServiceClient, Handler, error)

SetupDomiansClient loads domains gRPC configuration and creates a new domains gRPC client.

For example:

domainsClient, domainsHandler, err := grpcclient.SetupDomainsClient(ctx, grpcclient.Config{}).

func SetupGroupsClient

func SetupGroupsClient(ctx context.Context, cfg Config) (grpcGroupsV1.GroupsServiceClient, Handler, error)

SetupGroupsClient loads groups gRPC configuration and creates new groups gRPC client.

For example:

groupClient, groupHandler, err := grpcclient.SetupGroupsClient(ctx, grpcclient.Config{}).

func SetupTokenClient

func SetupTokenClient(ctx context.Context, cfg Config) (grpcTokenV1.TokenServiceClient, Handler, error)

SetupTokenClient loads auth services token gRPC configuration and creates new Token services gRPC client.

For example:

tokenClient, tokenHandler, err := grpcclient.SetupTokenClient(ctx, grpcclient.Config{}).

Jump to

Keyboard shortcuts

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