Self-Service Actions

Self-Service Action Descriptor

Regardless of whether you're using UI editing or GitOps to manage your self-service actions, the definitions are backed by JSON files. Each file is a fully compliant OpenAPI 3 spec file, with our own specific extensions.

You can still use Self Service Actions even if you don't use OpenAPI/Swagger.

We use the OpenAPI spec as a base for automation rule configuration, since it's an open spec with official support for extensions. That lets us extend it to be an automation rule descriptor spec with optional usage of actual OpenAPI fields.

All automation rule descriptors have 5 metadata fields:

  • ID: A unique identifier for the rule.

  • Name: A user-friendly display name.

  • Description (Optional): A concise overview of the action for further context.

  • Is Active: Boolean parameter that determines whether the self-service-action is active and should be executed or not.

  • Type: Defines the type of rule (selfServiceAction) .

Triggers

Triggers are conditions that initiate the execution. For self-service actions, the only available trigger type is manual meaning users need to manual execute the action either via the UI or API.

The trigger sections also specify the arguments (and their data-types) that a self-service action requires to be triggered, which are used as input when triggering an action from the UI.

E.g.

"triggers": [
   {
      "type":"manual",
      "inputSchema":{
         "type":"object",
         "title":"Repository Details",
         "required":[
            "repositoryName",
            "visibility"
         ],
         "properties":{
            "repositoryName":{
               "type":"string",
               "title":"Repository Name",
               "description": "The name of the Repository in Gitlab"
            },
            "visibility":{
               "type":"string",
               "title":"Visibility",
               "description": "The visibility of the Repository ('hidden', 'internal', 'public')",
               "enum": ["private", "internal", "public"],
               "default":"hidden"
            }
         }
      }
   }
]

Actions

Actions are the operations executed by the automation rule when a trigger condition is met. Actions in self-service action rules resemble the schema and syntax of actions in automation rules.

Data Manipulation

Data Manipulation in self-service action rules resemble the behaviour of actions in automation rules.

Example 1 (Creating a Gitlab Repository)

{
	"id": "gitlab-repo-creation",
	"title": "Create Repository in GitLab",
	"description": "Create a new GitLab repository",
	"isActive": true,
	"order": 0,
	"type": "selfServiceAction",
	"arguments": {},
	"triggers": [
   {
      "type":"manual",
      "inputSchema":{
         "type":"object",
         "title":"Repository Details",
         "required":[
            "repositoryName",
            "visibility"
         ],
         "properties":{
            "repositoryName":{
               "type":"string",
               "title":"Repository Name",
               "description": "The name of the Repository in Gitlab"
            },
            "visibility":{
               "type":"string",
               "title":"Visibility",
               "description": "The visibility of the Repository ('hidden', 'internal', 'public')",
               "enum": ["private", "internal", "public"],
               "default":"hidden"
            }
         }
      }
	}],
	"actions": [{
	   "type": "httpRequest",
	   "args": {
		   "body": "{\"name\": \"{{ data.repositoryName }}\", \"visibility\": \"{{ data.visibility }}\"}",
		   "path": "",
		   "method": "post",
		   "baseUrl": "https://gitlab.com/api/v4/projects",
		   "headers": {
			   "Content-Type": "application/json",
			   "PRIVATE-TOKEN": "{{ env('GITLAB_TOKEN_ID') }}"
		   }
	   }
        }],
	"tags": [{
      "key": "data-source",
      "value": "gitlab"
    }]
}

Learn More

Last updated