Azion CLI rules engine command and its subcommands

See the command and subcommands that enable the management of your edge applications’ rules in Rules Engine on the Azion Edge Platform using Azion CLI.


Listing your edge application’s rules in Rules Engine

Section titled Listing your edge application’s rules in Rules Engine

List the rules related to a specific edge application.

Terminal window
azioncli rules_engine list --application-id 1000 --phase request

The --application-id flag gives the ID for the edge application and, based on that, the rules related to the application are listed.

The --phase flag informs if you want to list the request rules or the response rules.

The --details option displays all relevant fields when listing.

The --filter option filters items by name.

The --order_by option sorts the output based on the informed field.

The --page option returns a page of the list based on the selected field.

The --page_size option defines how many items should be returned per page. By default, it’s 10.

The --sort option defines the order of the items on the list. The value should be either asc or desc.

The --help option displays more information about the list subcommand.


Generating a template for the rules_engine create and update subcommands

Section titled Generating a template for the rules_engine create and update subcommands

Generate a rules engine template to be used with the create and update subcommands.

Terminal window
azioncli rules_engine template

The template will be created, by default, inside the directory you’re running Azion CLI on. It looks similar to:

{
"behaviors": [
{
"name": "run_function",
"target": 0
}
],
"criteria": [
[
{
"conditional": "if",
"input_value": "/",
"operator": "starts_with",
"variable": "${uri}"
}
]
],
"name": "NewRulesEngine"
}

The --help option displays more information about the template subcommand.


Creating a rule in Rules Engine

Section titled Creating a rule in Rules Engine

Create a new rule in Rules Engine based on given attributes to be used with edge applications.

Terminal window
azioncli rules_engine create --application-id 100 --phase "response" --in ./file.json

The --application-id flag gives the ID for the edge application related to this rule in Rules Engine being created.

The --phase flag informs if you want to create a request rule or a response rule.

The --in flag informs the file path to the template, which must contain all attributes of the rule being created.

The --help option displays more information about the create subcommand.


Updating a rule in Rules Engine

Section titled Updating a rule in Rules Engine

Update a rule in Rules Engine based on given attributes.

Terminal window
azioncli rules_engine update --application-id 1673635839 --phase request --in rule.json --rule-id

The --rule-id flag gives the ID for the rule being updated.

The --application-id flag gives the ID for the edge application related to this rule in Rules Engine being updated.

The --phase flag informs the phase of the rule, request or response.

The --in flag informs the file path to the template, which must contain all attributes of the rule being updated.

The --help option displays more information about the update subcommand.


Describing a rule in Rules Engine

Section titled Describing a rule in Rules Engine

Return details about a specific rule in Rules Engine, based on a given ID.

Terminal window
azioncli rules_engine describe --application-id 123456 --rule-id 1234 --phase request

The --rule-id flag gives the ID for the rule being described.

The --application-id flag gives the ID for the edge application related to the rule being described.

The --phase flag informs the rule phase, request or response.

The --out option exports the output of the describe command to a given filepath.

The --format option, followed by the value json, changes the output format to JSON.

The --help option displays more information about the describe subcommand.


Deleting a rule in Rules Engine

Section titled Deleting a rule in Rules Engine

Delete a rule in Rules Engine on the Azion platform.

Terminal window
azioncli rules_engine delete --application-id 1673635839 --rule-id 12312

The --application-id flag informs the ID of the edge application related to the rule being deleted.

The --rule-id flag gives the ID for the rule being deleted.

The --help option displays more information about the delete subcommand.