doc-exports/docs/modelarts/api-ref/CreateAuthorization.html
Lai, Weijian 2f0818cf3d ModelArts API 22.3.0 version-20240311
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lai, Weijian <laiweijian4@huawei.com>
Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
2024-04-05 09:35:42 +00:00

150 lines
12 KiB
HTML

<a name="CreateAuthorization"></a><a name="CreateAuthorization"></a>
<h1 class="topictitle1">Configuring Authorization</h1>
<div id="body0000001349228041"><div class="section" id="CreateAuthorization__section691766104715"><h4 class="sectiontitle">Function</h4><p id="CreateAuthorization__p7919163478">This API is used to configure ModelArts authorization. ModelArts functions such as training management, development environment, data management, and real-time services can be properly used only after required authorization is configured. This API allows the system administrator to configure an agency for IAM users and set an access key of the current user.</p>
</div>
<div class="section" id="CreateAuthorization__section18923146134711"><h4 class="sectiontitle">URI</h4><p id="CreateAuthorization__p2924146194712">POST /v2/{project_id}/authorizations</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="CreateAuthorization__table79263634714" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Path Parameters</caption><thead align="left"><tr id="CreateAuthorization__row139255612479"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.5.1.1"><p id="CreateAuthorization__p1092736164714">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.5.1.2"><p id="CreateAuthorization__p392846174710">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.2.3.2.5.1.3"><p id="CreateAuthorization__p179295613479">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.2.3.2.5.1.4"><p id="CreateAuthorization__p1492913634719">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="CreateAuthorization__row1992556134713"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.1 "><p id="CreateAuthorization__p193006194714">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.2 "><p id="CreateAuthorization__p6931166104716">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.2.3.2.5.1.3 "><p id="CreateAuthorization__p109321866476">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.2.3.2.5.1.4 "><p id="CreateAuthorization__p1993312611473">Project ID. For details about how to obtain a project ID, see <a href="modelarts_03_0147.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="CreateAuthorization__section1393556184720"><h4 class="sectiontitle">Request Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="CreateAuthorization__request_AuthorizationRequest" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request body parameters</caption><thead align="left"><tr id="CreateAuthorization__row1193615618474"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.2.5.1.1"><p id="CreateAuthorization__p179403615472">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.2.5.1.2"><p id="CreateAuthorization__p209435610479">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.2.5.1.3"><p id="CreateAuthorization__p1094516634719">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.3.2.2.5.1.4"><p id="CreateAuthorization__p15946068474">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="CreateAuthorization__row179373611475"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.1 "><p id="CreateAuthorization__p49478611476">user_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.2 "><p id="CreateAuthorization__p20948869476">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.3 "><p id="CreateAuthorization__p49491663471">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.2.2.5.1.4 "><p id="CreateAuthorization__p1895018619479">User ID. For details about how to obtain a user ID, see <a href="modelarts_03_0006.html">Obtaining a User ID</a>.</p>
<p id="CreateAuthorization__p1695113624711">If <strong id="CreateAuthorization__b595217619471">user_id</strong> is set to <strong id="CreateAuthorization__b495216619471">all-users</strong>, authorization is configured for all IAM users. If some users have been authorized, their authorization will be updated.</p>
<p id="CreateAuthorization__p9953166134719">This parameter is mandatory only if the authorization method is set to <strong id="CreateAuthorization__b49531361477">Agency</strong>.</p>
</td>
</tr>
<tr id="CreateAuthorization__row159379618476"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.1 "><p id="CreateAuthorization__p1295419611476">type</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.2 "><p id="CreateAuthorization__p9955106164713">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.3 "><p id="CreateAuthorization__p1795686204714">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.2.2.5.1.4 "><p id="CreateAuthorization__p1795710664717">Authorization type. <strong id="CreateAuthorization__b15958146144718">Agency</strong> is recommended.</p>
<p id="CreateAuthorization__p1958126184717">Options:</p>
<ul id="CreateAuthorization__ul1995914615472"><li id="CreateAuthorization__li495946114716"><strong id="CreateAuthorization__b129605624716">agency</strong>: authorization through an agency</li><li id="CreateAuthorization__li696010616471"><strong id="CreateAuthorization__b696110610473">credential</strong>: authorization through an access Key (AK/SK)</li></ul>
<p id="CreateAuthorization__p79611365479">Default: <strong id="CreateAuthorization__b169623614475">agency</strong></p>
</td>
</tr>
<tr id="CreateAuthorization__row99379616474"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.1 "><p id="CreateAuthorization__p39625654717">content</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.2 "><p id="CreateAuthorization__p3963963473">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.3 "><p id="CreateAuthorization__p6964196104719">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.2.2.5.1.4 "><p id="CreateAuthorization__p11965763470">Authorization content.</p>
<ul id="CreateAuthorization__ul149679618470"><li id="CreateAuthorization__li09671468472">If <strong id="CreateAuthorization__b896917615471">Authorization Type</strong> is set to <strong id="CreateAuthorization__b19691962472">Agency</strong>, this field indicates the agency name.</li><li id="CreateAuthorization__li59706613472">If <strong id="CreateAuthorization__b199716619474">Authorization Type</strong> is set to <strong id="CreateAuthorization__b69714613478">AK/SK</strong>, this field indicates the access key ID (AK).</li></ul>
</td>
</tr>
<tr id="CreateAuthorization__row179370617476"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.1 "><p id="CreateAuthorization__p109737613476">secret_key</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.2 "><p id="CreateAuthorization__p20974146144712">No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.2.5.1.3 "><p id="CreateAuthorization__p159751460475">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.2.2.5.1.4 "><p id="CreateAuthorization__p197646154719">Secret Access Key (SK). This field is required only when <strong id="CreateAuthorization__b17977186184719">Authorization Method</strong> is set to <strong id="CreateAuthorization__b89771265473">AK/SK</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="CreateAuthorization__section169779612471"><h4 class="sectiontitle">Response Parameters</h4><p id="CreateAuthorization__p09791966473">None</p>
</div>
<div class="section" id="CreateAuthorization__section17980156124711"><h4 class="sectiontitle">Example Requests</h4><p id="CreateAuthorization__p0981769474">Upload authorization.</p>
<pre class="screen" id="CreateAuthorization__screen1598686104715">POST https://{endpoint}/v2/{project_id}/authorizations
{
"user_id" : "****d80fb058844ae8b82aa66d9fe****",
"type" : "agency",
"content" : "modelarts_agency"
}</pre>
</div>
<div class="section" id="CreateAuthorization__section1099346204717"><h4 class="sectiontitle">Example Responses</h4><p id="CreateAuthorization__p59941764476"><strong id="CreateAuthorization__b1999586204717">Status code: 200</strong></p>
<p id="CreateAuthorization__p89951461476">OK</p>
<pre class="screen" id="CreateAuthorization__screen1399676154716">{
"result" : "true"
}</pre>
</div>
<div class="section" id="CreateAuthorization__section1399810674719"><h4 class="sectiontitle">Status Codes</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="CreateAuthorization__status_code" frame="border" border="1" rules="all"><thead align="left"><tr id="CreateAuthorization__row707715473"><th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.7.2.1.3.1.1"><p id="CreateAuthorization__p3213720475">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="85%" id="mcps1.3.7.2.1.3.1.2"><p id="CreateAuthorization__p431710474">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="CreateAuthorization__row17013714718"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="CreateAuthorization__p3419714715">200</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="CreateAuthorization__p9567164710">OK</p>
</td>
</tr>
<tr id="CreateAuthorization__row30970471"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="CreateAuthorization__p12677104711">400</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="CreateAuthorization__p2707154713">Bad Request</p>
</td>
</tr>
<tr id="CreateAuthorization__row2007194713"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="CreateAuthorization__p108876475">401</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="CreateAuthorization__p12917104716">Unauthorized</p>
</td>
</tr>
<tr id="CreateAuthorization__row14012734711"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="CreateAuthorization__p410177204717">403</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="CreateAuthorization__p7125719474">Forbidden</p>
</td>
</tr>
<tr id="CreateAuthorization__row1307764713"><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.7.2.1.3.1.1 "><p id="CreateAuthorization__p71319720475">404</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.7.2.1.3.1.2 "><p id="CreateAuthorization__p13141772471">Not Found</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="CreateAuthorization__section815274473"><h4 class="sectiontitle">Error Codes</h4><p id="CreateAuthorization__p1816117134713">See <a href="modelarts_03_0095.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="authorization.html">Authorization Management</a></div>
</div>
</div>