Skip to content

Commit d4ffc77

Browse files
committed
docs: /docs -> /openapi.json
1 parent f0fd79c commit d4ffc77

File tree

5 files changed

+44
-44
lines changed

5 files changed

+44
-44
lines changed

cmd/cloud-init-server/handlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func parseData(r *http.Request) (cistore.GroupData, error) {
5353
// @Produce json
5454
// @Success 200 {object} string
5555
// @Failure 500 {object} nil
56-
// @Router /cloud-init/docs [get]
56+
// @Router /cloud-init/openapi.json [get]
5757
func DocsHandler(w http.ResponseWriter, r *http.Request) {
5858
doc, err := swag.ReadDoc()
5959
if err != nil {

cmd/cloud-init-server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func main() {
193193

194194
func initCiClientRouter(router chi.Router, handler *CiHandler, wgInterfaceManager *wgtunnel.InterfaceManager) {
195195
// Add cloud-init endpoints to router
196-
router.Get("/docs", DocsHandler)
196+
router.Get("/openapi.json", DocsHandler)
197197
router.With(wireGuardMiddleware).Get("/user-data", UserDataHandler)
198198
router.With(wireGuardMiddleware).Get("/meta-data", MetaDataHandler(handler.sm, handler.store))
199199
router.With(wireGuardMiddleware).Get("/vendor-data", VendorDataHandler(handler.sm, handler.store))

docs/docs.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -383,45 +383,45 @@ const docTemplate = `{
383383
}
384384
}
385385
},
386-
"/cloud-init/docs": {
386+
"/cloud-init/meta-data": {
387387
"get": {
388+
"description": "Get meta-data for requesting node based on the requesting IP.\n\nIf the impersonation API is enabled, an ID can be provided in\nthe URL path using ` + "`" + `/admin/impersonation` + "`" + `. In this case, the\nmeta-data will be retrieved for the requested ID.",
388389
"produces": [
389-
"application/json"
390+
"application/x-yaml"
390391
],
391-
"summary": "Return JSON-formatted OpenAPI documentation",
392+
"summary": "Get meta-data for requesting node",
392393
"responses": {
393394
"200": {
394395
"description": "OK",
395396
"schema": {
396-
"type": "string"
397+
"$ref": "#/definitions/main.MetaData"
397398
}
398399
},
400+
"404": {
401+
"description": "Not Found"
402+
},
403+
"422": {
404+
"description": "Unprocessable Entity"
405+
},
399406
"500": {
400407
"description": "Internal Server Error"
401408
}
402409
}
403410
}
404411
},
405-
"/cloud-init/meta-data": {
412+
"/cloud-init/openapi.json": {
406413
"get": {
407-
"description": "Get meta-data for requesting node based on the requesting IP.\n\nIf the impersonation API is enabled, an ID can be provided in\nthe URL path using ` + "`" + `/admin/impersonation` + "`" + `. In this case, the\nmeta-data will be retrieved for the requested ID.",
408414
"produces": [
409-
"application/x-yaml"
415+
"application/json"
410416
],
411-
"summary": "Get meta-data for requesting node",
417+
"summary": "Return JSON-formatted OpenAPI documentation",
412418
"responses": {
413419
"200": {
414420
"description": "OK",
415421
"schema": {
416-
"$ref": "#/definitions/main.MetaData"
422+
"type": "string"
417423
}
418424
},
419-
"404": {
420-
"description": "Not Found"
421-
},
422-
"422": {
423-
"description": "Unprocessable Entity"
424-
},
425425
"500": {
426426
"description": "Internal Server Error"
427427
}

docs/swagger.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -375,45 +375,45 @@
375375
}
376376
}
377377
},
378-
"/cloud-init/docs": {
378+
"/cloud-init/meta-data": {
379379
"get": {
380+
"description": "Get meta-data for requesting node based on the requesting IP.\n\nIf the impersonation API is enabled, an ID can be provided in\nthe URL path using `/admin/impersonation`. In this case, the\nmeta-data will be retrieved for the requested ID.",
380381
"produces": [
381-
"application/json"
382+
"application/x-yaml"
382383
],
383-
"summary": "Return JSON-formatted OpenAPI documentation",
384+
"summary": "Get meta-data for requesting node",
384385
"responses": {
385386
"200": {
386387
"description": "OK",
387388
"schema": {
388-
"type": "string"
389+
"$ref": "#/definitions/main.MetaData"
389390
}
390391
},
392+
"404": {
393+
"description": "Not Found"
394+
},
395+
"422": {
396+
"description": "Unprocessable Entity"
397+
},
391398
"500": {
392399
"description": "Internal Server Error"
393400
}
394401
}
395402
}
396403
},
397-
"/cloud-init/meta-data": {
404+
"/cloud-init/openapi.json": {
398405
"get": {
399-
"description": "Get meta-data for requesting node based on the requesting IP.\n\nIf the impersonation API is enabled, an ID can be provided in\nthe URL path using `/admin/impersonation`. In this case, the\nmeta-data will be retrieved for the requested ID.",
400406
"produces": [
401-
"application/x-yaml"
407+
"application/json"
402408
],
403-
"summary": "Get meta-data for requesting node",
409+
"summary": "Return JSON-formatted OpenAPI documentation",
404410
"responses": {
405411
"200": {
406412
"description": "OK",
407413
"schema": {
408-
"$ref": "#/definitions/main.MetaData"
414+
"type": "string"
409415
}
410416
},
411-
"404": {
412-
"description": "Not Found"
413-
},
414-
"422": {
415-
"description": "Unprocessable Entity"
416-
},
417417
"500": {
418418
"description": "Internal Server Error"
419419
}

docs/swagger.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -480,18 +480,6 @@ paths:
480480
tags:
481481
- admin
482482
- instance-data
483-
/cloud-init/docs:
484-
get:
485-
produces:
486-
- application/json
487-
responses:
488-
"200":
489-
description: OK
490-
schema:
491-
type: string
492-
"500":
493-
description: Internal Server Error
494-
summary: Return JSON-formatted OpenAPI documentation
495483
/cloud-init/meta-data:
496484
get:
497485
description: |-
@@ -514,6 +502,18 @@ paths:
514502
"500":
515503
description: Internal Server Error
516504
summary: Get meta-data for requesting node
505+
/cloud-init/openapi.json:
506+
get:
507+
produces:
508+
- application/json
509+
responses:
510+
"200":
511+
description: OK
512+
schema:
513+
type: string
514+
"500":
515+
description: Internal Server Error
516+
summary: Return JSON-formatted OpenAPI documentation
517517
/cloud-init/phone-home/{id}:
518518
post:
519519
description: |-

0 commit comments

Comments
 (0)