Merge "update template&mapping create view."
[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
13
14 .. code-block:: json
15    :linenos:
16
17    source-input
18    {
19     "description": "This is Input Resource Source Node Type",
20     "version": "1.0.0",
21     "properties": {},
22     "derived_from": "tosca.nodes.ResourceSource"
23    }
24
25
26 Default:
27 ========
28 Expects the value to be defaulted in the model itself.
29
30 .. code-block:: json
31    :linenos:
32
33    source-default
34    {
35     "description": "This is Default Resource Source Node Type",
36     "version": "1.0.0",
37     "properties": {},
38     "derived_from": "tosca.nodes.ResourceSource"
39    }
40
41
42 sql:
43 ====
44
45 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.
46
47 CDS is currently deployed along the side of SDNC, hence the primary database connection provided by the framework is to SDNC database.
48
49 |image0|
50
51 .. |image0| image:: media/sqltable.JPG
52    :width: 7.88889in 
53    :height: 4.43750in
54
55 .. toctree::
56    :maxdepth: 1  
57
58    sourceprimarydbcode
59
60 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.
61
62 .. toctree::
63    :maxdepth: 1 
64
65    dbsystemcode
66
67
68 REST:
69 =====
70
71 Expects the URI along with the VERB and the payload, if needed.
72
73 CDS is currently deployed along the side of SDNC, hence the default rest connection provided by the framework is to SDNC MDSAL.
74
75 |image1|
76
77 .. |image1| image:: media/resttable.JPG
78    :width: 7.88889in 
79    :height: 4.43750in
80
81 .. toctree::
82    :maxdepth: 1
83    
84    restsourcecode
85
86 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.
87
88 Few ways are available to authenticate to the REST system:
89
90         * token-auth
91         * basic-auth
92         * ssl-basic-auth
93         
94 For source code of Authentication click below link:
95
96 .. toctree::
97    :maxdepth: 1
98    
99    restauth
100
101 Capability:
102 ===========
103
104 Expects a script to be provided.
105
106 |image2|
107
108 .. |image2| image:: media/capabilitytable.JPG
109    :width: 7.88889in 
110    :height: 4.43750in
111    
112    
113 .. toctree::
114    :maxdepth: 1   
115
116    sourcecapabilitycode
117         
118 Complex Type:
119 =============
120
121 Value will be resolved through REST., and output will be a complex type.
122
123 Modeling reference: Modeling Concepts#rest
124
125 In this example, we're making a POST request to an IPAM system with no payload.
126
127 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.
128
129 As part of this request, the expected response will be as below.
130
131 .. toctree::
132    :maxdepth: 1   
133
134    complexResponse
135
136 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
137
138 .. toctree::
139    :maxdepth: 1 
140    
141    dt-netbox-ip
142
143 The type of the data dictionary will be dt-netbox-ip.
144
145 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.
146
147 .. toctree::
148    :maxdepth: 1 
149    
150    create_netbox_ip_address