X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dmaap-mediator-producer%2Fapi%2Fdocs.go;fp=dmaap-mediator-producer%2Fapi%2Fdocs.go;h=dbfc42be9c3d95f019a49014d60254d0429920ff;hb=2a6b1317357b5387f98e846c3b0387384cbadf4b;hp=0000000000000000000000000000000000000000;hpb=8170f78af913d337f874477ba5dd93411e9e69da;p=nonrtric.git diff --git a/dmaap-mediator-producer/api/docs.go b/dmaap-mediator-producer/api/docs.go new file mode 100644 index 00000000..dbfc42be --- /dev/null +++ b/dmaap-mediator-producer/api/docs.go @@ -0,0 +1,303 @@ +// Package api GENERATED BY THE COMMAND ABOVE; DO NOT EDIT +// This file was generated by swaggo/swag +package api + +import ( + "bytes" + "encoding/json" + "strings" + "text/template" + + "github.com/swaggo/swag" +) + +var doc = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "contact": {}, + "license": { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/admin/log": { + "put": { + "description": "Set the log level of the producer.", + "tags": [ + "Admin" + ], + "summary": "Set log level", + "parameters": [ + { + "enum": [ + "Error", + "Warn", + "Info", + "Debug" + ], + "type": "string", + "description": "string enums", + "name": "level", + "in": "query" + } + ], + "responses": { + "200": { + "description": "" + }, + "400": { + "description": "Problem as defined in https://tools.ietf.org/html/rfc7807", + "schema": { + "$ref": "#/definitions/ErrorInfo" + }, + "headers": { + "Content-Type": { + "type": "string", + "description": "application/problem+json" + } + } + } + } + } + }, + "/health_check": { + "get": { + "description": "Get the status of the producer. Will show if the producer has registered in ICS.", + "produces": [ + "application/json" + ], + "tags": [ + "Data producer (callbacks)" + ], + "summary": "Get status", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/" + } + } + } + } + }, + "/info_job": { + "post": { + "description": "Callback for ICS to add an info job", + "consumes": [ + "application/json" + ], + "tags": [ + "Data producer (callbacks)" + ], + "summary": "Add info job", + "parameters": [ + { + "description": "Info job data", + "name": "user", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/JobInfo" + } + } + ], + "responses": { + "200": { + "description": "" + }, + "400": { + "description": "Problem as defined in https://tools.ietf.org/html/rfc7807", + "schema": { + "$ref": "#/definitions/ErrorInfo" + }, + "headers": { + "Content-Type": { + "type": "string", + "description": "application/problem+json" + } + } + } + } + } + }, + "/info_job/{infoJobId}": { + "delete": { + "description": "Callback for ICS to delete an info job", + "tags": [ + "Data producer (callbacks)" + ], + "summary": "Delete info job", + "parameters": [ + { + "type": "string", + "description": "Info job ID", + "name": "infoJobId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "" + } + } + } + }, + "/swagger": { + "get": { + "description": "Get the Swagger API documentation for the producer.", + "tags": [ + "Admin" + ], + "summary": "Get Swagger Documentation", + "responses": { + "200": { + "description": "" + } + } + } + } + }, + "definitions": { + "": { + "type": "object", + "properties": { + "registeredStatus": { + "description": "The registration status of the producer in Information Coordinator Service. Either ` + "`" + `registered` + "`" + ` or ` + "`" + `not registered` + "`" + `", + "type": "string", + "example": "registered" + } + } + }, + "BufferTimeout": { + "type": "object", + "properties": { + "maxSize": { + "type": "integer" + }, + "maxTimeMiliseconds": { + "type": "integer" + } + } + }, + "ErrorInfo": { + "type": "object", + "properties": { + "detail": { + "description": "A human-readable explanation specific to this occurrence of the problem.", + "type": "string", + "example": "Info job type not found" + }, + "instance": { + "description": "A URI reference that identifies the specific occurrence of the problem.", + "type": "string" + }, + "status": { + "description": "The HTTP status code generated by the origin server for this occurrence of the problem.", + "type": "integer", + "example": 400 + }, + "title": { + "description": "A short, human-readable summary of the problem type.", + "type": "string" + }, + "type": { + "description": "A URI reference that identifies the problem type.", + "type": "string" + } + } + }, + "JobInfo": { + "type": "object", + "properties": { + "info_job_data": { + "$ref": "#/definitions/Parameters" + }, + "info_job_identity": { + "type": "string" + }, + "info_type_identity": { + "type": "string" + }, + "last_updated": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "target_uri": { + "type": "string" + } + } + }, + "Parameters": { + "type": "object", + "properties": { + "bufferTimeout": { + "$ref": "#/definitions/BufferTimeout" + } + } + } + } +}` + +type swaggerInfo struct { + Version string + Host string + BasePath string + Schemes []string + Title string + Description string +} + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = swaggerInfo{ + Version: "1.1.0", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "DMaaP Mediator Producer", + Description: "", +} + +type s struct{} + +func (s *s) ReadDoc() string { + sInfo := SwaggerInfo + sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) + + t, err := template.New("swagger_info").Funcs(template.FuncMap{ + "marshal": func(v interface{}) string { + a, _ := json.Marshal(v) + return string(a) + }, + "escape": func(v interface{}) string { + // escape tabs + str := strings.Replace(v.(string), "\t", "\\t", -1) + // replace " with \", and if that results in \\", replace that with \\\" + str = strings.Replace(str, "\"", "\\\"", -1) + return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1) + }, + }).Parse(doc) + if err != nil { + return doc + } + + var tpl bytes.Buffer + if err := t.Execute(&tpl, sInfo); err != nil { + return doc + } + + return tpl.String() +} + +func init() { + swag.Register("swagger", &s{}) +}