Skip to content

Commit

Permalink
Dropping Deprecated functionality
Browse files Browse the repository at this point in the history
Fixes #192

ChangeLog:
  - Drop support for import/export keywords
  - Drop references to legacy 'datasources'
  - Drop Alert Notifications as it's long been deprecated.
  • Loading branch information
safaci2000 committed Mar 3, 2024
1 parent 346cf2f commit e9f7d3b
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 295 deletions.
154 changes: 0 additions & 154 deletions cli/backup/alertnotifications.go

This file was deleted.

1 change: 0 additions & 1 deletion cli/backup/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ limited to clear/delete, list, download and upload. Any other functionality wil
},
CommandsList: []simplecobra.Commander{
newDashboardCommand(),
newAlertNotificationsCommand(),
newConnectionsCommand(),
newFolderCommand(),
newLibraryElementsCommand(),
Expand Down
2 changes: 1 addition & 1 deletion cli/backup/connection_permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func newConnectionsPermissionDownloadCmd() simplecobra.Commander {
cmd.Aliases = []string{"d"}
},
RunFunc: func(ctx context.Context, cd *simplecobra.Commandeer, rootCmd *support.RootCommand, args []string) error {
slog.Info("import Connections for context",
slog.Info("Download Connections for context",
"context", config.Config().GetGDGConfig().GetContext())
rootCmd.TableObj.AppendHeader(table.Row{"filename"})
connectionFilter, _ := cd.CobraCommand.Flags().GetString("connection")
Expand Down
13 changes: 0 additions & 13 deletions internal/config/config_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import (
"fmt"
"github.com/grafana/grafana-openapi-client-go/models"
"github.com/tidwall/gjson"
"log"
"log/slog"
"os"
"path"
"regexp"
)
Expand All @@ -19,7 +17,6 @@ const (
AlertNotificationResource = "alertnotifications"
ConnectionPermissionResource = "connections-permissions"
ConnectionResource = "connections"
LegacyConnections = "datasources"
DashboardResource = "dashboards"
FolderPermissionResource = "folders-permissions"
FolderResource = "folders"
Expand Down Expand Up @@ -192,16 +189,6 @@ func (s *GrafanaConfig) GetMonitoredFolders() []string {

// Validate will return terminate if any deprecated configuration is found.
func (s *GrafanaConfig) Validate() {
if len(s.LegacyConnectionSettings) > 0 {
log.Fatal("Using 'datasources' is now deprecated, please use 'connections' instead")
}
//Validate Connections
//TODO: remove code after next release
legacyCheck := s.GetPath(LegacyConnections)
if _, err := os.Stat(legacyCheck); !os.IsNotExist(err) {
log.Fatalf("Your export contains a datasource directry which is deprecated. Please remove or "+
"rename directory to '%s'", ConnectionResource)
}

}

Expand Down
6 changes: 2 additions & 4 deletions internal/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ type GrafanaConfig struct {
MonitoredFoldersOverride []MonitoredOrgFolders `mapstructure:"watched_folders_override" yaml:"watched_folders_override"`
MonitoredFolders []string `mapstructure:"watched" yaml:"watched"`
ConnectionSettings *ConnectionSettings `mapstructure:"connections" yaml:"connections"`
//Datasources are deprecated, please use Connections
LegacyConnectionSettings map[string]interface{} `mapstructure:"datasources" yaml:"datasources"`
FilterOverrides *FilterOverrides `mapstructure:"filter_override" yaml:"filter_override"`
OutputPath string `mapstructure:"output_path" yaml:"output_path"`
FilterOverrides *FilterOverrides `mapstructure:"filter_override" yaml:"filter_override"`
OutputPath string `mapstructure:"output_path" yaml:"output_path"`
}

type MonitoredOrgFolders struct {
Expand Down
121 changes: 0 additions & 121 deletions internal/service/alertnotifications.go

This file was deleted.

1 change: 0 additions & 1 deletion internal/service/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type GrafanaService interface {
OrganizationsApi
DashboardsApi
ConnectionsApi
AlertNotificationsApi
UsersApi
FoldersApi
LibraryElementsApi
Expand Down

0 comments on commit e9f7d3b

Please sign in to comment.