@@ -179,6 +179,38 @@ func (rm *resourceManager) updateFunctionConfiguration(
179
179
}
180
180
}
181
181
182
+ if delta .DifferentAt ("Spec.Environment" ) {
183
+ environment := & svcsdk.Environment {}
184
+ if dspec .Environment != nil {
185
+ environment .Variables = dspec .Environment .DeepCopy ().Variables
186
+ }
187
+ input .Environment = environment
188
+ }
189
+
190
+ if delta .DifferentAt ("Spec.EphemeralStorage" ) {
191
+ ephemeralStorage := & svcsdk.EphemeralStorage {}
192
+ if dspec .EphemeralStorage != nil {
193
+ ephemeralStorageCopy := dspec .EphemeralStorage .DeepCopy ()
194
+ ephemeralStorage .Size = ephemeralStorageCopy .Size
195
+ }
196
+ input .EphemeralStorage = ephemeralStorage
197
+ }
198
+
199
+ if delta .DifferentAt ("Spec.FileSystemConfigs" ) {
200
+ fileSystemConfigs := []* svcsdk.FileSystemConfig {}
201
+ if len (dspec .FileSystemConfigs ) > 0 {
202
+ for _ , elem := range dspec .FileSystemConfigs {
203
+ elemCopy := elem .DeepCopy ()
204
+ fscElem := & svcsdk.FileSystemConfig {
205
+ Arn : elemCopy .ARN ,
206
+ LocalMountPath : elemCopy .LocalMountPath ,
207
+ }
208
+ fileSystemConfigs = append (fileSystemConfigs , fscElem )
209
+ }
210
+ input .FileSystemConfigs = fileSystemConfigs
211
+ }
212
+ }
213
+
182
214
if delta .DifferentAt ("Spec.Handler" ) {
183
215
if dspec .Handler != nil {
184
216
input .Handler = aws .String (* dspec .Handler )
@@ -187,6 +219,19 @@ func (rm *resourceManager) updateFunctionConfiguration(
187
219
}
188
220
}
189
221
222
+ if delta .DifferentAt ("Spec.ImageConfig" ) {
223
+ if dspec .ImageConfig != nil && dspec .Code .ImageURI != nil && * dspec .Code .ImageURI != "" {
224
+ imageConfig := & svcsdk.ImageConfig {}
225
+ if dspec .ImageConfig != nil {
226
+ imageConfigCopy := dspec .ImageConfig .DeepCopy ()
227
+ imageConfig .Command = imageConfigCopy .Command
228
+ imageConfig .EntryPoint = imageConfigCopy .EntryPoint
229
+ imageConfig .WorkingDirectory = imageConfigCopy .WorkingDirectory
230
+ }
231
+ input .ImageConfig = imageConfig
232
+ }
233
+ }
234
+
190
235
if delta .DifferentAt ("Spec.KMSKeyARN" ) {
191
236
if dspec .KMSKeyARN != nil {
192
237
input .KMSKeyArn = aws .String (* dspec .KMSKeyARN )
@@ -195,11 +240,14 @@ func (rm *resourceManager) updateFunctionConfiguration(
195
240
}
196
241
}
197
242
198
- if delta .DifferentAt ("Spec.Role" ) {
199
- if dspec .Role != nil {
200
- input .Role = aws .String (* dspec .Role )
201
- } else {
202
- input .Role = aws .String ("" )
243
+ if delta .DifferentAt ("Spec.Layers" ) {
244
+ layers := []* string {}
245
+ if len (dspec .Layers ) > 0 {
246
+ for _ , iter := range dspec .Layers {
247
+ var elem string = * iter
248
+ layers = append (layers , & elem )
249
+ }
250
+ input .Layers = layers
203
251
}
204
252
}
205
253
@@ -211,47 +259,28 @@ func (rm *resourceManager) updateFunctionConfiguration(
211
259
}
212
260
}
213
261
214
- if delta .DifferentAt ("Spec.Timeout " ) {
215
- if dspec .Timeout != nil {
216
- input .Timeout = aws .Int64 (* dspec .Timeout )
262
+ if delta .DifferentAt ("Spec.Role " ) {
263
+ if dspec .Role != nil {
264
+ input .Role = aws .String (* dspec .Role )
217
265
} else {
218
- input .Timeout = aws .Int64 (0 )
219
- }
220
- }
221
-
222
- if delta .DifferentAt ("Spec.Environment" ) {
223
- environment := & svcsdk.Environment {}
224
- if dspec .Environment != nil {
225
- environment .Variables = dspec .Environment .DeepCopy ().Variables
266
+ input .Role = aws .String ("" )
226
267
}
227
- input .Environment = environment
228
268
}
229
269
230
- if delta .DifferentAt ("Spec.FileSystemConfigs" ) {
231
- fileSystemConfigs := []* svcsdk.FileSystemConfig {}
232
- if len (dspec .FileSystemConfigs ) > 0 {
233
- for _ , elem := range dspec .FileSystemConfigs {
234
- elemCopy := elem .DeepCopy ()
235
- fscElem := & svcsdk.FileSystemConfig {
236
- Arn : elemCopy .ARN ,
237
- LocalMountPath : elemCopy .LocalMountPath ,
238
- }
239
- fileSystemConfigs = append (fileSystemConfigs , fscElem )
240
- }
241
- input .FileSystemConfigs = fileSystemConfigs
270
+ if delta .DifferentAt (("Spec.SnapStart" )) {
271
+ snapStart := & svcsdk.SnapStart {}
272
+ if dspec .SnapStart != nil {
273
+ snapStartCopy := dspec .SnapStart .DeepCopy ()
274
+ snapStart .ApplyOn = snapStartCopy .ApplyOn
242
275
}
276
+ input .SnapStart = snapStart
243
277
}
244
278
245
- if delta .DifferentAt ("Spec.ImageConfig" ) {
246
- if dspec .ImageConfig != nil && dspec .Code .ImageURI != nil && * dspec .Code .ImageURI != "" {
247
- imageConfig := & svcsdk.ImageConfig {}
248
- if dspec .ImageConfig != nil {
249
- imageConfigCopy := dspec .ImageConfig .DeepCopy ()
250
- imageConfig .Command = imageConfigCopy .Command
251
- imageConfig .EntryPoint = imageConfigCopy .EntryPoint
252
- imageConfig .WorkingDirectory = imageConfigCopy .WorkingDirectory
253
- }
254
- input .ImageConfig = imageConfig
279
+ if delta .DifferentAt ("Spec.Timeout" ) {
280
+ if dspec .Timeout != nil {
281
+ input .Timeout = aws .Int64 (* dspec .Timeout )
282
+ } else {
283
+ input .Timeout = aws .Int64 (0 )
255
284
}
256
285
}
257
286
@@ -273,24 +302,6 @@ func (rm *resourceManager) updateFunctionConfiguration(
273
302
input .VpcConfig = VPCConfig
274
303
}
275
304
276
- if delta .DifferentAt ("Spec.EphemeralStorage" ) {
277
- ephemeralStorage := & svcsdk.EphemeralStorage {}
278
- if dspec .EphemeralStorage != nil {
279
- ephemeralStorageCopy := dspec .EphemeralStorage .DeepCopy ()
280
- ephemeralStorage .Size = ephemeralStorageCopy .Size
281
- }
282
- input .EphemeralStorage = ephemeralStorage
283
- }
284
-
285
- if delta .DifferentAt (("Spec.SnapStart" )) {
286
- snapStart := & svcsdk.SnapStart {}
287
- if dspec .SnapStart != nil {
288
- snapStartCopy := dspec .SnapStart .DeepCopy ()
289
- snapStart .ApplyOn = snapStartCopy .ApplyOn
290
- }
291
- input .SnapStart = snapStart
292
- }
293
-
294
305
_ , err = rm .sdkapi .UpdateFunctionConfigurationWithContext (ctx , input )
295
306
rm .metrics .RecordAPICall ("UPDATE" , "UpdateFunctionConfiguration" , err )
296
307
if err != nil {
0 commit comments