From cfb0d69fac1c9e457286931437936eb409f7030e Mon Sep 17 00:00:00 2001 From: rsullivan Date: Wed, 13 Sep 2023 08:35:29 -0600 Subject: [PATCH] start/stop eng --- examples/{suspend_engine => stop_engine}/main.go | 4 ++-- rai/client.go | 4 ++-- rai/client_test.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) rename examples/{suspend_engine => stop_engine}/main.go (94%) diff --git a/examples/suspend_engine/main.go b/examples/stop_engine/main.go similarity index 94% rename from examples/suspend_engine/main.go rename to examples/stop_engine/main.go index 46ce5da..14252f2 100644 --- a/examples/suspend_engine/main.go +++ b/examples/stop_engine/main.go @@ -39,12 +39,12 @@ func run(opts *Options) error { switch rsp.State { case "PROVISIONED": - err := client.SuspendEngine(opts.Engine) + err := client.StopEngine(opts.Engine) if err != nil { return err } case "SUSPENDED": - err := client.ResumeEngine(opts.Engine) + err := client.StartEngine(opts.Engine) if err != nil { return err } diff --git a/rai/client.go b/rai/client.go index 5aee422..303d598 100644 --- a/rai/client.go +++ b/rai/client.go @@ -601,7 +601,7 @@ func (c *Client) ListEngines(filters ...interface{}) ([]Engine, error) { return result.Engines, nil } -func (c *Client) ResumeEngine(engineName string) error { +func (c *Client) StartEngine(engineName string) error { var result interface{} data := &SuspendEngineRequest{Suspend: false} uri := makePath(PathEngine, engineName) @@ -612,7 +612,7 @@ func (c *Client) ResumeEngine(engineName string) error { return nil } -func (c *Client) SuspendEngine(engineName string) error { +func (c *Client) StopEngine(engineName string) error { var result interface{} data := &SuspendEngineRequest{Suspend: true} uri := makePath(PathEngine, engineName) diff --git a/rai/client_test.go b/rai/client_test.go index ce647b9..90a9acf 100644 --- a/rai/client_test.go +++ b/rai/client_test.go @@ -219,7 +219,7 @@ func TestEngine(t *testing.T) { assert.Nil(t, engine) // resume the test engine - err = client.SuspendEngine(test.engineName) + err = client.StopEngine(test.engineName) assert.Nil(t, err) waitOrFail := func(state string) { @@ -244,7 +244,7 @@ func TestEngine(t *testing.T) { assert.Equal(t, "SUSPENDED", engine.State) // suspend the test engine - err = client.ResumeEngine(test.engineName) + err = client.StartEngine(test.engineName) assert.Nil(t, err) waitOrFail("PROVISIONED")