Documentation
¶
Index ¶
- type API
- type Key
- func (h Key) Create(w http.ResponseWriter, r *http.Request)
- func (h Key) DeleteModel(r *http.Request) error
- func (h Key) Destroy(w http.ResponseWriter, r *http.Request)
- func (h Key) Edit(w http.ResponseWriter, r *http.Request)
- func (h Key) Index(w http.ResponseWriter, r *http.Request)
- func (h Key) IndexWithRelations(r *http.Request) ([]*key.Key, database.Paginator, error)
- func (h Key) ShowWithRelations(r *http.Request) (*key.Key, error)
- func (h Key) Store(w http.ResponseWriter, r *http.Request)
- func (h Key) StoreModel(r *http.Request) (*key.Key, key.Form, error)
- func (h Key) Update(w http.ResponseWriter, r *http.Request)
- func (h Key) UpdateModel(r *http.Request) (*key.Key, key.Form, error)
- type UI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Key // Prefix is the part of the URL under which the API is being served, for // example "/api". Prefix string }
API is the handler for handling API requests made for key creation, and management.
func (API) Destroy ¶
func (h API) Destroy(w http.ResponseWriter, r *http.Request)
Destroy removes the key in the given request context from the database. This serves no content in the response body.
func (API) Index ¶
func (h API) Index(w http.ResponseWriter, r *http.Request)
Index serves the JSON encoded list of keys for the given request. If multiple pages of keys are returned then the database.Paginator is encoded in the Link response header.
func (API) Show ¶ added in v1.1.0
func (h API) Show(w http.ResponseWriter, r *http.Request)
Show serves the JSON response for viewing an individual key.
func (API) Store ¶
func (h API) Store(w http.ResponseWriter, r *http.Request)
Store stores and submits the key from the given request body. If any validation errors occur then these will be sent back in the JSON response. On success the key is sent in the JSON response.
func (API) Update ¶
func (h API) Update(w http.ResponseWriter, r *http.Request)
Update applies the changes in the given request body to the existing key in the database. If any validation errors occur then these will be sent back in the JSON response. On success the updated key is sent in the JSON response.
type Key ¶
Key is the base handler that provides shared logic for the UI and API handlers for key creation, and management.
func (Key) Create ¶
func (h Key) Create(w http.ResponseWriter, r *http.Request)
Create serves the HTML response for creating SSH keys via the web frontend.
func (Key) DeleteModel ¶
DeleteModel removes the key in the given request context from the database.
func (Key) Destroy ¶
func (h Key) Destroy(w http.ResponseWriter, r *http.Request)
Destroy removes the key in the given request context from the database. This redirects back to the request's referer.
func (Key) Edit ¶
func (h Key) Edit(w http.ResponseWriter, r *http.Request)
Edit serves the HTML response for editing the key in the given request context.
func (Key) Index ¶
func (h Key) Index(w http.ResponseWriter, r *http.Request)
Index serves the HTML response detailing the list of SSH keys.
func (Key) IndexWithRelations ¶
IndexWithRelations retrieves a slice of *key.Key models for the user in the given request context. All of the relations for each key will be loaded into each model we have. If any of the keys have a bound namespace, then the namespace's user will be loaded too. A database.Paginator will also be returned if there are multiple pages of keys.
func (Key) ShowWithRelations ¶
ShowWithRelations retrieves the *key.Keys model from the context of the given request. All of the relations for the key will be loaded into the model we have. If the key has a namespace bound to it, then the namespace's user will be loaded to the namespace.
func (Key) Store ¶
func (h Key) Store(w http.ResponseWriter, r *http.Request)
Store validates the form submitted in the given request for creating a key. If validation fails then the user is redirected back to the request referer, otherwise they are redirect back to the key index.
func (Key) StoreModel ¶
StoreModel unmarshals the request's data into a key, validates it and stores it in the database. Upon success this will return the newly created key. This also returns the form for creating a key.
func (Key) Update ¶
func (h Key) Update(w http.ResponseWriter, r *http.Request)
Update validates the form submitted in the given request for updating a key. If validation fails then the user is redirect back to the request's referer, otherwise they are redirected back to the updated cron job.
func (Key) UpdateModel ¶
UpdateModel unmarshals the request's data into a key, validates it and updates the existing key in the database with the content in the form. Upon success the updated key is returned. This also returns the form for modifying a key.