version

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package version provides access to the /cloud/image/version endpoints — listing build history for a custom image, fetching build logs, and deleting individual versions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
	BuildStatus string `json:"build_status"`
	BuildTrace  string `json:"build_trace"`
}

Build is the body of GetBuildResponse — status plus the raw CI build trace.

type Client

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

Client is a service for the /cloud/image/version endpoints.

func New

func New(c *api.Client) *Client

New initialises a version Client.

func (*Client) Delete

func (s *Client) Delete(ctx context.Context, request DeleteRequest) (response JobResponse, err error)

Delete removes a specific version of a custom image via /cloud/image/version/delete.json. Version is the version string (e.g. "1.1-1076") as returned by ListAll. Returns a scheduler job.

To delete the *image* itself, use cloud.image.Delete instead — this endpoint only prunes one build/version.

func (*Client) GetBuild

func (s *Client) GetBuild(ctx context.Context, request GetBuildRequest) (response GetBuildResponse, err error)

GetBuild fetches the build log for a specific custom-image build via /cloud/image/version/get_build.json. Use this to surface CI failures to the consumer when ListAll reports build_status="failed".

func (*Client) ListAll

func (s *Client) ListAll(ctx context.Context, request ListAllRequest) (response ListAllResponse, err error)

ListAll lists versions (build history) for a custom image via /cloud/image/version/list_all.json. ImageID is required.

Each Version carries a BuildStatus ("success" / "failed" / "running") and a BuildID. Only the latest successful build is available to deploy in a container.

type DeleteRequest

type DeleteRequest struct {
	Code    string
	Version string
}

DeleteRequest removes a specific version of a custom image. Version is the version string (e.g. "1.1-1076"), available from ListAllResponse.

type GetBuildRequest

type GetBuildRequest struct {
	Code    string
	BuildID string
}

GetBuildRequest fetches the build log for a specific build. BuildID is the numeric build ID (Version.BuildID from ListAllResponse).

type GetBuildResponse

type GetBuildResponse struct {
	Return Build `json:"return"`
	models.APIResponse
}

GetBuildResponse is the return from /cloud/image/version/get_build.json.

type JobResponse

type JobResponse struct {
	Return struct {
		models.Job `json:"job"`
	} `json:"return"`
	models.APIResponse
}

JobResponse wraps the scheduler-job return for write operations on this namespace (currently only Delete).

type ListAllRequest

type ListAllRequest struct {
	ImageID    int
	SortBy     string
	SortDir    string
	PageSize   int
	PageNumber int
}

ListAllRequest lists versions of a custom image. ImageID is the numeric id of the image (from cloud/image/get's "id" field, or list_all). Filters are optional pagination/ordering knobs.

type ListAllResponse

type ListAllResponse struct {
	Return struct {
		models.Pagination
		Versions []Version `json:"data"`
	} `json:"return"`
	models.APIResponse
}

ListAllResponse is the return from /cloud/image/version/list_all.json.

type Version

type Version struct {
	ID             string `json:"id"`
	ClientID       string `json:"client_id"`
	ImageID        string `json:"image_id"`
	Version        string `json:"version"`
	Labels         string `json:"labels"`
	DateAdded      string `json:"date_added"`
	DateUpdated    string `json:"date_updated"`
	IsMissing      string `json:"is_missing"`
	ForceConfig    string `json:"force_config"`
	BuildID        string `json:"build_id"`
	BuildStatus    string `json:"build_status"`
	Pending        any    `json:"pending"`
	Code           string `json:"code"`
	ContainerCount int    `json:"container_count"`
}

Version describes one build of a custom image.

Jump to

Keyboard shortcuts

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