Updating api documentation
[aaf/sms.git] / sms-service / doc / api_swagger.yaml
1 swagger: '2.0'
2 info:
3   description: This is a service that provides secret management facilities
4   version: 1.0.0
5   title: Secret Management Service
6   contact:
7     email: kiran.k.kamineni@intel.com
8   license:
9     name: Apache 2.0
10     url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
11 host: 'aaf.onap.org:10443'
12 basePath: /v1/sms/
13 tags:
14   - name: system
15     description: Operations related to quorum client which are not useful to clients
16   - name: login
17     description: Operations related to username password based authentication
18   - name: domain
19     description: Operations related to Secret Domains
20   - name: secret
21     description: Operations related to Secrets
22 schemes:
23   - https
24 paths:
25   /login:
26     post:
27       tags:
28         - login
29       summary: Login with username and password
30       description: Operations related to logging in via username and Password
31       consumes:
32         - application/json
33       produces:
34         - application/json
35       parameters:
36         - name: body
37           in: body
38           required: true
39           schema:
40             $ref: '#/definitions/Credential'
41       responses:
42         '200':
43           description: Successful Login returns a token
44           schema:
45             type: object
46             properties:
47               token:
48                 type: string
49               ttl:
50                 type: integer
51                 description: ttl of returned token in seconds
52         '404':
53           description: Invalid Username or Password
54   /status:
55     get:
56       tags:
57         - system
58       description: Gets current backend status. This API is used only by quorum clients
59       summary: Get backend status
60       produces:
61         - application/json
62       responses:
63         '200':
64           description: Successful operation
65           schema:
66             type: object
67             properties:
68               sealstatus:
69                 type: string
70                 description: seal status of backend
71         '404':
72           description: Invalid Path or Path not found
73   /unseal:
74     post:
75       tags:
76         - system
77       description: Sends unseal shard to unseal if backend is sealed
78       summary: Unseal backend
79       consumes:
80         - application/json
81       produces:
82         - application/json
83       parameters:
84         - in: body
85           name: body
86           required: true
87           schema:
88             type: object
89             properties:
90               unsealshard:
91                 type: string
92                 description: Unseal shard that will be used along with other shards to unseal backend
93       responses:
94         '201':
95           description: Submitted unseal key
96         '404':
97           description: Invalid Path or Path not found          
98   /domain:
99     post:
100       tags:
101         - domain
102       summary: Add a new domain
103       description: ''
104       consumes:
105         - application/json
106       produces:
107         - application/json
108       parameters:
109         - in: body
110           name: body
111           required: true
112           schema:
113             $ref: '#/definitions/Domain'
114       responses:
115         '201':
116           description: Successful Creation
117           schema:
118             $ref: '#/definitions/Domain'
119         '400':
120           description: Invalid input
121         '500':
122           description: Internal Server Error
123   '/domain/{domainName}':
124     delete:
125       tags:
126         - domain
127       description: Deletes a domain with provided name
128       summary: Deletes a domain by name
129       produces:
130         - application/json
131       parameters:
132         - name: domainName
133           in: path
134           description: Name of the domain
135           required: true
136           type: string
137       responses:
138         '204':
139           description: Successful Deletion
140         '404':
141           description: Invalid Path or Path not found
142   '/domain/{domainName}/secret':
143     post:
144       tags:
145         - secret
146       summary: Add a new secret
147       description: ''
148       consumes:
149         - application/json
150       produces:
151         - application/json
152       parameters:
153         - name: domainName
154           in: path
155           description: Name of the domain
156           required: true
157           type: string
158         - name: body
159           in: body
160           required: true
161           schema:
162             $ref: '#/definitions/Secret'
163       responses:
164         '201':
165           description: Successful Creation
166         '404':
167           description: Invalid Path or Path not found
168     get:
169       tags:
170         - secret
171       description: Gets all secret names in this domain
172       summary: List secret Names in this domain
173       produces:
174         - application/json
175       parameters:
176         - name: domainName
177           in: path
178           description: Name of the domain in which to look at
179           required: true
180           type: string
181       responses:
182         '200':
183           description: Successful operation
184           schema:
185             type: array
186             items:
187               type: string 
188             example: ['secret1', 'secret2', 'secret3']
189         '404':
190           description: Invalid Path or Path not found
191   '/domain/{domainName}/secret/{secretName}':
192     get:
193       tags:
194         - secret
195       summary: Find Secret by Name
196       description: Returns a single secret
197       produces:
198         - application/json
199       parameters:
200         - name: domainName
201           in: path
202           description: Name of the domain in which to look at
203           required: true
204           type: string
205         - name: secretName
206           in: path
207           description: Name of the secret which is needed
208           required: true
209           type: string
210       responses:
211         '200':
212           description: successful operation
213           schema:
214             $ref: '#/definitions/Secret'
215         '404':
216           description: Invalid Path or Path not found
217     delete:
218       tags:
219         - secret
220       summary: Deletes a Secret
221       description: ''
222       produces:
223         - application/json
224       parameters:
225         - name: secretName
226           in: path
227           description: Name of Secret to Delete
228           required: true
229           type: string
230         - name: domainName
231           in: path
232           required: true
233           description: Path to the SecretDomain which contains the Secret
234           type: string
235       responses:
236         '204':
237           description: Successful Deletion
238         '404':
239           description: Invalid Path or Path not found
240 securityDefinitions:
241   token:
242     type: "apiKey"
243     name: "token"
244     in: "header"
245 definitions:
246   Credential:
247     type: object
248     properties:
249       username:
250         type: string
251       password:
252         type: string
253   Domain:
254     type: object
255     properties:
256       uuid:
257         type: string
258         description: >-
259           Optional value provided by user. If user does not provide, server will
260           auto generate
261       name:
262         type: string
263         description: Name of the secret domain under which all secrets will be stored
264   Secret:
265     type: object
266     properties:
267       name:
268         type: string
269         description: Name of the secret
270       values:
271         description: Map of key value pairs that constitute the secret
272         type: object
273         additionalProperties:
274           type: object
275         example:
276           "name": "john"
277           "Age": 40
278           "admin": true
279 externalDocs:
280   description: Find out more about Swagger
281   url: 'http://swagger.io'