simulator

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 44 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApiErrorAlreadyExists added in v0.31.0

func ApiErrorAlreadyExists(w http.ResponseWriter)

ApiErrorAlreadyExists responds with a REST error of type "ALREADY_EXISTS". For use with "/api" endpoints.

func ApiErrorGeneral added in v0.31.0

func ApiErrorGeneral(w http.ResponseWriter)

ApiErrorGeneral responds with a REST error of type "ERROR". For use with "/api" endpoints.

func ApiErrorInvalidArgument added in v0.31.0

func ApiErrorInvalidArgument(w http.ResponseWriter)

ApiErrorInvalidArgument responds with a REST error of type "INVALID_ARGUMENT". For use with "/api" endpoints.

func ApiErrorNotAllowedInCurrentState added in v0.31.0

func ApiErrorNotAllowedInCurrentState(w http.ResponseWriter)

ApiErrorNotAllowedInCurrentState responds with a REST error of type "NOT_ALLOWED_IN_CURRENT_STATE". For use with "/api" endpoints.

func ApiErrorNotFound added in v0.31.0

func ApiErrorNotFound(w http.ResponseWriter)

ApiErrorNotFound responds with a REST error of type "NOT_FOUND". For use with "/api" endpoints.

func ApiErrorResourceInUse added in v0.31.0

func ApiErrorResourceInUse(w http.ResponseWriter)

ApiErrorResourceInUse responds with a REST error of type "RESOURCE_IN_USE". For use with "/api" endpoints.

func ApiErrorUnauthorized added in v0.31.0

func ApiErrorUnauthorized(w http.ResponseWriter)

ApiErrorUnauthorized responds with a REST error of type "UNAUTHORIZED". For use with "/api" endpoints.

func ApiErrorUnsupported added in v0.31.0

func ApiErrorUnsupported(w http.ResponseWriter)

ApiErrorUnsupported responds with a REST error of type "UNSUPPORTED". For use with "/api" endpoints.

func BadRequest added in v0.22.0

func BadRequest(w http.ResponseWriter, kind string)

BadRequest responds with http.StatusBadRequest and json encoded vAPI error of type kind. For use with "/rest" endpoints where the response is a "value" wrapped structure.

func Decode added in v0.22.0

func Decode(r *http.Request, w http.ResponseWriter, val interface{}) bool

Decode the request Body into val. Returns true on success, otherwise false and sends the http.StatusBadRequest response.

func New

func New(u *url.URL, r *simulator.Registry) ([]string, http.Handler)

New creates a vAPI simulator.

func OK added in v0.22.0

func OK(w http.ResponseWriter, val ...interface{})

OK responds with http.StatusOK and encodes val, if specified, to JSON For use with "/rest" endpoints where the response is a "value" wrapped structure.

func StatusOK added in v0.24.0

func StatusOK(w http.ResponseWriter, val ...interface{})

StatusOK responds with http.StatusOK and encodes val, if specified, to JSON For use with "/api" endpoints.

Types

This section is empty.

Jump to

Keyboard shortcuts

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