Fugue.AWS.CloudFront.Compliance

Module Members

hasGeoRestrictionBlacklist

(Function)

Check that a WebDistribution blacklists specific countries.

For example, to check that Switzerland is blacklisted:

validate Fugue.AWS.CloudFront.Compliance.hasGeoRestrictionBlacklist {
  countries: ["CH"]
}

This is an simpler version of requireGeoRestriction.

Type Signature

 fun { countries: List<String>,
       references: Optional<List<String>> } -> fun (WebDistribution) -> Validation
Argument: countries

List of ISO 3166 country codes.

Type: List<String>

Argument: references
Type: Optional<List<String>>
Returns:
Type: fun ( WebDistribution) -> Validation

requireGeoRestriction

(Function)

Check that GEO restrictions satisfy a given predicate. If you just want to make sure specific countries are blacklisted, consider using the simpler hasGeoRestrictionBlacklist.

Example:

import Fugue.AWS.CloudFront as CloudFront
import Fugue.AWS.CloudFront.Compliance

validate Fugue.AWS.CloudFront.Compliance.requireGeoRestriction {
  predicate: isUSOnly
}

fun isUSOnly(gr: CloudFront.GeoRestriction) -> Bool:
  gr.(CloudFront.GeoRestriction).restrictionType == CloudFront.Whitelist &&
  gr.(CloudFront.GeoRestriction).items == ["US"]

Type Signature

 fun { predicate: fun (GeoRestriction) -> Bool,
       references: Optional<List<String>> } -> fun (WebDistribution) -> Validation
Argument: predicate
Type: fun ( GeoRestriction) -> Bool
Argument: references
Type: Optional<List<String>>
Returns:
Type: fun ( WebDistribution) -> Validation

requireHttpsCacheToViewer

(Function)

Check that CloudFront uses HTTPS to communicate in between the cache and the viewer.

Type Signature

 fun { references: Optional<List<String>> } -> fun (WebDistribution) -> Validation
Argument: references
Type: Optional<List<String>>
Returns:
Type: fun ( WebDistribution) -> Validation

requireHttpsOriginToCache

(Function)

Check that CloudFront uses HTTPS to communicate in between the origin and the cache.

Type Signature

 fun { references: Optional<List<String>> } -> fun (Origin) -> Validation
Argument: references
Type: Optional<List<String>>
Returns:
Type: fun ( Origin) -> Validation