Skip to content

Commit

Permalink
generate
Browse files Browse the repository at this point in the history
  • Loading branch information
frantjc committed Oct 25, 2022
1 parent d9d3471 commit 81d5c18
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 40 deletions.
24 changes: 17 additions & 7 deletions pkg/docs/proxy/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ var doc = `{
}
}
},
"/api/v1/apikey": {
"/api/v1/api-key": {
"post": {
"description": "\u003cb\u003e\u003cu\u003eCreate an API key\u003c/u\u003e\u003c/b\u003e",
"consumes": [
Expand All @@ -164,7 +164,7 @@ var doc = `{
"application/json"
],
"tags": [
"API-key"
"API-Key"
],
"summary": "Create an API key",
"parameters": [
Expand All @@ -174,7 +174,7 @@ var doc = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.Claims"
"$ref": "#/definitions/rototiller.Claims"
}
}
],
Expand Down Expand Up @@ -1489,6 +1489,11 @@ var doc = `{
},
"/api/v1/tasks": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
Expand Down Expand Up @@ -1523,6 +1528,11 @@ var doc = `{
},
"/api/v1/tasks/{type}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
Expand Down Expand Up @@ -1575,18 +1585,18 @@ var doc = `{
}
},
"definitions": {
"api.Claims": {
"rototiller.Auth": {
"type": "object",
"properties": {
"email": {
"api_key": {
"type": "string"
}
}
},
"rototiller.Auth": {
"rototiller.Claims": {
"type": "object",
"properties": {
"api_key": {
"email": {
"type": "string"
}
}
Expand Down
24 changes: 17 additions & 7 deletions pkg/docs/proxy/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
}
}
},
"/api/v1/apikey": {
"/api/v1/api-key": {
"post": {
"description": "\u003cb\u003e\u003cu\u003eCreate an API key\u003c/u\u003e\u003c/b\u003e",
"consumes": [
Expand All @@ -152,7 +152,7 @@
"application/json"
],
"tags": [
"API-key"
"API-Key"
],
"summary": "Create an API key",
"parameters": [
Expand All @@ -162,7 +162,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.Claims"
"$ref": "#/definitions/rototiller.Claims"
}
}
],
Expand Down Expand Up @@ -1477,6 +1477,11 @@
},
"/api/v1/tasks": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
Expand Down Expand Up @@ -1511,6 +1516,11 @@
},
"/api/v1/tasks/{type}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
Expand Down Expand Up @@ -1563,18 +1573,18 @@
}
},
"definitions": {
"api.Claims": {
"rototiller.Auth": {
"type": "object",
"properties": {
"email": {
"api_key": {
"type": "string"
}
}
},
"rototiller.Auth": {
"rototiller.Claims": {
"type": "object",
"properties": {
"api_key": {
"email": {
"type": "string"
}
}
Expand Down
18 changes: 11 additions & 7 deletions pkg/docs/proxy/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
definitions:
api.Claims:
rototiller.Auth:
properties:
email:
api_key:
type: string
type: object
rototiller.Auth:
rototiller.Claims:
properties:
api_key:
email:
type: string
type: object
rototiller.Error:
Expand Down Expand Up @@ -152,7 +152,7 @@ paths:
summary: RPC Get a storage's content
tags:
- Content
/api/v1/apikey:
/api/v1/api-key:
post:
consumes:
- application/json
Expand All @@ -163,7 +163,7 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/api.Claims'
$ref: '#/definitions/rototiller.Claims'
produces:
- application/json
responses:
Expand All @@ -181,7 +181,7 @@ paths:
$ref: '#/definitions/rototiller.Error'
summary: Create an API key
tags:
- API-key
- API-Key
/api/v1/jobs:
get:
description: Get a list of jobs based on owner ID
Expand Down Expand Up @@ -1084,6 +1084,8 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/rototiller.Error'
security:
- ApiKeyAuth: []
summary: Get a list of task types
tags:
- Task
Expand Down Expand Up @@ -1118,6 +1120,8 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/rototiller.Error'
security:
- ApiKeyAuth: []
summary: Get a task type
tags:
- Task
Expand Down
10 changes: 10 additions & 0 deletions pkg/docs/rototiller/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,11 @@ var doc = `{
},
"/api/v1/tasks": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
Expand Down Expand Up @@ -1477,6 +1482,11 @@ var doc = `{
},
"/api/v1/tasks/{type}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
Expand Down
10 changes: 10 additions & 0 deletions pkg/docs/rototiller/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,11 @@
},
"/api/v1/tasks": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
Expand Down Expand Up @@ -1465,6 +1470,11 @@
},
"/api/v1/tasks/{type}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"produces": [
"application/json"
],
Expand Down
4 changes: 4 additions & 0 deletions pkg/docs/rototiller/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,8 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/rototiller.Error'
security:
- ApiKeyAuth: []
summary: Get a list of task types
tags:
- Task
Expand Down Expand Up @@ -1078,6 +1080,8 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/rototiller.Error'
security:
- ApiKeyAuth: []
summary: Get a task type
tags:
- Task
Expand Down
38 changes: 19 additions & 19 deletions pkg/service/task_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
"github.com/logsquaredn/rototiller/pkg/api"
)

// @Security ApiKeyAuth
// @Summary Get a list of task types
// @Tags Task
// @Produce application/json
// @Success 200 {object} []rototiller.Task
// @Failure 401 {object} rototiller.Error
// @Failure 500 {object} rototiller.Error
// @Router /api/v1/tasks [get].
// @Security ApiKeyAuth
// @Summary Get a list of task types
// @Tags Task
// @Produce application/json
// @Success 200 {object} []rototiller.Task
// @Failure 401 {object} rototiller.Error
// @Failure 500 {object} rototiller.Error
// @Router /api/v1/tasks [get].
func (a *Handler) listTasksHandler(ctx *gin.Context) {
tasks, err := a.Datastore.GetTasks(
api.AllTaskTypes...,
Expand All @@ -35,17 +35,17 @@ func (a *Handler) listTasksHandler(ctx *gin.Context) {
ctx.JSON(http.StatusOK, tasks)
}

// @Security ApiKeyAuth
// @Summary Get a task type
// @Tags Task
// @Produce application/json
// @Param type path string true "Task type"
// @Success 200 {object} rototiller.Task
// @Failure 400 {object} rototiller.Error
// @Failure 401 {object} rototiller.Error
// @Failure 404 {object} rototiller.Error
// @Failure 500 {object} rototiller.Error
// @Router /api/v1/tasks/{type} [get].
// @Security ApiKeyAuth
// @Summary Get a task type
// @Tags Task
// @Produce application/json
// @Param type path string true "Task type"
// @Success 200 {object} rototiller.Task
// @Failure 400 {object} rototiller.Error
// @Failure 401 {object} rototiller.Error
// @Failure 404 {object} rototiller.Error
// @Failure 500 {object} rototiller.Error
// @Router /api/v1/tasks/{type} [get].
func (a *Handler) getTaskHandler(ctx *gin.Context) {
task, err := a.getTask(ctx.Param("task"))
if err != nil {
Expand Down

0 comments on commit 81d5c18

Please sign in to comment.