Modifying a Listener Rule

You can modify an existing listener rule that you created.

This action updates the pattern of the specified rule to distribute traffic to the registered backend virtual machines (VMs). Any attribute that you do not update retains its current value.

To display the pattern and registered VMs of your listener rules, see Getting Information About Your Listener Rules.

To modify the list of backend VMs for a listener rule, you need to delete the rule and create a new one.

Modifying a Listener Rule Using OSC CLI

The UpdateListenerRule command updates the pattern of the listener rule.
This call updates the pattern matching algorithm for incoming traffic.

Request sample
$ osc-cli api UpdateListenerRule --profile "default" \
    --ListenerRuleName "example-listener-rule" \
    --HostPattern "*.newhost.com"

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • HostPattern: (optional) A host-name pattern for the rule, with a maximum length of 128 characters. This host-name pattern supports maximum three wildcards, and must not contain any special characters except -.?.

  • ListenerRuleName: The name of the listener rule.

  • PathPattern: (optional) A path pattern for the rule, with a maximum length of 128 characters. This path pattern supports maximum three wildcards, and must not contain any special characters except _-.$/~"'@:+?.

The UpdateListenerRule command returns the following elements:

  • ListenerRule: Information about the listener rule.

    • Action: The type of action for the rule (always forward).

    • HostNamePattern: A host-name pattern for the rule, with a maximum length of 128 characters. This host-name pattern supports maximum three wildcards, and must not contain any special characters except -.?.

    • ListenerId: The ID of the listener.

    • ListenerRuleId: The ID of the listener rule.

    • ListenerRuleName: A human-readable name for the listener rule.

    • PathPattern: A path pattern for the rule, with a maximum length of 128 characters. This path pattern supports maximum three wildcards, and must not contain any special characters except _-.$/~"'@:+?.

    • Priority: The priority level of the listener rule, between 1 and 19999 both included. Each rule must have a unique priority level. Otherwise, an error is returned.

    • VmIds: The IDs of the backend VMs.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "ListenerRule": {
    "Priority": 10,
    "VmIds": [
      "i-12345678"
    ],
    "ListenerRuleName": "example-listener-rule",
    "Action": "forward",
    "ListenerId": 123456,
    "HostNamePattern": "*.newhost.com",
    "ListenerRuleId": 1234
  }
}

Modifying a Listener Rule Using oapi-cli

The UpdateListenerRule command updates the pattern of the listener rule.
This call updates the pattern matching algorithm for incoming traffic.

Request sample
$ oapi-cli --profile "default" UpdateListenerRule \
    --ListenerRuleName "example-listener-rule" \
    --HostPattern "*.newhost.com"

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • HostPattern: (optional) A host-name pattern for the rule, with a maximum length of 128 characters. This host-name pattern supports maximum three wildcards, and must not contain any special characters except -.?.

  • ListenerRuleName: The name of the listener rule.

  • PathPattern: (optional) A path pattern for the rule, with a maximum length of 128 characters. This path pattern supports maximum three wildcards, and must not contain any special characters except _-.$/~"'@:+?.

The UpdateListenerRule command returns the following elements:

  • ListenerRule: Information about the listener rule.

    • Action: The type of action for the rule (always forward).

    • HostNamePattern: A host-name pattern for the rule, with a maximum length of 128 characters. This host-name pattern supports maximum three wildcards, and must not contain any special characters except -.?.

    • ListenerId: The ID of the listener.

    • ListenerRuleId: The ID of the listener rule.

    • ListenerRuleName: A human-readable name for the listener rule.

    • PathPattern: A path pattern for the rule, with a maximum length of 128 characters. This path pattern supports maximum three wildcards, and must not contain any special characters except _-.$/~"'@:+?.

    • Priority: The priority level of the listener rule, between 1 and 19999 both included. Each rule must have a unique priority level. Otherwise, an error is returned.

    • VmIds: The IDs of the backend VMs.

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the request.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  },
  "ListenerRule": {
    "Priority": 10,
    "VmIds": [
      "i-12345678"
    ],
    "ListenerRuleName": "example-listener-rule",
    "Action": "forward",
    "ListenerId": 123456,
    "HostNamePattern": "*.newhost.com",
    "ListenerRuleId": 1234
  }
}

Related Pages

Corresponding API Methods