core: update b64encode and b64decode doc (#84757)

pull/83715/merge
Abhijeet Kasurde 9 months ago committed by GitHub
parent 4a710587dd
commit 650ee5abf8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -15,6 +15,12 @@ DOCUMENTATION:
description: A Base64 string to decode. description: A Base64 string to decode.
type: string type: string
required: true required: true
encoding:
description:
- The encoding to use to transform from a text string to a byte string.
- Defaults to using 'utf-8'.
type: string
required: false
EXAMPLES: | EXAMPLES: |
# Base64 decode a string # Base64 decode a string
@ -23,6 +29,10 @@ EXAMPLES: |
# Base64 decode the content of 'b64stuff' variable # Base64 decode the content of 'b64stuff' variable
stuff: "{{ b64stuff | b64decode }}" stuff: "{{ b64stuff | b64decode }}"
# Base64 decode the content with different encoding
stuff: "{{ 'QQBuAHMAaQBiAGwAZQAgAC0AIABPMIkwaDB/MAoA' | b64decode(encoding='utf-16-le') }}"
# => 'Ansible - くらとみ\n'
RETURN: RETURN:
_value: _value:
description: The contents of the Base64 encoded string. description: The contents of the Base64 encoded string.

@ -11,6 +11,12 @@ DOCUMENTATION:
description: A string to encode. description: A string to encode.
type: string type: string
required: true required: true
encoding:
description:
- The encoding to use to transform from a text string to a byte string.
- Defaults to using 'utf-8'.
type: string
required: false
EXAMPLES: | EXAMPLES: |
# Base64 encode a string # Base64 encode a string
@ -19,6 +25,10 @@ EXAMPLES: |
# Base64 encode the content of 'stuff' variable # Base64 encode the content of 'stuff' variable
b64stuff: "{{ stuff | b64encode }}" b64stuff: "{{ stuff | b64encode }}"
# Base64 encode the content with different encoding
b64stuff: "{{ 'Ansible - くらとみ\n' | b64encode(encoding='utf-16-le') }}"
# => 'QQBuAHMAaQBiAGwAZQAgAC0AIABPMIkwaDB/MAoA'
RETURN: RETURN:
_value: _value:
description: A Base64 encoded string. description: A Base64 encoded string.

Loading…
Cancel
Save