client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsError

func IsError(output string) (isErr bool, err error)

IsError returns true and the error message if the REST output is an error response. The gRPC-Gateway returns an error struct when an error is found but it's not an error type. The structure is defined

Types

type Config

type Config struct {
	APIVersion string
	Host       string
	Logger     *log.Logger

	GrpcPort string
	GrpcConn *grpc.ClientConn

	HTTPClient         *http.Client
	HTTPBaseURL        *url.URL
	HTTPHealthzClient  *http.Client
	HTTPHealthzBaseURL *url.URL

	Insecure    bool
	Certificate tls.Certificate
	CertPool    *x509.CertPool
	// contains filtered or unexported fields
}

Config is the kubekit client configuration

func New

func New(apiVersion string, logger *log.Logger) *Config

New creates a new KubeKit Client

func (*Config) Error

func (c *Config) Error() (*Config, error)

func (*Config) GetGRPCConn

func (c *Config) GetGRPCConn(host, port string) (*grpc.ClientConn, error)

GetGRPCConn create a gRPC connection to the given host:port

func (*Config) Healthz

func (c *Config) Healthz(ctx context.Context, service string) (string, error)

Healthz returns the Health Status using HTTP/REST or gRPC

func (*Config) HealthzGRPC

func (c *Config) HealthzGRPC(ctx context.Context, service string) (string, error)

HealthzGRPC returns the Health Status using gRPC

func (*Config) HealthzHTTP

func (c *Config) HealthzHTTP(service string) (string, error)

HealthzHTTP returns the Health Status using HTTP/REST

func (*Config) RunGRPCnRESTFunc

func (c *Config) RunGRPCnRESTFunc(name string, firstTry bool, fnGRPC ProtoFunc, fnREST ProtoFunc) (string, error)

RunGRPCnRESTFunc execute the given functions to access the GRPC and REST API

func (*Config) WithHTTP

func (c *Config) WithHTTP(host, httpPort, healthzPort string)

WithHTTP makes the KubeKit client to have a REST/HTTP client

func (*Config) WithTLS

func (c *Config) WithTLS(certDir, certFile, keyFile, caFile string) error

WithTLS makes the client secure by loading the given certificates

type ProtoFunc

type ProtoFunc func() (string, error)

ProtoFunc is a function to call inside a function to access the GRPC or REST API. It always return the API result and an error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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