All Projects → vadimi → grpc-client-cli

vadimi / grpc-client-cli

Licence: MIT license
generic gRPC command line client

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to grpc-client-cli

Vaadin Microservices Demo
A microservices example developed with Spring Cloud and Vaadin
Stars: ✭ 108 (-21.74%)
Mutual labels:  eureka
Spring Boot Cloud
基于 Spring Boot、Spring Cloud、Spring Oauth2 和 Spring Cloud Netflix 等框架构建的微服务项目
Stars: ✭ 2,044 (+1381.16%)
Mutual labels:  eureka
Spring Cloud Study
SpringCloud源码实战微服务框架(202003更新到SpringCloud的Greenwich版本,即基于SpringBoot2.1.7版本,以及新增SpringCloud Alibaba从入门到精通教程),涉及内容:配置中心,注册中心,服务提供者,服务消费者,熔断器,配置服务,API Gateway,API网关限流ratelimit,服务链路追踪zipkin,hystrix监控,监控聚合中心turbine等
Stars: ✭ 215 (+55.8%)
Mutual labels:  eureka
Springcloud Learning
学习Spring Cloud框架的总结,使用的是最新的Hoxton版本。主要对包括但不限于Eureka、Ribbon、Hystrix、Zuul、Gateway、Security、Bus、OpenFeign等核心组件的用法进行详细介绍。
Stars: ✭ 129 (-6.52%)
Mutual labels:  eureka
Nacos Sync
Service Sync component
Stars: ✭ 138 (+0%)
Mutual labels:  eureka
Discovery
.NET Clients for Service Discovery and Registration
Stars: ✭ 181 (+31.16%)
Mutual labels:  eureka
Discovery
A registry for resilient mid-tier load balancing and failover.
Stars: ✭ 1,317 (+854.35%)
Mutual labels:  eureka
Advanced Java
😮 Core Interview Questions & Answers For Experienced Java(Backend) Developers | 互联网 Java 工程师进阶知识完全扫盲:涵盖高并发、分布式、高可用、微服务、海量数据处理等领域知识
Stars: ✭ 59,142 (+42756.52%)
Mutual labels:  eureka
Hope Cloud
🐳 Hope-Cloud is a Java microservice project
Stars: ✭ 155 (+12.32%)
Mutual labels:  eureka
Springcloudexamples
Spring Cloud 学习教程
Stars: ✭ 208 (+50.72%)
Mutual labels:  eureka
Jetfirecloud
基于SpringCloud Finchley.RELEASE的微服务开发脚手架,整合了spring-security-oauth2、springboot-admin、feign、hystrix、spring-cloud-gateway、turbine等全家桶
Stars: ✭ 129 (-6.52%)
Mutual labels:  eureka
Spring Cloud Cli
Spring Cloud CLI features
Stars: ✭ 139 (+0.72%)
Mutual labels:  eureka
Edc.springcloud.samples
Spring Cloud作为第二代微服务的代表性框架,已经在国内众多大中小型的公司有实际应用案例。许多公司的业务线全部拥抱Spring Cloud,部分公司选择部分拥抱Spring Cloud。此示例基于Spring Boot 1.5.x编写,展示了Spring Cloud的核心组件的基本使用方式,在学习Spring Cloud时可以参考本示例。
Stars: ✭ 183 (+32.61%)
Mutual labels:  eureka
Python Eureka Client
A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
Stars: ✭ 111 (-19.57%)
Mutual labels:  eureka
Springcloud
springCloud学习
Stars: ✭ 251 (+81.88%)
Mutual labels:  eureka
Eureka Consul Adapter
This project contains a Spring Boot Starter that registers HTTP endpoints on a Spring Cloud Eureka server to support Prometheus's service discovery mechanism for Consul (<consul_sd_config>)
Stars: ✭ 93 (-32.61%)
Mutual labels:  eureka
Springcloud
简单了解微服务
Stars: ✭ 174 (+26.09%)
Mutual labels:  eureka
Kreya
Kreya is a GUI client for gRPC and REST APIs with innovative features for environments, authorizations and more.
Stars: ✭ 217 (+57.25%)
Mutual labels:  grpc-client
Springcloudlearning
《史上最简单的Spring Cloud教程源码》
Stars: ✭ 16,218 (+11652.17%)
Mutual labels:  eureka
Springcloud Shop
基于Spring Boot、Spring Cloud的微服务商城demo
Stars: ✭ 198 (+43.48%)
Mutual labels:  eureka

Description

grpc-client-cli is a generic gRPC command line client - call any gRPC service. If your service exposes gRPC Reflection service the tool will discover all services and methods automatically. If not, please specify --proto parameter with the path to proto files.

Installation

Download the binary and install it to /usr/local directory:

  • Linux: curl -L https://github.com/vadimi/grpc-client-cli/releases/download/v1.16.0/grpc-client-cli_linux_x86_64.tar.gz | tar -C /usr/local/bin -xz (you might need to add sudo before tar)
  • macOS: curl -L https://github.com/vadimi/grpc-client-cli/releases/download/v1.16.0/grpc-client-cli_darwin_x86_64.tar.gz | tar -C /usr/local/bin -xz

For go 1.17+ use this command to install the app to $GOPATH/bin directory:

  • go install github.com/vadimi/grpc-client-cli/cmd/[email protected]
  • go install github.com/vadimi/grpc-client-cli/cmd/grpc-client-cli@latest

Usage

Just specify a connection string to a service in host:port format and follow instructions to select service, method and enter request message in json or proto text format.

grpc-client-cli localhost:4400 or grpc-client-cli --address localhost:4400

In this case the service needs to expose gRPC Reflection service.

For full list of supported command line args please run grpc-client-cli -h.

To provide the list of services to call specify --proto parameter and --protoimports in case an additional directory for imports is required:

grpc-client-cli --proto /path/to/proto/files localhost:5050

The tool also supports :authority header override.

grpc-client-cli --authority localhost:9090 localhost:5050

It's also possible to capture some of the diagnostic information like request and response sizes, call duration:

grpc-client-cli -V localhost:4400

Proto text format for input and output:

grpc-client-cli --informat text --outformat text localhost:5050

Eureka Support

grpc-client-cli provides integrated support for services published to a Eureka service registry.

Connecting to a service published to Eureka running on http://localhost:8761/eureka/

grpc-client-cli eureka://application-name/

Connecting to a service running remotely on http://example.com:8761/eureka/

grpc-client-cli eureka://example.com/eureka/application-name/

Connecting to a service running remotely on http://example.com:9000/not-eureka/

grpc-client-cli eureka://example.com:9000/not-eureka/application-name/

The Eureka currently connects to services using the IP Addresses published in the service registry and the following published ports, in order:

  • Metadata key "grpc"
  • Metadata key "grpc.port"
  • Default insecure port

If you require a different default port, please file an issue, and that port will be considered for inclusion.

Subcommands

discover - print service protobuf contract

grpc-client-cli discover localhost:5050
grpc-client-cli -s User discover localhost:5050

health - call health check service, this command returns non-zero exit code in case health check returns NOT_SERVING response or the call fails for any other reason, so it's useful for example in kubernetes health probes

grpc-client-cli health localhost:5050
grpc-client-cli --address localhost:5050 health

Non-interactive mode

In non-interactive mode grpc-client-cli expects all parameters to be passed to execute gRPC service.

Pass message json through stdin

echo '{"user_id": "12345"}' | grpc-client-cli -service UserService -method GetUser localhost:5050
cat message.json | grpc-client-cli -service UserService -method GetUser localhost:5050

On windows this could be achieved using type command

type message.json | grpc-client-cli -service UserService -method GetUser localhost:5050

Input file

Another option of providing a file with message json is -input (or -i) parameter:

grpc-client-cli -service UserService -method GetUser -i message.json localhost:5050

Autocompletion

To enable autocompletion in your terminal add the following commands to your .bashrc or .zshrc files.

ZSH

PROG=grpc-client-cli
_CLI_ZSH_AUTOCOMPLETE_HACK=1
source  autocomplete/zsh_autocomplete

Bash

PROG=grpc-client-cli
source autocomplete/bash_autocomplete

autocomplete directory is located in the root of the repo. Please find more details here.

JSON format specifics

Most of the fields in proto message can be intuitively mapped to json types. There are some exclusions though:

  1. Timestamp mapped to a string in ISO 8601 format.

For example:

{
  "flight_start_date": "2018-03-19T00:00:00.0Z"
}
  1. Duration mapped to a string in the following format: 00h00m00s

For example:

{
  "start_time": "20h00m00s",
  "some_other_duration": "1s"
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].