Fix sonar issues in crud/logging/LoggingUtil
[aai/gizmo.git] / VERTEX.md
1 ## Vertex APIs
2
3 ### Create Vertex
4
5 Vertex payload data is validated against oxm.
6 * Mandatory attributes are required in payload
7 * Data type validation is enforced
8 * Defaults from oxm schema used when not specified in payload
9
10         URL: https://<host>:9520/services/inventory/v11/pserver/
11         Method: POST
12         Body:
13                 {   
14                         "properties":{   
15                                 "ptnii-equip-name":"e-name",
16                                 "equip-type":"server",
17                                 "hostname":"myhost",
18                                 "equip-vendor":"HP",
19                                 "equip-model":"DL380p-nd",
20                                 "fqdn":myhost.onap.net",
21                                 "purpose":"my-purpose",
22                                 "resource-version":"1477013499",
23                                 "ipv4-oam-address":"1.2.3.4"
24                         }
25                 }
26         Success Response:
27                 Code: 201
28                 Content:
29                         {   
30                                 "id":"1130672",
31                                 "type":"pserver",
32                                 "url":"services/inventory/v11/pserver/1130672",
33                                 "properties":{   
34                                         "ptnii-equip-name":"e-name",
35                                         "equip-type":"server",
36                                         "hostname":"myhost",
37                                         "equip-vendor":"HP",
38                                         "equip-model":"DL380p-nd",
39                                         "fqdn":myhost.onap.net",
40                                         "purpose":"my-purpose",
41                                         "resource-version":"1477013499",
42                                         "ipv4-oam-address":"1.2.3.4"
43                                 }
44                         }       
45         Error Response:
46                 Code: 400 (BAD REQUEST)
47                 Content: Error message describing the bad request failure.
48                 Situation: Invalid Payload or schema error.
49
50                 Code: 403 (FORBIDDEN)
51                 Content: Error message describing the Authorization failure.
52                 Situation: Authorization failure.
53
54                 Code: 415 (UNSUPPORTED MEDIA TYPE)
55                 Situation: Unsupported content type .
56                 
57                 Code: 500 (Internal Server Error)
58                 Content: Error message describing the failure.
59                 Situation: Any scenario not covered by the above error codes.
60
61 Optionally, a vertex can be created by posting to an endpoint which doesn't include the vertex type.
62
63         URL: https://<host>:9520/services/inventory/v11/
64         Method: POST
65         Body:
66                 {   
67                         "type":"pserver",
68                         "properties":{   
69                                 "ptnii-equip-name":"e-name",
70                                 "equip-type":"server",
71                                 "hostname":"myhost",
72                                 "equip-vendor":"HP",
73                                 "equip-model":"DL380p-nd",
74                                 "fqdn":myhost.onap.net",
75                                 "purpose":"my-purpose",
76                                 "resource-version":"1477013499",
77                                 "ipv4-oam-address":"1.2.3.4"
78                         }
79                 }
80         Success Response:
81                 Code: 201
82                 Content:
83                         {   
84                                 "id":"1130672",
85                                 "type":"pserver",
86                                 "url":"services/inventory/v11/pserver/1130672",
87                                 "properties":{   
88                                         "ptnii-equip-name":"e-name",
89                                         "equip-type":"server",
90                                         "hostname":"myhost",
91                                         "equip-vendor":"HP",
92                                         "equip-model":"DL380p-nd",
93                                         "fqdn":myhost.onap.net",
94                                         "purpose":"my-purpose",
95                                         "resource-version":"1477013499",
96                                         "ipv4-oam-address":"1.2.3.4"
97                                 }
98                         }       
99         Error Response:
100                 Code: 400 (BAD REQUEST)
101                 Content: Error message describing the bad request failure.
102                 Situation: Invalid Payload or schema error.
103
104                 Code: 403 (FORBIDDEN)
105                 Content: Error message describing the Authorization failure.
106                 Situation: Authorization failure.
107
108                 Code: 415 (UNSUPPORTED MEDIA TYPE)
109                 Situation: Unsupported content type .
110                 
111                 Code: 500 (Internal Server Error)
112                 Content: Error message describing the failure.
113                 Situation: Any scenario not covered by the above error codes.
114  
115 ### Get Vertex
116
117         URL: https://<host>:9520/services/inventory/v11/pserver/<id>
118         Method: GET
119         Success Response:
120                 Code: 200
121                 Content:
122                         {   
123                                 "id":"1130672",
124                                 "type":"pserver",
125                                 "url":"services/inventory/v11/pserver/<id>",
126                                 "properties":{   
127                                         "ptnii-equip-name":"e-name",
128                                         "equip-type":"server",
129                                         "hostname":"myhost",
130                                         "equip-vendor":"HP",
131                                         "equip-model":"DL380p-nd",
132                                         "fqdn":myhost.onap.net",
133                                         "purpose":"my-purpose",
134                                         "resource-version":"1477013499",
135                                         "ipv4-oam-address":"1.2.3.4"
136                                 },
137                                 "in":[   
138                                 ],
139                                 "out":[   
140                                         {   
141                                                 "id":"1crwnu-6hc-d6vp-oe08g",
142                                                 "type":"has",
143                                                 "target":"services/inventory/v11/vserver/40964272",
144                                                 "url":"services/inventory/relationships/v11/has/1crwnu-6hc-d6vp-oe08g"
145                                         }
146                                 ]
147                         }       
148         Error Response:
149                 Code: 404 (NOT FOUND)
150                 Situation: Resource Not found
151
152                 Code: 403 (FORBIDDEN)
153                 Content: Error message describing the Authorization failure.
154                 Situation: Authorization failure.
155
156                 Code: 415 (UNSUPPORTED MEDIA TYPE)
157                 Situation: Unsupported content type .
158                 
159                 Code: 500 (Internal Server Error)
160                 Content: Error message describing the failure.
161                 Situation: Any scenario not covered by the above error codes.
162
163 ### Get Vertices
164
165         URL: https://<host>:9520/services/inventory/v11/pserver/
166         Optional Query Param: ?equip-vendor=HP
167         Method: GET
168         Success Response:
169                 Code: 200
170                 Content:
171                         [   
172                                 {   
173                                         "id":"950296",
174                                         "type":"pserver",
175                                         "url":"services/inventory/v11/pserver/950296"
176                                 },
177                                 {   
178                                         "id":"1126576",
179                                         "type":"pserver",
180                                         "url":"services/inventory/v11/pserver/1126576"
181                                 },
182                                 {   
183                                         "id":"1032384",
184                                         "type":"pserver",
185                                         "url":"services/inventory/v11/pserver/1032384"
186                                 }
187                         ]       
188         Error Response:
189                 Code: 404 (NOT FOUND)
190                 Situation: Resource Not found
191
192                 Code: 403 (FORBIDDEN)
193                 Content: Error message describing the Authorization failure.
194                 Situation: Authorization failure.
195
196                 Code: 415 (UNSUPPORTED MEDIA TYPE)
197                 Situation: Unsupported content type .
198                 
199                 Code: 500 (Internal Server Error)
200                 Content: Error message describing the failure.
201                 Situation: Any scenario not covered by the above error codes.   
202                 
203 ### Get Vertices with Properties
204 Note: Adding query param of properties=all will return all properties
205
206         URL: https://<host>:9520/services/inventory/v11/pserver/
207         Optional Query Param: ?equip-vendor=HP
208         Optional Query Param: ?properties=hostname&properties=equip-vendor
209         Method: GET
210         Success Response:
211                 Code: 200
212                 Content:
213                         [
214                 {
215                     "idfdsa": "1263346e-372b-4681-8ce4-d40411620487",
216                     "type": "pserver",
217                     "url": "services/inventory/v11/pserver/1263346e-372b-4681-8ce4-d40411620487",
218                     "properties": {
219                         "equip-vendor": "HP",
220                         "hostname": "mtanjasdf119snd"
221                     }
222                 },
223                 {
224                     "idfdsa": "b57a9e54-bbb5-4e11-b537-aaa7bc8fd726",
225                     "type": "pserver",
226                     "url": "services/inventory/v11/pserver/b57a9e54-bbb5-4e11-b537-aaa7bc8fd726",
227                     "properties": {
228                         "equip-vendor": "HP",
229                         "hostname": "mtanjasdf119snd"
230                     }
231                 }
232             ]
233         Error Response:
234                 Code: 404 (NOT FOUND)
235                 Situation: Resource Not found
236
237                 Code: 403 (FORBIDDEN)
238                 Content: Error message describing the Authorization failure.
239                 Situation: Authorization failure.
240
241                 Code: 415 (UNSUPPORTED MEDIA TYPE)
242                 Situation: Unsupported content type .
243                 
244                 Code: 500 (Internal Server Error)
245                 Content: Error message describing the failure.
246                 Situation: Any scenario not covered by the above error codes.   
247
248 ### Update Vertex
249
250 The PUT command is used to modify an existing vertex.  By default, the vertex data is replaced by the content of the payload.  However, teh following parameter can be added to the header to perform a PATCH instead of a replace:
251 **X-HTTP-Method-Override=Patch**
252
253         URL: https://<host>:9520/services/inventory/v11/pserver/<id>
254         Method: PUT
255         Body: Same as POST      
256         Success Response:
257                 Code: 201
258                 Content: Same as POST   
259         Error Response:
260                 Code: 400 (BAD REQUEST)
261                 Content: Error message describing the bad request failure.
262                 Situation: Invalid Payload or schema error.
263
264                 Code: 403 (FORBIDDEN)
265                 Content: Error message describing the Authorization failure.
266                 Situation: Authorization failure.
267
268                 Code: 415 (UNSUPPORTED MEDIA TYPE)
269                 Situation: Unsupported content type .
270                 
271                 Code: 500 (Internal Server Error)
272                 Content: Error message describing the failure.
273                 Situation: Any scenario not covered by the above error codes.
274
275 ### Patch Vertex
276
277         URL: https://<host>:9520/services/inventory/v11/pserver/<id>
278         Method: PATCH (Content-Type header set to application/merge-patch+json)
279         Body:
280                 {   
281                         "properties":{   
282                                 "ptnii-equip-name":"e-name",
283                                 "resource-version":"1477013499",
284                                 "ipv4-oam-address":"1.2.3.99"
285                         }
286                 }
287         Success Response:
288                 Code: 200
289                 Content: Same as POST           
290         Error Response:
291                 Code: 400 (BAD REQUEST)
292                 Content: Error message describing the bad request failure.
293                 Situation: Invalid Payload or schema error.
294
295                 Code: 403 (FORBIDDEN)
296                 Content: Error message describing the Authorization failure.
297                 Situation: Authorization failure.
298
299                 Code: 415 (UNSUPPORTED MEDIA TYPE)
300                 Situation: Unsupported content type .
301                 
302                 Code: 500 (Internal Server Error)
303                 Content: Error message describing the failure.
304                 Situation: Any scenario not covered by the above error codes.
305  
306  ### Delete Vertex
307
308         URL: https://<host>:9520/services/inventory/v11/pserver/<id>
309         Method: DELETE
310         Success Response:
311                 Code: 200               
312         Error Response:
313                 Code: 404 (NOT FOUND)
314                 Situation: Resource not found
315
316                 Code: 403 (FORBIDDEN)
317                 Content: Error message describing the Authorization failure.
318                 Situation: Authorization failure.
319
320                 Code: 415 (UNSUPPORTED MEDIA TYPE)
321                 Situation: Unsupported content type .
322                 
323                 Code: 500 (Internal Server Error)
324                 Content: Error message describing the failure.
325                 Situation: Any scenario not covered by the above error codes.