Skip to content

Commit

Permalink
simply flatten[Beta]Scheduling method
Browse files Browse the repository at this point in the history
  • Loading branch information
rosbo committed Aug 17, 2017
1 parent 96c4c73 commit 9c603d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions google/resource_compute_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1587,12 +1587,13 @@ func flattenBetaMetadata(metadata *computeBeta.Metadata) map[string]string {

func flattenBetaScheduling(scheduling *computeBeta.Scheduling) []map[string]interface{} {
result := make([]map[string]interface{}, 0, 1)
schedulingMap := make(map[string]interface{})
schedulingMap := map[string]interface{}{
"on_host_maintenance": scheduling.OnHostMaintenance,
"preemptible": scheduling.Preemptible,
}
if scheduling.AutomaticRestart != nil {
schedulingMap["automatic_restart"] = *scheduling.AutomaticRestart
}
schedulingMap["on_host_maintenance"] = scheduling.OnHostMaintenance
schedulingMap["preemptible"] = scheduling.Preemptible
result = append(result, schedulingMap)
return result
}
Expand Down
7 changes: 4 additions & 3 deletions google/resource_compute_instance_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,12 +667,13 @@ func flattenNetworkInterfaces(networkInterfaces []*compute.NetworkInterface) ([]

func flattenScheduling(scheduling *compute.Scheduling) []map[string]interface{} {
result := make([]map[string]interface{}, 0, 1)
schedulingMap := make(map[string]interface{})
schedulingMap := map[string]interface{}{
"on_host_maintenance": scheduling.OnHostMaintenance,
"preemptible": scheduling.Preemptible,
}
if scheduling.AutomaticRestart != nil {
schedulingMap["automatic_restart"] = *scheduling.AutomaticRestart
}
schedulingMap["on_host_maintenance"] = scheduling.OnHostMaintenance
schedulingMap["preemptible"] = scheduling.Preemptible
result = append(result, schedulingMap)
return result
}
Expand Down

0 comments on commit 9c603d9

Please sign in to comment.