Skip to content
Ona Docs

GetSecretValue

client.Secrets.GetValue(ctx, body) (*SecretGetValueResponse, error)
POST/gitpod.v1.SecretService/GetSecretValue

Gets the value of a secret. Only available to environments that are authorized to access the secret.

Use this method to:

  • Retrieve secret values
  • Access credentials

Examples

  • Get secret value:

    Retrieves the value of a specific secret.

    secretId: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
ParametersExpand Collapse
body SecretGetValueParams
SecretID param.Field[string]Optional
formatuuid
ReturnsExpand Collapse
type SecretGetValueResponse struct{…}
Value stringOptional

GetSecretValue

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.Secrets.GetValue(context.TODO(), gitpod.SecretGetValueParams{
    SecretID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Value)
}
{
  "value": "value"
}
Returns Examples
{
  "value": "value"
}