Skip to content
Ona Docs

CreatePrebuildLogsToken

client.Prebuilds.NewLogsToken(ctx, body) (*PrebuildNewLogsTokenResponse, error)
POST/gitpod.v1.PrebuildService/CreatePrebuildLogsToken

Creates a logs access token for a prebuild.

Use this method to:

  • Stream logs from a running prebuild
  • Access archived logs from completed prebuilds

Generated tokens are valid for one hour.

Examples

  • Create prebuild logs token:

    Generates a token for accessing prebuild logs.

    prebuildId: "07e03a28-65a5-4d98-b532-8ea67b188048"
ParametersExpand Collapse
body PrebuildNewLogsTokenParams
PrebuildID param.Field[string]

prebuild_id specifies the prebuild for which the logs token should be created.

+required

formatuuid
ReturnsExpand Collapse
type PrebuildNewLogsTokenResponse struct{…}
AccessToken string

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

CreatePrebuildLogsToken

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.Prebuilds.NewLogsToken(context.TODO(), gitpod.PrebuildNewLogsTokenParams{
    PrebuildID: 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"
}