Documentation ¶
Overview ¶
Package apiv1 provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.13.3 DO NOT EDIT.
Index ¶
- Constants
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r *mux.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r *mux.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options GorillaServerOptions) http.Handler
- func New(api api.API, logger zerolog.Logger) *apiv1
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func Register(router *mux.Router, api api.API, logger zerolog.Logger)
- type AcknowledgeAlert
- type Alert
- type AlertAcknowledgement
- type AlertStatus
- type GetAlertsParams
- type GetAlertsParamsOrder
- type GetAlertsStatsParams
- type GetSilencesParams
- type GetSilencesParamsOrder
- type GorillaServerOptions
- type InvalidParamFormatError
- type Matcher
- type MiddlewareFunc
- type PostAlerts
- type PostAlertsAckJSONRequestBody
- type PostAlertsJSONBody
- type PostAlertsJSONRequestBody
- type PostSilence
- type PostSilencesJSONRequestBody
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) GetAlerts(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAlertsStats(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSilences(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostAlerts(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostAlertsAck(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostSilences(w http.ResponseWriter, r *http.Request)
- type Silence
- type StatsResult
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
Constants ¶
const ( CONTENT_TYPE_JSON = "application/json" CONTENT_TYPE_PROTO = "application/vnd.google.protobuf" )
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r *mux.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options GorillaServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
Types ¶
type AcknowledgeAlert ¶
type AcknowledgeAlert = AlertAcknowledgement
AcknowledgeAlert defines model for AcknowledgeAlert.
type Alert ¶
type Alert struct { Acknowledgement *AlertAcknowledgement `json:"acknowledgement,omitempty"` Annotations map[string]string `json:"annotations"` EndsAt *time.Time `json:"endsAt,omitempty"` Id *string `json:"id,omitempty"` Labels map[string]string `json:"labels"` StartsAt time.Time `json:"startsAt"` Status AlertStatus `json:"status"` TimeoutDeadline *time.Time `json:"timeoutDeadline,omitempty"` }
Alert defines model for Alert.
type AlertAcknowledgement ¶
type AlertAcknowledgement struct { AlertID *string `json:"alertID,omitempty"` Comment string `json:"comment"` Creator string `json:"creator"` }
AlertAcknowledgement defines model for AlertAcknowledgement.
type AlertStatus ¶
type AlertStatus string
AlertStatus defines model for Alert.Status.
const ( Acked AlertStatus = "acked" Firing AlertStatus = "firing" Resolved AlertStatus = "resolved" Silenced AlertStatus = "silenced" TimedOut AlertStatus = "timed out" )
Defines values for AlertStatus.
type GetAlertsParams ¶
type GetAlertsParams struct { // Limit The maximum number of results to return Limit *int `form:"limit,omitempty" json:"limit,omitempty"` // Offset The offset into the results to return. Used for pagination Offset *int `form:"offset,omitempty" json:"offset,omitempty"` // Sort The fields to sort the results by Sort *[]string `form:"sort,omitempty" json:"sort,omitempty"` // Order The order of the results. Only valid if `sort` is also specified. Order *GetAlertsParamsOrder `form:"order,omitempty" json:"order,omitempty"` // Matchers The matchers used to filter the returned list. Only alerts that match all the matchers will be returned. Matchers *[]string `form:"matchers,omitempty" json:"matchers,omitempty"` }
GetAlertsParams defines parameters for GetAlerts.
type GetAlertsParamsOrder ¶
type GetAlertsParamsOrder string
GetAlertsParamsOrder defines parameters for GetAlerts.
const ( GetAlertsParamsOrderASC GetAlertsParamsOrder = "ASC" GetAlertsParamsOrderDESC GetAlertsParamsOrder = "DESC" )
Defines values for GetAlertsParamsOrder.
type GetAlertsStatsParams ¶
type GetAlertsStatsParams struct { Type string `form:"type" json:"type"` // Args The arguments to the query, depending on the query type. Args *map[string]string `form:"args,omitempty" json:"args,omitempty"` }
GetAlertsStatsParams defines parameters for GetAlertsStats.
type GetSilencesParams ¶
type GetSilencesParams struct { // Limit The maximum number of results to return Limit *int `form:"limit,omitempty" json:"limit,omitempty"` // Offset The offset into the results to return. Used for pagination Offset *int `form:"offset,omitempty" json:"offset,omitempty"` // Sort The fields to sort the results by Sort *[]string `form:"sort,omitempty" json:"sort,omitempty"` // Order The order of the results. Only valid if `sort` is also specified. Order *GetSilencesParamsOrder `form:"order,omitempty" json:"order,omitempty"` // Matchers The matchers used to filter the returned list. Only silences that match all the matchers will be returned. // Note that matchers are applied literally to silences, e.g. sending `instance=~foo` will _only_ return silences // which contain the matcher `instance=~foo` Matchers *[]string `form:"matchers,omitempty" json:"matchers,omitempty"` }
GetSilencesParams defines parameters for GetSilences.
type GetSilencesParamsOrder ¶
type GetSilencesParamsOrder string
GetSilencesParamsOrder defines parameters for GetSilences.
const ( GetSilencesParamsOrderASC GetSilencesParamsOrder = "ASC" GetSilencesParamsOrderDESC GetSilencesParamsOrder = "DESC" )
Defines values for GetSilencesParamsOrder.
type GorillaServerOptions ¶
type GorillaServerOptions struct { BaseURL string BaseRouter *mux.Router Middlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type Matcher ¶
type Matcher struct { IsNegative bool `json:"isNegative"` IsRegex bool `json:"isRegex"` Label string `json:"label"` Value string `json:"value"` }
Matcher defines model for Matcher.
type MiddlewareFunc ¶
type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc
type PostAlertsAckJSONRequestBody ¶
type PostAlertsAckJSONRequestBody = AlertAcknowledgement
PostAlertsAckJSONRequestBody defines body for PostAlertsAck for application/json ContentType.
type PostAlertsJSONBody ¶
type PostAlertsJSONBody = []Alert
PostAlertsJSONBody defines parameters for PostAlerts.
type PostAlertsJSONRequestBody ¶
type PostAlertsJSONRequestBody = PostAlertsJSONBody
PostAlertsJSONRequestBody defines body for PostAlerts for application/json ContentType.
type PostSilencesJSONRequestBody ¶
type PostSilencesJSONRequestBody = Silence
PostSilencesJSONRequestBody defines body for PostSilences for application/json ContentType.
type RequiredHeaderError ¶
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type ServerInterface ¶
type ServerInterface interface { // Get alerts details // (GET /alerts) GetAlerts(w http.ResponseWriter, r *http.Request, params GetAlertsParams) // Add, or update alerts // (POST /alerts) PostAlerts(w http.ResponseWriter, r *http.Request) // Acknowledge an alert // (POST /alerts/ack) PostAlertsAck(w http.ResponseWriter, r *http.Request) // Query aggregated stats about alerts in the system // (GET /alerts/stats) GetAlertsStats(w http.ResponseWriter, r *http.Request, params GetAlertsStatsParams) // Get silences // (GET /silences) GetSilences(w http.ResponseWriter, r *http.Request, params GetSilencesParams) // Silence alerts // (POST /silences) PostSilences(w http.ResponseWriter, r *http.Request) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error) }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) GetAlerts ¶
func (siw *ServerInterfaceWrapper) GetAlerts(w http.ResponseWriter, r *http.Request)
GetAlerts operation middleware
func (*ServerInterfaceWrapper) GetAlertsStats ¶
func (siw *ServerInterfaceWrapper) GetAlertsStats(w http.ResponseWriter, r *http.Request)
GetAlertsStats operation middleware
func (*ServerInterfaceWrapper) GetSilences ¶
func (siw *ServerInterfaceWrapper) GetSilences(w http.ResponseWriter, r *http.Request)
GetSilences operation middleware
func (*ServerInterfaceWrapper) PostAlerts ¶
func (siw *ServerInterfaceWrapper) PostAlerts(w http.ResponseWriter, r *http.Request)
PostAlerts operation middleware
func (*ServerInterfaceWrapper) PostAlertsAck ¶
func (siw *ServerInterfaceWrapper) PostAlertsAck(w http.ResponseWriter, r *http.Request)
PostAlertsAck operation middleware
func (*ServerInterfaceWrapper) PostSilences ¶
func (siw *ServerInterfaceWrapper) PostSilences(w http.ResponseWriter, r *http.Request)
PostSilences operation middleware
type Silence ¶
type Silence struct { Comment string `json:"comment"` Creator string `json:"creator"` EndsAt time.Time `json:"endsAt"` Id *string `json:"id,omitempty"` Matchers []Matcher `json:"matchers"` StartsAt time.Time `json:"startsAt"` }
Silence defines model for Silence.
type StatsResult ¶
type StatsResult struct { Frames [][]float32 `json:"frames"` Labels map[string]string `json:"labels"` }
StatsResult defines model for StatsResult.
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error