refactor: expose generated code and client business logic to share with Kapacitor (#103)
* refactor: take clients out of internal * refactor: move stdio to pkg * Move internal/api to api * refactor: final changes for Kapacitor to access shared functionality * chore: regenerate mocks * fix: bad automated refactor * chore: extra formatting not caught by make fmt
This commit is contained in:
22
clients/ping/ping.go
Normal file
22
clients/ping/ping.go
Normal file
@ -0,0 +1,22 @@
|
||||
package ping
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/influxdata/influx-cli/v2/api"
|
||||
"github.com/influxdata/influx-cli/v2/clients"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
clients.CLI
|
||||
api.HealthApi
|
||||
}
|
||||
|
||||
// Ping checks the health of a remote InfluxDB instance.
|
||||
func (c Client) Ping(ctx context.Context) error {
|
||||
if _, err := c.GetHealth(ctx).Execute(); err != nil {
|
||||
return err
|
||||
}
|
||||
_, err := c.StdIO.Write([]byte("OK\n"))
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user