Documentation ¶
Overview ¶
Package weldr contains functions used to interact with a WELDR API Server
For normal usage InitClientUnixSocket() should be called with the api version and full path of the server's Unix Domain Socket. It will return a weldr.Client struct that you can then use to interact with the server.
For testing you can initialize a temporary weldr.Client using weldr.NewClient(), this is used in the weldr test functions.
Index ¶
- func AppendQuery(url, query string) string
- func GetContentFilename(header string) (string, error)
- func IsStringInSlice(slice []string, s string) bool
- func MoveFile(src, dst string) error
- func SetUpTemporaryRepository() (string, error)
- func TearDownTemporaryRepository(dir string) error
- type APIErrorMsg
- type APIResponse
- type BlueprintChanges
- type BlueprintsChangesV0
- type BlueprintsListV0
- type Change
- type Client
- func (c Client) APIURL(route string) string
- func (c Client) CancelCompose(id string) (ComposeCancelV0, []APIErrorMsg, error)
- func (c Client) ComposeImage(id string) (fileName string, apiResponse *APIResponse, err error)
- func (c Client) ComposeImagePath(id, path string) (fileName string, apiResponse *APIResponse, err error)
- func (c Client) ComposeInfo(id string) (info ComposeInfoV0, resp *APIResponse, err error)
- func (c Client) ComposeLog(id string, size int) (string, *APIResponse, error)
- func (c Client) ComposeLogs(id string) (fileName string, apiResponse *APIResponse, err error)
- func (c Client) ComposeLogsPath(id, path string) (fileName string, apiResponse *APIResponse, err error)
- func (c Client) ComposeMetadata(id string) (fileName string, apiResponse *APIResponse, err error)
- func (c Client) ComposeMetadataPath(id, path string) (fileName string, apiResponse *APIResponse, err error)
- func (c Client) ComposeResults(id string) (fileName string, apiResponse *APIResponse, err error)
- func (c Client) ComposeResultsPath(id, path string) (fileName string, apiResponse *APIResponse, err error)
- func (c Client) ComposeWait(id string, timeout, interval time.Duration) (aborted bool, info ComposeInfoV0, resp *APIResponse, err error)
- func (c Client) DeleteBlueprint(name string) (*APIResponse, error)
- func (c Client) DeleteComposes(ids []string) ([]ComposeDeleteV0, []APIErrorMsg, error)
- func (c Client) DeleteRaw(path string) ([]byte, *APIResponse, error)
- func (c Client) DeleteSource(id string) (*APIResponse, error)
- func (c Client) DepsolveBlueprints(names []string) (blueprints []interface{}, errors []APIErrorMsg, err error)
- func (c Client) DepsolveProjects(names []string, distro string) (deps []interface{}, errors []APIErrorMsg, err error)
- func (c Client) GetBlueprintChangeJSON(name, commit string) (interface{}, *APIResponse, error)
- func (c Client) GetBlueprintChangeTOML(name, commit string) (string, *APIResponse, error)
- func (c Client) GetBlueprintsChanges(names []string) ([]BlueprintChanges, []APIErrorMsg, error)
- func (c Client) GetBlueprintsJSON(names []string) ([]interface{}, []APIErrorMsg, error)
- func (c Client) GetBlueprintsTOML(names []string) ([]string, *APIResponse, error)
- func (c Client) GetComposeTypes(distro string) ([]string, *APIResponse, error)
- func (c Client) GetFile(path string) (fileName, cDisposition, cType string, apiResponse *APIResponse, err error)
- func (c Client) GetFilePath(route, path string) (fileName string, apiResponse *APIResponse, err error)
- func (c Client) GetFrozenBlueprintsJSON(names []string) (blueprints []interface{}, errors []APIErrorMsg, err error)
- func (c Client) GetFrozenBlueprintsTOML(names []string) ([]string, *APIResponse, error)
- func (c Client) GetJSONAll(path string) ([]byte, *APIResponse, error)
- func (c Client) GetJSONAllFnTotal(path string, fn func([]byte) (float64, error)) ([]byte, *APIResponse, error)
- func (c Client) GetRaw(method, path string) ([]byte, *APIResponse, error)
- func (c Client) GetRawBody(method, path string) (io.ReadCloser, *APIResponse, error)
- func (c Client) GetSourcesJSON(names []string) (map[string]interface{}, []APIErrorMsg, error)
- func (c Client) ListBlueprints() ([]string, *APIResponse, error)
- func (c Client) ListComposes() ([]ComposeStatusV0, []APIErrorMsg, error)
- func (c Client) ListDistros() ([]string, *APIResponse, error)
- func (c Client) ListModules(distro string) ([]ModuleV0, *APIResponse, error)
- func (c Client) ListProjects(distro string) ([]ProjectV0, *APIResponse, error)
- func (c Client) ListSources() ([]string, *APIResponse, error)
- func (c Client) ModulesInfo(names []string, distro string) ([]ProjectV0, *APIResponse, error)
- func (c Client) NewSourceTOML(source string) (*APIResponse, error)
- func (c Client) PostJSON(path, body string) ([]byte, *APIResponse, error)
- func (c Client) PostRaw(path, body string, headers map[string]string) ([]byte, *APIResponse, error)
- func (c Client) PostTOML(path, body string) ([]byte, *APIResponse, error)
- func (c Client) ProjectsInfo(projs []string, distro string) ([]ProjectV0, *APIResponse, error)
- func (c Client) PushBlueprintTOML(blueprint string) (*APIResponse, error)
- func (c Client) PushBlueprintWorkspaceTOML(blueprint string) (*APIResponse, error)
- func (c Client) RawURL(route string) string
- func (c Client) Request(method, route, body string, headers map[string]string) (*http.Response, error)
- func (c Client) RequestRawURL(method, route, body string, headers map[string]string) (*http.Response, error)
- func (c Client) SearchModules(names []string, distro string) ([]ModuleV0, *APIResponse, error)
- func (c Client) ServerStatus() (StatusV0, *APIResponse, error)
- func (c *Client) SetRawCallback(f func(string, string, int, []byte))
- func (c Client) StartCompose(blueprint, composeType string, size uint) (string, *APIResponse, error)
- func (c Client) StartComposeTest(blueprint, composeType string, size uint, test uint) (string, *APIResponse, error)
- func (c Client) StartComposeTestUpload(blueprint, composeType, imageName, profileFile string, size uint, test uint) (string, *APIResponse, error)
- func (c Client) StartComposeUpload(blueprint, composeType, imageName, profileFile string, size uint) (string, *APIResponse, error)
- func (c Client) StartOSTreeCompose(blueprint, composeType, ref, parent, url string, size uint) (string, *APIResponse, error)
- func (c Client) StartOSTreeComposeTest(blueprint, composeType, ref, parent, url string, size uint, test uint) (string, *APIResponse, error)
- func (c Client) StartOSTreeComposeTestUpload(blueprint, composeType, imageName, profileFile, ref, parent, url string, ...) (string, *APIResponse, error)
- func (c Client) StartOSTreeComposeUpload(blueprint, composeType, imageName, profileFile, ref, parent, url string, ...) (string, *APIResponse, error)
- func (c Client) TagBlueprint(name string) (*APIResponse, error)
- func (c Client) UndoBlueprint(name, commit string) (*APIResponse, error)
- type ComposeCancelV0
- type ComposeDeleteV0
- type ComposeInfoV0
- type ComposeStartV0
- type ComposeStatusV0
- type ComposeTypesV0
- type Group
- type HTTPClient
- type MockClient
- type ModuleV0
- type ModulesListV0
- type Package
- type PackageNEVRA
- type ProjectBuildV0
- type ProjectSourceV0
- type ProjectSpecV0
- type ProjectV0
- type ProjectsListV0
- type StatusV0
- type TestState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendQuery ¶
AppendQuery adds the query string to the current url using ? for the first and & for subsequent ones
func GetContentFilename ¶
GetContentFilename returns the filename from a content disposition header
func IsStringInSlice ¶
IsStringInSlice returns true if the string is present, false if not slice must be sorted
func MoveFile ¶
MoveFile will copy the src file to the destination file and remove the source on success It assumes the destination file doesn't exist, or if it does that it should be overwritten
func SetUpTemporaryRepository ¶
SetUpTemporaryRepository creates a temporary repository
func TearDownTemporaryRepository ¶
TearDownTemporaryRepository removes the temporary repository
Types ¶
type APIErrorMsg ¶
APIErrorMsg is an individual API error with an ID and a message string
func (APIErrorMsg) String ¶
func (r APIErrorMsg) String() string
String returns the error id and message as a string
type APIResponse ¶
type APIResponse struct { Status bool `json:"status"` Errors []APIErrorMsg `json:"errors,omitempty"` Warnings []string // Optional warning string // contains filtered or unexported fields }
APIResponse is returned by some requests to indicate success or failure. It is always returned when the status code is 400, indicating some kind of error with the request. If Status is true the Errors list will not be included or will be empty. When Status is false it will include at least one APIErrorMsg with details about the error.
func NewAPIResponse ¶
func NewAPIResponse(body []byte) (*APIResponse, error)
NewAPIResponse converts the response body to a status response
func (*APIResponse) AllErrors ¶
func (r *APIResponse) AllErrors() (all []string)
AllErrors returns a list of error description strings
func (APIResponse) IsWarning ¶
func (r APIResponse) IsWarning() bool
IsWarning returns true if is is just warnings
func (*APIResponse) StatusCode ¶
func (r *APIResponse) StatusCode() int
StatusCode returns the http status code
func (APIResponse) String ¶
func (r APIResponse) String() string
String returns the description of the first error, if there is one
type BlueprintChanges ¶
type BlueprintChanges struct { Changes []Change `json:"changes"` Name string `json:"name"` Total int `json:"total"` }
BlueprintChanges contains the list of changes to a specific blueprint
type BlueprintsChangesV0 ¶
type BlueprintsChangesV0 struct { Changes []BlueprintChanges `json:"blueprints"` Errors []APIErrorMsg `json:"errors"` Limit uint `json:"limit"` Offset uint `json:"offset"` }
BlueprintsChangesV0 is the response to /blueprints/changes/ request
type BlueprintsListV0 ¶
type BlueprintsListV0 struct { Total uint `json:"total"` Offset uint `json:"offset"` Limit uint `json:"limit"` Blueprints []string `json:"blueprints"` }
BlueprintsListV0 is the response to /blueprints/list request
type Change ¶
type Change struct { Commit string `json:"commit" toml:"commit"` Message string `json:"message" toml:"message"` Revision *int `json:"revision" toml:"revision"` Timestamp string `json:"timestamp" toml:"timestamp"` }
Change is a single change to a blueprint
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client contains details about the API server connection as well as functions to interact with the server
func InitClientUnixSocket ¶
InitClientUnixSocket configures the client to use a unix domain socket This configures the weldr.Client with the selected API version and socket path It must be called before using any of the weldr.Client functions.
func NewClient ¶
NewClient initializes the values of the weldr API client configuration used to query the server.
func (Client) APIURL ¶
APIURL returns the full url for a given route, including protocol, host, and api version
func (Client) CancelCompose ¶
func (c Client) CancelCompose(id string) (ComposeCancelV0, []APIErrorMsg, error)
CancelCompose cancels a compose that is waiting or running on the server
func (Client) ComposeImage ¶
func (c Client) ComposeImage(id string) (fileName string, apiResponse *APIResponse, err error)
ComposeImage saves the compose's image to a file in the current directory It returns the filename, the server response, and the error.
func (Client) ComposeImagePath ¶
func (c Client) ComposeImagePath(id, path string) (fileName string, apiResponse *APIResponse, err error)
ComposeImagePath saves the compose's image to a directory or file in path It returns the filename, the server response, and the error.
func (Client) ComposeInfo ¶
func (c Client) ComposeInfo(id string) (info ComposeInfoV0, resp *APIResponse, err error)
ComposeInfo returns details about a specific compose
func (Client) ComposeLog ¶
ComposeLog returns the last 1k of logs from a running compose
func (Client) ComposeLogs ¶
func (c Client) ComposeLogs(id string) (fileName string, apiResponse *APIResponse, err error)
ComposeLogs saves the compose's logs to a file in the current directory It returns the filename, the server response, and the error.
func (Client) ComposeLogsPath ¶
func (c Client) ComposeLogsPath(id, path string) (fileName string, apiResponse *APIResponse, err error)
ComposeLogsPath saves the compose's logs to a file in the current directory It returns the filename, the server response, and the error.
func (Client) ComposeMetadata ¶
func (c Client) ComposeMetadata(id string) (fileName string, apiResponse *APIResponse, err error)
ComposeMetadata saves the compose's metadata to a file in the current directory It returns the filename, the server response, and the error.
func (Client) ComposeMetadataPath ¶
func (c Client) ComposeMetadataPath(id, path string) (fileName string, apiResponse *APIResponse, err error)
ComposeMetadataPath saves the compose's metadata a directory or file in path It returns the filename, the server response, and the error.
func (Client) ComposeResults ¶
func (c Client) ComposeResults(id string) (fileName string, apiResponse *APIResponse, err error)
ComposeResults saves the compose's results to a file in the current directory It returns the filename, the server response, and the error.
func (Client) ComposeResultsPath ¶
func (c Client) ComposeResultsPath(id, path string) (fileName string, apiResponse *APIResponse, err error)
ComposeResultsPath saves the compose's results to a directory or file in path It returns the filename, the server response, and the error.
func (Client) ComposeWait ¶
func (c Client) ComposeWait(id string, timeout, interval time.Duration) (aborted bool, info ComposeInfoV0, resp *APIResponse, err error)
ComposeWait waits for the specified compose to be done Check the status until it is either FINISHED or FAILED or a timeout is exceeded aborted will be true if the timeout was exceeded, info will have the last status from the server before the timeout.
func (Client) DeleteBlueprint ¶
func (c Client) DeleteBlueprint(name string) (*APIResponse, error)
DeleteBlueprint deletes a blueprint and returns the server result
func (Client) DeleteComposes ¶
func (c Client) DeleteComposes(ids []string) ([]ComposeDeleteV0, []APIErrorMsg, error)
DeleteComposes removes a list of composes from the server
func (Client) DeleteRaw ¶
func (c Client) DeleteRaw(path string) ([]byte, *APIResponse, error)
DeleteRaw sends a DELETE request Errors from the API are returned as an APIResponse, client errors are returned as error
func (Client) DeleteSource ¶
func (c Client) DeleteSource(id string) (*APIResponse, error)
DeleteSource deletes a source and returns the server result Note that trying to delete a system source will fail with an error
func (Client) DepsolveBlueprints ¶
func (c Client) DepsolveBlueprints(names []string) (blueprints []interface{}, errors []APIErrorMsg, err error)
DepsolveBlueprints returns the blueprints, their dependencies, and any errors It uses interface{} for the response so that it is not tightly coupled to the server's response schema.
func (Client) DepsolveProjects ¶
func (c Client) DepsolveProjects(names []string, distro string) (deps []interface{}, errors []APIErrorMsg, err error)
DepsolveProjects returns the dependencies of all the projects passed to it It uses interface{} for the response so that it is not tightly coupled to the server's response schema.
func (Client) GetBlueprintChangeJSON ¶
func (c Client) GetBlueprintChangeJSON(name, commit string) (interface{}, *APIResponse, error)
GetBlueprintChangeJSON returns a single blueprint commit as JSON It uses interface{} for the blueprints so that it is not tightly coupled to the server's blueprint schema.
func (Client) GetBlueprintChangeTOML ¶
func (c Client) GetBlueprintChangeTOML(name, commit string) (string, *APIResponse, error)
GetBlueprintChangeTOML returns a single blueprint commit as TOML
func (Client) GetBlueprintsChanges ¶
func (c Client) GetBlueprintsChanges(names []string) ([]BlueprintChanges, []APIErrorMsg, error)
GetBlueprintsChanges requests the list of commits made to a list of blueprints
func (Client) GetBlueprintsJSON ¶
func (c Client) GetBlueprintsJSON(names []string) ([]interface{}, []APIErrorMsg, error)
GetBlueprintsJSON returns the blueprints and errors It uses interface{} for the blueprints so that it is not tightly coupled to the server's blueprint schema.
func (Client) GetBlueprintsTOML ¶
func (c Client) GetBlueprintsTOML(names []string) ([]string, *APIResponse, error)
GetBlueprintsTOML returns the listed blueprints as TOML strings
func (Client) GetComposeTypes ¶
func (c Client) GetComposeTypes(distro string) ([]string, *APIResponse, error)
GetComposeTypes returns a list of the compose types
func (Client) GetFile ¶
func (c Client) GetFile(path string) (fileName, cDisposition, cType string, apiResponse *APIResponse, err error)
GetFile writes a to a temporary file and returns the path, content-disposition, and content-type to the caller.
func (Client) GetFilePath ¶
func (c Client) GetFilePath(route, path string) (fileName string, apiResponse *APIResponse, err error)
GetFilePath writes a file returned by the route to the path passed to it If path is an existing directory the file is saved under it using the content-disposition name If the path doesn't end in a / it is assumed to be a full path + filename and the file is saved to it, or skipped if it already exists. If the path ends with a / and doesn't exist it returns an error
func (Client) GetFrozenBlueprintsJSON ¶
func (c Client) GetFrozenBlueprintsJSON(names []string) (blueprints []interface{}, errors []APIErrorMsg, err error)
GetFrozenBlueprintsJSON returns the blueprints and errors It uses interface{} for the blueprints so that it is not tightly coupled to the server's blueprint schema.
func (Client) GetFrozenBlueprintsTOML ¶
func (c Client) GetFrozenBlueprintsTOML(names []string) ([]string, *APIResponse, error)
GetFrozenBlueprintsTOML returns the listed blueprints as TOML strings These blueprints are 'frozen', their package versions have been depsolved and are set to the exact EVRA value.
func (Client) GetJSONAll ¶
func (c Client) GetJSONAll(path string) ([]byte, *APIResponse, error)
GetJSONAll returns all JSON results from a GET request using offset/limit This function makes 2 requests, the first with limit=0 to get the total number of results, and then with limit=TOTAL to fetch all of the results. The path passed to GetJSONAll should not include the limit or offset query parameters Errors from the API are returned as an APIResponse, client errors are returned as error
func (Client) GetJSONAllFnTotal ¶
func (c Client) GetJSONAllFnTotal(path string, fn func([]byte) (float64, error)) ([]byte, *APIResponse, error)
GetJSONAllFnTotal will retrieve all the results for a paginated route It makes 2 calls to the route, the first with limit=0, the results are passed to the user function which determines how many total results there are, and this value is then used in a second call to retrieve all of them.
func (Client) GetRaw ¶
func (c Client) GetRaw(method, path string) ([]byte, *APIResponse, error)
GetRaw returns raw data from a GET request Errors from the API are returned as an APIResponse, client errors are returned as error
func (Client) GetRawBody ¶
func (c Client) GetRawBody(method, path string) (io.ReadCloser, *APIResponse, error)
GetRawBody returns the resp.Body io.ReadCloser to the caller NOTE: The caller is responsible for closing the Body when finished
func (Client) GetSourcesJSON ¶
func (c Client) GetSourcesJSON(names []string) (map[string]interface{}, []APIErrorMsg, error)
GetSourcesJSON returns the sources and errors It uses interface{} for the sources so that it is not tightly coupled to the server's source schema.
func (Client) ListBlueprints ¶
func (c Client) ListBlueprints() ([]string, *APIResponse, error)
ListBlueprints returns a list of all of the blueprints available
func (Client) ListComposes ¶
func (c Client) ListComposes() ([]ComposeStatusV0, []APIErrorMsg, error)
ListComposes returns details about the composes on the server
func (Client) ListDistros ¶
func (c Client) ListDistros() ([]string, *APIResponse, error)
ListDistros returns a list of all of the available distributions
func (Client) ListModules ¶
func (c Client) ListModules(distro string) ([]ModuleV0, *APIResponse, error)
ListModules returns a list of all of the modules available NOTE: These are just packages, the server does not support modules directly
func (Client) ListProjects ¶
func (c Client) ListProjects(distro string) ([]ProjectV0, *APIResponse, error)
ListProjects returns a list of all of the projects available
func (Client) ListSources ¶
func (c Client) ListSources() ([]string, *APIResponse, error)
ListSources returns a list of all of the sources available
func (Client) ModulesInfo ¶
ModulesInfo returns a list of detailed info about the modules, including deps
func (Client) NewSourceTOML ¶
func (c Client) NewSourceTOML(source string) (*APIResponse, error)
NewSourceTOML adds (or updates if it already exists) a source using TOML When successful the response will have Status = true
func (Client) PostJSON ¶
func (c Client) PostJSON(path, body string) ([]byte, *APIResponse, error)
PostJSON sends a POST with JSON data and the Content-Type header set to "application/json" Errors from the API are returned as an APIResponse, client errors are returned as error
func (Client) PostRaw ¶
PostRaw sends a POST with raw data and returns the raw response body Errors from the API are returned as an APIResponse, client errors are returned as error
func (Client) PostTOML ¶
func (c Client) PostTOML(path, body string) ([]byte, *APIResponse, error)
PostTOML sends a POST with TOML data and the Content-Type header set to "text/x-toml" Errors from the API are returned as an APIResponse, client errors are returned as error
func (Client) ProjectsInfo ¶
ProjectsInfo returns a list of detailed info about the projects
func (Client) PushBlueprintTOML ¶
func (c Client) PushBlueprintTOML(blueprint string) (*APIResponse, error)
PushBlueprintTOML pushes a TOML formatted blueprint as a new commit When successful the response will have Status = true
func (Client) PushBlueprintWorkspaceTOML ¶
func (c Client) PushBlueprintWorkspaceTOML(blueprint string) (*APIResponse, error)
PushBlueprintWorkspaceTOML pushes a TOML formatted blueprint to the temporary workspace When successful the response will have Status = true
func (Client) RawURL ¶
RawURL returns the full url for a route, without adding the API path and version to it
func (Client) Request ¶
func (c Client) Request(method, route, body string, headers map[string]string) (*http.Response, error)
Request handles sending the request, handling errors, returning the response route is the API URL path, including query strings body is the data to send with POST headers is a map of header:value to add to the request
If it is successful a http.Response will be returned. If there is an error, the response will be nil and error will be returned.
func (Client) RequestRawURL ¶
func (c Client) RequestRawURL(method, route, body string, headers map[string]string) (*http.Response, error)
RequestRawURL handles sending the request, handling errors, returning the response route is the raw API URL path, including query strings body is the data to send with POST headers is a map of header:value to add to the request
If it is successful a http.Response will be returned. If there is an error, the response will be nil and error will be returned.
This request method does not add the API path and version to the request.
func (Client) SearchModules ¶
SearchModules returns a list of all of the modules matching all of the globs NOTE: These are just packages, the server does not support modules directly
func (Client) ServerStatus ¶
func (c Client) ServerStatus() (StatusV0, *APIResponse, error)
ServerStatus returns the status of the API server
func (*Client) SetRawCallback ¶
SetRawCallback sets a function that will be called with from the server response It is passed the method, path, result status, and body bytes
func (Client) StartCompose ¶
func (c Client) StartCompose(blueprint, composeType string, size uint) (string, *APIResponse, error)
StartCompose will start a compose of a blueprint Returns the UUID of the build that was started
func (Client) StartComposeTest ¶
func (c Client) StartComposeTest(blueprint, composeType string, size uint, test uint) (string, *APIResponse, error)
StartComposeTest will start a compose of a blueprint, optionally starting a test compose test = 1 creates a fake failed compose test = 2 creates a fake successful compose
func (Client) StartComposeTestUpload ¶
func (c Client) StartComposeTestUpload(blueprint, composeType, imageName, profileFile string, size uint, test uint) (string, *APIResponse, error)
StartComposeTestUpload will start a compose of a blueprint, optionally starting a test compose it will also upload the image to a provider. test = 1 creates a fake failed compose test = 2 creates a fake successful compose
func (Client) StartComposeUpload ¶
func (c Client) StartComposeUpload(blueprint, composeType, imageName, profileFile string, size uint) (string, *APIResponse, error)
StartComposeUpload will start a compose of a blueprint and upload it to a provider Returns the UUID of the build that was started
func (Client) StartOSTreeCompose ¶
func (c Client) StartOSTreeCompose(blueprint, composeType, ref, parent, url string, size uint) (string, *APIResponse, error)
StartOSTreeCompose will start a compose of a blueprint Returns the UUID of the build that was started
func (Client) StartOSTreeComposeTest ¶
func (c Client) StartOSTreeComposeTest(blueprint, composeType, ref, parent, url string, size uint, test uint) (string, *APIResponse, error)
StartOSTreeComposeTest will start a compose of a blueprint, optionally starting a test compose test = 1 creates a fake failed compose test = 2 creates a fake successful compose
func (Client) StartOSTreeComposeTestUpload ¶
func (c Client) StartOSTreeComposeTestUpload(blueprint, composeType, imageName, profileFile, ref, parent, url string, size uint, test uint) (string, *APIResponse, error)
StartOSTreeComposeTestUpload will start a compose of a blueprint, optionally starting a test compose test = 1 creates a fake failed compose test = 2 creates a fake successful compose
func (Client) StartOSTreeComposeUpload ¶
func (c Client) StartOSTreeComposeUpload(blueprint, composeType, imageName, profileFile, ref, parent, url string, size uint) (string, *APIResponse, error)
StartOSTreeComposeUpload will start a compose of a blueprint and upload it to a provider Returns the UUID of the build that was started
func (Client) TagBlueprint ¶
func (c Client) TagBlueprint(name string) (*APIResponse, error)
TagBlueprint tags the most recent blueprint commit as a release When successful the response will have Status = true
func (Client) UndoBlueprint ¶
func (c Client) UndoBlueprint(name, commit string) (*APIResponse, error)
UndoBlueprint reverts the blueprint to a previous commit When successful the response will have Status = true
type ComposeCancelV0 ¶
ComposeCancelV0 is the response to a cancel request
type ComposeDeleteV0 ¶
ComposeDeleteV0 is the response to a delete request
type ComposeInfoV0 ¶
type ComposeInfoV0 struct { ID string `json:"id"` Config string `json:"config"` // anaconda config, let's ignore this field Blueprint infoBlueprint `json:"blueprint"` // blueprint parts that info cares about Commit string `json:"commit"` // empty for now Deps struct { Packages []PackageNEVRA `json:"packages"` } `json:"deps"` ComposeType string `json:"compose_type"` QueueStatus string `json:"queue_status"` ImageSize uint64 `json:"image_size"` Uploads []infoUpload `json:"uploads"` // upload parts that info cares about }
ComposeInfoV0 is the response to a compose/info request
type ComposeStartV0 ¶
type ComposeStartV0 struct { ID string `json:"build_id"` Status bool `json:"status"` Warnings []string `json:"warnings"` }
ComposeStartV0 is the response to a successful start compose
type ComposeStatusV0 ¶
type ComposeStatusV0 struct { ID string `json:"id"` Blueprint string `json:"blueprint"` Version string `json:"version"` Type string `json:"compose_type"` Size uint `json:"image_size"` Status string `json:"queue_status"` JobCreated float64 `json:"job_created"` // XXX correct type? JobStarted float64 `json:"job_started"` // XXX correct type? JobFinished float64 `json:"job_finished"` // XXX correct type? }
ComposeStatusV0 is the response to /compose/queue, finished, failed
func SortComposeStatusV0 ¶
func SortComposeStatusV0(composes []ComposeStatusV0) []ComposeStatusV0
SortComposeStatusV0 sorts a slice of compose statuses It sorts, in order of preference, by: - status: running, waiting, finished, failed - blueprint name - blueprint version - compose type
type ComposeTypesV0 ¶
ComposeTypesV0 is the response to /compose/types
type Group ¶
type Group struct {
Name string `json:"name" toml:"name"`
}
Group specifies a package group.
type HTTPClient ¶
HTTPClient make it easier to swap out the client socket for testing
type MockClient ¶
MockClient implements the HTTPClient interface for testing client requests Set DoFunc to a function that returns whatever response is required
type ModulesListV0 ¶
type ModulesListV0 struct { Total uint `json:"total"` Offset uint `json:"offset"` Limit uint `json:"limit"` Modules []ModuleV0 `json:"modules"` }
ModulesListV0 is the response to /modules/list request
type Package ¶
type Package struct { Name string `json:"name" toml:"name"` Version string `json:"version,omitempty" toml:"version,omitempty"` }
A Package specifies an RPM package.
type PackageNEVRA ¶
type PackageNEVRA struct { Arch string `json:"arch"` Epoch int `json:"epoch"` Name string `json:"name"` Version string `json:"version"` Release string `json:"release"` }
PackageNEVRA contains the details about a package
func (PackageNEVRA) String ¶
func (pkg PackageNEVRA) String() string
String returns the package name, epoch, version and release as a string
type ProjectBuildV0 ¶
type ProjectBuildV0 struct { Arch string `json:"arch"` BuildTime string `json:"build_time"` Epoch uint `json:"epoch"` Release string `json:"release"` Source ProjectSourceV0 Changelog string `json:"changelog"` BuildConfigRef string `json:"build_config_ref"` BuildEnvRef string `json:"build_env_ref"` }
ProjectBuildV0 holds details about a single project build
func (ProjectBuildV0) String ¶
func (p ProjectBuildV0) String() string
String returns the package name, epoch, version and release as a string
type ProjectSourceV0 ¶
type ProjectSourceV0 struct { License string `json:"license"` Version string `json:"version"` SourceRef string `json:"source_ref"` }
ProjectSourceV0 holds details about the source of a project
type ProjectSpecV0 ¶
type ProjectSpecV0 struct { Name string `json:"name"` Epoch uint `json:"epoch"` Version string `json:"version"` Release string `json:"release"` Arch string `json:"arch"` RemoteLocation string `json:"remote_location,omitempty"` Checksum string `json:"checksum,omitempty"` Secrets string `json:"secrets,omitempty"` CheckGPG bool `json:"check_gpg,omitempty"` }
ProjectSpecV0 holds details about a project release
func (ProjectSpecV0) String ¶
func (p ProjectSpecV0) String() string
String returns the package name, epoch, version and release as a string
type ProjectV0 ¶
type ProjectV0 struct { Name string `json:"name"` Summary string `json:"summary"` Description string `json:"description"` Homepage string `json:"homepage"` UpstreamVCS string `json:"upstream_vcs"` Builds []ProjectBuildV0 `json:"builds"` Dependencies []ProjectSpecV0 `json:"dependencies,omitempty"` }
ProjectV0 holds details about a project
type ProjectsListV0 ¶
type ProjectsListV0 struct { Total uint `json:"total"` Offset uint `json:"offset"` Limit uint `json:"limit"` Projects []ProjectV0 `json:"projects"` }
ProjectsListV0 is the response to /projects/list request
type StatusV0 ¶
type StatusV0 struct { API string `json:"api"` DBSupported bool `json:"db_supported"` DBVersion string `json:"db_version"` SchemaVersion string `json:"schema_version"` Backend string `json:"backend"` Build string `json:"build"` Messages []string `json:"messages"` }
StatusV0 is the response to /api/status from a v0+ server