client

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HealthCmd = &cobra.Command{
	Use:   "health",
	Short: "Health is a grpc client to health check remote grpc server",
	Long:  `Health is a grpc client to invoke livess and readiness functions of remote grpc server`,
}
View Source
var LivenessCmd = &cobra.Command{
	Use:          "liveness",
	Short:        "liveness checks the liveness of remote grpc server",
	Long:         `liveness checks the liveness of remote grpc server`,
	SilenceUsage: true,
	RunE: func(cmd *cobra.Command, args []string) error {
		grpcAddr := fmt.Sprintf("%s:%d", host, port)

		ctx, cancel := context.WithTimeout(context.Background(), timeout)
		defer cancel()
		conn, err := grpc.DialContext(ctx, grpcAddr,
			grpc.WithInsecure(),
			grpc.WithBlock(),
		)
		if err != nil {
			return err
		}
		defer conn.Close()
		c := health.NewHealthCheckServiceClient(conn)
		_, err = c.Liveness(context.Background(), nil)
		return err
	},
}

LivenessCmd represents the liveness command

View Source
var ReadinessCmd = &cobra.Command{
	Use:          "readiness",
	Short:        "readiness checks the readiness of remote grpc server",
	Long:         `readiness checks the readiness of remote grpc server`,
	SilenceUsage: true,
	RunE: func(cmd *cobra.Command, args []string) error {
		grpcAddr := fmt.Sprintf("%s:%d", host, port)

		ctx, cancel := context.WithTimeout(context.Background(), timeout)
		defer cancel()
		conn, err := grpc.DialContext(ctx, grpcAddr,
			grpc.WithInsecure(),
			grpc.WithBlock(),
		)
		if err != nil {
			return err
		}
		defer conn.Close()
		c := health.NewHealthCheckServiceClient(conn)
		_, err = c.Readiness(ctx, nil)
		return err
	},
}

ReadinessCmd represents the readiness command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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