fossa

package
v0.7.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2018 License: MPL-2.0 Imports: 10 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 Initialize

func Initialize(server, APIKey string) error

Initialize sets up an API instance.

func MustInitialize

func MustInitialize(server, APIKey string)

MustInitialize crashes and logs a fatal exception if `Initialize` fails.

func NormalizeGitURL

func NormalizeGitURL(project string) string

func NormalizeType

func NormalizeType(t module.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"`

	Dependencies []Dependency
}

type Dependency

type Dependency struct {
	// Location
	Locator string `json:"locator"`

	// 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 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(analysis []module.Analyzed) ([]SourceUnit, error)

Jump to

Keyboard shortcuts

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