sdl

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetAcceptCharges

func SetAcceptCharges(aws, gcp string) string

SetAcceptCharges Sets the accept-charges parameter to the proper value according to what cloud profiles were provided.

Types

type Accession

type Accession struct {
	ID      string  `json:"bundle,omitempty"`
	Status  int     `json:"status,omitempty"`
	Message string  `json:"msg,omitempty"`
	Files   []*File `json:"files,omitempty"`
}

Accession The JSON object that the SDL API uses to represent an accession.

func (*Accession) Transfigure

func (a *Accession) Transfigure() *fuseralib.Accession

Transfigure Changes the SDL representation of an Accession into the Fusera representation.

func (*Accession) Validate

func (a *Accession) Validate(isDup map[string]bool) error

Validate Accession 1. Accession is one of the ones we asked for. 2. Status should be an HTTP 200 OK. 3. Files shouldn't be empty. 4. It's not a duplicate accession (we should only get one of each accession). 5. All Files are valid.

type File

type File struct {
	Name         string     `json:"name,omitempty"`
	Size         uint64     `json:"size,omitempty"`
	Type         string     `json:"type,omitempty"`
	ModifiedDate time.Time  `json:"modificationDate,omitempty"`
	Md5Hash      string     `json:"md5,omitempty"`
	Locations    []Location `json:"locations,omitempty"`
}

File The JSON object that the SDL API uses to represent a file.

func (*File) Transfigure

func (f *File) Transfigure() fuseralib.File

Transfigure Changes the SDL representation of a File into the Fusera representation.

func (*File) Validate

func (f *File) Validate() error

Validate Files 1. Files need a name. 2. Files need a type. 3. Files should have one location.

type Location

type Location struct {
	Link           string    `json:"link,omitempty"`
	Service        string    `json:"service,omitempty"`
	Region         string    `json:"region,omitempty"`
	ExpirationDate time.Time `json:"expirationDate,omitempty"`
	CeRequired     bool      `json:"ceRequired,omitempty"`
	PayRequired    bool      `json:"payRequired,omitempty"`
	Bucket         string    `json:"bucket,omitempty"`
	Key            string    `json:"key,omitempty"`
}

Location The JSON object used by the SDL API to represent the location of a file.

func (*Location) Validate

func (l *Location) Validate() error

Validate Location 1. Link shouldn't be empty. 2. Service shouldn't be empty. 3. Region shouldn't be empty. 4. If PayRequired is true, there must be a Bucket and Key.

type Param

type Param struct {
	Acc      []string
	Location gps.Locator
	Ngc      []byte
	// Acceptable values are "aws", "gcp", or "aws,gcp"
	AcceptCharges string
	FileType      map[string]bool
}

Param The structure to hold all the various parameters accepted by the SDL API.

func NewParam

func NewParam(acc []string, location gps.Locator, ngc []byte, charges string, types map[string]bool) *Param

NewParam Returns a Param, a convenient structure to hold all the global setting parameters for the SDL API. Most often to be used when creating a new SDL object.

func (*Param) AddGlobals

func (p *Param) AddGlobals(writer *multipart.Writer) (*multipart.Writer, error)

AddGlobals Adds all global parameters to writer for a request to the SDL API.

func (*Param) FileTypes

func (p *Param) FileTypes() string

FileTypes Returns the map of filetypes as a comma separated string for the SDL API parameter "filetypes".

type SDL

type SDL struct {
	URL   string
	Param *Param
}

SDL SDL is the main object to use when wanting to interact with the SDL API.

func NewSDL

func NewSDL() *SDL

NewSDL Creates a new SDL with default values already set.

func (*SDL) AddIdent

func (s *SDL) AddIdent(link string) (string, error)

AddIdent Adds an ident parameter to a link to fulfill the demand of a Compute Environment Required file link.

func (*SDL) Retrieve

func (s *SDL) Retrieve(accession string) (*fuseralib.Accession, error)

Retrieve The function to call to get information on a single accession.

func (*SDL) RetrieveAll

func (s *SDL) RetrieveAll() ([]*fuseralib.Accession, error)

RetrieveAll The function to call to get information on all the accessions.

func (*SDL) Sign

func (s *SDL) Sign(accession string) (*fuseralib.Accession, error)

Sign The function to call to sign a single accession.

func (*SDL) SignAll

func (s *SDL) SignAll() ([]*fuseralib.Accession, error)

SignAll Asks the SDL API to return locations (including signed links) for all the accessions, typically called on start up of Fusera when the eager flag has been set.

func (*SDL) SignAllInBatch

func (s *SDL) SignAllInBatch(batch int) ([]*fuseralib.Accession, error)

SignAllInBatch The function to call to get information on all the accessions, but in batches to avoid overloading the SDL API.

type VersionWrap

type VersionWrap struct {
	Version string       `json:"version,omitempty"`
	Result  []*Accession `json:"result,omitempty"`
}

VersionWrap The JSON object that wraps the SDL API's responses.

func (*VersionWrap) Validate

func (v *VersionWrap) Validate() error

Validate VersionWrap 1. Expected Version. 2. Result isn't empty.

Jump to

Keyboard shortcuts

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