api

package
v0.0.0-...-1bd3920 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Maximum number of files that can be included in a batch request.
	BatchSizeLimit = 500

	// Maximum size of a file that can be uploaded within a batch request or put directly.
	// Larger files must use the upload API.
	PutFileSizeLimit = 32 * 1024 * 1024
)

Request size limits.

View Source
const (
	// The Batch-Error header is sent as a trailer on batch responses.
	// If not empty, it indicates that there was an error processing
	// the batch request.
	HeaderBatchError = "Batch-Error"

	// The Path header indicates the path of a file in a batch operation.
	HeaderPath = "Path"

	// The Digest request and response header specifies cryptographic hashes for
	// a resource. The header must consist of the name of the digest algorithm
	// and the Base64-encoded checksum separated by a space.
	//
	// Example:
	// Digest: SHA256 qj7BbmrMgJ2LKBhmInYlar/S8bRBy1FXSTPz1L0RXRE=
	HeaderDigest = "Digest"

	// The Upload-Expires response header indicates the time after which an
	// unfinished upload expires.
	HeaderUploadExpires = "Upload-Expires"

	// The Upload-ID response header indicates the ID of a newly created upload.
	HeaderUploadID = "Upload-ID"

	// The Upload-Length request and response header indicates the size of an
	// entire upload in bytes. The value must be a non-negative integer.
	HeaderUploadLength = "Upload-Length"

	// The Upload-Offset request and response header indicates a byte offset
	// within a resource. The value must be a non-negative integer.
	HeaderUploadOffset = "Upload-Offset"

	// The Source header indicates the reason for a dataset PUT request.
	// The only valid value is "deleted" which indicates that the dataset
	// should be undeleted.
	HeaderSource = "Source"
)

Custom HTTP headers

View Source
const (
	DatasetScope = "dataset"
	UploadScope  = "upload"
)

Recognized scope classes. Example: "read:dataset[:datasetID]"

View Source
const HTTPTimeFormat = "Mon, 02 Jan 2006 15:04:05 GMT"

HTTPTimeFormat is the standard HTTP format for timestamps.

View Source
const (
	SHA256 = "SHA256"
)

Digest algorithms

Variables

This section is empty.

Functions

func DecodeDigest

func DecodeDigest(digest string) ([]byte, error)

func EncodeDigest

func EncodeDigest(digest []byte) string

Types

type Dataset

type Dataset struct {
	ID      string    `json:"id"`
	Created time.Time `json:"created"`

	// Whether the dataset is locked for writes.
	ReadOnly bool `json:"readonly"`

	// Size of the dataset. May be nil.
	Size *DatasetSize `json:"size,omitempty"`
}

Dataset is a collection of files.

type DatasetPatch

type DatasetPatch struct {
	// (optional) If true, lock the dataset for writes. Ignored if false.
	ReadOnly bool `json:"readonly,omitempty"`
}

DatasetPatch allows modification of a dataset's mutable properties.

type DatasetSize

type DatasetSize struct {
	// If true the dataset's size is final and will not change.
	Final      bool   `json:"final"`
	Files      int64  `json:"files"`
	Bytes      int64  `json:"bytes"`
	BytesHuman string `json:"bytesHuman"`
}

DatasetSize describes the size of a dataset.

type Error

type Error struct {
	// HTTP status code, such as 404
	Code int `json:"code"`

	// The text of the error, which should follow the guidelines found at:
	// https://github.com/golang/go/wiki/CodeReviewComments#error-strings
	Message string `json:"message"`

	// (optional) Long-form detail, such as the error's call stack
	Detail string `json:"detail,omitempty"`
}

Error encodes an error as a JSON-serializable struct.

func (Error) Error

func (e Error) Error() string

Error implements the standard error interface.

func (Error) Format

func (e Error) Format(s fmt.State, verb rune)

Format implements the fmt.Formatter interface.

type FileInfo

type FileInfo struct {
	// Path of the file relative to its dataset root.
	Path string `json:"path"`

	// Size of the file in bytes.
	Size int64 `json:"size"`

	// Cryptographic hash of the file's contents using the SHA256 algorithm.
	Digest []byte `json:"digest"`

	// Time at which the file was last updated.
	Updated time.Time `json:"updated"`

	// URL where the file can be retrieved with a GET request.
	URL string `json:"url,omitempty"`
}

FileInfo describes a single file within a dataset.

type ManifestPage

type ManifestPage struct {
	// A list of files in the dataset, sorted by path. Results are limited to a
	// fix number of of files per request. If the res
	Files []FileInfo `json:"files"`

	// An optional cursor to retrieve further results.
	Cursor string `json:"cursor,omitempty"`
}

ManifestPage describes a list of files within a dataset.

Jump to

Keyboard shortcuts

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