Skip to content
Ona Docs

CreateEnvironmentLogsToken

client.Environments.NewLogsToken(ctx, body) (*EnvironmentNewLogsTokenResponse, error)
POST/gitpod.v1.EnvironmentService/CreateEnvironmentLogsToken

Creates an access token for retrieving environment logs.

Generated tokens are valid for one hour and provide read-only access to the environment’s logs.

Examples

  • Generate logs token:

    Creates a temporary access token for retrieving environment logs.

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

environment_id specifies the environment for which the logs token should be created.

+required

formatuuid
ReturnsExpand Collapse
type EnvironmentNewLogsTokenResponse struct{…}
AccessToken string

access_token is the token that can be used to access the logs of the environment

CreateEnvironmentLogsToken

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.NewLogsToken(context.TODO(), gitpod.EnvironmentNewLogsTokenParams{
    EnvironmentID: gitpod.F("07e03a28-65a5-4d98-b532-8ea67b188048"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.AccessToken)
}
{
  "accessToken": "accessToken"
}
Returns Examples
{
  "accessToken": "accessToken"
}