Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Policy = Policy {}
- simplePolicy :: Resource -> Lifespan -> IO Policy
- newtype Resource = Resource Text
- data StartTime
- newtype EndTime = EndTime POSIXTime
- newtype Lifespan = Lifespan NominalDiffTime
- data IpAddress
- policyJSON :: Policy -> ByteString
- jsonTextPolicy :: Text -> Either String Policy
- jsonValPolicy :: Value -> Either String Policy
Defining a policy
A policy specifies what resource is being granted, for what time period, and to what IP addresses.
For AWS's documentation on what going into a CloudFront policy statement, see Values That You Specify in the Policy Statement for a Custom Policy for Signed Cookies.
Policy | |
|
Components of a policy
URL that a policy will grant access to, optionally containing asterisks for wildcards.
Examples:
"https:/
/d123example.cloudfront.net/index.html"
"https:/
/d123example.cloudfront.net/*.jpeg"
The time at which credentials begin to take effect
The IP address or address range of clients allowed to make requests
JSON representation
policyJSON :: Policy -> ByteString Source #
Encode a Policy
as JSON, with no whitespace, as AWS requires.
Excerpt from Setting Signed Cookies Using a Custom Policy:
- "Remove all whitespace (including tabs and newline characters) from the policy statement."