fastly routing-config path rule create
Create a rule within a path.
Syntax
$ fastly routing-config path rule create --file=FILE --path-id=PATH-ID --routing-config-id=ROUTING-CONFIG-IDOptions
| Key | Required? | Default | Description |
|---|---|---|---|
--file | Yes | Path to a JSON file describing the rule, e.g. {"action": {"type": "service", "value": "..."}, "conditions": [...]}. Omit "conditions" to create the default (catch-all) rule for the path | |
--path-id | Yes | The Path Identifier | |
--routing-config-id | Yes | The Routing Config Identifier |
Global options
| Key | Required? | Default | Description |
|---|---|---|---|
--help | No | Show context-sensitive help. | |
--accept-defaults | No | Accept default options for all interactive prompts apart from Yes/No confirmations | |
--auto-yes | No | Answer yes automatically to all Yes/No confirmations. This may suppress security warnings | |
--debug-mode | No | Print API request and response details (NOTE: can disrupt the normal CLI flow output formatting) | |
--non-interactive | No | Do not prompt for user input - suitable for CI processes. Equivalent to --accept-defaults and --auto-yes | |
--quiet | No | Silence all output except direct command output. This won't prevent interactive prompts (see: --accept-defaults, --auto-yes, --non-interactive) | |
--token | No | Fastly API token, or name of a stored auth token (use 'default' for the default token). Falls back to FASTLY_API_TOKEN env var | |
--verbose | No | Verbose logging |
Examples
Create the default (catch-all) rule for a path
Where rule.json contains {"action": {"type": "service", "value": "SU1Z0isxPaozGVKXdv0eY"}}, with no "conditions" field, to create the default (catch-all) rule for the path.
$ fastly routing-config path rule create --routing-config-id 1a2b3c4d --path-id 5e6f7g8h --file rule.jsonCreate a conditional rule within a path
Where rule.json contains {"action": {"type": "service", "value": "SU1Z0isxPaozGVKXdv0eY"}, "conditions": [{"type": "header", "key": "X-Test", "operator": "equals", "value": "1"}]}.
$ fastly routing-config path rule create --routing-config-id 1a2b3c4d --path-id 5e6f7g8h --file rule.jsonAPI equivalent
This command internally uses the following Fastly public APIs: