Skip to content

Commit daaf522

Browse files
committed
[docs] add API docs
1 parent 636a33d commit daaf522

File tree

5 files changed

+559
-6
lines changed

5 files changed

+559
-6
lines changed

api/docs.go

Lines changed: 199 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,205 @@ const docTemplate = `{
2121
},
2222
"host": "{{.Host}}",
2323
"basePath": "{{.BasePath}}",
24-
"paths": {}
24+
"paths": {
25+
"/csr": {
26+
"post": {
27+
"consumes": [
28+
"application/json"
29+
],
30+
"produces": [
31+
"application/json"
32+
],
33+
"tags": [
34+
"CSR"
35+
],
36+
"summary": "Submit CSR",
37+
"parameters": [
38+
{
39+
"description": "Request",
40+
"name": "request",
41+
"in": "body",
42+
"required": true,
43+
"schema": {
44+
"$ref": "#/definitions/ca.PostCSRRequest"
45+
}
46+
}
47+
],
48+
"responses": {
49+
"200": {
50+
"description": "OK",
51+
"schema": {
52+
"$ref": "#/definitions/ca.PostCSRResponse"
53+
}
54+
},
55+
"400": {
56+
"description": "Bad Request",
57+
"schema": {
58+
"$ref": "#/definitions/http.JSONErrorResponse"
59+
}
60+
},
61+
"500": {
62+
"description": "Internal Server Error",
63+
"schema": {
64+
"$ref": "#/definitions/http.JSONErrorResponse"
65+
}
66+
}
67+
}
68+
}
69+
},
70+
"/csr/{id}": {
71+
"get": {
72+
"consumes": [
73+
"application/json"
74+
],
75+
"produces": [
76+
"application/json"
77+
],
78+
"tags": [
79+
"CSR"
80+
],
81+
"summary": "Get CSR Status",
82+
"parameters": [
83+
{
84+
"type": "string",
85+
"description": "Request ID",
86+
"name": "id",
87+
"in": "path",
88+
"required": true
89+
}
90+
],
91+
"responses": {
92+
"200": {
93+
"description": "OK",
94+
"schema": {
95+
"$ref": "#/definitions/ca.GetCSRStatusResponse"
96+
}
97+
},
98+
"400": {
99+
"description": "Bad Request",
100+
"schema": {
101+
"$ref": "#/definitions/http.JSONErrorResponse"
102+
}
103+
},
104+
"404": {
105+
"description": "Not Found",
106+
"schema": {
107+
"$ref": "#/definitions/http.JSONErrorResponse"
108+
}
109+
},
110+
"500": {
111+
"description": "Internal Server Error",
112+
"schema": {
113+
"$ref": "#/definitions/http.JSONErrorResponse"
114+
}
115+
}
116+
}
117+
}
118+
}
119+
},
120+
"definitions": {
121+
"ca.CSRStatus": {
122+
"type": "string",
123+
"enum": [
124+
"pending",
125+
"approved",
126+
"denied"
127+
],
128+
"x-enum-varnames": [
129+
"CSRStatusPending",
130+
"CSRStatusApproved",
131+
"CSRStatusDenied"
132+
]
133+
},
134+
"ca.GetCSRStatusResponse": {
135+
"type": "object",
136+
"properties": {
137+
"certificate": {
138+
"description": "Certificate is the certificate issued by the CA. This field is only present\nif the status is ` + "`" + `approved` + "`" + `.",
139+
"type": "string"
140+
},
141+
"message": {
142+
"description": "Message is a human-readable description of the status.",
143+
"type": "string"
144+
},
145+
"request_id": {
146+
"description": "RequestID is the ID of the request. Can be used to request status.",
147+
"type": "string"
148+
},
149+
"status": {
150+
"description": "Status is the status of the requested certificate.",
151+
"allOf": [
152+
{
153+
"$ref": "#/definitions/ca.CSRStatus"
154+
}
155+
]
156+
}
157+
}
158+
},
159+
"ca.PostCSRRequest": {
160+
"type": "object",
161+
"required": [
162+
"content"
163+
],
164+
"properties": {
165+
"content": {
166+
"description": "Content contains the CSR content and is required.",
167+
"type": "string",
168+
"maxLength": 16384
169+
},
170+
"metadata": {
171+
"description": "Metadata includes additional metadata related to the CSR.",
172+
"type": "object",
173+
"additionalProperties": {
174+
"type": "string"
175+
}
176+
}
177+
}
178+
},
179+
"ca.PostCSRResponse": {
180+
"type": "object",
181+
"properties": {
182+
"certificate": {
183+
"description": "Certificate is the certificate issued by the CA. This field is only present\nif the status is ` + "`" + `approved` + "`" + `.",
184+
"type": "string"
185+
},
186+
"message": {
187+
"description": "Message is a human-readable description of the status.",
188+
"type": "string"
189+
},
190+
"request_id": {
191+
"description": "RequestID is the ID of the request. Can be used to request status.",
192+
"type": "string"
193+
},
194+
"status": {
195+
"description": "Status is the status of the requested certificate.",
196+
"allOf": [
197+
{
198+
"$ref": "#/definitions/ca.CSRStatus"
199+
}
200+
]
201+
}
202+
}
203+
},
204+
"http.JSONErrorResponse": {
205+
"type": "object",
206+
"properties": {
207+
"error": {
208+
"type": "object",
209+
"properties": {
210+
"code": {
211+
"description": "Code",
212+
"type": "integer"
213+
},
214+
"message": {
215+
"description": "Message",
216+
"type": "string"
217+
}
218+
}
219+
}
220+
}
221+
}
222+
}
25223
}`
26224

27225
// SwaggerInfo holds exported Swagger Info so clients can modify it

0 commit comments

Comments
 (0)