workbench

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package workbench provides workbench service helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEnvsToServiceRequests

func AddEnvsToServiceRequests(
	envs []string,
	serviceRequests []types.ServiceRequest,
) []types.ServiceRequest

AddEnvsToServiceRequests returns a function that will add the given environment strings, in the form `name=value`, to each service request.

func Auth0IDsQuery

func Auth0IDsQuery(ids []string, sortSpec string) url.Values

Auth0IDsQuery returns an Auth0 compatible query for the given IDs.

func BulkDeleteImages

func BulkDeleteImages(ctx context.Context, s *WorkbenchService, ids []string) ([]string, error)

BulkDeleteImages deletes the images with the given ids.

func BulkDeleteJobSubmissions

func BulkDeleteJobSubmissions(ctx context.Context, s *WorkbenchService, ids []string) ([]string, error)

BulkDeleteJobSubmissions deletes the job submission with the given id.

func BulkDeleteJobs

func BulkDeleteJobs(ctx context.Context, s *WorkbenchService, ids []string) ([]string, error)

BulkDeleteJobs deletes the job with the given id.

func BulkDeleteSnapshots

func BulkDeleteSnapshots(ctx context.Context, s *WorkbenchService, ids []string) ([]string, error)

BulkDeleteSnapshots deletes the snapshot with the given id.

func BulkDeleteWorkbenches

func BulkDeleteWorkbenches(ctx context.Context, s *WorkbenchService, ids []string) ([]string, error)

BulkDeleteWorkbenches deletes the workbench with the given id.

func BulkDeleteWorkspaces

func BulkDeleteWorkspaces(ctx context.Context, s *WorkbenchService, ids []string) ([]string, error)

BulkDeleteWorkspaces deletes the workspaces with the given ids.

func BulkUpdateImages

func BulkUpdateImages(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	body types.Image,
) (types.Images, error)

BulkUpdateImages applies the given types.Image to all the images with the given ids.

func BulkUpdateJobs

func BulkUpdateJobs(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	body types.Job,
) (types.Jobs, error)

BulkUpdateJobs applies the given types.Job to all the jobs with the given ids.

func BulkUpdateSnapshots

func BulkUpdateSnapshots(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	body types.Snapshot,
) (types.Snapshots, error)

BulkUpdateSnapshots applies the given types.Snapshot to all the snapshots with the given ids.

func BulkUpdateWorkbenches

func BulkUpdateWorkbenches(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	body types.Workbench,
) (types.Workbenches, error)

BulkUpdateWorkbenches applies the given types.Workbench to all the workbenches with the given ids.

func BulkUpdateWorkspaces

func BulkUpdateWorkspaces(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	body types.Workspace,
) (types.Workspaces, error)

BulkUpdateWorkspaces applies the given types.Workspace to all the workspaces with the given ids.

func CreateImage

func CreateImage(ctx context.Context, s *WorkbenchService, body types.Image) (types.Image, error)

CreateImage creates an image.

func CreateJob

func CreateJob(ctx context.Context, s *WorkbenchService, body types.Job) (types.Job, error)

CreateJob creates a job.

func CreateJobSubmission

func CreateJobSubmission(
	ctx context.Context,
	s *WorkbenchService,
	body types.JobSubmission,
) (types.JobSubmission, error)

CreateJobSubmission creates a job submission.

func CreateSnapshot

func CreateSnapshot(
	ctx context.Context,
	s *WorkbenchService,
	body types.Snapshot,
) (types.Snapshot, error)

CreateSnapshot creates a snapshot.

func CreateWorkbench

func CreateWorkbench(
	ctx context.Context,
	s *WorkbenchService,
	body types.Workbench,
) (types.Workbench, error)

CreateWorkbench creates a workbench.

func CreateWorkspace

func CreateWorkspace(
	ctx context.Context,
	s *WorkbenchService,
	body types.Workspace,
) (types.Workspace, error)

CreateWorkspace creates a workspace.

func DescribeConflicts

func DescribeConflicts(_ui ui.UI, resources types.Conflicts) error

DescribeConflicts returns a function that describes the given conflicts.

func DescribeDataplanes

func DescribeDataplanes(_ui ui.UI, resources types.Dataplanes) error

DescribeDataplanes returns a function that describes the given dataplanes.

func DescribeImageBuilds

func DescribeImageBuilds(_ui ui.UI, resources types.ImageBuilds) error

DescribeImageBuilds returns a function that describes the given image builds.

func DescribeImages

func DescribeImages(_ui ui.UI, resources types.Images) error

DescribeImages returns a function that describes the given images.

func DescribeJobSubmissions

func DescribeJobSubmissions(_ui ui.UI, resources types.JobSubmissions) error

DescribeJobSubmissions returns a function that describes the given job submissions.

func DescribeJobs

func DescribeJobs(_ui ui.UI, resources types.Jobs) error

DescribeJobs returns a function that describes the given jobs.

func DescribeSnapshots

func DescribeSnapshots(_ui ui.UI, resources types.Snapshots) error

DescribeSnapshots returns a function that describes the given snapshots.

func DescribeUsers

func DescribeUsers(_ui ui.UI, resources types.Auth0UserList) error

DescribeUsers returns a function that describes the given users.

func DescribeWorkbenches

func DescribeWorkbenches(_ui ui.UI, resources types.Workbenches) error

DescribeWorkbenches returns a function that describes the given workbenches.

func DescribeWorkspaces

func DescribeWorkspaces(_ui ui.UI, resources types.Workspaces) error

DescribeWorkspaces returns a function that describes the given workspaces.

func Get

func Get[T any](ctx context.Context, s *WorkbenchService, path string, query url.Values) result.Result[T]

Get performs an http GET with the given path and query against the given WorkbenchService. The response body is marshaled from JSON into the given type T and returned as a result.

func GetAccessToken

func GetAccessToken(s *WorkbenchService) string

GetAccessToken gets the access token from the given WorkbenchService.

func GetApplicationIDs

func GetApplicationIDs(
	ctx context.Context,
	s *WorkbenchService,
) ([]string, error)

GetApplicationIDs returns all application IDs present in the WorkbenchService.

func GetApplications

func GetApplications(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Applications, error)

GetApplications gets the Applications supported by the WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetConflicts

func GetConflicts(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Conflicts, error)

GetConflicts returns the Conflicts currently present in the Workbench Service. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetDataplanes

func GetDataplanes(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Dataplanes, error)

GetDataplanes gets the Dataplanes in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetEvents

func GetEvents(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Events, error)

GetEvents gets the events from the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetImageBuilds

func GetImageBuilds(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.ImageBuilds, error)

GetImageBuilds gets the image builds in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetImages

func GetImages(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Images, error)

GetImages gets the images in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetInitializerRequests

func GetInitializerRequests(
	ctx context.Context,
	svc *WorkbenchService,
	initializerIDs []string,
) ([]types.ServiceRequest, error)

GetInitializerRequests converts the given initializer IDs into a set of service requests that can be included in a Workspace request with those initializers.

func GetInitializers

func GetInitializers(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Initializers, error)

GetInitializers gets the initializers in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetJobSubmissions

func GetJobSubmissions(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.JobSubmissions, error)

GetJobSubmissions gets the job submissions in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetJobs

func GetJobs(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Jobs, error)

GetJobs gets the jobs in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetNodepoolIDs

func GetNodepoolIDs(
	ctx context.Context,
	s *WorkbenchService,
) ([]string, error)

GetNodepoolIDs returns all nodepool IDs present in the WorkbenchService.

func GetNodepools

func GetNodepools(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Nodepools, error)

GetNodepools gets the nodepools in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetPings

func GetPings(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Pings, error)

GetPings gets the pings in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetRaw

func GetRaw(ctx context.Context, s *WorkbenchService, rawURL string) result.Result[string]

GetRaw performs an http GET with the given path and query against the given WorkbenchService. The response body is marshaled into a string and returned as a result.

func GetServiceIDs

func GetServiceIDs(
	ctx context.Context,
	s *WorkbenchService,
) ([]string, error)

GetServiceIDs returns all service IDs present in the WorkbenchService.

func GetServiceRequests

func GetServiceRequests(
	ctx context.Context,
	svc *WorkbenchService,
	application string,
	serviceIDs []string,
) ([]types.ServiceRequest, error)

GetServiceRequests converts the given application into a set of service requests that can be included in a Workbench request for that application.

func GetServices

func GetServices(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Services, error)

GetServices gets the services in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetSettings

func GetSettings(
	ctx context.Context,
	s *WorkbenchService,
	userID string,
	tenant bool,
) (types.Settings, error)

GetSettings returns the Settings currently present in the Workbench Service.

func GetSnapshots

func GetSnapshots(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Snapshots, error)

GetSnapshots gets the snapshots in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetStorageClasses

func GetStorageClasses(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.StorageClasses, error)

GetStorageClasses gets the storage classes in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetUsers

func GetUsers(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Auth0UserList, error)

GetUsers gets the users in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetValidDataplaneID

func GetValidDataplaneID(ctx context.Context, svc *WorkbenchService, dataplaneID string) (string, error)

GetValidDataplaneID looks up a dataplane using the given dataplaneID. If the dataplane exists then its ID is returned. If given an empty dataplaneID then an empty string is returned with no error.

func GetValidWorkspaceRequests

func GetValidWorkspaceRequests(
	ctx context.Context,
	svc *WorkbenchService,
	workspaceIDs []string,
) ([]types.WorkspaceRequestWithMetadata, error)

GetValidWorkspaceRequests takes the given worksaceIDs, fetches those workspaces from the server, and returns the database id and full workspace request body for each.

func GetWorkbenches

func GetWorkbenches(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Workbenches, error)

GetWorkbenches gets the workbenches in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func GetWorkspaces

func GetWorkspaces(
	ctx context.Context,
	s *WorkbenchService,
	ids []string,
	sortSpec string,
) (types.Workspaces, error)

GetWorkspaces gets the workspaces in the given WorkbenchService. If given any ids, only the matching resources will be returned. Otherwise, all resources are returned.

func IDsOrControllerIDsQuery

func IDsOrControllerIDsQuery(ids []string, sortSpec string) url.Values

IDsOrControllerIDsQuery returns a PostgREST compatible query for the given IDs and sort spec that will match either the actual id or the controller_id columns.

func IDsQuery

func IDsQuery(ids []string, sortSpec string) url.Values

IDsQuery returns a PostgREST compatible query for the given IDs and sort spec.

func Post

func Post[T any](ctx context.Context, s *WorkbenchService, path string, body any) result.Result[T]

Post performs an http POST with the given path and query against the given WorkbenchService. The response body is marshaled from JSON into the given type T and returned as a result.

func PrintAPI

func PrintAPI(
	_ui ui.UI,
	resources API,
) error

PrintAPI prints the given API.

func PrintApplications

func PrintApplications(_ui ui.UI, _ string, resources types.Applications) error

PrintApplications returns a function that prints the given applications.

func PrintConflicts

func PrintConflicts(_ui ui.UI, _ string, resources types.Conflicts) error

PrintConflicts returns a function that prints the given conflicts.

func PrintDataplanes

func PrintDataplanes(_ui ui.UI, _ string, resources types.Dataplanes) error

PrintDataplanes returns a function that prints the given dataplanes.

func PrintEvents

func PrintEvents(_ui ui.UI, _ string, resources types.Events) error

PrintEvents returns a function that prints the given events.

func PrintImageBuilds

func PrintImageBuilds(_ui ui.UI, _ string, resources types.ImageBuilds) error

PrintImageBuilds returns a function that prints the given image builds.

func PrintImages

func PrintImages(_ui ui.UI, token string, resources types.Images) error

PrintImages returns a function that prints the given images.

func PrintInitializers

func PrintInitializers(_ui ui.UI, _ string, resources types.Initializers) error

PrintInitializers returns a function that prints the given initializers.

func PrintJobSubmissions

func PrintJobSubmissions(_ui ui.UI, token string, resources types.JobSubmissions) error

PrintJobSubmissions returns a function that prints the given job submissions.

func PrintJobs

func PrintJobs(_ui ui.UI, token string, resources types.Jobs) error

PrintJobs returns a function that prints the given jobs.

func PrintNodepools

func PrintNodepools(_ui ui.UI, _ string, resources types.Nodepools) error

PrintNodepools returns a function that prints the given nodepools.

func PrintPings

func PrintPings(_ui ui.UI, _ string, resources types.Pings) error

PrintPings returns a function that prints the given pings.

func PrintServices

func PrintServices(_ui ui.UI, _ string, resources types.Services) error

PrintServices returns a function that prints the given services.

func PrintSettings

func PrintSettings(_ui ui.UI, resources types.Settings) error

PrintSettings returns a function that prints the given Settings.

func PrintSnapshots

func PrintSnapshots(_ui ui.UI, token string, resources types.Snapshots) error

PrintSnapshots returns a function that prints the given snapshots.

func PrintStorageClasses

func PrintStorageClasses(_ui ui.UI, _ string, resources types.StorageClasses) error

PrintStorageClasses returns a function that prints the given storage classes.

func PrintUsers

func PrintUsers(_ui ui.UI, _ string, resources types.Auth0UserList) error

PrintUsers returns a function that prints the given users.

func PrintWorkbenches

func PrintWorkbenches(_ui ui.UI, token string, resources types.Workbenches) error

PrintWorkbenches returns a function that prints the given workbenches.

func PrintWorkspaces

func PrintWorkspaces(_ui ui.UI, token string, resources types.Workspaces) error

PrintWorkspaces returns a function that prints the given workspaces.

func RebuildImage

func RebuildImage(ctx context.Context, s *WorkbenchService, id string) (bool, error)

RebuildImage rebuilds the image with the given id.

func SetSetting

func SetSetting(
	ctx context.Context,
	s *WorkbenchService,
	userID string,
	name string,
	value any,
	tenant bool,
) (bool, error)

SetSetting sets the given setting to the given value.

Types

type API

type API *spec.Swagger

API is the OpenAPI (Swagger) specification for the Workbench service.

func GetAPI

func GetAPI(
	ctx context.Context,
	s *WorkbenchService,
) (API, error)

GetAPI returns the API from the WorkbenchService.

type WorkbenchService

type WorkbenchService struct {
	// contains filtered or unexported fields
}

WorkbenchService is an exported type. nolint:revive

func NewWorkbenchService

func NewWorkbenchService(endpoint, accessToken, csrfToken string) *WorkbenchService

NewWorkbenchService returns a new workbench service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址