aws_encryption_sdk_cli.internal.io_handling
Helper functions for handling all input and output for this CLI.
Functions
|
Duplicates the source filename in the destination directory, adding or stripping a suffix as needed. |
Classes
|
Common handler for all IO operations. |
- class aws_encryption_sdk_cli.internal.io_handling.IOHandler(metadata_writer: MetadataWriter, interactive: bool, no_overwrite: bool, decode_input: bool, encode_output: bool, required_encryption_context: Dict[str, str], required_encryption_context_keys: List[str], commitment_policy: CommitmentPolicy, buffer_output, max_encrypted_data_keys: Union[None, int])
Bases:
object
Common handler for all IO operations. Holds common configuration values used for all operations.
- Parameters
metadata_writer (aws_encryption_sdk_cli.internal.metadata.MetadataWriter) – File-like to which metadata should be written
interactive (bool) – Should prompt before overwriting existing files
no_overwrite (bool) – Should never overwrite existing files
decode_input (bool) – Should input be base64 decoded before operation
encode_output (bool) – Should output be base64 encoded after operation
buffer_output (bool) – Should buffer entire output before releasing to destination
required_encryption_context (dict) – Encryption context key-value pairs to require
required_encryption_context_keys (list) – Encryption context keys to require
Workaround pending resolution of attrs/mypy interaction. https://github.com/python/mypy/issues/2088 https://github.com/python-attrs/attrs/issues/215
- process_single_operation(stream_args: Dict[str, Union[CryptoMaterialsManager, str, Dict[str, str], AlgorithmSuite, int]], source: Union[str, bytes, IO], destination: str) OperationResult
Processes a single encrypt/decrypt operation given a pre-loaded source.
- Parameters
- Returns
OperationResult stating whether the file was written
- Return type
- process_single_file(stream_args: Dict[str, Union[CryptoMaterialsManager, str, Dict[str, str], AlgorithmSuite, int]], source: str, destination: str) None
Processes a single encrypt/decrypt operation on a source file.
- aws_encryption_sdk_cli.internal.io_handling.output_filename(source_filename: str, destination_dir: str, mode: str, suffix: str) str
Duplicates the source filename in the destination directory, adding or stripping a suffix as needed.
- Parameters
- Returns
Full file path of new destination file in destination directory
- Return type