juju: github.com/juju/juju/environs/imagedownloads Index | Files

package imagedownloads

import "github.com/juju/juju/environs/imagedownloads"

Package imagedownloads implements image-downloads metadata from simplestreams.

Index

Package Files

doc.go simplestreams.go

Constants

const (
    // DataType is the simplestreams datatype.
    DataType = "image-downloads"
)

func DefaultSource Uses

func DefaultSource() simplestreams.DataSource

DefaultSource creates a new signed simplestreams datasource for use with the image-downloads datatype.

func Filter Uses

func Filter(ftype string) simplestreams.AppendMatchingFunc

Filter collects only matching products. Series and Arch are filtered by imagemetadata.ImageConstraints. So this really only let's us filter on a file type.

func NewDataSource Uses

func NewDataSource(baseURL string) simplestreams.DataSource

NewDataSource returns a new simplestreams.DataSource from the provided baseURL. baseURL MUST include the image stream.

func Sort Uses

func Sort(metadata []*Metadata)

Sort sorts a slice of ImageMetadata in ascending order of their id in order to ensure the results of Fetch are ordered deterministically.

type Metadata Uses

type Metadata struct {
    Arch string `json:"arch,omitempty"`
    // For testing.
    // TODO(ro) 2016-12-07 BaseURL was jammed on to allow for testing in
    // juju/container/kvm/sync_internal_test. Refactor to pass it in rather
    // than setting it on an otherwise needlessly exported member.
    BaseURL string `json:"-"`
    Release string `json:"release,omitempty"`
    Version string `json:"version,omitempty"`
    FType   string `json:"ftype,omitempty"`
    SHA256  string `json:"sha256,omitempty"`
    Path    string `json:"path,omitempty"`
    Size    int64  `json:"size,omitempty"`
}

Metadata models the information about a particular cloud image download product.

func Fetch Uses

func Fetch(
    src []simplestreams.DataSource,
    cons *imagemetadata.ImageConstraint,
    ff simplestreams.AppendMatchingFunc) ([]*Metadata, *simplestreams.ResolveInfo, error)

Fetch gets product results as Metadata from the provided datasources, given some constraints and an optional filter function.

func One Uses

func One(arch, release, stream, ftype string, src func() simplestreams.DataSource) (*Metadata, error)

One gets Metadata for one content download item: The most recent of:

- architecture
- OS release
- Simplestreams stream
- File image type.

src exists to pass in a data source for testing.

func (*Metadata) DownloadURL Uses

func (m *Metadata) DownloadURL() (*url.URL, error)

DownloadURL returns the URL representing the image.

Package imagedownloads imports 9 packages (graph) and is imported by 6 packages. Updated 2018-06-12. Refresh now. Tools for package owners.