api

package
v0.0.0-...-768b56e Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2018 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Overview

Package api implements the htsget readset retrieval API.

The version implemented by this package is v1.0.0 defined at: http://samtools.github.io/hts-specs/htsget.html.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClientFromBearerToken

func NewClientFromBearerToken(req *http.Request) (*storage.Client, http.Header, error)

NewClientFromBearerToken constructs a storage client that uses the OAuth2 bearer token found in req to make storage requests. It returns the authorization header containing the bearer token as well to allow subsequent requests to be authenticated correctly.

func NewDefaultClient

func NewDefaultClient(_ *http.Request) (*storage.Client, http.Header, error)

NewDefaultClient returns a storage client that uses the application default credentials. It caches the storage client for efficiency.

func NewPublicClient

func NewPublicClient(_ *http.Request) (*storage.Client, http.Header, error)

NewPublicClient returns a storage client that does not use any form of client authorization. It can only be used to read publicly-readable objects. It caches the storage client for efficiency.

Types

type NewStorageClientFunc

type NewStorageClientFunc func(*http.Request) (*storage.Client, http.Header, error)

NewStorageClientFunc is the type of function that constructs the appropriate storage.Client to satisfy the incoming request. Any headers that caused this particular client to be created are returned to allow block requests to be generated correctly.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server provides an htsget protocol server. Must be created with NewServer.

func NewServer

func NewServer(newStorageClient NewStorageClientFunc, blockSizeLimit uint64) *Server

NewServer returns a new Server configured to use newStorageClient and blockSizeLimit. The server will call storageClientFunc on each request to determine which GCS storage client to use.

func (*Server) Export

func (server *Server) Export(mux *http.ServeMux)

Export registers the htsget API endpoint with mux and reads data using gcs. Blocks returned from the endpoint will generally not exceed blockSizeLimit bytes, though BAM chunks that already exceed this size will not be split.

func (*Server) Whitelist

func (server *Server) Whitelist(buckets []string)

Whitelist adds buckets to the set of buckets which the server is allowed to access. If Whitelist is never called for a given Server then reads from any bucket are allowed.

Jump to

Keyboard shortcuts

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