Documentation
¶
Overview ¶
Package pkgcloud allows you to talk to the packagecloud API. See https://packagecloud.io/docs/api
Index ¶
- Constants
- func ExtractPaginationHeaders(h *http.Header, p *Paginated) error
- type Client
- func (c Client) CreatePackage(repo, distro, pkgFile string) error
- func (c Client) Destroy(repo, packageFilename string) error
- func (c Client) DestroyFromPackage(p *Package) error
- func (c *Client) Distributions() (*Distributions, error)
- func (c *Client) Exists(repo, distro, packageFilename string) (bool, error)
- func (c *Client) GetPaginatedPackages(endpoint string) (*PaginatedPackages, error)
- func (c *Client) PaginatedAll(repo string) (*PaginatedPackages, error)
- func (c *Client) Promote(p *Package, repo string) error
- func (c *Client) SupportedDistros() (map[string]int, error)
- type Distribution
- type DistributionVersion
- type Distributions
- type Package
- type Paginated
- type PaginatedPackages
Constants ¶
const ServiceBaseURL = "https://packagecloud.io/"
ServiceBaseURL - base URL for packagecloud
const ServiceURL = "https://packagecloud.io/api/v1"
ServiceURL is the URL of packagecloud's API.
const UserAgent = "pkgcloud Go client"
UserAgent identifier
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
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) DestroyFromPackage ¶
DestroyFromPackage removes package from repository.
For use with Package struct
func (*Client) Distributions ¶
func (c *Client) Distributions() (*Distributions, error)
Distributions - retrieve all distribution descriptions
func (*Client) Exists ¶
Exists - Check to see if <repo>/<distro>/packageFilename exists in packagecloud.io
func (*Client) GetPaginatedPackages ¶
func (c *Client) GetPaginatedPackages(endpoint string) (*PaginatedPackages, error)
GetPaginatedPackages - Gets the first set of PaginatedPackages for endpoint Note: Fetching subsequent packages should be done with PackaginesPackages.Next()
func (*Client) PaginatedAll ¶
func (c *Client) PaginatedAll(repo string) (*PaginatedPackages, error)
PaginatedAll - Get the list of all Packages from a repo using PaginatedPackages The first PaginatedPackages object is the first page of responses. To get subsequent pages, call PaginatedPackages.Next() if it is non-nil
type Distribution ¶
type Distribution struct {
DisplayName string `json:"display_name"`
IndexName string `json:"index_name"`
Versions []DistributionVersion
}
Distribution - struct to represent how packagecloud.io handles distributions https://packagecloud.io/docs/api#resource_distributions
type DistributionVersion ¶
type DistributionVersion struct {
ID int `json:"id"`
DisplayName string `json:"display_name"`
IndexName string `json:"index_name"`
}
DistributionVersion - struct to represent how packagecloud.io handles distributions https://packagecloud.io/docs/api#resource_distributions
type Distributions ¶
type Distributions struct {
Deb []Distribution `json:"deb"`
Dsc []Distribution `json:"dsc"`
Rpm []Distribution `json:"rpm"`
}
Distributions - struct to represent how packagecloud.io handles distributions https://packagecloud.io/docs/api#resource_distributions
type Package ¶
type Package struct {
Name string `json:"name"`
CreatedAt time.Time `json:"created_at,string"`
Epoch int `json:"epoch"`
Scope string `json:"scope"`
Private bool `json:"private"`
UploaderName string `json:"uploader_name"`
Indexed bool `json:"indexed"`
RepositoryHTMLURL string `json:"repository_html_url"`
DownloadDetailsURL string `json:"downloads_detail_url"`
DownloadSeriesURL string `json:"downloads_series_url"`
DownloadCountURL string `json:"downloads_count_url"`
PromoteURL string `json:"promote_url"`
DestroyURL string `json:"destroy_url"`
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"`
}
Package - packagcloud.io Package structure See for detailed description of fields: https://packagecloud.io/docs/api#object_PackageFragment
type Paginated ¶
Paginated captures pagination information described at - https://packagecloud.io/docs/api#pagination
type PaginatedPackages ¶
type PaginatedPackages struct {
Packages []*Package
Next func() (*PaginatedPackages, error)
Paginated
}
PaginatedPackages captures 'Package' and pagination together Packages - list of packages returned in this page Next - function that can be called to fetch the nexts set of pages Paginated - Pagination meta data about this set of packages