packagecloud

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound             = errors.New("not found -- wrong api token?")
	ErrPackageAlreadyExists = errors.New("package already exists")
	ErrPaymentRequired      = errors.New("payment required")
	ErrUnauthenticated      = errors.New("authentication failed -- is token set?")
)

Functions

func GetSupportedFileExtensions

func GetSupportedFileExtensions() []string

TODO: packagecloud supports more than this, implement the others

func ValidateFileExtensions

func ValidateFileExtensions(paths []string) error

Types

type APIResponse

type APIResponse struct {
	Body      []byte
	LinkGroup link.Group
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config Config) *Client

func (*Client) GetDistributions

func (c *Client) GetDistributions() (types.PackageTypes, error)

func (*Client) LatestVersion

func (c *Client) LatestVersion(options ListVersionsOptions) (string, error)

func (*Client) ListPackages

func (c *Client) ListPackages(repo Repo) (types.PackageFragments, error)

func (*Client) ListPackagesStream

func (c *Client) ListPackagesStream(repo Repo, fn func(types.PackageFragments)) error

func (*Client) ListVersions

func (c *Client) ListVersions(options ListVersionsOptions) (types.PackageVersions, error)

func (*Client) PreviousVersion

func (c *Client) PreviousVersion(options ListVersionsOptions) (string, error)

func (*Client) PromoteByFilename

func (c *Client) PromoteByFilename(src Repo, dst Repo, distro Distro, filename string) error

PromoteByFilename will promote a single package by filename.

func (*Client) PromoteBySearch

func (c *Client) PromoteBySearch(dst Repo, options SearchOptions) error

PromoteBySearch will search for any packages matching the given search options and then promote all matches to the destination repository.

func (*Client) PushPackage

func (c *Client) PushPackage(options PushPackageOptions) (*types.PackageDetails, error)

func (*Client) Search

func (c *Client) Search(options SearchOptions) (types.PackageFragments, error)

func (*Client) SearchStream

func (c *Client) SearchStream(options SearchOptions, fn func(types.PackageFragments)) error

type Config

type Config struct {
	ServiceURL string `mapstructure:"url"`
	Token      string `mapstructure:"token"`
	Verbose    bool   `mapstructure:"verbose"`
}

func (Config) Validate

func (c Config) Validate() error

type Distro

type Distro struct {
	Name    string
	Version string
}

func NewDistro

func NewDistro(name, version string) Distro

func NewDistroFromString

func NewDistroFromString(s string) (Distro, error)

func (Distro) String

func (d Distro) String() string

func (Distro) Validate

func (d Distro) Validate() error

type GetClientFn

type GetClientFn func() (*Client, error)

type ListVersionsOptions

type ListVersionsOptions struct {
	// Repo is the repository to list versions for.
	Repo Repo

	// PackageName is the name of the package to list versions for.
	PackageName string

	// Filter can be used to search by package type.
	// (RPMs, Debs, DSCs, Gem, Python, Node).
	// Ignored when Dist is present.
	Filter string

	// Dist is the name of the distribution that the package is in.
	// (i.e. ubuntu, el/6)
	Dist string

	// Arch is the architecture of the packages. (i.e. x86_64, arm64, amd64).
	// Alpine/RPM/Debian only.
	Arch string

	// PerPage is the number of packages to return from the results set. If
	// nothing passed the default is 30.
	PerPage string
}

func (ListVersionsOptions) SearchOptions

func (o ListVersionsOptions) SearchOptions() SearchOptions

func (ListVersionsOptions) Validate

func (o ListVersionsOptions) Validate() error

type MissingOptionError

type MissingOptionError struct {
	Field string
}

func (*MissingOptionError) Error

func (e *MissingOptionError) Error() string

type MissingSearchOptionsError

type MissingSearchOptionsError struct{}

func (*MissingSearchOptionsError) Error

func (e *MissingSearchOptionsError) Error() string

type PushPackageOptions

type PushPackageOptions struct {
	RepoUser string
	RepoName string
	DistroID string
	FilePath string
}

type Repo

type Repo struct {
	User string
	Name string
}

func NewRepo

func NewRepo(user, name string) Repo

func NewRepoFromString

func NewRepoFromString(s string) (Repo, error)

func (Repo) String

func (r Repo) String() string

func (Repo) Validate

func (r Repo) Validate() error

type SearchOptions

type SearchOptions struct {
	// RepoUser is the username that the repository to search belongs to.
	RepoUser string

	// RepoName is the name of the repository to search.
	RepoName string

	// Query is a query string to search for package filename. If empty string
	// is passed, all packages are returned.
	Query string

	// Filter can be used to search by package type.
	// (RPMs, Debs, DSCs, Gem, Python, Node).
	// Ignored when Dist is present.
	Filter string

	// Dist is the name of the distribution that the package is in.
	// (i.e. ubuntu, el/6)
	// Overrides Filter.
	Dist string

	// Arch is the architecture of the packages. (i.e. x86_64, arm64, amd64).
	// Alpine/RPM/Debian only.
	Arch string

	// PerPage is the number of packages to return from the results set. If
	// nothing passed the default is 30.
	PerPage string
}

func (SearchOptions) Validate

func (o SearchOptions) Validate() error

type UnmarshalError

type UnmarshalError struct {
	Data []byte
	Err  error
}

func (*UnmarshalError) Error

func (e *UnmarshalError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL