Documentation ¶
Index ¶
- Constants
- func JSONRequest(httpClient *http.Client, method string, reqURL string, data string, ...) error
- func ParseBool(m map[string]interface{}, key string, methodAPI string) (bool, error)
- func ParseNumber(m map[string]interface{}, key string, methodAPI string) (*model.Number, error)
- func ParseString(m map[string]interface{}, key string, methodAPI string) (string, error)
- type AuthLevel
- type Config
- type Endpoint
- type WebServer
Constants ¶
const PrefixFieldNotFound = "could not find field in map"
PrefixFieldNotFound is what is returned in the error when we cannot find a field in the map
Variables ¶
This section is empty.
Functions ¶
func JSONRequest ¶
func JSONRequest( httpClient *http.Client, method string, reqURL string, data string, headers map[string]string, responseData interface{}, errorKey string, ) error
JSONRequest submits an HTTP web request and parses the response into the responseData object as JSON
func ParseNumber ¶
ParseNumber helps to parse a model.Number value out of the map
Types ¶
type AuthLevel ¶
type AuthLevel int
AuthLevel specifies the level of authentication needed for an endpoint.
type Config ¶
type Config struct { // PermittedEmails is a map of emails that are allowed access to the endpoints protected by Google authentication PermittedEmails map[string]bool // GoogleClientID - client ID of the Google application. It should only be left empty if no endpoints require // Google authentication GoogleClientID string // GoogleClientSecret - client secret of the Google application. It should only be left empty if no endpoints require // Google authentication GoogleClientSecret string }
Config is a struct storing configuration parameters for the monitoring server.
type Endpoint ¶
type Endpoint interface { GetHandlerFunc() http.HandlerFunc GetAuthLevel() AuthLevel GetPath() string }
Endpoint represents an API endpoint that implements GetHandlerFunc which returns a http.HandlerFunc specifying the behavior when this endpoint is hit. It's also required to implement GetAuthLevel, which returns the level of authentication that's required to access this endpoint. Currently, the values can be NoAuth or GoogleAuth. Lastly, GetPath returns the path that routes to this endpoint.