pkgcloud

package module
v0.0.0-...-9433184 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: Apache-2.0 Imports: 10 Imported by: 13

README

pkgcloud

Build Status GoDoc

Talk to the packagecloud API, in Go.

Installation

$ go get github.com/mlafeldt/pkgcloud/...

API Usage

See Godoc and pkgcloud.go to learn about the API.

Client Usage

Pushing packages

Pushing packages with pkgcloud-push is the only operation supported so far. The tool is a simple and fast replacement for the original package_cloud push command. If you pass more than one package, pkgcloud-push will push them in parallel! Before using it, however, make sure that PACKAGECLOUD_TOKEN is set in your environment.

Usage:

$ pkgcloud-push user/repo[/distro/version] /path/to/packages

Examples:

# Debian
$ pkgcloud-push mlafeldt/myrepo/ubuntu/trusty example_1.2.3_amd64.deb

# RPM
$ pkgcloud-push mlafeldt/myrepo/el/7 *.rpm

# RubyGem
$ pkgcloud-push mlafeldt/myrepo example-1.2.3.gem

Documentation

Overview

Package pkgcloud allows you to talk to the packagecloud API. See https://packagecloud.io/docs/api

Index

Constants

View Source
const ServiceURL = "https://packagecloud.io/api/v1"

ServiceURL is the URL of packagecloud's API.

View Source
const UserAgent = "pkgcloud Go client"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

A Client is a packagecloud client.

func NewClient

func NewClient(token string) (*Client, error)

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) All

func (c Client) All(repo string) ([]Package, error)

All list all packages in repository

func (Client) CreatePackage

func (c Client) CreatePackage(repo, distro, pkgFile string) error

CreatePackage pushes a new package to packagecloud.

func (Client) Destroy

func (c Client) Destroy(repo, packageFilename string) error

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(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

func (c *Client) ShowProgress(show bool)

Print 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"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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