Resource actions
2 minute read
A resource action puts a button on the detail page of a deployed resource. When a user selects it, it runs an action of any of the six action types. Administrators create them in Cloud Management Platform (CMP) at Admin > Resource Actions.
What resource actions can do
A resource action can run scripts on all or a subset of the server tiers in the resource, call an integration, email users, or run code that reads and writes information to and from the resource via the CMP database. Browse the Content Library or the CloudBolt Forge to see examples.
Control who can run an action
A resource action’s edit form has a Roles field listing the roles with permission to run that specific action. A role that holds the resource.all_actions permission can run every resource action, which overrides this list.
- Go to Admin > Resource Actions.
- Select Edit for an action.
- Under Roles, select the roles that should be able to run it.
- Select Save.
Control where the button appears
- Blueprints: Restrict the action to resources deployed from specific blueprints. A “Restart Web Server” action tied to the web server blueprint only appears on resources deployed from it.
- Server Tiers: For a remote script action edited within a blueprint, choose which server tiers the action runs against. If none are selected, it runs on every server created before the action.
- Display Condition Plug-in: Describe in code when the button should be shown, for cases that the other settings cannot express. See Action context for what the plugin receives.
- Display sequence: Set the order in which buttons appear when a resource has several.
Configure the confirmation dialog
Selecting an action button opens a confirmation dialog before anything runs. You can set its Dialog title template, its Dialog message (which accepts either plain text or HTML), and the Submit button label. Editing these in Admin > Resource Actions lets you warn users about what an action will do before they confirm it. For an action with consequences, select dangerous, which outlines the dialog in red and colors the submit button red.
Bulk runs and scheduling
Select Allow Bulk Operation to run the action against multiple resources at once.
Resource actions can also be scheduled for a later date and time. The steps are shared with server actions; see Scheduling actions.