|
7 | 7 | Policy, |
8 | 8 | PolicyStatus, |
9 | 9 | PublicAccessBlockConfiguration, |
| 10 | + ServerSideEncryptionConfiguration, |
10 | 11 | } from 'aws-sdk/clients/s3' |
11 | 12 |
|
12 | 13 | import { AwsS3 } from '../../types/generated' |
@@ -138,10 +139,16 @@ export default ({ |
138 | 139 | corsAdditions.corsConfiguration = t.yes |
139 | 140 | } |
140 | 141 |
|
141 | | - const encryptionAdditions = { encrypted: t.no } |
| 142 | + const encryptionAdditions = { encrypted: t.no, encryptionRules: [] } |
142 | 143 |
|
143 | 144 | if (!isEmpty(encryptionInfo)) { |
| 145 | + const { Rules } = encryptionInfo as ServerSideEncryptionConfiguration |
144 | 146 | encryptionAdditions.encrypted = t.yes |
| 147 | + encryptionAdditions.encryptionRules = Rules.map(r => ({ |
| 148 | + id: cuid(), |
| 149 | + sseAlgorithm: r.ApplyServerSideEncryptionByDefault?.SSEAlgorithm, |
| 150 | + kmsMasterKeyID: r.ApplyServerSideEncryptionByDefault?.KMSMasterKeyID, |
| 151 | + })) |
145 | 152 | } |
146 | 153 |
|
147 | 154 | const replicationAdditions = { crossRegionReplication: t.disabled } |
@@ -182,36 +189,42 @@ export default ({ |
182 | 189 | LambdaFunctionConfigurations: lambdaFunctionConfigurations = [], |
183 | 190 | }: NotificationConfiguration = notificationConfiguration |
184 | 191 | notificationConfigurationData = { |
185 | | - topicConfigurations: topicConfigurations?.map(tc => ({ |
186 | | - id: tc.Id || cuid(), |
187 | | - topicArn: tc.TopicArn, |
188 | | - events: tc.Events || [], |
189 | | - filterRules: tc.Filter?.Key?.FilterRules?.map(r => ({ |
190 | | - id: cuid(), |
191 | | - name: r.Name, |
192 | | - value: r.Value, |
| 192 | + topicConfigurations: |
| 193 | + topicConfigurations?.map(tc => ({ |
| 194 | + id: tc.Id || cuid(), |
| 195 | + topicArn: tc.TopicArn, |
| 196 | + events: tc.Events || [], |
| 197 | + filterRules: |
| 198 | + tc.Filter?.Key?.FilterRules?.map(r => ({ |
| 199 | + id: cuid(), |
| 200 | + name: r.Name, |
| 201 | + value: r.Value, |
| 202 | + })) || [], |
193 | 203 | })) || [], |
194 | | - })) || [], |
195 | | - queueConfigurations: queueConfigurations?.map(qc => ({ |
196 | | - id: qc.Id || cuid(), |
197 | | - queueArn: qc.QueueArn, |
198 | | - events: qc.Events || [], |
199 | | - filterRules: qc.Filter?.Key?.FilterRules?.map(r => ({ |
200 | | - id: cuid(), |
201 | | - name: r.Name, |
202 | | - value: r.Value, |
| 204 | + queueConfigurations: |
| 205 | + queueConfigurations?.map(qc => ({ |
| 206 | + id: qc.Id || cuid(), |
| 207 | + queueArn: qc.QueueArn, |
| 208 | + events: qc.Events || [], |
| 209 | + filterRules: |
| 210 | + qc.Filter?.Key?.FilterRules?.map(r => ({ |
| 211 | + id: cuid(), |
| 212 | + name: r.Name, |
| 213 | + value: r.Value, |
| 214 | + })) || [], |
203 | 215 | })) || [], |
204 | | - })) || [], |
205 | | - lambdaFunctionConfigurations: lambdaFunctionConfigurations?.map(lc => ({ |
206 | | - id: lc.Id || cuid(), |
207 | | - lambdaFunctionArn: lc.LambdaFunctionArn, |
208 | | - events: lc.Events || [], |
209 | | - filterRules: lc.Filter?.Key?.FilterRules?.map(r => ({ |
210 | | - id: cuid(), |
211 | | - name: r.Name, |
212 | | - value: r.Value, |
| 216 | + lambdaFunctionConfigurations: |
| 217 | + lambdaFunctionConfigurations?.map(lc => ({ |
| 218 | + id: lc.Id || cuid(), |
| 219 | + lambdaFunctionArn: lc.LambdaFunctionArn, |
| 220 | + events: lc.Events || [], |
| 221 | + filterRules: |
| 222 | + lc.Filter?.Key?.FilterRules?.map(r => ({ |
| 223 | + id: cuid(), |
| 224 | + name: r.Name, |
| 225 | + value: r.Value, |
| 226 | + })) || [], |
213 | 227 | })) || [], |
214 | | - })) || [], |
215 | 228 | } |
216 | 229 | } |
217 | 230 |
|
@@ -243,12 +256,13 @@ export default ({ |
243 | 256 | : `${total}`, |
244 | 257 | transferAcceleration: accelerationStatus, |
245 | 258 | notificationConfiguration: notificationConfigurationData, |
246 | | - aclGrants: grants?.map(g => ({ |
247 | | - id: cuid(), |
248 | | - granteeType: g.Grantee?.Type, |
249 | | - granteeUri: g.Grantee?.URI, |
250 | | - permission: g.Permission, |
251 | | - })) || [], |
| 259 | + aclGrants: |
| 260 | + grants?.map(g => ({ |
| 261 | + id: cuid(), |
| 262 | + granteeType: g.Grantee?.Type, |
| 263 | + granteeUri: g.Grantee?.URI, |
| 264 | + permission: g.Permission, |
| 265 | + })) || [], |
252 | 266 | } |
253 | 267 | return s3 |
254 | 268 | } |
0 commit comments