2789825e0ab153ef2a008c47ff9d59e5e2946cae
[ccsdk/cds.git] / docs / api-reference / bp-processor.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2 .. International License. http://creativecommons.org/licenses/by/4.0
3 .. Copyright (C) 2020 Deutsche Telekom AG.
4
5 Blueprint Processor API Reference
6 ==================================
7
8 Introduction
9 --------------
10
11 This section shows all resources and endpoints which CDS BP processor currently provides with sample requests/responses,
12 parameter description and other information. If there is a new API and you want do document it, you can use this template
13 :download:`rst <api-doc-template.rst>`.
14
15 Authentification
16 -----------------
17
18 Use Basic athentification with `ccsdkapps` as a username and password, in Header ``Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==``.
19
20 Download
21 ------------
22
23 You can find a postman collection including sample requests here: :download:`JSON <media/bp-processor.postman_collection.json>`
24
25 General Setup
26 --------------
27
28 All endpoints are accessable under ``http://{{host}}:{{port}}/api/v1/``. Host and port depends on your CDS BP processor
29 deployment.
30
31
32 List all endpoints
33 -------------------
34
35 Lists all available endpoints from blueprints processor API.
36
37
38 Request
39 ~~~~~~~~~~
40
41 GET ``http://{{host}}:{{port}}/actuator/mappings``
42 ....................................................
43
44 Lists all endpoints from blueprints processor.
45
46 .. code-block:: curl
47    :caption: **request**
48
49    curl --location --request GET 'http://localhost:8081/actuator/mappings' \
50    --header 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=='
51
52
53 Success Response
54 ~~~~~~~~~~~~~~~~~
55
56 HTTP Status 202 OK
57
58 .. code-block:: json
59    :caption: **sample response body**
60
61    {
62       "contexts": {
63          "application": {
64                "mappings": {
65                   "dispatcherHandlers": {
66                      "webHandler": [
67
68                            ...
69
70                            {
71                               "predicate": "{GET /api/v1/blueprint-model, produces [application/json]}",
72                               "handler": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController#allBlueprintModel()",
73                               "details": {
74                                  "handlerMethod": {
75                                        "className": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController",
76                                        "name": "allBlueprintModel",
77                                        "descriptor": "()Ljava/util/List;"
78                                  },
79                                  "handlerFunction": null,
80                                  "requestMappingConditions": {
81                                        "consumes": [],
82                                        "headers": [],
83                                        "methods": [
84                                           "GET"
85                                        ],
86                                        "params": [],
87                                        "patterns": [
88                                           "/api/v1/blueprint-model"
89                                        ],
90                                        "produces": [
91                                           {
92                                              "mediaType": "application/json",
93                                              "negated": false
94                                           }
95                                        ]
96                                  }
97                               }
98                            },
99                            {
100                               "predicate": "{GET /api/v1/blueprint-model/meta-data/{keyword}, produces [application/json]}",
101                               "handler": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController#allBlueprintModelMetaData(String, Continuation)",
102                               "details": {
103                                  "handlerMethod": {
104                                        "className": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController",
105                                        "name": "allBlueprintModelMetaData",
106                                        "descriptor": "(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;"
107                                  },
108                                  "handlerFunction": null,
109                                  "requestMappingConditions": {
110                                        "consumes": [],
111                                        "headers": [],
112                                        "methods": [
113                                           "GET"
114                                        ],
115                                        "params": [],
116                                        "patterns": [
117                                           "/api/v1/blueprint-model/meta-data/{keyword}"
118                                        ],
119                                        "produces": [
120                                           {
121                                              "mediaType": "application/json",
122                                              "negated": false
123                                           }
124                                        ]
125                                  }
126                               }
127                            }
128
129                            ...
130
131                      ]
132                   }
133                },
134                "parentId": null
135          }
136       }
137    }
138
139 Blueprint Model Catalog API
140 ----------------------------
141
142 Blueprint-model resource contains all Controller Blueprints Archive (CBA) packages which are available in CDS.
143 With blueprint-model API you can manage your CBAs.
144
145 Bootstrap
146 ~~~~~~~~~~~
147
148 POST ``/blueprint-model/bootstrap``
149 ....................................
150
151 Loads all Model Types, Resource Dictionaries and CBAs which are included in CDS by default.
152
153
154 Request
155 ...........
156
157 .. code-block:: curl
158    :caption: **sample request**
159
160    curl --location --request POST 'http://localhost:8081/api/v1/blueprint-model/bootstrap' \
161    --header 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==' \
162    --header 'Content-Type: application/json' \
163    --data-raw '{
164    "loadModelType" : true,
165    "loadResourceDictionary" : true,
166    "loadCBA" : true
167    }'
168
169 **Request Body Parameters:**
170
171 .. list-table::
172    :widths: 20 20 20 40
173    :header-rows: 1
174
175    * - Parameter
176      - Type
177      - Required
178      - Description
179    * - loadModelType
180      - Boolean
181      - yes
182      - Specifies if default model types should be loaded
183    * - loadResourceDictionary
184      - Boolean
185      - Yes
186      - Specifies if default data dictionaries should be loaded
187    * - loadCBA
188      - Boolean
189      - Yes
190      - Specifies if default CBAs should be loaded
191
192 Success Response
193 ......................
194
195 HTTP Status 202 OK
196
197
198 Consumes
199 ............
200
201 ``application/json``
202
203
204 Functional Description
205 ..............................
206
207 Before starting to work with CDS, bootstrap should be called to load all the basic models that each orginization might support.
208 Parameter values can be set as `false`  to skip loading e.g. the Resource Dictioniaries but this is not recommended.
209 The loaded CBAs are already enriched, that's why CBAs can be loaded even without Data Dictionaries or Model Types. If
210 validation of a CBA fails the CBA is skipped and the call is still executed successfully. You can find the error logs e.g.
211 in the console of an IDE.
212
213
214 Technical Description
215 ...........................
216
217 All Model Types which are loaded by bootstrap are in folder `/components/model-catalog/definition-type/starter-type`,
218 all Resource Dictionaries in `components/model-catalog/resource-dictionary/starter-dictionary`, all CBAs in
219 `model-catalog/blueprint-model/service-blueprint`.
220
221 **Called class/method:** ``org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController#bootstrap``.
222
223 Related topics
224 ..................
225
226 .. toctree::
227    :maxdepth: 1
228
229    ../modelingconcepts/cba
230    ../modelingconcepts/data-dictionary
231    ../modelingconcepts/data-type
232
233
234 List all blueprint models
235 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
236
237
238 GET ``/blueprint-model``
239 ..............................
240
241 Lists all blueprint models which are saved in CDS.
242
243 Request
244 ...........
245
246 .. code-block:: curl
247    :caption: **request**
248
249    curl --location --request GET 'http://{{ip_adress}}:{{port}}/api/v1/blueprint-model' \
250    --header 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=='
251
252 Produces
253 ...........
254
255 ``application/json``
256
257
258 Success Response
259 ......................
260
261 HTTP Status 200 OK
262
263 .. code-block:: json
264    :caption: **example response**
265
266    [
267     {
268         "blueprintModel": {
269             "id": "109e725d-5145-4f70-a2e7-ee6640e2fb5f",
270             "artifactUUId": null,
271             "artifactType": "SDNC_MODEL",
272             "artifactVersion": "1.0.0",
273             "artifactDescription": "",
274             "internalVersion": null,
275             "createdDate": "2020-11-09T19:00:20.000Z",
276             "artifactName": "vLB_CDS_RESTCONF",
277             "published": "Y",
278             "updatedBy": "DanielEmmarts>",
279             "tags": "vLB-CDS"
280         }
281     },
282     {
283         "blueprintModel": {
284             "id": "5cce3804-09eb-473d-b513-81f8547a7240",
285             "artifactUUId": null,
286             "artifactType": "SDNC_MODEL",
287             "artifactVersion": "1.0.0",
288             "artifactDescription": "",
289             "internalVersion": null,
290             "createdDate": "2020-11-09T19:00:20.000Z",
291             "artifactName": "vLB_CDS",
292             "published": "Y",
293             "updatedBy": "TomKennedy>",
294             "tags": "vLB_CDS"
295         }
296     }
297    ]
298
299 Technical Description
300 ...........................
301
302 Loads all Blueprint Models which are saved in the CDS database in table `BLUEPRINT_MODEL`. Unpublished and unproceeded
303 Blueprint Models are also included.
304 **Called class/method:** ``org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController#allBlueprintModel()``.