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 ¶
- type Build
- type Client
- func (s *Client) Delete(ctx context.Context, request DeleteRequest) (response JobResponse, err error)
- func (s *Client) GetBuild(ctx context.Context, request GetBuildRequest) (response GetBuildResponse, err error)
- func (s *Client) ListAll(ctx context.Context, request ListAllRequest) (response ListAllResponse, err error)
- type DeleteRequest
- type GetBuildRequest
- type GetBuildResponse
- type JobResponse
- type ListAllRequest
- type ListAllResponse
- type Version
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 (*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 ¶
DeleteRequest removes a specific version of a custom image. Version is the version string (e.g. "1.1-1076"), available from ListAllResponse.
type GetBuildRequest ¶
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 ¶
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.