convert

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 14 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 convert maps codersdk models to aggregated API resources and request payloads.

Index

Constants

View Source
const (
	// TemplateVersionOrganizationLabel holds the organization name of a CoderTemplateVersion.
	TemplateVersionOrganizationLabel = "aggregation.coder.com/organization"
	// TemplateVersionTemplateLabel holds the template name of a CoderTemplateVersion.
	TemplateVersionTemplateLabel = "aggregation.coder.com/template"
)

Variables

This section is empty.

Functions

func TemplateCreateRequestFromK8s

func TemplateCreateRequestFromK8s(obj *aggregationv1alpha1.CoderTemplate, templateName string) (codersdk.CreateTemplateRequest, error)

TemplateCreateRequestFromK8s builds a codersdk.CreateTemplateRequest from a K8s CoderTemplate.

func TemplateToK8s

func TemplateToK8s(namespace string, t codersdk.Template) *aggregationv1alpha1.CoderTemplate

TemplateToK8s converts a codersdk.Template to an aggregated API CoderTemplate.

func TemplateUpdateMetaRequestFromK8s

func TemplateUpdateMetaRequestFromK8s(obj *aggregationv1alpha1.CoderTemplate) codersdk.UpdateTemplateMeta

TemplateUpdateMetaRequestFromK8s builds a codersdk.UpdateTemplateMeta request.

func TemplateVersionToK8s added in v0.1.3

TemplateVersionToK8s converts a Coder template version of tpl to a CoderTemplateVersion.

metadata.resourceVersion is a fingerprint (hex SHA-256) of the returned object. It changes when any returned field changes, including the active flag, which Coder does not reflect in the version's own updated_at. Compare it only for equality.

func WorkspaceCreateRequestFromK8s

func WorkspaceCreateRequestFromK8s(
	obj *aggregationv1alpha1.CoderWorkspace,
	workspaceName string,
	templateID uuid.UUID,
) (codersdk.CreateWorkspaceRequest, error)

WorkspaceCreateRequestFromK8s builds a codersdk.CreateWorkspaceRequest.

func WorkspaceToK8s

func WorkspaceToK8s(namespace string, w codersdk.Workspace) *aggregationv1alpha1.CoderWorkspace

WorkspaceToK8s converts a codersdk.Workspace to an aggregated API CoderWorkspace.

metadata.resourceVersion is an opaque fingerprint of the returned representation: the full SHA-256 of the converted object serialized with resourceVersion unset. Every emitted metadata/spec/status field takes part, including lastUsedAt and autoShutdown, so a change that this API exposes changes the token even when Coder's Workspace.UpdatedAt stays the same, and a backend-only change that leaves the projection identical keeps the token. It is not monotonic and not a history cursor: an identical projection yields the same token again.

Types

This section is empty.

Jump to

Keyboard shortcuts

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