Creating a Role

Last updated: 2019-04-17 16:31:53

PDF

API Description

This API (CreateRole) is used to create a role.
Request domain name: cam.api.qcloud.com

Input Parameters

The following request parameter list only provides the API request parameters. Other parameters can be found in Common Request Parameters.

Parameter Name Required Type Description
policyDocument Yes String Trust policy of the role
description No String Role description
roleName Yes String Role name

Output Parameters

Parameter Name Type Description
roleId String Role ID

Example

Input

https://cam.api.qcloud.com/v2/index.php?Action=CreateRole&roleName=testroleName
&policyDocument=%7B%22version%22%3A%222.0%22%2C%22statement%22%3A%5B%7B%22action%22%3A%22name%2Fsts%3AAssumeRole%22%2C%22effect%22%3A%22allow%22%2C%22principal%22%3A%7B%22qcs%22%3A%5B%22qcs%3A%3Acam%3A%3Auin%12345678%3Aroot%22%5D%7D%7D%5D%7D&<Common request parameters>

The value of parameter policyDocument is:
{"version":"2.0","statement":[{"action":"name/sts:AssumeRole","effect":"allow","principal":{"qcs":["qcs::cam::uin/12345678:root"]}}]}

Output

{
    "code": 0,
    "message": "",
    "codeDesc": "Success",
    "data": {
        "roleId": "4611686018427397919"
    }
}

`