Azion CLI custom-pages
Azion CLI commands that create, list, describe, update, and delete custom page sets, with every flag, its type, and its default.
The Azion CLI custom-pages commands create, list, describe, update, and delete custom page sets, the Custom Pages resource that replaces the error responses of a workload with pages served from a connector. These commands manage the set and do not assign it to a workload: azion create workload-deployment --custom-page does. The options every command accepts, such as --format, --out, and -y, are on Global options.
Create
azion create custom-pages creates a custom page set from a JSON file. The command has no flag per field:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--file | — | string | — | Required. Path to a JSON file with the attributes of the custom page set. Use - to read the JSON from standard input. Without it, the command asks for the path. |
This file describes an active set named my-pages with one page. A 404 status code gets the page at /404.html on the connector with ID 123475:
Pass the file to the create command:
The command prints the ID of the set:
List
azion list custom-pages lists the custom page sets of your account, 50 to a page:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--details | — | — | — | Adds the LAST EDITOR and LAST MODIFIED columns to the ID, NAME, and ACTIVE 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 sets on each page. |
This command returns the first page of a list split into pages of one set:
The command prints one row per set:
Describe
azion describe custom-pages prints the settings of one custom page set:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--custom-page-id | — | int | — | ID of the custom page set to describe. |
This command describes the set with ID 123:
The command prints the ID, the name, the last change, and the state of the set:
With --format json, the command prints the full object: active, created_at, id, is_versioned, last_editor, last_modified, name, pages, product_version, version, version_id, and version_state. Each entry of pages holds a code and a page object with a type and attributes: connector, custom_status_code, ttl, and uri.
An ID that does not exist fails with this error:
Update
azion update custom-pages changes the name, the active state, or the pages of a custom page set from a JSON file:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--custom-page-id | — | int | — | ID of the custom page set to update. |
--file | — | string | — | Required. Path to a JSON file with the attributes to change. Use - to read the JSON from standard input. Without it, the command asks for the path. |
This file renames the set to my-pages-updated:
Pass the file to the update command with the ID of the set:
The command prints the ID of the updated set:
The fields that the file leaves out keep their values. After this update, the set is still active and keeps its 404 page.
Delete
azion delete custom-pages deletes a custom page set:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--custom-page-id | — | int | — | ID of the custom page set to delete. |
This command deletes the set with ID 123:
The command confirms the deletion:
Use a JSON file
azion create custom-pages and azion update custom-pages read the custom page set from a JSON file with --file. This is the only way to pass its attributes.
The file carries the fields of the set:
nameandactivedescribe the set.pagesholds one entry per status code. Each entry carries the status code incode, as a string such as"404", and apageobject.page.typeispage_connector, andpage.attributescarriesconnector, the ID of the connector that serves the page,ttl, anduri, the path of the page on that connector.
For what each field does and the values it takes, refer to Custom page settings.
A page of type page_default that carries only ttl is refused before the set is created, although the file is valid JSON:
On update, the file carries only the fields to change, and the fields it leaves out keep their values.