storage

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 32 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package storage implements codersdk-backed REST storage for the aggregated API server's CoderWorkspace and CoderTemplate resources.

v1 Semantics:

  • Resources are namespace-scoped; the namespace represents the CoderControlPlane namespace.
  • Template object names follow the format "<organization>.<template-name>".
  • Workspace object names follow "<organization>.<user>.<workspace-name>".
  • The dot separator works because Coder names are alphanumeric-with-hyphens (no dots), while Kubernetes object names allow dots (DNS-1123 subdomains).
  • A single admin session token is used for all API calls (no per-request impersonation in v1).
  • Storage resolves the backing codersdk.Client via a ClientProvider interface.
  • All-namespaces LIST aggregates results across eligible CoderControlPlane namespaces when the provider implements NamespaceLister.

Index

Constants

View Source
const (

	// MaxTemplateVersionBuildWaitTimeout keeps template build waits within aggregated API request deadlines.
	MaxTemplateVersionBuildWaitTimeout = 30 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TemplateStorage

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

TemplateStorage provides codersdk-backed CoderTemplate objects.

func NewTemplateStorage

func NewTemplateStorage(provider coder.ClientProvider) *TemplateStorage

NewTemplateStorage builds codersdk-backed storage for CoderTemplate resources.

func (*TemplateStorage) ConvertToTable

func (s *TemplateStorage) ConvertToTable(ctx context.Context, object, tableOptions runtime.Object) (*metav1.Table, error)

ConvertToTable converts a template object or list into kubectl table output.

func (*TemplateStorage) Create

func (s *TemplateStorage) Create(
	ctx context.Context,
	obj runtime.Object,
	createValidation rest.ValidateObjectFunc,
	_ *metav1.CreateOptions,
) (runtime.Object, error)

Create creates a CoderTemplate through codersdk.

func (*TemplateStorage) Delete

func (s *TemplateStorage) Delete(
	ctx context.Context,
	name string,
	deleteValidation rest.ValidateObjectFunc,
	options *metav1.DeleteOptions,
) (runtime.Object, bool, error)

Delete deletes a CoderTemplate through codersdk.

func (*TemplateStorage) Destroy

func (s *TemplateStorage) Destroy()

Destroy cleans up storage resources.

func (*TemplateStorage) Get

Get fetches a CoderTemplate by organization and template name.

func (*TemplateStorage) GetSingularName

func (s *TemplateStorage) GetSingularName() string

GetSingularName returns the singular name of the CoderTemplate resource.

func (*TemplateStorage) List

List fetches CoderTemplate objects from codersdk.

func (*TemplateStorage) NamespaceScoped

func (s *TemplateStorage) NamespaceScoped() bool

NamespaceScoped returns true because CoderTemplate is namespaced.

func (*TemplateStorage) New

func (s *TemplateStorage) New() runtime.Object

New returns an empty CoderTemplate object.

func (*TemplateStorage) NewList

func (s *TemplateStorage) NewList() runtime.Object

NewList returns an empty CoderTemplateList object.

func (*TemplateStorage) Update

func (s *TemplateStorage) Update(
	ctx context.Context,
	name string,
	objInfo rest.UpdatedObjectInfo,
	createValidation rest.ValidateObjectFunc,
	updateValidation rest.ValidateObjectUpdateFunc,
	forceAllowCreate bool,
	_ *metav1.UpdateOptions,
) (runtime.Object, bool, error)

Update applies a template metadata/source reconcile.

func (*TemplateStorage) Watch

Watch watches CoderTemplate objects backed by codersdk.

type WorkspaceStorage

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

WorkspaceStorage provides codersdk-backed CoderWorkspace objects.

func NewWorkspaceStorage

func NewWorkspaceStorage(provider coder.ClientProvider) *WorkspaceStorage

NewWorkspaceStorage builds codersdk-backed storage for CoderWorkspace resources.

func (*WorkspaceStorage) ConvertToTable

func (s *WorkspaceStorage) ConvertToTable(ctx context.Context, object, tableOptions runtime.Object) (*metav1.Table, error)

ConvertToTable converts a workspace object or list into kubectl table output.

func (*WorkspaceStorage) Create

func (s *WorkspaceStorage) Create(
	ctx context.Context,
	obj runtime.Object,
	createValidation rest.ValidateObjectFunc,
	_ *metav1.CreateOptions,
) (runtime.Object, error)

Create creates a CoderWorkspace through codersdk.

func (*WorkspaceStorage) Delete

func (s *WorkspaceStorage) Delete(
	ctx context.Context,
	name string,
	deleteValidation rest.ValidateObjectFunc,
	options *metav1.DeleteOptions,
) (runtime.Object, bool, error)

Delete requests workspace deletion through a codersdk build transition.

func (*WorkspaceStorage) Destroy

func (s *WorkspaceStorage) Destroy()

Destroy cleans up storage resources.

func (*WorkspaceStorage) Get

Get fetches a CoderWorkspace by organization, owner, and workspace name.

func (*WorkspaceStorage) GetSingularName

func (s *WorkspaceStorage) GetSingularName() string

GetSingularName returns the singular name of the CoderWorkspace resource.

func (*WorkspaceStorage) List

List fetches CoderWorkspace objects from codersdk.

func (*WorkspaceStorage) NamespaceScoped

func (s *WorkspaceStorage) NamespaceScoped() bool

NamespaceScoped returns true because CoderWorkspace is namespaced.

func (*WorkspaceStorage) New

func (s *WorkspaceStorage) New() runtime.Object

New returns an empty CoderWorkspace object.

func (*WorkspaceStorage) NewList

func (s *WorkspaceStorage) NewList() runtime.Object

NewList returns an empty CoderWorkspaceList object.

func (*WorkspaceStorage) Update

func (s *WorkspaceStorage) Update(
	ctx context.Context,
	name string,
	objInfo rest.UpdatedObjectInfo,
	createValidation rest.ValidateObjectFunc,
	updateValidation rest.ValidateObjectUpdateFunc,
	forceAllowCreate bool,
	_ *metav1.UpdateOptions,
) (runtime.Object, bool, error)

Update updates workspace run state through codersdk build transitions.

func (*WorkspaceStorage) Watch

Watch watches CoderWorkspace objects backed by codersdk.

Jump to

Keyboard shortcuts

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