Updated on 2024-11-14 GMT+08:00

Custom Policies

You can customize policies to supplement system-defined policies of CodeArts.

You can create custom policies using one of the following methods:

  • Visual editor: Select cloud services, actions, resources, and request conditions. You do not need to have knowledge of the policy syntax.
  • JSON: Create a policy in the JSON format from scratch or based on an existing policy.

For details, see Creating a Custom Policy. This section contains examples of common custom policies in CodeArts.

CodeArts Custom Policy Examples

  • Example 1: Authorize users to purchase CodeArts on the console
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "
                         devcloud:monthlyPackage:subscribe
                     "
                ]
            }
        ]
    }
  • Example 2: Define actions for multiple services in a policy

    A custom policy can contain the actions of multiple services that are of the global or project-level type. The following is an example policy containing actions of multiple services:

    { 
            "Version": "1.1", 
            "Statement": [ 
                    { 
                            "Action": [ 
                                    "devcloud:*:listResourceDetail", 
                                    "ecs:cloudServers:delete"
                            ], 
                            "Effect": "Allow" 
                    } 
            ] 
    }