Example #1
0
// NewHyperClient creates a new *HyperClient
func NewHyperClient(server string) (*HyperClient, error) {
	conn, err := grpc.Dial(server, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second))
	if err != nil {
		return nil, err
	}

	return &HyperClient{
		client: types.NewPublicAPIClient(conn),
		ctx:    context.Background(),
	}, nil
}
Example #2
0
func main() {
	conn, err := grpc.Dial(server, grpc.WithInsecure())
	if err != nil {
		fmt.Printf("Connect server error: %v", err)
		os.Exit(1)
	}
	defer conn.Close()

	client := types.NewPublicAPIClient(conn)
	request := types.PodInfoRequest{
		PodID: "pod-zpIOTSAjmM",
	}
	response, err := client.PodInfo(context.Background(), &request)
	if err != nil {
		fmt.Printf("Get PodInfo error: %v", err)
		os.Exit(1)
	}

	fmt.Printf("Got response: %v", response)
}