Documentation ¶
Index ¶
- func AddRequestHeaders(req *http.Request)
- type APIBuild
- type APIClient
- func (c *APIClient) Get(path string) (*http.Response, error)
- func (c *APIClient) GetBody(path string) ([]byte, error)
- func (c *APIClient) GetBuilds(username, name string, options *GetBuildsOptions) ([]*APIBuild, error)
- func (c *APIClient) GetDockerRepository(buildID string) (*DockerRepository, error)
- func (c *APIClient) GetStepVersion(owner, name, version string) (*APIStepVersion, error)
- func (c *APIClient) GetTarball(tarballURL string) (*http.Response, error)
- func (c *APIClient) URL(path string) string
- type APIError
- type APIOptions
- type APIStepVersion
- type DockerRepository
- type GetBuildsOptions
- type StepRegistry
- type WerckerStepRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRequestHeaders ¶
AddRequestHeaders add a few default headers to req. Currently added: User- Agent, X-Wercker-Version, X-Wercker-Git.
Types ¶
type APIBuild ¶
type APIBuild struct { ID string `json:"id"` URL string `json:"url"` Status string `json:"status"` Result string `json:"result"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` FinishedAt string `json:"finishedAt"` Progress float64 `json:"progress"` }
APIBuild represents a build from wercker api.
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient is a very dumb client for the wercker API
func NewAPIClient ¶
func NewAPIClient(options *APIOptions) *APIClient
NewAPIClient returns our dumb client
func (*APIClient) Get ¶
Get will do a GET http request, it adds the wercker endpoint and will add some default headers.
func (*APIClient) GetBody ¶
GetBody does a GET request. If the status code is 200, it will return the body.
func (*APIClient) GetBuilds ¶
func (c *APIClient) GetBuilds(username, name string, options *GetBuildsOptions) ([]*APIBuild, error)
GetBuilds will fetch multiple builds for application username/name.
func (*APIClient) GetDockerRepository ¶
func (c *APIClient) GetDockerRepository(buildID string) (*DockerRepository, error)
GetDockerRepository will retrieve a snappy-stream compressed tarball.
func (*APIClient) GetStepVersion ¶
func (c *APIClient) GetStepVersion(owner, name, version string) (*APIStepVersion, error)
GetStepVersion grabs a step at a specific version
func (*APIClient) GetTarball ¶
type APIOptions ¶
type APIStepVersion ¶
type APIStepVersion struct { TarballURL string `json:"tarballUrl"` Version string `json:"version"` Description string `json:"description"` }
APIStepVersion is the data structure for the JSON returned by the wercker API.
type DockerRepository ¶
type DockerRepository struct { // Content is the compressed tarball. It is the caller's responsibility to // close Content. Content io.ReadCloser // Sha256 checksum of the compressed tarball. Sha256 string // Size of the compressed tarball. Size int64 }
DockerRepository represents the meta information of a downloadable docker repository. This is a tarball compressed using snappy-stream.
type GetBuildsOptions ¶
type GetBuildsOptions struct { Sort string `qs:"sort"` Limit int `qs:"limit"` Skip int `qs:"skip"` Commit string `qs:"commit"` Branch string `qs:"branch"` Status string `qs:"status"` Result string `qs:"result"` Stack int `qs:"stack"` }
GetBuildsOptions are the optional parameters associated with GetBuilds
type StepRegistry ¶
type StepRegistry interface { // GetStepVersion retrieves a step from the registry GetStepVersion(owner, name, version string) (*APIStepVersion, error) // GetTarball retrieves a step tarball from the registry GetTarball(tarballURL string) (*http.Response, error) }
StepRegistry abstracts registry interaction
func NewWerckerStepRegistry ¶
func NewWerckerStepRegistry(baseURL, authToken string) StepRegistry
NewWerckerStepRegistry creates a new instance of NewWerckerStepRegistry
type WerckerStepRegistry ¶
type WerckerStepRegistry struct {
// contains filtered or unexported fields
}
WerckerStepRegistry implements the StepRegistry interface to handle
func (*WerckerStepRegistry) GetStepVersion ¶
func (r *WerckerStepRegistry) GetStepVersion(owner, name, version string) (*APIStepVersion, error)
GetStepVersion retrieves a step from the registry
func (*WerckerStepRegistry) GetTarball ¶
func (r *WerckerStepRegistry) GetTarball(tarballURL string) (*http.Response, error)