@@ -17,94 +17,6 @@ import {
1717} from '../../types/generated'
1818import { RawAwsCloudfront } from './data'
1919
20- export const createCacheBehavior = (
21- cache : CacheBehavior
22- ) : AwsCloudfrontCacheBehavior => {
23- const {
24- AllowedMethods : {
25- Items : allowedMethods = [ ] ,
26- CachedMethods : { Items : cachedMethods = [ ] } = { Items : [ ] } ,
27- } = { } ,
28- Compress : compress ,
29- DefaultTTL : defaultTtl ,
30- ForwardedValues : {
31- Headers : { Items : headers } = { } ,
32- QueryString : queryString ,
33- } = { } ,
34- MaxTTL : maxTtl ,
35- MinTTL : minTtl ,
36- PathPattern : patternPath ,
37- SmoothStreaming : smoothStreaming ,
38- TargetOriginId : targetOriginId ,
39- ViewerProtocolPolicy : viewerProtocolPolicy ,
40- } = cache
41-
42- const forwardedValues = {
43- headers,
44- queryString : queryString ? t . yes : t . no ,
45- }
46-
47- return {
48- id : generateUniqueId ( {
49- ...cache ,
50- } ) ,
51- allowedMethods,
52- cachedMethods,
53- compress : compress ? t . yes : t . no ,
54- defaultTtl : defaultTtl ? `${ defaultTtl } ${ t . seconds } ` : null ,
55- forwardedValues,
56- maxTtl : maxTtl ? `${ maxTtl } ${ t . seconds } ` : null ,
57- minTtl : minTtl ? `${ minTtl } ${ t . seconds } ` : null ,
58- patternPath,
59- smoothStreaming : smoothStreaming ? t . yes : t . no ,
60- targetOriginId,
61- viewerProtocolPolicy,
62- }
63- }
64-
65- export const createDefaultCacheBehavior = (
66- cache : DefaultCacheBehavior
67- ) : AwsCloudfrontCacheBehavior => {
68- const {
69- AllowedMethods : {
70- Items : allowedMethods = [ ] ,
71- CachedMethods : { Items : cachedMethods = [ ] } = { Items : [ ] } ,
72- } = { } ,
73- Compress : compress ,
74- DefaultTTL : defaultTtl ,
75- ForwardedValues : {
76- Headers : { Items : headers } = { } ,
77- QueryString : queryString ,
78- } = { } ,
79- MaxTTL : maxTtl ,
80- MinTTL : minTtl ,
81- SmoothStreaming : smoothStreaming ,
82- TargetOriginId : targetOriginId ,
83- ViewerProtocolPolicy : viewerProtocolPolicy ,
84- } = cache
85-
86- const forwardedValues = {
87- headers,
88- queryString : queryString ? t . yes : t . no ,
89- }
90-
91- return {
92- id : generateUniqueId ( {
93- ...cache ,
94- } ) ,
95- allowedMethods,
96- cachedMethods,
97- compress : compress ? t . yes : t . no ,
98- defaultTtl : defaultTtl ? `${ defaultTtl } ${ t . seconds } ` : null ,
99- forwardedValues,
100- maxTtl : maxTtl ? `${ maxTtl } ${ t . seconds } ` : null ,
101- minTtl : minTtl ? `${ minTtl } ${ t . seconds } ` : null ,
102- smoothStreaming : smoothStreaming ? t . yes : t . no ,
103- targetOriginId,
104- viewerProtocolPolicy,
105- }
106- }
107-
10820/**
10921 * CloudFront
11022 */
@@ -157,6 +69,96 @@ export default ({
15769 Tags = { } ,
15870 } : RawAwsCloudfront = service
15971
72+ const createCacheBehavior = (
73+ cache : CacheBehavior
74+ ) : AwsCloudfrontCacheBehavior => {
75+ const {
76+ AllowedMethods : {
77+ Items : allowedMethods = [ ] ,
78+ CachedMethods : { Items : cachedMethods = [ ] } = { Items : [ ] } ,
79+ } = { } ,
80+ Compress : compress ,
81+ DefaultTTL : defaultTtl ,
82+ ForwardedValues : {
83+ Headers : { Items : headers } = { } ,
84+ QueryString : queryString ,
85+ } = { } ,
86+ MaxTTL : maxTtl ,
87+ MinTTL : minTtl ,
88+ PathPattern : patternPath ,
89+ SmoothStreaming : smoothStreaming ,
90+ TargetOriginId : targetOriginId ,
91+ ViewerProtocolPolicy : viewerProtocolPolicy ,
92+ } = cache
93+
94+ const forwardedValues = {
95+ headers,
96+ queryString : queryString ? t . yes : t . no ,
97+ }
98+
99+ return {
100+ id : generateUniqueId ( {
101+ arn,
102+ ...cache ,
103+ } ) ,
104+ allowedMethods,
105+ cachedMethods,
106+ compress : compress ? t . yes : t . no ,
107+ defaultTtl : defaultTtl ? `${ defaultTtl } ${ t . seconds } ` : null ,
108+ forwardedValues,
109+ maxTtl : maxTtl ? `${ maxTtl } ${ t . seconds } ` : null ,
110+ minTtl : minTtl ? `${ minTtl } ${ t . seconds } ` : null ,
111+ patternPath,
112+ smoothStreaming : smoothStreaming ? t . yes : t . no ,
113+ targetOriginId,
114+ viewerProtocolPolicy,
115+ }
116+ }
117+
118+ const createDefaultCacheBehavior = (
119+ cache : DefaultCacheBehavior
120+ ) : AwsCloudfrontCacheBehavior => {
121+ const {
122+ AllowedMethods : {
123+ Items : allowedMethods = [ ] ,
124+ CachedMethods : { Items : cachedMethods = [ ] } = { Items : [ ] } ,
125+ } = { } ,
126+ Compress : compress ,
127+ DefaultTTL : defaultTtl ,
128+ ForwardedValues : {
129+ Headers : { Items : headers } = { } ,
130+ QueryString : queryString ,
131+ } = { } ,
132+ MaxTTL : maxTtl ,
133+ MinTTL : minTtl ,
134+ SmoothStreaming : smoothStreaming ,
135+ TargetOriginId : targetOriginId ,
136+ ViewerProtocolPolicy : viewerProtocolPolicy ,
137+ } = cache
138+
139+ const forwardedValues = {
140+ headers,
141+ queryString : queryString ? t . yes : t . no ,
142+ }
143+
144+ return {
145+ id : generateUniqueId ( {
146+ arn,
147+ ...cache ,
148+ } ) ,
149+ allowedMethods,
150+ cachedMethods,
151+ compress : compress ? t . yes : t . no ,
152+ defaultTtl : defaultTtl ? `${ defaultTtl } ${ t . seconds } ` : null ,
153+ forwardedValues,
154+ maxTtl : maxTtl ? `${ maxTtl } ${ t . seconds } ` : null ,
155+ minTtl : minTtl ? `${ minTtl } ${ t . seconds } ` : null ,
156+ smoothStreaming : smoothStreaming ? t . yes : t . no ,
157+ targetOriginId,
158+ viewerProtocolPolicy,
159+ }
160+ }
161+
160162 const customErrorResponses : AwsCloudfrontCustomErrorResponse [ ] = cer . map (
161163 ( {
162164 ErrorCachingMinTTL : errorCachingMinTtl ,
@@ -165,6 +167,7 @@ export default ({
165167 ResponsePagePath : responsePagePath ,
166168 } ) => ( {
167169 id : generateUniqueId ( {
170+ arn,
168171 errorCachingMinTtl,
169172 errorCode,
170173 responseCode,
@@ -210,10 +213,12 @@ export default ({
210213 } = origin
211214 return {
212215 id : generateUniqueId ( {
216+ arn,
213217 ...origin ,
214218 } ) ,
215219 customHeaders : customHeader . map ( ( { HeaderName, HeaderValue } ) => ( {
216220 id : generateUniqueId ( {
221+ arn,
217222 HeaderName,
218223 HeaderValue,
219224 } ) ,
0 commit comments