This section describes how to manage agency authorization by calling ModelArts APIs.
The process of managing ModelArts authorization is as follows:
ModelArts functions, such as data management, training management, development environment, and real-time services, can be used only after being authorized.
URI: POST https://{endpoint}/v2/{project_id}/agency
Request body:
{ "agency_name_suffix" : "iam-user01" }
{ "agency_name": "ma_agency_iam-user01" }
URI: POST https://{endpoint}/v2/{project_id}/authorizations
{ "user_id": "****af917080f5d21f55c018ba19****", "type": "agency", "content": "ma_agency_iam-user01" }
Set the italic parameters based on site requirements. Set user_id to the IAM user ID and content to the ModelArts agency created in the previous step.
{ "result": true }
URI: GET https://{endpoint}/v2/{project_id}/authorizations
Request header: X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
Set the italic parameters based on site requirements.
{ "auth": [ { "create_time": 1622804433221, "user_id": "all-users", "user_name": "all-users", "type": "agency", "content": "modelarts_agency" }, { "create_time": 1625457065365, "user_id": "****af917080f5d21f55c018ba19****", "user_name": null, "type": "agency", "content": "ma_agency_iam-user01" } ], "total_count": 2 }
Obtain the authorization information based on the response.
URI: DELETE https://{endpoint}/v2/{project_id}/authorizations?user_id=****d80fb058844ae8b82aa66d9fe****
Request header: X-auth-Token →MIIZmgYJKoZIhvcNAQcCoIIZizCCGYcCAQExDTALBglghkgBZQMEAgEwgXXXXXX...
Set the italic parameters based on site requirements. Set ****d80fb058844ae8b82aa66d9fe**** to the IAM user ID of the specified user.
{ "result": true }
{ "result": true, "success_message": "Delete all-users auth info successfully!" }