Skip to content

Commit

Permalink
Make notebooks wait for active state and enable stopping/starting ins…
Browse files Browse the repository at this point in the history
…… (#9971) (#1950)

* Make notebooks wait for active state and enable stopping/starting instances using the desired_state field

* ignore update_time

[upstream:18072d2b0665b0182e8bcd677fc1d0ca75693507]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Feb 13, 2024
1 parent 631f0d3 commit 2618402
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package notebooks

import (
"fmt"
"reflect"
"sort"
"strings"
Expand Down Expand Up @@ -62,6 +63,25 @@ func NotebooksInstanceKmsDiffSuppress(_, old, new string, _ *schema.ResourceData
return false
}

func modifyNotebooksInstanceState(config *transport_tpg.Config, d *schema.ResourceData, project string, billingProject string, userAgent string, state string) (map[string]interface{}, error) {
url, err := tpgresource.ReplaceVars(d, config, "{{NotebooksBasePath}}projects/{{project}}/locations/{{location}}/instances/{{name}}:"+state)
if err != nil {
return nil, err
}

res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: config,
Method: "POST",
Project: billingProject,
RawURL: url,
UserAgent: userAgent,
})
if err != nil {
return nil, fmt.Errorf("Unable to %q google_notebooks_instance %q: %s", state, d.Id(), err)
}
return res, nil
}

const NotebooksInstanceAssetType string = "notebooks.googleapis.com/Instance"

func ResourceConverterNotebooksInstance() cai.ResourceConverter {
Expand Down

0 comments on commit 2618402

Please sign in to comment.