Alerting: Export of contact points to HCL (#75849)
* add compat layer to convert from Export model to "new" API models
This commit is contained in:
@@ -548,15 +548,18 @@ func exportHcl(download bool, body definitions.AlertingFileExport) response.Resp
|
||||
Body: &gr,
|
||||
})
|
||||
}
|
||||
for idx, cp := range body.ContactPoints {
|
||||
upd, err := ContactPointFromContactPointExport(cp)
|
||||
if err != nil {
|
||||
return response.Error(http.StatusInternalServerError, "failed to convert contact points to HCL", err)
|
||||
}
|
||||
resources = append(resources, hcl.Resource{
|
||||
Type: "grafana_contact_point",
|
||||
Name: fmt.Sprintf("contact_point_%d", idx),
|
||||
Body: &upd,
|
||||
})
|
||||
}
|
||||
|
||||
// TODO implement support.
|
||||
// for idx, cp := range ex.ContactPoints {
|
||||
// resources = append(resources, resourceBlock{
|
||||
// Type: "grafana_contact_point",
|
||||
// Name: fmt.Sprintf("contact_point_%d", idx),
|
||||
// Body: &cp,
|
||||
// })
|
||||
// }
|
||||
for idx, cp := range body.Policies {
|
||||
policy := cp.Policy
|
||||
resources = append(resources, hcl.Resource{
|
||||
|
||||
Reference in New Issue
Block a user