Merge "Loopback search by tag service"
[ccsdk/cds.git] / docs / datadictionary / resourcesource.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. Copyright (C) 2019 IBM.
4
5 Resource Source 
6 ---------------
7
8 Input:
9 ======
10 Expects the value to be provided as input to the request.
11
12 source-input:
13
14 .. code: json
15 print("
16   "description": "This is Input Resource Source Node Type",
17   "version": "1.0.0",
18   "properties": {},
19   "derived_from": "tosca.nodes.ResourceSource"
20 ")
21
22
23 Default:
24 ========
25 Expects the value to be defaulted in the model itself.
26
27 source-default:
28
29   "description": "This is Default Resource Source Node Type",
30   "version": "1.0.0",
31   "properties": {},
32   "derived_from": "tosca.nodes.ResourceSource"
33
34
35
36 sql:
37 ====
38
39 Expects the SQL query to be modeled; that SQL query can be parameterized, and the parameters be other resources resolved through other means. If that's the case, this data dictionary definition will have to define key-dependencies along with input-key-mapping.
40
41 CDS is currently deployed along the side of SDNC, hence the primary database connection provided by the framework is to SDNC database.
42
43 |image0|
44
45 .. |image0| image:: media/sqltable.JPG
46    :width: 7.88889in 
47    :height: 4.43750in
48
49 .. toctree::
50    :maxdepth: 1  
51
52    sourceprimarydbcode
53
54 Connection to a specific database can be expressed through the endpoint-selector property, which refers to a macro defining the information about the database the connect to. Understand TOSCA Macro in the context of CDS.
55
56 .. toctree::
57    :maxdepth: 1 
58
59    dbsystemcode
60
61
62 REST:
63 =====
64
65 Expects the URI along with the VERB and the payload, if needed.
66
67 CDS is currently deployed along the side of SDNC, hence the default rest connection provided by the framework is to SDNC MDSAL.
68
69 |image1|
70
71 .. |image1| image:: media/resttable.JPG
72    :width: 7.88889in 
73    :height: 4.43750in
74
75 .. toctree::
76    :maxdepth: 1
77    
78    restsourcecode
79
80 Connection to a specific REST system can be expressed through the endpoint-selector property, which refers to a macro defining the information about the REST system the connect to. Understand TOSCA Macro in the context of CDS.
81
82 Few ways are available to authenticate to the REST system:
83
84         * token-auth
85         * basic-auth
86         * ssl-basic-auth
87         
88 For source code of Authentication click below link:
89
90 .. toctree::
91    :maxdepth: 1
92    
93    restauth
94
95 Capability:
96 ===========
97
98 Expects a script to be provided.
99
100 |image2|
101
102 .. |image2| image:: media/capabilitytable.JPG
103    :width: 7.88889in 
104    :height: 4.43750in
105    
106    
107 .. toctree::
108    :maxdepth: 1   
109
110    sourcecapabilitycode
111         
112 Complex Type:
113 =============
114
115 Value will be resolved through REST., and output will be a complex type.
116
117 Modeling reference: Modeling Concepts#rest
118
119 In this example, we're making a POST request to an IPAM system with no payload.
120
121 Some ingredients are required to perform the query, in this case, $prefixId. Hence It is provided as an input-key-mapping and defined as a key-dependencies. Please refer to the modeling guideline for more in depth understanding.
122
123 As part of this request, the expected response will be as below.
124
125 .. toctree::
126    :maxdepth: 1   
127
128    complexResponse
129
130 What is of interest is the address and id fields. For the process to return these two values, we need to create a custom data-type, as bellow
131
132 .. toctree::
133    :maxdepth: 1 
134    
135    dt-netbox-ip
136
137 The type of the data dictionary will be dt-netbox-ip.
138
139 To tell the resolution framework what is of interest in the response, the output-key-mapping section is used. The process will map the output-key-mapping to the defined data-type.
140
141 .. toctree::
142    :maxdepth: 1 
143    
144    create_netbox_ip_address