api

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagHeaderPrefix = "Mrd-Tag-"
	NullSubject     = "$null"
)

Variables

This section is empty.

Functions

func BuildRouter

func BuildRouter(db core.MetadataDatabase, store core.BlobStore, logRequests bool) http.Handler

func CreateBlobInfo

func CreateBlobInfo(r *http.Request, blob *core.BlobInfo) map[string]interface{}

func GetRequestId added in v0.0.8

func GetRequestId(ctx context.Context) string

Gets the ID for the current request or empty if there is none.

func TagHeaderName

func TagHeaderName(tagName string) string

func ValidateAndStoreOptionalSystemTag

func ValidateAndStoreOptionalSystemTag(tagName string, tagValues []string, field **string, validator TagValidator) error

func ValidateAndStoreTag

func ValidateAndStoreTag(tags *core.BlobTags, tagName string, tagValues []string) error

func ValidateGenericTagValues

func ValidateGenericTagValues(tagName string, tagValues []string) error

func ValidateOnlyOneTag

func ValidateOnlyOneTag(tagName string, tagValues []string) error

func ValidateSubjectTagValue

func ValidateSubjectTagValue(tagName string, tagValues []string) error

func ValidateTagName

func ValidateTagName(tagName string, tagValues []string) error

func ValidateTimeToLive added in v0.0.5

func ValidateTimeToLive(tagName string, tagValues []string) error

Types

type ErrorInfo

type ErrorInfo struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type ErrorResponse

type ErrorResponse struct {
	Error ErrorInfo `json:"error"`
}

Based on https://github.com/microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses

func CreateErrorResponse

func CreateErrorResponse(code, message string) ErrorResponse

type Handler

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

func (*Handler) BlobDataResponse

func (handler *Handler) BlobDataResponse(w http.ResponseWriter, r *http.Request, blobInfo *core.BlobInfo)

func (*Handler) BlobMetadataResponse

func (handler *Handler) BlobMetadataResponse(w http.ResponseWriter, r *http.Request, blobInfo *core.BlobInfo)

func (*Handler) CreateBlob

func (handler *Handler) CreateBlob(w http.ResponseWriter, r *http.Request)

func (*Handler) GetLatestBlobData

func (handler *Handler) GetLatestBlobData(w http.ResponseWriter, r *http.Request)

func (*Handler) MakeBlobEndpoint

func (handler *Handler) MakeBlobEndpoint(responder Responder, grace time.Duration) http.HandlerFunc

func (*Handler) SearchBlobs

func (handler *Handler) SearchBlobs(w http.ResponseWriter, r *http.Request)

type Responder

type Responder func(http.ResponseWriter, *http.Request, *core.BlobInfo)

type SearchResponse

type SearchResponse struct {
	Items    []map[string]interface{} `json:"items"`
	NextLink string                   `json:"nextLink,omitempty"`
}

type TagValidator

type TagValidator func(tagName string, tagValues []string) error

func CombineTagValidators

func CombineTagValidators(validators ...TagValidator) TagValidator

Jump to

Keyboard shortcuts

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