Skip to content

Commit

Permalink
Update javadoc and example with new policy
Browse files Browse the repository at this point in the history
  • Loading branch information
harjain99 committed Jun 18, 2024
1 parent c0d8a28 commit 0995301
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 17 deletions.
71 changes: 70 additions & 1 deletion examples/cloudfront/cloudfront.gyro
Original file line number Diff line number Diff line change
@@ -1,3 +1,71 @@
aws::cloudfront-cache-policy cache-policy-example
cache-policy-config
default-ttl: 3600
max-ttl: 86400
min-ttl: 0
name: "cache-policy-example"

key-param
accept-encoding-brotli: true
accept-encoding-gzip: true

headers-config
header-behavior: "whitelist"
headers: [
"example-header1",
"example-header2"
]
end

query-strings-config
query-string-behavior: "whitelist"
query-strings: [
"example-query1",
"example-query2"
]
end

cookies-config
cookie-behavior: "whitelist"
cookies: [
"example-cookie1",
"example-cookie2"
]
end
end
end
end

aws::cloudfront-origin-request-policy origin-request-policy-example
origin-request-policy-config
name: "origin-request-policy-example"

headers-config
header-behavior: "whitelist"
headers: [
"example-header1",
"example-header2"
]
end

query-strings-config
query-string-behavior: "whitelist"
query-strings: [
"example-query1",
"example-query2"
]
end

cookies-config
cookie-behavior: "whitelist"
cookies: [
"example-cookie1",
"example-cookie2"
]
end
end
end

aws::cloudfront cloudfront-example
enabled: true
ipv6-enabled: false
Expand All @@ -22,7 +90,8 @@ aws::cloudfront cloudfront-example
viewer-protocol-policy: "allow-all"
allowed-methods: ["GET", "HEAD"]
cached-methods: ["GET", "HEAD"]
headers: ["Origin"]
cache-policy: $(aws::cloudfront-cache-policy cache-policy-example)
origin-request-policy: $(aws::cloudfront-origin-request-policy origin-request-policy-example)
end

behavior
Expand Down
34 changes: 18 additions & 16 deletions src/main/java/gyro/aws/cloudfront/CloudFrontResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@
* aws::cloudfront cloudfront-example
* enabled: true
* ipv6-enabled: false
* comment: "cloudfront-example - static asset cache"
* comment: "$(project) - static asset cache"
*
* origin
* id: $(aws::s3-bucket bucket).name
* id: "S3-$(project)-brightspot"
* domain-name: "$(project)-brightspot.s3.us-east-1.amazonaws.com"
* end
*
* origin
* id: "elb-$(project)-web"
* domain-name: "www.google.com"
*
* custom-origin
Expand All @@ -85,16 +90,17 @@
* end
*
* default-cache-behavior
* target-origin-id: $(aws::s3-bucket bucket).name
* target-origin-id: "S3-$(project)-brightspot"
* viewer-protocol-policy: "allow-all"
* allowed-methods: ["GET", "HEAD"]
* cached-methods: ["GET", "HEAD"]
* headers: ["Origin"]
* cache-policy: $(aws::cloudfront-cache-policy cache-policy-example)
* origin-request-policy: $(aws::cloudfront-origin-request-policy origin-request-policy-example)
* end
*
* behavior
* path-pattern: "/dims?/*"
* target-origin-id: $(aws::s3-bucket bucket).name
* target-origin-id: "elb-$(project)-web"
* viewer-protocol-policy: "allow-all"
* allowed-methods: ["GET", "HEAD"]
* query-string: true
Expand All @@ -105,21 +111,17 @@
* restrictions: ["US"]
* end
*
* custom-error-response
* error-code: 400
* ttl: 0
* end
*
* logging
* bucket: $(aws::s3-bucket bucket)
* bucket-prefix: "my-bucket/logs"
* include-cookies: false
* end
* @for error-code, ttl -in [400, 0, 403, 5, 404, 5, 500, 0, 502, 0, 503, 0, 504, 0]
* custom-error-response
* error-code: $(error-code)
* ttl: $(ttl)
* end
* @end
*
* tags: {
* Name: "content cache"
* }
* end
* end
*/
@Type("cloudfront")
public class CloudFrontResource extends AwsResource implements Copyable<Distribution> {
Expand Down

0 comments on commit 0995301

Please sign in to comment.