mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Base-line API for provisioning notification policies * Wire API up, some simple tests * Return provenance status through API * Fix missing call * Transactions * Clarity in package dependencies * Unify receivers in definitions * Fix issue introduced by receiver change * Drop unused internal test implementation * FGAC hooks for provisioning routes * Polish, swap names * Asserting on number of exposed routes * Don't bubble up updated object * Integrate with new concurrency token feature in store * Back out duplicated changes * Remove redundant tests * Regenerate and create unit tests for API layer * Integration tests for auth * Address linter errors * Put route behind toggle * Use alternative store API and fix feature toggle in tests * Fixes, polish * Fix whitespace * Re-kick drone * Rename services to provisioning
21 lines
562 B
Go
21 lines
562 B
Go
package provisioning
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
|
)
|
|
|
|
func DeserializeAlertmanagerConfig(config []byte) (*definitions.PostableUserConfig, error) {
|
|
result := definitions.PostableUserConfig{}
|
|
if err := json.Unmarshal(config, &result); err != nil {
|
|
return nil, fmt.Errorf("failed to deserialize alertmanager configuration: %w", err)
|
|
}
|
|
return &result, nil
|
|
}
|
|
|
|
func SerializeAlertmanagerConfig(config definitions.PostableUserConfig) ([]byte, error) {
|
|
return json.Marshal(config)
|
|
}
|