doc-exports/docs/mrs/api-ref/mrs_02_0022.html
Yang, Tong bd2b57f749 MRS API 2.0.38.SP20 version
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Yang, Tong <yangtong2@huawei.com>
Co-committed-by: Yang, Tong <yangtong2@huawei.com>
2022-11-16 15:06:08 +00:00

248 lines
17 KiB
HTML

<a name="mrs_02_0022"></a><a name="mrs_02_0022"></a>
<h1 class="topictitle1">Creating a Data Source</h1>
<div id="body1484116919792"><div class="section" id="mrs_02_0022__section11410068144834"><h4 class="sectiontitle">Function</h4><p id="mrs_02_0022__p30367694144836">This API is used to create a data source. This API is compatible with Sahara.</p>
</div>
<div class="section" id="mrs_02_0022__section4721807314497"><h4 class="sectiontitle">URI</h4><ul id="mrs_02_0022__u749b0e1d16034ea99b9d31909ce7ee80"><li id="mrs_02_0022__li351910470488">Format<p id="mrs_02_0022__p35521456124816"><a name="mrs_02_0022__li351910470488"></a><a name="li351910470488"></a>POST /v1.1/{project_id}/data-sources</p>
</li><li id="mrs_02_0022__li831194172516">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_02_0022__table49499141194754" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameter description</caption><thead align="left"><tr id="mrs_02_0022__row33700024194754"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.2.2.1.2.4.1.1"><p id="mrs_02_0022__p16571835194812">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.2.2.1.2.4.1.2"><p id="mrs_02_0022__p141410194812">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.2.2.1.2.4.1.3"><p id="mrs_02_0022__p11454278194812">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_02_0022__row6505449415356"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.4.1.1 "><p id="mrs_02_0022__p3492262515356">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.2.2.1.2.4.1.2 "><p id="mrs_02_0022__p1016041415356">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.2.1.2.4.1.3 "><p id="mrs_02_0022__p1768719515356">Project ID. For details on how to obtain the project ID, see <a href="mrs_02_0011.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="mrs_02_0022__section31697334144924"><h4 class="sectiontitle">Request</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_02_0022__table19445385114112" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameter description</caption><thead align="left"><tr id="mrs_02_0022__row1790422114112"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.3.2.2.5.1.1"><p id="mrs_02_0022__p10806517114112">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.2.2.5.1.2"><p id="mrs_02_0022__p2912680114112">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.2.2.5.1.3"><p id="mrs_02_0022__p34600536114112">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45%" id="mcps1.3.3.2.2.5.1.4"><p id="mrs_02_0022__p51180012114112">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_02_0022__row51940301114112"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.2.5.1.1 "><p id="mrs_02_0022__p39771773145713">name</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.2 "><p id="mrs_02_0022__p29636830145713">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.3 "><p id="mrs_02_0022__p7598676145713">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.2.5.1.4 "><p id="mrs_02_0022__p53534038145713">Data source name</p>
<p id="mrs_02_0022__p667497994849">Contains 1 to 80 characters and consists of letters, digits, hyphens (-), and underscores (_) only.</p>
</td>
</tr>
<tr id="mrs_02_0022__row18284370114112"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.2.5.1.1 "><p id="mrs_02_0022__p43646883145713">url</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.2 "><p id="mrs_02_0022__p4937219915237">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.3 "><p id="mrs_02_0022__p5870587215316">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.2.5.1.4 "><p id="mrs_02_0022__p57957308145713">Data source URL</p>
<p id="mrs_02_0022__p195891015248">Contains 1 to 255 characters.</p>
<ul id="mrs_02_0022__ul197417161574"><li id="mrs_02_0022__li211643101574">If the data source type is HDFS, the value is <strong id="mrs_02_0022__b282583209530">/</strong><em id="mrs_02_0022__i389248869530">Save path of the data source</em>.</li><li id="mrs_02_0022__li5234427715752">If the data source type is OBS, the value is <strong id="mrs_02_0022__b57629220155547">s3</strong><strong id="mrs_02_0022__b28772868155547">a</strong><strong id="mrs_02_0022__b45346037155551">://</strong><em id="mrs_02_0022__i59859279538">Save path of the data source</em>.</li></ul>
</td>
</tr>
<tr id="mrs_02_0022__row475482215758"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.2.5.1.1 "><p id="mrs_02_0022__p4959628115758">credentials</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.2 "><p id="mrs_02_0022__p5787579615758">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.3 "><p id="mrs_02_0022__p5742790415758">Object</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.2.5.1.4 "><p id="mrs_02_0022__p2114864415758">Authentication information. The current version does not support this function.</p>
</td>
</tr>
<tr id="mrs_02_0022__row2693395895552"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.2.5.1.1 "><p id="mrs_02_0022__p3416696195552">is_protected</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.2 "><p id="mrs_02_0022__p1606046195552">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.3 "><p id="mrs_02_0022__p2582896195552">Bool</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.2.5.1.4 "><p id="mrs_02_0022__p1177112695552">Whether the data source is protected</p>
<ul id="mrs_02_0022__ul360256379574"><li id="mrs_02_0022__li164971619574">true</li><li id="mrs_02_0022__li205044639578">false</li></ul>
<p id="mrs_02_0022__p6483812795728">The current version does not support this function.</p>
</td>
</tr>
<tr id="mrs_02_0022__row4788217195558"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.2.5.1.1 "><p id="mrs_02_0022__p5325060395558">is_public</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.2 "><p id="mrs_02_0022__p1833155995558">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.3 "><p id="mrs_02_0022__p846133695558">Bool</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.2.5.1.4 "><p id="mrs_02_0022__p1427965495558">Whether the data source is public</p>
<ul id="mrs_02_0022__ul5208982895717"><li id="mrs_02_0022__li748278795719">true</li><li id="mrs_02_0022__li23622095719">false</li></ul>
<p id="mrs_02_0022__p6105735395725">The current version does not support this function.</p>
</td>
</tr>
<tr id="mrs_02_0022__row34155459114112"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.2.5.1.1 "><p id="mrs_02_0022__p62216246145713">type</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.2 "><p id="mrs_02_0022__p2060969915237">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.3 "><p id="mrs_02_0022__p1226219015318">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.2.5.1.4 "><p id="mrs_02_0022__p40587883145713">Data source type</p>
<ul id="mrs_02_0022__ul2600786315532"><li id="mrs_02_0022__li6223015215532">hdfs</li><li id="mrs_02_0022__li4272940315540">obs</li><li id="mrs_02_0022__li773125795812">swift (not supported by the current version)</li></ul>
</td>
</tr>
<tr id="mrs_02_0022__row41150634114112"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.3.2.2.5.1.1 "><p id="mrs_02_0022__p54100889145713">description</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.2 "><p id="mrs_02_0022__p3011949115237">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.5.1.3 "><p id="mrs_02_0022__p3471563715318">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.2.5.1.4 "><p id="mrs_02_0022__p8987936145713">Data source description</p>
<p id="mrs_02_0022__p85145142518">Contains a maximum of 65535 characters.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="mrs_02_0022__section10069032144933"><h4 class="sectiontitle">Response</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="mrs_02_0022__table51257841151049" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Response parameter description</caption><thead align="left"><tr id="mrs_02_0022__row8480851151049"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.2.2.4.1.1"><p id="mrs_02_0022__p15860319151049">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.4.2.2.4.1.2"><p id="mrs_02_0022__p40813771151049">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.4.2.2.4.1.3"><p id="mrs_02_0022__p17581180151049">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_02_0022__row14789514151049"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p28232664151128">description</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p32100671151824">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p60375806151049">Data source description</p>
</td>
</tr>
<tr id="mrs_02_0022__row6511344151049"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p59583657151128">url</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p47113545151824">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p38365320151049">Data source URL</p>
</td>
</tr>
<tr id="mrs_02_0022__row33112539151141"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p64870032151141">tenant_id</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p2060135151824">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p20842175017348">Project ID. For details on how to obtain the project ID, see <a href="mrs_02_0011.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
<tr id="mrs_02_0022__row22096096151146"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p44953331151146">created_at</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p26983233151824">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p25869246151146">Data source creation time</p>
</td>
</tr>
<tr id="mrs_02_0022__row44747700151120"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p685049151120">updated_at</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p65422913151120">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p64764563151120">Data source update time If the data source has not been updated, the value of this parameter is <strong id="mrs_02_0022__b863912328585">null</strong>.</p>
</td>
</tr>
<tr id="mrs_02_0022__row18376161151152"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p10483939151640">is_protected</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p65650233151640">Bool</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p16068681151640">Whether the data source is protected</p>
</td>
</tr>
<tr id="mrs_02_0022__row6726034151222"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p20438892151640">is_public</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p16062920151640">Bool</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p26028163151640">Whether the data source is public</p>
</td>
</tr>
<tr id="mrs_02_0022__row25334813151227"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p38853957151227">type</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p66202595151828">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p60833455151227">Data source type</p>
</td>
</tr>
<tr id="mrs_02_0022__row8652083151249"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p29730140151249">id</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p17113312151828">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p39995064151249">ID returned by the system after the data source is created</p>
</td>
</tr>
<tr id="mrs_02_0022__row12228393151256"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.1 "><p id="mrs_02_0022__p50975775151256">name</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.4.2.2.4.1.2 "><p id="mrs_02_0022__p21869845151828">String</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.4.2.2.4.1.3 "><p id="mrs_02_0022__p43580859151256">Data source name</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="mrs_02_0022__section16281131022217"><h4 class="sectiontitle">Example</h4><ul id="mrs_02_0022__ul31895467223"><li id="mrs_02_0022__li34189801145544">Example request<pre class="screen" id="mrs_02_0022__screen4411854892719">{
"name": "my-data-source",
"url": "/simple/mapreduce/input",
"is_protected": false,
"is_public": false,
"type": "hdfs",
"description": "this is the data source template"
}</pre>
</li></ul>
</div>
<ul id="mrs_02_0022__ul106521311236"><li id="mrs_02_0022__li434888315144">Example response<pre class="screen" id="mrs_02_0022__screen44885148151018">{
"data_source": {
"name": "my-data-source",
"type": "hdfs",
"url": "/simple/mapreduce/input",
"description": "this is the data source template",
"created_at": "2017-06-22T08:28:57",
"updated_at": null,
"id": "e275a927-fe72-4b8b-a634-e47a11dca181",
"tenant_id": "5a3314075bfa49b9ae360f4ecd333695",
"is_public": false,
"is_protected": false
}
}</pre>
</li></ul>
<div class="section" id="mrs_02_0022__section13299747144948"><h4 class="sectiontitle">Status Code</h4><p id="mrs_02_0022__p5547365016031"><a href="#mrs_02_0022__table1584477916050">Table 4</a> describes the status code of this API.</p>
<div class="tablenoborder"><a name="mrs_02_0022__table1584477916050"></a><a name="table1584477916050"></a><table cellpadding="4" cellspacing="0" summary="" id="mrs_02_0022__table1584477916050" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Status code</caption><thead align="left"><tr id="mrs_02_0022__row1339492016050"><th align="left" class="cellrowborder" valign="top" width="30%" id="mcps1.3.7.3.2.3.1.1"><p id="mrs_02_0022__p3411176516050">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="70%" id="mcps1.3.7.3.2.3.1.2"><p id="mrs_02_0022__p1158961516050">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="mrs_02_0022__row3719767816050"><td class="cellrowborder" valign="top" width="30%" headers="mcps1.3.7.3.2.3.1.1 "><p id="mrs_02_0022__p6022194016050">202</p>
</td>
<td class="cellrowborder" valign="top" width="70%" headers="mcps1.3.7.3.2.3.1.2 "><p id="mrs_02_0022__p4613894216050">The data source has been successfully created.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="mrs_02_0022__p3132993710328">For the description about error status codes, see <a href="mrs_02_0015.html">Status Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="mrs_02_0021.html">Data Source APIs</a></div>
</div>
</div>