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
- type TemplateStorage
- func (s *TemplateStorage) ConvertToTable(ctx context.Context, object, tableOptions runtime.Object) (*metav1.Table, error)
- func (s *TemplateStorage) Create(ctx context.Context, obj runtime.Object, ...) (runtime.Object, error)
- func (s *TemplateStorage) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, ...) (runtime.Object, bool, error)
- func (s *TemplateStorage) Destroy()
- func (s *TemplateStorage) Get(ctx context.Context, name string, _ *metav1.GetOptions) (runtime.Object, error)
- func (s *TemplateStorage) GetSingularName() string
- func (s *TemplateStorage) List(ctx context.Context, _ *metainternalversion.ListOptions) (runtime.Object, error)
- func (s *TemplateStorage) NamespaceScoped() bool
- func (s *TemplateStorage) New() runtime.Object
- func (s *TemplateStorage) NewList() runtime.Object
- func (s *TemplateStorage) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, ...) (runtime.Object, bool, error)
- func (s *TemplateStorage) Watch(ctx context.Context, opts *metainternalversion.ListOptions) (watch.Interface, error)
- type WorkspaceStorage
- func (s *WorkspaceStorage) ConvertToTable(ctx context.Context, object, tableOptions runtime.Object) (*metav1.Table, error)
- func (s *WorkspaceStorage) Create(ctx context.Context, obj runtime.Object, ...) (runtime.Object, error)
- func (s *WorkspaceStorage) Delete(ctx context.Context, name string, deleteValidation rest.ValidateObjectFunc, ...) (runtime.Object, bool, error)
- func (s *WorkspaceStorage) Destroy()
- func (s *WorkspaceStorage) Get(ctx context.Context, name string, _ *metav1.GetOptions) (runtime.Object, error)
- func (s *WorkspaceStorage) GetSingularName() string
- func (s *WorkspaceStorage) List(ctx context.Context, _ *metainternalversion.ListOptions) (runtime.Object, error)
- func (s *WorkspaceStorage) NamespaceScoped() bool
- func (s *WorkspaceStorage) New() runtime.Object
- func (s *WorkspaceStorage) NewList() runtime.Object
- func (s *WorkspaceStorage) Update(ctx context.Context, name string, objInfo rest.UpdatedObjectInfo, ...) (runtime.Object, bool, error)
- func (s *WorkspaceStorage) Watch(ctx context.Context, opts *metainternalversion.ListOptions) (watch.Interface, error)
Constants ¶
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, _ *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 ¶
func (s *TemplateStorage) Get(ctx context.Context, name string, _ *metav1.GetOptions) (runtime.Object, error)
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 ¶
func (s *TemplateStorage) List(ctx context.Context, _ *metainternalversion.ListOptions) (runtime.Object, error)
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 ¶
func (s *TemplateStorage) Watch(ctx context.Context, opts *metainternalversion.ListOptions) (watch.Interface, error)
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, _ *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 ¶
func (s *WorkspaceStorage) Get(ctx context.Context, name string, _ *metav1.GetOptions) (runtime.Object, error)
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 ¶
func (s *WorkspaceStorage) List(ctx context.Context, _ *metainternalversion.ListOptions) (runtime.Object, error)
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 ¶
func (s *WorkspaceStorage) Watch(ctx context.Context, opts *metainternalversion.ListOptions) (watch.Interface, error)
Watch watches CoderWorkspace objects backed by codersdk.