mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: use any rather than interface{} (#74066)
This commit is contained in:
@@ -52,14 +52,14 @@ func init() {
|
||||
// Non-optimal global solution to replace plugin SDK default loggers for core plugins.
|
||||
sdklog.DefaultLogger = &logWrapper{logger: log.New("plugin.coreplugin")}
|
||||
backend.Logger = sdklog.DefaultLogger
|
||||
backend.NewLoggerWith = func(args ...interface{}) sdklog.Logger {
|
||||
backend.NewLoggerWith = func(args ...any) sdklog.Logger {
|
||||
for i, arg := range args {
|
||||
// Obtain logger name from args.
|
||||
if s, ok := arg.(string); ok && s == "logger" {
|
||||
l := &logWrapper{logger: log.New(args[i+1].(string))}
|
||||
// new args slice without logger name and logger name value
|
||||
if len(args) > 2 {
|
||||
newArgs := make([]interface{}, 0, len(args)-2)
|
||||
newArgs := make([]any, 0, len(args)-2)
|
||||
newArgs = append(newArgs, args[:i]...)
|
||||
newArgs = append(newArgs, args[i+2:]...)
|
||||
return l.With(newArgs...)
|
||||
@@ -120,7 +120,7 @@ func (cr *Registry) BackendFactoryProvider() func(_ context.Context, p *plugins.
|
||||
}
|
||||
}
|
||||
|
||||
func asBackendPlugin(svc interface{}) backendplugin.PluginFactoryFunc {
|
||||
func asBackendPlugin(svc any) backendplugin.PluginFactoryFunc {
|
||||
opts := backend.ServeOpts{}
|
||||
if queryHandler, ok := svc.(backend.QueryDataHandler); ok {
|
||||
opts.QueryDataHandler = queryHandler
|
||||
@@ -147,19 +147,19 @@ type logWrapper struct {
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
func (l *logWrapper) Debug(msg string, args ...interface{}) {
|
||||
func (l *logWrapper) Debug(msg string, args ...any) {
|
||||
l.logger.Debug(msg, args...)
|
||||
}
|
||||
|
||||
func (l *logWrapper) Info(msg string, args ...interface{}) {
|
||||
func (l *logWrapper) Info(msg string, args ...any) {
|
||||
l.logger.Info(msg, args...)
|
||||
}
|
||||
|
||||
func (l *logWrapper) Warn(msg string, args ...interface{}) {
|
||||
func (l *logWrapper) Warn(msg string, args ...any) {
|
||||
l.logger.Warn(msg, args...)
|
||||
}
|
||||
|
||||
func (l *logWrapper) Error(msg string, args ...interface{}) {
|
||||
func (l *logWrapper) Error(msg string, args ...any) {
|
||||
l.logger.Error(msg, args...)
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ func (l *logWrapper) Level() sdklog.Level {
|
||||
return sdklog.NoLevel
|
||||
}
|
||||
|
||||
func (l *logWrapper) With(args ...interface{}) sdklog.Logger {
|
||||
func (l *logWrapper) With(args ...any) sdklog.Logger {
|
||||
l.logger = l.logger.New(args...)
|
||||
return l
|
||||
}
|
||||
|
||||
@@ -14,15 +14,15 @@ type logWrapper struct {
|
||||
Logger plog.Logger
|
||||
|
||||
name string
|
||||
impliedArgs []interface{}
|
||||
impliedArgs []any
|
||||
}
|
||||
|
||||
func formatArgs(args ...interface{}) []interface{} {
|
||||
func formatArgs(args ...any) []any {
|
||||
if len(args) == 0 || len(args)%2 != 0 {
|
||||
return args
|
||||
}
|
||||
|
||||
res := []interface{}{}
|
||||
res := []any{}
|
||||
|
||||
for n := 0; n < len(args); n += 2 {
|
||||
key := args[n]
|
||||
@@ -39,7 +39,7 @@ func formatArgs(args ...interface{}) []interface{} {
|
||||
}
|
||||
|
||||
// Emit a message and key/value pairs at a provided log level
|
||||
func (lw logWrapper) Log(level hclog.Level, msg string, args ...interface{}) {
|
||||
func (lw logWrapper) Log(level hclog.Level, msg string, args ...any) {
|
||||
switch level {
|
||||
case hclog.Trace:
|
||||
lw.Trace(msg, args...)
|
||||
@@ -57,27 +57,27 @@ func (lw logWrapper) Log(level hclog.Level, msg string, args ...interface{}) {
|
||||
}
|
||||
|
||||
// Emit a message and key/value pairs at the TRACE level
|
||||
func (lw logWrapper) Trace(msg string, args ...interface{}) {
|
||||
func (lw logWrapper) Trace(msg string, args ...any) {
|
||||
lw.Logger.Debug(msg, formatArgs(args...)...)
|
||||
}
|
||||
|
||||
// Emit a message and key/value pairs at the DEBUG level
|
||||
func (lw logWrapper) Debug(msg string, args ...interface{}) {
|
||||
func (lw logWrapper) Debug(msg string, args ...any) {
|
||||
lw.Logger.Debug(msg, formatArgs(args...)...)
|
||||
}
|
||||
|
||||
// Emit a message and key/value pairs at the INFO level
|
||||
func (lw logWrapper) Info(msg string, args ...interface{}) {
|
||||
func (lw logWrapper) Info(msg string, args ...any) {
|
||||
lw.Logger.Info(msg, formatArgs(args...)...)
|
||||
}
|
||||
|
||||
// Emit a message and key/value pairs at the WARN level
|
||||
func (lw logWrapper) Warn(msg string, args ...interface{}) {
|
||||
func (lw logWrapper) Warn(msg string, args ...any) {
|
||||
lw.Logger.Warn(msg, formatArgs(args...)...)
|
||||
}
|
||||
|
||||
// Emit a message and key/value pairs at the ERROR level
|
||||
func (lw logWrapper) Error(msg string, args ...interface{}) {
|
||||
func (lw logWrapper) Error(msg string, args ...any) {
|
||||
lw.Logger.Error(msg, formatArgs(args...)...)
|
||||
}
|
||||
|
||||
@@ -97,12 +97,12 @@ func (lw logWrapper) IsWarn() bool { return true }
|
||||
func (lw logWrapper) IsError() bool { return true }
|
||||
|
||||
// ImpliedArgs returns With key/value pairs
|
||||
func (lw logWrapper) ImpliedArgs() []interface{} {
|
||||
func (lw logWrapper) ImpliedArgs() []any {
|
||||
return lw.impliedArgs
|
||||
}
|
||||
|
||||
// Creates a sublogger that will always have the given key/value pairs
|
||||
func (lw logWrapper) With(args ...interface{}) hclog.Logger {
|
||||
func (lw logWrapper) With(args ...any) hclog.Logger {
|
||||
return logWrapper{
|
||||
Logger: lw.Logger.New(args...),
|
||||
name: lw.name,
|
||||
|
||||
@@ -10,14 +10,14 @@ import (
|
||||
|
||||
func TestLogWrapper(t *testing.T) {
|
||||
tcs := []struct {
|
||||
args []interface{}
|
||||
expectedResult []interface{}
|
||||
args []any
|
||||
expectedResult []any
|
||||
}{
|
||||
{args: []interface{}{}, expectedResult: []interface{}{}},
|
||||
{args: []interface{}{"1", "2", "3"}, expectedResult: []interface{}{"1", "2", "3"}},
|
||||
{args: []interface{}{"1", "2"}, expectedResult: []interface{}{"1", "2"}},
|
||||
{args: []interface{}{"1", "2", "timestamp", time.Now()}, expectedResult: []interface{}{"1", "2"}},
|
||||
{args: []interface{}{"1", "2", "timestamp", time.Now(), "3", "4"}, expectedResult: []interface{}{"1", "2", "3", "4"}},
|
||||
{args: []any{}, expectedResult: []any{}},
|
||||
{args: []any{"1", "2", "3"}, expectedResult: []any{"1", "2", "3"}},
|
||||
{args: []any{"1", "2"}, expectedResult: []any{"1", "2"}},
|
||||
{args: []any{"1", "2", "timestamp", time.Now()}, expectedResult: []any{"1", "2"}},
|
||||
{args: []any{"1", "2", "timestamp", time.Now(), "3", "4"}, expectedResult: []any{"1", "2", "3", "4"}},
|
||||
}
|
||||
|
||||
for i, tc := range tcs {
|
||||
|
||||
@@ -96,7 +96,7 @@ func instrumentPluginRequest(ctx context.Context, cfg Cfg, pluginCtx *backend.Pl
|
||||
}
|
||||
|
||||
if cfg.LogDatasourceRequests {
|
||||
logParams := []interface{}{
|
||||
logParams := []any{
|
||||
"status", status,
|
||||
"duration", elapsed,
|
||||
"pluginId", pluginCtx.PluginID,
|
||||
|
||||
@@ -20,7 +20,7 @@ func (p *RendererGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Serve
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *RendererGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {
|
||||
func (p *RendererGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (any, error) {
|
||||
return &RendererGRPCClient{NewRendererClient(c), NewSanitizerClient(c)}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ func file_sanitizer_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_sanitizer_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_sanitizer_proto_goTypes = []interface{}{
|
||||
var file_sanitizer_proto_goTypes = []any{
|
||||
(*SanitizeRequest)(nil), // 0: pluginextensionv2.SanitizeRequest
|
||||
(*SanitizeResponse)(nil), // 1: pluginextensionv2.SanitizeResponse
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func file_sanitizer_proto_init() {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_sanitizer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_sanitizer_proto_msgTypes[0].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*SanitizeRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -224,7 +224,7 @@ func file_sanitizer_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_sanitizer_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_sanitizer_proto_msgTypes[1].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*SanitizeResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -306,7 +306,7 @@ func RegisterSanitizerServer(s *grpc.Server, srv SanitizerServer) {
|
||||
s.RegisterService(&_Sanitizer_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Sanitizer_Sanitize_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _Sanitizer_Sanitize_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(SanitizeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@@ -318,7 +318,7 @@ func _Sanitizer_Sanitize_Handler(srv interface{}, ctx context.Context, dec func(
|
||||
Server: srv,
|
||||
FullMethod: "/pluginextensionv2.Sanitizer/Sanitize",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(SanitizerServer).Sanitize(ctx, req.(*SanitizeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
|
||||
@@ -893,7 +893,7 @@ func file_secretsmanager_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_secretsmanager_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_secretsmanager_proto_goTypes = []interface{}{
|
||||
var file_secretsmanager_proto_goTypes = []any{
|
||||
(*Key)(nil), // 0: secretsmanagerplugin.Key
|
||||
(*Item)(nil), // 1: secretsmanagerplugin.Item
|
||||
(*GetSecretRequest)(nil), // 2: secretsmanagerplugin.GetSecretRequest
|
||||
@@ -943,7 +943,7 @@ func file_secretsmanager_proto_init() {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_secretsmanager_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[0].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*Key); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -955,7 +955,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[1].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*Item); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -967,7 +967,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[2].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*GetSecretRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -979,7 +979,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[3].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*GetSecretResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -991,7 +991,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[4].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*SetSecretRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1003,7 +1003,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[5].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*SetSecretResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1015,7 +1015,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[6].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*DeleteSecretRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1027,7 +1027,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[7].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*DeleteSecretResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1039,7 +1039,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[8].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*ListSecretsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1051,7 +1051,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[9].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*ListSecretsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1063,7 +1063,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[10].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*GetAllSecretsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1075,7 +1075,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[11].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*GetAllSecretsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1087,7 +1087,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[12].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*RenameSecretRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1099,7 +1099,7 @@ func file_secretsmanager_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_secretsmanager_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
|
||||
file_secretsmanager_proto_msgTypes[13].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*RenameSecretResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
||||
@@ -19,7 +19,7 @@ func (p *SecretsManagerGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *SecretsManagerGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {
|
||||
func (p *SecretsManagerGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (any, error) {
|
||||
return &SecretsManagerGRPCClient{NewSecretsManagerClient(c)}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ func RegisterSecretsManagerServer(s grpc.ServiceRegistrar, srv SecretsManagerSer
|
||||
s.RegisterService(&SecretsManager_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _SecretsManager_GetSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _SecretsManager_GetSecret_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(GetSecretRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@@ -153,13 +153,13 @@ func _SecretsManager_GetSecret_Handler(srv interface{}, ctx context.Context, dec
|
||||
Server: srv,
|
||||
FullMethod: "/secretsmanagerplugin.SecretsManager/GetSecret",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(SecretsManagerServer).GetSecret(ctx, req.(*GetSecretRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SecretsManager_SetSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _SecretsManager_SetSecret_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(SetSecretRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@@ -171,13 +171,13 @@ func _SecretsManager_SetSecret_Handler(srv interface{}, ctx context.Context, dec
|
||||
Server: srv,
|
||||
FullMethod: "/secretsmanagerplugin.SecretsManager/SetSecret",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(SecretsManagerServer).SetSecret(ctx, req.(*SetSecretRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SecretsManager_DeleteSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _SecretsManager_DeleteSecret_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(DeleteSecretRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@@ -189,13 +189,13 @@ func _SecretsManager_DeleteSecret_Handler(srv interface{}, ctx context.Context,
|
||||
Server: srv,
|
||||
FullMethod: "/secretsmanagerplugin.SecretsManager/DeleteSecret",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(SecretsManagerServer).DeleteSecret(ctx, req.(*DeleteSecretRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SecretsManager_ListSecrets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _SecretsManager_ListSecrets_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(ListSecretsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@@ -207,13 +207,13 @@ func _SecretsManager_ListSecrets_Handler(srv interface{}, ctx context.Context, d
|
||||
Server: srv,
|
||||
FullMethod: "/secretsmanagerplugin.SecretsManager/ListSecrets",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(SecretsManagerServer).ListSecrets(ctx, req.(*ListSecretsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SecretsManager_RenameSecret_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _SecretsManager_RenameSecret_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(RenameSecretRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@@ -225,13 +225,13 @@ func _SecretsManager_RenameSecret_Handler(srv interface{}, ctx context.Context,
|
||||
Server: srv,
|
||||
FullMethod: "/secretsmanagerplugin.SecretsManager/RenameSecret",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(SecretsManagerServer).RenameSecret(ctx, req.(*RenameSecretRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SecretsManager_GetAllSecrets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
func _SecretsManager_GetAllSecrets_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
|
||||
in := new(GetAllSecretsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
@@ -243,7 +243,7 @@ func _SecretsManager_GetAllSecrets_Handler(srv interface{}, ctx context.Context,
|
||||
Server: srv,
|
||||
FullMethod: "/secretsmanagerplugin.SecretsManager/GetAllSecrets",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
return srv.(SecretsManagerServer).GetAllSecrets(ctx, req.(*GetAllSecretsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
|
||||
@@ -13,29 +13,29 @@ func NewTestLogger() *TestLogger {
|
||||
return &TestLogger{}
|
||||
}
|
||||
|
||||
func (f *TestLogger) New(_ ...interface{}) Logger {
|
||||
func (f *TestLogger) New(_ ...any) Logger {
|
||||
return NewTestLogger()
|
||||
}
|
||||
|
||||
func (f *TestLogger) Info(msg string, ctx ...interface{}) {
|
||||
func (f *TestLogger) Info(msg string, ctx ...any) {
|
||||
f.InfoLogs.Calls++
|
||||
f.InfoLogs.Message = msg
|
||||
f.InfoLogs.Ctx = ctx
|
||||
}
|
||||
|
||||
func (f *TestLogger) Warn(msg string, ctx ...interface{}) {
|
||||
func (f *TestLogger) Warn(msg string, ctx ...any) {
|
||||
f.WarnLogs.Calls++
|
||||
f.WarnLogs.Message = msg
|
||||
f.WarnLogs.Ctx = ctx
|
||||
}
|
||||
|
||||
func (f *TestLogger) Debug(msg string, ctx ...interface{}) {
|
||||
func (f *TestLogger) Debug(msg string, ctx ...any) {
|
||||
f.DebugLogs.Calls++
|
||||
f.DebugLogs.Message = msg
|
||||
f.DebugLogs.Ctx = ctx
|
||||
}
|
||||
|
||||
func (f *TestLogger) Error(msg string, ctx ...interface{}) {
|
||||
func (f *TestLogger) Error(msg string, ctx ...any) {
|
||||
f.ErrorLogs.Calls++
|
||||
f.ErrorLogs.Message = msg
|
||||
f.ErrorLogs.Ctx = ctx
|
||||
@@ -44,7 +44,7 @@ func (f *TestLogger) Error(msg string, ctx ...interface{}) {
|
||||
type Logs struct {
|
||||
Calls int
|
||||
Message string
|
||||
Ctx []interface{}
|
||||
Ctx []any
|
||||
}
|
||||
|
||||
var _ PrettyLogger = (*TestPrettyLogger)(nil)
|
||||
@@ -55,13 +55,13 @@ func NewTestPrettyLogger() *TestPrettyLogger {
|
||||
return &TestPrettyLogger{}
|
||||
}
|
||||
|
||||
func (f *TestPrettyLogger) Successf(_ string, _ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Failuref(_ string, _ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Info(_ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Infof(_ string, _ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Debug(_ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Debugf(_ string, _ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Warn(_ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Warnf(_ string, _ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Error(_ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Errorf(_ string, _ ...interface{}) {}
|
||||
func (f *TestPrettyLogger) Successf(_ string, _ ...any) {}
|
||||
func (f *TestPrettyLogger) Failuref(_ string, _ ...any) {}
|
||||
func (f *TestPrettyLogger) Info(_ ...any) {}
|
||||
func (f *TestPrettyLogger) Infof(_ string, _ ...any) {}
|
||||
func (f *TestPrettyLogger) Debug(_ ...any) {}
|
||||
func (f *TestPrettyLogger) Debugf(_ string, _ ...any) {}
|
||||
func (f *TestPrettyLogger) Warn(_ ...any) {}
|
||||
func (f *TestPrettyLogger) Warnf(_ string, _ ...any) {}
|
||||
func (f *TestPrettyLogger) Error(_ ...any) {}
|
||||
func (f *TestPrettyLogger) Errorf(_ string, _ ...any) {}
|
||||
|
||||
@@ -16,42 +16,42 @@ func NewPrettyLogger(name string) *prettyLogger {
|
||||
}
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Successf(format string, args ...interface{}) {
|
||||
func (l *prettyLogger) Successf(format string, args ...any) {
|
||||
l.log.Info(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Failuref(format string, args ...interface{}) {
|
||||
func (l *prettyLogger) Failuref(format string, args ...any) {
|
||||
l.log.Error(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Info(args ...interface{}) {
|
||||
func (l *prettyLogger) Info(args ...any) {
|
||||
l.log.Info(fmt.Sprint(args...))
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Infof(format string, args ...interface{}) {
|
||||
func (l *prettyLogger) Infof(format string, args ...any) {
|
||||
l.log.Info(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Debug(args ...interface{}) {
|
||||
func (l *prettyLogger) Debug(args ...any) {
|
||||
l.log.Debug(fmt.Sprint(args...))
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Debugf(format string, args ...interface{}) {
|
||||
func (l *prettyLogger) Debugf(format string, args ...any) {
|
||||
l.log.Debug(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Warn(args ...interface{}) {
|
||||
func (l *prettyLogger) Warn(args ...any) {
|
||||
l.log.Warn(fmt.Sprint(args...))
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Warnf(format string, args ...interface{}) {
|
||||
func (l *prettyLogger) Warnf(format string, args ...any) {
|
||||
l.log.Warn(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Error(args ...interface{}) {
|
||||
func (l *prettyLogger) Error(args ...any) {
|
||||
l.log.Error(fmt.Sprint(args...))
|
||||
}
|
||||
|
||||
func (l *prettyLogger) Errorf(format string, args ...interface{}) {
|
||||
func (l *prettyLogger) Errorf(format string, args ...any) {
|
||||
l.log.Error(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
@@ -14,31 +14,31 @@ type grafanaInfraLogWrapper struct {
|
||||
l *log.ConcreteLogger
|
||||
}
|
||||
|
||||
func (d *grafanaInfraLogWrapper) New(ctx ...interface{}) Logger {
|
||||
func (d *grafanaInfraLogWrapper) New(ctx ...any) Logger {
|
||||
if len(ctx) == 0 {
|
||||
return &grafanaInfraLogWrapper{
|
||||
l: d.l.New(),
|
||||
}
|
||||
}
|
||||
|
||||
ctx = append([]interface{}{"logger"}, ctx...)
|
||||
ctx = append([]any{"logger"}, ctx...)
|
||||
return &grafanaInfraLogWrapper{
|
||||
l: d.l.New(ctx...),
|
||||
}
|
||||
}
|
||||
|
||||
func (d *grafanaInfraLogWrapper) Debug(msg string, ctx ...interface{}) {
|
||||
func (d *grafanaInfraLogWrapper) Debug(msg string, ctx ...any) {
|
||||
d.l.Debug(msg, ctx...)
|
||||
}
|
||||
|
||||
func (d *grafanaInfraLogWrapper) Info(msg string, ctx ...interface{}) {
|
||||
func (d *grafanaInfraLogWrapper) Info(msg string, ctx ...any) {
|
||||
d.l.Info(msg, ctx...)
|
||||
}
|
||||
|
||||
func (d *grafanaInfraLogWrapper) Warn(msg string, ctx ...interface{}) {
|
||||
func (d *grafanaInfraLogWrapper) Warn(msg string, ctx ...any) {
|
||||
d.l.Warn(msg, ctx...)
|
||||
}
|
||||
|
||||
func (d *grafanaInfraLogWrapper) Error(msg string, ctx ...interface{}) {
|
||||
func (d *grafanaInfraLogWrapper) Error(msg string, ctx ...any) {
|
||||
d.l.Error(msg, ctx...)
|
||||
}
|
||||
|
||||
@@ -211,19 +211,19 @@ type PluginMetaDTO struct {
|
||||
}
|
||||
|
||||
type DataSourceDTO struct {
|
||||
ID int64 `json:"id,omitempty"`
|
||||
UID string `json:"uid,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
PluginMeta *PluginMetaDTO `json:"meta"`
|
||||
URL string `json:"url,omitempty"`
|
||||
IsDefault bool `json:"isDefault"`
|
||||
Access string `json:"access,omitempty"`
|
||||
Preload bool `json:"preload"`
|
||||
Module string `json:"module,omitempty"`
|
||||
JSONData map[string]interface{} `json:"jsonData"`
|
||||
ReadOnly bool `json:"readOnly"`
|
||||
AngularDetected bool `json:"angularDetected"`
|
||||
ID int64 `json:"id,omitempty"`
|
||||
UID string `json:"uid,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Name string `json:"name"`
|
||||
PluginMeta *PluginMetaDTO `json:"meta"`
|
||||
URL string `json:"url,omitempty"`
|
||||
IsDefault bool `json:"isDefault"`
|
||||
Access string `json:"access,omitempty"`
|
||||
Preload bool `json:"preload"`
|
||||
Module string `json:"module,omitempty"`
|
||||
JSONData map[string]any `json:"jsonData"`
|
||||
ReadOnly bool `json:"readOnly"`
|
||||
AngularDetected bool `json:"angularDetected"`
|
||||
|
||||
BasicAuth string `json:"basicAuth,omitempty"`
|
||||
WithCredentials bool `json:"withCredentials,omitempty"`
|
||||
|
||||
@@ -79,4 +79,4 @@ func (f inMemoryFileInfo) Size() int64 { return f.size }
|
||||
func (f inMemoryFileInfo) Mode() os.FileMode { return 0444 } // Read for all
|
||||
func (f inMemoryFileInfo) ModTime() time.Time { return time.Time{} }
|
||||
func (f inMemoryFileInfo) IsDir() bool { return false }
|
||||
func (f inMemoryFileInfo) Sys() interface{} { return nil }
|
||||
func (f inMemoryFileInfo) Sys() any { return nil }
|
||||
|
||||
Reference in New Issue
Block a user