auth

package
v0.0.0-...-36461b0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package auth provides a client to call the service backends based on the type of server specified in the config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear clears existing server configs

func LoadServerConfigs

func LoadServerConfigs(sl []*httppb.ServerDefinition) error

LoadServerConfigs loads the server config

func NewGRPCConnection

func NewGRPCConnection(ctx context.Context, addr string) (*grpc.ClientConn, error)

NewGRPCConnection returns a connection to a gRPC server using Google default credentials.

Types

type Client

type Client interface {
	ExecuteRequest(ctx context.Context, req *http.Request, name string, failOnNotFound bool) (*json.RawMessage, error)
}

Client is a generic interface for communicating with the server.

type GCPClient

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

GCPClient is used to call a service hosted on GCP.

func NewClient

func NewClient(ctx context.Context) *GCPClient

NewClient establishes a client using http.

func (*GCPClient) ExecuteRequest

func (sc *GCPClient) ExecuteRequest(ctx context.Context, req *http.Request, name string, failOnNotFound bool) (*json.RawMessage, error)

ExecuteRequest executes an http request (req). If the request fails, it is logged with the parameter name. Upon receiving a 404, it returns an error or empty JSON object depending on the failOnNotFound flag.

Jump to

Keyboard shortcuts

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