Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteError ¶
func WriteError(w http.ResponseWriter, statusCode int, err error) error
WriteError writes an error response back to the ResponseWriter.
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, statusCode int, resp interface{}) error
WriteResponse writes a response object to the provided ResponseWriter w and with a status code of statusCode. resp is marshaled to JSON.
Types ¶
type APIResponse ¶
type APIResponse struct {
Status string `json:"status"`
Data interface{} `json:"data,omitempty"`
}
APIResponse is the base object returned for any API call. The Data field will be set to either nil or a value of another *Response type value from this package.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse is contained inside an APIResponse and returns an error string. Returned by any API call that can fail.
type GetConfigurationResponse ¶
type GetConfigurationResponse struct {
// Value is the stringified YAML configuration.
Value string `json:"value"`
}
GetConfigurationResponse is contained inside an APIResponse and provides a single configuration known to the KV store. Returned by GetConfiguration.
type ListConfigurationsResponse ¶
type ListConfigurationsResponse struct {
// Configs is the list of configuration names.
Configs []string `json:"configs"`
}
ListConfigurationsResponse is contained inside an APIResponse and provides the list of configurations known to the KV store. Returned by ListConfigurations.