Skip to content

Create a pool rule

Request

Create a rule that assigns an attempt to a pool based on conditions. A rule consists of a priority, conditions, and a pool ID. Rules are evaluated in priority order, from the lowest value to the highest value. Multiple rules cannot have the same priority. If all of a rule's conditions are met, an attempt is assigned to its pool. If none of the rules are met, an attempt is assigned to a default pool.

Security
ApiKeyAuth
Bodyapplication/jsonrequired
conditionsArray of objects, [ 1 .. 2 ] items(RestPoolRuleCondition)required

Conditions that must be met for the rule to assign an attempt to a pool. If multiple conditions are specified, all conditions must be met.

poolIdstring, >= 1required

ID of the pool that this rule assigns attempts to.

Example:"42"
priorityinteger, (int32), [ 1 .. 10000 ]required

Priority of the rule. Rules are evaluated in priority order, from the lowest value to the highest value. Multiple rules cannot have the same priority.

Example:10
curl -i -X POST \
  https://api-workflow.treasuredata.com/api/pool_rules \
  -H 'Authorization: TD1 <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "conditions": [
      {
        "type": "invocation_type",
        "values": [
          "on_demand"
        ]
      }
    ],
    "poolId": "42",
    "priority": 10
  }'

Responses

Pool rule created

Bodyapplication/json
conditionsArray of objects, [ 1 .. 2 ] items(RestPoolRuleCondition)required

Conditions that must be met for the rule to assign an attempt to a pool. If multiple conditions are specified, all conditions must be met.

idstring, >= 1required

ID of the pool rule.

Example:"42"
poolIdstring, >= 1required

ID of the pool that this rule assigns attempts to.

Example:"42"
priorityinteger, (int32), [ 1 .. 10000 ]required

Priority of the rule. Rules are evaluated in priority order, from the lowest value to the highest value. Multiple rules cannot have the same priority.

Example:10
Response
{ "conditions": [ {} ], "id": "42", "poolId": "42", "priority": 10 }