api

package
v0.0.0-...-96fe679 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2014 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Database *mgo.Session

Database is used to store a handle to the *mgo.Session so that it can be injected by the middleware into the context

Functions

func ContentTypeJSON

func ContentTypeJSON(res web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

ContentTypeJSON sets the content header for JSON responses

func NewRouter

func NewRouter(db *mgo.Session) *web.Router

NewRouter generates a new Mux router that implements the various Docker Registry API calls required

Types

type APIContext

type APIContext struct {
	*Context
}

APIContext is inialised for each API user by the middleware and passed to the URL handlers when it can be inspected/updated.

func (*APIContext) AncestryDelete

func (c *APIContext) AncestryDelete(res web.ResponseWriter, req *web.Request)

AncestryDelete handles DELETE requests for removing image ancestry information DELETE /images/:image_id/ancestry

func (*APIContext) AncestryGet

func (c *APIContext) AncestryGet(res web.ResponseWriter, req *web.Request)

AncestryGet handles GET requests for retrieving image ancestry information GET /images/:image_id/ancestry

func (*APIContext) AncestryPut

func (c *APIContext) AncestryPut(res web.ResponseWriter, req *web.Request)

AncestryPut handles PUT requests for creating image ancestry information PUT /images/:image_id/ancestry

func (*APIContext) ImageDelete

func (c *APIContext) ImageDelete(res web.ResponseWriter, req *web.Request)

DELETE /images/:image_id/json

func (*APIContext) ImageGet

func (c *APIContext) ImageGet(res web.ResponseWriter, req *web.Request)

ImageGet loads an image from the database and returns it to the requestor in JSON format. GET /images/:image_id/json

func (*APIContext) ImageIndex

func (c *APIContext) ImageIndex(res web.ResponseWriter, req *web.Request)

GET /images

func (*APIContext) ImagePut

func (c *APIContext) ImagePut(res web.ResponseWriter, req *web.Request)

ImagePut recieves docker image metadata in json form and stores it in the database if it doesn't already exist. PUT /images/:image_id/json

func (*APIContext) LayerDelete

func (c *APIContext) LayerDelete(res web.ResponseWriter, req *web.Request)

DELETE /images/:image_id/layer

func (*APIContext) LayerGet

func (c *APIContext) LayerGet(res web.ResponseWriter, req *web.Request)

GET /images/:image_id/layer

func (*APIContext) LayerPut

func (c *APIContext) LayerPut(res web.ResponseWriter, req *web.Request)

PUT /images/:image_id/layer

func (*APIContext) RepositoryAuth

func (c *APIContext) RepositoryAuth(res web.ResponseWriter, req *web.Request)

PUT /repositories/:owner/:repository/auth

func (*APIContext) RepositoryDelete

func (c *APIContext) RepositoryDelete(res web.ResponseWriter, req *web.Request)

DELETE /repositories/:owner/:repository

func (*APIContext) RepositoryImageGet

func (c *APIContext) RepositoryImageGet(res web.ResponseWriter, req *web.Request)

GET /repositories/:owner/:repository/images

func (*APIContext) RepositoryImagePut

func (c *APIContext) RepositoryImagePut(res web.ResponseWriter, req *web.Request)

PUT /repositories/:owner/:repository/images

func (*APIContext) RepositoryPut

func (c *APIContext) RepositoryPut(res web.ResponseWriter, req *web.Request)

RepositoryPut creates a repository if it doesn't already exist and if the user has permission to do so. PUT http://docker.directory/v1/:owner/:repository

func (*APIContext) Status

func (c *APIContext) Status(res web.ResponseWriter, req *web.Request)

Status reports on the status of the registry. This endpoint is also used to determin if the registry supports SSL

func (*APIContext) TagDelete

func (c *APIContext) TagDelete(res web.ResponseWriter, req *web.Request)

DELETE /repositories/:owner/:repository/tags/:tag

func (*APIContext) TagGet

func (c *APIContext) TagGet(res web.ResponseWriter, req *web.Request)

GET /repositories/:owner/:repository/tags/:tag

func (*APIContext) TagPut

func (c *APIContext) TagPut(res web.ResponseWriter, req *web.Request)

PUT /repositories/:owner/:repository/tags/:tag

func (*APIContext) TagsGet

func (c *APIContext) TagsGet(res web.ResponseWriter, req *web.Request)

GET /repositories/:owner/:repository/tags

func (*APIContext) UserCreate

func (c *APIContext) UserCreate(res web.ResponseWriter, req *web.Request)

UserCreate handles user creation POST requests from the docker client. POST /users

func (*APIContext) UserLogin

func (c *APIContext) UserLogin(res web.ResponseWriter, req *web.Request)

UserLogin authenticates a user GET /users

func (*APIContext) UserUpdate

func (c *APIContext) UserUpdate(res web.ResponseWriter, req *web.Request)

PUT /users/:username

type Context

type Context struct {
	User     *models.User
	Database *mgo.Session
}

Context is inialised for each user by the middleware and passed to the URL handlers when it can be inspected/updated.

func (*Context) Authenticate

func (c *Context) Authenticate(w web.ResponseWriter, r *web.Request, next web.NextMiddlewareFunc)

Authenticate middleware authenticates a HTTP request either via basic auth or by accesstoken as per the Docker Registry & Index Spec.

func (*Context) Authorize

func (c *Context) Authorize(w web.ResponseWriter, r *web.Request, next web.NextMiddlewareFunc)

Authorize middleware checks whether an authenticated user is allowed to access the resource they are requesting

func (*Context) ImageChecksumDelete

func (c *Context) ImageChecksumDelete(res web.ResponseWriter, req *web.Request)

DELETE /images/:image_id/checksum

func (*Context) ImageChecksumGet

func (c *Context) ImageChecksumGet(res web.ResponseWriter, req *web.Request)

GET /images/:image_id/checksum

func (*Context) ImageChecksumPut

func (c *Context) ImageChecksumPut(res web.ResponseWriter, req *web.Request)

PUT /images/:image_id/checksum

func (*Context) Index

func (c *Context) Index(res web.ResponseWriter, req *web.Request)

Index handles incoming GET requests on our root index '/'

func (*Context) MongoDatabase

func (c *Context) MongoDatabase(res web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

MongoDatabase sets up a database session in the context

func (*Context) RequestLogger

func (c *Context) RequestLogger(res web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

RequestLogger prints a pretty JSON representation of incoming requests

func (*Context) Version

func (c *Context) Version(res web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

Version adds a X-Docker-Registry-Version cookie header

type JSON

type JSON map[string]interface{}

JSON provides an easy way to write JSON responses in anything that requires a Stringer interface, such as the fmt.Fprintf(). This makes it very handy for writing out JSON HTTP responses.

func (JSON) String

func (r JSON) String() string

Jump to

Keyboard shortcuts

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