Documentation ¶
Overview ¶
Package pkgcloud allows you to talk to the packagecloud API. See https://packagecloud.io/docs/api
Index ¶
- Constants
- Variables
- func NewUploadRequest(url string, params map[string]string, paramName, path string) (*http.Request, error)
- type Client
- func (c Client) All(ctx context.Context, repo string) ([]Package, error)
- func (c Client) CreatePackage(ctx context.Context, repo, distro, pkgFile string) error
- func (c Client) Destroy(ctx context.Context, repo, packageFilename string) error
- func (c Client) Search(ctx context.Context, repo, q, filter, dist string, perPage int) ([]Package, error)
- func (c *Client) ShowProgress(show bool)
- type Package
- type Target
Constants ¶
const EndpointURL = "https://packagecloud.io/api/v1"
EndpointURL is the URL of packagecloud's API.
Variables ¶
var ErrBadGateway = errors.New("bad gateway")
ErrBadGateway is a sentinel error indicating a bad gateway; may be retriable.
var ErrFilenameAlreadyTaken = errors.New("filename has already been taken")
ErrFilenameAlreadyTaken is a sentinel error indicating that there is already a file with that n ame.
Functions ¶
func NewUploadRequest ¶
func NewUploadRequest(url string, params map[string]string, paramName, path string) (*http.Request, error)
NewUploadRequest creates a new file upload HTTP request with optional extra params. Based on https://gist.github.com/mattetti/5914158
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is a packagecloud client.
func NewClient ¶
NewClient creates a packagecloud client. API requests are authenticated using an API token. If no token is passed, it will be read from the PACKAGECLOUD_TOKEN environment variable.
func (Client) CreatePackage ¶
CreatePackage pushes a new package to packagecloud.
func (Client) Destroy ¶
Destroy removes package from repository.
repo should be full path to repository (e.g. youruser/repository/ubuntu/xenial).
func (Client) Search ¶
func (c Client) Search(ctx context.Context, repo, q, filter, dist string, perPage int) ([]Package, error)
Search searches packages from repository. repo should be full path to repository (e.g. youruser/repository/ubuntu/xenial). q: The query string to search for package filename. If empty string is passed, all packages are returned filter: Search by package type (RPMs, Debs, DSCs, Gem, Python) - Ignored when dist != "" dist: The name of the distribution the package is in. (i.e. ubuntu, el/6) - Overrides filter. perPage: The number of packages to return from the results set. If nothing passed, default is 30
func (*Client) ShowProgress ¶
ShowProgress prints a progress bar of paginated API requests when show is set to true
type Package ¶
type Package struct { Name string `json:"name"` Filename string `json:"filename"` DistroVersion string `json:"distro_version"` Version string `json:"version"` Release string `json:"release"` Type string `json:"type"` PackageUrl string `json:"package_url"` PackageHtmlUrl string `json:"package_html_url"` }