api

package
v5.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BadImageIDError = Error{
	ID:     "bad_request",
	Code:   "bad_request",
	Status: "400",
	Title:  "Bad Request",
	Detail: "The image ID provided is not valid",
	Source: ErrorSource{
		Parameter: "image_id",
	},
}
View Source
var CannotDeleteImageWithInstancesError = Error{
	ID:     "unprocessable_entity",
	Code:   "unprocessable_entity",
	Status: "422",
	Title:  "Image Has Instances",
	Detail: "Cannot delete an image that has instances",
}
View Source
var ImageNotFoundError = Error{
	ID:     "resource_not_found",
	Code:   "resource_not_found",
	Status: "404",
	Title:  "Image Not Found",
	Detail: "The image you specified could not be found",
}
View Source
var InternalServerError = Error{
	ID:     "internal_server_error",
	Code:   "internal_server_error",
	Status: "500",
	Title:  "Internal Server Error",
	Detail: "Something went wrong :(",
}
View Source
var InvalidJSONError = Error{
	ID:     "bad_request",
	Code:   "bad_request",
	Status: "400",
	Title:  "Invalid JSON",
	Detail: "Your JSON is malformed",
}
View Source
var MissingApiVersion = Error{
	ID:     "missing_api_version_header",
	Code:   "missing_api_version_header",
	Status: "400",
	Title:  "Missing API Version Header",
	Detail: "No API version specified in Draupnir-Version header",
}
View Source
var NotFoundError = Error{
	ID:     "resource_not_found",
	Code:   "resource_not_found",
	Status: "404",
	Title:  "Resource Not Found",
	Detail: "The resource you requested could not be found",
}
View Source
var OauthError = Error{
	ID:     "bad_request",
	Code:   "bad_request",
	Status: "400",
	Title:  "OAuth Error",
	Detail: "There was some oauth error",
}
View Source
var UnauthorizedError = Error{
	ID:     "unauthorized",
	Code:   "unauthorized",
	Status: "401",
	Title:  "Unauthorized",
	Detail: "You do not have permission to view this resource",
}
View Source
var UnreadyImageError = Error{
	ID:     "unprocessable_entity",
	Code:   "unprocessable_entity",
	Status: "422",
	Title:  "Image Not Ready",
	Detail: "The specified image is not ready to be used",
	Source: ErrorSource{
		Parameter: "image_id",
	},
}

Functions

This section is empty.

Types

type Error

type Error struct {
	ID     string      `json:"id"`
	Status string      `json:"status"`
	Code   string      `json:"code"`
	Title  string      `json:"title"`
	Detail string      `json:"detail"`
	Source ErrorSource `json:"source,omitempty"`
}

func InvalidApiVersion

func InvalidApiVersion(v string) Error

func (Error) Render

func (e Error) Render(w http.ResponseWriter, statuscode int)

type ErrorSource

type ErrorSource struct {
	Pointer   string `json:"pointer,omitempty"`
	Parameter string `json:"parameter,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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