types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package types contains type defintions for all Bindle API objects

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindleSpec

type BindleSpec struct {
	Name        string   `toml:"name"`
	Version     string   `toml:"version"`
	Description *string  `toml:"description"`
	Authors     []string `toml:"authors,omitempty"`
}

BindleSpec contains the data to identify a bindle as well as additional metadata describing it

type Condition

type Condition struct {
	MemberOf []string `toml:"memberOf,omitempty"`
	Requires []string `toml:"requires,omitempty"`
}

/ Condition is used to associate parcels to `Group`s

type ErrorResponse

type ErrorResponse struct {
	Error string `toml:"error"`
}

ErrorResponse is a string error message returned from the server

type Group

type Group struct {
	Name        string  `toml:"name"`
	Required    *bool   `toml:"required"`
	SatisfiedBy *string `toml:"satisfiedBy"`
}

Group is a top-level organization object that may contain zero or more parcels. Every parcel belongs to at least one group, but may belong to others.

type Invoice

type Invoice struct {
	BindleVersion string            `toml:"bindleVersion"`
	Yanked        *bool             `toml:"yanked"`
	Bindle        BindleSpec        `toml:"bindle"`
	Annotations   map[string]string `toml:"annotations,omitempty"`
	Parcel        []Parcel          `toml:"parcel,omitempty"`
	Group         []Group           `toml:"group,omitempty"`
}

Invoice is the main structure for a Bindle invoice. The invoice describes a specific version of a bindle. For example, the bindle `foo/bar/1.0.0` would be represented as an Invoice with the `BindleSpec` name set to `foo/bar` and version set to `1.0.0`.

Most fields on this struct are singular to best represent the specification. There, fields like `group` and `parcel` are singular due to the conventions of TOML.

func (Invoice) Name

func (i Invoice) Name() string

Name returns the full name of the bindle (name + version)

type InvoiceCreateResponse

type InvoiceCreateResponse struct {
	Invoice Invoice `toml:"invoice"`
	Missing []Label `toml:"missing,omitempty"`
}

InvoiceCreateResponse is returned by a Bindle server when creating an invoice. It contains the created invoice and an optional slice of labels indicating which parcels are missing in storage

type Label

type Label struct {
	SHA256      string                       `toml:"sha256"`
	MediaType   string                       `toml:"mediaType"`
	Name        string                       `toml:"name"`
	Size        uint64                       `toml:"size"`
	Annotations map[string]string            `toml:"annotations,omitempty"`
	Feature     map[string]map[string]string `toml:"feature,omitempty"`
}

Label is the metadata of a stored parcel. See the Label Spec for more detailed information: https://github.com/deislabs/bindle/blob/master/docs/label-spec.md

type Matches

type Matches struct {
	// The query used to find this match set
	Query string `toml:"query"`
	// Whether the search engine used strict mode
	Strict bool `toml:"strict"`
	// The offset of the first result in the matches
	Offset uint64 `toml:"offset"`
	// The maximum number of results this query would have returned
	Limit uint8 `toml:"limit"`
	// The total number of matches the search engine located
	//
	// In many cases, this will not match the number of results returned on this query
	Total uint64 `toml:"total"`
	// Whether there are more results than the ones returned here
	More bool `toml:"more"`
	// Whether this list includes potentially yanked invoices
	Yanked bool `toml:"yanked"`
	// The list of invoices returned as this part of the query
	//
	// The length of this Vec will be less than or equal to the limit.
	Invoices []Invoice `toml:"invoices"`
}

Matches describes the matches that are returned from a query

type MissingParcelsResponse

type MissingParcelsResponse struct {
	Missing []Label `toml:"missing"`
}

MissingParcelsResponse is a response to a missing parcels request. TOML doesn't support top level arrays, so they must be embedded in a table

type Parcel

type Parcel struct {
	Label      Label      `toml:"label"`
	Conditions *Condition `toml:"conditions"`
}

Parcel is a description of a stored parcel file. A parcel file can be an arbitrary "blob" of data. This could be binary or text files. This object contains the metadata and associated conditions for using a parcel. For more information, see the Bindle Spec: https://github.com/deislabs/bindle/blob/master/docs/bindle-spec.md

type QueryOptions

type QueryOptions struct {
	Query   *string `toml:"q"`
	Version *string `toml:"v"`
	Offset  *uint64 `toml:"o"`
	Limit   *uint8  `toml:"l"`
	Strict  *bool   `toml:"strict"`
	Yanked  *bool   `toml:"yanked"`
}

QueryOptions represents available options for the query API

func (*QueryOptions) QueryString

func (q *QueryOptions) QueryString() string

QueryString returns a query string suitable for use in a URL (including the starting `?`) using the configured parameters of a `QueryOptions`

Jump to

Keyboard shortcuts

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