Documentation ¶
Overview ¶
Package api contains everything related to the toolctl API.
Index ¶
- func GetLatestVersion(toolctlAPI ToolctlAPI, tool Tool) (version *semver.Version, err error)
- func SaveMeta(toolctlAPI ToolctlAPI, meta Meta) (err error)
- func SaveToolPlatformMeta(toolctlAPI ToolctlAPI, tool Tool, meta ToolPlatformMeta) (err error)
- func SaveToolPlatformVersionMeta(toolctlAPI ToolctlAPI, tool Tool, meta ToolPlatformVersionMeta) (err error)
- type Location
- type Meta
- type NotFoundError
- type Tool
- type ToolMeta
- type ToolPlatformMeta
- type ToolPlatformMetaVersion
- type ToolPlatformVersionMeta
- type ToolctlAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLatestVersion ¶
func GetLatestVersion(toolctlAPI ToolctlAPI, tool Tool) (version *semver.Version, err error)
GetLatestVersion returns the latest version for the given tool, OS and arch
func SaveMeta ¶ added in v0.2.2
func SaveMeta(toolctlAPI ToolctlAPI, meta Meta) (err error)
SaveMeta saves the metadata for the toolctl API.
func SaveToolPlatformMeta ¶
func SaveToolPlatformMeta(toolctlAPI ToolctlAPI, tool Tool, meta ToolPlatformMeta) (err error)
SaveToolPlatformMeta saves the metadata for the given tool and platform.
func SaveToolPlatformVersionMeta ¶ added in v0.2.2
func SaveToolPlatformVersionMeta(toolctlAPI ToolctlAPI, tool Tool, meta ToolPlatformVersionMeta) (err error)
SaveToolPlatformVersionMeta saves version metadata for a tool to the API.
Types ¶
type Location ¶
type Location uint32
Location represents the location of the API, currently remote or local.
type Meta ¶
type Meta struct {
Tools []string
}
Meta contains metadata for the toolctl API.
func GetMeta ¶
func GetMeta(toolctlAPI ToolctlAPI) (meta Meta, err error)
GetMeta returns the metadata for the toolctl API.
type NotFoundError ¶
type NotFoundError struct { }
NotFoundError is returned when an API resource could not be found.
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type Tool ¶
Tool describes a tool. It contains its name and version as well as the OS and architecture for which it was compiled.
type ToolMeta ¶
type ToolMeta struct { Description string DownloadURLTemplate string `yaml:"downloadURLTemplate"` Homepage string IgnoredVersions []string `yaml:"ignoredVersions"` VersionArgs []string `yaml:"versionArgs"` }
ToolMeta contains metadata for a tool.
func GetToolMeta ¶
func GetToolMeta(toolctlAPI ToolctlAPI, tool Tool) (meta ToolMeta, err error)
GetToolMeta returns the metadata for the given tool.
type ToolPlatformMeta ¶
type ToolPlatformMeta struct {
Version ToolPlatformMetaVersion
}
ToolPlatformMeta contains metadata for a given tool and platform.
func GetToolPlatformMeta ¶
func GetToolPlatformMeta(toolctlAPI ToolctlAPI, tool Tool) (meta ToolPlatformMeta, err error)
GetToolPlatformMeta returns the metadata for the given tool and platform.
type ToolPlatformMetaVersion ¶
ToolPlatformMetaVersion contains version metadata for a given tool and platform.
type ToolPlatformVersionMeta ¶
ToolPlatformVersionMeta contains metadata for a given tool version and platform.
func GetToolPlatformVersionMeta ¶
func GetToolPlatformVersionMeta(toolctlAPI ToolctlAPI, tool Tool) (meta ToolPlatformVersionMeta, err error)
GetToolPlatformVersionMeta returns the metadata for the given tool version and platform.
type ToolctlAPI ¶
type ToolctlAPI interface { LocalAPIBasePath() string LocalAPIFS() afero.Fs Location() Location GetContents(path string) (found bool, contents []byte, err error) SaveContents(path string, data []byte) error }
ToolctlAPI defines the interface that all toolctl APIs need to implement.
func New ¶
func New( localAPIFS afero.Fs, cmd *cobra.Command, defaultLocation Location, ) (toolctlAPI ToolctlAPI, err error)
New returns a new API instance, based on the specified command line flags and the default location.
func NewLocalAPI ¶
func NewLocalAPI(localAPIFS afero.Fs, basePath string) (ToolctlAPI, error)
NewLocalAPI returns a new local API instance.
func NewRemoteAPI ¶
func NewRemoteAPI(localFS afero.Fs, remoteAPIBaseURL string) (ToolctlAPI, error)
NewRemoteAPI returns a new remote API instance.