View Source Antikythera.Aws.CloudfrontSignedUrl (antikythera v0.5.1)

This module provides functions to generate a signed URL for CloudFront

Summary

Functions

Link to this function

generate_signed_url(resource_url, lifetime_in_seconds, key_pair_id, private_key, url_encoded? \\ false)

View Source
@spec generate_signed_url(
  String.t(),
  pos_integer(),
  String.t(),
  String.t(),
  boolean()
) :: String.t()

Generates a signed URL to access a file via CloudFront.

Parameters

  • resource_url (string): CloudFront URL used for accessing the file, including query string parameters, if any.
  • lifetime_in_seconds (positive integer): Expiration time is determined as the sum of the current time (in seconds) and this value.
  • key_pair_id (string): ID for an active CloudFront key pair used for generating the signature.
  • private_key (string): RSA private key for the key pair specified by key_pair_id.
  • url_encoded? (boolean): Whether resource_url is encoded or not (optional, default is false).

Return value

A generated signed URL (string).

Link to this function

generate_signed_url_using_custom_policy(resource_url, lifetime_in_seconds, key_pair_id, private_key, url_encoded? \\ false, optional_policy \\ [])

View Source
@spec generate_signed_url_using_custom_policy(
  String.t(),
  pos_integer(),
  String.t(),
  String.t(),
  boolean(),
  Keyword.t()
) :: String.t()

Generates a signed URL to access a file via CloudFront using a custom policy.

Parameters

  • resource_url (string): CloudFront URL used for accessing the file, including query string parameters, if any.
  • lifetime_in_seconds (positive integer): Expiration time is determined as the sum of the current time (in seconds) and this value.
  • key_pair_id (string): ID for an active CloudFront key pair used for generating the signature.
  • private_key (string): RSA private key for the key pair specified by key_pair_id.
  • url_encoded? (boolean): Whether resource_url is encoded or not (optional, default is false).
  • optional_policy (Keyword): Optional policy conditions to be added to a custom policy (default is []). Currently, supports only the following keywords:
    • :date_greater_than(integer >= 0): Seconds in AWS:EpochTime. Specified to DateGreaterThan
    • :ip_address (list of strings): Specified to IpAddress.

Return value

A generated signed URL (string).