Skip to main content

Module shared

Module shared 

Source
Expand description

Primitives shared across the Amazon Translate handlers: ARN synthesis, deterministic id derivation, timestamps, and terminology-file parsing. Kept in one place so the create / get paths cannot diverge on wire format.

Structs§

FileFacts
Facts read from an imported terminology / parallel-data file.

Functions§

data_location
A service-managed S3 location Translate exposes for a downloadable resource file (terminology / parallel-data). The file itself is not produced; this is the presigned-style location it would live at.
decode_blob
Decode a wire blob member. awsJson1_1 base64-encodes blobs; the AWS SDK and terraform always send base64. If the value is not valid base64 (e.g. a raw synthetic probe string) fall back to the raw UTF-8 bytes so the parser never panics on unexpected input.
hash_str
FNV-1a hash for deterministic synthesis of ids from a seed so a given resource’s derived value is stable across reads and restarts.
job_id
A 32-character lowercase-hex job id (matching the JobId @length max of 32 and the permissive JobId pattern). Derived deterministically from a seed so repeated calls in a test are stable, but seeded with a UUID at the call site to stay unique across jobs.
now_epoch
Current time as awsJson1_1 epoch-seconds (a floating-point number). The Translate Timestamp shape carries no @timestampFormat, so awsJson1_1’s default epoch-seconds applies.
parse_file
Parse a terminology / parallel-data file (CSV or TSV) for its size, record count, and language columns. This reads the caller-supplied data file only; it runs no translation. Unknown / binary formats yield just the byte size.
parse_resource_arn
Split a Translate ARN into (resource_type, name). arn:aws:translate:{region}:{account}:{type}/{name} -> (type, name).
resource_arn
Amazon Translate resource ARN, arn:aws:translate:{region}:{account}:{resource_type}/{name}.