Documentation ¶
Index ¶
- func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
- func Logger(inner http.Handler, name string) http.Handler
- func NewRouter(routers ...Router) *mux.Router
- func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)
- type ContainerSpec
- type ImplResponse
- type Instance
- type InstanceEvent
- type InstanceSpec
- type InstanceStatus
- type InstancesApiController
- type InstancesApiRouter
- type InstancesApiService
- type InstancesApiServicer
- type ProviderSpec
- type Route
- type Router
- type Routes
- type ScrapeTarget
- type StaticSpec
- type TargetsApiController
- type TargetsApiRouter
- type TargetsApiService
- type TargetsApiServicer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeJSONResponse ¶
func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code
Types ¶
type ContainerSpec ¶
type ImplResponse ¶
type ImplResponse struct { Code int Body interface{} }
Implementation response defines an error code with the associated body
func Response ¶
func Response(code int, body interface{}) ImplResponse
Response return a ImplResponse struct filled
type Instance ¶
type Instance struct { Name string `json:"name"` Endpoint string `json:"endpoint"` Provider string `json:"provider"` Active bool `json:"active"` Container ContainerSpec `json:"container"` Status InstanceStatus `json:"status"` }
type InstanceEvent ¶
type InstanceSpec ¶
type InstanceSpec struct {
Container ContainerSpec `json:"container"`
}
type InstanceStatus ¶
type InstancesApiController ¶
type InstancesApiController struct {
// contains filtered or unexported fields
}
A InstancesApiController binds http requests to an api service and writes the service results to the http response
func (*InstancesApiController) GetInstances ¶
func (c *InstancesApiController) GetInstances(w http.ResponseWriter, r *http.Request)
GetInstances - Get InstanceDemand for a ScrapeTarget
func (*InstancesApiController) Routes ¶
func (c *InstancesApiController) Routes() Routes
Routes returns all of the api route for the InstancesApiController
func (*InstancesApiController) SaveInstances ¶
func (c *InstancesApiController) SaveInstances(w http.ResponseWriter, r *http.Request)
SaveInstances - Update InstanceDemand for a ScrapeTarget
type InstancesApiRouter ¶
type InstancesApiRouter interface { GetInstances(http.ResponseWriter, *http.Request) SaveInstances(http.ResponseWriter, *http.Request) }
InstancesApiRouter defines the required methods for binding the api requests to a responses for the InstancesApi The InstancesApiRouter implementation should parse necessary information from the http request, pass the data to a InstancesApiServicer to perform the required actions, then write the service results to the http response.
type InstancesApiService ¶
type InstancesApiService struct { }
InstancesApiService is a service that implents the logic for the InstancesApiServicer This service should implement the business logic for every endpoint for the InstancesApi API. Include any external packages or services that will be required by this service.
func (*InstancesApiService) GetInstances ¶
func (s *InstancesApiService) GetInstances(ctx context.Context, target string) (ImplResponse, error)
GetInstances - Get InstanceDemand for a ScrapeTarget
func (*InstancesApiService) SaveInstances ¶
func (s *InstancesApiService) SaveInstances(ctx context.Context, target string, instance []Instance) (ImplResponse, error)
SaveInstances - Update InstanceDemand for a ScrapeTarget
type InstancesApiServicer ¶
type InstancesApiServicer interface { GetInstances(context.Context, string) (ImplResponse, error) SaveInstances(context.Context, string, []Instance) (ImplResponse, error) }
InstancesApiServicer defines the api actions for the InstancesApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
func NewInstancesApiService ¶
func NewInstancesApiService() InstancesApiServicer
NewInstancesApiService creates a default api service
type ProviderSpec ¶
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc http.HandlerFunc }
A Route defines the parameters for an api endpoint
type Router ¶
type Router interface {
Routes() Routes
}
Router defines the required methods for retrieving api routes
func NewInstancesApiController ¶
func NewInstancesApiController(s InstancesApiServicer) Router
NewInstancesApiController creates a default api controller
func NewTargetsApiController ¶
func NewTargetsApiController(s TargetsApiServicer) Router
NewTargetsApiController creates a default api controller
type ScrapeTarget ¶
type ScrapeTarget struct { Name string `json:"name"` Path string `json:"path"` Description string `json:"description"` Query string `json:"query"` ProviderSpec ProviderSpec `json:"providerSpec"` InstanceSpec InstanceSpec `json:"instanceSpec"` StaticSpec StaticSpec `json:"staticSpec"` }
type StaticSpec ¶
type StaticSpec struct {
Endpoints []string `json:"endpoints"`
}
type TargetsApiController ¶
type TargetsApiController struct {
// contains filtered or unexported fields
}
A TargetsApiController binds http requests to an api service and writes the service results to the http response
func (*TargetsApiController) ListScrapeTargets ¶
func (c *TargetsApiController) ListScrapeTargets(w http.ResponseWriter, r *http.Request)
ListScrapeTargets - List ScrapeTargets
func (*TargetsApiController) Routes ¶
func (c *TargetsApiController) Routes() Routes
Routes returns all of the api route for the TargetsApiController
type TargetsApiRouter ¶
type TargetsApiRouter interface {
ListScrapeTargets(http.ResponseWriter, *http.Request)
}
TargetsApiRouter defines the required methods for binding the api requests to a responses for the TargetsApi The TargetsApiRouter implementation should parse necessary information from the http request, pass the data to a TargetsApiServicer to perform the required actions, then write the service results to the http response.
type TargetsApiService ¶
type TargetsApiService struct { }
TargetsApiService is a service that implents the logic for the TargetsApiServicer This service should implement the business logic for every endpoint for the TargetsApi API. Include any external packages or services that will be required by this service.
func (*TargetsApiService) ListScrapeTargets ¶
func (s *TargetsApiService) ListScrapeTargets(ctx context.Context) (ImplResponse, error)
ListScrapeTargets - List ScrapeTargets
type TargetsApiServicer ¶
type TargetsApiServicer interface {
ListScrapeTargets(context.Context) (ImplResponse, error)
}
TargetsApiServicer defines the api actions for the TargetsApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
func NewTargetsApiService ¶
func NewTargetsApiService() TargetsApiServicer
NewTargetsApiService creates a default api service
Source Files ¶
- api.go
- api_instances.go
- api_instances_service.go
- api_targets.go
- api_targets_service.go
- helpers.go
- impl.go
- logger.go
- model_container_spec.go
- model_instance.go
- model_instance_event.go
- model_instance_spec.go
- model_instance_status.go
- model_provider_spec.go
- model_scrape_target.go
- model_static_spec.go
- routers.go