@@ -491,12 +491,23 @@ func expandDates(dates []interface{}) *storagetransfer.Date {
491
491
return nil
492
492
}
493
493
494
- date := dates [0 ].([]interface {})
495
- return & storagetransfer.Date {
496
- Day : int64 (extractFirstMapConfig (date )["day" ].(int )),
497
- Month : int64 (extractFirstMapConfig (date )["month" ].(int )),
498
- Year : int64 (extractFirstMapConfig (date )["year" ].(int )),
494
+ dateElem := dates [0 ].([]interface {})
495
+ date := & storagetransfer.Date {}
496
+
497
+ dateMap := extractFirstMapConfig (dateElem )
498
+ if v , ok := dateMap ["day" ]; ok {
499
+ date .Day = int64 (v .(int ))
500
+ }
501
+
502
+ if v , ok := dateMap ["month" ]; ok {
503
+ date .Month = int64 (v .(int ))
499
504
}
505
+
506
+ if v , ok := dateMap ["year" ]; ok {
507
+ date .Year = int64 (v .(int ))
508
+ }
509
+
510
+ return date
500
511
}
501
512
502
513
func flattenDate (date * storagetransfer.Date ) []map [string ]interface {} {
@@ -514,13 +525,27 @@ func expandTimeOfDays(times []interface{}) *storagetransfer.TimeOfDay {
514
525
return nil
515
526
}
516
527
517
- time := times [0 ].([]interface {})
518
- return & storagetransfer.TimeOfDay {
519
- Hours : int64 (extractFirstMapConfig (time )["hours" ].(int )),
520
- Minutes : int64 (extractFirstMapConfig (time )["minutes" ].(int )),
521
- Seconds : int64 (extractFirstMapConfig (time )["seconds" ].(int )),
522
- Nanos : int64 (extractFirstMapConfig (time )["nanos" ].(int )),
528
+ timeElem := times [0 ].([]interface {})
529
+ time := & storagetransfer.TimeOfDay {}
530
+
531
+ timeMap := extractFirstMapConfig (timeElem )
532
+ if v , ok := timeMap ["hours" ]; ok {
533
+ time .Hours = int64 (v .(int ))
534
+ }
535
+
536
+ if v , ok := timeMap ["minutes" ]; ok {
537
+ time .Minutes = int64 (v .(int ))
538
+ }
539
+
540
+ if v , ok := timeMap ["seconds" ]; ok {
541
+ time .Seconds = int64 (v .(int ))
523
542
}
543
+
544
+ if v , ok := timeMap ["nanos" ]; ok {
545
+ time .Nanos = int64 (v .(int ))
546
+ }
547
+
548
+ return time
524
549
}
525
550
526
551
func flattenTimeOfDay (timeOfDay * storagetransfer.TimeOfDay ) []map [string ]interface {} {
0 commit comments