From ad9a265cd1f9fa1779264c8d1834e6e50b0512ee Mon Sep 17 00:00:00 2001 From: Samir Faci Date: Sun, 5 Nov 2023 01:42:59 -0400 Subject: [PATCH] Removing logger from service calls --- cmd/backup/connection_permissions.go | 2 +- cmd/backup/folders.go | 2 +- cmd/backup/team.go | 2 +- go.mod | 131 ++++++++++----------- go.sum | 101 +++++++++++++++- internal/log/log.go | 2 +- internal/log/slog_handler.go | 1 - internal/service/alertnotifications.go | 19 +-- internal/service/common.go | 7 +- internal/service/connection_permissions.go | 30 ++--- internal/service/connections.go | 27 +++-- internal/service/contract.go | 4 +- internal/service/dashboards.go | 31 +++-- internal/service/filters/filters.go | 5 +- internal/service/folders.go | 44 +++---- internal/service/libraryelements.go | 45 +++---- internal/service/login.go | 2 +- internal/service/organizations.go | 43 +++---- internal/service/server.go | 2 +- internal/service/serviceaccounts.go | 16 ++- internal/service/storage_cloud.go | 11 +- internal/service/storage_local.go | 5 +- internal/service/storage_test.go | 2 +- internal/service/teams.go | 38 +++--- internal/service/tokens.go | 5 +- internal/service/user.go | 31 ++--- test/common_test.go | 4 +- test/libraryelements_integration_test.go | 2 +- 28 files changed, 351 insertions(+), 263 deletions(-) diff --git a/cmd/backup/connection_permissions.go b/cmd/backup/connection_permissions.go index f4683b0e..b6600477 100644 --- a/cmd/backup/connection_permissions.go +++ b/cmd/backup/connection_permissions.go @@ -47,7 +47,7 @@ func newConnectionsPermissionListCmd() simplecobra.Commander { RunFunc: func(ctx context.Context, cd *simplecobra.Commandeer, rootCmd *support.RootCommand, args []string) error { connectionFilter, _ := cd.CobraCommand.Flags().GetString("connection") filters := service.NewConnectionFilter(connectionFilter) - slog.Info("Listing Connection Permissions for context: '%s'", config.Config().GetAppConfig().GetContext()) + slog.Info("Listing Connection Permissions for context", "context", config.Config().GetAppConfig().GetContext()) rootCmd.TableObj.AppendHeader(table.Row{"id", "uid", "name", "slug", "type", "default", "url"}) connections := rootCmd.GrafanaSvc().ListConnectionPermissions(filters) _ = connections diff --git a/cmd/backup/folders.go b/cmd/backup/folders.go index 5657c1ea..86955a72 100644 --- a/cmd/backup/folders.go +++ b/cmd/backup/folders.go @@ -110,7 +110,7 @@ func newFolderDownloadCmd() simplecobra.Commander { cmd.Aliases = []string{"d"} }, RunFunc: func(ctx context.Context, cd *simplecobra.Commandeer, rootCmd *support.RootCommand, args []string) error { - slog.Info("Listing Folders for context: '%s'", config.Config().AppConfig.GetContext()) + slog.Info("Listing Folders for context", "context", config.Config().AppConfig.GetContext()) rootCmd.TableObj.AppendHeader(table.Row{"file"}) folders := rootCmd.GrafanaSvc().DownloadFolders(getFolderFilter()) if len(folders) == 0 { diff --git a/cmd/backup/team.go b/cmd/backup/team.go index 34e63e3e..b96e4574 100644 --- a/cmd/backup/team.go +++ b/cmd/backup/team.go @@ -150,7 +150,7 @@ func newTeamsClearCmd() simplecobra.Commander { cmd.Aliases = []string{"c"} }, RunFunc: func(ctx context.Context, cd *simplecobra.Commandeer, rootCmd *support.RootCommand, args []string) error { - slog.Info("Deleting teams for context: '%s'", config.Config().AppConfig.GetContext()) + slog.Info("Deleting teams for context", "context", config.Config().AppConfig.GetContext()) filter := api.NewTeamFilter(parseTeamGlobalFlags(cd.CobraCommand)...) rootCmd.TableObj.AppendHeader(table.Row{"type", "team ID", "team Name"}) teams, err := rootCmd.GrafanaSvc().DeleteTeam(filter) diff --git a/go.mod b/go.mod index 1a9f462d..40ebe7f4 100644 --- a/go.mod +++ b/go.mod @@ -1,84 +1,68 @@ module github.com/esnet/gdg -go 1.21rc4 - -toolchain go1.21.0 +go 1.21.3 require ( github.com/AlecAivazis/survey/v2 v2.3.7 - github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect - github.com/gosimple/slug v1.13.1 - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/sirupsen/logrus v1.9.3 - github.com/spf13/cobra v1.7.0 - github.com/spf13/viper v1.17.0 - github.com/stretchr/testify v1.8.4 - github.com/thoas/go-funk v0.9.3 - github.com/tidwall/pretty v1.2.1 - go.mongodb.org/mongo-driver v1.12.1 // indirect - golang.org/x/sys v0.14.0 // indirect - golang.org/x/term v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v3 v3.0.1 - -) - -require ( - github.com/aws/aws-sdk-go v1.45.23 + github.com/aws/aws-sdk-go v1.47.3 github.com/bep/simplecobra v0.3.2 - github.com/carlmjohnson/requests v0.23.4 + github.com/carlmjohnson/requests v0.23.5 github.com/esnet/grafana-swagger-api-golang v0.0.0-20230904013855-9a47b55d30d3 github.com/go-openapi/runtime v0.26.0 - github.com/google/uuid v1.3.1 - github.com/jedib0t/go-pretty/v6 v6.4.8 - github.com/lmittmann/tint v1.0.0 + github.com/google/uuid v1.4.0 + github.com/gosimple/slug v1.13.1 + github.com/jedib0t/go-pretty/v6 v6.4.9 + github.com/lmittmann/tint v1.0.3 + github.com/mattn/go-isatty v0.0.20 github.com/ory/dockertest/v3 v3.10.0 github.com/samber/lo v1.38.1 + github.com/spf13/cobra v1.8.0 + github.com/spf13/viper v1.17.0 + github.com/stretchr/testify v1.8.4 + github.com/thoas/go-funk v0.9.3 github.com/tidwall/gjson v1.17.0 - gitlab.com/greyxor/slogor v1.1.2 + github.com/tidwall/pretty v1.2.1 gocloud.dev v0.34.0 golang.org/x/exp v0.0.0-20231006140011-7918f672742d + gopkg.in/yaml.v3 v3.0.1 ) require ( - cloud.google.com/go v0.110.8 // indirect - cloud.google.com/go/compute v1.23.0 // indirect + cloud.google.com/go v0.110.10 // indirect + cloud.google.com/go/compute v1.23.3 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.2 // indirect - cloud.google.com/go/storage v1.33.0 // indirect + cloud.google.com/go/iam v1.1.5 // indirect + cloud.google.com/go/storage v1.34.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect - github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.0 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect - github.com/aws/aws-sdk-go-v2 v1.21.0 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 // indirect - github.com/aws/aws-sdk-go-v2/config v1.18.43 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.13.41 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 // indirect - github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.88 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43 // indirect - github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4 // indirect - github.com/aws/aws-sdk-go-v2/service/s3 v1.40.0 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.15.0 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.23.0 // indirect - github.com/aws/smithy-go v1.14.2 // indirect + github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect + github.com/aws/aws-sdk-go-v2 v1.22.1 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.0 // indirect + github.com/aws/aws-sdk-go-v2/config v1.22.0 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.15.1 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2 // indirect + github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.13.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.1 // indirect + github.com/aws/aws-sdk-go-v2/service/s3 v1.42.0 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.17.0 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.25.0 // indirect + github.com/aws/smithy-go v1.16.0 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/containerd/continuity v0.3.0 // indirect github.com/creack/pty v1.1.18 // indirect @@ -87,8 +71,8 @@ require ( github.com/docker/docker v24.0.7+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect + github.com/go-logr/logr v1.3.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/analysis v0.21.4 // indirect github.com/go-openapi/errors v0.20.4 // indirect @@ -103,11 +87,11 @@ require ( github.com/golang-jwt/jwt/v5 v5.0.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.5.9 // indirect + github.com/google/go-cmp v0.6.0 // indirect github.com/google/s2a-go v0.1.7 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/wire v0.5.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect github.com/gosimple/unidecode v1.0.1 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect @@ -120,7 +104,10 @@ require ( github.com/kylelemons/godebug v1.1.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moby/term v0.0.0-20201216013528-df9cb8a40635 // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect @@ -134,6 +121,7 @@ require ( github.com/rivo/uniseg v0.4.4 // indirect github.com/sagikazarmark/locafero v0.3.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sirupsen/logrus v1.8.1 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect @@ -144,6 +132,7 @@ require ( github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect + go.mongodb.org/mongo-driver v1.12.1 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/otel v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect @@ -153,15 +142,19 @@ require ( golang.org/x/mod v0.13.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/oauth2 v0.13.0 // indirect - golang.org/x/sync v0.4.0 // indirect + golang.org/x/sync v0.5.0 // indirect + golang.org/x/sys v0.14.0 // indirect + golang.org/x/term v0.13.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.14.0 // indirect - golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect - google.golang.org/api v0.145.0 // indirect + golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect + google.golang.org/api v0.149.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect - google.golang.org/grpc v1.58.3 // indirect + google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 18bac614..7ff9c2bb 100644 --- a/go.sum +++ b/go.sum @@ -19,6 +19,8 @@ cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmW cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= cloud.google.com/go v0.110.8 h1:tyNdfIxjzaWctIiLYOTalaLKZ17SI44SKFW26QbOhME= cloud.google.com/go v0.110.8/go.mod h1:Iz8AkXJf1qmxC3Oxoep8R1T36w8B92yU29PcBhHO5fk= +cloud.google.com/go v0.110.10 h1:LXy9GEO+timppncPIAZoOj3l58LIU9k+kn48AN7IO3Y= +cloud.google.com/go v0.110.10/go.mod h1:v1OoFqYxiBkUrruItNM3eT4lLByNjxmJSV/xDKJNnic= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -27,12 +29,16 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= +cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/iam v1.1.2 h1:gacbrBdWcoVmGLozRuStX45YKvJtzIjJdAolzUs1sm4= cloud.google.com/go/iam v1.1.2/go.mod h1:A5avdyVL2tCppe4unb0951eI9jreack+RJ0/d+KUZOU= +cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= +cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= @@ -45,6 +51,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= cloud.google.com/go/storage v1.33.0 h1:PVrDOkIC8qQVa1P3SXGpQvfuJhN2LHOoyZvWs8D2X5M= cloud.google.com/go/storage v1.33.0/go.mod h1:Hhh/dogNRGca7IWv1RC2YqEn0c0G77ctA/OxflYkiD8= +cloud.google.com/go/storage v1.34.1 h1:H2Af2dU5J0PF7A5B+ECFIce+RqxVnrVilO+cu0TS3MI= +cloud.google.com/go/storage v1.34.1/go.mod h1:VN1ElqqvR9adg1k9xlkUJ55cMOP1/QjnNNuT5xQL6dY= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ= github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo= @@ -52,12 +60,18 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 h1:9kDVnTz3vbfweTqAUmk/a/pH5 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0/go.mod h1:3Ug6Qzto9anB6mGlEdgYMDF5zHQ+wwhEaYR4s17PHMw= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1 h1:LNHhpdK7hzUcx/k1LIcuh5k7k1LGIWLQfCjaneSj7Fc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.1/go.mod h1:uE9zaUfEQT/nbQjVi2IblCG9iaLtZsuYZ8ne+PuQ02M= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0 h1:Ma67P/GGprNwsslzEH6+Kb8nybI8jpDTm4Wmzu2ReK8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.2.0/go.mod h1:c+Lifp3EDEamAkPVzMooRNOK6CZjNSdEnf1A7jsI9u4= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0 h1:nVocQV40OQne5613EeLayJiRAJuKlBGy+m22qWG+WRg= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0/go.mod h1:7QJP7dr2wznCMeqIrhMgWGf7XpAQnVrJqDm9nvV3Cu4= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0 h1:gggzg0SUMs6SQbEw+3LoSsYf9YMjkupeAnHMX8O9mmY= +github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0/go.mod h1:+6KLcKIVgxoBDMqMO/Nvy7bZ9a0nbU3I1DtFQK3YvB4= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= @@ -81,48 +95,90 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3d github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/aws-sdk-go v1.45.23 h1:0xRQw5fsFMpisaliDZ8iUZtw9w+3YjY9/UwUGRbB/i4= github.com/aws/aws-sdk-go v1.45.23/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.47.3 h1:e0H6NFXiniCpR8Lu3lTphVdRaeRCDLAeRyTHd1tJSd8= +github.com/aws/aws-sdk-go v1.47.3/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.21.0 h1:gMT0IW+03wtYJhRqTVYn0wLzwdnK9sRMcxmtfGzRdJc= github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= +github.com/aws/aws-sdk-go-v2 v1.22.1 h1:sjnni/AuoTXxHitsIdT0FwmqUuNUuHtufcVDErVFT9U= +github.com/aws/aws-sdk-go-v2 v1.22.1/go.mod h1:Kd0OJtkW3Q0M0lUWGszapWjEvrXDzRW+D21JNsroB+c= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 h1:OPLEkmhXf6xFPiz0bLeDArZIDx1NNS4oJyG4nv3Gct0= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13/go.mod h1:gpAbvyDGQFozTEmlTFO8XcQKHzubdq0LzRyJpG6MiXM= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.0 h1:hHgLiIrTRtddC0AKcJr5s7i/hLgcpTt+q/FKxf1Zayk= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.0/go.mod h1:w4I/v3NOWgD+qvs1NPEwhd++1h3XPHFaVxasfY6HlYQ= github.com/aws/aws-sdk-go-v2/config v1.18.43 h1:IgdUtTRvUDC6eiJBqU6vh7bHFNAEBjQ8S+qJ7zVhDOs= github.com/aws/aws-sdk-go-v2/config v1.18.43/go.mod h1:NiFev8qlgg8MPzw3fO/EwzMZeZwlJEKGwfpjRPA9Nvw= +github.com/aws/aws-sdk-go-v2/config v1.22.0 h1:9Mm99OalzZRz0ab5fpodMoHBApHS6pqRNp3M9NmzvDg= +github.com/aws/aws-sdk-go-v2/config v1.22.0/go.mod h1:2eWgw5lps8fKI7LZVTrRTYP6HE6k/uEFUuTSHfXwqP0= github.com/aws/aws-sdk-go-v2/credentials v1.13.41 h1:dgbKq1tamtboYAKSXWbqL0lKO9rmEzEhbZFh9JQW/Bg= github.com/aws/aws-sdk-go-v2/credentials v1.13.41/go.mod h1:cc3Fn7DkKbJalPtQnudHGZZ8ml9+hwtbc1CJONsYYqk= +github.com/aws/aws-sdk-go-v2/credentials v1.15.1 h1:hmf6lAm9hk7uLCfapZn/jL05lm6Uwdbn1B0fgjyuf4M= +github.com/aws/aws-sdk-go-v2/credentials v1.15.1/go.mod h1:QTcHga3ZbQOneJuxmGBOCxiClxmp+TlvmjFexAnJ790= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11 h1:uDZJF1hu0EVT/4bogChk8DyjSF6fof6uL/0Y26Ma7Fg= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.11/go.mod h1:TEPP4tENqBGO99KwVpV9MlOX4NSrSLP8u3KRy2CDwA8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2 h1:gIeH4+o1MN/caGBWjoGQTUTIu94xD6fI5B2+TcwBf70= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2/go.mod h1:wLyMIo/zPOhQhPXTddpfdkSleyigtFi8iMnC+2m/SK4= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.88 h1:AxcMcV1uTY15jysvTiXC6Mgpb5nU1rnqH0PmgJ7ig80= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.88/go.mod h1:C6Kvpm4g92So11JEAHMK0trT6EEEe5g5uG5JrneR6zQ= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.13.1 h1:ULswbgGNVrW8zEhkCNwrwXrs1mUvy2JTqWaCRsD2ZZw= +github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.13.1/go.mod h1:pAXgsDPk1rRwwfkz8/9ISO75vXEHqTGIgbLhGqqQ1GY= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 h1:22dGT7PneFMx4+b3pz7lMTRyN8ZKH7M2cW4GP9yUS2g= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1 h1:fi1ga6WysOyYb5PAf3Exd6B5GiSNpnZim4h1rhlBqx0= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1/go.mod h1:V5CY8wNurvPUibTi9mwqUqpiFZ5LnioKWIFUDtIzdI8= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 h1:SijA0mgjV8E+8G45ltVHs0fvKpTj8xmZJ3VwhGKtUSI= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1 h1:ZpaV/j48RlPc4AmOZuPv22pJliXjXq8/reL63YzyFnw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1/go.mod h1:R8aXraabD2e3qv1csxM14/X9WF4wFMIY0kH4YEtYD5M= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43 h1:g+qlObJH4Kn4n21g69DjspU0hKTjWtq7naZ9OLCv0ew= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.43/go.mod h1:rzfdUlfA+jdgLDmPKjd3Chq9V7LVLYo1Nz++Wb91aRo= +github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0 h1:DqOQvIfmGkXZUVJnl9VRk0AnxyS59tCtX9k1Pyss4Ak= +github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0/go.mod h1:VV/Kbw9Mg1GWJOT9WK+oTL3cWZiXtapnNvDSRqTZLsg= github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4 h1:6lJvvkQ9HmbHZ4h/IEwclwv2mrTW8Uq1SOB/kXy0mfw= github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4/go.mod h1:1PrKYwxTM+zjpw9Y41KFtoJCQrJ34Z47Y4VgVbfndjo= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.1 h1:vzYLDkwTw4CY0vUk84MeSufRf8XIsC/GsoIFXD60sTg= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.1/go.mod h1:ToBFBnjeGR2ruMx8IWp/y7vSK3Irj5/oPwifruiqoOM= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14 h1:m0QTSI6pZYJTk5WSKx3fm5cNW/DCicVzULBgU/6IyD0= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14/go.mod h1:dDilntgHy9WnHXsh7dDtUPgHKEfTJIBUTHM8OWm0f/0= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0 h1:CJxo7ZBbaIzmXfV3hjcx36n9V87gJsIUPJflwqEHl3Q= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0/go.mod h1:yjVfjuY4nD1EW9i387Kau+I6V5cBA5YnC/mWNopjZrI= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36 h1:eev2yZX7esGRjqRbnVk1UxMLw4CyVZDpZXRCcy75oQk= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36/go.mod h1:lGnOkH9NJATw0XEPcAknFBj3zzNTEGRHtSw+CwC1YTg= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.1 h1:15FUCJzAP9Y25nioTqTrGlZmhOtthaXBWlt4pS+d3Xo= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.1/go.mod h1:5655NW53Un6l7JzkI6AA3rZvf0m532cSnLThA1fVXcA= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35 h1:CdzPW9kKitgIiLV1+MHobfR5Xg25iYnyzWZhyQuSlDI= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.35/go.mod h1:QGF2Rs33W5MaN9gYdEQOBBFPLwTZkEhRwI33f7KIG0o= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1 h1:2OXw3ppu1XsB6rqKEMV4tnecTjIY3PRV2U6IP6KPJQo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1/go.mod h1:FZB4AdakIqW/yERVdGJA6Z9jraax1beXfhBBnK2wwR8= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4 h1:v0jkRigbSD6uOdwcaUQmgEwG1BkPfAPDqaeNt/29ghg= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4/go.mod h1:LhTyt8J04LL+9cIt7pYJ5lbS/U98ZmXovLOR/4LUsk8= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.1 h1:dnl0klXYX9EKpzZbWlH5LJL+YTcEZcJEMPFFr/rAHUQ= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.1/go.mod h1:Mfk/9Joso4tCQYzM4q4HRUIqwln8lnIIMB/OE8Zebdc= github.com/aws/aws-sdk-go-v2/service/s3 v1.40.0 h1:wl5dxN1NONhTDQD9uaEvNsDRX29cBmGED/nl0jkWlt4= github.com/aws/aws-sdk-go-v2/service/s3 v1.40.0/go.mod h1:rDGMZA7f4pbmTtPOk5v5UM2lmX6UAbRnMDJeDvnH7AM= +github.com/aws/aws-sdk-go-v2/service/s3 v1.42.0 h1:u0YoSrxjr3Lm+IqIlRAV+4YTFwkXjyB9db9CfUFge2w= +github.com/aws/aws-sdk-go-v2/service/s3 v1.42.0/go.mod h1:98EIdRu+BNsdqITsXfy+57TZfwlUQC9aDn9a9qoo90U= github.com/aws/aws-sdk-go-v2/service/sso v1.15.0 h1:vuGK1vHNP9zx0PfOrtPumbwR2af0ATQ1Z2H6p75AgRQ= github.com/aws/aws-sdk-go-v2/service/sso v1.15.0/go.mod h1:fIAwKQKBFu90pBxx07BFOMJLpRUGu8VOzLJakeY+0K4= +github.com/aws/aws-sdk-go-v2/service/sso v1.17.0 h1:I/Oh3IxGPfHXiGnwM54TD6hNr/8TlUrBXAtTyGhR+zw= +github.com/aws/aws-sdk-go-v2/service/sso v1.17.0/go.mod h1:H6NCMvDBqA+CvIaXzaSqM6LWtzv9BzZrqBOqz+PzRF8= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1 h1:8lKOidPkmSmfUtiTgtdXWgaKItCZ/g75/jEk6Ql6GsA= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.1/go.mod h1:yygr8ACQRY2PrEcy3xsUI357stq2AxnFM6DIsR9lij4= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0 h1:irbXQkfVYIRaewYSXcu4yVk0m2T+JzZd0dkop7FjmO0= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0/go.mod h1:4wPNCkM22+oRe71oydP66K50ojDUC33XutSMi2pEF/M= github.com/aws/aws-sdk-go-v2/service/sts v1.23.0 h1:pyvfUqkNLMipdKNAtu7OVbRxUrR2BMaKccIPpk/Hkak= github.com/aws/aws-sdk-go-v2/service/sts v1.23.0/go.mod h1:VC7JDqsqiwXukYEDjoHh9U0fOJtNWh04FPQz4ct4GGU= +github.com/aws/aws-sdk-go-v2/service/sts v1.25.0 h1:sYIFy8tm1xQwRvVQ4CRuBGXKIg9sHNuG6+3UAQuoujk= +github.com/aws/aws-sdk-go-v2/service/sts v1.25.0/go.mod h1:S/LOQUeYDfJeJpFCIJDMjy7dwL4aA33HUdVi+i7uH8k= github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ= github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.16.0 h1:gJZEH/Fqh+RsvlJ1Zt4tVAtV6bKkp3cC+R6FCZMNzik= +github.com/aws/smithy-go v1.16.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= github.com/bep/simplecobra v0.3.2 h1:dVcflWm7l31zxV8QUrJqQ/de/satzqY8ukq0aL0pZDE= github.com/bep/simplecobra v0.3.2/go.mod h1:EOp6bCKuuHmwA9bQcRC8LcDB60co2Cmht5X4xMIOwf0= github.com/carlmjohnson/requests v0.23.4 h1:AxcvapfB9RPXLSyvAHk9YJoodQ43ZjzNHj6Ft3tQGdg= github.com/carlmjohnson/requests v0.23.4/go.mod h1:Qzp6tW4DQyainPP+tGwiJTzwxvElTIKm0B191TgTtOA= +github.com/carlmjohnson/requests v0.23.5 h1:NPANcAofwwSuC6SIMwlgmHry2V3pLrSqRiSBKYbNHHA= +github.com/carlmjohnson/requests v0.23.5/go.mod h1:zG9P28thdRnN61aD7iECFhH5iGGKX2jIjKQD9kqYH+o= github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -141,6 +197,7 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= @@ -175,12 +232,16 @@ github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0X github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= +github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= @@ -305,6 +366,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-replayers/grpcreplay v1.1.0 h1:S5+I3zYyZ+GQz68OfbURDdt/+cSMqCK1wrvNx7WBzTE= github.com/google/go-replayers/grpcreplay v1.1.0/go.mod h1:qzAvJ8/wi57zq7gWqaE6AwLM6miiXUQwP1S+I9icmhk= github.com/google/go-replayers/httpreplay v1.2.0 h1:VM1wEyyjaoU53BwrOnaf9VhAyQQEEioJvFYxYcLRKzk= @@ -335,10 +398,14 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/wire v0.5.0 h1:I7ELFeVBr3yfPIcc8+MWvrjk+3VjbcSzoXm3JVa+jD8= github.com/google/wire v0.5.0/go.mod h1:ngWDr9Qvq3yZA10YrxfyGELY/AFWGVpy9c1LTRi1EoU= github.com/googleapis/enterprise-certificate-proxy v0.3.1 h1:SBWmZhjUDRorQxrN0nwzf+AHBxnbFjViHQS4P0yVpmQ= github.com/googleapis/enterprise-certificate-proxy v0.3.1/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= +github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs= +github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= @@ -365,6 +432,8 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jedib0t/go-pretty/v6 v6.4.8 h1:HiNzyMSEpsBaduKhmK+CwcpulEeBrTmxutz4oX/oWkg= github.com/jedib0t/go-pretty/v6 v6.4.8/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVfmHZu9n8rk2xs= +github.com/jedib0t/go-pretty/v6 v6.4.9 h1:vZ6bjGg2eBSrJn365qlxGcaWu09Id+LHtrfDWlB2Usc= +github.com/jedib0t/go-pretty/v6 v6.4.9/go.mod h1:Ndk3ase2CkQbXLLNf5QDHoYb6J9WtVfmHZu9n8rk2xs= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -398,6 +467,8 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lmittmann/tint v1.0.0 h1:fzEj70K1L58uyoePQxKe+ezDZJ5pybiWGdA0JeFvvyw= github.com/lmittmann/tint v1.0.0/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE= +github.com/lmittmann/tint v1.0.3 h1:W5PHeA2D8bBJVvabNfQD/XW9HPLZK1XoPZH0cq8NouQ= +github.com/lmittmann/tint v1.0.3/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -414,9 +485,13 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI= github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= @@ -480,9 +555,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY= @@ -492,6 +566,8 @@ github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -551,8 +627,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -gitlab.com/greyxor/slogor v1.1.2 h1:KCCAVzLjB7u9ya257fiUqVbJojh30dZ/r7IAJGFoK6Y= -gitlab.com/greyxor/slogor v1.1.2/go.mod h1:jzZQuMGuDydoRog+bPMfWRMUuJvIHaDAWiJAS1KFGHQ= go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= @@ -694,6 +768,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -746,12 +822,13 @@ golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -773,6 +850,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -840,6 +919,8 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= +golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -861,6 +942,8 @@ google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34q google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= google.golang.org/api v0.145.0 h1:kBjvf1A3/m30kUvnUX9jZJxTu3lJrpGFt5V/1YZrjwg= google.golang.org/api v0.145.0/go.mod h1:OARJqIfoYjXJj4C1AiBSXYZt03qsoz8FQYU6fBEfrHM= +google.golang.org/api v0.149.0 h1:b2CqT6kG+zqJIVKRQ3ELJVLN1PwHZ6DJ3dW8yl82rgY= +google.golang.org/api v0.149.0/go.mod h1:Mwn1B7JTXrzXtnvmzQE2BD6bYZQ8DShKZDZbeN9I7qI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -908,10 +991,16 @@ google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 h1:SeZZZx0cP0fqUyA+oRzP9k7cSwJlvDFiROO72uwD6i0= google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97/go.mod h1:t1VqOqqvce95G3hIDCT5FeO3YUc6Q4Oe24L/+rNMxRk= +google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405 h1:I6WNifs6pF9tNdSob2W24JtyxIYjzFB9qDlpUC76q+U= +google.golang.org/genproto v0.0.0-20231030173426-d783a09b4405/go.mod h1:3WDQMjmJk36UQhjQ89emUzb1mdaHcPeeAh4SCBKznB4= google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU= google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0= +google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405 h1:HJMDndgxest5n2y77fnErkM62iUsptE/H8p0dC2Huo4= +google.golang.org/genproto/googleapis/api v0.0.0-20231030173426-d783a09b4405/go.mod h1:oT32Z4o8Zv2xPQTg0pbVaPr0MPOH6f14RgXt7zfIpwg= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 h1:6GQBEOdGkX6MMTLT9V+TjtIRZCw9VPD5Z+yHY9wMgS0= google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -930,6 +1019,8 @@ google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA5 google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/internal/log/log.go b/internal/log/log.go index 529b69f4..554ef65a 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -16,7 +16,7 @@ func InitializeAppLogger(stdout *os.File, stderr *os.File) { outStream := stdout level := slog.LevelInfo showSource := false - if config.Config().AppConfig.Global.Debug == true { + if config.Config().AppConfig.Global.Debug { level = slog.LevelDebug showSource = true } diff --git a/internal/log/slog_handler.go b/internal/log/slog_handler.go index 105172f6..07891a85 100644 --- a/internal/log/slog_handler.go +++ b/internal/log/slog_handler.go @@ -19,7 +19,6 @@ type ContextHandler struct { func NewContextHandler(h slog.Handler, out *os.File, err *os.File, opts *tint.Options) *ContextHandler { ch := &ContextHandler{outStream: out, errStream: err, options: opts} if lh, ok := h.(*ContextHandler); ok { - h = lh.handler if lh.outStream == out && lh.errStream == err { return lh } diff --git a/internal/service/alertnotifications.go b/internal/service/alertnotifications.go index 927c5933..1a376e9a 100644 --- a/internal/service/alertnotifications.go +++ b/internal/service/alertnotifications.go @@ -5,10 +5,11 @@ import ( "github.com/esnet/gdg/internal/config" "github.com/esnet/grafana-swagger-api-golang/goclient/client/legacy_alerts_notification_channels" "github.com/esnet/grafana-swagger-api-golang/goclient/models" + "log/slog" "strings" "github.com/gosimple/slug" - log "github.com/sirupsen/logrus" + "log" ) // AlertNotificationsApi Contract definition @@ -42,12 +43,12 @@ func (s *DashNGoImpl) DownloadAlertNotifications() []string { alertnotifications = s.ListAlertNotifications() for _, an := range alertnotifications { if anPacked, err = json.Marshal(an); err != nil { - log.Errorf("error marshalling %s to json with %s", an.Name, err) + slog.Error("error marshalling to json", "filename", an.Name, "err", err.Error()) continue } anPath := buildResourcePath(slug.Make(an.Name), config.AlertNotificationResource) if err = s.storage.WriteFile(anPath, anPacked); err != nil { - log.Errorf("error writing %s to file with %s", slug.Make(an.Name), err) + slog.Error("error writing to file", "filename", slug.Make(an.Name), "err", err.Error()) } else { dataFiles = append(dataFiles, anPath) } @@ -64,7 +65,7 @@ func (s *DashNGoImpl) DeleteAllAlertNotifications() []string { params.NotificationChannelID = item.ID _, err := s.client.LegacyAlertsNotificationChannels.DeleteAlertNotificationChannel(params, s.getAuth()) if err != nil { - log.Error("Failed to delete notification") + slog.Error("Failed to delete notification") continue } an = append(an, item.Name) @@ -86,7 +87,7 @@ func (s *DashNGoImpl) UploadAlertNotifications() []string { dirPath := config.Config().GetDefaultGrafanaConfig().GetPath(config.AlertNotificationResource) filesInDir, err = s.storage.FindAllFiles(dirPath, true) if err != nil { - log.WithError(err).Fatalf("Unable to find Alert data in Storage System %s", s.storage.Name()) + log.Fatalf("Unable to find Alert data in Storage System %s, err: %s", s.storage.Name(), err.Error()) } alertnotifications = s.ListAlertNotifications() @@ -94,13 +95,13 @@ func (s *DashNGoImpl) UploadAlertNotifications() []string { for _, file := range filesInDir { if strings.HasSuffix(file, ".json") { if raw, err = s.storage.ReadFile(file); err != nil { - log.Errorf("error reading file %s with %s", file, err) + slog.Error("error reading file", "file", file, "err", err) continue } var newAlertNotification models.CreateAlertNotificationCommand if err = json.Unmarshal(raw, &newAlertNotification); err != nil { - log.Errorf("error unmarshalling json with %s", err) + slog.Error("error unmarshalling json", "err", err) continue } @@ -109,7 +110,7 @@ func (s *DashNGoImpl) UploadAlertNotifications() []string { dp := legacy_alerts_notification_channels.NewDeleteAlertNotificationChannelByUIDParams() dp.NotificationChannelUID = existing.UID if _, err := s.client.LegacyAlertsNotificationChannels.DeleteAlertNotificationChannelByUID(dp, s.getAuth()); err != nil { - log.Errorf("error on deleting datasource %s with %s", newAlertNotification.Name, err) + slog.Error("error on deleting datasource", "datasource", newAlertNotification.Name, "err", err) } break } @@ -118,7 +119,7 @@ func (s *DashNGoImpl) UploadAlertNotifications() []string { params := legacy_alerts_notification_channels.NewCreateAlertNotificationChannelParams() params.Body = &newAlertNotification if _, err = s.client.LegacyAlertsNotificationChannels.CreateAlertNotificationChannel(params, s.getAuth()); err != nil { - log.Errorf("error on importing datasource %s with %s", newAlertNotification.Name, err) + slog.Error("error on importing datasource", "datasource", newAlertNotification.Name, "err", err) continue } exported = append(exported, file) diff --git a/internal/service/common.go b/internal/service/common.go index e505a14a..8912ed69 100644 --- a/internal/service/common.go +++ b/internal/service/common.go @@ -5,7 +5,8 @@ import ( "fmt" "github.com/esnet/gdg/internal/config" "github.com/gosimple/slug" - log "github.com/sirupsen/logrus" + "log" + "log/slog" "os" "path/filepath" "strings" @@ -36,7 +37,7 @@ func updateSlug(board string) string { func CreateDestinationPath(v string) { err := os.MkdirAll(v, 0750) if err != nil { - log.WithError(err).Panicf("unable to create path %s", v) + log.Panicf("unable to create path %s, err: %s", v, err.Error()) } } @@ -56,7 +57,7 @@ func getFolderFromResourcePath(storageEngine string, filePath string, resourceTy ndx := strings.LastIndex(folderName, string(os.PathSeparator)) if ndx != -1 { folderName = folderName[0:ndx] - log.Debugf("Folder name is: %s", folderName) + slog.Debug("Folder name is", "folder", folderName) return folderName, nil } return "", errors.New("unable to parse resource to retrieve folder name") diff --git a/internal/service/connection_permissions.go b/internal/service/connection_permissions.go index 84732ec7..d5051200 100644 --- a/internal/service/connection_permissions.go +++ b/internal/service/connection_permissions.go @@ -9,7 +9,8 @@ import ( "github.com/esnet/grafana-swagger-api-golang/goclient/client/datasource_permissions" "github.com/esnet/grafana-swagger-api-golang/goclient/models" "github.com/gosimple/slug" - log "github.com/sirupsen/logrus" + "log" + "log/slog" "path/filepath" "strings" ) @@ -32,7 +33,7 @@ func (s *DashNGoImpl) ListConnectionPermissions(filter filters.Filter) map[*mode for ndx, connection := range connections { permission, err := s.getConnectionPermission(connection.ID) if err != nil { - log.Errorf("unable to retrieve connection permissions for ID: %d", connection.ID) + slog.Error("unable to retrieve connection permissions for ID", "id", connection.ID) continue } result[&connections[ndx]] = permission.GetPayload() @@ -44,7 +45,7 @@ func (s *DashNGoImpl) ListConnectionPermissions(filter filters.Filter) map[*mode // DownloadConnectionPermissions download permissions to local file system func (s *DashNGoImpl) DownloadConnectionPermissions(filter filters.Filter) []string { - log.Infof("Downloading connection permissions") + slog.Info("Downloading connection permissions") var ( dsPacked []byte err error @@ -53,12 +54,12 @@ func (s *DashNGoImpl) DownloadConnectionPermissions(filter filters.Filter) []str currentPermissions := s.ListConnectionPermissions(filter) for connection, permission := range currentPermissions { if dsPacked, err = json.MarshalIndent(permission, "", " "); err != nil { - log.Errorf("unable to marshall json %s for %s Permissions\n", err, connection.Name) + slog.Error("unable to marshall json ", "err", err.Error(), "connectionName", connection.Name) continue } dsPath := buildResourcePath(slug.Make(connection.Name), config.ConnectionPermissionResource) if err = s.storage.WriteFile(dsPath, dsPacked); err != nil { - log.Errorf("%s for %s\n", err.Error(), slug.Make(connection.Name)) + slog.Error("unable to write file. ", "filename", slug.Make(connection.Name), "error", err.Error()) } else { dataFiles = append(dataFiles, dsPath) } @@ -78,17 +79,17 @@ func (s *DashNGoImpl) UploadConnectionPermissions(filter filters.Filter) []strin filesInDir, err := s.storage.FindAllFiles(config.Config().GetDefaultGrafanaConfig().GetPath(config.ConnectionPermissionResource), false) if err != nil { - log.WithError(err).Fatal("Failed to read folders permission imports") + log.Fatalf("Failed to read folders permission imports: %s", err.Error()) } for _, file := range filesInDir { fileLocation := filepath.Join(config.Config().GetDefaultGrafanaConfig().GetPath(config.ConnectionPermissionResource), file) if !filter.ValidateAll(map[filters.FilterType]string{filters.Name: strings.ReplaceAll(file, ".json", "")}) { - log.Debugf("File does not match pattern, skipping %s", file) + slog.Debug("File does not match pattern, skipping file", "filename", file) continue } if strings.HasSuffix(file, ".json") { if rawFolder, err = s.storage.ReadFile(fileLocation); err != nil { - log.WithError(err).Errorf("failed to read file %s", fileLocation) + slog.Error("failed to read file %s", "filename", fileLocation, "err", err) continue } } @@ -96,13 +97,13 @@ func (s *DashNGoImpl) UploadConnectionPermissions(filter filters.Filter) []strin newEntries := new(models.DataSourcePermissionsDTO) err = json.Unmarshal(rawFolder, &newEntries) if err != nil { - log.Warnf("Failed to Decode payload for %s", fileLocation) + slog.Warn("Failed to Decode payload for file", "filename", fileLocation) continue } //Get current permissions permissions, err := s.getConnectionPermission(newEntries.DatasourceID) if err != nil { - log.Errorf("connection permission could not be retrieved, cannot update permissions") + slog.Error("connection permission could not be retrieved, cannot update permissions") continue } @@ -113,7 +114,7 @@ func (s *DashNGoImpl) UploadConnectionPermissions(filter filters.Filter) []strin } if !success { - log.Errorf("Failed to delete previous data, cannot update permissions") + slog.Error("Failed to delete previous data, cannot update permissions") continue } @@ -128,14 +129,14 @@ func (s *DashNGoImpl) UploadConnectionPermissions(filter filters.Filter) []strin } err = s.extended.AddConnectionPermission(p) if err != nil { - log.Errorf("Failed to update folder permissions") + slog.Error("Failed to update folder permissions") } else { dataFiles = append(dataFiles, fileLocation) } } } - log.Infof("Removing all previous permissions and re-applying") + slog.Info("Removing all previous permissions and re-applying") return dataFiles } @@ -168,8 +169,7 @@ func (s *DashNGoImpl) deleteConnectionPermission(permissionId int64, datasourceI if err != nil { return false } - log.Debugf("%d permission has been removed associated with datasource %d: %s", permissionId, datasourceId, resp.GetPayload().Message) - + slog.Debug("permission has been removed associated with datasource %d: %s", "permissionId", permissionId, "datasourceId", datasourceId, "response", resp.GetPayload().Message) return true } diff --git a/internal/service/connections.go b/internal/service/connections.go index 463bbc19..8a08fa0c 100644 --- a/internal/service/connections.go +++ b/internal/service/connections.go @@ -7,11 +7,12 @@ import ( "github.com/esnet/gdg/internal/service/filters" "github.com/esnet/grafana-swagger-api-golang/goclient/client/datasources" "github.com/esnet/grafana-swagger-api-golang/goclient/models" + "log/slog" "path/filepath" "strings" "github.com/gosimple/slug" - log "github.com/sirupsen/logrus" + "log" ) // ConnectionsApi Contract definition @@ -57,7 +58,7 @@ func (s *DashNGoImpl) ListConnections(filter filters.Filter) []models.DataSource dsSettings := s.grafanaConf.GetDataSourceSettings() for _, item := range ds.GetPayload() { if dsSettings.FiltersEnabled() && dsSettings.IsExcluded(item) { - log.Debugf("Skipping data source: %s since it fails filter checks with dataType of: %s", item.Name, item.Type) + slog.Debug("Skipping data source, since it fails datatype filter checks", "datasource", item.Name, "datatype", item.Type) continue } if filter.ValidateAll(map[filters.FilterType]string{filters.Name: GetSlug(item.Name)}) { @@ -80,14 +81,14 @@ func (s *DashNGoImpl) DownloadConnections(filter filters.Filter) []string { dsListing = s.ListConnections(filter) for _, ds := range dsListing { if dsPacked, err = json.MarshalIndent(ds, "", " "); err != nil { - log.Errorf("%s for %s\n", err, ds.Name) + slog.Error("unable to marshall file", "datasource", ds.Name, "err", err) continue } dsPath := buildResourcePath(slug.Make(ds.Name), config.ConnectionResource) if err = s.storage.WriteFile(dsPath, dsPacked); err != nil { - log.Errorf("%s for %s\n", err, slug.Make(ds.Name)) + slog.Error("Unable to write file", "filename", slug.Make(ds.Name), "err", err) } else { dataFiles = append(dataFiles, dsPath) } @@ -105,7 +106,7 @@ func (s *DashNGoImpl) DeleteAllConnections(filter filters.Filter) []string { dsItem, err := s.client.Datasources.DeleteDataSourceByID(p, s.getAuth()) if err != nil { - log.Warningf("Failed to delete datasource: %s, response: %s", item.Name, dsItem.Error()) + slog.Warn("Failed to delete datasource", "datasource", item.Name, "err", dsItem.Error()) continue } ds = append(ds, item.Name) @@ -119,11 +120,11 @@ func (s *DashNGoImpl) UploadConnections(filter filters.Filter) []string { var exported []string - log.Infof("Reading files from folder: %s", config.Config().GetDefaultGrafanaConfig().GetPath(config.ConnectionResource)) + slog.Info("Reading files from folder", "folder", config.Config().GetDefaultGrafanaConfig().GetPath(config.ConnectionResource)) filesInDir, err := s.storage.FindAllFiles(config.Config().GetDefaultGrafanaConfig().GetPath(config.ConnectionResource), false) if err != nil { - log.WithError(err).Errorf("failed to list files in directory for datasources") + slog.Error("failed to list files in directory for datasources", "err", err) } dsListing = s.ListConnections(filter) @@ -134,13 +135,13 @@ func (s *DashNGoImpl) UploadConnections(filter filters.Filter) []string { fileLocation := filepath.Join(config.Config().GetDefaultGrafanaConfig().GetPath(config.ConnectionResource), file) if strings.HasSuffix(file, ".json") { if rawDS, err = s.storage.ReadFile(fileLocation); err != nil { - log.WithError(err).Errorf("failed to read file: %s", fileLocation) + slog.Error("failed to read file", "filename", fileLocation, "err", err) continue } var newDS models.AddDataSourceCommand if err = json.Unmarshal(rawDS, &newDS); err != nil { - log.WithError(err).Errorf("failed to unmarshall file: %s", fileLocation) + slog.Error("failed to unmarshall file", "filename", fileLocation, "err", err) continue } @@ -153,14 +154,14 @@ func (s *DashNGoImpl) UploadConnections(filter filters.Filter) []string { if newDS.BasicAuth { creds, err = dsConfig.GetCredentials(newDS) if err != nil { //Attempt to get Credentials by URL regex - log.Warn("DataSource has Auth enabled but has no valid Credentials that could be retrieved. Please check your configuration and try again.") + slog.Warn("DataSource has Auth enabled but has no valid Credentials that could be retrieved. Please check your configuration and try again.") } } else { creds = nil } if dsSettings.FiltersEnabled() && dsSettings.IsExcluded(newDS) { - log.Debugf("Skipping local JSON file since source: %s since it fails filter checks with dataType of: %s", newDS.Name, newDS.Type) + slog.Debug("Skipping local JSON file since source fails datatype filter checks", "datasource", newDS.Name, "datatype", newDS.Type) continue } @@ -179,14 +180,14 @@ func (s *DashNGoImpl) UploadConnections(filter filters.Filter) []string { deleteParam := datasources.NewDeleteDataSourceByIDParams() deleteParam.ID = fmt.Sprintf("%d", existingDS.ID) if _, err := s.client.Datasources.DeleteDataSourceByID(deleteParam, s.getAuth()); err != nil { - log.Errorf("error on deleting datasource %s with %s", newDS.Name, err) + slog.Error("error on deleting datasource", "datasource", newDS.Name, "err", err) } break } } p := datasources.NewAddDataSourceParams().WithBody(&newDS) if createStatus, err := s.client.Datasources.AddDataSource(p, s.getAuth()); err != nil { - log.Errorf("error on importing datasource %s with %s (%s)", newDS.Name, err, createStatus.Error()) + slog.Error("error on importing datasource", "datasource", newDS.Name, "err", err, "createError", createStatus.Error()) } else { exported = append(exported, fileLocation) } diff --git a/internal/service/contract.go b/internal/service/contract.go index 73af32fb..550e563e 100644 --- a/internal/service/contract.go +++ b/internal/service/contract.go @@ -5,8 +5,8 @@ import ( "github.com/esnet/gdg/internal/api" "github.com/esnet/gdg/internal/config" "github.com/esnet/grafana-swagger-api-golang/goclient/client" - log "github.com/sirupsen/logrus" "github.com/spf13/viper" + "log/slog" "sync" ) @@ -77,7 +77,7 @@ func configureStorage(obj *DashNGoImpl) { { obj.storage, err = NewCloudStorage(ctx) if err != nil { - log.Warn("falling back on Local Storage, Cloud storage configuration error") + slog.Warn("falling back on Local Storage, Cloud storage configuration error") obj.storage = NewLocalStorage(ctx) } } diff --git a/internal/service/dashboards.go b/internal/service/dashboards.go index a689cf81..c2d4b889 100644 --- a/internal/service/dashboards.go +++ b/internal/service/dashboards.go @@ -4,23 +4,20 @@ import ( "encoding/json" "fmt" "github.com/esnet/gdg/internal/config" - //log2 "github.com/esnet/gdg/internal/log" "github.com/esnet/gdg/internal/service/filters" gapi "github.com/esnet/grafana-swagger-api-golang" "github.com/esnet/grafana-swagger-api-golang/goclient/client/dashboards" "github.com/esnet/grafana-swagger-api-golang/goclient/client/folders" "github.com/esnet/grafana-swagger-api-golang/goclient/client/search" "github.com/esnet/grafana-swagger-api-golang/goclient/models" + "github.com/tidwall/pretty" "golang.org/x/exp/slices" + "log" + "log/slog" "path/filepath" "regexp" "strings" - "github.com/tidwall/pretty" - - log "github.com/sirupsen/logrus" - //log "log/slog" - "github.com/thoas/go-funk" ) @@ -46,7 +43,7 @@ func (s *DashNGoImpl) getDashboardByUid(uid string) (*models.DashboardFullWithMe func NewDashboardFilter(entries ...string) filters.Filter { if len(entries) != 3 { - //log.Log(context.Background(), log2.LevelFatal, "Unable to create a valid Dashboard Filter, aborting.") + log.Fatalf("Unable to create a valid Dashboard Filter, aborting.") } folderFilter := entries[0] dashboardFilter := entries[1] @@ -202,19 +199,19 @@ func (s *DashNGoImpl) DownloadDashboards(filter filters.Filter) []string { dp.UID = link.UID if metaData, err = s.client.Dashboards.GetDashboardByUID(dp, s.getAuth()); err != nil { - log.Errorf("%s for %s\n", err, link.URI) + slog.Error("unable to get Dashboard by UID", "err", err, "Dashboard-URI", link.URI) continue } rawBoard, err = json.Marshal(metaData.Payload.Dashboard) if err != nil { - log.Errorf("unable to serialize dashboard %s", dp.UID) + slog.Error("unable to serialize dashboard", "dashboard", dp.UID) continue } fileName := fmt.Sprintf("%s/%s.json", buildResourceFolder(link.FolderTitle, config.DashboardResource), metaData.Payload.Meta.Slug) if err = s.storage.WriteFile(fileName, pretty.Pretty(rawBoard)); err != nil { - log.Errorf("%s for %s\n", err, metaData.Payload.Meta.Slug) + slog.Error("Unable to save dashboard to file\n", "err", err, "dashboard", metaData.Payload.Meta.Slug) } else { boards = append(boards, fileName) } @@ -249,7 +246,7 @@ func (s *DashNGoImpl) UploadDashboards(filterReq filters.Filter) { path := config.Config().GetDefaultGrafanaConfig().GetPath(config.DashboardResource) filesInDir, err := s.storage.FindAllFiles(path, true) if err != nil { - log.WithError(err).Fatal("unable to find any files to export from storage engine") + log.Fatalf("unable to find any files to export from storage engine, err: %v", err) } //Delete all dashboards that match prior to import s.DeleteAllDashboards(filterReq) @@ -266,24 +263,24 @@ func (s *DashNGoImpl) UploadDashboards(filterReq filters.Filter) { baseFile = strings.ReplaceAll(baseFile, ".json", "") if !strings.HasSuffix(file, ".json") { - log.Warnf("Only json files are supported, skipping %s", file) + slog.Warn("Only json files are supported, skipping", "filename", file) continue } if rawBoard, err = s.storage.ReadFile(file); err != nil { - log.Println(err) + slog.Warn("Unable to read file", "filename", file, "err", err) continue } var board = make(map[string]interface{}) if err = json.Unmarshal(rawBoard, &board); err != nil { - log.WithError(err).Printf("Failed to unmarshall file: %s", file) + slog.Warn("Failed to unmarshall file", "filename", file) continue } //Extract Folder Name based on path folderName, err = getFolderFromResourcePath(s.grafanaConf.Storage, file, config.DashboardResource) if err != nil { - log.Warnf("unable to determine dashboard folder name, falling back on default") + slog.Warn("unable to determine dashboard folder name, falling back on default") } if folderName == "" || folderName == DefaultFolderName { @@ -291,7 +288,7 @@ func (s *DashNGoImpl) UploadDashboards(filterReq filters.Filter) { folderName = DefaultFolderName } if !slices.Contains(validFolders, folderName) && !config.Config().GetDefaultGrafanaConfig().GetFilterOverrides().IgnoreDashboardFilters { - log.Debugf("Skipping file %s, doesn't match any valid folders", file) + slog.Debug("Skipping file since it doesn't match any valid folders", "filename", file) continue } validateMap := map[filters.FilterType]string{filters.FolderFilter: folderName, filters.DashFilter: baseFile} @@ -332,7 +329,7 @@ func (s *DashNGoImpl) UploadDashboards(filterReq filters.Filter) { } if _, exportError := s.client.Dashboards.ImportDashboard(importDashReq, s.getAuth()); exportError != nil { - log.WithError(err).Printf("error on Exporting dashboard %s", file) + slog.Info("error on Exporting dashboard", "dashboard-filename", file, "err", err) continue } diff --git a/internal/service/filters/filters.go b/internal/service/filters/filters.go index 4ab457c2..ee17dbdc 100644 --- a/internal/service/filters/filters.go +++ b/internal/service/filters/filters.go @@ -2,7 +2,8 @@ package filters import ( "github.com/esnet/gdg/internal/config" - log "github.com/sirupsen/logrus" + "log/slog" + "github.com/thoas/go-funk" "regexp" "strings" @@ -63,7 +64,7 @@ func (s *BaseFilter) AddRegex(name FilterType, pattern *regexp.Regexp) { name = DefaultFilter } if pattern == nil { - log.Warnf("invalid pattern received, cannot set filter pattern for entity name: %s", name) + slog.Warn("invalid pattern received, cannot set filter pattern for entity name", "entityName", name) return } s.validationPatterns[name] = pattern diff --git a/internal/service/folders.go b/internal/service/folders.go index 1babac1d..ac23a4b1 100644 --- a/internal/service/folders.go +++ b/internal/service/folders.go @@ -11,9 +11,10 @@ import ( "github.com/esnet/grafana-swagger-api-golang/goclient/client/search" "github.com/esnet/grafana-swagger-api-golang/goclient/models" "github.com/gosimple/slug" - log "github.com/sirupsen/logrus" "github.com/tidwall/gjson" "golang.org/x/exp/slices" + "log" + "log/slog" "path/filepath" "strings" ) @@ -59,7 +60,7 @@ func (s *DashNGoImpl) checkFolderName(folderName string) bool { // DownloadFolderPermissions downloads all the current folder permissions based on filter. func (s *DashNGoImpl) DownloadFolderPermissions(filter filters.Filter) []string { - log.Infof("Downloading folder permissions") + slog.Info("Downloading folder permissions") var ( dsPacked []byte err error @@ -68,12 +69,12 @@ func (s *DashNGoImpl) DownloadFolderPermissions(filter filters.Filter) []string currentPermissions := s.ListFolderPermissions(filter) for folder, permission := range currentPermissions { if dsPacked, err = json.MarshalIndent(permission, "", " "); err != nil { - log.Errorf("%s for %s Permissions\n", err, folder.Title) + slog.Error("Unable to marshall file", "err", err, "folderName", folder.Title) continue } dsPath := buildResourcePath(slug.Make(folder.Title), config.FolderPermissionResource) if err = s.storage.WriteFile(dsPath, dsPacked); err != nil { - log.Errorf("%s for %s\n", err.Error(), slug.Make(folder.Title)) + slog.Error("Unable to write file", "err", err.Error(), "filename", slug.Make(folder.Title)) } else { dataFiles = append(dataFiles, dsPath) } @@ -91,13 +92,13 @@ func (s *DashNGoImpl) UploadFolderPermissions(filter filters.Filter) []string { ) filesInDir, err := s.storage.FindAllFiles(config.Config().GetDefaultGrafanaConfig().GetPath(config.FolderPermissionResource), false) if err != nil { - log.WithError(err).Fatal("Failed to read folders permission imports") + log.Fatalf("Failed to read folders permission imports, %v", err) } for _, file := range filesInDir { fileLocation := filepath.Join(config.Config().GetDefaultGrafanaConfig().GetPath(config.FolderPermissionResource), file) if strings.HasSuffix(file, ".json") { if rawFolder, err = s.storage.ReadFile(fileLocation); err != nil { - log.WithError(err).Errorf("failed to read file %s", fileLocation) + slog.Error("failed to read file", "filename", fileLocation, "err", err) continue } } @@ -106,7 +107,7 @@ func (s *DashNGoImpl) UploadFolderPermissions(filter filters.Filter) []string { newEntries := make([]*models.DashboardACLUpdateItem, 0) err = json.Unmarshal(rawFolder, &newEntries) if err != nil { - log.Warnf("Failed to Decode payload for %s", fileLocation) + slog.Warn("Failed to Decode payload file", "filename", fileLocation) continue } payload := &models.UpdateDashboardACLCommand{ @@ -118,13 +119,13 @@ func (s *DashNGoImpl) UploadFolderPermissions(filter filters.Filter) []string { p.Body = payload _, err := s.client.FolderPermissions.UpdateFolderPermissions(p, s.getAuth()) if err != nil { - log.Errorf("Failed to update folder permissions") + slog.Error("Failed to update folder permissions") } else { dataFiles = append(dataFiles, fileLocation) } } - log.Infof("Patching server with local folder permissions") + slog.Info("Patching server with local folder permissions") return dataFiles } @@ -148,10 +149,9 @@ func (s *DashNGoImpl) ListFolderPermissions(filter filters.Filter) map[*models.H case errors.As(err, &getFolderPermissionListInternalServerError): var castError *folder_permissions.GetFolderPermissionListInternalServerError errors.As(err, &castError) - log.WithField("message", *castError.GetPayload().Message). - WithError(err).Error(msg) + slog.Error(msg, "message", *castError.GetPayload().Message, "err", err) default: - log.WithError(err).Error(msg) + slog.Error(msg, "err", err) } } else { r[foldersList[ndx]] = results.GetPayload() @@ -179,13 +179,13 @@ func (s *DashNGoImpl) ListFolder(filter filters.Filter) []*models.Hit { valid := s.checkFolderName(val.Title) if filter == nil { if !valid { - log.Warningf("Folder '%s' has an invalid character and is not supported. Path seperators are not allowed", val.Title) + slog.Warn("Folder has an invalid character and is not supported. Path separators are not allowed", "folderName", val.Title) continue } result = append(result, folderListing.GetPayload()[ndx]) } else if filter.ValidateAll(map[filters.FilterType]string{filters.FolderFilter: val.Title}) { if !valid { - log.Warningf("Folder '%s' has an invalid character and is not supported. Path seperators are not allowed", val.Title) + slog.Warn("Folder has an invalid character and is not supported. Path separators are not allowed", "folderName", val.Title) continue } result = append(result, folderListing.GetPayload()[ndx]) @@ -206,12 +206,12 @@ func (s *DashNGoImpl) DownloadFolders(filter filters.Filter) []string { folderListing := s.ListFolder(filter) for _, folder := range folderListing { if dsPacked, err = json.MarshalIndent(folder, "", " "); err != nil { - log.Errorf("%s for %s\n", err, folder.Title) + slog.Error("Unable to serialize data to JSON", "err", err, "folderName", folder.Title) continue } dsPath := buildResourcePath(slug.Make(folder.Title), config.FolderResource) if err = s.storage.WriteFile(dsPath, dsPacked); err != nil { - log.Errorf("%s for %s\n", err.Error(), slug.Make(folder.Title)) + slog.Error("Unable to write file.", "err", err.Error(), "folderName", slug.Make(folder.Title)) } else { dataFiles = append(dataFiles, dsPath) } @@ -228,7 +228,7 @@ func (s *DashNGoImpl) UploadFolders(filter filters.Filter) []string { ) filesInDir, err := s.storage.FindAllFiles(config.Config().GetDefaultGrafanaConfig().GetPath(config.FolderResource), false) if err != nil { - log.WithError(err).Fatal("Failed to read folders imports") + log.Fatalf("Failed to read folders imports, %v", err) } folderItems := s.ListFolder(filter) @@ -236,23 +236,23 @@ func (s *DashNGoImpl) UploadFolders(filter filters.Filter) []string { fileLocation := filepath.Join(config.Config().GetDefaultGrafanaConfig().GetPath(config.FolderResource), file) if strings.HasSuffix(file, ".json") { if rawFolder, err = s.storage.ReadFile(fileLocation); err != nil { - log.WithError(err).Errorf("failed to read file %s", fileLocation) + slog.Error("failed to read file", "filename", fileLocation, "err", err) continue } } var newFolder models.CreateFolderCommand if err = json.Unmarshal(rawFolder, &newFolder); err != nil { - log.WithError(err).Warn("failed to unmarshall folder") + slog.Warn("failed to unmarshall folder", "err", err) continue } if !s.checkFolderName(newFolder.Title) { - log.Warningf("Folder '%s' has an invalid character and is not supported, skipping folder", newFolder.Title) + slog.Warn("Folder has an invalid character and is not supported, skipping folder", "folderName", newFolder.Title) continue } skipCreate := false for _, existingFolder := range folderItems { if existingFolder.UID == newFolder.UID { - log.Warnf("Folder '%s' already exists, skipping", existingFolder.Title) + slog.Warn("Folder already exists, skipping", "folderName", existingFolder.Title) skipCreate = true } @@ -264,7 +264,7 @@ func (s *DashNGoImpl) UploadFolders(filter filters.Filter) []string { params.Body = &newFolder f, err := s.client.Folders.CreateFolder(params, s.getAuth()) if err != nil { - log.Errorf("failed to create folder %s", newFolder.Title) + slog.Error("failed to create folder.", "folderName", newFolder.Title, "err", err) continue } result = append(result, f.Payload.Title) diff --git a/internal/service/libraryelements.go b/internal/service/libraryelements.go index 532caa15..cb4f6629 100644 --- a/internal/service/libraryelements.go +++ b/internal/service/libraryelements.go @@ -2,6 +2,7 @@ package service import ( "encoding/json" + "errors" "fmt" "github.com/esnet/gdg/internal/config" "github.com/esnet/gdg/internal/service/filters" @@ -9,10 +10,11 @@ import ( "github.com/esnet/grafana-swagger-api-golang/goclient/client/library_elements" "github.com/esnet/grafana-swagger-api-golang/goclient/models" "github.com/gosimple/slug" - log "github.com/sirupsen/logrus" "github.com/tidwall/gjson" "golang.org/x/exp/maps" "golang.org/x/exp/slices" + "log" + "log/slog" "strings" ) @@ -41,7 +43,7 @@ func (s *DashNGoImpl) ListLibraryElementsConnections(filter filters.Filter, conn for _, item := range payload.GetPayload().Result { dashboard, err := s.getDashboardByUid(item.ConnectionUID) if err != nil { - log.WithField("UID", item.ConnectionUID).Errorf("failed to retrieve linked Dashboard") + slog.Error("failed to retrieve linked Dashboard", "uid", item.ConnectionUID) } results = append(results, dashboard) } @@ -76,7 +78,7 @@ func (s *DashNGoImpl) ListLibraryElements(filter filters.Filter) []*models.Libra params.Kind = tools.PtrOf(listLibraryPanels) libraryElements, err := s.client.LibraryElements.GetLibraryElements(params, s.getAuth()) if err != nil { - log.WithError(err).Fatal("Unable to list Library Elements") + log.Fatalf("Unable to list Library Elements %v", err) } return libraryElements.GetPayload().Result.Elements @@ -95,7 +97,7 @@ func (s *DashNGoImpl) DownloadLibraryElements(filter filters.Filter) []string { listing = s.ListLibraryElements(filter) for _, item := range listing { if dsPacked, err = json.MarshalIndent(item, "", " "); err != nil { - log.Errorf("%s for %s\n", err, item.Name) + slog.Error("Unable to serialize object", "err", err, "library-element", item.Name) continue } folderName := DefaultFolderName @@ -107,7 +109,7 @@ func (s *DashNGoImpl) DownloadLibraryElements(filter filters.Filter) []string { libraryPath := fmt.Sprintf("%s/%s.json", buildResourceFolder(folderName, config.LibraryElementResource), slug.Make(item.Name)) if err = s.storage.WriteFile(libraryPath, dsPacked); err != nil { - log.Errorf("%s for %s\n", err, slug.Make(item.Name)) + slog.Error("Unable to write file", "err", err, "library-element", slug.Make(item.Name)) } else { dataFiles = append(dataFiles, libraryPath) } @@ -124,7 +126,7 @@ func (s *DashNGoImpl) UploadLibraryElements(filter filters.Filter) []string { libraryUID string ) - log.Infof("Reading files from folder: %s", config.Config().GetDefaultGrafanaConfig().GetPath(config.LibraryElementResource)) + slog.Info("Reading files from folder", "folder", config.Config().GetDefaultGrafanaConfig().GetPath(config.LibraryElementResource)) filesInDir, err := s.storage.FindAllFiles(config.Config().GetDefaultGrafanaConfig().GetPath(config.LibraryElementResource), true) currentLibElements := s.ListLibraryElements(filter) @@ -135,14 +137,14 @@ func (s *DashNGoImpl) UploadLibraryElements(filter filters.Filter) []string { } if err != nil { - log.WithError(err).Errorf("failed to list files in directory for library elements") + slog.Error("failed to list files in directory for library elements", "err", err) } for _, file := range filesInDir { fileLocation := file if strings.HasSuffix(file, ".json") { if rawLibraryElement, err = s.storage.ReadFile(fileLocation); err != nil { - log.WithError(err).Errorf("failed to read file: %s", fileLocation) + slog.Error("failed to read file", "file", fileLocation, "err", err) continue } @@ -151,30 +153,29 @@ func (s *DashNGoImpl) UploadLibraryElements(filter filters.Filter) []string { if Results[0].Exists() { folderName = Results[0].String() } else { - log.Errorf("Unable to determine folder name of library component, skipping %s", file) + slog.Error("Unable to determine folder name of library component, skipping.", "filename", file) continue } //Get UID if Results[1].Exists() { libraryUID = Results[1].String() } else { - log.Errorf("Unable to determine the library panel UID, %s, attempting to export anyways", file) - //continue + slog.Error("Unable to determine the library panel UID, attempting to export anyways", "filename", file) } if _, ok := libMapping[libraryUID]; ok { - log.Warnf("Library already exists, skipping %s", file) + slog.Warn("Library already exists, skipping", "filename", file) continue } if !slices.Contains(config.Config().GetDefaultGrafanaConfig().GetMonitoredFolders(), folderName) { - log.WithField("folder", folderName).WithField("file", file).Warn("Skipping since requested file is not in a folder gdg is configured to manage") + slog.Warn("Skipping since requested file is not in a folder gdg is configured to manage", "folder", folderName, "file", file) continue } var newLibraryRequest models.CreateLibraryElementCommand if err = json.Unmarshal(rawLibraryElement, &newLibraryRequest); err != nil { - log.WithError(err).Errorf("failed to unmarshall file: %s", fileLocation) + slog.Error("failed to unmarshall file", "filename", fileLocation, "err", err) continue } @@ -182,7 +183,7 @@ func (s *DashNGoImpl) UploadLibraryElements(filter filters.Filter) []string { params.Body = &newLibraryRequest entity, err := s.client.LibraryElements.CreateLibraryElement(params, s.getAuth()) if err != nil { - log.WithError(err).Errorf("Failed to create library element") + slog.Error("Failed to create library element", "err", err) } else { exported = append(exported, entity.Payload.Result.Name) } @@ -201,13 +202,15 @@ func (s *DashNGoImpl) DeleteAllLibraryElements(filter filters.Filter) []string { params.SetLibraryElementUID(element.UID) _, err := s.client.LibraryElements.DeleteLibraryElementByUID(params, s.getAuth()) if err != nil { - var logEntry *log.Entry - if serr, ok := err.(*library_elements.DeleteLibraryElementByUIDForbidden); ok { - logEntry = log.WithField("ErrorMessage", *serr.GetPayload().Message) - } else { - log.WithError(err) + //var logEntry *log.Entry + logEntries := make([]interface{}, 0) + var serr *library_elements.DeleteLibraryElementByUIDForbidden + if errors.As(err, &serr) { + logEntries = append(logEntries, []interface{}{"ErrorMessage", *serr.GetPayload().Message}...) } - logEntry.Errorf("Failed to delete library panel titled: %s", element.Name) + + logEntries = append(logEntries, []interface{}{"panel", element.Name}...) + slog.Error("Failed to delete library panel", logEntries...) continue } entries = append(entries, element.Name) diff --git a/internal/service/login.go b/internal/service/login.go index e22beef1..e6c58ebd 100644 --- a/internal/service/login.go +++ b/internal/service/login.go @@ -10,7 +10,7 @@ import ( gclient "github.com/esnet/grafana-swagger-api-golang/goclient/client" "github.com/go-openapi/runtime" - log "github.com/sirupsen/logrus" + "log" "net/http" ) diff --git a/internal/service/organizations.go b/internal/service/organizations.go index 96d94a84..e268681d 100644 --- a/internal/service/organizations.go +++ b/internal/service/organizations.go @@ -10,11 +10,12 @@ import ( "github.com/esnet/grafana-swagger-api-golang/goclient/models" "github.com/go-openapi/runtime" "github.com/gosimple/slug" + "log/slog" "path/filepath" "strings" "github.com/esnet/grafana-swagger-api-golang/goclient/client/orgs" - log "github.com/sirupsen/logrus" + "log" ) // OrganizationsApi Contract definition @@ -76,7 +77,7 @@ func (s *DashNGoImpl) getOrganization(id int64) (*models.OrgDetailsDTO, error) { func (s *DashNGoImpl) SetOrganization(id int64) error { //Removes Org filter if id <= 1 { - log.Warnf("organization is not a valid value, resetting to default value of 1.") + slog.Warn("organization is not a valid value, resetting to default value of 1.") s.grafanaConf.OrganizationId = 1 } @@ -100,7 +101,7 @@ func (s *DashNGoImpl) SetOrganization(id int64) error { // ListOrganizations List all dashboards func (s *DashNGoImpl) ListOrganizations() []*models.OrgDTO { if !s.grafanaConf.IsAdminEnabled() { - log.Errorf("No valid Grafana Admin configured, cannot retrieve Organizations List") + slog.Error("No valid Grafana Admin configured, cannot retrieve Organizations List") return nil } @@ -112,9 +113,9 @@ func (s *DashNGoImpl) ListOrganizations() []*models.OrgDTO { case errors.As(err, &swaggerErr): var castError *orgs.SearchOrgsForbidden errors.As(err, &castError) - log.WithField("message", *castError.GetPayload().Message).Fatal(msg) + log.Fatalf("%s, message:%s", msg, *castError.GetPayload().Message) default: - log.WithError(err).Fatal(msg) + log.Fatalf("%s, err: %v", msg, err) } } return orgList.GetPayload() @@ -123,7 +124,7 @@ func (s *DashNGoImpl) ListOrganizations() []*models.OrgDTO { // DownloadOrganizations Download organizations func (s *DashNGoImpl) DownloadOrganizations() []string { if !s.grafanaConf.IsAdminEnabled() { - log.Errorf("No valid Grafana Admin configured, cannot retrieve Organizations") + slog.Error("No valid Grafana Admin configured, cannot retrieve Organizations") return nil } var ( @@ -135,12 +136,12 @@ func (s *DashNGoImpl) DownloadOrganizations() []string { orgsListing := s.ListOrganizations() for _, organisation := range orgsListing { if dsPacked, err = json.MarshalIndent(organisation, "", " "); err != nil { - log.Errorf("%s for %s\n", err, organisation.Name) + slog.Error("Unable to serialize organization object", "err", err, "organization", organisation.Name) continue } dsPath := buildResourcePath(slug.Make(organisation.Name), config.OrganizationResource) if err = s.storage.WriteFile(dsPath, dsPacked); err != nil { - log.Errorf("%s for %s\n", err.Error(), slug.Make(organisation.Name)) + slog.Error("Unable to write file", "err", err.Error(), "organization", slug.Make(organisation.Name)) } else { dataFiles = append(dataFiles, dsPath) } @@ -152,7 +153,7 @@ func (s *DashNGoImpl) DownloadOrganizations() []string { // UploadOrganizations Upload organizations to Grafana func (s *DashNGoImpl) UploadOrganizations() []string { if !s.grafanaConf.IsAdminEnabled() { - log.Errorf("No valid Grafana Admin configured, cannot upload Organizations") + slog.Error("No valid Grafana Admin configured, cannot upload Organizations") return nil } var ( @@ -161,7 +162,7 @@ func (s *DashNGoImpl) UploadOrganizations() []string { ) filesInDir, err := s.storage.FindAllFiles(config.Config().GetDefaultGrafanaConfig().GetPath(config.OrganizationResource), false) if err != nil { - log.WithError(err).Fatal("Failed to read folders imports") + log.Fatalf("Failed to read folders imports, err: %v", err) } orgListing := s.ListOrganizations() orgMap := map[string]bool{} @@ -173,17 +174,17 @@ func (s *DashNGoImpl) UploadOrganizations() []string { fileLocation := filepath.Join(config.Config().GetDefaultGrafanaConfig().GetPath(config.OrganizationResource), file) if strings.HasSuffix(file, ".json") { if rawFolder, err = s.storage.ReadFile(fileLocation); err != nil { - log.WithError(err).Errorf("failed to read file %s", fileLocation) + slog.Error("failed to read file", "filename", fileLocation, "err", err) continue } } var newOrg models.CreateOrgCommand if err = json.Unmarshal(rawFolder, &newOrg); err != nil { - log.WithError(err).Warn("failed to unmarshall folder") + slog.Warn("failed to unmarshall folder", "err", err) continue } if _, ok := orgMap[newOrg.Name]; ok { - log.Infof("Organization %s already exists, skipping", newOrg.Name) + slog.Info("Organization already exists, skipping", "organization", newOrg.Name) continue } @@ -191,7 +192,7 @@ func (s *DashNGoImpl) UploadOrganizations() []string { params.Body = &newOrg _, err = s.client.Orgs.CreateOrg(params, s.getBasicAuth()) if err != nil { - log.Errorf("failed to create folder %s", newOrg.Name) + slog.Error("failed to create folder", "organization", newOrg.Name) continue } result = append(result, newOrg.Name) @@ -203,7 +204,7 @@ func (s *DashNGoImpl) UploadOrganizations() []string { // SwitchOrganization switch organization context func (s *DashNGoImpl) SwitchOrganization(id int64) error { if !s.grafanaConf.IsBasicAuth() { - log.Warnf("Basic auth required for Org switching. Ignoring Org setting and continuing") + slog.Warn("Basic auth required for Org switching. Ignoring Org setting and continuing") return nil } valid := false @@ -211,14 +212,14 @@ func (s *DashNGoImpl) SwitchOrganization(id int64) error { var orgsPayload []*models.OrgDTO orgList, err := s.client.Orgs.SearchOrgs(orgs.NewSearchOrgsParams(), s.getBasicAuth()) if err != nil { - log.Warn("Error fetch organizations requires (SuperAdmin Basic Auth), assuming valid ID was requested. Cannot validate OrgId") + slog.Warn("Error fetch organizations requires (SuperAdmin Basic Auth), assuming valid ID was requested. Cannot validate OrgId") valid = true orgsPayload = make([]*models.OrgDTO, 0) } else { orgsPayload = orgList.GetPayload() } for _, orgEntry := range orgsPayload { - log.Debugf("%d %s\n", orgEntry.ID, orgEntry.Name) + slog.Debug("", "orgID", orgEntry.ID, "OrgName", orgEntry.Name) if orgEntry.ID == s.grafanaConf.GetOrganizationId() { valid = true break @@ -241,7 +242,7 @@ func (s *DashNGoImpl) SwitchOrganization(id int64) error { params.OrgID = id status, err := s.client.SignedInUser.UserSetUsingOrg(params, s.getBasicAuth()) if err != nil { - log.WithError(err).Fatalf("%s for %v\n", err, status) + log.Fatalf("%s for %v\n", err, status) return err } @@ -263,7 +264,7 @@ func (s *DashNGoImpl) getAssociatedActiveOrg(auth runtime.ClientAuthInfoWriter) p := org.NewGetCurrentOrgParams() payload, err := s.client.Org.GetCurrentOrg(p, auth) if err != nil { - log.WithError(err).Fatal("Unable to retrieve current organization") + log.Fatalf("Unable to retrieve current organization, err: %v", err) } return payload.GetPayload() } @@ -273,7 +274,7 @@ func (s *DashNGoImpl) SetUserOrganizations(id int64) error { p.OrgID = id payload, err := s.client.SignedInUser.UserSetUsingOrg(p, s.getBasicAuth()) if err == nil { - log.Debugf(payload.GetPayload().Message) + slog.Debug(payload.GetPayload().Message) } return err } @@ -290,7 +291,7 @@ func (s *DashNGoImpl) ListOrgUsers(orgId int64) []*models.OrgUserDTO { p.OrgID = orgId resp, err := s.client.Orgs.GetOrgUsers(p, s.getGrafanaAdminAuth()) if err != nil { - log.WithError(err).Fatal("failed to get org users") + log.Fatalf("failed to get org users, err: %v", err) } return resp.GetPayload() } diff --git a/internal/service/server.go b/internal/service/server.go index c0df5bf2..13048de2 100644 --- a/internal/service/server.go +++ b/internal/service/server.go @@ -8,7 +8,7 @@ import ( func (s *DashNGoImpl) GetServerInfo() map[string]interface{} { t, err := s.extended.Health() if err != nil { - log.Panic("Unable to get server health info") + log.Fatalf("Unable to get server health info, err: %v", err) } result := make(map[string]interface{}) result["Database"] = t.Database diff --git a/internal/service/serviceaccounts.go b/internal/service/serviceaccounts.go index 69e1408c..c0aba6eb 100644 --- a/internal/service/serviceaccounts.go +++ b/internal/service/serviceaccounts.go @@ -2,13 +2,14 @@ package service import ( "fmt" + "log/slog" "github.com/esnet/gdg/internal/api" "github.com/esnet/gdg/internal/tools" "github.com/esnet/grafana-swagger-api-golang/goclient/client/service_accounts" "github.com/esnet/grafana-swagger-api-golang/goclient/models" "github.com/samber/lo" - log "github.com/sirupsen/logrus" + "log" ) type ServiceAccountApi interface { @@ -28,9 +29,7 @@ func (s *DashNGoImpl) CreateServiceAccount(name, role string, expiration int64) } data, err := s.client.ServiceAccounts.CreateServiceAccount(p, s.getAuth()) if err != nil { - log.WithField("serivceName", name). - WithField("role", role). - Fatal("unable to create a service request") + log.Fatalf("unable to create a service request, serviceName: %s, role: %s", name, role) } return data.GetPayload(), nil @@ -45,8 +44,7 @@ func (s *DashNGoImpl) CreateServiceAccountToken(serviceAccountId int64, name str p.ServiceAccountID = serviceAccountId token, err := s.client.ServiceAccounts.CreateToken(p, s.getAuth()) if err != nil { - log.Error(err.Error()) - log.Fatalf("unable to create token '%s' for service account ID: %d", name, serviceAccountId) + log.Fatalf("unable to create token '%s' for service account ID: %d, err: %v", name, serviceAccountId, err) } @@ -73,7 +71,7 @@ func (s *DashNGoImpl) ListServiceAccounts() []*api.ServiceAccountDTOWithTokens { if item.ServiceAccount.Tokens > 0 { item.Tokens, err = s.ListServiceAccountsTokens(item.ServiceAccount.ID) if err != nil { - log.Warnf("failed to retrieve tokens for service account %d", item.ServiceAccount.ID) + slog.Warn("failed to retrieve tokens for service account", "serviceAccountId", item.ServiceAccount.ID) } } @@ -102,7 +100,7 @@ func (s *DashNGoImpl) DeleteAllServiceAccounts() []string { p.ServiceAccountID = account.ServiceAccount.ID _, err := s.client.ServiceAccounts.DeleteServiceAccount(p, s.getAuth()) if err != nil { - log.Warnf("Failed to delete service account %d", p.ServiceAccountID) + slog.Warn("Failed to delete service account", "ServiceAccountId", p.ServiceAccountID) } else { accountNames = append(accountNames, fmt.Sprintf("service account %d has been deleted", p.ServiceAccountID)) } @@ -124,7 +122,7 @@ func (s *DashNGoImpl) DeleteServiceAccountTokens(serviceId int64) []string { p.ServiceAccountID = serviceId _, err := s.client.ServiceAccounts.DeleteToken(p, s.getAuth()) if err != nil { - log.Errorf("unable to delete token ID: %d", token.ID) + slog.Error("unable to delete token", "tokenID", token.ID) continue } result = append(result, token.Name) diff --git a/internal/service/storage_cloud.go b/internal/service/storage_cloud.go index 52dab9ea..a8a09f4b 100644 --- a/internal/service/storage_cloud.go +++ b/internal/service/storage_cloud.go @@ -8,9 +8,10 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" - log "github.com/sirupsen/logrus" "gocloud.dev/blob" "gocloud.dev/blob/s3blob" + "log" + "log/slog" "os" "path" "path/filepath" @@ -105,7 +106,7 @@ func (s *CloudStorage) FindAllFiles(folder string, fullPath bool) ([]string, err if strings.Contains(obj.Key, folderName) { fileList = append(fileList, obj.Key) } else { - log.Debugf("%s does not match folder path", obj.Key) + slog.Debug("key does not match folder path", "key", obj.Key) } } else { fileList = append(fileList, filepath.Base(obj.Key)) @@ -161,9 +162,9 @@ func NewCloudStorage(c context.Context) (Storage, error) { //attempt to create bucket _, err := client.CreateBucket(&m) if err != nil { - log.Warnf("%s bucket already exists or cannot be created", *m.Bucket) + slog.Warn("bucket already exists or cannot be created", "bucket", *m.Bucket) } else { - log.Infof("bucket %s has been created", *m.Bucket) + slog.Info("bucket has been created", "bucket", *m.Bucket) } }) @@ -176,7 +177,7 @@ func NewCloudStorage(c context.Context) (Storage, error) { } if err != nil { - log.WithError(err).WithField("Msg", errorMsg).Fatal("unable to connect to cloud provider") + log.Fatalf("unable to connect to cloud provider, err: %v, message: %s", err, errorMsg) } entity := &CloudStorage{ diff --git a/internal/service/storage_local.go b/internal/service/storage_local.go index 43617b17..49f70453 100644 --- a/internal/service/storage_local.go +++ b/internal/service/storage_local.go @@ -3,13 +3,12 @@ package service import ( "context" "errors" + "log/slog" "os" "path/filepath" - log "github.com/sirupsen/logrus" "gocloud.dev/blob" "gocloud.dev/blob/fileblob" - _ "gocloud.dev/blob/fileblob" ) // LocalStorage default storage engine @@ -52,7 +51,7 @@ func (s *LocalStorage) WriteFile(filename string, data []byte) error { if err == nil { //Remove attribute file being generated by local storage attrFile := filename + ".attrs" - log.Debugf("Removing file %s", attrFile) + slog.Debug("Removing file", "file", attrFile) defer os.Remove(attrFile) } diff --git a/internal/service/storage_test.go b/internal/service/storage_test.go index 1f98f4e9..ab2ff1d2 100644 --- a/internal/service/storage_test.go +++ b/internal/service/storage_test.go @@ -3,7 +3,7 @@ package service import ( "context" "errors" - log "github.com/sirupsen/logrus" + "log" "path" ) diff --git a/internal/service/teams.go b/internal/service/teams.go index ced5b7a8..0efeda85 100644 --- a/internal/service/teams.go +++ b/internal/service/teams.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/esnet/gdg/internal/config" "github.com/esnet/gdg/internal/service/filters" + "log/slog" "github.com/esnet/grafana-swagger-api-golang/goclient/client/teams" "github.com/esnet/grafana-swagger-api-golang/goclient/models" @@ -14,7 +15,7 @@ import ( "encoding/json" "path/filepath" - log "github.com/sirupsen/logrus" + "log" ) type TeamsApi interface { @@ -65,7 +66,7 @@ func (s *DashNGoImpl) DownloadTeams(filter filters.Filter) map[*models.TeamDTO][ teamFileName := filepath.Join(teamPath, GetSlug(team.Name), "team.json") teamData, err := json.MarshalIndent(&teamListing[ndx], "", "\t") if err != nil { - log.Errorf("could not serialize team object for team name: %s", team.Name) + slog.Error("could not serialize team object for team name", "teamName", team.Name) continue } //Members @@ -74,19 +75,19 @@ func (s *DashNGoImpl) DownloadTeams(filter filters.Filter) map[*models.TeamDTO][ p.TeamID = fmt.Sprintf("%d", team.ID) members, err := s.client.Teams.GetTeamMembers(p, s.getAuth()) if err != nil { - log.Errorf("could not get team members object for team name: %s", team.Name) + slog.Error("could not get team members object for team name", "teamName", team.Name) continue } membersData, err := json.MarshalIndent(members.GetPayload(), "", "\t") if err != nil { - log.Errorf("could not serialize team members object for team name: %s", team.Name) + slog.Error("could not serialize team members object for team name", "teamName", team.Name) continue } //Writing Files if err = s.storage.WriteFile(teamFileName, teamData); err != nil { - log.WithError(err).Errorf("for %s\n", team.Name) + slog.Error("could not write file", "teamName", team.Name, "err", err) } else if err = s.storage.WriteFile(memberFileName, membersData); err != nil { - log.WithError(err).Errorf("for %s\n", team.Name) + slog.Error("could not write team members file", "teamName", team.Name, "err", err) } else { importedTeams[team] = members.GetPayload() } @@ -98,7 +99,7 @@ func (s *DashNGoImpl) DownloadTeams(filter filters.Filter) map[*models.TeamDTO][ func (s *DashNGoImpl) UploadTeams(filter filters.Filter) map[*models.TeamDTO][]*models.TeamMemberDTO { filesInDir, err := s.storage.FindAllFiles(config.Config().GetDefaultGrafanaConfig().GetPath(config.TeamResource), true) if err != nil { - log.WithError(err).Errorf("failed to list files in directory for teams") + slog.Error("failed to list files in directory for teams", "err", err) } exportedTeams := make(map[*models.TeamDTO][]*models.TeamMemberDTO) //Clear previous data. @@ -111,12 +112,12 @@ func (s *DashNGoImpl) UploadTeams(filter filters.Filter) map[*models.TeamDTO][]* //Export Team var rawTeam []byte if rawTeam, err = s.storage.ReadFile(fileLocation); err != nil { - log.WithError(err).Errorf("failed to read file: %s", fileLocation) + slog.Error("failed to read file", "filename", fileLocation, "err", err) continue } var newTeam *models.TeamDTO if err = json.Unmarshal(rawTeam, &newTeam); err != nil { - log.WithError(err).Errorf("failed to unmarshal file: %s", fileLocation) + slog.Error("failed to unmarshal file", "filename", fileLocation, "err", err) continue } p := teams.NewCreateTeamParams() @@ -126,8 +127,7 @@ func (s *DashNGoImpl) UploadTeams(filter filters.Filter) map[*models.TeamDTO][]* } teamCreated, err := s.client.Teams.CreateTeam(p, s.getAuth()) if err != nil { - log.WithError(err).Errorf("failed to create team for file: %s", fileLocation) - continue + slog.Error("failed to create team for file", "filename", fileLocation, "err", err) } newTeam.ID = teamCreated.GetPayload().TeamID @@ -137,22 +137,22 @@ func (s *DashNGoImpl) UploadTeams(filter filters.Filter) map[*models.TeamDTO][]* teamMemberLocation := filepath.Join(config.Config().GetDefaultGrafanaConfig().GetPath(config.TeamResource), GetSlug(newTeam.Name), "members.json") if rawMembers, err = s.storage.ReadFile(teamMemberLocation); err != nil { - log.WithError(err).Errorf("failed to find team members: %s", fileLocation) + slog.Error("failed to find team members", "filename", fileLocation, "err", err) continue } var newMembers []*models.TeamMemberDTO if err = json.Unmarshal(rawMembers, &newMembers); err != nil { - log.WithError(err).Errorf("failed to unmarshal file: %s", fileLocation) + slog.Error("failed to unmarshal file", "filename", fileLocation, "err", err) continue } for _, member := range newMembers { if s.isAdminUser(member.UserID, member.Name) { - log.Warnf("skipping admin user, already added when new team is created") + slog.Warn("skipping admin user, already added when new team is created") continue } _, err := s.addTeamMember(newTeam, member) if err != nil { - log.WithError(err).Errorf("failed to create team member for team %s with ID %d", newTeam.Name, member.UserID) + slog.Error("failed to create team member for team", "teamName", newTeam.Name, "MemberID", member.UserID, "err", err) } else { currentMembers = append(currentMembers, member) } @@ -221,7 +221,7 @@ func (s *DashNGoImpl) DeleteTeam(filter filters.Filter) ([]*models.TeamDTO, erro p.TeamID = fmt.Sprintf("%d", team.ID) _, err := s.client.Teams.DeleteTeamByID(p, s.getAuth()) if err != nil { - log.Errorf("failed to delete team: '%s'", team.Name) + slog.Error("failed to delete team", "teamName", team.Name) continue } result = append(result, team) @@ -265,9 +265,9 @@ func (s *DashNGoImpl) addTeamMember(team *models.TeamDTO, userDTO *models.TeamMe p.Body = &models.AddTeamMemberCommand{UserID: user.ID} msg, err := s.client.Teams.AddTeamMember(p, s.getAuth()) if err != nil { - log.Info(err.Error()) + slog.Info(err.Error()) errorMsg := fmt.Sprintf("failed to add member '%s' to team '%s'", userDTO.Login, team.Name) - log.Error(errorMsg) + slog.Error(errorMsg) return "", errors.New(errorMsg) } if userDTO.Permission == AdminUserPermission { @@ -279,7 +279,7 @@ func (s *DashNGoImpl) addTeamMember(team *models.TeamDTO, userDTO *models.TeamMe if err != nil { return "", err } - log.WithField("message", response.GetPayload().Message).Debugf("Updated permissions for user %s on team %s", userDTO.Name, team.Name) + slog.Debug("Updated permissions for user on team ", "username", userDTO.Name, "teamName", team.Name, "message", response.GetPayload().Message) } return msg.GetPayload().Message, nil diff --git a/internal/service/tokens.go b/internal/service/tokens.go index 99ace136..08c4e950 100644 --- a/internal/service/tokens.go +++ b/internal/service/tokens.go @@ -2,10 +2,11 @@ package service import ( "fmt" + "log/slog" "github.com/esnet/grafana-swagger-api-golang/goclient/client/api_keys" "github.com/esnet/grafana-swagger-api-golang/goclient/models" - log "github.com/sirupsen/logrus" + "log" ) type TokenApi interface { @@ -31,7 +32,7 @@ func (s *DashNGoImpl) DeleteAllTokens() []string { for _, key := range keys { err := s.deleteAPIKey(key.ID) if err != nil { - log.Warnf("Failed to delete API key %d named %s", key.ID, key.Name) + slog.Warn("Failed to delete API key", "APIKeyID", key.ID, "APIKey", key.Name) continue } deleted = append(deleted, key.Name) diff --git a/internal/service/user.go b/internal/service/user.go index 719033dd..2c2a5f9c 100644 --- a/internal/service/user.go +++ b/internal/service/user.go @@ -13,8 +13,9 @@ import ( "github.com/esnet/grafana-swagger-api-golang/goclient/client/users" "github.com/esnet/grafana-swagger-api-golang/goclient/models" "github.com/gosimple/slug" - log "github.com/sirupsen/logrus" "github.com/tidwall/pretty" + "log" + "log/slog" "path/filepath" "strings" ) @@ -91,17 +92,17 @@ func (s *DashNGoImpl) DownloadUsers(filter filters.Filter) []string { userPath := buildResourceFolder("", config.UserResource) for ndx, user := range userListing { if s.isAdminUser(user.ID, user.Name) { - log.Info("Skipping admin super user") + slog.Info("Skipping admin super user") continue } fileName := filepath.Join(userPath, fmt.Sprintf("%s.json", GetSlug(user.Login))) userData, err = json.Marshal(&userListing[ndx]) if err != nil { - log.Errorf("could not serialize user object for userId: %d", user.ID) + slog.Error("could not serialize user object for userId", "userID", user.ID) continue } if err = s.storage.WriteFile(fileName, pretty.Pretty(userData)); err != nil { - log.WithError(err).Errorf("for %s\n", user.Login) + slog.Error("Failed to write file", "filename", user.Login, "err", err) } else { importedUsers = append(importedUsers, fileName) } @@ -119,7 +120,7 @@ func (s *DashNGoImpl) isAdminUser(id int64, name string) bool { func (s *DashNGoImpl) UploadUsers(filter filters.Filter) []models.UserProfileDTO { filesInDir, err := s.storage.FindAllFiles(config.Config().GetDefaultGrafanaConfig().GetPath(config.UserResource), false) if err != nil { - log.WithError(err).Errorf("failed to list files in directory for userListings") + slog.Error("failed to list files in directory for userListings", "err", err) } var userListings []models.UserProfileDTO var rawUser []byte @@ -136,11 +137,11 @@ func (s *DashNGoImpl) UploadUsers(filter filters.Filter) []models.UserProfileDTO fileLocation := filepath.Join(config.Config().GetDefaultGrafanaConfig().GetPath(config.UserResource), file) if strings.HasSuffix(file, ".json") { if rawUser, err = s.storage.ReadFile(fileLocation); err != nil { - log.WithError(err).Errorf("failed to read file: %s", fileLocation) + slog.Error("failed to read file", "filename", fileLocation, "err", err) continue } if val, ok := currentUsers[filepath.Base(file)]; ok { - log.Warnf("User %s already exist, skipping", val.Login) + slog.Warn("User already exist, skipping", "username", val.Login) continue } var newUser models.AdminCreateUserForm @@ -150,37 +151,37 @@ func (s *DashNGoImpl) UploadUsers(filter filters.Filter) []models.UserProfileDTO var data = make(map[string]interface{}, 0) if err = json.Unmarshal(rawUser, &data); err != nil { - log.WithError(err).Errorf("failed to unmarshall file: %s", fileLocation) + slog.Error("failed to unmarshall file", "filename", fileLocation, "err", err) continue } data["password"] = password //Get raw version of payload once more with password if rawUser, err = json.Marshal(data); err != nil { - log.WithError(err).Errorf("failed to marshall file: %s to include password", fileLocation) + slog.Error("failed to marshall file to include password", "filename", fileLocation, "err", err) } if err = json.Unmarshal(rawUser, &newUser); err != nil { - log.WithError(err).Errorf("failed to unmarshall file: %s", fileLocation) + slog.Error("failed to unmarshall file", "filename", fileLocation, "err", err) continue } if newUser.Name == "admin" { - log.Info("Skipping admin user") + slog.Info("Skipping admin user") continue } params := admin_users.NewAdminCreateUserParams() params.Body = &newUser userCreated, err := s.client.AdminUsers.AdminCreateUser(params, s.getBasicAuth()) if err != nil { - log.WithError(err).Errorf("Failed to create user for file: %s", fileLocation) + slog.Error("Failed to create user for file", "filename", fileLocation, "err", err) continue } p := users.NewGetUserByIDParams() p.UserID = userCreated.Payload.ID resp, err := s.client.Users.GetUserByID(p, s.getBasicAuth()) if err != nil { - log.Errorf("unable to read user: %s, ID: %d back from grafana", newUser.Email, userCreated.Payload.ID) + slog.Error("unable to read user back from grafana", "username", newUser.Email, "userID", userCreated.GetPayload().ID) continue } userListings = append(userListings, *resp.Payload) @@ -219,7 +220,7 @@ func (s *DashNGoImpl) DeleteAllUsers(filter filters.Filter) []string { var deletedUsers []string for _, user := range userListing { if s.isAdminUser(user.ID, user.Name) { - log.Info("Skipping admin user") + slog.Info("Skipping admin user") continue } @@ -261,7 +262,7 @@ func (s *DashNGoImpl) PromoteUser(userLogin string) (string, error) { msg, err := s.client.AdminUsers.AdminUpdateUserPermissions(promoteUserParam, s.getBasicAuth()) if err != nil { errorMsg := fmt.Sprintf("failed to promote user: '%s'", userLogin) - log.Error(errorMsg) + slog.Error("failed to promote user", "username", userLogin, "err", err) return "", errors.New(errorMsg) } diff --git a/test/common_test.go b/test/common_test.go index 4508f6cc..ac2d85a4 100644 --- a/test/common_test.go +++ b/test/common_test.go @@ -93,11 +93,11 @@ func TestMain(m *testing.M) { pool := setupDockerTest() var wg *sync.WaitGroup = new(sync.WaitGroup) wg.Add(2) - slog.Info("Starting at: %s", time.Now().String()) + slog.Info("Starting at", "time", time.Now().String()) go setupMinioContainer(pool, wg) go setupGrafanaContainer(pool, wg) wg.Wait() - slog.Info("Ending at: %s", time.Now().String()) + slog.Info("Ending at", "end", time.Now().String()) exitVal := m.Run() diff --git a/test/libraryelements_integration_test.go b/test/libraryelements_integration_test.go index 9adf1ada..8683a1e0 100644 --- a/test/libraryelements_integration_test.go +++ b/test/libraryelements_integration_test.go @@ -22,7 +22,7 @@ func TestLibraryElementsCRUD(t *testing.T) { apiClient.UploadLibraryElements(filtersEntity) slog.Info("Listing all library elements") boards := apiClient.ListLibraryElements(filtersEntity) - slog.Info("Imported %d library elements", len(boards)) + slog.Info("Imported library elements", "count", len(boards)) var generalBoard *models.LibraryElementDTO var otherBoard *models.LibraryElementDTO for ndx, board := range boards {