All Products
Search
Document Center

Logic Composer:Query information about multiple RAM users

Last Updated:Apr 12, 2024

This topic describes how to query information about multiple RAM users.

Background information

Logic Composer is activated and RAM users are created by using your Alibaba Cloud account.

Procedure

  1. Log on to the Alibaba Cloud console and open the Logic Composer console.

  2. In the left-side navigation pane, click Workflows. On the Workflows page, click Create Workflow.

  3. Set the Workflow Name and Resource group parameters, which are required. Then, click OK.

  4. In the Create Workflow dialog box that appears, select the default option Blank and then click OK to go to the workflow editing page.

  5. In the Select Trigger window on the Graphic View tab, click the All tab and then click Request.

  6. In the Request dialog box that appears, click When a HTTP request is received on the Triggers tab. In the dialog box that appears, select GET for Method.

  7. Click + Add Step. In the Select Action dialog box that appears, click the All tab and then click Variables.

  8. In the Variables dialog box that appears, click Initialize variable on the Actions tab. In the Initialize variable dialog box that appears, enter the variable name newVar for the Name parameter, select Array for the Type parameter, and then enter [] in the Value parameter.

  9. At the bottom of the workflow, click + Add Step. The Select Action dialog box appears.

  10. Click the Alibaba Cloud tab, search for Resource Access Management in the connector list, and click Resource Access Management.

  11. In the Resource Access Management dialog box that appears, search for listusers in the action list, and then click ListUsers.

  12. Click Authorize. In the Grant Role panel that appears, set the following parameter and click OK to complete the authorization configuration. If you have specified a role, skip this step.

    • Role Type: Select New Role for this parameter.

    • Role Name: Set this parameter to logic-composer-accessing-RAM-role.

    • Role Description: Enter Required permissions for running logic-composer-Access-RAM-role in this field.

    • New Authorization Policies: Select AliyunRAMReadOnlyAccess for this parameter.

  13. Click + Add Step at the bottom of the workflow. In the Select Action dialog box that appears, click Control. In the Control dialog box that appears, click For each on the Actions tab.

  14. Click the input box of the Value parameter. In the floating window that appears on the right, click Users under Resource Access Management ListUsers.

  15. Click + Add Step in the ForEach dialog box. In the Select Action dialog box that appears, search for Resource Access Management in the connector list and click Resource Access Management. In the Resource Access Management dialog box that appears, search for policies in the action list and click ListPoliciesForUser.

  16. Click the input box of UserName in the tab. In the floating window on the right, enter items ('ForEach')['UserName'] in the input box of the Expression tab, and click OK next to the input box. If you cannot see the OK button due to the narrow window, scroll the browser window to the right.

  17. Click + Add Step in the ForEach tab. In the Select Action dialog box that appears, search for Resource Access Management in the connector list and click Resource Access Management. In the Resource Access Management dialog box that appears, search for accesskeys in the action list and click ListAccessKeys.

  18. Click the input box of UserName in the tab. In the floating window on the right, enter items ('ForEach')['UserName'] in the input box of the Expression tab, and click OK next to the input box. If you cannot see the OK button due to the narrow window, scroll the browser window to the right.

  19. Click + Add Step in the ForEach node. In the Select Action dialog box that appears, click Variables to show the action list.

  20. Click Append to array variable. In the Name drop-down list, select newVar. In the Value field, enter the following sample code in the input box:

    {
      "userName": "@{items('ForEach')['UserName']}",
      "accessKeys": "@{body('Resource_Access_Management_ListAccessKeys')['AccessKeys']['AccessKey']}",
      "policies": "@{body('Resource_Access_Management_ListPoliciesForUser')['Policies']['Policy']}"
    }

Execution result

  1. At the bottom of the workflow, click + Add Step. The Select Action dialog box appears. Find Request in the connector list and click it. Then, find Response in the action list and click it.

  2. In the Response dialog box that appears, enter Content-Type and application/json in Header, and then click the input box of Body. In the dialog box that appears on the right, click the output variable newVar under Initialize variable, and then click Save to save the workflow.

  3. Click Run to run the workflow. The Result page appears. After all the nodes are run, click the Response node to view the output in the Body section.

Verify the response through a browser

  1. On the Graphic View tab of the workflow, click the trigger When a HTTP request is received, and copy the URL in HTTP Endpoint.

  2. Open a new page in a browser, paste the copied URL to the address bar, and press Enter.

  3. Check whether the response is correct.

Note

If you have a large number of RAM users and permissions in the account, the response may time out. This does not interrupt the run of a workflow. You can view the run log of a workflow on the Execution Log page. For more information, see the HTTP section of Limits.