Skip to content
Ona Docs

StopEnvironment

client.Environments.Stop(ctx, body) (*EnvironmentStopResponse, error)
POST/gitpod.v1.EnvironmentService/StopEnvironment

Stops a running environment.

Use this method to pause work while preserving the environment’s state. The environment can be resumed later using StartEnvironment.

Examples

  • Stop an environment:

    Gracefully stops a running environment while preserving its state.

    environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
ParametersExpand Collapse
body EnvironmentStopParams
EnvironmentID param.Field[string]Optional

environment_id specifies which environment should be stopped.

+required

formatuuid
ReturnsExpand Collapse
type EnvironmentStopResponse interface{…}

StopEnvironment

package main

import (
  "context"
  "fmt"

  "github.com/gitpod-io/gitpod-sdk-go"
  "github.com/gitpod-io/gitpod-sdk-go/option"
)

func main() {
  client := gitpod.NewClient(
    option.WithBearerToken("My Bearer Token"),
  )
  response, err := client.Environments.Stop(context.TODO(), gitpod.EnvironmentStopParams{
    EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response)
}
{}
Returns Examples
{}