Processing rules

Processing rules

GEThttps://cloud-api.calyptia.com/v1/pipelines/{pipelineID}/processing_rules
Authorization
Path parameters
pipelineID*string (uuid)
Query parameters
Response

OK

Headers
Body
id*string (uuid)
pipelineID*string (uuid)
configSectionID*string (uuid)
fileID*string (uuid)
match*string
Example: "*"
isMatchRegexp*boolean
actions*array of RuleActionV1 (object)
createdAt*string (date-time)
updatedAt*string (date-time)
Request
const response = await fetch('https://cloud-api.calyptia.com/v1/pipelines/{pipelineID}/processing_rules', {
    method: 'GET',
    headers: {
      "Authorization": "Bearer <token>"
    },
});
const data = await response.json();
Response
[
  {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "pipelineID": "123e4567-e89b-12d3-a456-426614174000",
    "configSectionID": "123e4567-e89b-12d3-a456-426614174000",
    "fileID": "123e4567-e89b-12d3-a456-426614174000",
    "match": "*",
    "isMatchRegexp": false,
    "actions": [
      {
        "description": "Sample action",
        "enabled": true,
        "selectors": [
          {
            "expr": "some_key"
          }
        ],
        "add": {
          "key": "some_key",
          "value": "some_value"
        },
        "renameTo": "renamed",
        "copyAs": "copied",
        "maskWith": "masked"
      }
    ],
    "createdAt": "2024-10-06T09:40:44.197Z",
    "updatedAt": "2024-10-06T09:40:44.197Z"
  }
]

Create a processing rule

Create a processing rule in the given pipeline. Only one processing rule is allowed per pipeline.

POSThttps://cloud-api.calyptia.com/v1/pipelines/{pipelineID}/processing_rules
Authorization
Path parameters
pipelineID*string (uuid)
Body
match*string
Example: "*"
isMatchRegexp*boolean
actions*array of RuleActionV1 (object)
Response

Created

Body
id*string (uuid)
configSectionID*string (uuid)
fileID*string (uuid)
createdAt*string (uuid)
Request
const response = await fetch('https://cloud-api.calyptia.com/v1/pipelines/{pipelineID}/processing_rules', {
    method: 'POST',
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      "match": "*",
      "isMatchRegexp": false,
      "language": "lua",
      "actions": [
        {
          "kind": "add",
          "description": "Sample action",
          "enabled": true,
          "selectors": [
            {
              "kind": "key",
              "op": "equal",
              "expr": "some_key"
            }
          ]
        }
      ]
    }),
});
const data = await response.json();
Response
{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "configSectionID": "123e4567-e89b-12d3-a456-426614174000",
  "fileID": "123e4567-e89b-12d3-a456-426614174000",
  "createdAt": "123e4567-e89b-12d3-a456-426614174000"
}