Skip to main content

Module shared

Module shared 

Source
Expand description

Primitives shared across the AWS Amplify (amplify) handlers: ARN synthesis, deterministic id derivation, timestamps, and default-domain / webhook-URL construction. Kept in one place so the create / get paths cannot diverge on wire format.

Functions§

access_log_url
A presigned access-log download URL.
app_arn
The AWS Amplify app ARN, arn:aws:amplify:{region}:{account}:apps/{app_id}.
artifact_url
The artifact download URL for a build artifact.
backend_environment_arn
The backend-environment ARN, .../apps/{app_id}/backendenvironments/{name}.
branch_arn
The branch ARN, .../apps/{app_id}/branches/{branch}.
certificate_verification_dns_record
The ACM certificate-verification DNS record AWS surfaces while a domain is being verified.
decode_artifact_id
Reverse encode_artifact_id. Returns None for an id we did not mint.
default_domain
The default *.amplifyapp.com domain AWS assigns every app.
domain_arn
The domain-association ARN, .../apps/{app_id}/domains/{domain}.
encode_artifact_id
Encode an artifact id so GetArtifactUrl can resolve it back to its (app_id, branch, job_id, file_name) without a lookup table. AWS artifact ids are opaque; ours are a reversible base64url blob.
hash_str
FNV-1a hash for deterministic synthesis of ids / hosts from a seed so a given resource’s derived value is stable across reads and restarts.
job_arn
The job ARN, .../apps/{app_id}/branches/{branch}/jobs/{job_id}.
new_app_id
Generate a fresh Amplify app id of AWS’s ^d[a-z0-9]+$ form: a d prefix followed by 24 lowercase base-36 characters (well within the 1..=20… — AWS app ids are 14 chars, so we emit d + 13 chars = 14 total).
new_webhook_id
Generate a fresh webhook id (a UUID; Amplify’s WebhookId pattern accepts any string).
now_epoch
Current time as restJson1 epoch-seconds (a floating-point number). Amplify’s timestamp members carry no @timestampFormat, so restJson1’s default epoch-seconds applies – the AWS SDK parses the numeric value.
parse_resource_arn
Parse an Amplify ResourceArn into (app_id, Option<branch>) for the tagging operations. Only apps and branches carry tags in the model.
subdomain_dns_record
The DNS record a subdomain resolves to (a CNAME onto the app’s default domain).
thumbnail_url
A branch thumbnail URL (a presigned-style URL over the Amplify CDN).
upload_url
A presigned S3 upload URL for a manual deployment file.
webhook_arn
The webhook ARN, .../apps/{app_id}/webhooks/{webhook_id}.
webhook_url
The webhook trigger URL AWS provisions, of the form https://webhooks.amplify.{region}.amazonaws.com/prod/webhooks?id={id}&token={token}&operation=startbuild.