Skip to content
Ona Docs

GetService

client.Environments.Automations.Services.Get(ctx, body) (*EnvironmentAutomationServiceGetResponse, error)
POST/gitpod.v1.EnvironmentAutomationService/GetService

Gets details about a specific automation service.

Use this method to:

  • Check service status
  • View service configuration
  • Monitor service health
  • Retrieve service metadata

Examples

  • Get service details:

    Retrieves information about a specific service.

    id: "d2c94c27-3b76-4a42-b88c-95a85e392c68"
ParametersExpand Collapse
body EnvironmentAutomationServiceGetParams
ID param.Field[string]Optional
formatuuid
ReturnsExpand Collapse
type EnvironmentAutomationServiceGetResponse struct{…}
Service Service
ID string
formatuuid
EnvironmentID stringOptional
formatuuid
Metadata ServiceMetadataOptional
CreatedAt TimeOptional

created_at is the time the service was created.

formatdate-time
Creator SubjectOptional

creator describes the principal who created the service.

ID stringOptional

id is the UUID of the subject

formatuuid
Principal PrincipalOptional

Principal is the principal of the subject

One of the following:
const PrincipalUnspecified Principal = "PRINCIPAL_UNSPECIFIED"
const PrincipalAccount Principal = "PRINCIPAL_ACCOUNT"
const PrincipalUser Principal = "PRINCIPAL_USER"
const PrincipalRunner Principal = "PRINCIPAL_RUNNER"
const PrincipalEnvironment Principal = "PRINCIPAL_ENVIRONMENT"
const PrincipalServiceAccount Principal = "PRINCIPAL_SERVICE_ACCOUNT"
const PrincipalRunnerManager Principal = "PRINCIPAL_RUNNER_MANAGER"
Description stringOptional

description is a user-facing description for the service. It can be used to provide context and documentation for the service.

Name stringOptional

name is a user-facing name for the service. Unlike the reference, this field is not unique, and not referenced by the system. This is a short descriptive name for the service.

minLength1
Reference stringOptional

reference is a user-facing identifier for the service which must be unique on the environment. It is used to express dependencies between services, and to identify the service in user interactions (e.g. the CLI).

Role ServiceRoleOptional

role specifies the intended role or purpose of the service.

One of the following:
const ServiceRoleUnspecified ServiceRole = "SERVICE_ROLE_UNSPECIFIED"
const ServiceRoleDefault ServiceRole = "SERVICE_ROLE_DEFAULT"
const ServiceRoleEditor ServiceRole = "SERVICE_ROLE_EDITOR"
const ServiceRoleAIAgent ServiceRole = "SERVICE_ROLE_AI_AGENT"
const ServiceRoleSecurityAgent ServiceRole = "SERVICE_ROLE_SECURITY_AGENT"
TriggeredBy []AutomationTriggerOptional

triggered_by is a list of trigger that start the service.

BeforeSnapshot boolOptional
Manual boolOptional
PostDevcontainerStart boolOptional
PostEnvironmentStart boolOptional
PostMachineStart boolOptional
Prebuild boolOptional
Spec ServiceSpecOptional
Commands ServiceSpecCommandsOptional

commands contains the commands to start, stop and check the readiness of the service

Ready stringOptional

ready is an optional command that is run repeatedly until it exits with a zero exit code. If set, the service will first go into a Starting phase, and then into a Running phase once the ready command exits with a zero exit code.

Start stringOptional

start is the command to start and run the service. If start exits, the service will transition to the following phase:

  • Stopped: if the exit code is 0
  • Failed: if the exit code is not 0 If the stop command is not set, the start command will receive a SIGTERM signal when the service is requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal.
minLength1
Stop stringOptional

stop is an optional command that runs when the service is requested to stop. If set, instead of sending a SIGTERM signal to the start command, the stop command will be run. Once the stop command exits, the start command will receive a SIGKILL signal. If the stop command exits with a non-zero exit code, the service will transition to the Failed phase. If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and stop commands.

DesiredPhase ServicePhaseOptional

desired_phase is the phase the service should be in. Used to start or stop the service.

One of the following:
const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"
const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"
const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"
const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"
const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"
const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"
const ServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED"

env specifies environment variables for the service.

Name stringOptional

name is the environment variable name.

minLength1
Value stringOptional

value is a literal string value.

ValueFrom EnvironmentVariableSourceOptional

value_from specifies a source for the value.

SecretRef SecretRef

secret_ref references a secret by ID.

ID stringOptional

id is the UUID of the secret to reference.

formatuuid
RunsOn RunsOnOptional

runs_on specifies the environment the service should run on.

Docker RunsOnDockerOptional
Environment []stringOptional
Image stringOptional
minLength1
Machine unknownOptional

Machine runs the service/task directly on the VM/machine level.

Session stringOptional

session should be changed to trigger a restart of the service. If a service exits it will not be restarted until the session is changed.

SpecVersion stringOptional

version of the spec. The value of this field has no semantic meaning (e.g. don’t interpret it as as a timestamp), but it can be used to impose a partial order. If a.spec_version < b.spec_version then a was the spec before b.

Status ServiceStatusOptional
FailureMessage stringOptional

failure_message summarises why the service failed to operate. If this is non-empty the service has failed to operate and will likely transition to a failed state.

LogURL stringOptional

log_url contains the URL at which the service logs can be accessed.

Output map[string, string]Optional

output contains the output of the service. setting an output field to empty string will unset it.

Phase ServicePhaseOptional

phase is the current phase of the service.

One of the following:
const ServicePhaseUnspecified ServicePhase = "SERVICE_PHASE_UNSPECIFIED"
const ServicePhaseStarting ServicePhase = "SERVICE_PHASE_STARTING"
const ServicePhaseRunning ServicePhase = "SERVICE_PHASE_RUNNING"
const ServicePhaseStopping ServicePhase = "SERVICE_PHASE_STOPPING"
const ServicePhaseStopped ServicePhase = "SERVICE_PHASE_STOPPED"
const ServicePhaseFailed ServicePhase = "SERVICE_PHASE_FAILED"
const ServicePhaseDeleted ServicePhase = "SERVICE_PHASE_DELETED"
Session stringOptional

session is the current session of the service.

StatusVersion stringOptional

version of the status update. Service instances themselves are unversioned, but their status has different versions. The value of this field has no semantic meaning (e.g. don’t interpret it as as a timestamp), but it can be used to impose a partial order. If a.status_version < b.status_version then a was the status before b.

GetService

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"),
  )
  service, err := client.Environments.Automations.Services.Get(context.TODO(), gitpod.EnvironmentAutomationServiceGetParams{
    ID: gitpod.F("d2c94c27-3b76-4a42-b88c-95a85e392c68"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", service.Service)
}
{
  "service": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "metadata": {
      "createdAt": "2019-12-27T18:11:19.117Z",
      "creator": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "principal": "PRINCIPAL_UNSPECIFIED"
      },
      "description": "description",
      "name": "x",
      "reference": "reference",
      "role": "SERVICE_ROLE_UNSPECIFIED",
      "triggeredBy": [
        {
          "beforeSnapshot": true,
          "manual": true,
          "postDevcontainerStart": true,
          "postEnvironmentStart": true,
          "postMachineStart": true,
          "prebuild": true
        }
      ]
    },
    "spec": {
      "commands": {
        "ready": "ready",
        "start": "x",
        "stop": "stop"
      },
      "desiredPhase": "SERVICE_PHASE_UNSPECIFIED",
      "env": [
        {
          "name": "x",
          "value": "value",
          "valueFrom": {
            "secretRef": {
              "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
            }
          }
        }
      ],
      "runsOn": {
        "docker": {
          "environment": [
            "string"
          ],
          "image": "x"
        },
        "machine": {}
      },
      "session": "session",
      "specVersion": "specVersion"
    },
    "status": {
      "failureMessage": "failureMessage",
      "logUrl": "logUrl",
      "output": {
        "foo": "string"
      },
      "phase": "SERVICE_PHASE_UNSPECIFIED",
      "session": "session",
      "statusVersion": "statusVersion"
    }
  }
}
Returns Examples
{
  "service": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "environmentId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "metadata": {
      "createdAt": "2019-12-27T18:11:19.117Z",
      "creator": {
        "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
        "principal": "PRINCIPAL_UNSPECIFIED"
      },
      "description": "description",
      "name": "x",
      "reference": "reference",
      "role": "SERVICE_ROLE_UNSPECIFIED",
      "triggeredBy": [
        {
          "beforeSnapshot": true,
          "manual": true,
          "postDevcontainerStart": true,
          "postEnvironmentStart": true,
          "postMachineStart": true,
          "prebuild": true
        }
      ]
    },
    "spec": {
      "commands": {
        "ready": "ready",
        "start": "x",
        "stop": "stop"
      },
      "desiredPhase": "SERVICE_PHASE_UNSPECIFIED",
      "env": [
        {
          "name": "x",
          "value": "value",
          "valueFrom": {
            "secretRef": {
              "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"
            }
          }
        }
      ],
      "runsOn": {
        "docker": {
          "environment": [
            "string"
          ],
          "image": "x"
        },
        "machine": {}
      },
      "session": "session",
      "specVersion": "specVersion"
    },
    "status": {
      "failureMessage": "failureMessage",
      "logUrl": "logUrl",
      "output": {
        "foo": "string"
      },
      "phase": "SERVICE_PHASE_UNSPECIFIED",
      "session": "session",
      "statusVersion": "statusVersion"
    }
  }
}