Azion CLI device-group
Azion CLI commands that create, list, describe, update, and delete the device groups of an application, with every flag and its type.
The Azion CLI device-group commands create, list, describe, update, and delete device groups, the names and regular expressions an application compares with the User-Agent header of each request. A device group belongs to one application, so every command takes the --application-id of that application. The options every command accepts, such as --format, --out, and -y, are on Global options.
Create
azion create device-group creates a device group in an application, with the name and the regular expression you pass:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--application-id | — | int | — | ID of the application that holds the device group. |
--file | — | string | — | Path to a JSON file with the attributes of the device group. Use - to read the JSON from standard input. |
--name | — | string | — | Name of the device group. It takes letters and digits only. |
--user-agent | — | string | — | Required unless --file is set. Regular expression to compare with the User-Agent header of each request. Without it, the command asks for the expression. |
The command needs Application Accelerator turned on for the application. While it is off, the command fails with this error:
This command turns on Application Accelerator for the application with ID 1234567890. The --application-accelerator flag is on Azion CLI application:
The command prints the ID of the updated application:
A name with a hyphen or an underscore is refused with this error:
This command creates a device group named mobile that matches Android devices and devices whose header contains Mobile:
The command prints the ID of the device group:
List
azion list device-group lists the device groups of one application, 50 to a page:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--application-id | — | int | — | ID of the application whose device groups you list. |
--details | — | — | — | Accepted, but adds no columns: the list keeps the ID, NAME, and USER AGENT columns. |
--filter | — | string | — | Name to filter the list by. |
--order-by | — | string | — | Field to sort the list by. |
--page | — | int | 1 | Number of the page to return. |
--page-size | — | int | 50 | Number of device groups on each page. |
This command lists the device groups of the application with ID 1234567890:
The command prints one row per device group:
Describe
azion describe device-group prints the settings of one device group:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--application-id | — | int | — | Required. ID of the application that holds the device group. |
--group-id | — | int | — | Required. ID of the device group to describe. |
This command describes the device group with ID 1238:
The command prints the ID, the name, and the regular expression of the device group:
With --format json, the command prints the full object: created_at, id, name, and user_agent.
Update
azion update device-group changes the name or the regular expression of a device group:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--application-id | — | int | — | Required. ID of the application that holds the device group. |
--file | — | string | — | Path to a JSON file with the attributes to change. Use - to read the JSON from standard input. |
--group-id | — | int | — | Required. ID of the device group to update. |
--name | — | string | — | New name of the device group. |
--user-agent | — | string | — | New regular expression to compare with the User-Agent header. |
This command adds iPhone devices to the regular expression of the device group with ID 1238:
The command prints the ID of the updated device group:
Delete
azion delete device-group deletes a device group from an application:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--application-id | — | int | — | Required. ID of the application that holds the device group. |
--group-id | — | int | — | Required. ID of the device group to delete. |
This command deletes the device group with ID 1239:
The command confirms the deletion:
Use a JSON file
azion create device-group and azion update device-group read the attributes of the device group from a JSON file with --file. The file carries name and user_agent.
This file creates a device group named tablet that matches iPad and tablet devices:
Pass the file to the create command with the ID of the application:
The command prints the ID of the device group:
This file renames a device group to tabletupdated:
Pass the file to the update command with the IDs of the application and the device group:
The command prints the ID of the updated device group:
A field the file leaves out keeps its value. After this update, the device group with ID 1239 still has (iPad|Tablet) as its user_agent.