Skip to content

Commit

Permalink
Version guard flatteners/expanders
Browse files Browse the repository at this point in the history
  • Loading branch information
uol-jlin authored Jan 9, 2025
1 parent 7484b73 commit ae95bd3
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5912,6 +5912,7 @@ func expandMonitoringConfig(configured interface{}) *container.MonitoringConfig
mc.ManagedPrometheusConfig = &container.ManagedPrometheusConfig{
Enabled: managed_prometheus["enabled"].(bool),
}
{{- if ne $.TargetVersionName "ga" }}
if autoMonitoring, ok := managed_prometheus["auto_monitoring_config"]; ok && len(autoMonitoring.([]interface{})) > 0 {
autoMonitoringConfig := autoMonitoring.([]interface{})[0].(map[string]interface{})
if scope, ok := autoMonitoringConfig["scope"].(string); ok {
Expand All @@ -5920,6 +5921,7 @@ func expandMonitoringConfig(configured interface{}) *container.MonitoringConfig
}
}
}
{{- end }}
}

if v, ok := config["advanced_datapath_observability_config"]; ok && len(v.([]interface{})) > 0 {
Expand Down Expand Up @@ -6905,13 +6907,15 @@ func flattenManagedPrometheusConfig(c *container.ManagedPrometheusConfig) []map[

result["enabled"] = c.Enabled

{{- if ne $.TargetVersionName "ga" }}
if c.AutoMonitoringConfig != nil {
autoMonitoringMap := make(map[string]interface{})
if c.AutoMonitoringConfig.Scope != "" {
autoMonitoringMap["scope"] = c.AutoMonitoringConfig.Scope
}
result["auto_monitoring_config"] = autoMonitoringMap
}
{{- end }}

return []map[string]interface{}{result}
}
Expand Down

0 comments on commit ae95bd3

Please sign in to comment.