Skip to main content

base64.encode

Encode a field to base64.

Description

The processor will encode the value of the target field to base64 and store the result in the target field. It is not allowed to encode the .Position field. If the provided field doesn't exist, the processor will create that field and assign its value.

Configuration parameters

version: 2.2
pipelines:
- id: example
status: running
connectors:
# define source and destination ...
processors:
- id: example
plugin: "base64.encode"
settings:
# Field is a reference to the target field. Note that it is not
# allowed to base64 encode the `.Position` field.
# For more information about the format, see [Referencing
# fields](https://conduit.io/docs/using/processors/referencing-fields).
# Type: string
field: ""
# Whether to decode the record key using its corresponding schema from
# the schema registry.
# Type: bool
sdk.schema.decode.key.enabled: "true"
# Whether to decode the record payload using its corresponding schema
# from the schema registry.
# Type: bool
sdk.schema.decode.payload.enabled: "true"
# Whether to encode the record key using its corresponding schema from
# the schema registry.
# Type: bool
sdk.schema.encode.key.enabled: "true"
# Whether to encode the record payload using its corresponding schema
# from the schema registry.
# Type: bool
sdk.schema.encode.payload.enabled: "true"

Examples

Encode record key to base64

TThis example takes a record containing raw data in .Key and converts it into a base64 encoded string.

Configuration parameters

version: 2.2
pipelines:
- id: example
status: running
connectors:
# define source and destination ...
processors:
- id: example
plugin: "base64.encode"
settings:
field: ".Key"

Record difference

Before
After
1
{
1
{
2
  "position": "dGVzdC1wb3NpdGlvbg==",
2
  "position": "dGVzdC1wb3NpdGlvbg==",
3
  "operation": "create",
3
  "operation": "create",
4
  "metadata": {
4
  "metadata": {
5
    "key1": "val1"
5
    "key1": "val1"
6
  },
6
  },
7
-
  "key": "test-key",
7
+
  "key": "dGVzdC1rZXk=",
8
  "payload": {
8
  "payload": {
9
    "before": null,
9
    "before": null,
10
    "after": {
10
    "after": {
11
      "foo": "bar"
11
      "foo": "bar"
12
    }
12
    }
13
  }
13
  }
14
}
14
}

Encode nested value to base64

This example takes a record containing a string in .Payload.Before.foo and converts it into a base64 encoded string.

Configuration parameters

version: 2.2
pipelines:
- id: example
status: running
connectors:
# define source and destination ...
processors:
- id: example
plugin: "base64.encode"
settings:
field: ".Payload.After.foo"

Record difference

Before
After
1
{
1
{
2
  "position": "dGVzdC1wb3NpdGlvbg==",
2
  "position": "dGVzdC1wb3NpdGlvbg==",
3
  "operation": "create",
3
  "operation": "create",
4
  "metadata": {
4
  "metadata": {
5
    "key1": "val1"
5
    "key1": "val1"
6
  },
6
  },
7
  "key": "test-key",
7
  "key": "test-key",
8
  "payload": {
8
  "payload": {
9
    "before": null,
9
    "before": null,
10
    "after": {
10
    "after": {
11
-
      "foo": "bar"
11
+
      "foo": "YmFy"
12
    }
12
    }
13
  }
13
  }
14
}
14
}

scarf pixel conduit-site-docs-using-processors