Merge pull request #11285 from influxdata/update_scraper_endpoint

fix(http): update scrapers endpoint
pull/11294/head
kelwang 2019-01-18 11:59:09 -05:00 committed by GitHub
commit ecf63c7935
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 20 deletions

View File

@ -170,11 +170,11 @@ var apiLinks = map[string]interface{}{
"spec": "/api/v2/query/spec",
"suggestions": "/api/v2/query/suggestions",
},
"setup": "/api/v2/setup",
"signin": "/api/v2/signin",
"signout": "/api/v2/signout",
"sources": "/api/v2/sources",
"scrapertargets": "/api/v2/scrapertargets",
"setup": "/api/v2/setup",
"signin": "/api/v2/signin",
"signout": "/api/v2/signout",
"sources": "/api/v2/sources",
"scrapers": "/api/v2/scrapers",
"system": map[string]string{
"metrics": "/metrics",
"debug": "/debug/pprof",
@ -262,7 +262,7 @@ func (h *APIHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
if strings.HasPrefix(r.URL.Path, "/api/v2/scrapertargets") {
if strings.HasPrefix(r.URL.Path, "/api/v2/scrapers") {
h.ScraperHandler.ServeHTTP(w, r)
return
}

View File

@ -22,7 +22,7 @@ type ScraperHandler struct {
}
const (
targetPath = "/api/v2/scrapertargets"
targetPath = "/api/v2/scrapers"
)
// NewScraperHandler returns a new instance of ScraperHandler.
@ -38,7 +38,7 @@ func NewScraperHandler() *ScraperHandler {
return h
}
// handlePostScraperTarget is HTTP handler for the POST /api/v2/scrapertargets route.
// handlePostScraperTarget is HTTP handler for the POST /api/v2/scrapers route.
func (h *ScraperHandler) handlePostScraperTarget(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
@ -63,7 +63,7 @@ func (h *ScraperHandler) handlePostScraperTarget(w http.ResponseWriter, r *http.
}
}
// handleDeleteScraperTarget is the HTTP handler for the DELETE /api/v2/scrapertargets/:id route.
// handleDeleteScraperTarget is the HTTP handler for the DELETE /api/v2/scrapers/:id route.
func (h *ScraperHandler) handleDeleteScraperTarget(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
@ -81,7 +81,7 @@ func (h *ScraperHandler) handleDeleteScraperTarget(w http.ResponseWriter, r *htt
w.WriteHeader(http.StatusNoContent)
}
// handlePatchScraperTarget is the HTTP handler for the PATCH /api/v2/scrapertargets/:id route.
// handlePatchScraperTarget is the HTTP handler for the PATCH /api/v2/scrapers/:id route.
func (h *ScraperHandler) handlePatchScraperTarget(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
@ -135,7 +135,7 @@ func (h *ScraperHandler) handleGetScraperTarget(w http.ResponseWriter, r *http.R
}
}
// handleGetScraperTargets is the HTTP handler for the GET /api/v2/scrapertargets route.
// handleGetScraperTargets is the HTTP handler for the GET /api/v2/scrapers route.
func (h *ScraperHandler) handleGetScraperTargets(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()

View File

@ -100,7 +100,7 @@ func TestService_handleGetScraperTargets(t *testing.T) {
`
{
"links": {
"self": "/api/v2/scrapertargets"
"self": "/api/v2/scrapers"
},
"scraper_targets": [
{
@ -113,7 +113,7 @@ func TestService_handleGetScraperTargets(t *testing.T) {
"type": "prometheus",
"url": "www.one.url",
"links": {
"self": "/api/v2/scrapertargets/0000000000000111"
"self": "/api/v2/scrapers/0000000000000111"
}
},
{
@ -126,7 +126,7 @@ func TestService_handleGetScraperTargets(t *testing.T) {
"type": "prometheus",
"url": "www.two.url",
"links": {
"self": "/api/v2/scrapertargets/0000000000000222"
"self": "/api/v2/scrapers/0000000000000222"
}
}
]
@ -169,7 +169,7 @@ func TestService_handleGetScraperTargets(t *testing.T) {
body: `
{
"links": {
"self": "/api/v2/scrapertargets"
"self": "/api/v2/scrapers"
},
"scraper_targets": []
}
@ -295,7 +295,7 @@ func TestService_handleGetScraperTarget(t *testing.T) {
"orgID": "0000000000000211",
"organization": "org1",
"links": {
"self": "/api/v2/scrapertargets/%[1]s"
"self": "/api/v2/scrapers/%[1]s"
}
}
`,
@ -518,7 +518,7 @@ func TestService_handlePostScraperTarget(t *testing.T) {
"bucket": "bucket1",
"bucketID": "0000000000000212",
"links": {
"self": "/api/v2/scrapertargets/%[1]s"
"self": "/api/v2/scrapers/%[1]s"
}
}
`,
@ -643,7 +643,7 @@ func TestService_handlePatchScraperTarget(t *testing.T) {
"bucket": "bucket1",
"bucketID":"0000000000000212",
"links":{
"self":"/api/v2/scrapertargets/%[1]s"
"self":"/api/v2/scrapers/%[1]s"
}
}`,
targetOneIDString,

View File

@ -597,7 +597,7 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Error"
/scrapertargets:
/scrapers:
get:
tags:
- ScraperTargets
@ -633,7 +633,7 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Error"
'/scrapertargets/{scraperTargetID}':
'/scrapers/{scraperTargetID}':
delete:
tags:
- ScraperTargets