Skip to content

Commit

Permalink
feat(cloudfront): add ability to set RealtimeLogConfigARN (#2301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffaello authored Jan 27, 2022
1 parent 0764346 commit 04fec27
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "mycustomorigin.com",
Expand Down Expand Up @@ -227,6 +228,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": "realtime_log_config_ARN",
"ResponseHeadersPolicyId": "uuid",
"SmoothStreaming": true,
"TargetOriginId": "mycustomorigin.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "mycustomorigin.com",
Expand Down Expand Up @@ -165,6 +166,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "mycustomoriginupdated.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "exampleorigin.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "exampleorigin.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "exampleorigin.com",
Expand Down Expand Up @@ -154,6 +155,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "exampleorigin.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "exampleorigin.com",
Expand Down Expand Up @@ -253,6 +254,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "exampleorigin.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "mybucket",
Expand Down Expand Up @@ -150,6 +151,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "mybucket",
Expand Down Expand Up @@ -238,6 +240,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "anotherbucket",
Expand Down Expand Up @@ -329,6 +332,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "mybucket",
Expand Down Expand Up @@ -417,6 +421,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "anotherbucket",
Expand Down Expand Up @@ -508,6 +513,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "mybucket.with.dots",
Expand Down Expand Up @@ -596,6 +602,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "anotherbucket",
Expand Down Expand Up @@ -687,6 +694,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "mybucket.s3.s3",
Expand Down Expand Up @@ -775,6 +783,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "anotherbucket",
Expand Down Expand Up @@ -866,6 +875,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "mybucket",
Expand Down Expand Up @@ -954,6 +964,7 @@ Object {
},
"MaxTTL": 31536000,
"MinTTL": 0,
"RealtimeLogConfigArn": undefined,
"ResponseHeadersPolicyId": "",
"SmoothStreaming": false,
"TargetOriginId": "anotherbucket",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ describe("Input origin as a custom url", () => {
smoothStreaming: true,
compress: true,
fieldLevelEncryptionId: "123",
responseHeadersPolicyId: "uuid"
responseHeadersPolicyId: "uuid",
realtimeLogConfigArn: "realtime_log_config_ARN"
},
origins: ["https://mycustomorigin.com"]
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type DefaultCacheBehavior = {
viewerProtocolPolicy?: string;
fieldLevelEncryptionId?: string;
responseHeadersPolicyId?: string;
realtimeLogConfigArn?: string;
};

export default (originId, defaults: DefaultCacheBehavior = {}) => {
Expand All @@ -25,7 +26,8 @@ export default (originId, defaults: DefaultCacheBehavior = {}) => {
smoothStreaming = false,
viewerProtocolPolicy = "redirect-to-https",
fieldLevelEncryptionId = "",
responseHeadersPolicyId = ""
responseHeadersPolicyId = "",
realtimeLogConfigArn = undefined
} = defaults;

const defaultCacheBehavior = {
Expand Down Expand Up @@ -55,7 +57,8 @@ export default (originId, defaults: DefaultCacheBehavior = {}) => {
Items: []
},
FieldLevelEncryptionId: fieldLevelEncryptionId,
ResponseHeadersPolicyId: responseHeadersPolicyId
ResponseHeadersPolicyId: responseHeadersPolicyId,
RealtimeLogConfigArn: realtimeLogConfigArn
};

addLambdaAtEdgeToCacheBehavior(defaultCacheBehavior, defaults["lambda@edge"]);
Expand Down

0 comments on commit 04fec27

Please sign in to comment.