fossa

package
v0.7.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2018 License: MPL-2.0 Imports: 11 Imported by: 16

Documentation

Overview

Package fossa provides a high-level interface to the FOSSA API (by default, located at https://app.fossa.io).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoProject   = errors.New("no project provided for upload")
	ErrNoRevision  = errors.New("no revision provided for upload")
	ErrNoBuildData = errors.New("no build data to upload")
)

Errors related to preconditions.

View Source
var (
	ErrForbidden            = errors.New("authentication failed (is the API key correct?)")
	ErrRevisionDoesNotExist = errors.New("revision does not exist (are the project and revision correct and published in FOSSA?)")
)

Errors resulting from a bad API response.

Functions

func Init added in v0.7.0

func Init(server, APIKey string) error

Init sets up an API instance.

func MustInit added in v0.7.0

func MustInit(server, APIKey string)

MustInit crashes and logs a fatal exception if `Init` fails.

func NormalizeGitURL

func NormalizeGitURL(project string) string

func NormalizeType

func NormalizeType(t pkg.Type) (string, error)

func Post

func Post(endpoint string, body []byte) (res string, statusCode int, err error)

Types

type Build

type Build struct {
	Artifact string
	Context  interface{}

	Succeeded bool
	Error     error `json:",omitempty"`

	Imports      []string
	Dependencies []Dependency
}

type Dependency

type Dependency struct {
	// Location
	Locator string   `json:"locator"`
	Imports []string `json:"imports,omitempty"`

	// Metadata
	Data *json.RawMessage `json:"data,omitempty"`

	// Context
	Depth              int      `json:"depth,omitempty"`
	Parent             string   `json:"parent,omitempty"`
	UnresolvedLocators []string `json:"unresolved_locators,omitempty"`
}

type ImportPath

type ImportPath []Locator

func ReadImportPath

func ReadImportPath(s ImportPathString) ImportPath

func (ImportPath) String

func (p ImportPath) String() ImportPathString

type ImportPathString

type ImportPathString string

type Locator

type Locator struct {
	Fetcher  string `json:"fetcher"`
	Project  string `json:"package"`
	Revision string `json:"revision"`
}

func LocatorOf added in v0.7.0

func LocatorOf(id pkg.ID) Locator

func ReadLocator

func ReadLocator(s string) Locator

func Upload

func Upload(fetcher, project, revision, title, branch string, data []SourceUnit) (Locator, error)

func (Locator) IsResolved

func (l Locator) IsResolved() bool

func (Locator) String

func (l Locator) String() string

type SourceUnit

type SourceUnit struct {
	Name     string
	Type     string
	Manifest string
	Build    Build
}

func Normalize

func Normalize(modules []module.Module) ([]SourceUnit, error)

Jump to

Keyboard shortcuts

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