refactor: switch to Execute() method on requests (#56)

This commit is contained in:
Daniel Moran
2021-04-30 16:42:29 -04:00
committed by GitHub
parent 7f5542c119
commit b038973a19
3 changed files with 4 additions and 8 deletions

View File

@ -8,11 +8,9 @@ import (
// Ping checks the health of a remote InfluxDB instance. // Ping checks the health of a remote InfluxDB instance.
func (c *CLI) Ping(ctx context.Context, client api.HealthApi) error { func (c *CLI) Ping(ctx context.Context, client api.HealthApi) error {
req := client.GetHealth(ctx) if _, _, err := client.GetHealth(ctx).Execute(); err != nil {
if _, _, err := client.GetHealthExecute(req); err != nil {
return err return err
} }
_, err := c.StdIO.Write([]byte("OK\n")) _, err := c.StdIO.Write([]byte("OK\n"))
return err return err
} }

View File

@ -44,8 +44,7 @@ func (c *CLI) Setup(ctx context.Context, client api.SetupApi, params *SetupParam
} }
// Check if setup is even allowed. // Check if setup is even allowed.
checkReq := client.GetSetup(ctx) checkResp, _, err := client.GetSetup(ctx).Execute()
checkResp, _, err := client.GetSetupExecute(checkReq)
if err != nil { if err != nil {
return fmt.Errorf("failed to check if already set up: %w", err) return fmt.Errorf("failed to check if already set up: %w", err)
} }
@ -58,8 +57,7 @@ func (c *CLI) Setup(ctx context.Context, client api.SetupApi, params *SetupParam
if err != nil { if err != nil {
return err return err
} }
setupReq := client.PostSetup(ctx).OnboardingRequest(setupBody) resp, _, err := client.PostSetup(ctx).OnboardingRequest(setupBody).Execute()
resp, _, err := client.PostSetupExecute(setupReq)
if err != nil { if err != nil {
return fmt.Errorf("failed to setup instance: %w", err) return fmt.Errorf("failed to setup instance: %w", err)
} }

View File

@ -69,7 +69,7 @@ func (c *CLI) Write(ctx context.Context, clients *WriteClients, params *WritePar
req = req.Org(c.ActiveConfig.Org) req = req.Org(c.ActiveConfig.Org)
} }
if _, err := clients.Client.PostWriteExecute(req); err != nil { if _, err := req.Execute(); err != nil {
return err return err
} }