diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 27b829148d..712f7aa71c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -92,11 +92,11 @@ implementation](https://github.com/googleapis/genai-toolbox/blob/main/internal/s `newdb.go`. Create a `Config` struct to include all the necessary parameters for connecting to the database (e.g., host, port, username, password, database name) and a `Source` struct to store necessary parameters for tools (e.g., - Name, Kind, connection object, additional config). + Name, Type, connection object, additional config). * **Implement the [`SourceConfig`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/sources/sources.go#L57) interface**. This interface requires two methods: - * `SourceConfigKind() string`: Returns a unique string identifier for your + * `SourceConfigType() string`: Returns a unique string identifier for your data source (e.g., `"newdb"`). * `Initialize(ctx context.Context, tracer trace.Tracer) (Source, error)`: Creates a new instance of your data source and establishes a connection to @@ -104,7 +104,7 @@ implementation](https://github.com/googleapis/genai-toolbox/blob/main/internal/s * **Implement the [`Source`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/sources/sources.go#L63) interface**. This interface requires one method: - * `SourceKind() string`: Returns the same string identifier as `SourceConfigKind()`. + * `SourceType() string`: Returns the same string identifier as `SourceConfigType()`. * **Implement `init()`** to register the new Source. * **Implement Unit Tests** in a file named `newdb_test.go`. @@ -126,7 +126,7 @@ tools. * **Implement the [`ToolConfig`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/tools/tools.go#L61) interface**. This interface requires one method: - * `ToolConfigKind() string`: Returns a unique string identifier for your tool + * `ToolConfigType() string`: Returns a unique string identifier for your tool (e.g., `"newdb-tool"`). * `Initialize(sources map[string]Source) (Tool, error)`: Creates a new instance of your tool and validates that it can connect to the specified @@ -243,7 +243,7 @@ resources. | style | Update src code, with only formatting and whitespace updates (e.g. code formatter or linter changes). | Pull requests should always add scope whenever possible. The scope is - formatted as `/` (e.g., `sources/postgres`, or + formatted as `/` (e.g., `sources/postgres`, or `tools/mssql-sql`). Ideally, **each PR covers only one scope**, if this is diff --git a/README.md b/README.md index 86a186bb8a..98aa6bf13d 100644 --- a/README.md +++ b/README.md @@ -954,7 +954,7 @@ For more details on configuring different types of sources, see the ### Tools The `tools` section of a `tools.yaml` define the actions an agent can take: what -kind of tool it is, which source(s) it affects, what parameters it uses, etc. +type of tool it is, which source(s) it affects, what parameters it uses, etc. ```yaml tools: diff --git a/cmd/root_test.go b/cmd/root_test.go index 17058d18ff..915dfbb031 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -555,7 +555,7 @@ func TestParseToolFile(t *testing.T) { Sources: server.SourceConfigs{ "my-pg-instance": cloudsqlpgsrc.Config{ Name: "my-pg-instance", - Kind: cloudsqlpgsrc.SourceKind, + Type: cloudsqlpgsrc.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -568,7 +568,7 @@ func TestParseToolFile(t *testing.T) { Tools: server.ToolConfigs{ "example_tool": postgressql.Config{ Name: "example_tool", - Kind: "postgres-sql", + Type: "postgres-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -709,7 +709,7 @@ func TestParseToolFileWithAuth(t *testing.T) { Sources: server.SourceConfigs{ "my-pg-instance": cloudsqlpgsrc.Config{ Name: "my-pg-instance", - Kind: cloudsqlpgsrc.SourceKind, + Type: cloudsqlpgsrc.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -722,19 +722,19 @@ func TestParseToolFileWithAuth(t *testing.T) { AuthServices: server.AuthServiceConfigs{ "my-google-service": google.Config{ Name: "my-google-service", - Kind: google.AuthServiceKind, + Type: google.AuthServiceType, ClientID: "my-client-id", }, "other-google-service": google.Config{ Name: "other-google-service", - Kind: google.AuthServiceKind, + Type: google.AuthServiceType, ClientID: "other-client-id", }, }, Tools: server.ToolConfigs{ "example_tool": postgressql.Config{ Name: "example_tool", - Kind: "postgres-sql", + Type: "postgres-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -809,7 +809,7 @@ func TestParseToolFileWithAuth(t *testing.T) { Sources: server.SourceConfigs{ "my-pg-instance": cloudsqlpgsrc.Config{ Name: "my-pg-instance", - Kind: cloudsqlpgsrc.SourceKind, + Type: cloudsqlpgsrc.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -822,19 +822,19 @@ func TestParseToolFileWithAuth(t *testing.T) { AuthSources: server.AuthServiceConfigs{ "my-google-service": google.Config{ Name: "my-google-service", - Kind: google.AuthServiceKind, + Type: google.AuthServiceType, ClientID: "my-client-id", }, "other-google-service": google.Config{ Name: "other-google-service", - Kind: google.AuthServiceKind, + Type: google.AuthServiceType, ClientID: "other-client-id", }, }, Tools: server.ToolConfigs{ "example_tool": postgressql.Config{ Name: "example_tool", - Kind: "postgres-sql", + Type: "postgres-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -911,7 +911,7 @@ func TestParseToolFileWithAuth(t *testing.T) { Sources: server.SourceConfigs{ "my-pg-instance": cloudsqlpgsrc.Config{ Name: "my-pg-instance", - Kind: cloudsqlpgsrc.SourceKind, + Type: cloudsqlpgsrc.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -924,19 +924,19 @@ func TestParseToolFileWithAuth(t *testing.T) { AuthServices: server.AuthServiceConfigs{ "my-google-service": google.Config{ Name: "my-google-service", - Kind: google.AuthServiceKind, + Type: google.AuthServiceType, ClientID: "my-client-id", }, "other-google-service": google.Config{ Name: "other-google-service", - Kind: google.AuthServiceKind, + Type: google.AuthServiceType, ClientID: "other-client-id", }, }, Tools: server.ToolConfigs{ "example_tool": postgressql.Config{ Name: "example_tool", - Kind: "postgres-sql", + Type: "postgres-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -1082,7 +1082,7 @@ func TestEnvVarReplacement(t *testing.T) { Sources: server.SourceConfigs{ "my-http-instance": httpsrc.Config{ Name: "my-http-instance", - Kind: httpsrc.SourceKind, + Type: httpsrc.SourceType, BaseURL: "http://test_server/", Timeout: "10s", DefaultHeaders: map[string]string{"Authorization": "ACTUAL_HEADER"}, @@ -1092,19 +1092,19 @@ func TestEnvVarReplacement(t *testing.T) { AuthServices: server.AuthServiceConfigs{ "my-google-service": google.Config{ Name: "my-google-service", - Kind: google.AuthServiceKind, + Type: google.AuthServiceType, ClientID: "ACTUAL_CLIENT_ID", }, "other-google-service": google.Config{ Name: "other-google-service", - Kind: google.AuthServiceKind, + Type: google.AuthServiceType, ClientID: "ACTUAL_CLIENT_ID_2", }, }, Tools: server.ToolConfigs{ "example_tool": http.Config{ Name: "example_tool", - Kind: "http", + Type: "http", Source: "my-instance", Method: "GET", Path: "search?name=alice&pet=cat", diff --git a/internal/auth/auth.go b/internal/auth/auth.go index e8f15e4f11..5fd30d1f45 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -21,13 +21,13 @@ import ( // AuthServiceConfig is the interface for configuring authentication services. type AuthServiceConfig interface { - AuthServiceConfigKind() string + AuthServiceConfigType() string Initialize() (AuthService, error) } // AuthService is the interface for authentication services. type AuthService interface { - AuthServiceKind() string + AuthServiceType() string GetName() string GetClaimsFromHeader(context.Context, http.Header) (map[string]any, error) ToConfig() AuthServiceConfig diff --git a/internal/auth/google/google.go b/internal/auth/google/google.go index 90cb809589..f4788c2e70 100644 --- a/internal/auth/google/google.go +++ b/internal/auth/google/google.go @@ -23,7 +23,7 @@ import ( "google.golang.org/api/idtoken" ) -const AuthServiceKind string = "google" +const AuthServiceType string = "google" // validate interface var _ auth.AuthServiceConfig = Config{} @@ -31,13 +31,13 @@ var _ auth.AuthServiceConfig = Config{} // Auth service configuration type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` ClientID string `yaml:"clientId" validate:"required"` } -// Returns the auth service kind -func (cfg Config) AuthServiceConfigKind() string { - return AuthServiceKind +// Returns the auth service type +func (cfg Config) AuthServiceConfigType() string { + return AuthServiceType } // Initialize a Google auth service @@ -55,9 +55,9 @@ type AuthService struct { Config } -// Returns the auth service kind -func (a AuthService) AuthServiceKind() string { - return AuthServiceKind +// Returns the auth service type +func (a AuthService) AuthServiceType() string { + return AuthServiceType } func (a AuthService) ToConfig() auth.AuthServiceConfig { diff --git a/internal/embeddingmodels/embeddingmodels.go b/internal/embeddingmodels/embeddingmodels.go index d038dd231e..5f82ee32f1 100644 --- a/internal/embeddingmodels/embeddingmodels.go +++ b/internal/embeddingmodels/embeddingmodels.go @@ -22,12 +22,12 @@ import ( // EmbeddingModelConfig is the interface for configuring embedding models. type EmbeddingModelConfig interface { - EmbeddingModelConfigKind() string + EmbeddingModelConfigType() string Initialize(context.Context) (EmbeddingModel, error) } type EmbeddingModel interface { - EmbeddingModelKind() string + EmbeddingModelType() string ToConfig() EmbeddingModelConfig EmbedParameters(context.Context, []string) ([][]float32, error) } diff --git a/internal/embeddingmodels/gemini/gemini.go b/internal/embeddingmodels/gemini/gemini.go index 1a31060e7b..19a2bcf19a 100644 --- a/internal/embeddingmodels/gemini/gemini.go +++ b/internal/embeddingmodels/gemini/gemini.go @@ -23,22 +23,22 @@ import ( "google.golang.org/genai" ) -const EmbeddingModelKind string = "gemini" +const EmbeddingModelType string = "gemini" // validate interface var _ embeddingmodels.EmbeddingModelConfig = Config{} type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Model string `yaml:"model" validate:"required"` ApiKey string `yaml:"apiKey"` Dimension int32 `yaml:"dimension"` } -// Returns the embedding model kind -func (cfg Config) EmbeddingModelConfigKind() string { - return EmbeddingModelKind +// Returns the embedding model type +func (cfg Config) EmbeddingModelConfigType() string { + return EmbeddingModelType } // Initialize a Gemini embedding model @@ -69,9 +69,9 @@ type EmbeddingModel struct { Config } -// Returns the embedding model kind -func (m EmbeddingModel) EmbeddingModelKind() string { - return EmbeddingModelKind +// Returns the embedding model type +func (m EmbeddingModel) EmbeddingModelType() string { + return EmbeddingModelType } func (m EmbeddingModel) ToConfig() embeddingmodels.EmbeddingModelConfig { diff --git a/internal/embeddingmodels/gemini/gemini_test.go b/internal/embeddingmodels/gemini/gemini_test.go index c4c3b8dcdc..fbd7c13dbf 100644 --- a/internal/embeddingmodels/gemini/gemini_test.go +++ b/internal/embeddingmodels/gemini/gemini_test.go @@ -42,7 +42,7 @@ func TestParseFromYamlGemini(t *testing.T) { want: map[string]embeddingmodels.EmbeddingModelConfig{ "my-gemini-model": gemini.Config{ Name: "my-gemini-model", - Kind: gemini.EmbeddingModelKind, + Type: gemini.EmbeddingModelType, Model: "text-embedding-004", }, }, @@ -60,7 +60,7 @@ func TestParseFromYamlGemini(t *testing.T) { want: map[string]embeddingmodels.EmbeddingModelConfig{ "complex-gemini": gemini.Config{ Name: "complex-gemini", - Kind: gemini.EmbeddingModelKind, + Type: gemini.EmbeddingModelType, Model: "text-embedding-004", ApiKey: "test-api-key", Dimension: 768, diff --git a/internal/prompts/custom/custom.go b/internal/prompts/custom/custom.go index 312b53613c..e934d6c64c 100644 --- a/internal/prompts/custom/custom.go +++ b/internal/prompts/custom/custom.go @@ -27,10 +27,10 @@ type Message = prompts.Message const kind = "custom" -// init registers this prompt kind with the prompt framework. +// init registers this prompt type with the prompt framework. func init() { if !prompts.Register(kind, newConfig) { - panic(fmt.Sprintf("prompt kind %q already registered", kind)) + panic(fmt.Sprintf("prompt type %q already registered", kind)) } } @@ -56,7 +56,7 @@ type Config struct { var _ prompts.PromptConfig = Config{} var _ prompts.Prompt = Prompt{} -func (c Config) PromptConfigKind() string { +func (c Config) PromptConfigType() string { return kind } diff --git a/internal/prompts/custom/custom_test.go b/internal/prompts/custom/custom_test.go index ff411c7b8b..05ba772a95 100644 --- a/internal/prompts/custom/custom_test.go +++ b/internal/prompts/custom/custom_test.go @@ -50,8 +50,8 @@ func TestConfig(t *testing.T) { if p == nil { t.Fatal("Initialize() returned a nil prompt") } - if cfg.PromptConfigKind() != "custom" { - t.Errorf("PromptConfigKind() = %q, want %q", cfg.PromptConfigKind(), "custom") + if cfg.PromptConfigType() != "custom" { + t.Errorf("PromptConfigType() = %q, want %q", cfg.PromptConfigType(), "custom") } t.Run("Manifest", func(t *testing.T) { diff --git a/internal/prompts/prompts.go b/internal/prompts/prompts.go index bac784c4c5..b2b384dae3 100644 --- a/internal/prompts/prompts.go +++ b/internal/prompts/prompts.go @@ -52,7 +52,7 @@ func DecodeConfig(ctx context.Context, kind, name string, decoder *yaml.Decoder) } if !found { - return nil, fmt.Errorf("unknown prompt kind: %q", kind) + return nil, fmt.Errorf("unknown prompt type: %q", kind) } promptConfig, err := factory(ctx, name, decoder) @@ -63,7 +63,7 @@ func DecodeConfig(ctx context.Context, kind, name string, decoder *yaml.Decoder) } type PromptConfig interface { - PromptConfigKind() string + PromptConfigType() string Initialize() (Prompt, error) } diff --git a/internal/prompts/prompts_test.go b/internal/prompts/prompts_test.go index d0fe0a95f5..35078e7dab 100644 --- a/internal/prompts/prompts_test.go +++ b/internal/prompts/prompts_test.go @@ -29,16 +29,16 @@ import ( type mockPromptConfig struct { name string - kind string + Type string } -func (m *mockPromptConfig) PromptConfigKind() string { return m.kind } +func (m *mockPromptConfig) PromptConfigType() string { return m.Type } func (m *mockPromptConfig) Initialize() (prompts.Prompt, error) { return nil, nil } var errMockFactory = errors.New("mock factory error") func mockFactory(ctx context.Context, name string, decoder *yaml.Decoder) (prompts.PromptConfig, error) { - return &mockPromptConfig{name: name, kind: "mockKind"}, nil + return &mockPromptConfig{name: name, Type: "mockType"}, nil } func mockErrorFactory(ctx context.Context, name string, decoder *yaml.Decoder) (prompts.PromptConfig, error) { @@ -50,7 +50,7 @@ func TestRegistry(t *testing.T) { ctx := context.Background() t.Run("RegisterAndDecodeSuccess", func(t *testing.T) { - kind := "testKindSuccess" + kind := "testTypeSuccess" if !prompts.Register(kind, mockFactory) { t.Fatal("expected registration to succeed") } @@ -69,19 +69,19 @@ func TestRegistry(t *testing.T) { } }) - t.Run("DecodeUnknownKind", func(t *testing.T) { + t.Run("DecodeUnknownType", func(t *testing.T) { decoder := yaml.NewDecoder(strings.NewReader("")) - _, err := prompts.DecodeConfig(ctx, "unregisteredKind", "testPrompt", decoder) + _, err := prompts.DecodeConfig(ctx, "unregisteredType", "testPrompt", decoder) if err == nil { t.Fatal("expected an error for unknown kind, but got nil") } - if !strings.Contains(err.Error(), "unknown prompt kind") { - t.Errorf("expected error to contain 'unknown prompt kind', but got: %v", err) + if !strings.Contains(err.Error(), "unknown prompt type") { + t.Errorf("expected error to contain 'unknown prompt type', but got: %v", err) } }) t.Run("FactoryReturnsError", func(t *testing.T) { - kind := "testKindError" + kind := "testTypeError" if !prompts.Register(kind, mockErrorFactory) { t.Fatal("expected registration to succeed") } @@ -105,8 +105,8 @@ func TestRegistry(t *testing.T) { if config == nil { t.Fatal("expected a non-nil config for default kind") } - if config.PromptConfigKind() != "custom" { - t.Errorf("expected default kind to be 'custom', but got %q", config.PromptConfigKind()) + if config.PromptConfigType() != "custom" { + t.Errorf("expected default kind to be 'custom', but got %q", config.PromptConfigType()) } }) } diff --git a/internal/server/config.go b/internal/server/config.go index 652e7547de..1cec76f80b 100644 --- a/internal/server/config.go +++ b/internal/server/config.go @@ -201,7 +201,7 @@ func (c *AuthServiceConfigs) UnmarshalYAML(ctx context.Context, unmarshal func(i return fmt.Errorf("error creating decoder: %w", err) } switch kind { - case google.AuthServiceKind: + case google.AuthServiceType: actual := google.Config{Name: name} if err := dec.DecodeContext(ctx, &actual); err != nil { return fmt.Errorf("unable to parse as %q: %w", kind, err) @@ -245,7 +245,7 @@ func (c *EmbeddingModelConfigs) UnmarshalYAML(ctx context.Context, unmarshal fun return fmt.Errorf("error creating decoder: %w", err) } switch kind { - case gemini.EmbeddingModelKind: + case gemini.EmbeddingModelType: actual := gemini.Config{Name: name} if err := dec.DecodeContext(ctx, &actual); err != nil { return fmt.Errorf("unable to parse as %q: %w", kind, err) diff --git a/internal/server/resources/resources_test.go b/internal/server/resources/resources_test.go index ad4bfdd326..e0682a27a9 100644 --- a/internal/server/resources/resources_test.go +++ b/internal/server/resources/resources_test.go @@ -32,7 +32,7 @@ func TestUpdateServer(t *testing.T) { "example-source": &alloydbpg.Source{ Config: alloydbpg.Config{ Name: "example-alloydb-source", - Kind: "alloydb-postgres", + Type: "alloydb-postgres", }, }, } @@ -92,7 +92,7 @@ func TestUpdateServer(t *testing.T) { "example-source2": &alloydbpg.Source{ Config: alloydbpg.Config{ Name: "example-alloydb-source2", - Kind: "alloydb-postgres", + Type: "alloydb-postgres", }, }, } diff --git a/internal/server/server.go b/internal/server/server.go index 961ffc48a3..f77c504113 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -86,7 +86,7 @@ func InitializeConfigs(ctx context.Context, cfg ServerConfig) ( childCtx, span := instrumentation.Tracer.Start( ctx, "toolbox/server/source/init", - trace.WithAttributes(attribute.String("source_kind", sc.SourceConfigKind())), + trace.WithAttributes(attribute.String("source_type", sc.SourceConfigType())), trace.WithAttributes(attribute.String("source_name", name)), ) defer span.End() @@ -114,7 +114,7 @@ func InitializeConfigs(ctx context.Context, cfg ServerConfig) ( _, span := instrumentation.Tracer.Start( ctx, "toolbox/server/auth/init", - trace.WithAttributes(attribute.String("auth_kind", sc.AuthServiceConfigKind())), + trace.WithAttributes(attribute.String("auth_type", sc.AuthServiceConfigType())), trace.WithAttributes(attribute.String("auth_name", name)), ) defer span.End() @@ -142,7 +142,7 @@ func InitializeConfigs(ctx context.Context, cfg ServerConfig) ( _, span := instrumentation.Tracer.Start( ctx, "toolbox/server/embeddingmodel/init", - trace.WithAttributes(attribute.String("model_kind", ec.EmbeddingModelConfigKind())), + trace.WithAttributes(attribute.String("model_type", ec.EmbeddingModelConfigType())), trace.WithAttributes(attribute.String("model_name", name)), ) defer span.End() @@ -170,7 +170,7 @@ func InitializeConfigs(ctx context.Context, cfg ServerConfig) ( _, span := instrumentation.Tracer.Start( ctx, "toolbox/server/tool/init", - trace.WithAttributes(attribute.String("tool_kind", tc.ToolConfigKind())), + trace.WithAttributes(attribute.String("tool_type", tc.ToolConfigType())), trace.WithAttributes(attribute.String("tool_name", name)), ) defer span.End() @@ -239,7 +239,7 @@ func InitializeConfigs(ctx context.Context, cfg ServerConfig) ( _, span := instrumentation.Tracer.Start( ctx, "toolbox/server/prompt/init", - trace.WithAttributes(attribute.String("prompt_kind", pc.PromptConfigKind())), + trace.WithAttributes(attribute.String("prompt_type", pc.PromptConfigType())), trace.WithAttributes(attribute.String("prompt_name", name)), ) defer span.End() diff --git a/internal/server/server_test.go b/internal/server/server_test.go index c13df83be4..ab809fc579 100644 --- a/internal/server/server_test.go +++ b/internal/server/server_test.go @@ -141,7 +141,7 @@ func TestUpdateServer(t *testing.T) { "example-source": &alloydbpg.Source{ Config: alloydbpg.Config{ Name: "example-alloydb-source", - Kind: "alloydb-postgres", + Type: "alloydb-postgres", }, }, } diff --git a/internal/sources/alloydbadmin/alloydbadmin.go b/internal/sources/alloydbadmin/alloydbadmin.go index 633c7eb73e..83fb52ee97 100644 --- a/internal/sources/alloydbadmin/alloydbadmin.go +++ b/internal/sources/alloydbadmin/alloydbadmin.go @@ -32,14 +32,14 @@ import ( "google.golang.org/api/option" ) -const SourceKind string = "alloydb-admin" +const SourceType string = "alloydb-admin" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -53,13 +53,13 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` DefaultProject string `yaml:"defaultProject"` UseClientOAuth bool `yaml:"useClientOAuth"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -106,8 +106,8 @@ type Source struct { Service *alloydbrestapi.Service } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/alloydbadmin/alloydbadmin_test.go b/internal/sources/alloydbadmin/alloydbadmin_test.go index b8af21c386..ac419f9e72 100644 --- a/internal/sources/alloydbadmin/alloydbadmin_test.go +++ b/internal/sources/alloydbadmin/alloydbadmin_test.go @@ -41,7 +41,7 @@ func TestParseFromYamlAlloyDBAdmin(t *testing.T) { want: map[string]sources.SourceConfig{ "my-alloydb-admin-instance": alloydbadmin.Config{ Name: "my-alloydb-admin-instance", - Kind: alloydbadmin.SourceKind, + Type: alloydbadmin.SourceType, UseClientOAuth: false, }, }, @@ -57,7 +57,7 @@ func TestParseFromYamlAlloyDBAdmin(t *testing.T) { want: map[string]sources.SourceConfig{ "my-alloydb-admin-instance": alloydbadmin.Config{ Name: "my-alloydb-admin-instance", - Kind: alloydbadmin.SourceKind, + Type: alloydbadmin.SourceType, UseClientOAuth: true, }, }, diff --git a/internal/sources/alloydbpg/alloydb_pg.go b/internal/sources/alloydbpg/alloydb_pg.go index 58d8600ebd..be0b51a3b5 100644 --- a/internal/sources/alloydbpg/alloydb_pg.go +++ b/internal/sources/alloydbpg/alloydb_pg.go @@ -29,14 +29,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "alloydb-postgres" +const SourceType string = "alloydb-postgres" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -50,7 +50,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Region string `yaml:"region" validate:"required"` Cluster string `yaml:"cluster" validate:"required"` @@ -61,8 +61,8 @@ type Config struct { Database string `yaml:"database" validate:"required"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -90,8 +90,8 @@ type Source struct { Pool *pgxpool.Pool } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -183,7 +183,7 @@ func getConnectionConfig(ctx context.Context, user, pass, dbname string) (string func initAlloyDBPgConnectionPool(ctx context.Context, tracer trace.Tracer, name, project, region, cluster, instance, ipType, user, pass, dbname string) (*pgxpool.Pool, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() dsn, useIAM, err := getConnectionConfig(ctx, user, pass, dbname) diff --git a/internal/sources/alloydbpg/alloydb_pg_test.go b/internal/sources/alloydbpg/alloydb_pg_test.go index f0ddc57ef9..1f97646916 100644 --- a/internal/sources/alloydbpg/alloydb_pg_test.go +++ b/internal/sources/alloydbpg/alloydb_pg_test.go @@ -48,7 +48,7 @@ func TestParseFromYamlAlloyDBPg(t *testing.T) { want: map[string]sources.SourceConfig{ "my-pg-instance": alloydbpg.Config{ Name: "my-pg-instance", - Kind: alloydbpg.SourceKind, + Type: alloydbpg.SourceType, Project: "my-project", Region: "my-region", Cluster: "my-cluster", @@ -78,7 +78,7 @@ func TestParseFromYamlAlloyDBPg(t *testing.T) { want: map[string]sources.SourceConfig{ "my-pg-instance": alloydbpg.Config{ Name: "my-pg-instance", - Kind: alloydbpg.SourceKind, + Type: alloydbpg.SourceType, Project: "my-project", Region: "my-region", Cluster: "my-cluster", @@ -108,7 +108,7 @@ func TestParseFromYamlAlloyDBPg(t *testing.T) { want: map[string]sources.SourceConfig{ "my-pg-instance": alloydbpg.Config{ Name: "my-pg-instance", - Kind: alloydbpg.SourceKind, + Type: alloydbpg.SourceType, Project: "my-project", Region: "my-region", Cluster: "my-cluster", diff --git a/internal/sources/bigquery/bigquery.go b/internal/sources/bigquery/bigquery.go index b24378c858..aabcdd0078 100644 --- a/internal/sources/bigquery/bigquery.go +++ b/internal/sources/bigquery/bigquery.go @@ -41,7 +41,7 @@ import ( "google.golang.org/api/option" ) -const SourceKind string = "bigquery" +const SourceType string = "bigquery" // CloudPlatformScope is a broad scope for Google Cloud Platform services. const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" @@ -65,8 +65,8 @@ type BigQuerySessionProvider func(ctx context.Context) (*Session, error) type DataplexClientCreator func(tokenString string) (*dataplexapi.CatalogClient, error) func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -81,7 +81,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { // BigQuery configs Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Location string `yaml:"location"` WriteMode string `yaml:"writeMode"` @@ -119,9 +119,9 @@ func (s *StringOrStringSlice) UnmarshalYAML(unmarshal func(any) error) error { return fmt.Errorf("cannot unmarshal %T into StringOrStringSlice", v) } -func (r Config) SourceConfigKind() string { +func (r Config) SourceConfigType() string { // Returns BigQuery source kind - return SourceKind + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { if r.WriteMode == "" { @@ -302,9 +302,9 @@ type Session struct { LastUsed time.Time } -func (s *Source) SourceKind() string { +func (s *Source) SourceType() string { // Returns BigQuery Google SQL source kind - return SourceKind + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -665,7 +665,7 @@ func initBigQueryConnection( impersonateServiceAccount string, scopes []string, ) (*bigqueryapi.Client, *bigqueryrestapi.Service, oauth2.TokenSource, error) { - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() userAgent, err := util.UserAgentFromContext(ctx) @@ -741,7 +741,7 @@ func initBigQueryConnectionWithOAuthToken( tokenString string, wantRestService bool, ) (*bigqueryapi.Client, *bigqueryrestapi.Service, error) { - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Construct token source token := &oauth2.Token{ @@ -801,7 +801,7 @@ func initDataplexConnection( var clientCreator DataplexClientCreator var err error - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() userAgent, err := util.UserAgentFromContext(ctx) diff --git a/internal/sources/bigquery/bigquery_test.go b/internal/sources/bigquery/bigquery_test.go index a23f1b47bd..224a7393a0 100644 --- a/internal/sources/bigquery/bigquery_test.go +++ b/internal/sources/bigquery/bigquery_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQuery(t *testing.T) { want: server.SourceConfigs{ "my-instance": bigquery.Config{ Name: "my-instance", - Kind: bigquery.SourceKind, + Type: bigquery.SourceType, Project: "my-project", Location: "", WriteMode: "", @@ -66,7 +66,7 @@ func TestParseFromYamlBigQuery(t *testing.T) { want: server.SourceConfigs{ "my-instance": bigquery.Config{ Name: "my-instance", - Kind: bigquery.SourceKind, + Type: bigquery.SourceType, Project: "my-project", Location: "asia", WriteMode: "blocked", @@ -87,7 +87,7 @@ func TestParseFromYamlBigQuery(t *testing.T) { want: server.SourceConfigs{ "my-instance": bigquery.Config{ Name: "my-instance", - Kind: bigquery.SourceKind, + Type: bigquery.SourceType, Project: "my-project", Location: "us", UseClientOAuth: true, @@ -108,7 +108,7 @@ func TestParseFromYamlBigQuery(t *testing.T) { want: server.SourceConfigs{ "my-instance": bigquery.Config{ Name: "my-instance", - Kind: bigquery.SourceKind, + Type: bigquery.SourceType, Project: "my-project", Location: "us", AllowedDatasets: []string{"my_dataset"}, @@ -128,7 +128,7 @@ func TestParseFromYamlBigQuery(t *testing.T) { want: server.SourceConfigs{ "my-instance": bigquery.Config{ Name: "my-instance", - Kind: bigquery.SourceKind, + Type: bigquery.SourceType, Project: "my-project", Location: "us", ImpersonateServiceAccount: "service-account@my-project.iam.gserviceaccount.com", @@ -150,7 +150,7 @@ func TestParseFromYamlBigQuery(t *testing.T) { want: server.SourceConfigs{ "my-instance": bigquery.Config{ Name: "my-instance", - Kind: bigquery.SourceKind, + Type: bigquery.SourceType, Project: "my-project", Location: "us", Scopes: []string{"https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform"}, @@ -170,7 +170,7 @@ func TestParseFromYamlBigQuery(t *testing.T) { want: server.SourceConfigs{ "my-instance": bigquery.Config{ Name: "my-instance", - Kind: bigquery.SourceKind, + Type: bigquery.SourceType, Project: "my-project", Location: "us", MaxQueryResultRows: 10, @@ -260,7 +260,7 @@ func TestInitialize_MaxQueryResultRows(t *testing.T) { desc: "default value", cfg: bigquery.Config{ Name: "test-default", - Kind: bigquery.SourceKind, + Type: bigquery.SourceType, Project: "test-project", UseClientOAuth: true, }, @@ -270,7 +270,7 @@ func TestInitialize_MaxQueryResultRows(t *testing.T) { desc: "configured value", cfg: bigquery.Config{ Name: "test-configured", - Kind: bigquery.SourceKind, + Type: bigquery.SourceType, Project: "test-project", UseClientOAuth: true, MaxQueryResultRows: 100, diff --git a/internal/sources/bigtable/bigtable.go b/internal/sources/bigtable/bigtable.go index 22daf64c37..825e82fcbb 100644 --- a/internal/sources/bigtable/bigtable.go +++ b/internal/sources/bigtable/bigtable.go @@ -27,14 +27,14 @@ import ( "google.golang.org/api/option" ) -const SourceKind string = "bigtable" +const SourceType string = "bigtable" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -48,13 +48,13 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Instance string `yaml:"instance" validate:"required"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -77,8 +77,8 @@ type Source struct { Client *bigtable.Client } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -179,7 +179,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, configParam param func initBigtableClient(ctx context.Context, tracer trace.Tracer, name, project, instance string) (*bigtable.Client, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Set up Bigtable data operations client. diff --git a/internal/sources/bigtable/bigtable_test.go b/internal/sources/bigtable/bigtable_test.go index c3f2a7d3dc..f74d4b39d5 100644 --- a/internal/sources/bigtable/bigtable_test.go +++ b/internal/sources/bigtable/bigtable_test.go @@ -43,7 +43,7 @@ func TestParseFromYamlBigtableDb(t *testing.T) { want: map[string]sources.SourceConfig{ "my-bigtable-instance": bigtable.Config{ Name: "my-bigtable-instance", - Kind: bigtable.SourceKind, + Type: bigtable.SourceType, Project: "my-project", Instance: "my-instance", }, diff --git a/internal/sources/cassandra/cassandra.go b/internal/sources/cassandra/cassandra.go index 49c070bf06..1fa84878ec 100644 --- a/internal/sources/cassandra/cassandra.go +++ b/internal/sources/cassandra/cassandra.go @@ -25,11 +25,11 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "cassandra" +const SourceType string = "cassandra" func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -43,7 +43,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Hosts []string `yaml:"hosts" validate:"required"` Keyspace string `yaml:"keyspace"` ProtoVersion int `yaml:"protoVersion"` @@ -68,9 +68,9 @@ func (c Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.So return s, nil } -// SourceConfigKind implements sources.SourceConfig. -func (c Config) SourceConfigKind() string { - return SourceKind +// SourceConfigType implements sources.SourceConfig. +func (c Config) SourceConfigType() string { + return SourceType } var _ sources.SourceConfig = Config{} @@ -89,9 +89,9 @@ func (s *Source) ToConfig() sources.SourceConfig { return s.Config } -// SourceKind implements sources.Source. -func (s *Source) SourceKind() string { - return SourceKind +// SourceType implements sources.Source. +func (s *Source) SourceType() string { + return SourceType } func (s *Source) RunSQL(ctx context.Context, statement string, params parameters.ParamValues) (any, error) { @@ -120,7 +120,7 @@ var _ sources.Source = &Source{} func initCassandraSession(ctx context.Context, tracer trace.Tracer, c Config) (*gocql.Session, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, c.Name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, c.Name) defer span.End() // Validate authentication configuration diff --git a/internal/sources/cassandra/cassandra_test.go b/internal/sources/cassandra/cassandra_test.go index ddcbb3debe..072627fc2d 100644 --- a/internal/sources/cassandra/cassandra_test.go +++ b/internal/sources/cassandra/cassandra_test.go @@ -43,7 +43,7 @@ func TestParseFromYamlCassandra(t *testing.T) { want: server.SourceConfigs{ "my-cassandra-instance": cassandra.Config{ Name: "my-cassandra-instance", - Kind: cassandra.SourceKind, + Type: cassandra.SourceType, Hosts: []string{"my-host1", "my-host2"}, Username: "", Password: "", @@ -77,7 +77,7 @@ func TestParseFromYamlCassandra(t *testing.T) { want: server.SourceConfigs{ "my-cassandra-instance": cassandra.Config{ Name: "my-cassandra-instance", - Kind: cassandra.SourceKind, + Type: cassandra.SourceType, Hosts: []string{"my-host1", "my-host2"}, Username: "user", Password: "pass", diff --git a/internal/sources/clickhouse/clickhouse.go b/internal/sources/clickhouse/clickhouse.go index 3f0b6f961b..528b9e02cb 100644 --- a/internal/sources/clickhouse/clickhouse.go +++ b/internal/sources/clickhouse/clickhouse.go @@ -28,14 +28,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "clickhouse" +const SourceType string = "clickhouse" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -49,7 +49,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` Database string `yaml:"database" validate:"required"` @@ -59,8 +59,8 @@ type Config struct { Secure bool `yaml:"secure"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -88,8 +88,8 @@ type Source struct { Pool *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -174,7 +174,7 @@ func validateConfig(protocol string) error { func initClickHouseConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, protocol string, secure bool) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() if protocol == "" { diff --git a/internal/sources/clickhouse/clickhouse_test.go b/internal/sources/clickhouse/clickhouse_test.go index 7a1bd321eb..d8720f6b28 100644 --- a/internal/sources/clickhouse/clickhouse_test.go +++ b/internal/sources/clickhouse/clickhouse_test.go @@ -25,10 +25,10 @@ import ( "go.opentelemetry.io/otel" ) -func TestConfigSourceConfigKind(t *testing.T) { +func TestConfigSourceConfigType(t *testing.T) { config := Config{} - if config.SourceConfigKind() != SourceKind { - t.Errorf("Expected %s, got %s", SourceKind, config.SourceConfigKind()) + if config.SourceConfigType() != SourceType { + t.Errorf("Expected %s, got %s", SourceType, config.SourceConfigType()) } } @@ -53,7 +53,7 @@ func TestNewConfig(t *testing.T) { `, expected: Config{ Name: "test-clickhouse", - Kind: "clickhouse", + Type: "clickhouse", Host: "localhost", Port: "8443", User: "default", @@ -75,7 +75,7 @@ func TestNewConfig(t *testing.T) { `, expected: Config{ Name: "minimal-clickhouse", - Kind: "clickhouse", + Type: "clickhouse", Host: "127.0.0.1", Port: "8123", User: "testuser", @@ -100,7 +100,7 @@ func TestNewConfig(t *testing.T) { `, expected: Config{ Name: "http-clickhouse", - Kind: "clickhouse", + Type: "clickhouse", Host: "clickhouse.example.com", Port: "8123", User: "analytics", @@ -125,7 +125,7 @@ func TestNewConfig(t *testing.T) { `, expected: Config{ Name: "secure-clickhouse", - Kind: "clickhouse", + Type: "clickhouse", Host: "secure.clickhouse.io", Port: "8443", User: "secureuser", @@ -196,10 +196,10 @@ func TestNewConfigInvalidYAML(t *testing.T) { } } -func TestSource_SourceKind(t *testing.T) { +func TestSource_SourceType(t *testing.T) { source := &Source{} - if source.SourceKind() != SourceKind { - t.Errorf("Expected %s, got %s", SourceKind, source.SourceKind()) + if source.SourceType() != SourceType { + t.Errorf("Expected %s, got %s", SourceType, source.SourceType()) } } diff --git a/internal/sources/cloudgda/cloud_gda.go b/internal/sources/cloudgda/cloud_gda.go index 5743991647..e911dedc5b 100644 --- a/internal/sources/cloudgda/cloud_gda.go +++ b/internal/sources/cloudgda/cloud_gda.go @@ -29,15 +29,15 @@ import ( "golang.org/x/oauth2/google" ) -const SourceKind string = "cloud-gemini-data-analytics" +const SourceType string = "cloud-gemini-data-analytics" const Endpoint string = "https://geminidataanalytics.googleapis.com" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -51,13 +51,13 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` ProjectID string `yaml:"projectId" validate:"required"` UseClientOAuth bool `yaml:"useClientOAuth"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } // Initialize initializes a Gemini Data Analytics Source instance. @@ -102,8 +102,8 @@ type Source struct { userAgent string } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/cloudgda/cloud_gda_test.go b/internal/sources/cloudgda/cloud_gda_test.go index 30b977729d..7bae7d800f 100644 --- a/internal/sources/cloudgda/cloud_gda_test.go +++ b/internal/sources/cloudgda/cloud_gda_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlCloudGDA(t *testing.T) { want: map[string]sources.SourceConfig{ "my-gda-instance": cloudgda.Config{ Name: "my-gda-instance", - Kind: cloudgda.SourceKind, + Type: cloudgda.SourceType, ProjectID: "test-project-id", UseClientOAuth: false, }, @@ -65,7 +65,7 @@ func TestParseFromYamlCloudGDA(t *testing.T) { want: map[string]sources.SourceConfig{ "my-gda-instance": cloudgda.Config{ Name: "my-gda-instance", - Kind: cloudgda.SourceKind, + Type: cloudgda.SourceType, ProjectID: "another-project", UseClientOAuth: true, }, @@ -153,12 +153,12 @@ func TestInitialize(t *testing.T) { }{ { desc: "initialize with ADC", - cfg: cloudgda.Config{Name: "test-gda", Kind: cloudgda.SourceKind, ProjectID: "test-proj"}, + cfg: cloudgda.Config{Name: "test-gda", Type: cloudgda.SourceType, ProjectID: "test-proj"}, wantClientOAuth: false, }, { desc: "initialize with client OAuth", - cfg: cloudgda.Config{Name: "test-gda-oauth", Kind: cloudgda.SourceKind, ProjectID: "test-proj", UseClientOAuth: true}, + cfg: cloudgda.Config{Name: "test-gda-oauth", Type: cloudgda.SourceType, ProjectID: "test-proj", UseClientOAuth: true}, wantClientOAuth: true, }, } diff --git a/internal/sources/cloudhealthcare/cloud_healthcare.go b/internal/sources/cloudhealthcare/cloud_healthcare.go index 82cfbd583e..fca3b69ec2 100644 --- a/internal/sources/cloudhealthcare/cloud_healthcare.go +++ b/internal/sources/cloudhealthcare/cloud_healthcare.go @@ -34,7 +34,7 @@ import ( "google.golang.org/api/option" ) -const SourceKind string = "cloud-healthcare" +const SourceType string = "cloud-healthcare" // validate interface var _ sources.SourceConfig = Config{} @@ -42,8 +42,8 @@ var _ sources.SourceConfig = Config{} type HealthcareServiceCreator func(tokenString string) (*healthcare.Service, error) func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -58,7 +58,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { // Healthcare configs Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Region string `yaml:"region" validate:"required"` Dataset string `yaml:"dataset" validate:"required"` @@ -67,8 +67,8 @@ type Config struct { UseClientOAuth bool `yaml:"useClientOAuth"` } -func (c Config) SourceConfigKind() string { - return SourceKind +func (c Config) SourceConfigType() string { + return SourceType } func (c Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -144,7 +144,7 @@ func newHealthcareServiceCreator(ctx context.Context, tracer trace.Tracer, name } func initHealthcareConnectionWithOAuthToken(ctx context.Context, tracer trace.Tracer, name string, userAgent string, tokenString string) (*healthcare.Service, error) { - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Construct token source token := &oauth2.Token{ @@ -162,7 +162,7 @@ func initHealthcareConnectionWithOAuthToken(ctx context.Context, tracer trace.Tr } func initHealthcareConnection(ctx context.Context, tracer trace.Tracer, name string) (*healthcare.Service, oauth2.TokenSource, error) { - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() cred, err := google.FindDefaultCredentials(ctx, healthcare.CloudHealthcareScope) @@ -194,8 +194,8 @@ type Source struct { allowedDICOMStores map[string]struct{} } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -517,14 +517,14 @@ func (s *Source) RetrieveRenderedDICOMInstance(storeID, study, series, sop strin return base64String, nil } -func (s *Source) SearchDICOM(toolKind, storeID, dicomWebPath, tokenStr string, opts []googleapi.CallOption) (any, error) { +func (s *Source) SearchDICOM(toolType, storeID, dicomWebPath, tokenStr string, opts []googleapi.CallOption) (any, error) { svc, err := s.getService(tokenStr) if err != nil { return nil, err } name := fmt.Sprintf("projects/%s/locations/%s/datasets/%s/dicomStores/%s", s.Project(), s.Region(), s.DatasetID(), storeID) var resp *http.Response - switch toolKind { + switch toolType { case "cloud-healthcare-search-dicom-instances": resp, err = svc.Projects.Locations.Datasets.DicomStores.SearchForInstances(name, dicomWebPath).Do(opts...) case "cloud-healthcare-search-dicom-series": @@ -532,7 +532,7 @@ func (s *Source) SearchDICOM(toolKind, storeID, dicomWebPath, tokenStr string, o case "cloud-healthcare-search-dicom-studies": resp, err = svc.Projects.Locations.Datasets.DicomStores.SearchForStudies(name, dicomWebPath).Do(opts...) default: - return nil, fmt.Errorf("incompatible tool kind: %s", toolKind) + return nil, fmt.Errorf("incompatible tool type: %s", toolType) } if err != nil { return nil, fmt.Errorf("failed to search dicom series: %w", err) diff --git a/internal/sources/cloudhealthcare/cloud_healthcare_test.go b/internal/sources/cloudhealthcare/cloud_healthcare_test.go index 688a701cba..6ece93c2e9 100644 --- a/internal/sources/cloudhealthcare/cloud_healthcare_test.go +++ b/internal/sources/cloudhealthcare/cloud_healthcare_test.go @@ -43,7 +43,7 @@ func TestParseFromYamlCloudHealthcare(t *testing.T) { want: server.SourceConfigs{ "my-instance": cloudhealthcare.Config{ Name: "my-instance", - Kind: cloudhealthcare.SourceKind, + Type: cloudhealthcare.SourceType, Project: "my-project", Region: "us-central1", Dataset: "my-dataset", @@ -65,7 +65,7 @@ func TestParseFromYamlCloudHealthcare(t *testing.T) { want: server.SourceConfigs{ "my-instance": cloudhealthcare.Config{ Name: "my-instance", - Kind: cloudhealthcare.SourceKind, + Type: cloudhealthcare.SourceType, Project: "my-project", Region: "us", Dataset: "my-dataset", @@ -91,7 +91,7 @@ func TestParseFromYamlCloudHealthcare(t *testing.T) { want: server.SourceConfigs{ "my-instance": cloudhealthcare.Config{ Name: "my-instance", - Kind: cloudhealthcare.SourceKind, + Type: cloudhealthcare.SourceType, Project: "my-project", Region: "us", Dataset: "my-dataset", diff --git a/internal/sources/cloudmonitoring/cloud_monitoring.go b/internal/sources/cloudmonitoring/cloud_monitoring.go index eb478dce24..0118496a51 100644 --- a/internal/sources/cloudmonitoring/cloud_monitoring.go +++ b/internal/sources/cloudmonitoring/cloud_monitoring.go @@ -29,14 +29,14 @@ import ( monitoring "google.golang.org/api/monitoring/v3" ) -const SourceKind string = "cloud-monitoring" +const SourceType string = "cloud-monitoring" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -50,12 +50,12 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` UseClientOAuth bool `yaml:"useClientOAuth"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } // Initialize initializes a Cloud Monitoring Source instance. @@ -99,8 +99,8 @@ type Source struct { userAgent string } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/cloudmonitoring/cloud_monitoring_test.go b/internal/sources/cloudmonitoring/cloud_monitoring_test.go index 329af6a2a4..d57fa76373 100644 --- a/internal/sources/cloudmonitoring/cloud_monitoring_test.go +++ b/internal/sources/cloudmonitoring/cloud_monitoring_test.go @@ -42,7 +42,7 @@ func TestParseFromYamlCloudMonitoring(t *testing.T) { want: map[string]sources.SourceConfig{ "my-cloud-monitoring-instance": cloudmonitoring.Config{ Name: "my-cloud-monitoring-instance", - Kind: cloudmonitoring.SourceKind, + Type: cloudmonitoring.SourceType, UseClientOAuth: false, }, }, @@ -58,7 +58,7 @@ func TestParseFromYamlCloudMonitoring(t *testing.T) { want: map[string]sources.SourceConfig{ "my-cloud-monitoring-instance": cloudmonitoring.Config{ Name: "my-cloud-monitoring-instance", - Kind: cloudmonitoring.SourceKind, + Type: cloudmonitoring.SourceType, UseClientOAuth: true, }, }, diff --git a/internal/sources/cloudsqladmin/cloud_sql_admin.go b/internal/sources/cloudsqladmin/cloud_sql_admin.go index 9e22f56aa1..21e2edc23c 100644 --- a/internal/sources/cloudsqladmin/cloud_sql_admin.go +++ b/internal/sources/cloudsqladmin/cloud_sql_admin.go @@ -35,7 +35,7 @@ import ( sqladmin "google.golang.org/api/sqladmin/v1" ) -const SourceKind string = "cloud-sql-admin" +const SourceType string = "cloud-sql-admin" var ( targetLinkRegex = regexp.MustCompile(`/projects/([^/]+)/instances/([^/]+)/databases/([^/]+)`) @@ -46,8 +46,8 @@ var ( var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -61,13 +61,13 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` DefaultProject string `yaml:"defaultProject"` UseClientOAuth bool `yaml:"useClientOAuth"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } // Initialize initializes a CloudSQL Admin Source instance. @@ -114,8 +114,8 @@ type Source struct { Service *sqladmin.Service } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/cloudsqladmin/cloud_sql_admin_test.go b/internal/sources/cloudsqladmin/cloud_sql_admin_test.go index 4138a0a7c4..40fc761cce 100644 --- a/internal/sources/cloudsqladmin/cloud_sql_admin_test.go +++ b/internal/sources/cloudsqladmin/cloud_sql_admin_test.go @@ -42,7 +42,7 @@ func TestParseFromYamlCloudSQLAdmin(t *testing.T) { want: map[string]sources.SourceConfig{ "my-cloud-sql-admin-instance": cloudsqladmin.Config{ Name: "my-cloud-sql-admin-instance", - Kind: cloudsqladmin.SourceKind, + Type: cloudsqladmin.SourceType, UseClientOAuth: false, }, }, @@ -58,7 +58,7 @@ func TestParseFromYamlCloudSQLAdmin(t *testing.T) { want: map[string]sources.SourceConfig{ "my-cloud-sql-admin-instance": cloudsqladmin.Config{ Name: "my-cloud-sql-admin-instance", - Kind: cloudsqladmin.SourceKind, + Type: cloudsqladmin.SourceType, UseClientOAuth: true, }, }, diff --git a/internal/sources/cloudsqlmssql/cloud_sql_mssql.go b/internal/sources/cloudsqlmssql/cloud_sql_mssql.go index 02480df326..c4536b5744 100644 --- a/internal/sources/cloudsqlmssql/cloud_sql_mssql.go +++ b/internal/sources/cloudsqlmssql/cloud_sql_mssql.go @@ -29,14 +29,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "cloud-sql-mssql" +const SourceType string = "cloud-sql-mssql" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -51,7 +51,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { // Cloud SQL MSSQL configs Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Region string `yaml:"region" validate:"required"` Instance string `yaml:"instance" validate:"required"` @@ -62,9 +62,9 @@ type Config struct { Database string `yaml:"database" validate:"required"` } -func (r Config) SourceConfigKind() string { +func (r Config) SourceConfigType() string { // Returns Cloud SQL MSSQL source kind - return SourceKind + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -94,9 +94,9 @@ type Source struct { Db *sql.DB } -func (s *Source) SourceKind() string { +func (s *Source) SourceType() string { // Returns Cloud SQL MSSQL source kind - return SourceKind + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -152,7 +152,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initCloudSQLMssqlConnection(ctx context.Context, tracer trace.Tracer, name, project, region, instance, ipType, user, pass, dbname string) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() userAgent, err := util.UserAgentFromContext(ctx) diff --git a/internal/sources/cloudsqlmssql/cloud_sql_mssql_test.go b/internal/sources/cloudsqlmssql/cloud_sql_mssql_test.go index 4af46d63ca..b5d52525b6 100644 --- a/internal/sources/cloudsqlmssql/cloud_sql_mssql_test.go +++ b/internal/sources/cloudsqlmssql/cloud_sql_mssql_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlCloudSQLMssql(t *testing.T) { want: server.SourceConfigs{ "my-instance": cloudsqlmssql.Config{ Name: "my-instance", - Kind: cloudsqlmssql.SourceKind, + Type: cloudsqlmssql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -74,7 +74,7 @@ func TestParseFromYamlCloudSQLMssql(t *testing.T) { want: server.SourceConfigs{ "my-instance": cloudsqlmssql.Config{ Name: "my-instance", - Kind: cloudsqlmssql.SourceKind, + Type: cloudsqlmssql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -102,7 +102,7 @@ func TestParseFromYamlCloudSQLMssql(t *testing.T) { want: server.SourceConfigs{ "my-instance": cloudsqlmssql.Config{ Name: "my-instance", - Kind: cloudsqlmssql.SourceKind, + Type: cloudsqlmssql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", diff --git a/internal/sources/cloudsqlmysql/cloud_sql_mysql.go b/internal/sources/cloudsqlmysql/cloud_sql_mysql.go index 759f00af7d..0e22d52d47 100644 --- a/internal/sources/cloudsqlmysql/cloud_sql_mysql.go +++ b/internal/sources/cloudsqlmysql/cloud_sql_mysql.go @@ -30,14 +30,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "cloud-sql-mysql" +const SourceType string = "cloud-sql-mysql" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -51,7 +51,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Region string `yaml:"region" validate:"required"` Instance string `yaml:"instance" validate:"required"` @@ -61,8 +61,8 @@ type Config struct { Database string `yaml:"database" validate:"required"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -90,8 +90,8 @@ type Source struct { Pool *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -184,7 +184,7 @@ func getConnectionConfig(ctx context.Context, user, pass string) (string, string func initCloudSQLMySQLConnectionPool(ctx context.Context, tracer trace.Tracer, name, project, region, instance, ipType, user, pass, dbname string) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Configure the driver to connect to the database diff --git a/internal/sources/cloudsqlmysql/cloud_sql_mysql_test.go b/internal/sources/cloudsqlmysql/cloud_sql_mysql_test.go index 74e9d9dd82..dd12006d01 100644 --- a/internal/sources/cloudsqlmysql/cloud_sql_mysql_test.go +++ b/internal/sources/cloudsqlmysql/cloud_sql_mysql_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlCloudSQLMySQL(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": cloudsqlmysql.Config{ Name: "my-mysql-instance", - Kind: cloudsqlmysql.SourceKind, + Type: cloudsqlmysql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -74,7 +74,7 @@ func TestParseFromYamlCloudSQLMySQL(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": cloudsqlmysql.Config{ Name: "my-mysql-instance", - Kind: cloudsqlmysql.SourceKind, + Type: cloudsqlmysql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -102,7 +102,7 @@ func TestParseFromYamlCloudSQLMySQL(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": cloudsqlmysql.Config{ Name: "my-mysql-instance", - Kind: cloudsqlmysql.SourceKind, + Type: cloudsqlmysql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -130,7 +130,7 @@ func TestParseFromYamlCloudSQLMySQL(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": cloudsqlmysql.Config{ Name: "my-mysql-instance", - Kind: cloudsqlmysql.SourceKind, + Type: cloudsqlmysql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", diff --git a/internal/sources/cloudsqlpg/cloud_sql_pg.go b/internal/sources/cloudsqlpg/cloud_sql_pg.go index dc7e59be3d..0ede8b565d 100644 --- a/internal/sources/cloudsqlpg/cloud_sql_pg.go +++ b/internal/sources/cloudsqlpg/cloud_sql_pg.go @@ -28,14 +28,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "cloud-sql-postgres" +const SourceType string = "cloud-sql-postgres" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -49,7 +49,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Region string `yaml:"region" validate:"required"` Instance string `yaml:"instance" validate:"required"` @@ -59,8 +59,8 @@ type Config struct { Password string `yaml:"password"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -88,8 +88,8 @@ type Source struct { Pool *pgxpool.Pool } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -162,7 +162,7 @@ func getConnectionConfig(ctx context.Context, user, pass, dbname string) (string func initCloudSQLPgConnectionPool(ctx context.Context, tracer trace.Tracer, name, project, region, instance, ipType, user, pass, dbname string) (*pgxpool.Pool, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Configure the driver to connect to the database diff --git a/internal/sources/cloudsqlpg/cloud_sql_pg_test.go b/internal/sources/cloudsqlpg/cloud_sql_pg_test.go index 0b833a94e0..b654750607 100644 --- a/internal/sources/cloudsqlpg/cloud_sql_pg_test.go +++ b/internal/sources/cloudsqlpg/cloud_sql_pg_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlCloudSQLPg(t *testing.T) { want: server.SourceConfigs{ "my-pg-instance": cloudsqlpg.Config{ Name: "my-pg-instance", - Kind: cloudsqlpg.SourceKind, + Type: cloudsqlpg.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -74,7 +74,7 @@ func TestParseFromYamlCloudSQLPg(t *testing.T) { want: server.SourceConfigs{ "my-pg-instance": cloudsqlpg.Config{ Name: "my-pg-instance", - Kind: cloudsqlpg.SourceKind, + Type: cloudsqlpg.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -102,7 +102,7 @@ func TestParseFromYamlCloudSQLPg(t *testing.T) { want: server.SourceConfigs{ "my-pg-instance": cloudsqlpg.Config{ Name: "my-pg-instance", - Kind: cloudsqlpg.SourceKind, + Type: cloudsqlpg.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -130,7 +130,7 @@ func TestParseFromYamlCloudSQLPg(t *testing.T) { want: server.SourceConfigs{ "my-pg-instance": cloudsqlpg.Config{ Name: "my-pg-instance", - Kind: cloudsqlpg.SourceKind, + Type: cloudsqlpg.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", diff --git a/internal/sources/couchbase/couchbase.go b/internal/sources/couchbase/couchbase.go index c273a47ec0..ca7386ec53 100644 --- a/internal/sources/couchbase/couchbase.go +++ b/internal/sources/couchbase/couchbase.go @@ -29,14 +29,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "couchbase" +const SourceType string = "couchbase" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -50,7 +50,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` ConnectionString string `yaml:"connectionString" validate:"required"` Bucket string `yaml:"bucket" validate:"required"` Scope string `yaml:"scope" validate:"required"` @@ -66,8 +66,8 @@ type Config struct { QueryScanConsistency uint `yaml:"queryScanConsistency"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -96,8 +96,8 @@ type Source struct { Scope *gocb.Scope } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/couchbase/couchbase_test.go b/internal/sources/couchbase/couchbase_test.go index 43677333c4..bf3acf7360 100644 --- a/internal/sources/couchbase/couchbase_test.go +++ b/internal/sources/couchbase/couchbase_test.go @@ -45,7 +45,7 @@ func TestParseFromYamlCouchbase(t *testing.T) { want: server.SourceConfigs{ "my-couchbase-instance": couchbase.Config{ Name: "my-couchbase-instance", - Kind: couchbase.SourceKind, + Type: couchbase.SourceType, ConnectionString: "localhost", Username: "Administrator", Password: "password", @@ -74,7 +74,7 @@ func TestParseFromYamlCouchbase(t *testing.T) { want: server.SourceConfigs{ "my-couchbase-instance": couchbase.Config{ Name: "my-couchbase-instance", - Kind: couchbase.SourceKind, + Type: couchbase.SourceType, ConnectionString: "couchbases://localhost", Bucket: "travel-sample", Scope: "inventory", diff --git a/internal/sources/dataplex/dataplex.go b/internal/sources/dataplex/dataplex.go index 52d64b194d..b1ff03ccaa 100644 --- a/internal/sources/dataplex/dataplex.go +++ b/internal/sources/dataplex/dataplex.go @@ -31,14 +31,14 @@ import ( grpcstatus "google.golang.org/grpc/status" ) -const SourceKind string = "dataplex" +const SourceType string = "dataplex" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -53,13 +53,13 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { // Dataplex configs Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` } -func (r Config) SourceConfigKind() string { +func (r Config) SourceConfigType() string { // Returns Dataplex source kind - return SourceKind + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -83,9 +83,9 @@ type Source struct { Client *dataplexapi.CatalogClient } -func (s *Source) SourceKind() string { +func (s *Source) SourceType() string { // Returns Dataplex source kind - return SourceKind + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -106,7 +106,7 @@ func initDataplexConnection( name string, project string, ) (*dataplexapi.CatalogClient, error) { - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() cred, err := google.FindDefaultCredentials(ctx) diff --git a/internal/sources/dataplex/dataplex_test.go b/internal/sources/dataplex/dataplex_test.go index 0379eba5b4..eebd65f2cb 100644 --- a/internal/sources/dataplex/dataplex_test.go +++ b/internal/sources/dataplex/dataplex_test.go @@ -41,7 +41,7 @@ func TestParseFromYamlDataplex(t *testing.T) { want: server.SourceConfigs{ "my-instance": dataplex.Config{ Name: "my-instance", - Kind: dataplex.SourceKind, + Type: dataplex.SourceType, Project: "my-project", }, }, diff --git a/internal/sources/dgraph/dgraph.go b/internal/sources/dgraph/dgraph.go index 317779db38..9a28ecee89 100644 --- a/internal/sources/dgraph/dgraph.go +++ b/internal/sources/dgraph/dgraph.go @@ -30,14 +30,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "dgraph" +const SourceType string = "dgraph" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -67,7 +67,7 @@ type DgraphClient struct { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` DgraphUrl string `yaml:"dgraphUrl" validate:"required"` User string `yaml:"user"` Password string `yaml:"password"` @@ -75,8 +75,8 @@ type Config struct { ApiKey string `yaml:"apiKey"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -103,8 +103,8 @@ type Source struct { Client *DgraphClient `yaml:"client"` } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -139,7 +139,7 @@ func (s *Source) RunSQL(statement string, params parameters.ParamValues, isQuery func initDgraphHttpClient(ctx context.Context, tracer trace.Tracer, r Config) (*DgraphClient, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, r.Name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, r.Name) defer span.End() if r.DgraphUrl == "" { diff --git a/internal/sources/dgraph/dgraph_test.go b/internal/sources/dgraph/dgraph_test.go index d2db006683..1cd393d4cb 100644 --- a/internal/sources/dgraph/dgraph_test.go +++ b/internal/sources/dgraph/dgraph_test.go @@ -45,7 +45,7 @@ func TestParseFromYamlDgraph(t *testing.T) { want: server.SourceConfigs{ "my-dgraph-instance": dgraph.Config{ Name: "my-dgraph-instance", - Kind: dgraph.SourceKind, + Type: dgraph.SourceType, DgraphUrl: "https://localhost:8080", ApiKey: "abc123", Password: "pass@123", @@ -65,7 +65,7 @@ func TestParseFromYamlDgraph(t *testing.T) { want: server.SourceConfigs{ "my-dgraph-instance": dgraph.Config{ Name: "my-dgraph-instance", - Kind: dgraph.SourceKind, + Type: dgraph.SourceType, DgraphUrl: "https://localhost:8080", }, }, diff --git a/internal/sources/elasticsearch/elasticsearch.go b/internal/sources/elasticsearch/elasticsearch.go index b5ec915c18..529836cf96 100644 --- a/internal/sources/elasticsearch/elasticsearch.go +++ b/internal/sources/elasticsearch/elasticsearch.go @@ -30,14 +30,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "elasticsearch" +const SourceType string = "elasticsearch" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -51,15 +51,15 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Addresses []string `yaml:"addresses" validate:"required"` Username string `yaml:"username"` Password string `yaml:"password"` APIKey string `yaml:"apikey"` } -func (c Config) SourceConfigKind() string { - return SourceKind +func (c Config) SourceConfigType() string { + return SourceType } type EsClient interface { @@ -139,9 +139,9 @@ func (c Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.So return s, nil } -// SourceKind returns the kind string for this source. -func (s *Source) SourceKind() string { - return SourceKind +// SourceType returns the kind string for this source. +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/elasticsearch/elasticsearch_test.go b/internal/sources/elasticsearch/elasticsearch_test.go index 95d941edc4..434e41fccd 100644 --- a/internal/sources/elasticsearch/elasticsearch_test.go +++ b/internal/sources/elasticsearch/elasticsearch_test.go @@ -43,7 +43,7 @@ func TestParseFromYamlElasticsearch(t *testing.T) { want: server.SourceConfigs{ "my-es-instance": elasticsearch.Config{ Name: "my-es-instance", - Kind: elasticsearch.SourceKind, + Type: elasticsearch.SourceType, Addresses: []string{"http://localhost:9200"}, APIKey: "somekey", }, diff --git a/internal/sources/firebird/firebird.go b/internal/sources/firebird/firebird.go index 4be3d20cac..3532f3b9de 100644 --- a/internal/sources/firebird/firebird.go +++ b/internal/sources/firebird/firebird.go @@ -27,13 +27,13 @@ import ( "github.com/googleapis/genai-toolbox/internal/sources" ) -const SourceKind string = "firebird" +const SourceType string = "firebird" var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -47,7 +47,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user" validate:"required"` @@ -55,8 +55,8 @@ type Config struct { Database string `yaml:"database" validate:"required"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -84,8 +84,8 @@ type Source struct { Db *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -144,7 +144,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an } func initFirebirdConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname string) (*sql.DB, error) { - _, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + _, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // urlExample := "user:password@host:port/path/to/database.fdb" diff --git a/internal/sources/firebird/firebird_test.go b/internal/sources/firebird/firebird_test.go index 0a7e72f66c..3d527a4b25 100644 --- a/internal/sources/firebird/firebird_test.go +++ b/internal/sources/firebird/firebird_test.go @@ -45,7 +45,7 @@ func TestParseFromYamlFirebird(t *testing.T) { want: server.SourceConfigs{ "my-fdb-instance": firebird.Config{ Name: "my-fdb-instance", - Kind: firebird.SourceKind, + Type: firebird.SourceType, Host: "my-host", Port: "my-port", Database: "my_db", diff --git a/internal/sources/firestore/firestore.go b/internal/sources/firestore/firestore.go index be9f7aa94f..88fe629f63 100644 --- a/internal/sources/firestore/firestore.go +++ b/internal/sources/firestore/firestore.go @@ -31,14 +31,14 @@ import ( "google.golang.org/genproto/googleapis/type/latlng" ) -const SourceKind string = "firestore" +const SourceType string = "firestore" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -53,14 +53,14 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { // Firestore configs Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Database string `yaml:"database"` // Optional, defaults to "(default)" } -func (r Config) SourceConfigKind() string { +func (r Config) SourceConfigType() string { // Returns Firestore source kind - return SourceKind + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -92,9 +92,9 @@ type Source struct { RulesClient *firebaserules.Service } -func (s *Source) SourceKind() string { +func (s *Source) SourceType() string { // Returns Firestore source kind - return SourceKind + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -594,7 +594,7 @@ func initFirestoreConnection( project string, database string, ) (*firestore.Client, error) { - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() userAgent, err := util.UserAgentFromContext(ctx) diff --git a/internal/sources/firestore/firestore_test.go b/internal/sources/firestore/firestore_test.go index 3f15440f13..133d9b476c 100644 --- a/internal/sources/firestore/firestore_test.go +++ b/internal/sources/firestore/firestore_test.go @@ -42,7 +42,7 @@ func TestParseFromYamlFirestore(t *testing.T) { want: server.SourceConfigs{ "my-firestore": firestore.Config{ Name: "my-firestore", - Kind: firestore.SourceKind, + Type: firestore.SourceType, Project: "my-project", Database: "", }, @@ -60,7 +60,7 @@ func TestParseFromYamlFirestore(t *testing.T) { want: server.SourceConfigs{ "my-firestore": firestore.Config{ Name: "my-firestore", - Kind: firestore.SourceKind, + Type: firestore.SourceType, Project: "my-project", Database: "my-database", }, diff --git a/internal/sources/http/http.go b/internal/sources/http/http.go index 238c19b607..e6da48fef3 100644 --- a/internal/sources/http/http.go +++ b/internal/sources/http/http.go @@ -29,14 +29,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "http" +const SourceType string = "http" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -50,7 +50,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` BaseURL string `yaml:"baseUrl"` Timeout string `yaml:"timeout"` DefaultHeaders map[string]string `yaml:"headers"` @@ -58,8 +58,8 @@ type Config struct { DisableSslVerification bool `yaml:"disableSslVerification"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } // Initialize initializes an HTTP Source instance. @@ -122,8 +122,8 @@ type Source struct { client *http.Client } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/http/http_test.go b/internal/sources/http/http_test.go index 02d8fc6b4d..fa0d56270e 100644 --- a/internal/sources/http/http_test.go +++ b/internal/sources/http/http_test.go @@ -42,7 +42,7 @@ func TestParseFromYamlHttp(t *testing.T) { want: map[string]sources.SourceConfig{ "my-http-instance": http.Config{ Name: "my-http-instance", - Kind: http.SourceKind, + Type: http.SourceType, BaseURL: "http://test_server/", Timeout: "30s", DisableSslVerification: false, @@ -68,7 +68,7 @@ func TestParseFromYamlHttp(t *testing.T) { want: map[string]sources.SourceConfig{ "my-http-instance": http.Config{ Name: "my-http-instance", - Kind: http.SourceKind, + Type: http.SourceType, BaseURL: "http://test_server/", Timeout: "10s", DefaultHeaders: map[string]string{"Authorization": "test_header", "Custom-Header": "custom"}, diff --git a/internal/sources/looker/looker.go b/internal/sources/looker/looker.go index c7b401b080..bc76068c4c 100644 --- a/internal/sources/looker/looker.go +++ b/internal/sources/looker/looker.go @@ -33,14 +33,14 @@ import ( v4 "github.com/looker-open-source/sdk-codegen/go/sdk/v4" ) -const SourceKind string = "looker" +const SourceType string = "looker" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -64,7 +64,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` BaseURL string `yaml:"base_url" validate:"required"` ClientId string `yaml:"client_id"` ClientSecret string `yaml:"client_secret"` @@ -79,8 +79,8 @@ type Config struct { SessionLength int64 `yaml:"sessionLength"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } // Initialize initializes a Looker Source instance. @@ -154,8 +154,8 @@ type Source struct { AuthTokenHeaderName string } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/looker/looker_test.go b/internal/sources/looker/looker_test.go index bd470f0130..f9ba0573fc 100644 --- a/internal/sources/looker/looker_test.go +++ b/internal/sources/looker/looker_test.go @@ -44,7 +44,7 @@ func TestParseFromYamlLooker(t *testing.T) { want: map[string]sources.SourceConfig{ "my-looker-instance": looker.Config{ Name: "my-looker-instance", - Kind: looker.SourceKind, + Type: looker.SourceType, BaseURL: "http://example.looker.com/", ClientId: "jasdl;k;tjl", ClientSecret: "sdakl;jgflkasdfkfg", diff --git a/internal/sources/mindsdb/mindsdb.go b/internal/sources/mindsdb/mindsdb.go index 4bb5daac1c..18dc28c852 100644 --- a/internal/sources/mindsdb/mindsdb.go +++ b/internal/sources/mindsdb/mindsdb.go @@ -27,14 +27,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "mindsdb" +const SourceType string = "mindsdb" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -48,7 +48,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user" validate:"required"` @@ -57,8 +57,8 @@ type Config struct { QueryTimeout string `yaml:"queryTimeout"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -86,8 +86,8 @@ type Source struct { Pool *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -159,7 +159,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initMindsDBConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, queryTimeout string) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Configure the driver to connect to the database diff --git a/internal/sources/mindsdb/mindsdb_test.go b/internal/sources/mindsdb/mindsdb_test.go index b80f0bc5a6..6339cd02af 100644 --- a/internal/sources/mindsdb/mindsdb_test.go +++ b/internal/sources/mindsdb/mindsdb_test.go @@ -45,7 +45,7 @@ func TestParseFromYamlMindsDB(t *testing.T) { want: server.SourceConfigs{ "my-mindsdb-instance": mindsdb.Config{ Name: "my-mindsdb-instance", - Kind: mindsdb.SourceKind, + Type: mindsdb.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", @@ -70,7 +70,7 @@ func TestParseFromYamlMindsDB(t *testing.T) { want: server.SourceConfigs{ "my-mindsdb-instance": mindsdb.Config{ Name: "my-mindsdb-instance", - Kind: mindsdb.SourceKind, + Type: mindsdb.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", diff --git a/internal/sources/mongodb/mongodb.go b/internal/sources/mongodb/mongodb.go index 533e5005d5..0a8f273ed6 100644 --- a/internal/sources/mongodb/mongodb.go +++ b/internal/sources/mongodb/mongodb.go @@ -29,14 +29,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "mongodb" +const SourceType string = "mongodb" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -50,12 +50,12 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Uri string `yaml:"uri" validate:"required"` // MongoDB Atlas connection URI } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -84,8 +84,8 @@ type Source struct { Client *mongo.Client } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -293,7 +293,7 @@ func (s *Source) DeleteOne(ctx context.Context, filterString, database, collecti func initMongoDBClient(ctx context.Context, tracer trace.Tracer, name, uri string) (*mongo.Client, error) { // Start a tracing span - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() userAgent, err := util.UserAgentFromContext(ctx) diff --git a/internal/sources/mongodb/mongodb_test.go b/internal/sources/mongodb/mongodb_test.go index 0c882899a4..ab7c859d10 100644 --- a/internal/sources/mongodb/mongodb_test.go +++ b/internal/sources/mongodb/mongodb_test.go @@ -41,7 +41,7 @@ func TestParseFromYamlMongoDB(t *testing.T) { want: server.SourceConfigs{ "mongo-db": mongodb.Config{ Name: "mongo-db", - Kind: mongodb.SourceKind, + Type: mongodb.SourceType, Uri: "mongodb+srv://username:password@host/dbname", }, }, diff --git a/internal/sources/mssql/mssql.go b/internal/sources/mssql/mssql.go index 688ccf18c4..9e5b5c2906 100644 --- a/internal/sources/mssql/mssql.go +++ b/internal/sources/mssql/mssql.go @@ -28,14 +28,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "mssql" +const SourceType string = "mssql" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -50,7 +50,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { // Cloud SQL MSSQL configs Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user" validate:"required"` @@ -59,9 +59,9 @@ type Config struct { Encrypt string `yaml:"encrypt"` } -func (r Config) SourceConfigKind() string { +func (r Config) SourceConfigType() string { // Returns Cloud SQL MSSQL source kind - return SourceKind + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -91,9 +91,9 @@ type Source struct { Db *sql.DB } -func (s *Source) SourceKind() string { +func (s *Source) SourceType() string { // Returns Cloud SQL MSSQL source kind - return SourceKind + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -156,7 +156,7 @@ func initMssqlConnection( error, ) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() userAgent, err := util.UserAgentFromContext(ctx) diff --git a/internal/sources/mssql/mssql_test.go b/internal/sources/mssql/mssql_test.go index b1fa552b46..89213adc30 100644 --- a/internal/sources/mssql/mssql_test.go +++ b/internal/sources/mssql/mssql_test.go @@ -45,7 +45,7 @@ func TestParseFromYamlMssql(t *testing.T) { want: server.SourceConfigs{ "my-mssql-instance": mssql.Config{ Name: "my-mssql-instance", - Kind: mssql.SourceKind, + Type: mssql.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", @@ -70,7 +70,7 @@ func TestParseFromYamlMssql(t *testing.T) { want: server.SourceConfigs{ "my-mssql-instance": mssql.Config{ Name: "my-mssql-instance", - Kind: mssql.SourceKind, + Type: mssql.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", diff --git a/internal/sources/mysql/mysql.go b/internal/sources/mysql/mysql.go index b456ec9a3f..916b11dcdb 100644 --- a/internal/sources/mysql/mysql.go +++ b/internal/sources/mysql/mysql.go @@ -30,14 +30,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "mysql" +const SourceType string = "mysql" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -51,7 +51,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user" validate:"required"` @@ -61,8 +61,8 @@ type Config struct { QueryParams map[string]string `yaml:"queryParams"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -90,8 +90,8 @@ type Source struct { Pool *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -158,7 +158,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initMySQLConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, queryTimeout string, queryParams map[string]string) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Build query parameters via url.Values for deterministic order and proper escaping. diff --git a/internal/sources/mysql/mysql_test.go b/internal/sources/mysql/mysql_test.go index 2cbce3bc50..f78260d58a 100644 --- a/internal/sources/mysql/mysql_test.go +++ b/internal/sources/mysql/mysql_test.go @@ -50,7 +50,7 @@ func TestParseFromYamlCloudSQLMySQL(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": mysql.Config{ Name: "my-mysql-instance", - Kind: mysql.SourceKind, + Type: mysql.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", @@ -75,7 +75,7 @@ func TestParseFromYamlCloudSQLMySQL(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": mysql.Config{ Name: "my-mysql-instance", - Kind: mysql.SourceKind, + Type: mysql.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", @@ -103,7 +103,7 @@ func TestParseFromYamlCloudSQLMySQL(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": mysql.Config{ Name: "my-mysql-instance", - Kind: mysql.SourceKind, + Type: mysql.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", @@ -211,7 +211,7 @@ func TestFailInitialization(t *testing.T) { cfg := mysql.Config{ Name: "instance", - Kind: "mysql", + Type: "mysql", Host: "localhost", Port: "3306", Database: "db", diff --git a/internal/sources/neo4j/neo4j.go b/internal/sources/neo4j/neo4j.go index 70cc21ae14..0644b2e527 100644 --- a/internal/sources/neo4j/neo4j.go +++ b/internal/sources/neo4j/neo4j.go @@ -29,7 +29,7 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "neo4j" +const SourceType string = "neo4j" var sourceClassifier *classifier.QueryClassifier = classifier.NewQueryClassifier() @@ -37,8 +37,8 @@ var sourceClassifier *classifier.QueryClassifier = classifier.NewQueryClassifier var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -52,15 +52,15 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Uri string `yaml:"uri" validate:"required"` User string `yaml:"user" validate:"required"` Password string `yaml:"password" validate:"required"` Database string `yaml:"database" validate:"required"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -91,8 +91,8 @@ type Source struct { Driver neo4j.DriverWithContext } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -182,7 +182,7 @@ func addPlanChildren(p neo4j.Plan) []map[string]any { func initNeo4jDriver(ctx context.Context, tracer trace.Tracer, uri, user, password, name string) (neo4j.DriverWithContext, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() auth := neo4j.BasicAuth(user, password, "") diff --git a/internal/sources/neo4j/neo4j_test.go b/internal/sources/neo4j/neo4j_test.go index 2ac8aab534..090b7f7de8 100644 --- a/internal/sources/neo4j/neo4j_test.go +++ b/internal/sources/neo4j/neo4j_test.go @@ -44,7 +44,7 @@ func TestParseFromYamlNeo4j(t *testing.T) { want: server.SourceConfigs{ "my-neo4j-instance": neo4j.Config{ Name: "my-neo4j-instance", - Kind: neo4j.SourceKind, + Type: neo4j.SourceType, Uri: "neo4j+s://my-host:7687", Database: "my_db", User: "my_user", diff --git a/internal/sources/oceanbase/oceanbase.go b/internal/sources/oceanbase/oceanbase.go index 27a989ae3d..edee9739b1 100644 --- a/internal/sources/oceanbase/oceanbase.go +++ b/internal/sources/oceanbase/oceanbase.go @@ -27,14 +27,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "oceanbase" +const SourceType string = "oceanbase" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -48,7 +48,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user" validate:"required"` @@ -57,8 +57,8 @@ type Config struct { QueryTimeout string `yaml:"queryTimeout"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -86,8 +86,8 @@ type Source struct { Pool *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -153,7 +153,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an } func initOceanBaseConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, queryTimeout string) (*sql.DB, error) { - _, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + _, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?parseTime=true", user, pass, host, port, dbname) diff --git a/internal/sources/oceanbase/oceanbase_test.go b/internal/sources/oceanbase/oceanbase_test.go index a21a5e0655..b2231b52a8 100644 --- a/internal/sources/oceanbase/oceanbase_test.go +++ b/internal/sources/oceanbase/oceanbase_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlOceanBase(t *testing.T) { want: server.SourceConfigs{ "my-oceanbase-instance": oceanbase.Config{ Name: "my-oceanbase-instance", - Kind: oceanbase.SourceKind, + Type: oceanbase.SourceType, Host: "0.0.0.0", Port: "2881", Database: "ob_db", @@ -71,7 +71,7 @@ func TestParseFromYamlOceanBase(t *testing.T) { want: server.SourceConfigs{ "my-oceanbase-instance": oceanbase.Config{ Name: "my-oceanbase-instance", - Kind: oceanbase.SourceKind, + Type: oceanbase.SourceType, Host: "0.0.0.0", Port: "2881", Database: "ob_db", diff --git a/internal/sources/oracle/oracle.go b/internal/sources/oracle/oracle.go index 29d78cc706..2acf016449 100644 --- a/internal/sources/oracle/oracle.go +++ b/internal/sources/oracle/oracle.go @@ -18,14 +18,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "oracle" +const SourceType string = "oracle" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -45,7 +45,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` ConnectionString string `yaml:"connectionString,omitempty"` TnsAlias string `yaml:"tnsAlias,omitempty"` TnsAdmin string `yaml:"tnsAdmin,omitempty"` @@ -95,8 +95,8 @@ func (c Config) validate() error { return nil } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -124,8 +124,8 @@ type Source struct { DB *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -239,7 +239,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initOracleConnection(ctx context.Context, tracer trace.Tracer, config Config) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, config.Name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, config.Name) defer span.End() logger, err := util.LoggerFromContext(ctx) diff --git a/internal/sources/oracle/oracle_test.go b/internal/sources/oracle/oracle_test.go index 3d8f4c7ba5..cc827f21af 100644 --- a/internal/sources/oracle/oracle_test.go +++ b/internal/sources/oracle/oracle_test.go @@ -33,7 +33,7 @@ func TestParseFromYamlOracle(t *testing.T) { want: server.SourceConfigs{ "my-oracle-cs": oracle.Config{ Name: "my-oracle-cs", - Kind: oracle.SourceKind, + Type: oracle.SourceType, ConnectionString: "my-host:1521/XEPDB1", User: "my_user", Password: "my_pass", @@ -56,7 +56,7 @@ func TestParseFromYamlOracle(t *testing.T) { want: server.SourceConfigs{ "my-oracle-host": oracle.Config{ Name: "my-oracle-host", - Kind: oracle.SourceKind, + Type: oracle.SourceType, Host: "my-host", Port: 1521, ServiceName: "ORCLPDB", @@ -81,7 +81,7 @@ func TestParseFromYamlOracle(t *testing.T) { want: server.SourceConfigs{ "my-oracle-tns-oci": oracle.Config{ Name: "my-oracle-tns-oci", - Kind: oracle.SourceKind, + Type: oracle.SourceType, TnsAlias: "FINANCE_DB", TnsAdmin: "/opt/oracle/network/admin", User: "my_user", diff --git a/internal/sources/postgres/postgres.go b/internal/sources/postgres/postgres.go index d23721fc06..23cd139f54 100644 --- a/internal/sources/postgres/postgres.go +++ b/internal/sources/postgres/postgres.go @@ -28,14 +28,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "postgres" +const SourceType string = "postgres" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -49,7 +49,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user" validate:"required"` @@ -58,8 +58,8 @@ type Config struct { QueryParams map[string]string `yaml:"queryParams"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -87,8 +87,8 @@ type Source struct { Pool *pgxpool.Pool } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -128,7 +128,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initPostgresConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname string, queryParams map[string]string) (*pgxpool.Pool, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() userAgent, err := util.UserAgentFromContext(ctx) if err != nil { diff --git a/internal/sources/postgres/postgres_test.go b/internal/sources/postgres/postgres_test.go index b9d8872c3a..036d78f086 100644 --- a/internal/sources/postgres/postgres_test.go +++ b/internal/sources/postgres/postgres_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlPostgres(t *testing.T) { want: server.SourceConfigs{ "my-pg-instance": postgres.Config{ Name: "my-pg-instance", - Kind: postgres.SourceKind, + Type: postgres.SourceType, Host: "my-host", Port: "my-port", Database: "my_db", @@ -74,7 +74,7 @@ func TestParseFromYamlPostgres(t *testing.T) { want: server.SourceConfigs{ "my-pg-instance": postgres.Config{ Name: "my-pg-instance", - Kind: postgres.SourceKind, + Type: postgres.SourceType, Host: "my-host", Port: "my-port", Database: "my_db", diff --git a/internal/sources/redis/redis.go b/internal/sources/redis/redis.go index f8e4bfa40e..cfbf1ddc9f 100644 --- a/internal/sources/redis/redis.go +++ b/internal/sources/redis/redis.go @@ -24,14 +24,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "redis" +const SourceType string = "redis" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -45,7 +45,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Address []string `yaml:"address" validate:"required"` Username string `yaml:"username"` Password string `yaml:"password"` @@ -54,8 +54,8 @@ type Config struct { ClusterEnabled bool `yaml:"clusterEnabled"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } // RedisClient is an interface for `redis.Client` and `redis.ClusterClient @@ -141,8 +141,8 @@ type Source struct { Client RedisClient } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/redis/redis_test.go b/internal/sources/redis/redis_test.go index 4fe944b924..cddada1569 100644 --- a/internal/sources/redis/redis_test.go +++ b/internal/sources/redis/redis_test.go @@ -43,7 +43,7 @@ func TestParseFromYamlRedis(t *testing.T) { want: server.SourceConfigs{ "my-redis-instance": redis.Config{ Name: "my-redis-instance", - Kind: redis.SourceKind, + Type: redis.SourceType, Address: []string{"127.0.0.1"}, ClusterEnabled: false, UseGCPIAM: false, @@ -66,7 +66,7 @@ func TestParseFromYamlRedis(t *testing.T) { want: server.SourceConfigs{ "my-redis-instance": redis.Config{ Name: "my-redis-instance", - Kind: redis.SourceKind, + Type: redis.SourceType, Address: []string{"127.0.0.1"}, Password: "my-pass", Database: 1, diff --git a/internal/sources/serverlessspark/serverlessspark.go b/internal/sources/serverlessspark/serverlessspark.go index f6968f9bae..2ea9861090 100644 --- a/internal/sources/serverlessspark/serverlessspark.go +++ b/internal/sources/serverlessspark/serverlessspark.go @@ -33,14 +33,14 @@ import ( "google.golang.org/protobuf/encoding/protojson" ) -const SourceKind string = "serverless-spark" +const SourceType string = "serverless-spark" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -54,13 +54,13 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Location string `yaml:"location" validate:"required"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -94,8 +94,8 @@ type Source struct { OpsClient *longrunning.OperationsClient } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/serverlessspark/serverlessspark_test.go b/internal/sources/serverlessspark/serverlessspark_test.go index 3162f259ef..9902089475 100644 --- a/internal/sources/serverlessspark/serverlessspark_test.go +++ b/internal/sources/serverlessspark/serverlessspark_test.go @@ -42,7 +42,7 @@ func TestParseFromYamlServerlessSpark(t *testing.T) { want: server.SourceConfigs{ "my-instance": serverlessspark.Config{ Name: "my-instance", - Kind: serverlessspark.SourceKind, + Type: serverlessspark.SourceType, Project: "my-project", Location: "my-location", }, diff --git a/internal/sources/singlestore/singlestore.go b/internal/sources/singlestore/singlestore.go index ebcede392e..2f300d3753 100644 --- a/internal/sources/singlestore/singlestore.go +++ b/internal/sources/singlestore/singlestore.go @@ -29,15 +29,15 @@ import ( "go.opentelemetry.io/otel/trace" ) -// SourceKind for SingleStore source -const SourceKind string = "singlestore" +// SourceType for SingleStore source +const SourceType string = "singlestore" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -52,7 +52,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources // Config holds the configuration parameters for connecting to a SingleStore database. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user" validate:"required"` @@ -61,9 +61,9 @@ type Config struct { QueryTimeout string `yaml:"queryTimeout"` } -// SourceConfigKind returns the kind of the source configuration. -func (r Config) SourceConfigKind() string { - return SourceKind +// SourceConfigType returns the kind of the source configuration. +func (r Config) SourceConfigType() string { + return SourceType } // Initialize sets up the SingleStore connection pool and returns a Source. @@ -93,9 +93,9 @@ type Source struct { Pool *sql.DB } -// SourceKind returns the kind of the source configuration. -func (s *Source) SourceKind() string { - return SourceKind +// SourceType returns the kind of the source configuration. +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -162,7 +162,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initSingleStoreConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, queryTimeout string) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Configure the driver to connect to the database diff --git a/internal/sources/singlestore/singlestore_test.go b/internal/sources/singlestore/singlestore_test.go index 101df5300a..b72edfe3b0 100644 --- a/internal/sources/singlestore/singlestore_test.go +++ b/internal/sources/singlestore/singlestore_test.go @@ -45,7 +45,7 @@ func TestParseFromYaml(t *testing.T) { want: server.SourceConfigs{ "my-s2-instance": singlestore.Config{ Name: "my-s2-instance", - Kind: singlestore.SourceKind, + Type: singlestore.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", @@ -70,7 +70,7 @@ func TestParseFromYaml(t *testing.T) { want: server.SourceConfigs{ "my-s2-instance": singlestore.Config{ Name: "my-s2-instance", - Kind: singlestore.SourceKind, + Type: singlestore.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", diff --git a/internal/sources/snowflake/snowflake.go b/internal/sources/snowflake/snowflake.go index af44eb2ece..289db6dd96 100644 --- a/internal/sources/snowflake/snowflake.go +++ b/internal/sources/snowflake/snowflake.go @@ -25,14 +25,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "snowflake" +const SourceType string = "snowflake" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -46,7 +46,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Account string `yaml:"account" validate:"required"` User string `yaml:"user" validate:"required"` Password string `yaml:"password" validate:"required"` @@ -56,8 +56,8 @@ type Config struct { Role string `yaml:"role"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -85,8 +85,8 @@ type Source struct { DB *sqlx.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -137,7 +137,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initSnowflakeConnection(ctx context.Context, tracer trace.Tracer, name, account, user, password, database, schema, warehouse, role string) (*sqlx.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Set defaults for optional parameters diff --git a/internal/sources/snowflake/snowflake_test.go b/internal/sources/snowflake/snowflake_test.go index 54d7114849..4e5aa226b5 100644 --- a/internal/sources/snowflake/snowflake_test.go +++ b/internal/sources/snowflake/snowflake_test.go @@ -45,7 +45,7 @@ func TestParseFromYamlSnowflake(t *testing.T) { want: server.SourceConfigs{ "my-snowflake-instance": snowflake.Config{ Name: "my-snowflake-instance", - Kind: snowflake.SourceKind, + Type: snowflake.SourceType, Account: "my-account", User: "my_user", Password: "my_pass", diff --git a/internal/sources/sources.go b/internal/sources/sources.go index 10e6d57e17..dcdec2a6c2 100644 --- a/internal/sources/sources.go +++ b/internal/sources/sources.go @@ -31,46 +31,46 @@ var sourceRegistry = make(map[string]SourceConfigFactory) // Register registers a new source kind with its factory. // It returns false if the kind is already registered. -func Register(kind string, factory SourceConfigFactory) bool { - if _, exists := sourceRegistry[kind]; exists { +func Register(sourceType string, factory SourceConfigFactory) bool { + if _, exists := sourceRegistry[sourceType]; exists { // Source with this kind already exists, do not overwrite. return false } - sourceRegistry[kind] = factory + sourceRegistry[sourceType] = factory return true } // DecodeConfig decodes a source configuration using the registered factory for the given kind. -func DecodeConfig(ctx context.Context, kind string, name string, decoder *yaml.Decoder) (SourceConfig, error) { - factory, found := sourceRegistry[kind] +func DecodeConfig(ctx context.Context, sourceType string, name string, decoder *yaml.Decoder) (SourceConfig, error) { + factory, found := sourceRegistry[sourceType] if !found { - return nil, fmt.Errorf("unknown source kind: %q", kind) + return nil, fmt.Errorf("unknown source kind: %q", sourceType) } sourceConfig, err := factory(ctx, name, decoder) if err != nil { - return nil, fmt.Errorf("unable to parse source %q as %q: %w", name, kind, err) + return nil, fmt.Errorf("unable to parse source %q as %q: %w", name, sourceType, err) } return sourceConfig, err } // SourceConfig is the interface for configuring a source. type SourceConfig interface { - SourceConfigKind() string + SourceConfigType() string Initialize(ctx context.Context, tracer trace.Tracer) (Source, error) } // Source is the interface for the source itself. type Source interface { - SourceKind() string + SourceType() string ToConfig() SourceConfig } // InitConnectionSpan adds a span for database pool connection initialization -func InitConnectionSpan(ctx context.Context, tracer trace.Tracer, sourceKind, sourceName string) (context.Context, trace.Span) { +func InitConnectionSpan(ctx context.Context, tracer trace.Tracer, sourceType, sourceName string) (context.Context, trace.Span) { ctx, span := tracer.Start( ctx, "toolbox/server/source/connect", - trace.WithAttributes(attribute.String("source_kind", sourceKind)), + trace.WithAttributes(attribute.String("source_type", sourceType)), trace.WithAttributes(attribute.String("source_name", sourceName)), ) return ctx, span diff --git a/internal/sources/spanner/spanner.go b/internal/sources/spanner/spanner.go index d6a6967e12..0959aac18f 100644 --- a/internal/sources/spanner/spanner.go +++ b/internal/sources/spanner/spanner.go @@ -28,14 +28,14 @@ import ( "google.golang.org/api/iterator" ) -const SourceKind string = "spanner" +const SourceType string = "spanner" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -49,15 +49,15 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Project string `yaml:"project" validate:"required"` Instance string `yaml:"instance" validate:"required"` Dialect sources.Dialect `yaml:"dialect" validate:"required"` Database string `yaml:"database" validate:"required"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -80,8 +80,8 @@ type Source struct { Client *spanner.Client } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -171,7 +171,7 @@ func (s *Source) RunSQL(ctx context.Context, readOnly bool, statement string, pa func initSpannerClient(ctx context.Context, tracer trace.Tracer, name, project, instance, dbname string) (*spanner.Client, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Configure the connection to the database diff --git a/internal/sources/spanner/spanner_test.go b/internal/sources/spanner/spanner_test.go index af0ac6a9fe..81327bd6b7 100644 --- a/internal/sources/spanner/spanner_test.go +++ b/internal/sources/spanner/spanner_test.go @@ -44,7 +44,7 @@ func TestParseFromYamlSpannerDb(t *testing.T) { want: map[string]sources.SourceConfig{ "my-spanner-instance": spanner.Config{ Name: "my-spanner-instance", - Kind: spanner.SourceKind, + Type: spanner.SourceType, Project: "my-project", Instance: "my-instance", Dialect: "googlesql", @@ -66,7 +66,7 @@ func TestParseFromYamlSpannerDb(t *testing.T) { want: map[string]sources.SourceConfig{ "my-spanner-instance": spanner.Config{ Name: "my-spanner-instance", - Kind: spanner.SourceKind, + Type: spanner.SourceType, Project: "my-project", Instance: "my-instance", Dialect: "googlesql", @@ -88,7 +88,7 @@ func TestParseFromYamlSpannerDb(t *testing.T) { want: map[string]sources.SourceConfig{ "my-spanner-instance": spanner.Config{ Name: "my-spanner-instance", - Kind: spanner.SourceKind, + Type: spanner.SourceType, Project: "my-project", Instance: "my-instance", Dialect: "postgresql", diff --git a/internal/sources/sqlite/sqlite.go b/internal/sources/sqlite/sqlite.go index f2afc57f9c..a0982c6741 100644 --- a/internal/sources/sqlite/sqlite.go +++ b/internal/sources/sqlite/sqlite.go @@ -27,14 +27,14 @@ import ( _ "modernc.org/sqlite" // Pure Go SQLite driver ) -const SourceKind string = "sqlite" +const SourceType string = "sqlite" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -48,12 +48,12 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Database string `yaml:"database" validate:"required"` // Path to SQLite database file } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -81,8 +81,8 @@ type Source struct { Db *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -155,7 +155,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initSQLiteConnection(ctx context.Context, tracer trace.Tracer, name, dbPath string) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Open database connection diff --git a/internal/sources/sqlite/sqlite_test.go b/internal/sources/sqlite/sqlite_test.go index 0367679063..61772fa708 100644 --- a/internal/sources/sqlite/sqlite_test.go +++ b/internal/sources/sqlite/sqlite_test.go @@ -42,7 +42,7 @@ func TestParseFromYamlSQLite(t *testing.T) { want: map[string]sources.SourceConfig{ "my-sqlite-db": sqlite.Config{ Name: "my-sqlite-db", - Kind: sqlite.SourceKind, + Type: sqlite.SourceType, Database: "/path/to/database.db", }, }, diff --git a/internal/sources/tidb/tidb.go b/internal/sources/tidb/tidb.go index 617da6969d..dc69690d31 100644 --- a/internal/sources/tidb/tidb.go +++ b/internal/sources/tidb/tidb.go @@ -27,15 +27,15 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "tidb" +const SourceType string = "tidb" const TiDBCloudHostPattern string = `gateway\d{2}\.(.+)\.(prod|dev|staging)\.(.+)\.tidbcloud\.com` // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -55,7 +55,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user" validate:"required"` @@ -64,8 +64,8 @@ type Config struct { UseSSL bool `yaml:"ssl"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -93,8 +93,8 @@ type Source struct { Pool *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -189,7 +189,7 @@ func IsTiDBCloudHost(host string) bool { func initTiDBConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname string, useSSL bool) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Configure the driver to connect to the database diff --git a/internal/sources/tidb/tidb_test.go b/internal/sources/tidb/tidb_test.go index f9b8b8ffd1..3a3ccd26f9 100644 --- a/internal/sources/tidb/tidb_test.go +++ b/internal/sources/tidb/tidb_test.go @@ -45,7 +45,7 @@ func TestParseFromYamlTiDB(t *testing.T) { want: server.SourceConfigs{ "my-tidb-instance": tidb.Config{ Name: "my-tidb-instance", - Kind: tidb.SourceKind, + Type: tidb.SourceType, Host: "0.0.0.0", Port: "my-port", Database: "my_db", @@ -71,7 +71,7 @@ func TestParseFromYamlTiDB(t *testing.T) { want: server.SourceConfigs{ "my-tidb-cloud": tidb.Config{ Name: "my-tidb-cloud", - Kind: tidb.SourceKind, + Type: tidb.SourceType, Host: "gateway01.us-west-2.prod.aws.tidbcloud.com", Port: "4000", Database: "test_db", @@ -96,7 +96,7 @@ func TestParseFromYamlTiDB(t *testing.T) { want: server.SourceConfigs{ "my-tidb-cloud": tidb.Config{ Name: "my-tidb-cloud", - Kind: tidb.SourceKind, + Type: tidb.SourceType, Host: "gateway01.us-west-2.prod.aws.tidbcloud.com", Port: "4000", Database: "test_db", diff --git a/internal/sources/trino/trino.go b/internal/sources/trino/trino.go index ed99dc3c19..b06572e485 100644 --- a/internal/sources/trino/trino.go +++ b/internal/sources/trino/trino.go @@ -30,14 +30,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "trino" +const SourceType string = "trino" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -51,7 +51,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user"` @@ -67,8 +67,8 @@ type Config struct { DisableSslVerification bool `yaml:"disableSslVerification"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -96,8 +96,8 @@ type Source struct { Pool *sql.DB } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -160,7 +160,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initTrinoConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, password, catalog, schema, queryTimeout, accessToken string, kerberosEnabled, sslEnabled bool, sslCertPath, sslCert string, disableSslVerification bool) (*sql.DB, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // Build Trino DSN diff --git a/internal/sources/trino/trino_test.go b/internal/sources/trino/trino_test.go index f59679c86b..31f5709c1d 100644 --- a/internal/sources/trino/trino_test.go +++ b/internal/sources/trino/trino_test.go @@ -165,7 +165,7 @@ func TestParseFromYamlTrino(t *testing.T) { want: server.SourceConfigs{ "my-trino-instance": Config{ Name: "my-trino-instance", - Kind: SourceKind, + Type: SourceType, Host: "localhost", Port: "8080", User: "testuser", @@ -194,7 +194,7 @@ func TestParseFromYamlTrino(t *testing.T) { want: server.SourceConfigs{ "my-trino-instance": Config{ Name: "my-trino-instance", - Kind: SourceKind, + Type: SourceType, Host: "localhost", Port: "8443", User: "testuser", @@ -222,7 +222,7 @@ func TestParseFromYamlTrino(t *testing.T) { want: server.SourceConfigs{ "my-trino-anonymous": Config{ Name: "my-trino-anonymous", - Kind: SourceKind, + Type: SourceType, Host: "localhost", Port: "8080", Catalog: "hive", @@ -252,7 +252,7 @@ func TestParseFromYamlTrino(t *testing.T) { want: server.SourceConfigs{ "my-trino-ssl-cert": Config{ Name: "my-trino-ssl-cert", - Kind: SourceKind, + Type: SourceType, Host: "localhost", Port: "8443", User: "testuser", diff --git a/internal/sources/valkey/valkey.go b/internal/sources/valkey/valkey.go index 58ed2356d3..8bcc58981c 100644 --- a/internal/sources/valkey/valkey.go +++ b/internal/sources/valkey/valkey.go @@ -24,14 +24,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "valkey" +const SourceType string = "valkey" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -45,7 +45,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Address []string `yaml:"address" validate:"required"` Username string `yaml:"username"` Password string `yaml:"password"` @@ -54,8 +54,8 @@ type Config struct { DisableCache bool `yaml:"disableCache"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -114,8 +114,8 @@ type Source struct { Client valkey.Client } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { diff --git a/internal/sources/valkey/valkey_test.go b/internal/sources/valkey/valkey_test.go index 58a0cc0017..544e13fb4b 100644 --- a/internal/sources/valkey/valkey_test.go +++ b/internal/sources/valkey/valkey_test.go @@ -44,7 +44,7 @@ func TestParseFromYamlValkey(t *testing.T) { want: map[string]sources.SourceConfig{ "my-valkey-instance": valkey.Config{ Name: "my-valkey-instance", - Kind: valkey.SourceKind, + Type: valkey.SourceType, Address: []string{"127.0.0.1"}, Username: "", Password: "", @@ -71,7 +71,7 @@ func TestParseFromYamlValkey(t *testing.T) { want: map[string]sources.SourceConfig{ "my-valkey-instance": valkey.Config{ Name: "my-valkey-instance", - Kind: valkey.SourceKind, + Type: valkey.SourceType, Address: []string{"127.0.0.1"}, Username: "user", Password: "pass", diff --git a/internal/sources/yugabytedb/yugabytedb.go b/internal/sources/yugabytedb/yugabytedb.go index 830e3ae7fe..f2e9586fda 100644 --- a/internal/sources/yugabytedb/yugabytedb.go +++ b/internal/sources/yugabytedb/yugabytedb.go @@ -24,14 +24,14 @@ import ( "go.opentelemetry.io/otel/trace" ) -const SourceKind string = "yugabytedb" +const SourceType string = "yugabytedb" // validate interface var _ sources.SourceConfig = Config{} func init() { - if !sources.Register(SourceKind, newConfig) { - panic(fmt.Sprintf("source kind %q already registered", SourceKind)) + if !sources.Register(SourceType, newConfig) { + panic(fmt.Sprintf("source type %q already registered", SourceType)) } } @@ -45,7 +45,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (sources type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Host string `yaml:"host" validate:"required"` Port string `yaml:"port" validate:"required"` User string `yaml:"user" validate:"required"` @@ -58,8 +58,8 @@ type Config struct { FailedHostReconnectDelaySeconds string `yaml:"failedHostReconnectDelaySecs"` } -func (r Config) SourceConfigKind() string { - return SourceKind +func (r Config) SourceConfigType() string { + return SourceType } func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) { @@ -87,8 +87,8 @@ type Source struct { Pool *pgxpool.Pool } -func (s *Source) SourceKind() string { - return SourceKind +func (s *Source) SourceType() string { + return SourceType } func (s *Source) ToConfig() sources.SourceConfig { @@ -130,7 +130,7 @@ func (s *Source) RunSQL(ctx context.Context, statement string, params []any) (an func initYugabyteDBConnectionPool(ctx context.Context, tracer trace.Tracer, name, host, port, user, pass, dbname, loadBalance, topologyKeys, refreshInterval, explicitFallback, failedHostTTL string) (*pgxpool.Pool, error) { //nolint:all // Reassigned ctx - ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceKind, name) + ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name) defer span.End() // urlExample := "postgres://username:password@localhost:5433/database_name" i := fmt.Sprintf("postgres://%s:%s@%s:%s/%s", user, pass, host, port, dbname) diff --git a/internal/sources/yugabytedb/yugabytedb_test.go b/internal/sources/yugabytedb/yugabytedb_test.go index 32eda8b642..62c0e8df9c 100644 --- a/internal/sources/yugabytedb/yugabytedb_test.go +++ b/internal/sources/yugabytedb/yugabytedb_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlYugabyteDB(t *testing.T) { want: server.SourceConfigs{ "my-yb-instance": yugabytedb.Config{ Name: "my-yb-instance", - Kind: "yugabytedb", + Type: "yugabytedb", Host: "yb-host", Port: "yb-port", User: "yb_user", @@ -75,7 +75,7 @@ func TestParseFromYamlYugabyteDB(t *testing.T) { want: server.SourceConfigs{ "my-yb-instance": yugabytedb.Config{ Name: "my-yb-instance", - Kind: "yugabytedb", + Type: "yugabytedb", Host: "yb-host", Port: "yb-port", User: "yb_user", @@ -103,7 +103,7 @@ func TestParseFromYamlYugabyteDB(t *testing.T) { want: server.SourceConfigs{ "my-yb-instance": yugabytedb.Config{ Name: "my-yb-instance", - Kind: "yugabytedb", + Type: "yugabytedb", Host: "yb-host", Port: "yb-port", User: "yb_user", @@ -133,7 +133,7 @@ func TestParseFromYamlYugabyteDB(t *testing.T) { want: server.SourceConfigs{ "my-yb-instance": yugabytedb.Config{ Name: "my-yb-instance", - Kind: "yugabytedb", + Type: "yugabytedb", Host: "yb-host", Port: "yb-port", User: "yb_user", @@ -164,7 +164,7 @@ func TestParseFromYamlYugabyteDB(t *testing.T) { want: server.SourceConfigs{ "my-yb-instance": yugabytedb.Config{ Name: "my-yb-instance", - Kind: "yugabytedb", + Type: "yugabytedb", Host: "yb-host", Port: "yb-port", User: "yb_user", @@ -197,7 +197,7 @@ func TestParseFromYamlYugabyteDB(t *testing.T) { want: server.SourceConfigs{ "my-yb-instance": yugabytedb.Config{ Name: "my-yb-instance", - Kind: "yugabytedb", + Type: "yugabytedb", Host: "yb-host", Port: "yb-port", User: "yb_user", diff --git a/internal/tools/alloydb/alloydbcreatecluster/alloydbcreatecluster.go b/internal/tools/alloydb/alloydbcreatecluster/alloydbcreatecluster.go index 5996fc69a3..52d8696152 100644 --- a/internal/tools/alloydb/alloydbcreatecluster/alloydbcreatecluster.go +++ b/internal/tools/alloydb/alloydbcreatecluster/alloydbcreatecluster.go @@ -29,7 +29,7 @@ const kind string = "alloydb-create-cluster" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Configuration for the create-cluster tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -123,7 +123,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -187,7 +187,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydbcreatecluster/alloydbcreatecluster_test.go b/internal/tools/alloydb/alloydbcreatecluster/alloydbcreatecluster_test.go index b97dc8487e..d682552df9 100644 --- a/internal/tools/alloydb/alloydbcreatecluster/alloydbcreatecluster_test.go +++ b/internal/tools/alloydb/alloydbcreatecluster/alloydbcreatecluster_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-my-cluster": alloydbcreatecluster.Config{ Name: "create-my-cluster", - Kind: "alloydb-create-cluster", + Type: "alloydb-create-cluster", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-my-cluster-auth": alloydbcreatecluster.Config{ Name: "create-my-cluster-auth", - Kind: "alloydb-create-cluster", + Type: "alloydb-create-cluster", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance.go b/internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance.go index 058567fea5..0fd45bbf98 100644 --- a/internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance.go +++ b/internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance.go @@ -29,7 +29,7 @@ const kind string = "alloydb-create-instance" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Configuration for the create-instance tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -124,7 +124,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -193,7 +193,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance_test.go b/internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance_test.go index 499a23c051..ed98529898 100644 --- a/internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance_test.go +++ b/internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-my-instance": alloydbcreateinstance.Config{ Name: "create-my-instance", - Kind: "alloydb-create-instance", + Type: "alloydb-create-instance", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-my-instance-auth": alloydbcreateinstance.Config{ Name: "create-my-instance-auth", - Kind: "alloydb-create-instance", + Type: "alloydb-create-instance", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser.go b/internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser.go index a5cb258554..1187f1b56b 100644 --- a/internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser.go +++ b/internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser.go @@ -29,7 +29,7 @@ const kind string = "alloydb-create-user" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Configuration for the create-user tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -123,7 +123,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -198,7 +198,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser_test.go b/internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser_test.go index 1a35b3093e..9200a98fdd 100644 --- a/internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser_test.go +++ b/internal/tools/alloydb/alloydbcreateuser/alloydbcreateuser_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-my-user": alloydbcreateuser.Config{ Name: "create-my-user", - Kind: "alloydb-create-user", + Type: "alloydb-create-user", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-my-user-auth": alloydbcreateuser.Config{ Name: "create-my-user-auth", - Kind: "alloydb-create-user", + Type: "alloydb-create-user", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/alloydb/alloydbgetcluster/alloydbgetcluster.go b/internal/tools/alloydb/alloydbgetcluster/alloydbgetcluster.go index 392edeff3e..164f538aac 100644 --- a/internal/tools/alloydb/alloydbgetcluster/alloydbgetcluster.go +++ b/internal/tools/alloydb/alloydbgetcluster/alloydbgetcluster.go @@ -29,7 +29,7 @@ const kind string = "alloydb-get-cluster" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Configuration for the get-cluster tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -60,8 +60,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -121,7 +121,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -169,7 +169,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydbgetcluster/alloydbgetcluster_test.go b/internal/tools/alloydb/alloydbgetcluster/alloydbgetcluster_test.go index d30a335cd0..ce8bf99794 100644 --- a/internal/tools/alloydb/alloydbgetcluster/alloydbgetcluster_test.go +++ b/internal/tools/alloydb/alloydbgetcluster/alloydbgetcluster_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "get-my-cluster": alloydbgetcluster.Config{ Name: "get-my-cluster", - Kind: "alloydb-get-cluster", + Type: "alloydb-get-cluster", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "get-my-cluster-auth": alloydbgetcluster.Config{ Name: "get-my-cluster-auth", - Kind: "alloydb-get-cluster", + Type: "alloydb-get-cluster", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/alloydb/alloydbgetinstance/alloydbgetinstance.go b/internal/tools/alloydb/alloydbgetinstance/alloydbgetinstance.go index eeff94721c..6c9994eb90 100644 --- a/internal/tools/alloydb/alloydbgetinstance/alloydbgetinstance.go +++ b/internal/tools/alloydb/alloydbgetinstance/alloydbgetinstance.go @@ -29,7 +29,7 @@ const kind string = "alloydb-get-instance" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Configuration for the get-instance tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -60,8 +60,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -121,7 +121,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -173,7 +173,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydbgetinstance/alloydbgetinstance_test.go b/internal/tools/alloydb/alloydbgetinstance/alloydbgetinstance_test.go index 62e9339222..f37c5c867a 100644 --- a/internal/tools/alloydb/alloydbgetinstance/alloydbgetinstance_test.go +++ b/internal/tools/alloydb/alloydbgetinstance/alloydbgetinstance_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "get-my-instance": alloydbgetinstance.Config{ Name: "get-my-instance", - Kind: "alloydb-get-instance", + Type: "alloydb-get-instance", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "get-my-instance-auth": alloydbgetinstance.Config{ Name: "get-my-instance-auth", - Kind: "alloydb-get-instance", + Type: "alloydb-get-instance", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/alloydb/alloydbgetuser/alloydbgetuser.go b/internal/tools/alloydb/alloydbgetuser/alloydbgetuser.go index 31d2222f62..b90d6b4d5b 100644 --- a/internal/tools/alloydb/alloydbgetuser/alloydbgetuser.go +++ b/internal/tools/alloydb/alloydbgetuser/alloydbgetuser.go @@ -29,7 +29,7 @@ const kind string = "alloydb-get-user" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Configuration for the get-user tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -60,8 +60,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -121,7 +121,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -173,7 +173,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydbgetuser/alloydbgetuser_test.go b/internal/tools/alloydb/alloydbgetuser/alloydbgetuser_test.go index 0d20ea3259..06dc4a4879 100644 --- a/internal/tools/alloydb/alloydbgetuser/alloydbgetuser_test.go +++ b/internal/tools/alloydb/alloydbgetuser/alloydbgetuser_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "get-my-user": alloydbgetuser.Config{ Name: "get-my-user", - Kind: "alloydb-get-user", + Type: "alloydb-get-user", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "get-my-user-auth": alloydbgetuser.Config{ Name: "get-my-user-auth", - Kind: "alloydb-get-user", + Type: "alloydb-get-user", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/alloydb/alloydblistclusters/alloydblistclusters.go b/internal/tools/alloydb/alloydblistclusters/alloydblistclusters.go index 2e06cb062a..6c5307478d 100644 --- a/internal/tools/alloydb/alloydblistclusters/alloydblistclusters.go +++ b/internal/tools/alloydb/alloydblistclusters/alloydblistclusters.go @@ -29,7 +29,7 @@ const kind string = "alloydb-list-clusters" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Configuration for the list-clusters tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -60,8 +60,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -119,7 +119,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -163,7 +163,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydblistclusters/alloydblistclusters_test.go b/internal/tools/alloydb/alloydblistclusters/alloydblistclusters_test.go index b60a11db20..e0a2e9534e 100644 --- a/internal/tools/alloydb/alloydblistclusters/alloydblistclusters_test.go +++ b/internal/tools/alloydb/alloydblistclusters/alloydblistclusters_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "list-my-clusters": alloydblistclusters.Config{ Name: "list-my-clusters", - Kind: "alloydb-list-clusters", + Type: "alloydb-list-clusters", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "list-my-clusters-auth": alloydblistclusters.Config{ Name: "list-my-clusters-auth", - Kind: "alloydb-list-clusters", + Type: "alloydb-list-clusters", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/alloydb/alloydblistinstances/alloydblistinstances.go b/internal/tools/alloydb/alloydblistinstances/alloydblistinstances.go index b7d4e05b35..2cbc500946 100644 --- a/internal/tools/alloydb/alloydblistinstances/alloydblistinstances.go +++ b/internal/tools/alloydb/alloydblistinstances/alloydblistinstances.go @@ -29,7 +29,7 @@ const kind string = "alloydb-list-instances" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Configuration for the list-instances tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -60,8 +60,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -120,7 +120,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -168,7 +168,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydblistinstances/alloydblistinstances_test.go b/internal/tools/alloydb/alloydblistinstances/alloydblistinstances_test.go index aa667d9563..28b55bace5 100644 --- a/internal/tools/alloydb/alloydblistinstances/alloydblistinstances_test.go +++ b/internal/tools/alloydb/alloydblistinstances/alloydblistinstances_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "list-my-instances": alloydblistinstances.Config{ Name: "list-my-instances", - Kind: "alloydb-list-instances", + Type: "alloydb-list-instances", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "list-my-instances-auth": alloydblistinstances.Config{ Name: "list-my-instances-auth", - Kind: "alloydb-list-instances", + Type: "alloydb-list-instances", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/alloydb/alloydblistusers/alloydblistusers.go b/internal/tools/alloydb/alloydblistusers/alloydblistusers.go index 3551a373a9..11641f737e 100644 --- a/internal/tools/alloydb/alloydblistusers/alloydblistusers.go +++ b/internal/tools/alloydb/alloydblistusers/alloydblistusers.go @@ -29,7 +29,7 @@ const kind string = "alloydb-list-users" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Configuration for the list-users tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -60,8 +60,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -120,7 +120,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -168,7 +168,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydblistusers/alloydblistusers_test.go b/internal/tools/alloydb/alloydblistusers/alloydblistusers_test.go index d2d0672684..33a3b0fec2 100644 --- a/internal/tools/alloydb/alloydblistusers/alloydblistusers_test.go +++ b/internal/tools/alloydb/alloydblistusers/alloydblistusers_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "list-my-users": alloydblistusers.Config{ Name: "list-my-users", - Kind: "alloydb-list-users", + Type: "alloydb-list-users", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "list-my-users-auth": alloydblistusers.Config{ Name: "list-my-users-auth", - Kind: "alloydb-list-users", + Type: "alloydb-list-users", Source: "my-alloydb-admin-source", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation.go b/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation.go index b1996fc0ee..371050273b 100644 --- a/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation.go +++ b/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation.go @@ -74,7 +74,7 @@ Please refer to the official documentation for guidance on deploying the toolbox func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -95,7 +95,7 @@ type compatibleSource interface { // Config defines the configuration for the wait-for-operation tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -110,8 +110,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -214,7 +214,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -292,7 +292,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation_test.go b/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation_test.go index 68f92d39d6..90a9f94c4b 100644 --- a/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation_test.go +++ b/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation_test.go @@ -50,7 +50,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "wait-for-thing": alloydbwaitforoperation.Config{ Name: "wait-for-thing", - Kind: "alloydb-wait-for-operation", + Type: "alloydb-wait-for-operation", Source: "some-source", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/alloydbainl/alloydbainl.go b/internal/tools/alloydbainl/alloydbainl.go index 117abd2ad5..3fa2824ae4 100644 --- a/internal/tools/alloydbainl/alloydbainl.go +++ b/internal/tools/alloydbainl/alloydbainl.go @@ -31,7 +31,7 @@ const kind string = "alloydb-ai-nl" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` NLConfig string `yaml:"nlConfig" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -128,7 +128,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/alloydbainl/alloydbainl_test.go b/internal/tools/alloydbainl/alloydbainl_test.go index 2e618e66cc..076d627d3c 100644 --- a/internal/tools/alloydbainl/alloydbainl_test.go +++ b/internal/tools/alloydbainl/alloydbainl_test.go @@ -57,7 +57,7 @@ func TestParseFromYamlAlloyDBNLA(t *testing.T) { want: server.ToolConfigs{ "example_tool": alloydbainl.Config{ Name: "example_tool", - Kind: "alloydb-ai-nl", + Type: "alloydb-ai-nl", Source: "my-alloydb-instance", Description: "AlloyDB natural language query tool", NLConfig: "my_nl_config", @@ -98,7 +98,7 @@ func TestParseFromYamlAlloyDBNLA(t *testing.T) { want: server.ToolConfigs{ "complex_tool": alloydbainl.Config{ Name: "complex_tool", - Kind: "alloydb-ai-nl", + Type: "alloydb-ai-nl", Source: "my-alloydb-instance", Description: "AlloyDB natural language query tool with multiple parameters", NLConfig: "complex_nl_config", diff --git a/internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution.go b/internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution.go index 7f50803b0a..bbe97f451b 100644 --- a/internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution.go +++ b/internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution.go @@ -35,7 +35,7 @@ const kind string = "bigquery-analyze-contribution" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -59,7 +59,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -68,7 +68,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -155,7 +155,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke runs the contribution analysis. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -329,7 +329,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution_test.go b/internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution_test.go index 7409acd14e..1aaa16e524 100644 --- a/internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution_test.go +++ b/internal/tools/bigquery/bigqueryanalyzecontribution/bigqueryanalyzecontribution_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQueryAnalyzeContribution(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigqueryanalyzecontribution.Config{ Name: "example_tool", - Kind: "bigquery-analyze-contribution", + Type: "bigquery-analyze-contribution", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics.go b/internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics.go index ff9fc8e889..103d066699 100644 --- a/internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics.go +++ b/internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics.go @@ -42,7 +42,7 @@ const instructions = `**INSTRUCTIONS - FOLLOW THESE RULES:** func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -107,7 +107,7 @@ type CAPayload struct { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -116,7 +116,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -173,7 +173,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -285,7 +285,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics_test.go b/internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics_test.go index aadbbbe4b4..746eda1cca 100644 --- a/internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics_test.go +++ b/internal/tools/bigquery/bigqueryconversationalanalytics/bigqueryconversationalanalytics_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQueryConversationalAnalytics(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigqueryconversationalanalytics.Config{ Name: "example_tool", - Kind: "bigquery-conversational-analytics", + Type: "bigquery-conversational-analytics", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql.go b/internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql.go index 6f2fc245c9..7d790ed339 100644 --- a/internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql.go +++ b/internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql.go @@ -36,7 +36,7 @@ const kind string = "bigquery-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -61,7 +61,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -70,7 +70,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -153,7 +153,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -302,7 +302,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql_test.go b/internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql_test.go index 0b5d11879c..2604264635 100644 --- a/internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql_test.go +++ b/internal/tools/bigquery/bigqueryexecutesql/bigqueryexecutesql_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQueryExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigqueryexecutesql.Config{ Name: "example_tool", - Kind: "bigquery-execute-sql", + Type: "bigquery-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/bigquery/bigqueryforecast/bigqueryforecast.go b/internal/tools/bigquery/bigqueryforecast/bigqueryforecast.go index b3d56fb465..ffede41e5f 100644 --- a/internal/tools/bigquery/bigqueryforecast/bigqueryforecast.go +++ b/internal/tools/bigquery/bigqueryforecast/bigqueryforecast.go @@ -35,7 +35,7 @@ const kind string = "bigquery-forecast" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -59,7 +59,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -68,7 +68,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -134,7 +134,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -292,7 +292,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/bigquery/bigqueryforecast/bigqueryforecast_test.go b/internal/tools/bigquery/bigqueryforecast/bigqueryforecast_test.go index 48de140b18..6f6b7fcff5 100644 --- a/internal/tools/bigquery/bigqueryforecast/bigqueryforecast_test.go +++ b/internal/tools/bigquery/bigqueryforecast/bigqueryforecast_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQueryForecast(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigqueryforecast.Config{ Name: "example_tool", - Kind: "bigquery-forecast", + Type: "bigquery-forecast", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/bigquery/bigquerygetdatasetinfo/bigquerygetdatasetinfo.go b/internal/tools/bigquery/bigquerygetdatasetinfo/bigquerygetdatasetinfo.go index 021f8f1dfb..c633c2365e 100644 --- a/internal/tools/bigquery/bigquerygetdatasetinfo/bigquerygetdatasetinfo.go +++ b/internal/tools/bigquery/bigquerygetdatasetinfo/bigquerygetdatasetinfo.go @@ -34,7 +34,7 @@ const datasetKey string = "dataset" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -56,7 +56,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -122,7 +122,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -178,7 +178,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/bigquery/bigquerygetdatasetinfo/bigquerygetdatasetinfo_test.go b/internal/tools/bigquery/bigquerygetdatasetinfo/bigquerygetdatasetinfo_test.go index bb4fa8890f..53fac7a5f0 100644 --- a/internal/tools/bigquery/bigquerygetdatasetinfo/bigquerygetdatasetinfo_test.go +++ b/internal/tools/bigquery/bigquerygetdatasetinfo/bigquerygetdatasetinfo_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQueryGetDatasetInfo(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigquerygetdatasetinfo.Config{ Name: "example_tool", - Kind: "bigquery-get-dataset-info", + Type: "bigquery-get-dataset-info", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/bigquery/bigquerygettableinfo/bigquerygettableinfo.go b/internal/tools/bigquery/bigquerygettableinfo/bigquerygettableinfo.go index b02b36689e..72fc770668 100644 --- a/internal/tools/bigquery/bigquerygettableinfo/bigquerygettableinfo.go +++ b/internal/tools/bigquery/bigquerygettableinfo/bigquerygettableinfo.go @@ -35,7 +35,7 @@ const tableKey string = "table" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -57,7 +57,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -66,7 +66,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -126,7 +126,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -188,7 +188,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/bigquery/bigquerygettableinfo/bigquerygettableinfo_test.go b/internal/tools/bigquery/bigquerygettableinfo/bigquerygettableinfo_test.go index 992dc4d843..7b7e4f9f0d 100644 --- a/internal/tools/bigquery/bigquerygettableinfo/bigquerygettableinfo_test.go +++ b/internal/tools/bigquery/bigquerygettableinfo/bigquerygettableinfo_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQueryGetTableInfo(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigquerygettableinfo.Config{ Name: "example_tool", - Kind: "bigquery-get-table-info", + Type: "bigquery-get-table-info", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/bigquery/bigquerylistdatasetids/bigquerylistdatasetids.go b/internal/tools/bigquery/bigquerylistdatasetids/bigquerylistdatasetids.go index e56fd8cf53..c4fba00f7d 100644 --- a/internal/tools/bigquery/bigquerylistdatasetids/bigquerylistdatasetids.go +++ b/internal/tools/bigquery/bigquerylistdatasetids/bigquerylistdatasetids.go @@ -33,7 +33,7 @@ const projectKey string = "project" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -121,7 +121,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -184,7 +184,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/bigquery/bigquerylistdatasetids/bigquerylistdatasetids_test.go b/internal/tools/bigquery/bigquerylistdatasetids/bigquerylistdatasetids_test.go index 546410431b..6d7ba9c0bc 100644 --- a/internal/tools/bigquery/bigquerylistdatasetids/bigquerylistdatasetids_test.go +++ b/internal/tools/bigquery/bigquerylistdatasetids/bigquerylistdatasetids_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQueryListDatasetIds(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigquerylistdatasetids.Config{ Name: "example_tool", - Kind: "bigquery-list-dataset-ids", + Type: "bigquery-list-dataset-ids", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/bigquery/bigquerylisttableids/bigquerylisttableids.go b/internal/tools/bigquery/bigquerylisttableids/bigquerylisttableids.go index d5489e28dd..634ea6b64c 100644 --- a/internal/tools/bigquery/bigquerylisttableids/bigquerylisttableids.go +++ b/internal/tools/bigquery/bigquerylisttableids/bigquerylisttableids.go @@ -35,7 +35,7 @@ const datasetKey string = "dataset" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -57,7 +57,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -66,7 +66,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -125,7 +125,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -195,7 +195,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/bigquery/bigquerylisttableids/bigquerylisttableids_test.go b/internal/tools/bigquery/bigquerylisttableids/bigquerylisttableids_test.go index 8e5076ce0f..64461cc718 100644 --- a/internal/tools/bigquery/bigquerylisttableids/bigquerylisttableids_test.go +++ b/internal/tools/bigquery/bigquerylisttableids/bigquerylisttableids_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQueryListTableIds(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigquerylisttableids.Config{ Name: "example_tool", - Kind: "bigquery-list-table-ids", + Type: "bigquery-list-table-ids", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/bigquery/bigquerysearchcatalog/bigquerysearchcatalog.go b/internal/tools/bigquery/bigquerysearchcatalog/bigquerysearchcatalog.go index 2b2e557f88..54e6042ec9 100644 --- a/internal/tools/bigquery/bigquerysearchcatalog/bigquerysearchcatalog.go +++ b/internal/tools/bigquery/bigquerysearchcatalog/bigquerysearchcatalog.go @@ -34,7 +34,7 @@ const kind string = "bigquery-search-catalog" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -110,7 +110,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -187,7 +187,7 @@ func ExtractType(resourceString string) string { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/bigquery/bigquerysearchcatalog/bigquerysearchcatalog_test.go b/internal/tools/bigquery/bigquerysearchcatalog/bigquerysearchcatalog_test.go index 2885aecafb..893cedf02b 100644 --- a/internal/tools/bigquery/bigquerysearchcatalog/bigquerysearchcatalog_test.go +++ b/internal/tools/bigquery/bigquerysearchcatalog/bigquerysearchcatalog_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlBigQuerySearch(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigquerysearchcatalog.Config{ Name: "example_tool", - Kind: "bigquery-search-catalog", + Type: "bigquery-search-catalog", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/bigquery/bigquerysql/bigquerysql.go b/internal/tools/bigquery/bigquerysql/bigquerysql.go index b7cece9186..716bdaa4b0 100644 --- a/internal/tools/bigquery/bigquerysql/bigquerysql.go +++ b/internal/tools/bigquery/bigquerysql/bigquerysql.go @@ -35,7 +35,7 @@ const kind string = "bigquery-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -56,7 +56,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -68,7 +68,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -105,7 +105,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -234,7 +234,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/bigquery/bigquerysql/bigquerysql_test.go b/internal/tools/bigquery/bigquerysql/bigquerysql_test.go index 967fd418cd..8a04682225 100644 --- a/internal/tools/bigquery/bigquerysql/bigquerysql_test.go +++ b/internal/tools/bigquery/bigquerysql/bigquerysql_test.go @@ -53,7 +53,7 @@ func TestParseFromYamlBigQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigquerysql.Config{ Name: "example_tool", - Kind: "bigquery-sql", + Type: "bigquery-sql", Source: "my-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -122,7 +122,7 @@ func TestParseFromYamlWithTemplateBigQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigquerysql.Config{ Name: "example_tool", - Kind: "bigquery-sql", + Type: "bigquery-sql", Source: "my-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/bigtable/bigtable.go b/internal/tools/bigtable/bigtable.go index fbd6e57932..fb8acec653 100644 --- a/internal/tools/bigtable/bigtable.go +++ b/internal/tools/bigtable/bigtable.go @@ -30,7 +30,7 @@ const kind string = "bigtable-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -98,7 +98,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/bigtable/bigtable_test.go b/internal/tools/bigtable/bigtable_test.go index 6d12b341e2..756174fa3b 100644 --- a/internal/tools/bigtable/bigtable_test.go +++ b/internal/tools/bigtable/bigtable_test.go @@ -53,7 +53,7 @@ func TestParseFromYamlBigtable(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigtable.Config{ Name: "example_tool", - Kind: "bigtable-sql", + Type: "bigtable-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -122,7 +122,7 @@ func TestParseFromYamlWithTemplateBigtable(t *testing.T) { want: server.ToolConfigs{ "example_tool": bigtable.Config{ Name: "example_tool", - Kind: "bigtable-sql", + Type: "bigtable-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/cassandra/cassandracql/cassandracql.go b/internal/tools/cassandra/cassandracql/cassandracql.go index 60ae4dff6d..3618aa8a19 100644 --- a/internal/tools/cassandra/cassandracql/cassandracql.go +++ b/internal/tools/cassandra/cassandracql/cassandracql.go @@ -30,7 +30,7 @@ const kind string = "cassandra-cql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -60,8 +60,8 @@ type Config struct { var _ tools.ToolConfig = Config{} -// ToolConfigKind implements tools.ToolConfig. -func (c Config) ToolConfigKind() string { +// ToolConfigType implements tools.ToolConfig. +func (c Config) ToolConfigType() string { return kind } @@ -108,7 +108,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { // Invoke implements tools.Tool. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/cassandra/cassandracql/cassandracql_test.go b/internal/tools/cassandra/cassandracql/cassandracql_test.go index 3ed76b33f2..4b7a69c686 100644 --- a/internal/tools/cassandra/cassandracql/cassandracql_test.go +++ b/internal/tools/cassandra/cassandracql/cassandracql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlCassandra(t *testing.T) { want: server.ToolConfigs{ "example_tool": cassandracql.Config{ Name: "example_tool", - Kind: "cassandra-cql", + Type: "cassandra-cql", Source: "my-cassandra-instance", Description: "some description", Statement: "SELECT * FROM CQL_STATEMENT;\n", @@ -111,7 +111,7 @@ func TestParseFromYamlCassandra(t *testing.T) { want: server.ToolConfigs{ "example_tool": cassandracql.Config{ Name: "example_tool", - Kind: "cassandra-cql", + Type: "cassandra-cql", Source: "my-cassandra-instance", Description: "some description", Statement: "SELECT * FROM CQL_STATEMENT;\n", @@ -142,7 +142,7 @@ func TestParseFromYamlCassandra(t *testing.T) { want: server.ToolConfigs{ "example_tool": cassandracql.Config{ Name: "example_tool", - Kind: "cassandra-cql", + Type: "cassandra-cql", Source: "my-cassandra-instance", Description: "some description", Statement: "SELECT * FROM CQL_STATEMENT;\n", diff --git a/internal/tools/clickhouse/clickhouseexecutesql/clickhouseexecutesql.go b/internal/tools/clickhouse/clickhouseexecutesql/clickhouseexecutesql.go index 191b8b3dfd..4f95db2253 100644 --- a/internal/tools/clickhouse/clickhouseexecutesql/clickhouseexecutesql.go +++ b/internal/tools/clickhouse/clickhouseexecutesql/clickhouseexecutesql.go @@ -25,11 +25,11 @@ import ( "github.com/googleapis/genai-toolbox/internal/util/parameters" ) -const executeSQLKind string = "clickhouse-execute-sql" +const executeSQLType string = "clickhouse-execute-sql" func init() { - if !tools.Register(executeSQLKind, newExecuteSQLConfig) { - panic(fmt.Sprintf("tool kind %q already registered", executeSQLKind)) + if !tools.Register(executeSQLType, newExecuteSQLConfig) { + panic(fmt.Sprintf("tool type %q already registered", executeSQLType)) } } @@ -47,7 +47,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -55,8 +55,8 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { - return executeSQLKind +func (cfg Config) ToolConfigType() string { + return executeSQLType } func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error) { @@ -88,7 +88,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, token tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/clickhouse/clickhouseexecutesql/clickhouseexecutesql_test.go b/internal/tools/clickhouse/clickhouseexecutesql/clickhouseexecutesql_test.go index 9bc0e8716d..f623db3c04 100644 --- a/internal/tools/clickhouse/clickhouseexecutesql/clickhouseexecutesql_test.go +++ b/internal/tools/clickhouse/clickhouseexecutesql/clickhouseexecutesql_test.go @@ -45,7 +45,7 @@ func TestParseFromYamlClickHouseExecuteSQL(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "clickhouse-execute-sql", + Type: "clickhouse-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/clickhouse/clickhouselistdatabases/clickhouselistdatabases.go b/internal/tools/clickhouse/clickhouselistdatabases/clickhouselistdatabases.go index 7d697502ab..a4e0f75f72 100644 --- a/internal/tools/clickhouse/clickhouselistdatabases/clickhouselistdatabases.go +++ b/internal/tools/clickhouse/clickhouselistdatabases/clickhouselistdatabases.go @@ -25,11 +25,11 @@ import ( "github.com/googleapis/genai-toolbox/internal/util/parameters" ) -const listDatabasesKind string = "clickhouse-list-databases" +const listDatabasesType string = "clickhouse-list-databases" func init() { - if !tools.Register(listDatabasesKind, newListDatabasesConfig) { - panic(fmt.Sprintf("tool kind %q already registered", listDatabasesKind)) + if !tools.Register(listDatabasesType, newListDatabasesConfig) { + panic(fmt.Sprintf("tool type %q already registered", listDatabasesType)) } } @@ -47,7 +47,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -56,8 +56,8 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { - return listDatabasesKind +func (cfg Config) ToolConfigType() string { + return listDatabasesType } func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error) { @@ -87,7 +87,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, token tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/clickhouse/clickhouselistdatabases/clickhouselistdatabases_test.go b/internal/tools/clickhouse/clickhouselistdatabases/clickhouselistdatabases_test.go index ca6d9b21b7..c821d221b3 100644 --- a/internal/tools/clickhouse/clickhouselistdatabases/clickhouselistdatabases_test.go +++ b/internal/tools/clickhouse/clickhouselistdatabases/clickhouselistdatabases_test.go @@ -24,10 +24,10 @@ import ( "github.com/googleapis/genai-toolbox/internal/util/parameters" ) -func TestListDatabasesConfigToolConfigKind(t *testing.T) { +func TestListDatabasesConfigToolConfigType(t *testing.T) { cfg := Config{} - if cfg.ToolConfigKind() != listDatabasesKind { - t.Errorf("expected %q, got %q", listDatabasesKind, cfg.ToolConfigKind()) + if cfg.ToolConfigType() != listDatabasesType { + t.Errorf("expected %q, got %q", listDatabasesType, cfg.ToolConfigType()) } } @@ -53,7 +53,7 @@ func TestParseFromYamlClickHouseListDatabases(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "clickhouse-list-databases", + Type: "clickhouse-list-databases", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/clickhouse/clickhouselisttables/clickhouselisttables.go b/internal/tools/clickhouse/clickhouselisttables/clickhouselisttables.go index 7f5464c049..821305abe7 100644 --- a/internal/tools/clickhouse/clickhouselisttables/clickhouselisttables.go +++ b/internal/tools/clickhouse/clickhouselisttables/clickhouselisttables.go @@ -25,12 +25,12 @@ import ( "github.com/googleapis/genai-toolbox/internal/util/parameters" ) -const listTablesKind string = "clickhouse-list-tables" +const listTablesType string = "clickhouse-list-tables" const databaseKey string = "database" func init() { - if !tools.Register(listTablesKind, newListTablesConfig) { - panic(fmt.Sprintf("tool kind %q already registered", listTablesKind)) + if !tools.Register(listTablesType, newListTablesConfig) { + panic(fmt.Sprintf("tool type %q already registered", listTablesType)) } } @@ -48,7 +48,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -57,8 +57,8 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { - return listTablesKind +func (cfg Config) ToolConfigType() string { + return listTablesType } func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error) { @@ -91,7 +91,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, token tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/clickhouse/clickhouselisttables/clickhouselisttables_test.go b/internal/tools/clickhouse/clickhouselisttables/clickhouselisttables_test.go index 4500dac099..9d841fb25a 100644 --- a/internal/tools/clickhouse/clickhouselisttables/clickhouselisttables_test.go +++ b/internal/tools/clickhouse/clickhouselisttables/clickhouselisttables_test.go @@ -24,10 +24,10 @@ import ( "github.com/googleapis/genai-toolbox/internal/util/parameters" ) -func TestListTablesConfigToolConfigKind(t *testing.T) { +func TestListTablesConfigToolConfigType(t *testing.T) { cfg := Config{} - if cfg.ToolConfigKind() != listTablesKind { - t.Errorf("expected %q, got %q", listTablesKind, cfg.ToolConfigKind()) + if cfg.ToolConfigType() != listTablesType { + t.Errorf("expected %q, got %q", listTablesType, cfg.ToolConfigType()) } } @@ -53,7 +53,7 @@ func TestParseFromYamlClickHouseListTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "clickhouse-list-tables", + Type: "clickhouse-list-tables", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/clickhouse/clickhousesql/clickhousesql.go b/internal/tools/clickhouse/clickhousesql/clickhousesql.go index 5a83143e67..732f6ac0fe 100644 --- a/internal/tools/clickhouse/clickhousesql/clickhousesql.go +++ b/internal/tools/clickhouse/clickhousesql/clickhousesql.go @@ -25,11 +25,11 @@ import ( "github.com/googleapis/genai-toolbox/internal/util/parameters" ) -const sqlKind string = "clickhouse-sql" +const sqlType string = "clickhouse-sql" func init() { - if !tools.Register(sqlKind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", sqlKind)) + if !tools.Register(sqlType, newConfig) { + panic(fmt.Sprintf("tool type %q already registered", sqlType)) } } @@ -47,7 +47,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -58,8 +58,8 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { - return sqlKind +func (cfg Config) ToolConfigType() string { + return sqlType } func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error) { @@ -89,7 +89,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, token tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/clickhouse/clickhousesql/clickhousesql_test.go b/internal/tools/clickhouse/clickhousesql/clickhousesql_test.go index 3c50305e28..3dbe0a3d06 100644 --- a/internal/tools/clickhouse/clickhousesql/clickhousesql_test.go +++ b/internal/tools/clickhouse/clickhousesql/clickhousesql_test.go @@ -27,10 +27,10 @@ import ( "github.com/googleapis/genai-toolbox/internal/util/parameters" ) -func TestConfigToolConfigKind(t *testing.T) { +func TestConfigToolConfigType(t *testing.T) { config := Config{} - if config.ToolConfigKind() != sqlKind { - t.Errorf("Expected %s, got %s", sqlKind, config.ToolConfigKind()) + if config.ToolConfigType() != sqlType { + t.Errorf("Expected %s, got %s", sqlType, config.ToolConfigType()) } } @@ -57,7 +57,7 @@ func TestParseFromYamlClickHouseSQL(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "clickhouse-sql", + Type: "clickhouse-sql", Source: "my-instance", Description: "some description", Statement: "SELECT 1", @@ -82,7 +82,7 @@ func TestParseFromYamlClickHouseSQL(t *testing.T) { want: server.ToolConfigs{ "param_tool": Config{ Name: "param_tool", - Kind: "clickhouse-sql", + Type: "clickhouse-sql", Source: "test-source", Description: "Test ClickHouse tool", Statement: "SELECT * FROM test_table WHERE id = $1", @@ -113,7 +113,7 @@ func TestParseFromYamlClickHouseSQL(t *testing.T) { func TestSQLConfigInitializeValidSource(t *testing.T) { config := Config{ Name: "test-tool", - Kind: sqlKind, + Type: sqlType, Source: "test-clickhouse", Description: "Test tool", Statement: "SELECT 1", diff --git a/internal/tools/cloudgda/cloudgda.go b/internal/tools/cloudgda/cloudgda.go index 6ea132318e..df6bde00a6 100644 --- a/internal/tools/cloudgda/cloudgda.go +++ b/internal/tools/cloudgda/cloudgda.go @@ -45,7 +45,7 @@ Usage guidance: func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -65,7 +65,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Location string `yaml:"location" validate:"required"` @@ -77,7 +77,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -121,7 +121,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool logic func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -180,7 +180,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudgda/cloudgda_test.go b/internal/tools/cloudgda/cloudgda_test.go index 2e92c56213..1df8382c75 100644 --- a/internal/tools/cloudgda/cloudgda_test.go +++ b/internal/tools/cloudgda/cloudgda_test.go @@ -68,7 +68,7 @@ func TestParseFromYaml(t *testing.T) { want: map[string]tools.ToolConfig{ "my-gda-query-tool": cloudgdatool.Config{ Name: "my-gda-query-tool", - Kind: "cloud-gemini-data-analytics-query", + Type: "cloud-gemini-data-analytics-query", Source: "gda-api-source", Description: "Test Description", Location: "us-central1", @@ -141,7 +141,7 @@ type mockSource struct { config cloudgdasrc.Config // to return from ToConfig } -func (m *mockSource) SourceKind() string { return m.kind } +func (m *mockSource) SourceType() string { return m.kind } func (m *mockSource) ToConfig() sources.SourceConfig { return m.config } func (m *mockSource) GetClient(ctx context.Context, token string) (*http.Client, error) { if m.client != nil { @@ -166,7 +166,7 @@ func TestInitialize(t *testing.T) { srcs := map[string]sources.Source{ "gda-api-source": &cloudgdasrc.Source{ - Config: cloudgdasrc.Config{Name: "gda-api-source", Kind: cloudgdasrc.SourceKind, ProjectID: "test-project"}, + Config: cloudgdasrc.Config{Name: "gda-api-source", Type: cloudgdasrc.SourceType, ProjectID: "test-project"}, Client: &http.Client{}, BaseURL: cloudgdasrc.Endpoint, }, @@ -180,7 +180,7 @@ func TestInitialize(t *testing.T) { desc: "successful initialization", cfg: cloudgdatool.Config{ Name: "my-gda-query-tool", - Kind: "cloud-gemini-data-analytics-query", + Type: "cloud-gemini-data-analytics-query", Source: "gda-api-source", Description: "Test Description", Location: "us-central1", @@ -287,7 +287,7 @@ func TestInvoke(t *testing.T) { // Create a real cloudgdasrc.Source but inject the authenticated client mockGdaSource := &cloudgdasrc.Source{ - Config: cloudgdasrc.Config{Name: "mock-gda-source", Kind: cloudgdasrc.SourceKind, ProjectID: "test-project"}, + Config: cloudgdasrc.Config{Name: "mock-gda-source", Type: cloudgdasrc.SourceType, ProjectID: "test-project"}, Client: authClient, BaseURL: mockServer.URL, } @@ -298,7 +298,7 @@ func TestInvoke(t *testing.T) { // Initialize the tool config with context toolCfg := cloudgdatool.Config{ Name: "query-data-tool", - Kind: "cloud-gemini-data-analytics-query", + Type: "cloud-gemini-data-analytics-query", Source: "mock-gda-source", Description: "Query Gemini Data Analytics", Location: "us-central1", // Set location for the test diff --git a/internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage.go b/internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage.go index bd77a069f0..de3e3cc29f 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage.go @@ -32,7 +32,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -134,7 +134,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage_test.go b/internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage_test.go index de85dd8674..c655f8c81d 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareFHIRFetchPage(t *testing.T) { want: server.ToolConfigs{ "example_tool": fhirfetchpage.Config{ Name: "example_tool", - Kind: "cloud-healthcare-fhir-fetch-page", + Type: "cloud-healthcare-fhir-fetch-page", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcarefhirpatienteverything/cloudhealthcarefhirpatienteverything.go b/internal/tools/cloudhealthcare/cloudhealthcarefhirpatienteverything/cloudhealthcarefhirpatienteverything.go index 1e7f648d6b..f313393d76 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarefhirpatienteverything/cloudhealthcarefhirpatienteverything.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarefhirpatienteverything/cloudhealthcarefhirpatienteverything.go @@ -37,7 +37,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -57,7 +57,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -66,7 +66,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -117,7 +117,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -186,7 +186,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcarefhirpatienteverything/cloudhealthcarefhirpatienteverything_test.go b/internal/tools/cloudhealthcare/cloudhealthcarefhirpatienteverything/cloudhealthcarefhirpatienteverything_test.go index 703fd0c2d3..e749c4369a 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarefhirpatienteverything/cloudhealthcarefhirpatienteverything_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarefhirpatienteverything/cloudhealthcarefhirpatienteverything_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareFHIRPatientEverything(t *testing.T) { want: server.ToolConfigs{ "example_tool": fhirpatienteverything.Config{ Name: "example_tool", - Kind: "cloud-healthcare-fhir-patient-everything", + Type: "cloud-healthcare-fhir-patient-everything", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcarefhirpatientsearch/cloudhealthcarefhirpatientsearch.go b/internal/tools/cloudhealthcare/cloudhealthcarefhirpatientsearch/cloudhealthcarefhirpatientsearch.go index 8c8c0c95d3..6b3cb61067 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarefhirpatientsearch/cloudhealthcarefhirpatientsearch.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarefhirpatientsearch/cloudhealthcarefhirpatientsearch.go @@ -53,7 +53,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -73,7 +73,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -82,7 +82,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -151,7 +151,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -259,7 +259,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcarefhirpatientsearch/cloudhealthcarefhirpatientsearch_test.go b/internal/tools/cloudhealthcare/cloudhealthcarefhirpatientsearch/cloudhealthcarefhirpatientsearch_test.go index 072fbc02d4..3a69341092 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarefhirpatientsearch/cloudhealthcarefhirpatientsearch_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarefhirpatientsearch/cloudhealthcarefhirpatientsearch_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareFHIRPatientSearch(t *testing.T) { want: server.ToolConfigs{ "example_tool": fhirpatientsearch.Config{ Name: "example_tool", - Kind: "cloud-healthcare-fhir-patient-search", + Type: "cloud-healthcare-fhir-patient-search", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetdataset/cloudhealthcaregetdataset.go b/internal/tools/cloudhealthcare/cloudhealthcaregetdataset/cloudhealthcaregetdataset.go index d26e4fd06e..0f2252c3a8 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetdataset/cloudhealthcaregetdataset.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetdataset/cloudhealthcaregetdataset.go @@ -30,7 +30,7 @@ const kind string = "cloud-healthcare-get-dataset" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -91,7 +91,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -126,7 +126,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetdataset/cloudhealthcaregetdataset_test.go b/internal/tools/cloudhealthcare/cloudhealthcaregetdataset/cloudhealthcaregetdataset_test.go index 3e56f2e9e4..f88c0681ad 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetdataset/cloudhealthcaregetdataset_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetdataset/cloudhealthcaregetdataset_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlGetHealthcareDataset(t *testing.T) { want: server.ToolConfigs{ "example_tool": getdataset.Config{ Name: "example_tool", - Kind: "cloud-healthcare-get-dataset", + Type: "cloud-healthcare-get-dataset", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstore/cloudhealthcaregetdicomstore.go b/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstore/cloudhealthcaregetdicomstore.go index 6a9b5bf75e..282938100e 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstore/cloudhealthcaregetdicomstore.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstore/cloudhealthcaregetdicomstore.go @@ -31,7 +31,7 @@ const kind string = "cloud-healthcare-get-dicom-store" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -108,7 +108,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -147,7 +147,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstore/cloudhealthcaregetdicomstore_test.go b/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstore/cloudhealthcaregetdicomstore_test.go index af87f20b9b..8bebc02657 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstore/cloudhealthcaregetdicomstore_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstore/cloudhealthcaregetdicomstore_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareGetDICOMStore(t *testing.T) { want: server.ToolConfigs{ "example_tool": getdicomstore.Config{ Name: "example_tool", - Kind: "cloud-healthcare-get-dicom-store", + Type: "cloud-healthcare-get-dicom-store", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstoremetrics/cloudhealthcaregetdicomstoremetrics.go b/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstoremetrics/cloudhealthcaregetdicomstoremetrics.go index c5ade268c9..79684c2b9f 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstoremetrics/cloudhealthcaregetdicomstoremetrics.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstoremetrics/cloudhealthcaregetdicomstoremetrics.go @@ -31,7 +31,7 @@ const kind string = "cloud-healthcare-get-dicom-store-metrics" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -108,7 +108,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -147,7 +147,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstoremetrics/cloudhealthcaregetdicomstoremetrics_test.go b/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstoremetrics/cloudhealthcaregetdicomstoremetrics_test.go index 43523f7b85..8613826580 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstoremetrics/cloudhealthcaregetdicomstoremetrics_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetdicomstoremetrics/cloudhealthcaregetdicomstoremetrics_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareGetDICOMStoreMetrics(t *testing.T) { want: server.ToolConfigs{ "example_tool": getdicomstoremetrics.Config{ Name: "example_tool", - Kind: "cloud-healthcare-get-dicom-store-metrics", + Type: "cloud-healthcare-get-dicom-store-metrics", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirresource/cloudhealthcaregetfhirresource.go b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirresource/cloudhealthcaregetfhirresource.go index 0e381b2806..02dd943671 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirresource/cloudhealthcaregetfhirresource.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirresource/cloudhealthcaregetfhirresource.go @@ -34,7 +34,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -113,7 +113,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -161,7 +161,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirresource/cloudhealthcaregetfhirresource_test.go b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirresource/cloudhealthcaregetfhirresource_test.go index 7c2ba5277f..0639e9b5cf 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirresource/cloudhealthcaregetfhirresource_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirresource/cloudhealthcaregetfhirresource_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareGetFHIRResource(t *testing.T) { want: server.ToolConfigs{ "example_tool": getfhirresource.Config{ Name: "example_tool", - Kind: "cloud-healthcare-get-fhir-resource", + Type: "cloud-healthcare-get-fhir-resource", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstore/cloudhealthcaregetfhirstore.go b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstore/cloudhealthcaregetfhirstore.go index f3755ae0bb..2276fef283 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstore/cloudhealthcaregetfhirstore.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstore/cloudhealthcaregetfhirstore.go @@ -31,7 +31,7 @@ const kind string = "cloud-healthcare-get-fhir-store" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -108,7 +108,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -147,7 +147,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstore/cloudhealthcaregetfhirstore_test.go b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstore/cloudhealthcaregetfhirstore_test.go index bcf3d54e51..9b934fe95e 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstore/cloudhealthcaregetfhirstore_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstore/cloudhealthcaregetfhirstore_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareGetFHIRStore(t *testing.T) { want: server.ToolConfigs{ "example_tool": getfhirstore.Config{ Name: "example_tool", - Kind: "cloud-healthcare-get-fhir-store", + Type: "cloud-healthcare-get-fhir-store", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstoremetrics/cloudhealthcaregetfhirstoremetrics.go b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstoremetrics/cloudhealthcaregetfhirstoremetrics.go index f105bbd7ec..638ac96af6 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstoremetrics/cloudhealthcaregetfhirstoremetrics.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstoremetrics/cloudhealthcaregetfhirstoremetrics.go @@ -31,7 +31,7 @@ const kind string = "cloud-healthcare-get-fhir-store-metrics" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -108,7 +108,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -147,7 +147,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstoremetrics/cloudhealthcaregetfhirstoremetrics_test.go b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstoremetrics/cloudhealthcaregetfhirstoremetrics_test.go index bd112bb00d..55e4df69be 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstoremetrics/cloudhealthcaregetfhirstoremetrics_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaregetfhirstoremetrics/cloudhealthcaregetfhirstoremetrics_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareGetFHIRStoreMetrics(t *testing.T) { want: server.ToolConfigs{ "example_tool": getfhirstoremetrics.Config{ Name: "example_tool", - Kind: "cloud-healthcare-get-fhir-store-metrics", + Type: "cloud-healthcare-get-fhir-store-metrics", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcarelistdicomstores/cloudhealthcarelistdicomstores.go b/internal/tools/cloudhealthcare/cloudhealthcarelistdicomstores/cloudhealthcarelistdicomstores.go index bdc4002c3a..fa2f06873e 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarelistdicomstores/cloudhealthcarelistdicomstores.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarelistdicomstores/cloudhealthcarelistdicomstores.go @@ -30,7 +30,7 @@ const kind string = "cloud-healthcare-list-dicom-stores" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -91,7 +91,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -126,7 +126,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcarelistdicomstores/cloudhealthcarelistdicomstores_test.go b/internal/tools/cloudhealthcare/cloudhealthcarelistdicomstores/cloudhealthcarelistdicomstores_test.go index f9e874b2d9..2e2f479adb 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarelistdicomstores/cloudhealthcarelistdicomstores_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarelistdicomstores/cloudhealthcarelistdicomstores_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareListDICOMStores(t *testing.T) { want: server.ToolConfigs{ "example_tool": listdicomstores.Config{ Name: "example_tool", - Kind: "cloud-healthcare-list-dicom-stores", + Type: "cloud-healthcare-list-dicom-stores", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcarelistfhirstores/cloudhealthcarelistfhirstores.go b/internal/tools/cloudhealthcare/cloudhealthcarelistfhirstores/cloudhealthcarelistfhirstores.go index c7918329cd..8ba2bdf034 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarelistfhirstores/cloudhealthcarelistfhirstores.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarelistfhirstores/cloudhealthcarelistfhirstores.go @@ -30,7 +30,7 @@ const kind string = "cloud-healthcare-list-fhir-stores" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -91,7 +91,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -126,7 +126,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcarelistfhirstores/cloudhealthcarelistfhirstores_test.go b/internal/tools/cloudhealthcare/cloudhealthcarelistfhirstores/cloudhealthcarelistfhirstores_test.go index dc7d8d891e..78c6226eab 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcarelistfhirstores/cloudhealthcarelistfhirstores_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcarelistfhirstores/cloudhealthcarelistfhirstores_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareListFHIRStores(t *testing.T) { want: server.ToolConfigs{ "example_tool": listfhirstores.Config{ Name: "example_tool", - Kind: "cloud-healthcare-list-fhir-stores", + Type: "cloud-healthcare-list-fhir-stores", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance.go b/internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance.go index 44c7e8a612..1d6657a786 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance.go +++ b/internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance.go @@ -36,7 +36,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -56,7 +56,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -118,7 +118,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -174,7 +174,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance_test.go b/internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance_test.go index 1522c3d8c3..9146306a54 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareRetrieveRenderedDICOMInstance(t *testing.T) { want: server.ToolConfigs{ "example_tool": retrieverendereddicominstance.Config{ Name: "example_tool", - Kind: "cloud-healthcare-retrieve-rendered-dicom-instance", + Type: "cloud-healthcare-retrieve-rendered-dicom-instance", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicominstances/cloudhealthcaresearchdicominstances.go b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicominstances/cloudhealthcaresearchdicominstances.go index 1223d09649..245aac6c98 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicominstances/cloudhealthcaresearchdicominstances.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicominstances/cloudhealthcaresearchdicominstances.go @@ -43,7 +43,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -63,7 +63,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -72,7 +72,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -132,7 +132,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -176,7 +176,7 @@ func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, para } } } - return source.SearchDICOM(t.Kind, storeID, dicomWebPath, tokenStr, opts) + return source.SearchDICOM(t.Type, storeID, dicomWebPath, tokenStr, opts) } func (t Tool) ParseParams(data map[string]any, claims map[string]map[string]any) (parameters.ParamValues, error) { @@ -200,7 +200,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicominstances/cloudhealthcaresearchdicominstances_test.go b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicominstances/cloudhealthcaresearchdicominstances_test.go index e28c6c1dd2..7353bfb7c3 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicominstances/cloudhealthcaresearchdicominstances_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicominstances/cloudhealthcaresearchdicominstances_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareSearchDICOMInstances(t *testing.T) { want: server.ToolConfigs{ "example_tool": searchdicominstances.Config{ Name: "example_tool", - Kind: "cloud-healthcare-search-dicom-instances", + Type: "cloud-healthcare-search-dicom-instances", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomseries/cloudhealthcaresearchdicomseries.go b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomseries/cloudhealthcaresearchdicomseries.go index 3c72fd99c3..d44c1d5d85 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomseries/cloudhealthcaresearchdicomseries.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomseries/cloudhealthcaresearchdicomseries.go @@ -41,7 +41,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -61,7 +61,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -70,7 +70,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -129,7 +129,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -161,7 +161,7 @@ func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, para dicomWebPath = fmt.Sprintf("studies/%s/series", id) } } - return source.SearchDICOM(t.Kind, storeID, dicomWebPath, tokenStr, opts) + return source.SearchDICOM(t.Type, storeID, dicomWebPath, tokenStr, opts) } func (t Tool) ParseParams(data map[string]any, claims map[string]map[string]any) (parameters.ParamValues, error) { @@ -185,7 +185,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomseries/cloudhealthcaresearchdicomseries_test.go b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomseries/cloudhealthcaresearchdicomseries_test.go index 7558adcadf..dfb8a16e80 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomseries/cloudhealthcaresearchdicomseries_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomseries/cloudhealthcaresearchdicomseries_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareSearchDICOMSeries(t *testing.T) { want: server.ToolConfigs{ "example_tool": searchdicomseries.Config{ Name: "example_tool", - Kind: "cloud-healthcare-search-dicom-series", + Type: "cloud-healthcare-search-dicom-series", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomstudies/cloudhealthcaresearchdicomstudies.go b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomstudies/cloudhealthcaresearchdicomstudies.go index d6d92f9dbb..e6f7ebbbc0 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomstudies/cloudhealthcaresearchdicomstudies.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomstudies/cloudhealthcaresearchdicomstudies.go @@ -39,7 +39,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -59,7 +59,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -68,7 +68,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -125,7 +125,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -145,7 +145,7 @@ func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, para return nil, err } dicomWebPath := "studies" - return source.SearchDICOM(t.Kind, storeID, dicomWebPath, tokenStr, opts) + return source.SearchDICOM(t.Type, storeID, dicomWebPath, tokenStr, opts) } func (t Tool) ParseParams(data map[string]any, claims map[string]map[string]any) (parameters.ParamValues, error) { @@ -169,7 +169,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomstudies/cloudhealthcaresearchdicomstudies_test.go b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomstudies/cloudhealthcaresearchdicomstudies_test.go index 483f37e61b..9cad7cffe4 100644 --- a/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomstudies/cloudhealthcaresearchdicomstudies_test.go +++ b/internal/tools/cloudhealthcare/cloudhealthcaresearchdicomstudies/cloudhealthcaresearchdicomstudies_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlHealthcareSearchDICOMStudies(t *testing.T) { want: server.ToolConfigs{ "example_tool": searchdicomstudies.Config{ Name: "example_tool", - Kind: "cloud-healthcare-search-dicom-studies", + Type: "cloud-healthcare-search-dicom-studies", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudmonitoring/cloudmonitoring.go b/internal/tools/cloudmonitoring/cloudmonitoring.go index aab95defbe..e2e3339c02 100644 --- a/internal/tools/cloudmonitoring/cloudmonitoring.go +++ b/internal/tools/cloudmonitoring/cloudmonitoring.go @@ -30,7 +30,7 @@ const kind string = "cloud-monitoring-query-prometheus" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/cloudmonitoring/cloudmonitoring_test.go b/internal/tools/cloudmonitoring/cloudmonitoring_test.go index 51c4d00c21..aa86f7e073 100644 --- a/internal/tools/cloudmonitoring/cloudmonitoring_test.go +++ b/internal/tools/cloudmonitoring/cloudmonitoring_test.go @@ -34,7 +34,7 @@ type mockIncompatibleSource struct{ sources.Source } func TestInitialize(t *testing.T) { t.Parallel() - testSource := &cloudmonitoringsrc.Source{Config: cloudmonitoringsrc.Config{Kind: "cloud-monitoring"}} + testSource := &cloudmonitoringsrc.Source{Config: cloudmonitoringsrc.Config{Type: "cloud-monitoring"}} srcs := map[string]sources.Source{ "my-monitoring-source": testSource, "incompatible-source": &mockIncompatibleSource{}, @@ -55,7 +55,7 @@ func TestInitialize(t *testing.T) { desc: "Success case with nil authRequired", cfg: cloudmonitoring.Config{ Name: "test-tool", - Kind: "cloud-monitoring-query-prometheus", + Type: "cloud-monitoring-query-prometheus", Source: "my-monitoring-source", Description: "A test description.", AuthRequired: nil, @@ -70,7 +70,7 @@ func TestInitialize(t *testing.T) { desc: "Success case with specified authRequired", cfg: cloudmonitoring.Config{ Name: "test-tool-with-auth", - Kind: "cloud-monitoring-query-prometheus", + Type: "cloud-monitoring-query-prometheus", Source: "my-monitoring-source", Description: "Another test description.", AuthRequired: []string{"google-auth-service"}, @@ -131,7 +131,7 @@ func TestParseFromYamlCloudMonitoring(t *testing.T) { want: server.ToolConfigs{ "example_tool": cloudmonitoring.Config{ Name: "example_tool", - Kind: "cloud-monitoring-query-prometheus", + Type: "cloud-monitoring-query-prometheus", Source: "my-instance", Description: "some description", AuthRequired: []string{}, @@ -153,7 +153,7 @@ func TestParseFromYamlCloudMonitoring(t *testing.T) { want: server.ToolConfigs{ "example_tool": cloudmonitoring.Config{ Name: "example_tool", - Kind: "cloud-monitoring-query-prometheus", + Type: "cloud-monitoring-query-prometheus", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -197,7 +197,7 @@ func TestFailParseFromYamlCloudMonitoring(t *testing.T) { source: my-instance description: some description `, - err: `unknown tool kind: "invalid-kind"`, + err: `unknown tool type: "invalid-kind"`, }, { desc: "missing source", diff --git a/internal/tools/cloudsql/cloudsqlcloneinstance/cloudsqlcloneinstance.go b/internal/tools/cloudsql/cloudsqlcloneinstance/cloudsqlcloneinstance.go index 887d2d8f9b..8cb07d5a70 100644 --- a/internal/tools/cloudsql/cloudsqlcloneinstance/cloudsqlcloneinstance.go +++ b/internal/tools/cloudsql/cloudsqlcloneinstance/cloudsqlcloneinstance.go @@ -30,7 +30,7 @@ const kind string = "cloud-sql-clone-instance" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -52,7 +52,7 @@ type compatibleSource interface { // Config defines the configuration for the clone-instance tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Description string `yaml:"description"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -61,8 +61,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -125,7 +125,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -176,7 +176,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsql/cloudsqlcloneinstance/cloudsqlcloneinstance_test.go b/internal/tools/cloudsql/cloudsqlcloneinstance/cloudsqlcloneinstance_test.go index 42fb94406d..cf8473ecbc 100644 --- a/internal/tools/cloudsql/cloudsqlcloneinstance/cloudsqlcloneinstance_test.go +++ b/internal/tools/cloudsql/cloudsqlcloneinstance/cloudsqlcloneinstance_test.go @@ -47,7 +47,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "clone-instance-tool": cloudsqlcloneinstance.Config{ Name: "clone-instance-tool", - Kind: "cloud-sql-clone-instance", + Type: "cloud-sql-clone-instance", Description: "a test description", Source: "a-source", AuthRequired: []string{}, diff --git a/internal/tools/cloudsql/cloudsqlcreatebackup/cloudsqlcreatebackup.go b/internal/tools/cloudsql/cloudsqlcreatebackup/cloudsqlcreatebackup.go index 2ad723f0d5..5a00ef74fb 100644 --- a/internal/tools/cloudsql/cloudsqlcreatebackup/cloudsqlcreatebackup.go +++ b/internal/tools/cloudsql/cloudsqlcreatebackup/cloudsqlcreatebackup.go @@ -40,7 +40,7 @@ type compatibleSource interface { // Config defines the configuration for the create-backup tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Description string `yaml:"description"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -48,7 +48,7 @@ type Config struct { func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -60,8 +60,8 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T return actual, nil } -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -121,7 +121,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -167,7 +167,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsql/cloudsqlcreatebackup/cloudsqlcreatebackup_test.go b/internal/tools/cloudsql/cloudsqlcreatebackup/cloudsqlcreatebackup_test.go index f3f46a470d..e71eeaa79a 100644 --- a/internal/tools/cloudsql/cloudsqlcreatebackup/cloudsqlcreatebackup_test.go +++ b/internal/tools/cloudsql/cloudsqlcreatebackup/cloudsqlcreatebackup_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-backup-tool": cloudsqlcreatebackup.Config{ Name: "create-backup-tool", - Kind: "cloud-sql-create-backup", + Type: "cloud-sql-create-backup", Description: "a test description", Source: "a-source", AuthRequired: []string{}, diff --git a/internal/tools/cloudsql/cloudsqlcreatedatabase/cloudsqlcreatedatabase.go b/internal/tools/cloudsql/cloudsqlcreatedatabase/cloudsqlcreatedatabase.go index bf9471be86..a2e6269d93 100644 --- a/internal/tools/cloudsql/cloudsqlcreatedatabase/cloudsqlcreatedatabase.go +++ b/internal/tools/cloudsql/cloudsqlcreatedatabase/cloudsqlcreatedatabase.go @@ -29,7 +29,7 @@ const kind string = "cloud-sql-create-database" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Config defines the configuration for the create-database tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -118,7 +118,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -165,7 +165,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsql/cloudsqlcreatedatabase/cloudsqlcreatedatabase_test.go b/internal/tools/cloudsql/cloudsqlcreatedatabase/cloudsqlcreatedatabase_test.go index 8630c916b6..c7d0aefe44 100644 --- a/internal/tools/cloudsql/cloudsqlcreatedatabase/cloudsqlcreatedatabase_test.go +++ b/internal/tools/cloudsql/cloudsqlcreatedatabase/cloudsqlcreatedatabase_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-database": cloudsqlcreatedatabase.Config{ Name: "create-database", - Kind: "cloud-sql-create-database", + Type: "cloud-sql-create-database", Source: "my-source", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudsql/cloudsqlcreateusers/cloudsqlcreateusers.go b/internal/tools/cloudsql/cloudsqlcreateusers/cloudsqlcreateusers.go index 701e5e2151..efd5bea5be 100644 --- a/internal/tools/cloudsql/cloudsqlcreateusers/cloudsqlcreateusers.go +++ b/internal/tools/cloudsql/cloudsqlcreateusers/cloudsqlcreateusers.go @@ -29,7 +29,7 @@ const kind string = "cloud-sql-create-users" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Config defines the configuration for the create-user tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -120,7 +120,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -170,7 +170,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsql/cloudsqlcreateusers/cloudsqlcreateusers_test.go b/internal/tools/cloudsql/cloudsqlcreateusers/cloudsqlcreateusers_test.go index 594b5215cb..075d877c81 100644 --- a/internal/tools/cloudsql/cloudsqlcreateusers/cloudsqlcreateusers_test.go +++ b/internal/tools/cloudsql/cloudsqlcreateusers/cloudsqlcreateusers_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-user": cloudsqlcreateusers.Config{ Name: "create-user", - Kind: "cloud-sql-create-users", + Type: "cloud-sql-create-users", Source: "my-source", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudsql/cloudsqlgetinstances/cloudsqlgetinstances.go b/internal/tools/cloudsql/cloudsqlgetinstances/cloudsqlgetinstances.go index 6c2b57cfc2..dfeee543bb 100644 --- a/internal/tools/cloudsql/cloudsqlgetinstances/cloudsqlgetinstances.go +++ b/internal/tools/cloudsql/cloudsqlgetinstances/cloudsqlgetinstances.go @@ -29,7 +29,7 @@ const kind string = "cloud-sql-get-instance" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Config defines the configuration for the get-instances tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Description string `yaml:"description"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -118,7 +118,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -161,7 +161,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsql/cloudsqlgetinstances/cloudsqlgetinstances_test.go b/internal/tools/cloudsql/cloudsqlgetinstances/cloudsqlgetinstances_test.go index 809ecfa815..17200fc757 100644 --- a/internal/tools/cloudsql/cloudsqlgetinstances/cloudsqlgetinstances_test.go +++ b/internal/tools/cloudsql/cloudsqlgetinstances/cloudsqlgetinstances_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "get-instances": cloudsqlgetinstances.Config{ Name: "get-instances", - Kind: "cloud-sql-get-instance", + Type: "cloud-sql-get-instance", Description: "A tool to get cloud sql instances", Source: "my-gcp-source", AuthRequired: []string{}, diff --git a/internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases.go b/internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases.go index a18c9dcffb..216e61e7a0 100644 --- a/internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases.go +++ b/internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases.go @@ -29,7 +29,7 @@ const kind string = "cloud-sql-list-databases" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Config defines the configuration for the list-databases tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -117,7 +117,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -160,7 +160,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases_test.go b/internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases_test.go index f7c1d49380..d3d5f39773 100644 --- a/internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases_test.go +++ b/internal/tools/cloudsql/cloudsqllistdatabases/cloudsqllistdatabases_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "list-my-databases": cloudsqllistdatabases.Config{ Name: "list-my-databases", - Kind: "cloud-sql-list-databases", + Type: "cloud-sql-list-databases", Description: "some description", AuthRequired: []string{}, Source: "some-source", diff --git a/internal/tools/cloudsql/cloudsqllistinstances/cloudsqllistinstances.go b/internal/tools/cloudsql/cloudsqllistinstances/cloudsqllistinstances.go index 21ddd0a469..e9344e60e3 100644 --- a/internal/tools/cloudsql/cloudsqllistinstances/cloudsqllistinstances.go +++ b/internal/tools/cloudsql/cloudsqllistinstances/cloudsqllistinstances.go @@ -29,7 +29,7 @@ const kind string = "cloud-sql-list-instances" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Config defines the configuration for the list-instance tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -116,7 +116,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -155,7 +155,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsql/cloudsqllistinstances/cloudsqllistinstances_test.go b/internal/tools/cloudsql/cloudsqllistinstances/cloudsqllistinstances_test.go index bf7eabfc09..092a928f0f 100644 --- a/internal/tools/cloudsql/cloudsqllistinstances/cloudsqllistinstances_test.go +++ b/internal/tools/cloudsql/cloudsqllistinstances/cloudsqllistinstances_test.go @@ -45,7 +45,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "list-my-instances": Config{ Name: "list-my-instances", - Kind: "cloud-sql-list-instances", + Type: "cloud-sql-list-instances", Description: "some description", AuthRequired: []string{}, Source: "some-source", diff --git a/internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation.go b/internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation.go index 4da7c7faba..d166f4ee5c 100644 --- a/internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation.go +++ b/internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation.go @@ -72,7 +72,7 @@ Please refer to the official documentation for guidance on deploying the toolbox func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -94,7 +94,7 @@ type compatibleSource interface { // Config defines the configuration for the wait-for-operation tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -110,8 +110,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -211,7 +211,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -290,7 +290,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation_test.go b/internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation_test.go index 580ee5a4f4..c0dd0b816b 100644 --- a/internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation_test.go +++ b/internal/tools/cloudsql/cloudsqlwaitforoperation/cloudsqlwaitforoperation_test.go @@ -50,7 +50,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "wait-for-thing": cloudsqlwaitforoperation.Config{ Name: "wait-for-thing", - Kind: "cloud-sql-wait-for-operation", + Type: "cloud-sql-wait-for-operation", Source: "some-source", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance/cloudsqlmssqlcreateinstance.go b/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance/cloudsqlmssqlcreateinstance.go index 9a76293506..9dc0c7cf5b 100644 --- a/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance/cloudsqlmssqlcreateinstance.go +++ b/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance/cloudsqlmssqlcreateinstance.go @@ -31,7 +31,7 @@ const kind string = "cloud-sql-mssql-create-instance" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -52,7 +52,7 @@ type compatibleSource interface { // Config defines the configuration for the create-instances tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Description string `yaml:"description"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -61,8 +61,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -122,7 +122,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -194,7 +194,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance/cloudsqlmssqlcreateinstance_test.go b/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance/cloudsqlmssqlcreateinstance_test.go index 54b381ae62..31f58fad18 100644 --- a/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance/cloudsqlmssqlcreateinstance_test.go +++ b/internal/tools/cloudsqlmssql/cloudsqlmssqlcreateinstance/cloudsqlmssqlcreateinstance_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-instance-tool": cloudsqlmssqlcreateinstance.Config{ Name: "create-instance-tool", - Kind: "cloud-sql-mssql-create-instance", + Type: "cloud-sql-mssql-create-instance", Description: "a test description", Source: "a-source", AuthRequired: []string{}, diff --git a/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance/cloudsqlmysqlcreateinstance.go b/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance/cloudsqlmysqlcreateinstance.go index 247544dc15..1e470e18ba 100644 --- a/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance/cloudsqlmysqlcreateinstance.go +++ b/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance/cloudsqlmysqlcreateinstance.go @@ -31,7 +31,7 @@ const kind string = "cloud-sql-mysql-create-instance" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -52,7 +52,7 @@ type compatibleSource interface { // Config defines the configuration for the create-instances tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Description string `yaml:"description"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -61,8 +61,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -122,7 +122,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -196,7 +196,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance/cloudsqlmysqlcreateinstance_test.go b/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance/cloudsqlmysqlcreateinstance_test.go index eb961412c8..e471d33347 100644 --- a/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance/cloudsqlmysqlcreateinstance_test.go +++ b/internal/tools/cloudsqlmysql/cloudsqlmysqlcreateinstance/cloudsqlmysqlcreateinstance_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-instance-tool": cloudsqlmysqlcreateinstance.Config{ Name: "create-instance-tool", - Kind: "cloud-sql-mysql-create-instance", + Type: "cloud-sql-mysql-create-instance", Description: "a test description", Source: "a-source", AuthRequired: []string{}, diff --git a/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances.go b/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances.go index 8fe60179f0..028bab861d 100644 --- a/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances.go +++ b/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances.go @@ -31,7 +31,7 @@ const kind string = "cloud-sql-postgres-create-instance" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -52,7 +52,7 @@ type compatibleSource interface { // Config defines the configuration for the create-instances tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Description string `yaml:"description"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -61,8 +61,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -122,7 +122,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -195,7 +195,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances_test.go b/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances_test.go index 950ba8b2de..03076f52c9 100644 --- a/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances_test.go +++ b/internal/tools/cloudsqlpg/cloudsqlpgcreateinstances/cloudsqlpgcreateinstances_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "create-instance-tool": cloudsqlpgcreateinstances.Config{ Name: "create-instance-tool", - Kind: "cloud-sql-postgres-create-instance", + Type: "cloud-sql-postgres-create-instance", Description: "a test description", Source: "a-source", AuthRequired: []string{}, diff --git a/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck/cloudsqlpgupgradeprecheck.go b/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck/cloudsqlpgupgradeprecheck.go index a4fd600414..4acd4a6d7c 100644 --- a/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck/cloudsqlpgupgradeprecheck.go +++ b/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck/cloudsqlpgupgradeprecheck.go @@ -31,7 +31,7 @@ const kind string = "postgres-upgrade-precheck" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { // Config defines the configuration for the precheck-upgrade tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Description string `yaml:"description"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,8 +60,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -133,7 +133,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the tool's logic. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -231,7 +231,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } diff --git a/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck/cloudsqlpgupgradeprecheck_test.go b/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck/cloudsqlpgupgradeprecheck_test.go index 27a117e1ba..42ffc4037b 100644 --- a/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck/cloudsqlpgupgradeprecheck_test.go +++ b/internal/tools/cloudsqlpg/cloudsqlpgupgradeprecheck/cloudsqlpgupgradeprecheck_test.go @@ -48,7 +48,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "precheck-upgrade-tool": cloudsqlpgupgradeprecheck.Config{ Name: "precheck-upgrade-tool", - Kind: "postgres-upgrade-precheck", + Type: "postgres-upgrade-precheck", Description: "a precheck test description", Source: "some-admin-source", AuthRequired: []string{"https://www.googleapis.com/auth/cloud-platform"}, @@ -67,7 +67,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "precheck-upgrade-tool-no-auth": cloudsqlpgupgradeprecheck.Config{ Name: "precheck-upgrade-tool-no-auth", - Kind: "postgres-upgrade-precheck", + Type: "postgres-upgrade-precheck", Description: "a precheck test description no auth", Source: "other-admin-source", AuthRequired: []string{}, diff --git a/internal/tools/couchbase/couchbase.go b/internal/tools/couchbase/couchbase.go index a43c85f506..3123b1c85b 100644 --- a/internal/tools/couchbase/couchbase.go +++ b/internal/tools/couchbase/couchbase.go @@ -30,7 +30,7 @@ const kind string = "couchbase-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -97,7 +97,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/couchbase/couchbase_test.go b/internal/tools/couchbase/couchbase_test.go index 6f8f2bc459..1ccc6d3555 100644 --- a/internal/tools/couchbase/couchbase_test.go +++ b/internal/tools/couchbase/couchbase_test.go @@ -50,7 +50,7 @@ func TestParseFromYamlCouchbase(t *testing.T) { want: server.ToolConfigs{ "example_tool": couchbase.Config{ Name: "example_tool", - Kind: "couchbase-sql", + Type: "couchbase-sql", AuthRequired: []string{}, Source: "my-couchbase-instance", Description: "some tool description", @@ -118,7 +118,7 @@ func TestParseFromYamlWithTemplateMssql(t *testing.T) { want: server.ToolConfigs{ "example_tool": couchbase.Config{ Name: "example_tool", - Kind: "couchbase-sql", + Type: "couchbase-sql", AuthRequired: []string{}, Source: "my-couchbase-instance", Description: "some tool description", diff --git a/internal/tools/dataform/dataformcompilelocal/dataformcompilelocal.go b/internal/tools/dataform/dataformcompilelocal/dataformcompilelocal.go index 7ab1036991..1ce39c4567 100644 --- a/internal/tools/dataform/dataformcompilelocal/dataformcompilelocal.go +++ b/internal/tools/dataform/dataformcompilelocal/dataformcompilelocal.go @@ -31,7 +31,7 @@ const kind string = "dataform-compile-local" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -45,14 +45,14 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` } var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } diff --git a/internal/tools/dataform/dataformcompilelocal/dataformcompilelocal_test.go b/internal/tools/dataform/dataformcompilelocal/dataformcompilelocal_test.go index 40b85f0363..75dcf3841a 100644 --- a/internal/tools/dataform/dataformcompilelocal/dataformcompilelocal_test.go +++ b/internal/tools/dataform/dataformcompilelocal/dataformcompilelocal_test.go @@ -45,7 +45,7 @@ func TestParseFromYamlDataformCompile(t *testing.T) { want: server.ToolConfigs{ "example_tool": dataformcompilelocal.Config{ Name: "example_tool", - Kind: "dataform-compile-local", + Type: "dataform-compile-local", Description: "some description", AuthRequired: []string{}, }, diff --git a/internal/tools/dataplex/dataplexlookupentry/dataplexlookupentry.go b/internal/tools/dataplex/dataplexlookupentry/dataplexlookupentry.go index 3fed4ef0cc..bfac7f5afd 100644 --- a/internal/tools/dataplex/dataplexlookupentry/dataplexlookupentry.go +++ b/internal/tools/dataplex/dataplexlookupentry/dataplexlookupentry.go @@ -30,7 +30,7 @@ const kind string = "dataplex-lookup-entry" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -48,7 +48,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -111,7 +111,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/dataplex/dataplexlookupentry/dataplexlookupentry_test.go b/internal/tools/dataplex/dataplexlookupentry/dataplexlookupentry_test.go index 8c3d5942c2..25c6a755f7 100644 --- a/internal/tools/dataplex/dataplexlookupentry/dataplexlookupentry_test.go +++ b/internal/tools/dataplex/dataplexlookupentry/dataplexlookupentry_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlDataplexLookupEntry(t *testing.T) { want: server.ToolConfigs{ "example_tool": dataplexlookupentry.Config{ Name: "example_tool", - Kind: "dataplex-lookup-entry", + Type: "dataplex-lookup-entry", Source: "my-instance", Description: "some description", AuthRequired: []string{}, @@ -84,7 +84,7 @@ func TestParseFromYamlDataplexLookupEntry(t *testing.T) { want: server.ToolConfigs{ "example_tool": dataplexlookupentry.Config{ Name: "example_tool", - Kind: "dataplex-lookup-entry", + Type: "dataplex-lookup-entry", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes.go b/internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes.go index 214f7396e1..f361c4e4bc 100644 --- a/internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes.go +++ b/internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes.go @@ -30,7 +30,7 @@ const kind string = "dataplex-search-aspect-types" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -48,7 +48,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -57,7 +57,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes_test.go b/internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes_test.go index 963091b03d..78ed24bbc4 100644 --- a/internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes_test.go +++ b/internal/tools/dataplex/dataplexsearchaspecttypes/dataplexsearchaspecttypes_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlDataplexSearchAspectTypes(t *testing.T) { want: server.ToolConfigs{ "example_tool": dataplexsearchaspecttypes.Config{ Name: "example_tool", - Kind: "dataplex-search-aspect-types", + Type: "dataplex-search-aspect-types", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries.go b/internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries.go index 7180848a4b..41bc3c13e1 100644 --- a/internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries.go +++ b/internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries.go @@ -30,7 +30,7 @@ const kind string = "dataplex-search-entries" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -48,7 +48,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -57,7 +57,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries_test.go b/internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries_test.go index f916c82f74..ae149f9cca 100644 --- a/internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries_test.go +++ b/internal/tools/dataplex/dataplexsearchentries/dataplexsearchentries_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlDataplexSearchEntries(t *testing.T) { want: server.ToolConfigs{ "example_tool": dataplexsearchentries.Config{ Name: "example_tool", - Kind: "dataplex-search-entries", + Type: "dataplex-search-entries", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/dgraph/dgraph.go b/internal/tools/dgraph/dgraph.go index 7d56baadd9..d3fadcd84b 100644 --- a/internal/tools/dgraph/dgraph.go +++ b/internal/tools/dgraph/dgraph.go @@ -30,7 +30,7 @@ const kind string = "dgraph-dql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -62,7 +62,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -92,7 +92,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/dgraph/dgraph_test.go b/internal/tools/dgraph/dgraph_test.go index cb4f672ff3..f0ef6a9167 100644 --- a/internal/tools/dgraph/dgraph_test.go +++ b/internal/tools/dgraph/dgraph_test.go @@ -50,7 +50,7 @@ func TestParseFromYamlDgraph(t *testing.T) { want: server.ToolConfigs{ "example_tool": dgraph.Config{ Name: "example_tool", - Kind: "dgraph-dql", + Type: "dgraph-dql", Source: "my-dgraph-instance", AuthRequired: []string{}, Description: "some tool description", @@ -74,7 +74,7 @@ func TestParseFromYamlDgraph(t *testing.T) { want: server.ToolConfigs{ "example_tool": dgraph.Config{ Name: "example_tool", - Kind: "dgraph-dql", + Type: "dgraph-dql", Source: "my-dgraph-instance", Description: "some tool description", AuthRequired: []string{}, diff --git a/internal/tools/elasticsearch/elasticsearchesql/elasticsearchesql.go b/internal/tools/elasticsearch/elasticsearchesql/elasticsearchesql.go index 0e13013635..b5f857184d 100644 --- a/internal/tools/elasticsearch/elasticsearchesql/elasticsearchesql.go +++ b/internal/tools/elasticsearch/elasticsearchesql/elasticsearchesql.go @@ -32,7 +32,7 @@ const kind string = "elasticsearch-esql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -43,7 +43,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` @@ -55,7 +55,7 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (c Config) ToolConfigKind() string { +func (c Config) ToolConfigType() string { return kind } @@ -90,7 +90,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/elasticsearch/elasticsearchesql/elasticsearchesql_test.go b/internal/tools/elasticsearch/elasticsearchesql/elasticsearchesql_test.go index ec65d2842a..27e8abfdb7 100644 --- a/internal/tools/elasticsearch/elasticsearchesql/elasticsearchesql_test.go +++ b/internal/tools/elasticsearch/elasticsearchesql/elasticsearchesql_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlElasticsearchEsql(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "elasticsearch-esql", + Type: "elasticsearch-esql", Source: "my-elasticsearch-instance", Description: "Elasticsearch ES|QL tool", AuthRequired: []string{}, @@ -76,7 +76,7 @@ func TestParseFromYamlElasticsearchEsql(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "elasticsearch-esql", + Type: "elasticsearch-esql", Source: "my-elasticsearch-instance", Description: "Elasticsearch ES|QL tool with customizable limit", AuthRequired: []string{}, diff --git a/internal/tools/firebird/firebirdexecutesql/firebirdexecutesql.go b/internal/tools/firebird/firebirdexecutesql/firebirdexecutesql.go index fa5e414f63..28335904e5 100644 --- a/internal/tools/firebird/firebirdexecutesql/firebirdexecutesql.go +++ b/internal/tools/firebird/firebirdexecutesql/firebirdexecutesql.go @@ -31,7 +31,7 @@ const kind string = "firebird-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -91,7 +91,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firebird/firebirdexecutesql/firebirdexecutesql_test.go b/internal/tools/firebird/firebirdexecutesql/firebirdexecutesql_test.go index a2f8f02355..2afb4bb2ab 100644 --- a/internal/tools/firebird/firebirdexecutesql/firebirdexecutesql_test.go +++ b/internal/tools/firebird/firebirdexecutesql/firebirdexecutesql_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": firebirdexecutesql.Config{ Name: "example_tool", - Kind: "firebird-execute-sql", + Type: "firebird-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/firebird/firebirdsql/firebirdsql.go b/internal/tools/firebird/firebirdsql/firebirdsql.go index aad9b54aa5..ecf9eaa99a 100644 --- a/internal/tools/firebird/firebirdsql/firebirdsql.go +++ b/internal/tools/firebird/firebirdsql/firebirdsql.go @@ -31,7 +31,7 @@ const kind string = "firebird-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -62,7 +62,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -99,7 +99,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firebird/firebirdsql/firebirdsql_test.go b/internal/tools/firebird/firebirdsql/firebirdsql_test.go index 5530699035..2d9ddbcfe1 100644 --- a/internal/tools/firebird/firebirdsql/firebirdsql_test.go +++ b/internal/tools/firebird/firebirdsql/firebirdsql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlFirebird(t *testing.T) { want: server.ToolConfigs{ "example_tool": firebirdsql.Config{ Name: "example_tool", - Kind: "firebird-sql", + Type: "firebird-sql", Source: "my-fdb-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -132,7 +132,7 @@ func TestParseFromYamlWithTemplateParamsFirebird(t *testing.T) { want: server.ToolConfigs{ "example_tool": firebirdsql.Config{ Name: "example_tool", - Kind: "firebird-sql", + Type: "firebird-sql", Source: "my-fdb-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/firestore/firestoreadddocuments/firestoreadddocuments.go b/internal/tools/firestore/firestoreadddocuments/firestoreadddocuments.go index 2878116045..8a0a47bbd6 100644 --- a/internal/tools/firestore/firestoreadddocuments/firestoreadddocuments.go +++ b/internal/tools/firestore/firestoreadddocuments/firestoreadddocuments.go @@ -34,7 +34,7 @@ const returnDocumentDataKey string = "returnData" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -62,7 +62,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -129,7 +129,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firestore/firestoreadddocuments/firestoreadddocuments_test.go b/internal/tools/firestore/firestoreadddocuments/firestoreadddocuments_test.go index 5e743714f1..c9009b5e8d 100644 --- a/internal/tools/firestore/firestoreadddocuments/firestoreadddocuments_test.go +++ b/internal/tools/firestore/firestoreadddocuments/firestoreadddocuments_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlFirestoreAddDocuments(t *testing.T) { want: server.ToolConfigs{ "add_docs_tool": firestoreadddocuments.Config{ Name: "add_docs_tool", - Kind: "firestore-add-documents", + Type: "firestore-add-documents", Source: "my-firestore-instance", Description: "Add documents to Firestore collections", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYamlFirestoreAddDocuments(t *testing.T) { want: server.ToolConfigs{ "secure_add_docs": firestoreadddocuments.Config{ Name: "secure_add_docs", - Kind: "firestore-add-documents", + Type: "firestore-add-documents", Source: "prod-firestore", Description: "Add documents with authentication", AuthRequired: []string{"google-auth-service", "api-key-service"}, @@ -121,21 +121,21 @@ func TestParseFromYamlMultipleTools(t *testing.T) { want := server.ToolConfigs{ "add_user_docs": firestoreadddocuments.Config{ Name: "add_user_docs", - Kind: "firestore-add-documents", + Type: "firestore-add-documents", Source: "users-firestore", Description: "Add user documents", AuthRequired: []string{"user-auth"}, }, "add_product_docs": firestoreadddocuments.Config{ Name: "add_product_docs", - Kind: "firestore-add-documents", + Type: "firestore-add-documents", Source: "products-firestore", Description: "Add product documents", AuthRequired: []string{}, }, "add_order_docs": firestoreadddocuments.Config{ Name: "add_order_docs", - Kind: "firestore-add-documents", + Type: "firestore-add-documents", Source: "orders-firestore", Description: "Add order documents", AuthRequired: []string{"user-auth", "admin-auth"}, diff --git a/internal/tools/firestore/firestoredeletedocuments/firestoredeletedocuments.go b/internal/tools/firestore/firestoredeletedocuments/firestoredeletedocuments.go index f92780d616..4e45dad7f7 100644 --- a/internal/tools/firestore/firestoredeletedocuments/firestoredeletedocuments.go +++ b/internal/tools/firestore/firestoredeletedocuments/firestoredeletedocuments.go @@ -32,7 +32,7 @@ const documentPathsKey string = "documentPaths" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -95,7 +95,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firestore/firestoredeletedocuments/firestoredeletedocuments_test.go b/internal/tools/firestore/firestoredeletedocuments/firestoredeletedocuments_test.go index 15cfce822c..6a9e438b55 100644 --- a/internal/tools/firestore/firestoredeletedocuments/firestoredeletedocuments_test.go +++ b/internal/tools/firestore/firestoredeletedocuments/firestoredeletedocuments_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlFirestoreDeleteDocuments(t *testing.T) { want: server.ToolConfigs{ "delete_docs_tool": firestoredeletedocuments.Config{ Name: "delete_docs_tool", - Kind: "firestore-delete-documents", + Type: "firestore-delete-documents", Source: "my-firestore-instance", Description: "Delete documents from Firestore by paths", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYamlFirestoreDeleteDocuments(t *testing.T) { want: server.ToolConfigs{ "secure_delete_docs": firestoredeletedocuments.Config{ Name: "secure_delete_docs", - Kind: "firestore-delete-documents", + Type: "firestore-delete-documents", Source: "prod-firestore", Description: "Delete documents with authentication", AuthRequired: []string{"google-auth-service", "api-key-service"}, @@ -121,21 +121,21 @@ func TestParseFromYamlMultipleTools(t *testing.T) { want := server.ToolConfigs{ "delete_user_docs": firestoredeletedocuments.Config{ Name: "delete_user_docs", - Kind: "firestore-delete-documents", + Type: "firestore-delete-documents", Source: "users-firestore", Description: "Delete user documents", AuthRequired: []string{"user-auth"}, }, "delete_product_docs": firestoredeletedocuments.Config{ Name: "delete_product_docs", - Kind: "firestore-delete-documents", + Type: "firestore-delete-documents", Source: "products-firestore", Description: "Delete product documents", AuthRequired: []string{}, }, "delete_order_docs": firestoredeletedocuments.Config{ Name: "delete_order_docs", - Kind: "firestore-delete-documents", + Type: "firestore-delete-documents", Source: "orders-firestore", Description: "Delete order documents", AuthRequired: []string{"user-auth", "admin-auth"}, diff --git a/internal/tools/firestore/firestoregetdocuments/firestoregetdocuments.go b/internal/tools/firestore/firestoregetdocuments/firestoregetdocuments.go index 42e6cb86e9..e7aa326d1e 100644 --- a/internal/tools/firestore/firestoregetdocuments/firestoregetdocuments.go +++ b/internal/tools/firestore/firestoregetdocuments/firestoregetdocuments.go @@ -32,7 +32,7 @@ const documentPathsKey string = "documentPaths" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -95,7 +95,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firestore/firestoregetdocuments/firestoregetdocuments_test.go b/internal/tools/firestore/firestoregetdocuments/firestoregetdocuments_test.go index 4cc6ab6245..3b8dfb57a5 100644 --- a/internal/tools/firestore/firestoregetdocuments/firestoregetdocuments_test.go +++ b/internal/tools/firestore/firestoregetdocuments/firestoregetdocuments_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlFirestoreGetDocuments(t *testing.T) { want: server.ToolConfigs{ "get_docs_tool": firestoregetdocuments.Config{ Name: "get_docs_tool", - Kind: "firestore-get-documents", + Type: "firestore-get-documents", Source: "my-firestore-instance", Description: "Retrieve documents from Firestore by paths", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYamlFirestoreGetDocuments(t *testing.T) { want: server.ToolConfigs{ "secure_get_docs": firestoregetdocuments.Config{ Name: "secure_get_docs", - Kind: "firestore-get-documents", + Type: "firestore-get-documents", Source: "prod-firestore", Description: "Get documents with authentication", AuthRequired: []string{"google-auth-service", "api-key-service"}, @@ -121,21 +121,21 @@ func TestParseFromYamlMultipleTools(t *testing.T) { want := server.ToolConfigs{ "get_user_docs": firestoregetdocuments.Config{ Name: "get_user_docs", - Kind: "firestore-get-documents", + Type: "firestore-get-documents", Source: "users-firestore", Description: "Get user documents", AuthRequired: []string{"user-auth"}, }, "get_product_docs": firestoregetdocuments.Config{ Name: "get_product_docs", - Kind: "firestore-get-documents", + Type: "firestore-get-documents", Source: "products-firestore", Description: "Get product documents", AuthRequired: []string{}, }, "get_order_docs": firestoregetdocuments.Config{ Name: "get_order_docs", - Kind: "firestore-get-documents", + Type: "firestore-get-documents", Source: "orders-firestore", Description: "Get order documents", AuthRequired: []string{"user-auth", "admin-auth"}, diff --git a/internal/tools/firestore/firestoregetrules/firestoregetrules.go b/internal/tools/firestore/firestoregetrules/firestoregetrules.go index d153130e18..84723dd8b6 100644 --- a/internal/tools/firestore/firestoregetrules/firestoregetrules.go +++ b/internal/tools/firestore/firestoregetrules/firestoregetrules.go @@ -30,7 +30,7 @@ const kind string = "firestore-get-rules" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -93,7 +93,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firestore/firestoregetrules/firestoregetrules_test.go b/internal/tools/firestore/firestoregetrules/firestoregetrules_test.go index 405eb1377a..43a80a7bc0 100644 --- a/internal/tools/firestore/firestoregetrules/firestoregetrules_test.go +++ b/internal/tools/firestore/firestoregetrules/firestoregetrules_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlFirestoreGetRules(t *testing.T) { want: server.ToolConfigs{ "get_rules_tool": firestoregetrules.Config{ Name: "get_rules_tool", - Kind: "firestore-get-rules", + Type: "firestore-get-rules", Source: "my-firestore-instance", Description: "Retrieves the active Firestore security rules for the current project", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYamlFirestoreGetRules(t *testing.T) { want: server.ToolConfigs{ "secure_get_rules": firestoregetrules.Config{ Name: "secure_get_rules", - Kind: "firestore-get-rules", + Type: "firestore-get-rules", Source: "prod-firestore", Description: "Get Firestore security rules with authentication", AuthRequired: []string{"google-auth-service", "admin-service"}, @@ -121,21 +121,21 @@ func TestParseFromYamlMultipleTools(t *testing.T) { want := server.ToolConfigs{ "get_dev_rules": firestoregetrules.Config{ Name: "get_dev_rules", - Kind: "firestore-get-rules", + Type: "firestore-get-rules", Source: "dev-firestore", Description: "Get development Firestore rules", AuthRequired: []string{"dev-auth"}, }, "get_staging_rules": firestoregetrules.Config{ Name: "get_staging_rules", - Kind: "firestore-get-rules", + Type: "firestore-get-rules", Source: "staging-firestore", Description: "Get staging Firestore rules", AuthRequired: []string{}, }, "get_prod_rules": firestoregetrules.Config{ Name: "get_prod_rules", - Kind: "firestore-get-rules", + Type: "firestore-get-rules", Source: "prod-firestore", Description: "Get production Firestore rules", AuthRequired: []string{"prod-auth", "admin-auth"}, diff --git a/internal/tools/firestore/firestorelistcollections/firestorelistcollections.go b/internal/tools/firestore/firestorelistcollections/firestorelistcollections.go index 4e09600e73..c3f0253979 100644 --- a/internal/tools/firestore/firestorelistcollections/firestorelistcollections.go +++ b/internal/tools/firestore/firestorelistcollections/firestorelistcollections.go @@ -32,7 +32,7 @@ const parentPathKey string = "parentPath" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -96,7 +96,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firestore/firestorelistcollections/firestorelistcollections_test.go b/internal/tools/firestore/firestorelistcollections/firestorelistcollections_test.go index d3b08ae649..3f33b11d1b 100644 --- a/internal/tools/firestore/firestorelistcollections/firestorelistcollections_test.go +++ b/internal/tools/firestore/firestorelistcollections/firestorelistcollections_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlFirestoreListCollections(t *testing.T) { want: server.ToolConfigs{ "list_collections_tool": firestorelistcollections.Config{ Name: "list_collections_tool", - Kind: "firestore-list-collections", + Type: "firestore-list-collections", Source: "my-firestore-instance", Description: "List collections in Firestore", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYamlFirestoreListCollections(t *testing.T) { want: server.ToolConfigs{ "secure_list_collections": firestorelistcollections.Config{ Name: "secure_list_collections", - Kind: "firestore-list-collections", + Type: "firestore-list-collections", Source: "prod-firestore", Description: "List collections with authentication", AuthRequired: []string{"google-auth-service", "api-key-service"}, @@ -121,21 +121,21 @@ func TestParseFromYamlMultipleTools(t *testing.T) { want := server.ToolConfigs{ "list_user_collections": firestorelistcollections.Config{ Name: "list_user_collections", - Kind: "firestore-list-collections", + Type: "firestore-list-collections", Source: "users-firestore", Description: "List user-related collections", AuthRequired: []string{"user-auth"}, }, "list_product_collections": firestorelistcollections.Config{ Name: "list_product_collections", - Kind: "firestore-list-collections", + Type: "firestore-list-collections", Source: "products-firestore", Description: "List product-related collections", AuthRequired: []string{}, }, "list_admin_collections": firestorelistcollections.Config{ Name: "list_admin_collections", - Kind: "firestore-list-collections", + Type: "firestore-list-collections", Source: "admin-firestore", Description: "List administrative collections", AuthRequired: []string{"user-auth", "admin-auth"}, diff --git a/internal/tools/firestore/firestorequery/firestorequery.go b/internal/tools/firestore/firestorequery/firestorequery.go index 3501d52b5b..7c7e879a22 100644 --- a/internal/tools/firestore/firestorequery/firestorequery.go +++ b/internal/tools/firestore/firestorequery/firestorequery.go @@ -38,7 +38,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -60,7 +60,7 @@ type compatibleSource interface { // Config represents the configuration for the Firestore query tool type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -80,8 +80,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of tool configuration -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of tool configuration +func (cfg Config) ToolConfigType() string { return kind } @@ -159,7 +159,7 @@ var validOperators = map[string]bool{ // Invoke executes the Firestore query based on the provided parameters func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firestore/firestorequery/firestorequery_test.go b/internal/tools/firestore/firestorequery/firestorequery_test.go index 178bbe8071..7a8d27d853 100644 --- a/internal/tools/firestore/firestorequery/firestorequery_test.go +++ b/internal/tools/firestore/firestorequery/firestorequery_test.go @@ -53,7 +53,7 @@ func TestParseFromYamlFirestoreQuery(t *testing.T) { want: server.ToolConfigs{ "query_users_tool": firestorequery.Config{ Name: "query_users_tool", - Kind: "firestore-query", + Type: "firestore-query", Source: "my-firestore-instance", Description: "Query users collection with parameterized path", CollectionPath: "users/{{.userId}}/documents", @@ -93,7 +93,7 @@ func TestParseFromYamlFirestoreQuery(t *testing.T) { want: server.ToolConfigs{ "query_products_tool": firestorequery.Config{ Name: "query_products_tool", - Kind: "firestore-query", + Type: "firestore-query", Source: "prod-firestore", Description: "Query products with dynamic filters", CollectionPath: "products", @@ -138,7 +138,7 @@ func TestParseFromYamlFirestoreQuery(t *testing.T) { want: server.ToolConfigs{ "query_orders_tool": firestorequery.Config{ Name: "query_orders_tool", - Kind: "firestore-query", + Type: "firestore-query", Source: "orders-firestore", Description: "Query orders with field selection", CollectionPath: "orders", @@ -197,7 +197,7 @@ func TestParseFromYamlFirestoreQuery(t *testing.T) { want: server.ToolConfigs{ "secure_query_tool": firestorequery.Config{ Name: "secure_query_tool", - Kind: "firestore-query", + Type: "firestore-query", Source: "secure-firestore", Description: "Query with authentication and complex filters", CollectionPath: "{{.collection}}", @@ -273,7 +273,7 @@ func TestParseFromYamlFirestoreQuery(t *testing.T) { want: server.ToolConfigs{ "query_with_typed_values": firestorequery.Config{ Name: "query_with_typed_values", - Kind: "firestore-query", + Type: "firestore-query", Source: "typed-firestore", Description: "Query with Firestore native JSON value types", CollectionPath: "countries", @@ -415,7 +415,7 @@ func TestParseFromYamlMultipleQueryTools(t *testing.T) { want := server.ToolConfigs{ "query_user_posts": firestorequery.Config{ Name: "query_user_posts", - Kind: "firestore-query", + Type: "firestore-query", Source: "social-firestore", Description: "Query user posts with filtering", CollectionPath: "users/{{.userId}}/posts", @@ -442,7 +442,7 @@ func TestParseFromYamlMultipleQueryTools(t *testing.T) { }, "query_inventory": firestorequery.Config{ Name: "query_inventory", - Kind: "firestore-query", + Type: "firestore-query", Source: "inventory-firestore", Description: "Query inventory items", CollectionPath: "warehouses/{{.warehouseId}}/inventory", @@ -457,7 +457,7 @@ func TestParseFromYamlMultipleQueryTools(t *testing.T) { }, "query_transactions": firestorequery.Config{ Name: "query_transactions", - Kind: "firestore-query", + Type: "firestore-query", Source: "finance-firestore", Description: "Query financial transactions", CollectionPath: "accounts/{{.accountId}}/transactions", diff --git a/internal/tools/firestore/firestorequerycollection/firestorequerycollection.go b/internal/tools/firestore/firestorequerycollection/firestorequerycollection.go index f4c6aa493c..688a4c0eeb 100644 --- a/internal/tools/firestore/firestorequerycollection/firestorequerycollection.go +++ b/internal/tools/firestore/firestorequerycollection/firestorequerycollection.go @@ -74,7 +74,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -96,7 +96,7 @@ type compatibleSource interface { // Config represents the configuration for the Firestore query collection tool type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -105,8 +105,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of tool configuration -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of tool configuration +func (cfg Config) ToolConfigType() string { return kind } @@ -231,7 +231,7 @@ func (o *OrderByConfig) GetDirection() firestoreapi.Direction { // Invoke executes the Firestore query based on the provided parameters func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firestore/firestorequerycollection/firestorequerycollection_test.go b/internal/tools/firestore/firestorequerycollection/firestorequerycollection_test.go index 355ce8e188..a35c863276 100644 --- a/internal/tools/firestore/firestorequerycollection/firestorequerycollection_test.go +++ b/internal/tools/firestore/firestorequerycollection/firestorequerycollection_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlFirestoreQueryCollection(t *testing.T) { want: server.ToolConfigs{ "query_users_tool": firestorequerycollection.Config{ Name: "query_users_tool", - Kind: "firestore-query-collection", + Type: "firestore-query-collection", Source: "my-firestore-instance", Description: "Query users collection with filters and ordering", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYamlFirestoreQueryCollection(t *testing.T) { want: server.ToolConfigs{ "secure_query_tool": firestorequerycollection.Config{ Name: "secure_query_tool", - Kind: "firestore-query-collection", + Type: "firestore-query-collection", Source: "prod-firestore", Description: "Query collections with authentication", AuthRequired: []string{"google-auth-service", "api-key-service"}, @@ -121,21 +121,21 @@ func TestParseFromYamlMultipleTools(t *testing.T) { want := server.ToolConfigs{ "query_users": firestorequerycollection.Config{ Name: "query_users", - Kind: "firestore-query-collection", + Type: "firestore-query-collection", Source: "users-firestore", Description: "Query user documents with filtering", AuthRequired: []string{"user-auth"}, }, "query_products": firestorequerycollection.Config{ Name: "query_products", - Kind: "firestore-query-collection", + Type: "firestore-query-collection", Source: "products-firestore", Description: "Query product catalog", AuthRequired: []string{}, }, "query_orders": firestorequerycollection.Config{ Name: "query_orders", - Kind: "firestore-query-collection", + Type: "firestore-query-collection", Source: "orders-firestore", Description: "Query customer orders with complex filters", AuthRequired: []string{"user-auth", "admin-auth"}, diff --git a/internal/tools/firestore/firestoreupdatedocument/firestoreupdatedocument.go b/internal/tools/firestore/firestoreupdatedocument/firestoreupdatedocument.go index a791de7a17..d0fdea8217 100644 --- a/internal/tools/firestore/firestoreupdatedocument/firestoreupdatedocument.go +++ b/internal/tools/firestore/firestoreupdatedocument/firestoreupdatedocument.go @@ -36,7 +36,7 @@ const returnDocumentDataKey string = "returnData" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -55,7 +55,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -64,7 +64,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -139,7 +139,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firestore/firestoreupdatedocument/firestoreupdatedocument_test.go b/internal/tools/firestore/firestoreupdatedocument/firestoreupdatedocument_test.go index 3311aeb86e..8a68aa30b1 100644 --- a/internal/tools/firestore/firestoreupdatedocument/firestoreupdatedocument_test.go +++ b/internal/tools/firestore/firestoreupdatedocument/firestoreupdatedocument_test.go @@ -46,7 +46,7 @@ authRequired: `, want: Config{ Name: "test-update-document", - Kind: "firestore-update-document", + Type: "firestore-update-document", Source: "test-firestore", Description: "Update a document in Firestore", AuthRequired: []string{"google-oauth"}, @@ -63,7 +63,7 @@ description: Update a document `, want: Config{ Name: "test-update-document", - Kind: "firestore-update-document", + Type: "firestore-update-document", Source: "test-firestore", Description: "Update a document", }, @@ -102,12 +102,12 @@ kind: [invalid } } -func TestConfig_ToolConfigKind(t *testing.T) { +func TestConfig_ToolConfigType(t *testing.T) { cfg := Config{} - got := cfg.ToolConfigKind() + got := cfg.ToolConfigType() want := "firestore-update-document" if got != want { - t.Fatalf("ToolConfigKind() = %v, want %v", got, want) + t.Fatalf("ToolConfigType() = %v, want %v", got, want) } } @@ -123,7 +123,7 @@ func TestConfig_Initialize(t *testing.T) { name: "valid initialization", config: Config{ Name: "test-update-document", - Kind: "firestore-update-document", + Type: "firestore-update-document", Source: "test-firestore", Description: "Update a document", }, @@ -161,8 +161,8 @@ func TestConfig_Initialize(t *testing.T) { if actualTool.Name != tt.config.Name { t.Fatalf("tool.Name = %v, want %v", actualTool.Name, tt.config.Name) } - if actualTool.Kind != "firestore-update-document" { - t.Fatalf("tool.Kind = %v, want %v", actualTool.Kind, "firestore-update-document") + if actualTool.Type != "firestore-update-document" { + t.Fatalf("tool.Type = %v, want %v", actualTool.Type, "firestore-update-document") } if diff := cmp.Diff(tt.config.AuthRequired, actualTool.AuthRequired); diff != "" { t.Fatalf("AuthRequired mismatch (-want +got):\n%s", diff) diff --git a/internal/tools/firestore/firestorevalidaterules/firestorevalidaterules.go b/internal/tools/firestore/firestorevalidaterules/firestorevalidaterules.go index 9442982e02..44215641b9 100644 --- a/internal/tools/firestore/firestorevalidaterules/firestorevalidaterules.go +++ b/internal/tools/firestore/firestorevalidaterules/firestorevalidaterules.go @@ -35,7 +35,7 @@ const ( func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -107,7 +107,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/firestore/firestorevalidaterules/firestorevalidaterules_test.go b/internal/tools/firestore/firestorevalidaterules/firestorevalidaterules_test.go index f63945d078..ae89e481aa 100644 --- a/internal/tools/firestore/firestorevalidaterules/firestorevalidaterules_test.go +++ b/internal/tools/firestore/firestorevalidaterules/firestorevalidaterules_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlFirestoreValidateRules(t *testing.T) { want: server.ToolConfigs{ "validate_rules_tool": firestorevalidaterules.Config{ Name: "validate_rules_tool", - Kind: "firestore-validate-rules", + Type: "firestore-validate-rules", Source: "my-firestore-instance", Description: "Validate Firestore security rules", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYamlFirestoreValidateRules(t *testing.T) { want: server.ToolConfigs{ "secure_validate_rules": firestorevalidaterules.Config{ Name: "secure_validate_rules", - Kind: "firestore-validate-rules", + Type: "firestore-validate-rules", Source: "prod-firestore", Description: "Validate rules with authentication", AuthRequired: []string{"google-auth-service", "api-key-service"}, @@ -121,21 +121,21 @@ func TestParseFromYamlMultipleTools(t *testing.T) { want := server.ToolConfigs{ "validate_dev_rules": firestorevalidaterules.Config{ Name: "validate_dev_rules", - Kind: "firestore-validate-rules", + Type: "firestore-validate-rules", Source: "dev-firestore", Description: "Validate development environment rules", AuthRequired: []string{"dev-auth"}, }, "validate_staging_rules": firestorevalidaterules.Config{ Name: "validate_staging_rules", - Kind: "firestore-validate-rules", + Type: "firestore-validate-rules", Source: "staging-firestore", Description: "Validate staging environment rules", AuthRequired: []string{}, }, "validate_prod_rules": firestorevalidaterules.Config{ Name: "validate_prod_rules", - Kind: "firestore-validate-rules", + Type: "firestore-validate-rules", Source: "prod-firestore", Description: "Validate production environment rules", AuthRequired: []string{"prod-auth", "admin-auth"}, diff --git a/internal/tools/http/http.go b/internal/tools/http/http.go index 6ba9699e2b..ed6ff1ffce 100644 --- a/internal/tools/http/http.go +++ b/internal/tools/http/http.go @@ -36,7 +36,7 @@ const kind string = "http" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -57,7 +57,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -74,7 +74,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -227,7 +227,7 @@ func getHeaders(headerParams parameters.Parameters, defaultHeaders map[string]st } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/http/http_test.go b/internal/tools/http/http_test.go index 62bacbca4d..812ff53dba 100644 --- a/internal/tools/http/http_test.go +++ b/internal/tools/http/http_test.go @@ -50,7 +50,7 @@ func TestParseFromYamlHTTP(t *testing.T) { want: server.ToolConfigs{ "example_tool": http.Config{ Name: "example_tool", - Kind: "http", + Type: "http", Source: "my-instance", Method: "GET", Path: "search", @@ -109,7 +109,7 @@ func TestParseFromYamlHTTP(t *testing.T) { want: server.ToolConfigs{ "example_tool": http.Config{ Name: "example_tool", - Kind: "http", + Type: "http", Source: "my-instance", Method: "GET", Path: "{{.pathParam}}?name=alice&pet=cat", diff --git a/internal/tools/looker/lookeradddashboardelement/lookeradddashboardelement.go b/internal/tools/looker/lookeradddashboardelement/lookeradddashboardelement.go index 5e354d7fd2..886804ad38 100644 --- a/internal/tools/looker/lookeradddashboardelement/lookeradddashboardelement.go +++ b/internal/tools/looker/lookeradddashboardelement/lookeradddashboardelement.go @@ -33,7 +33,7 @@ const kind string = "looker-add-dashboard-element" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -64,7 +64,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -135,7 +135,7 @@ var ( ) func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -261,7 +261,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -273,7 +273,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookeradddashboardelement/lookeradddashboardelement_test.go b/internal/tools/looker/lookeradddashboardelement/lookeradddashboardelement_test.go index 93c007043f..0adfe6fa29 100644 --- a/internal/tools/looker/lookeradddashboardelement/lookeradddashboardelement_test.go +++ b/internal/tools/looker/lookeradddashboardelement/lookeradddashboardelement_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerAddDashboardElement(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-add-dashboard-element", + Type: "looker-add-dashboard-element", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter.go b/internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter.go index c6c56f85e2..7f004b410a 100644 --- a/internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter.go +++ b/internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter.go @@ -32,7 +32,7 @@ const kind string = "looker-add-dashboard-filter" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -129,7 +129,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -230,7 +230,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -238,7 +238,7 @@ func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (boo } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter_test.go b/internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter_test.go index 43f43dc6c6..c493a14b04 100644 --- a/internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter_test.go +++ b/internal/tools/looker/lookeradddashboardfilter/lookeradddashboardfilter_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerAddDashboardFilter(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-add-dashboard-filter", + Type: "looker-add-dashboard-filter", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics.go b/internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics.go index 94cc18e960..996725d884 100644 --- a/internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics.go +++ b/internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics.go @@ -43,7 +43,7 @@ const instructions = `**INSTRUCTIONS - FOLLOW THESE RULES:** func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -126,7 +126,7 @@ type CAPayload struct { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -136,7 +136,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -216,7 +216,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -309,7 +309,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -561,7 +561,7 @@ func appendMessage(messages []map[string]any, newMessage map[string]any) []map[s } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics_test.go b/internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics_test.go index fbc17e47c4..5d7d4a22d1 100644 --- a/internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics_test.go +++ b/internal/tools/looker/lookerconversationalanalytics/lookerconversationalanalytics_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlLookerConversationalAnalytics(t *testing.T) { want: server.ToolConfigs{ "example_tool": lookerconversationalanalytics.Config{ Name: "example_tool", - Kind: "looker-conversational-analytics", + Type: "looker-conversational-analytics", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookercreateprojectfile/lookercreateprojectfile.go b/internal/tools/looker/lookercreateprojectfile/lookercreateprojectfile.go index b65be502ef..c6477b3529 100644 --- a/internal/tools/looker/lookercreateprojectfile/lookercreateprojectfile.go +++ b/internal/tools/looker/lookercreateprojectfile/lookercreateprojectfile.go @@ -32,7 +32,7 @@ const kind string = "looker-create-project-file" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -111,7 +111,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -169,7 +169,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -181,7 +181,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookercreateprojectfile/lookercreateprojectfile_test.go b/internal/tools/looker/lookercreateprojectfile/lookercreateprojectfile_test.go index bd9b910b4d..5840057626 100644 --- a/internal/tools/looker/lookercreateprojectfile/lookercreateprojectfile_test.go +++ b/internal/tools/looker/lookercreateprojectfile/lookercreateprojectfile_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerCreateProjectFile(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-create-project-file", + Type: "looker-create-project-file", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerdeleteprojectfile/lookerdeleteprojectfile.go b/internal/tools/looker/lookerdeleteprojectfile/lookerdeleteprojectfile.go index b49690c8d3..418466d7e8 100644 --- a/internal/tools/looker/lookerdeleteprojectfile/lookerdeleteprojectfile.go +++ b/internal/tools/looker/lookerdeleteprojectfile/lookerdeleteprojectfile.go @@ -32,7 +32,7 @@ const kind string = "looker-delete-project-file" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -112,7 +112,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -161,7 +161,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -173,7 +173,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerdeleteprojectfile/lookerdeleteprojectfile_test.go b/internal/tools/looker/lookerdeleteprojectfile/lookerdeleteprojectfile_test.go index ff0ab2bf7b..5ae4836635 100644 --- a/internal/tools/looker/lookerdeleteprojectfile/lookerdeleteprojectfile_test.go +++ b/internal/tools/looker/lookerdeleteprojectfile/lookerdeleteprojectfile_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerDeleteProjectFile(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-delete-project-file", + Type: "looker-delete-project-file", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerdevmode/lookerdevmode.go b/internal/tools/looker/lookerdevmode/lookerdevmode.go index 46736125cf..5f989efcf9 100644 --- a/internal/tools/looker/lookerdevmode/lookerdevmode.go +++ b/internal/tools/looker/lookerdevmode/lookerdevmode.go @@ -32,7 +32,7 @@ const kind string = "looker-dev-mode" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -109,7 +109,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -163,7 +163,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -175,7 +175,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerdevmode/lookerdevmode_test.go b/internal/tools/looker/lookerdevmode/lookerdevmode_test.go index dd776f77e2..cb4eb58ec4 100644 --- a/internal/tools/looker/lookerdevmode/lookerdevmode_test.go +++ b/internal/tools/looker/lookerdevmode/lookerdevmode_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerDevMode(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-dev-mode", + Type: "looker-dev-mode", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergenerateembedurl/lookergenerateembedurl.go b/internal/tools/looker/lookergenerateembedurl/lookergenerateembedurl.go index 7a4b9506d3..3988e4ea3d 100644 --- a/internal/tools/looker/lookergenerateembedurl/lookergenerateembedurl.go +++ b/internal/tools/looker/lookergenerateembedurl/lookergenerateembedurl.go @@ -33,7 +33,7 @@ const kind string = "looker-generate-embed-url" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -55,7 +55,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -115,7 +115,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -175,7 +175,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -187,7 +187,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergenerateembedurl/lookergenerateembedurl_test.go b/internal/tools/looker/lookergenerateembedurl/lookergenerateembedurl_test.go index 93dcd0eb88..e0bffd1863 100644 --- a/internal/tools/looker/lookergenerateembedurl/lookergenerateembedurl_test.go +++ b/internal/tools/looker/lookergenerateembedurl/lookergenerateembedurl_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGenerateEmbedUrl(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-generate-embed-url", + Type: "looker-generate-embed-url", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases.go b/internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases.go index 96c80f5cdd..46b6058974 100644 --- a/internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases.go +++ b/internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases.go @@ -31,7 +31,7 @@ const kind string = "looker-get-connection-databases" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -52,7 +52,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -62,7 +62,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -108,7 +108,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -149,7 +149,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -161,7 +161,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases_test.go b/internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases_test.go index 284d4102bb..5969479572 100644 --- a/internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases_test.go +++ b/internal/tools/looker/lookergetconnectiondatabases/lookergetconnectiondatabases_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetConnectionDatabases(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-connection-databases", + Type: "looker-get-connection-databases", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetconnections/lookergetconnections.go b/internal/tools/looker/lookergetconnections/lookergetconnections.go index f6875b3d3b..2bde4707e1 100644 --- a/internal/tools/looker/lookergetconnections/lookergetconnections.go +++ b/internal/tools/looker/lookergetconnections/lookergetconnections.go @@ -32,7 +32,7 @@ const kind string = "looker-get-connections" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -108,7 +108,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -168,7 +168,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -180,7 +180,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetconnections/lookergetconnections_test.go b/internal/tools/looker/lookergetconnections/lookergetconnections_test.go index b921a57e94..2f161bb05d 100644 --- a/internal/tools/looker/lookergetconnections/lookergetconnections_test.go +++ b/internal/tools/looker/lookergetconnections/lookergetconnections_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetConnections(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-connections", + Type: "looker-get-connections", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas.go b/internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas.go index 472bf3166f..f91e511369 100644 --- a/internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas.go +++ b/internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas.go @@ -31,7 +31,7 @@ const kind string = "looker-get-connection-schemas" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -52,7 +52,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -62,7 +62,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -109,7 +109,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -155,7 +155,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -167,7 +167,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas_test.go b/internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas_test.go index 1c2951102f..db1c24c64d 100644 --- a/internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas_test.go +++ b/internal/tools/looker/lookergetconnectionschemas/lookergetconnectionschemas_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetConnectionSchemas(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-connection-schemas", + Type: "looker-get-connection-schemas", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetconnectiontablecolumns/lookergetconnectiontablecolumns.go b/internal/tools/looker/lookergetconnectiontablecolumns/lookergetconnectiontablecolumns.go index 1fdeadd1fd..d29e3a23a1 100644 --- a/internal/tools/looker/lookergetconnectiontablecolumns/lookergetconnectiontablecolumns.go +++ b/internal/tools/looker/lookergetconnectiontablecolumns/lookergetconnectiontablecolumns.go @@ -32,7 +32,7 @@ const kind string = "looker-get-connection-table-columns" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -112,7 +112,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -192,7 +192,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -204,7 +204,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetconnectiontablecolumns/lookergetconnectiontablecolumns_test.go b/internal/tools/looker/lookergetconnectiontablecolumns/lookergetconnectiontablecolumns_test.go index 3242a31ffb..e1acae589f 100644 --- a/internal/tools/looker/lookergetconnectiontablecolumns/lookergetconnectiontablecolumns_test.go +++ b/internal/tools/looker/lookergetconnectiontablecolumns/lookergetconnectiontablecolumns_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetConnectionTableColumns(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-connection-table-columns", + Type: "looker-get-connection-table-columns", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables.go b/internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables.go index dfdbd120e4..d65fb760cd 100644 --- a/internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables.go +++ b/internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables.go @@ -32,7 +32,7 @@ const kind string = "looker-get-connection-tables" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -111,7 +111,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -183,7 +183,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -195,7 +195,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables_test.go b/internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables_test.go index 1b6ec50aa0..187b959259 100644 --- a/internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables_test.go +++ b/internal/tools/looker/lookergetconnectiontables/lookergetconnectiontables_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetConnectionTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-connection-tables", + Type: "looker-get-connection-tables", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetdashboards/lookergetdashboards.go b/internal/tools/looker/lookergetdashboards/lookergetdashboards.go index 60b5e82503..70bf701844 100644 --- a/internal/tools/looker/lookergetdashboards/lookergetdashboards.go +++ b/internal/tools/looker/lookergetdashboards/lookergetdashboards.go @@ -32,7 +32,7 @@ const kind string = "looker-get-dashboards" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -117,7 +117,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -194,7 +194,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -206,7 +206,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetdashboards/lookergetdashboards_test.go b/internal/tools/looker/lookergetdashboards/lookergetdashboards_test.go index b3eba2af62..a9e5cd74d0 100644 --- a/internal/tools/looker/lookergetdashboards/lookergetdashboards_test.go +++ b/internal/tools/looker/lookergetdashboards/lookergetdashboards_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetDashboards(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-dashboards", + Type: "looker-get-dashboards", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetdimensions/lookergetdimensions.go b/internal/tools/looker/lookergetdimensions/lookergetdimensions.go index 1144a8c420..e7f8c9a58f 100644 --- a/internal/tools/looker/lookergetdimensions/lookergetdimensions.go +++ b/internal/tools/looker/lookergetdimensions/lookergetdimensions.go @@ -33,7 +33,7 @@ const kind string = "looker-get-dimensions" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -55,7 +55,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -110,7 +110,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -169,7 +169,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -181,7 +181,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetdimensions/lookergetdimensions_test.go b/internal/tools/looker/lookergetdimensions/lookergetdimensions_test.go index 53dba27533..ca79a2a996 100644 --- a/internal/tools/looker/lookergetdimensions/lookergetdimensions_test.go +++ b/internal/tools/looker/lookergetdimensions/lookergetdimensions_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetDimensions(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-dimensions", + Type: "looker-get-dimensions", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetexplores/lookergetexplores.go b/internal/tools/looker/lookergetexplores/lookergetexplores.go index 39996152ec..f17ad3779c 100644 --- a/internal/tools/looker/lookergetexplores/lookergetexplores.go +++ b/internal/tools/looker/lookergetexplores/lookergetexplores.go @@ -32,7 +32,7 @@ const kind string = "looker-get-explores" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -64,7 +64,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -110,7 +110,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -178,7 +178,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -190,7 +190,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetexplores/lookergetexplores_test.go b/internal/tools/looker/lookergetexplores/lookergetexplores_test.go index 1c0b0d72b3..5b5b979e62 100644 --- a/internal/tools/looker/lookergetexplores/lookergetexplores_test.go +++ b/internal/tools/looker/lookergetexplores/lookergetexplores_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetExplores(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-explores", + Type: "looker-get-explores", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetfilters/lookergetfilters.go b/internal/tools/looker/lookergetfilters/lookergetfilters.go index 880680bbdb..4928954464 100644 --- a/internal/tools/looker/lookergetfilters/lookergetfilters.go +++ b/internal/tools/looker/lookergetfilters/lookergetfilters.go @@ -33,7 +33,7 @@ const kind string = "looker-get-filters" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -55,7 +55,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -110,7 +110,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -169,7 +169,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -181,7 +181,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetfilters/lookergetfilters_test.go b/internal/tools/looker/lookergetfilters/lookergetfilters_test.go index 0cec5dd0bb..b899a009cb 100644 --- a/internal/tools/looker/lookergetfilters/lookergetfilters_test.go +++ b/internal/tools/looker/lookergetfilters/lookergetfilters_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetFilters(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-filters", + Type: "looker-get-filters", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetlooks/lookergetlooks.go b/internal/tools/looker/lookergetlooks/lookergetlooks.go index 9a3a8a5456..91fe0c9f1a 100644 --- a/internal/tools/looker/lookergetlooks/lookergetlooks.go +++ b/internal/tools/looker/lookergetlooks/lookergetlooks.go @@ -32,7 +32,7 @@ const kind string = "looker-get-looks" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -117,7 +117,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -194,7 +194,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -206,7 +206,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetlooks/lookergetlooks_test.go b/internal/tools/looker/lookergetlooks/lookergetlooks_test.go index b6a4f23dd7..34d9b56885 100644 --- a/internal/tools/looker/lookergetlooks/lookergetlooks_test.go +++ b/internal/tools/looker/lookergetlooks/lookergetlooks_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetLooks(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-looks", + Type: "looker-get-looks", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetmeasures/lookergetmeasures.go b/internal/tools/looker/lookergetmeasures/lookergetmeasures.go index 9ca671841f..84e8e2b1f0 100644 --- a/internal/tools/looker/lookergetmeasures/lookergetmeasures.go +++ b/internal/tools/looker/lookergetmeasures/lookergetmeasures.go @@ -33,7 +33,7 @@ const kind string = "looker-get-measures" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -55,7 +55,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -110,7 +110,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -169,7 +169,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -181,7 +181,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetmeasures/lookergetmeasures_test.go b/internal/tools/looker/lookergetmeasures/lookergetmeasures_test.go index 7587b4cd3c..b47a64e103 100644 --- a/internal/tools/looker/lookergetmeasures/lookergetmeasures_test.go +++ b/internal/tools/looker/lookergetmeasures/lookergetmeasures_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetMeasures(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-measures", + Type: "looker-get-measures", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetmodels/lookergetmodels.go b/internal/tools/looker/lookergetmodels/lookergetmodels.go index 3ba6c30f91..2c2bfc6819 100644 --- a/internal/tools/looker/lookergetmodels/lookergetmodels.go +++ b/internal/tools/looker/lookergetmodels/lookergetmodels.go @@ -32,7 +32,7 @@ const kind string = "looker-get-models" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -64,7 +64,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -109,7 +109,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -170,7 +170,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -182,7 +182,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetmodels/lookergetmodels_test.go b/internal/tools/looker/lookergetmodels/lookergetmodels_test.go index b28c02c317..fe24406e38 100644 --- a/internal/tools/looker/lookergetmodels/lookergetmodels_test.go +++ b/internal/tools/looker/lookergetmodels/lookergetmodels_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetModels(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-models", + Type: "looker-get-models", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetparameters/lookergetparameters.go b/internal/tools/looker/lookergetparameters/lookergetparameters.go index 3dd0acb833..a3ea51484c 100644 --- a/internal/tools/looker/lookergetparameters/lookergetparameters.go +++ b/internal/tools/looker/lookergetparameters/lookergetparameters.go @@ -33,7 +33,7 @@ const kind string = "looker-get-parameters" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -55,7 +55,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -110,7 +110,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -169,7 +169,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -181,7 +181,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetparameters/lookergetparameters_test.go b/internal/tools/looker/lookergetparameters/lookergetparameters_test.go index 3c4679e8ec..113d93b68d 100644 --- a/internal/tools/looker/lookergetparameters/lookergetparameters_test.go +++ b/internal/tools/looker/lookergetparameters/lookergetparameters_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetParameters(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-parameters", + Type: "looker-get-parameters", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetprojectfile/lookergetprojectfile.go b/internal/tools/looker/lookergetprojectfile/lookergetprojectfile.go index 1843860e75..82df7f2f44 100644 --- a/internal/tools/looker/lookergetprojectfile/lookergetprojectfile.go +++ b/internal/tools/looker/lookergetprojectfile/lookergetprojectfile.go @@ -33,7 +33,7 @@ const kind string = "looker-get-project-file" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -64,7 +64,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -111,7 +111,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -166,7 +166,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -178,7 +178,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetprojectfile/lookergetprojectfile_test.go b/internal/tools/looker/lookergetprojectfile/lookergetprojectfile_test.go index cfd182c1d6..4d6d25bd1a 100644 --- a/internal/tools/looker/lookergetprojectfile/lookergetprojectfile_test.go +++ b/internal/tools/looker/lookergetprojectfile/lookergetprojectfile_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetProjectFile(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-project-file", + Type: "looker-get-project-file", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles.go b/internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles.go index d6e42ac451..85c1b2534c 100644 --- a/internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles.go +++ b/internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles.go @@ -32,7 +32,7 @@ const kind string = "looker-get-project-files" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -109,7 +109,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -182,7 +182,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -194,7 +194,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles_test.go b/internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles_test.go index 83a315b449..dd7eb873d6 100644 --- a/internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles_test.go +++ b/internal/tools/looker/lookergetprojectfiles/lookergetprojectfiles_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetProjectFiles(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-project-files", + Type: "looker-get-project-files", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookergetprojects/lookergetprojects.go b/internal/tools/looker/lookergetprojects/lookergetprojects.go index fd7f0288da..697b85f44a 100644 --- a/internal/tools/looker/lookergetprojects/lookergetprojects.go +++ b/internal/tools/looker/lookergetprojects/lookergetprojects.go @@ -32,7 +32,7 @@ const kind string = "looker-get-projects" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -108,7 +108,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -159,7 +159,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -171,7 +171,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookergetprojects/lookergetprojects_test.go b/internal/tools/looker/lookergetprojects/lookergetprojects_test.go index 3a25be54d5..137291bda9 100644 --- a/internal/tools/looker/lookergetprojects/lookergetprojects_test.go +++ b/internal/tools/looker/lookergetprojects/lookergetprojects_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerGetProjects(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-get-projects", + Type: "looker-get-projects", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerhealthanalyze/lookerhealthanalyze.go b/internal/tools/looker/lookerhealthanalyze/lookerhealthanalyze.go index 1f3ef98d05..530eb11c1b 100644 --- a/internal/tools/looker/lookerhealthanalyze/lookerhealthanalyze.go +++ b/internal/tools/looker/lookerhealthanalyze/lookerhealthanalyze.go @@ -38,7 +38,7 @@ const kind string = "looker-health-analyze" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -59,7 +59,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -69,7 +69,7 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -126,7 +126,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -210,7 +210,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -569,7 +569,7 @@ func (t *analyzeTool) explores(ctx context.Context, model, explore string) ([]ma // ================================================================================================================= func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerhealthanalyze/lookerhealthanalyze_test.go b/internal/tools/looker/lookerhealthanalyze/lookerhealthanalyze_test.go index 7d41a972e8..2ef69c92eb 100644 --- a/internal/tools/looker/lookerhealthanalyze/lookerhealthanalyze_test.go +++ b/internal/tools/looker/lookerhealthanalyze/lookerhealthanalyze_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerHealthAnalyze(t *testing.T) { want: server.ToolConfigs{ "example_tool": lha.Config{ Name: "example_tool", - Kind: "looker-health-analyze", + Type: "looker-health-analyze", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerhealthpulse/lookerhealthpulse.go b/internal/tools/looker/lookerhealthpulse/lookerhealthpulse.go index 08556114d4..f6887b6c2c 100644 --- a/internal/tools/looker/lookerhealthpulse/lookerhealthpulse.go +++ b/internal/tools/looker/lookerhealthpulse/lookerhealthpulse.go @@ -38,7 +38,7 @@ const kind string = "looker-health-pulse" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -59,7 +59,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -69,7 +69,7 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -117,7 +117,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -174,7 +174,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -469,7 +469,7 @@ func (t *pulseTool) checkLegacyFeatures(ctx context.Context, source compatibleSo // ================================================================================================================= func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerhealthpulse/lookerhealthpulse_test.go b/internal/tools/looker/lookerhealthpulse/lookerhealthpulse_test.go index 12a7b69a77..6e635205b7 100644 --- a/internal/tools/looker/lookerhealthpulse/lookerhealthpulse_test.go +++ b/internal/tools/looker/lookerhealthpulse/lookerhealthpulse_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerHealthPulse(t *testing.T) { want: server.ToolConfigs{ "example_tool": lhp.Config{ Name: "example_tool", - Kind: "looker-health-pulse", + Type: "looker-health-pulse", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum.go b/internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum.go index bb4e3c9967..93b7f0f53f 100644 --- a/internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum.go +++ b/internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum.go @@ -38,7 +38,7 @@ const kind string = "looker-health-vacuum" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -59,7 +59,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -69,7 +69,7 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -126,7 +126,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -188,7 +188,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -473,7 +473,7 @@ func (t *vacuumTool) getUsedExploreFields(ctx context.Context, model, explore st // ================================================================================================================= func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum_test.go b/internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum_test.go index 59fd2f2121..c2864ca8f7 100644 --- a/internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum_test.go +++ b/internal/tools/looker/lookerhealthvacuum/lookerhealthvacuum_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerHealthVacuum(t *testing.T) { want: server.ToolConfigs{ "example_tool": lhv.Config{ Name: "example_tool", - Kind: "looker-health-vacuum", + Type: "looker-health-vacuum", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookermakedashboard/lookermakedashboard.go b/internal/tools/looker/lookermakedashboard/lookermakedashboard.go index 13b0fc54b6..2bdbfa062e 100644 --- a/internal/tools/looker/lookermakedashboard/lookermakedashboard.go +++ b/internal/tools/looker/lookermakedashboard/lookermakedashboard.go @@ -34,7 +34,7 @@ const kind string = "looker-make-dashboard" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -55,7 +55,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -117,7 +117,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -214,7 +214,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -226,7 +226,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookermakedashboard/lookermakedashboard_test.go b/internal/tools/looker/lookermakedashboard/lookermakedashboard_test.go index 2da79199ed..05fbe6103d 100644 --- a/internal/tools/looker/lookermakedashboard/lookermakedashboard_test.go +++ b/internal/tools/looker/lookermakedashboard/lookermakedashboard_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerMakeDashboard(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-make-dashboard", + Type: "looker-make-dashboard", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookermakelook/lookermakelook.go b/internal/tools/looker/lookermakelook/lookermakelook.go index 43509cd5cc..748a5255e1 100644 --- a/internal/tools/looker/lookermakelook/lookermakelook.go +++ b/internal/tools/looker/lookermakelook/lookermakelook.go @@ -35,7 +35,7 @@ const kind string = "looker-make-look" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -56,7 +56,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -66,7 +66,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -124,7 +124,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -235,7 +235,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -247,7 +247,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookermakelook/lookermakelook_test.go b/internal/tools/looker/lookermakelook/lookermakelook_test.go index f6a3bd71f5..c0cf31821c 100644 --- a/internal/tools/looker/lookermakelook/lookermakelook_test.go +++ b/internal/tools/looker/lookermakelook/lookermakelook_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerMakeLook(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-make-look", + Type: "looker-make-look", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerquery/lookerquery.go b/internal/tools/looker/lookerquery/lookerquery.go index 7120f46f02..1da8cd4fc0 100644 --- a/internal/tools/looker/lookerquery/lookerquery.go +++ b/internal/tools/looker/lookerquery/lookerquery.go @@ -34,7 +34,7 @@ const kind string = "looker-query" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -55,7 +55,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -110,7 +110,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -162,7 +162,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -174,7 +174,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerquery/lookerquery_test.go b/internal/tools/looker/lookerquery/lookerquery_test.go index e204096e50..cec149233d 100644 --- a/internal/tools/looker/lookerquery/lookerquery_test.go +++ b/internal/tools/looker/lookerquery/lookerquery_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-query", + Type: "looker-query", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerquerysql/lookerquerysql.go b/internal/tools/looker/lookerquerysql/lookerquerysql.go index b587311928..2b17bb1b9a 100644 --- a/internal/tools/looker/lookerquerysql/lookerquerysql.go +++ b/internal/tools/looker/lookerquerysql/lookerquerysql.go @@ -33,7 +33,7 @@ const kind string = "looker-query-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -64,7 +64,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -109,7 +109,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -152,7 +152,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -164,7 +164,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerquerysql/lookerquerysql_test.go b/internal/tools/looker/lookerquerysql/lookerquerysql_test.go index bb8e25d7a4..55906adae2 100644 --- a/internal/tools/looker/lookerquerysql/lookerquerysql_test.go +++ b/internal/tools/looker/lookerquerysql/lookerquerysql_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerQuerySql(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-query-sql", + Type: "looker-query-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerqueryurl/lookerqueryurl.go b/internal/tools/looker/lookerqueryurl/lookerqueryurl.go index 9cc5f4f507..5442ebbac1 100644 --- a/internal/tools/looker/lookerqueryurl/lookerqueryurl.go +++ b/internal/tools/looker/lookerqueryurl/lookerqueryurl.go @@ -33,7 +33,7 @@ const kind string = "looker-query-url" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -54,7 +54,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -64,7 +64,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -116,7 +116,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -181,7 +181,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -193,7 +193,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerqueryurl/lookerqueryurl_test.go b/internal/tools/looker/lookerqueryurl/lookerqueryurl_test.go index 740e3aaa3e..071db1c46f 100644 --- a/internal/tools/looker/lookerqueryurl/lookerqueryurl_test.go +++ b/internal/tools/looker/lookerqueryurl/lookerqueryurl_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerQueryUrl(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-query-url", + Type: "looker-query-url", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerrundashboard/lookerrundashboard.go b/internal/tools/looker/lookerrundashboard/lookerrundashboard.go index 25081e5da7..81c621da86 100644 --- a/internal/tools/looker/lookerrundashboard/lookerrundashboard.go +++ b/internal/tools/looker/lookerrundashboard/lookerrundashboard.go @@ -35,7 +35,7 @@ const kind string = "looker-run-dashboard" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -56,7 +56,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -66,7 +66,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -115,7 +115,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -178,7 +178,7 @@ func (t Tool) McpManifest() tools.McpManifest { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -279,7 +279,7 @@ func merge(channels ...<-chan map[string]any) <-chan map[string]any { } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerrundashboard/lookerrundashboard_test.go b/internal/tools/looker/lookerrundashboard/lookerrundashboard_test.go index 6726e04545..cef2619b02 100644 --- a/internal/tools/looker/lookerrundashboard/lookerrundashboard_test.go +++ b/internal/tools/looker/lookerrundashboard/lookerrundashboard_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerRunDashboard(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-run-dashboard", + Type: "looker-run-dashboard", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerrunlook/lookerrunlook.go b/internal/tools/looker/lookerrunlook/lookerrunlook.go index c1c7123509..6db9cd88a3 100644 --- a/internal/tools/looker/lookerrunlook/lookerrunlook.go +++ b/internal/tools/looker/lookerrunlook/lookerrunlook.go @@ -34,7 +34,7 @@ const kind string = "looker-run-look" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -55,7 +55,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -116,7 +116,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -191,7 +191,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -199,7 +199,7 @@ func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (boo } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerrunlook/lookerrunlook_test.go b/internal/tools/looker/lookerrunlook/lookerrunlook_test.go index ac2dfbe99c..bff1f9d830 100644 --- a/internal/tools/looker/lookerrunlook/lookerrunlook_test.go +++ b/internal/tools/looker/lookerrunlook/lookerrunlook_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerRunLook(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-run-look", + Type: "looker-run-look", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/looker/lookerupdateprojectfile/lookerupdateprojectfile.go b/internal/tools/looker/lookerupdateprojectfile/lookerupdateprojectfile.go index 03701268ab..002739ff51 100644 --- a/internal/tools/looker/lookerupdateprojectfile/lookerupdateprojectfile.go +++ b/internal/tools/looker/lookerupdateprojectfile/lookerupdateprojectfile.go @@ -32,7 +32,7 @@ const kind string = "looker-update-project-file" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -52,7 +52,7 @@ type compatibleSource interface { } type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -62,7 +62,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -112,7 +112,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } @@ -174,7 +174,7 @@ func (t Tool) Authorized(verifiedAuthServices []string) bool { } func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (bool, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return false, err } @@ -182,7 +182,7 @@ func (t Tool) RequiresClientAuthorization(resourceMgr tools.SourceProvider) (boo } func (t Tool) GetAuthTokenHeaderName(resourceMgr tools.SourceProvider) (string, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return "", err } diff --git a/internal/tools/looker/lookerupdateprojectfile/lookerupdateprojectfile_test.go b/internal/tools/looker/lookerupdateprojectfile/lookerupdateprojectfile_test.go index fef23faab7..8b7e0ecfe7 100644 --- a/internal/tools/looker/lookerupdateprojectfile/lookerupdateprojectfile_test.go +++ b/internal/tools/looker/lookerupdateprojectfile/lookerupdateprojectfile_test.go @@ -47,7 +47,7 @@ func TestParseFromYamlLookerUpdateProjectFile(t *testing.T) { want: server.ToolConfigs{ "example_tool": lkr.Config{ Name: "example_tool", - Kind: "looker-update-project-file", + Type: "looker-update-project-file", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql.go b/internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql.go index f93097e809..352531aa97 100644 --- a/internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql.go +++ b/internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql.go @@ -30,7 +30,7 @@ const kind string = "mindsdb-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -98,7 +98,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql_test.go b/internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql_test.go index 4c5f2b84cb..d376731b6b 100644 --- a/internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql_test.go +++ b/internal/tools/mindsdb/mindsdbexecutesql/mindsdbexecutesql_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mindsdbexecutesql.Config{ Name: "example_tool", - Kind: "mindsdb-execute-sql", + Type: "mindsdb-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/mindsdb/mindsdbsql/mindsdbsql.go b/internal/tools/mindsdb/mindsdbsql/mindsdbsql.go index ee297865c6..414d992fe2 100644 --- a/internal/tools/mindsdb/mindsdbsql/mindsdbsql.go +++ b/internal/tools/mindsdb/mindsdbsql/mindsdbsql.go @@ -30,7 +30,7 @@ const kind string = "mindsdb-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -100,7 +100,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mindsdb/mindsdbsql/mindsdbsql_test.go b/internal/tools/mindsdb/mindsdbsql/mindsdbsql_test.go index 3493717391..ad96f53418 100644 --- a/internal/tools/mindsdb/mindsdbsql/mindsdbsql_test.go +++ b/internal/tools/mindsdb/mindsdbsql/mindsdbsql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlmindsdbsql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mindsdbsql.Config{ Name: "example_tool", - Kind: "mindsdb-sql", + Type: "mindsdb-sql", Source: "my-mindsdbsql-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -139,7 +139,7 @@ func TestParseFromYamlWithTemplateParamsmindsdbsql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mindsdbsql.Config{ Name: "example_tool", - Kind: "mindsdb-sql", + Type: "mindsdb-sql", Source: "my-mindsdbsql-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/mongodb/mongodbaggregate/mongodbaggregate.go b/internal/tools/mongodb/mongodbaggregate/mongodbaggregate.go index 00bf5641aa..08346eeb11 100644 --- a/internal/tools/mongodb/mongodbaggregate/mongodbaggregate.go +++ b/internal/tools/mongodb/mongodbaggregate/mongodbaggregate.go @@ -31,7 +31,7 @@ const kind string = "mongodb-aggregate" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` Description string `yaml:"description" validate:"required"` @@ -65,7 +65,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -103,7 +103,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mongodb/mongodbaggregate/mongodbaggregate_test.go b/internal/tools/mongodb/mongodbaggregate/mongodbaggregate_test.go index 266ac5e982..24a6a186f2 100644 --- a/internal/tools/mongodb/mongodbaggregate/mongodbaggregate_test.go +++ b/internal/tools/mongodb/mongodbaggregate/mongodbaggregate_test.go @@ -58,7 +58,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbaggregate.Config{ Name: "example_tool", - Kind: "mongodb-aggregate", + Type: "mongodb-aggregate", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", diff --git a/internal/tools/mongodb/mongodbdeletemany/mongodbdeletemany.go b/internal/tools/mongodb/mongodbdeletemany/mongodbdeletemany.go index 29a2a33495..cb1fc27eb9 100644 --- a/internal/tools/mongodb/mongodbdeletemany/mongodbdeletemany.go +++ b/internal/tools/mongodb/mongodbdeletemany/mongodbdeletemany.go @@ -31,7 +31,7 @@ const kind string = "mongodb-delete-many" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` Description string `yaml:"description" validate:"required"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -107,7 +107,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mongodb/mongodbdeletemany/mongodbdeletemany_test.go b/internal/tools/mongodb/mongodbdeletemany/mongodbdeletemany_test.go index e5861949cf..ea8e9bfd3b 100644 --- a/internal/tools/mongodb/mongodbdeletemany/mongodbdeletemany_test.go +++ b/internal/tools/mongodb/mongodbdeletemany/mongodbdeletemany_test.go @@ -57,7 +57,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbdeletemany.Config{ Name: "example_tool", - Kind: "mongodb-delete-many", + Type: "mongodb-delete-many", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", diff --git a/internal/tools/mongodb/mongodbdeleteone/mongodbdeleteone.go b/internal/tools/mongodb/mongodbdeleteone/mongodbdeleteone.go index 2d761d83ed..b56b12b694 100644 --- a/internal/tools/mongodb/mongodbdeleteone/mongodbdeleteone.go +++ b/internal/tools/mongodb/mongodbdeleteone/mongodbdeleteone.go @@ -31,7 +31,7 @@ const kind string = "mongodb-delete-one" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` Description string `yaml:"description" validate:"required"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -107,7 +107,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mongodb/mongodbdeleteone/mongodbdeleteone_test.go b/internal/tools/mongodb/mongodbdeleteone/mongodbdeleteone_test.go index 4aa99da297..12119afd07 100644 --- a/internal/tools/mongodb/mongodbdeleteone/mongodbdeleteone_test.go +++ b/internal/tools/mongodb/mongodbdeleteone/mongodbdeleteone_test.go @@ -57,7 +57,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbdeleteone.Config{ Name: "example_tool", - Kind: "mongodb-delete-one", + Type: "mongodb-delete-one", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", diff --git a/internal/tools/mongodb/mongodbfind/mongodbfind.go b/internal/tools/mongodb/mongodbfind/mongodbfind.go index 12ccd84636..ca5c820b14 100644 --- a/internal/tools/mongodb/mongodbfind/mongodbfind.go +++ b/internal/tools/mongodb/mongodbfind/mongodbfind.go @@ -34,7 +34,7 @@ const kind string = "mongodb-find" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -53,7 +53,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` Description string `yaml:"description" validate:"required"` @@ -71,7 +71,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -158,7 +158,7 @@ func getOptions(ctx context.Context, sortParameters parameters.Parameters, proje } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mongodb/mongodbfind/mongodbfind_test.go b/internal/tools/mongodb/mongodbfind/mongodbfind_test.go index 6b56d9c7c4..3217421a2f 100644 --- a/internal/tools/mongodb/mongodbfind/mongodbfind_test.go +++ b/internal/tools/mongodb/mongodbfind/mongodbfind_test.go @@ -63,7 +63,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbfind.Config{ Name: "example_tool", - Kind: "mongodb-find", + Type: "mongodb-find", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", diff --git a/internal/tools/mongodb/mongodbfindone/mongodbfindone.go b/internal/tools/mongodb/mongodbfindone/mongodbfindone.go index e9f1555c66..87131d9319 100644 --- a/internal/tools/mongodb/mongodbfindone/mongodbfindone.go +++ b/internal/tools/mongodb/mongodbfindone/mongodbfindone.go @@ -33,7 +33,7 @@ const kind string = "mongodb-find-one" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -52,7 +52,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` Description string `yaml:"description" validate:"required"` @@ -67,7 +67,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -111,7 +111,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mongodb/mongodbfindone/mongodbfindone_test.go b/internal/tools/mongodb/mongodbfindone/mongodbfindone_test.go index a8d5b9bfc0..4aa909d60f 100644 --- a/internal/tools/mongodb/mongodbfindone/mongodbfindone_test.go +++ b/internal/tools/mongodb/mongodbfindone/mongodbfindone_test.go @@ -60,7 +60,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbfindone.Config{ Name: "example_tool", - Kind: "mongodb-find-one", + Type: "mongodb-find-one", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", diff --git a/internal/tools/mongodb/mongodbinsertmany/mongodbinsertmany.go b/internal/tools/mongodb/mongodbinsertmany/mongodbinsertmany.go index 0dc11a230b..4c2f4fdfa9 100644 --- a/internal/tools/mongodb/mongodbinsertmany/mongodbinsertmany.go +++ b/internal/tools/mongodb/mongodbinsertmany/mongodbinsertmany.go @@ -32,7 +32,7 @@ const paramDataKey = "data" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` Description string `yaml:"description" validate:"required"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -101,7 +101,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mongodb/mongodbinsertmany/mongodbinsertmany_test.go b/internal/tools/mongodb/mongodbinsertmany/mongodbinsertmany_test.go index 19ac3ce0c1..895e5c62ce 100644 --- a/internal/tools/mongodb/mongodbinsertmany/mongodbinsertmany_test.go +++ b/internal/tools/mongodb/mongodbinsertmany/mongodbinsertmany_test.go @@ -50,7 +50,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbinsertmany.Config{ Name: "example_tool", - Kind: "mongodb-insert-many", + Type: "mongodb-insert-many", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", @@ -75,7 +75,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbinsertmany.Config{ Name: "example_tool", - Kind: "mongodb-insert-many", + Type: "mongodb-insert-many", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", @@ -100,7 +100,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbinsertmany.Config{ Name: "example_tool", - Kind: "mongodb-insert-many", + Type: "mongodb-insert-many", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", diff --git a/internal/tools/mongodb/mongodbinsertone/mongodbinsertone.go b/internal/tools/mongodb/mongodbinsertone/mongodbinsertone.go index a93589c053..b044de37e7 100644 --- a/internal/tools/mongodb/mongodbinsertone/mongodbinsertone.go +++ b/internal/tools/mongodb/mongodbinsertone/mongodbinsertone.go @@ -32,7 +32,7 @@ const dataParamsKey = "data" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` Description string `yaml:"description" validate:"required"` @@ -63,7 +63,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -102,7 +102,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mongodb/mongodbinsertone/mongodbinsertone_test.go b/internal/tools/mongodb/mongodbinsertone/mongodbinsertone_test.go index a61dde20b0..32ee276ad9 100644 --- a/internal/tools/mongodb/mongodbinsertone/mongodbinsertone_test.go +++ b/internal/tools/mongodb/mongodbinsertone/mongodbinsertone_test.go @@ -50,7 +50,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbinsertone.Config{ Name: "example_tool", - Kind: "mongodb-insert-one", + Type: "mongodb-insert-one", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", @@ -75,7 +75,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbinsertone.Config{ Name: "example_tool", - Kind: "mongodb-insert-one", + Type: "mongodb-insert-one", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", @@ -100,7 +100,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbinsertone.Config{ Name: "example_tool", - Kind: "mongodb-insert-one", + Type: "mongodb-insert-one", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", diff --git a/internal/tools/mongodb/mongodbupdatemany/mongodbupdatemany.go b/internal/tools/mongodb/mongodbupdatemany/mongodbupdatemany.go index b80bc4972e..f4b94f4dc0 100644 --- a/internal/tools/mongodb/mongodbupdatemany/mongodbupdatemany.go +++ b/internal/tools/mongodb/mongodbupdatemany/mongodbupdatemany.go @@ -30,7 +30,7 @@ const kind string = "mongodb-update-many" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` Description string `yaml:"description" validate:"required"` @@ -66,7 +66,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -110,7 +110,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mongodb/mongodbupdatemany/mongodbupdatemany_test.go b/internal/tools/mongodb/mongodbupdatemany/mongodbupdatemany_test.go index b7353afe08..690abb6e2d 100644 --- a/internal/tools/mongodb/mongodbupdatemany/mongodbupdatemany_test.go +++ b/internal/tools/mongodb/mongodbupdatemany/mongodbupdatemany_test.go @@ -63,7 +63,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbupdatemany.Config{ Name: "example_tool", - Kind: "mongodb-update-many", + Type: "mongodb-update-many", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", @@ -120,7 +120,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbupdatemany.Config{ Name: "example_tool", - Kind: "mongodb-update-many", + Type: "mongodb-update-many", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", @@ -177,7 +177,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbupdatemany.Config{ Name: "example_tool", - Kind: "mongodb-update-many", + Type: "mongodb-update-many", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", diff --git a/internal/tools/mongodb/mongodbupdateone/mongodbupdateone.go b/internal/tools/mongodb/mongodbupdateone/mongodbupdateone.go index d3236992e8..5ff4d21aad 100644 --- a/internal/tools/mongodb/mongodbupdateone/mongodbupdateone.go +++ b/internal/tools/mongodb/mongodbupdateone/mongodbupdateone.go @@ -30,7 +30,7 @@ const kind string = "mongodb-update-one" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` AuthRequired []string `yaml:"authRequired" validate:"required"` Description string `yaml:"description" validate:"required"` @@ -67,7 +67,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -111,7 +111,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mongodb/mongodbupdateone/mongodbupdateone_test.go b/internal/tools/mongodb/mongodbupdateone/mongodbupdateone_test.go index b450892fb2..6fd539f936 100644 --- a/internal/tools/mongodb/mongodbupdateone/mongodbupdateone_test.go +++ b/internal/tools/mongodb/mongodbupdateone/mongodbupdateone_test.go @@ -64,7 +64,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbupdateone.Config{ Name: "example_tool", - Kind: "mongodb-update-one", + Type: "mongodb-update-one", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", @@ -123,7 +123,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbupdateone.Config{ Name: "example_tool", - Kind: "mongodb-update-one", + Type: "mongodb-update-one", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", @@ -182,7 +182,7 @@ func TestParseFromYamlMongoQuery(t *testing.T) { want: server.ToolConfigs{ "example_tool": mongodbupdateone.Config{ Name: "example_tool", - Kind: "mongodb-update-one", + Type: "mongodb-update-one", Source: "my-instance", AuthRequired: []string{}, Database: "test_db", diff --git a/internal/tools/mssql/mssqlexecutesql/mssqlexecutesql.go b/internal/tools/mssql/mssqlexecutesql/mssqlexecutesql.go index efa43cec03..78439878d8 100644 --- a/internal/tools/mssql/mssqlexecutesql/mssqlexecutesql.go +++ b/internal/tools/mssql/mssqlexecutesql/mssqlexecutesql.go @@ -31,7 +31,7 @@ const kind string = "mssql-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -59,7 +59,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -90,7 +90,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mssql/mssqlexecutesql/mssqlexecutesql_test.go b/internal/tools/mssql/mssqlexecutesql/mssqlexecutesql_test.go index 5042b54215..57f9dfe70b 100644 --- a/internal/tools/mssql/mssqlexecutesql/mssqlexecutesql_test.go +++ b/internal/tools/mssql/mssqlexecutesql/mssqlexecutesql_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mssqlexecutesql.Config{ Name: "example_tool", - Kind: "mssql-execute-sql", + Type: "mssql-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/mssql/mssqllisttables/mssqllisttables.go b/internal/tools/mssql/mssqllisttables/mssqllisttables.go index 82f987b9a5..23b38ad363 100644 --- a/internal/tools/mssql/mssqllisttables/mssqllisttables.go +++ b/internal/tools/mssql/mssqllisttables/mssqllisttables.go @@ -279,7 +279,7 @@ const listTablesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -298,7 +298,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -307,7 +307,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -340,7 +340,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mssql/mssqllisttables/mssqllisttables_test.go b/internal/tools/mssql/mssqllisttables/mssqllisttables_test.go index 029a89a1ca..adaff0aed4 100644 --- a/internal/tools/mssql/mssqllisttables/mssqllisttables_test.go +++ b/internal/tools/mssql/mssqllisttables/mssqllisttables_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlmssqlListTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": mssqllisttables.Config{ Name: "example_tool", - Kind: "mssql-list-tables", + Type: "mssql-list-tables", Source: "my-mssql-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/mssql/mssqlsql/mssqlsql.go b/internal/tools/mssql/mssqlsql/mssqlsql.go index d0ce09c9e8..e5ca143f83 100644 --- a/internal/tools/mssql/mssqlsql/mssqlsql.go +++ b/internal/tools/mssql/mssqlsql/mssqlsql.go @@ -31,7 +31,7 @@ const kind string = "mssql-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -62,7 +62,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -95,7 +95,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mssql/mssqlsql/mssqlsql_test.go b/internal/tools/mssql/mssqlsql/mssqlsql_test.go index 3fb9b44d8c..f08a6b8ade 100644 --- a/internal/tools/mssql/mssqlsql/mssqlsql_test.go +++ b/internal/tools/mssql/mssqlsql/mssqlsql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlMssql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mssqlsql.Config{ Name: "example_tool", - Kind: "mssql-sql", + Type: "mssql-sql", Source: "my-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -139,7 +139,7 @@ func TestParseFromYamlWithTemplateMssql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mssqlsql.Config{ Name: "example_tool", - Kind: "mssql-sql", + Type: "mssql-sql", Source: "my-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/mysql/mysqlexecutesql/mysqlexecutesql.go b/internal/tools/mysql/mysqlexecutesql/mysqlexecutesql.go index f09bee748f..6c1a143250 100644 --- a/internal/tools/mysql/mysqlexecutesql/mysqlexecutesql.go +++ b/internal/tools/mysql/mysqlexecutesql/mysqlexecutesql.go @@ -31,7 +31,7 @@ const kind string = "mysql-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -59,7 +59,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -90,7 +90,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mysql/mysqlexecutesql/mysqlexecutesql_test.go b/internal/tools/mysql/mysqlexecutesql/mysqlexecutesql_test.go index 9044c2575d..08cbbc84f1 100644 --- a/internal/tools/mysql/mysqlexecutesql/mysqlexecutesql_test.go +++ b/internal/tools/mysql/mysqlexecutesql/mysqlexecutesql_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mysqlexecutesql.Config{ Name: "example_tool", - Kind: "mysql-execute-sql", + Type: "mysql-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/mysql/mysqlgetqueryplan/mysqlgetqueryplan.go b/internal/tools/mysql/mysqlgetqueryplan/mysqlgetqueryplan.go index 07d4396cda..0970ff3f49 100644 --- a/internal/tools/mysql/mysqlgetqueryplan/mysqlgetqueryplan.go +++ b/internal/tools/mysql/mysqlgetqueryplan/mysqlgetqueryplan.go @@ -33,7 +33,7 @@ const kind string = "mysql-get-query-plan" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -52,7 +52,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -92,7 +92,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mysql/mysqlgetqueryplan/mysqlgetqueryplan_test.go b/internal/tools/mysql/mysqlgetqueryplan/mysqlgetqueryplan_test.go index b06248dbaf..b26adb41ca 100644 --- a/internal/tools/mysql/mysqlgetqueryplan/mysqlgetqueryplan_test.go +++ b/internal/tools/mysql/mysqlgetqueryplan/mysqlgetqueryplan_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlGetQueryPlan(t *testing.T) { want: server.ToolConfigs{ "example_tool": mysqlgetqueryplan.Config{ Name: "example_tool", - Kind: "mysql-get-query-plan", + Type: "mysql-get-query-plan", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/mysql/mysqllistactivequeries/mysqllistactivequeries.go b/internal/tools/mysql/mysqllistactivequeries/mysqllistactivequeries.go index 1cc564752b..0ff1731745 100644 --- a/internal/tools/mysql/mysqllistactivequeries/mysqllistactivequeries.go +++ b/internal/tools/mysql/mysqllistactivequeries/mysqllistactivequeries.go @@ -95,7 +95,7 @@ const listActiveQueriesStatementCloudSQLMySQL = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -114,7 +114,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -123,7 +123,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -146,11 +146,11 @@ func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error) mcpManifest := tools.GetMcpManifest(cfg.Name, cfg.Description, cfg.AuthRequired, allParameters, nil) var statement string - sourceKind := rawS.SourceKind() - switch sourceKind { - case mysql.SourceKind: + sourceType := rawS.SourceType() + switch sourceType { + case mysql.SourceType: statement = listActiveQueriesStatementMySQL - case cloudsqlmysql.SourceKind: + case cloudsqlmysql.SourceType: statement = listActiveQueriesStatementCloudSQLMySQL default: return nil, fmt.Errorf("unsupported source kind: %s", cfg.Source) @@ -178,7 +178,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mysql/mysqllistactivequeries/mysqllistactivequeries_test.go b/internal/tools/mysql/mysqllistactivequeries/mysqllistactivequeries_test.go index cacc41c1ed..fcde501e31 100644 --- a/internal/tools/mysql/mysqllistactivequeries/mysqllistactivequeries_test.go +++ b/internal/tools/mysql/mysqllistactivequeries/mysqllistactivequeries_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mysqllistactivequeries.Config{ Name: "example_tool", - Kind: "mysql-list-active-queries", + Type: "mysql-list-active-queries", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/mysql/mysqllisttablefragmentation/mysqllisttablefragmentation.go b/internal/tools/mysql/mysqllisttablefragmentation/mysqllisttablefragmentation.go index adadd806d0..1f6a46c6ee 100644 --- a/internal/tools/mysql/mysqllisttablefragmentation/mysqllisttablefragmentation.go +++ b/internal/tools/mysql/mysqllisttablefragmentation/mysqllisttablefragmentation.go @@ -53,7 +53,7 @@ const listTableFragmentationStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -72,7 +72,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -81,7 +81,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -115,7 +115,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mysql/mysqllisttablefragmentation/mysqllisttablefragmentation_test.go b/internal/tools/mysql/mysqllisttablefragmentation/mysqllisttablefragmentation_test.go index 401f672e72..1a23f34f77 100644 --- a/internal/tools/mysql/mysqllisttablefragmentation/mysqllisttablefragmentation_test.go +++ b/internal/tools/mysql/mysqllisttablefragmentation/mysqllisttablefragmentation_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mysqllisttablefragmentation.Config{ Name: "example_tool", - Kind: "mysql-list-table-fragmentation", + Type: "mysql-list-table-fragmentation", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/mysql/mysqllisttables/mysqllisttables.go b/internal/tools/mysql/mysqllisttables/mysqllisttables.go index 608ee5b524..fb5592e496 100644 --- a/internal/tools/mysql/mysqllisttables/mysqllisttables.go +++ b/internal/tools/mysql/mysqllisttables/mysqllisttables.go @@ -183,7 +183,7 @@ const listTablesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -202,7 +202,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -211,7 +211,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -245,7 +245,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mysql/mysqllisttables/mysqllisttables_test.go b/internal/tools/mysql/mysqllisttables/mysqllisttables_test.go index c195e4f4e7..643c914fda 100644 --- a/internal/tools/mysql/mysqllisttables/mysqllisttables_test.go +++ b/internal/tools/mysql/mysqllisttables/mysqllisttables_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlMySQLListTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": mysqllisttables.Config{ Name: "example_tool", - Kind: "mysql-list-tables", + Type: "mysql-list-tables", Source: "my-mysql-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/mysql/mysqllisttablesmissinguniqueindexes/mysqllisttablesmissinguniqueindexes.go b/internal/tools/mysql/mysqllisttablesmissinguniqueindexes/mysqllisttablesmissinguniqueindexes.go index 025f0b4bdf..eb1fb4522a 100644 --- a/internal/tools/mysql/mysqllisttablesmissinguniqueindexes/mysqllisttablesmissinguniqueindexes.go +++ b/internal/tools/mysql/mysqllisttablesmissinguniqueindexes/mysqllisttablesmissinguniqueindexes.go @@ -54,7 +54,7 @@ const listTablesMissingUniqueIndexesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -73,7 +73,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -82,7 +82,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -114,7 +114,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mysql/mysqllisttablesmissinguniqueindexes/mysqllisttablesmissinguniqueindexes_test.go b/internal/tools/mysql/mysqllisttablesmissinguniqueindexes/mysqllisttablesmissinguniqueindexes_test.go index 6ee9c87347..7a9c1e96ac 100644 --- a/internal/tools/mysql/mysqllisttablesmissinguniqueindexes/mysqllisttablesmissinguniqueindexes_test.go +++ b/internal/tools/mysql/mysqllisttablesmissinguniqueindexes/mysqllisttablesmissinguniqueindexes_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": mysqllisttablesmissinguniqueindexes.Config{ Name: "example_tool", - Kind: "mysql-list-tables-missing-unique-indexes", + Type: "mysql-list-tables-missing-unique-indexes", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/mysql/mysqlsql/mysqlsql.go b/internal/tools/mysql/mysqlsql/mysqlsql.go index 27a3c59716..a6c9965126 100644 --- a/internal/tools/mysql/mysqlsql/mysqlsql.go +++ b/internal/tools/mysql/mysqlsql/mysqlsql.go @@ -30,7 +30,7 @@ const kind string = "mysql-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/mysql/mysqlsql/mysqlsql_test.go b/internal/tools/mysql/mysqlsql/mysqlsql_test.go index 5863477f0b..449fd7c269 100644 --- a/internal/tools/mysql/mysqlsql/mysqlsql_test.go +++ b/internal/tools/mysql/mysqlsql/mysqlsql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlMySQL(t *testing.T) { want: server.ToolConfigs{ "example_tool": mysqlsql.Config{ Name: "example_tool", - Kind: "mysql-sql", + Type: "mysql-sql", Source: "my-mysql-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -139,7 +139,7 @@ func TestParseFromYamlWithTemplateParamsMySQL(t *testing.T) { want: server.ToolConfigs{ "example_tool": mysqlsql.Config{ Name: "example_tool", - Kind: "mysql-sql", + Type: "mysql-sql", Source: "my-mysql-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/neo4j/neo4jcypher/neo4jcypher.go b/internal/tools/neo4j/neo4jcypher/neo4jcypher.go index b783df5cde..e72afebfab 100644 --- a/internal/tools/neo4j/neo4jcypher/neo4jcypher.go +++ b/internal/tools/neo4j/neo4jcypher/neo4jcypher.go @@ -30,7 +30,7 @@ const kind string = "neo4j-cypher" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -86,7 +86,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/neo4j/neo4jcypher/neo4jcypher_test.go b/internal/tools/neo4j/neo4jcypher/neo4jcypher_test.go index 898583f961..1f3e86d431 100644 --- a/internal/tools/neo4j/neo4jcypher/neo4jcypher_test.go +++ b/internal/tools/neo4j/neo4jcypher/neo4jcypher_test.go @@ -55,7 +55,7 @@ func TestParseFromYamlNeo4j(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "neo4j-cypher", + Type: "neo4j-cypher", Source: "my-neo4j-instance", Description: "some tool description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/neo4j/neo4jexecutecypher/neo4jexecutecypher.go b/internal/tools/neo4j/neo4jexecutecypher/neo4jexecutecypher.go index 316423da49..6a06aaf53d 100644 --- a/internal/tools/neo4j/neo4jexecutecypher/neo4jexecutecypher.go +++ b/internal/tools/neo4j/neo4jexecutecypher/neo4jexecutecypher.go @@ -29,7 +29,7 @@ const kind string = "neo4j-execute-cypher" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -48,7 +48,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` ReadOnly bool `yaml:"readOnly"` @@ -58,7 +58,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -95,7 +95,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/neo4j/neo4jexecutecypher/neo4jexecutecypher_test.go b/internal/tools/neo4j/neo4jexecutecypher/neo4jexecutecypher_test.go index a287292647..ae19ee6335 100644 --- a/internal/tools/neo4j/neo4jexecutecypher/neo4jexecutecypher_test.go +++ b/internal/tools/neo4j/neo4jexecutecypher/neo4jexecutecypher_test.go @@ -48,7 +48,7 @@ func TestParseFromYamlNeo4j(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "neo4j-execute-cypher", + Type: "neo4j-execute-cypher", Source: "my-neo4j-instance", Description: "some tool description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -71,7 +71,7 @@ func TestParseFromYamlNeo4j(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "neo4j-execute-cypher", + Type: "neo4j-execute-cypher", Source: "my-neo4j-instance", ReadOnly: true, Description: "some tool description", diff --git a/internal/tools/neo4j/neo4jschema/neo4jschema.go b/internal/tools/neo4j/neo4jschema/neo4jschema.go index bb38122cee..0eab5a231b 100644 --- a/internal/tools/neo4j/neo4jschema/neo4jschema.go +++ b/internal/tools/neo4j/neo4jschema/neo4jschema.go @@ -37,7 +37,7 @@ const kind string = "neo4j-schema" // init registers the tool with the application's tool registry when the package is initialized. func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -62,7 +62,7 @@ type compatibleSource interface { // These settings are typically read from a YAML file. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -72,8 +72,8 @@ type Config struct { // Statically verify that Config implements the tools.ToolConfig interface. var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of this tool configuration. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of this tool configuration. +func (cfg Config) ToolConfigType() string { return kind } @@ -114,7 +114,7 @@ type Tool struct { // Invoke executes the tool's main logic: fetching the Neo4j schema. // It first checks the cache for a valid schema before extracting it from the database. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/neo4j/neo4jschema/neo4jschema_test.go b/internal/tools/neo4j/neo4jschema/neo4jschema_test.go index 6960dd7c58..a93af1d765 100644 --- a/internal/tools/neo4j/neo4jschema/neo4jschema_test.go +++ b/internal/tools/neo4j/neo4jschema/neo4jschema_test.go @@ -51,7 +51,7 @@ func TestParseFromYamlNeo4j(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "neo4j-schema", + Type: "neo4j-schema", Source: "my-neo4j-instance", Description: "some tool description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -72,7 +72,7 @@ func TestParseFromYamlNeo4j(t *testing.T) { want: server.ToolConfigs{ "example_tool": Config{ Name: "example_tool", - Kind: "neo4j-schema", + Type: "neo4j-schema", Source: "my-neo4j-instance", Description: "some tool description", AuthRequired: []string{}, // Expect an empty slice, not nil. diff --git a/internal/tools/oceanbase/oceanbaseexecutesql/oceanbaseexecutesql.go b/internal/tools/oceanbase/oceanbaseexecutesql/oceanbaseexecutesql.go index a962bc030c..bfabfc4ece 100644 --- a/internal/tools/oceanbase/oceanbaseexecutesql/oceanbaseexecutesql.go +++ b/internal/tools/oceanbase/oceanbaseexecutesql/oceanbaseexecutesql.go @@ -30,7 +30,7 @@ const kind string = "oceanbase-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -41,7 +41,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T return actual, nil } -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -90,7 +90,7 @@ type Tool struct { // Invoke executes the SQL statement provided in the parameters. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/oceanbase/oceanbaseexecutesql/oceanbaseexecutesql_test.go b/internal/tools/oceanbase/oceanbaseexecutesql/oceanbaseexecutesql_test.go index 0653765d2a..a419b1f3cf 100644 --- a/internal/tools/oceanbase/oceanbaseexecutesql/oceanbaseexecutesql_test.go +++ b/internal/tools/oceanbase/oceanbaseexecutesql/oceanbaseexecutesql_test.go @@ -50,7 +50,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": oceanbaseexecutesql.Config{ Name: "example_tool", - Kind: "oceanbase-execute-sql", + Type: "oceanbase-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/oceanbase/oceanbasesql/oceanbasesql.go b/internal/tools/oceanbase/oceanbasesql/oceanbasesql.go index 0d9a0d9441..290a36f76c 100644 --- a/internal/tools/oceanbase/oceanbasesql/oceanbasesql.go +++ b/internal/tools/oceanbase/oceanbasesql/oceanbasesql.go @@ -30,7 +30,7 @@ const kind string = "oceanbase-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -41,7 +41,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T return actual, nil } -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -95,7 +95,7 @@ type Tool struct { // Invoke executes the SQL statement with the provided parameters. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/oceanbase/oceanbasesql/oceanbasesql_test.go b/internal/tools/oceanbase/oceanbasesql/oceanbasesql_test.go index 0b1806dd84..c787687f3c 100644 --- a/internal/tools/oceanbase/oceanbasesql/oceanbasesql_test.go +++ b/internal/tools/oceanbase/oceanbasesql/oceanbasesql_test.go @@ -53,7 +53,7 @@ func TestParseFromYamlOceanBaseSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": oceanbasesql.Config{ Name: "example_tool", - Kind: "oceanbase-sql", + Type: "oceanbase-sql", Source: "my-instance", Description: "some description", Statement: "select * from t where id = ?", diff --git a/internal/tools/oracle/oracleexecutesql/oracleexecutesql.go b/internal/tools/oracle/oracleexecutesql/oracleexecutesql.go index c0d7fb6374..cb0cc53683 100644 --- a/internal/tools/oracle/oracleexecutesql/oracleexecutesql.go +++ b/internal/tools/oracle/oracleexecutesql/oracleexecutesql.go @@ -19,7 +19,7 @@ const kind string = "oracle-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -38,7 +38,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -47,7 +47,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -78,7 +78,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/oracle/oracleexecutesql/oracleexecutesql_test.go b/internal/tools/oracle/oracleexecutesql/oracleexecutesql_test.go index 834d3d6981..9c8db8e8fa 100644 --- a/internal/tools/oracle/oracleexecutesql/oracleexecutesql_test.go +++ b/internal/tools/oracle/oracleexecutesql/oracleexecutesql_test.go @@ -36,7 +36,7 @@ func TestParseFromYamlOracleExecuteSql(t *testing.T) { want: server.ToolConfigs{ "run_adhoc_query": oracleexecutesql.Config{ Name: "run_adhoc_query", - Kind: "oracle-execute-sql", + Type: "oracle-execute-sql", Source: "my-oracle-instance", Description: "Executes arbitrary SQL statements like INSERT or UPDATE.", AuthRequired: []string{"my-google-auth-service"}, @@ -55,7 +55,7 @@ func TestParseFromYamlOracleExecuteSql(t *testing.T) { want: server.ToolConfigs{ "run_simple_update": oracleexecutesql.Config{ Name: "run_simple_update", - Kind: "oracle-execute-sql", + Type: "oracle-execute-sql", Source: "db-dev", Description: "Runs a simple update operation.", AuthRequired: []string{}, diff --git a/internal/tools/oracle/oraclesql/oraclesql.go b/internal/tools/oracle/oraclesql/oraclesql.go index 949ed327f9..3180b4d61e 100644 --- a/internal/tools/oracle/oraclesql/oraclesql.go +++ b/internal/tools/oracle/oraclesql/oraclesql.go @@ -18,7 +18,7 @@ const kind string = "oracle-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -37,7 +37,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -49,7 +49,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -82,7 +82,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/oracle/oraclesql/oraclesql_test.go b/internal/tools/oracle/oraclesql/oraclesql_test.go index 2ba0a7321c..b6e8becf42 100644 --- a/internal/tools/oracle/oraclesql/oraclesql_test.go +++ b/internal/tools/oracle/oraclesql/oraclesql_test.go @@ -36,7 +36,7 @@ func TestParseFromYamlOracleSql(t *testing.T) { want: server.ToolConfigs{ "get_user_by_id": oraclesql.Config{ Name: "get_user_by_id", - Kind: "oracle-sql", + Type: "oracle-sql", Source: "my-oracle-instance", Description: "Retrieves user details by ID.", Statement: "SELECT id, name, email FROM users WHERE id = :1", @@ -57,7 +57,7 @@ func TestParseFromYamlOracleSql(t *testing.T) { want: server.ToolConfigs{ "get_orders": oraclesql.Config{ Name: "get_orders", - Kind: "oracle-sql", + Type: "oracle-sql", Source: "db-prod", Description: "Gets orders for a customer with optional filtering.", Statement: "SELECT * FROM ${SCHEMA}.ORDERS WHERE customer_id = :customer_id AND status = :status", diff --git a/internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview.go b/internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview.go index c2c89791c9..33e576b058 100644 --- a/internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview.go +++ b/internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview.go @@ -44,7 +44,7 @@ const databaseOverviewStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -63,7 +63,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -72,7 +72,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -111,7 +111,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview_test.go b/internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview_test.go index 63ea550d2a..360ff95058 100644 --- a/internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview_test.go +++ b/internal/tools/postgres/postgresdatabaseoverview/postgresdatabaseoverview_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresDatabaseOverview(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgresdatabaseoverview.Config{ Name: "example_tool", - Kind: "postgres-database-overview", + Type: "postgres-database-overview", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresDatabaseOverview(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgresdatabaseoverview.Config{ Name: "example_tool", - Kind: "postgres-database-overview", + Type: "postgres-database-overview", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgresexecutesql/postgresexecutesql.go b/internal/tools/postgres/postgresexecutesql/postgresexecutesql.go index aec0851759..99054636f6 100644 --- a/internal/tools/postgres/postgresexecutesql/postgresexecutesql.go +++ b/internal/tools/postgres/postgresexecutesql/postgresexecutesql.go @@ -31,7 +31,7 @@ const kind string = "postgres-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -59,7 +59,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -90,7 +90,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgresexecutesql/postgresexecutesql_test.go b/internal/tools/postgres/postgresexecutesql/postgresexecutesql_test.go index 6351b54c64..ff122d044c 100644 --- a/internal/tools/postgres/postgresexecutesql/postgresexecutesql_test.go +++ b/internal/tools/postgres/postgresexecutesql/postgresexecutesql_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgresexecutesql.Config{ Name: "example_tool", - Kind: "postgres-execute-sql", + Type: "postgres-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/postgres/postgresgetcolumncardinality/postgresgetcolumncardinality.go b/internal/tools/postgres/postgresgetcolumncardinality/postgresgetcolumncardinality.go index a104ea2858..239124d1ac 100644 --- a/internal/tools/postgres/postgresgetcolumncardinality/postgresgetcolumncardinality.go +++ b/internal/tools/postgres/postgresgetcolumncardinality/postgresgetcolumncardinality.go @@ -49,7 +49,7 @@ const getColumnCardinality = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -68,7 +68,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -77,7 +77,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -123,7 +123,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgresgetcolumncardinality/postgresgetcolumncardinality_test.go b/internal/tools/postgres/postgresgetcolumncardinality/postgresgetcolumncardinality_test.go index e1ea31fe59..0b23948710 100644 --- a/internal/tools/postgres/postgresgetcolumncardinality/postgresgetcolumncardinality_test.go +++ b/internal/tools/postgres/postgresgetcolumncardinality/postgresgetcolumncardinality_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresGetColumnCardinality(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgresgetcolumncardinality.Config{ Name: "example_tool", - Kind: "postgres-get-column-cardinality", + Type: "postgres-get-column-cardinality", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresGetColumnCardinality(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgresgetcolumncardinality.Config{ Name: "example_tool", - Kind: "postgres-get-column-cardinality", + Type: "postgres-get-column-cardinality", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistactivequeries/postgreslistactivequeries.go b/internal/tools/postgres/postgreslistactivequeries/postgreslistactivequeries.go index 81cea0d42d..76fbd86ad1 100644 --- a/internal/tools/postgres/postgreslistactivequeries/postgreslistactivequeries.go +++ b/internal/tools/postgres/postgreslistactivequeries/postgreslistactivequeries.go @@ -53,7 +53,7 @@ const listActiveQueriesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -72,7 +72,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -81,7 +81,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -119,7 +119,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistactivequeries/postgreslistactivequeries_test.go b/internal/tools/postgres/postgreslistactivequeries/postgreslistactivequeries_test.go index 96a5caeb0e..dadbda1c4b 100644 --- a/internal/tools/postgres/postgreslistactivequeries/postgreslistactivequeries_test.go +++ b/internal/tools/postgres/postgreslistactivequeries/postgreslistactivequeries_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistactivequeries.Config{ Name: "example_tool", - Kind: "postgres-list-active-queries", + Type: "postgres-list-active-queries", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistactivequeries.Config{ Name: "example_tool", - Kind: "postgres-list-active-queries", + Type: "postgres-list-active-queries", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistavailableextensions/postgreslistavailableextensions.go b/internal/tools/postgres/postgreslistavailableextensions/postgreslistavailableextensions.go index 3cc764c460..66864c54c6 100644 --- a/internal/tools/postgres/postgreslistavailableextensions/postgreslistavailableextensions.go +++ b/internal/tools/postgres/postgreslistavailableextensions/postgreslistavailableextensions.go @@ -40,7 +40,7 @@ const listAvailableExtensionsQuery = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -59,7 +59,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -68,7 +68,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -99,7 +99,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistavailableextensions/postgreslistavailableextensions_test.go b/internal/tools/postgres/postgreslistavailableextensions/postgreslistavailableextensions_test.go index 8c26d59cdd..51ecdebba0 100644 --- a/internal/tools/postgres/postgreslistavailableextensions/postgreslistavailableextensions_test.go +++ b/internal/tools/postgres/postgreslistavailableextensions/postgreslistavailableextensions_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgres(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistavailableextensions.Config{ Name: "example_tool", - Kind: "postgres-list-available-extensions", + Type: "postgres-list-available-extensions", Source: "my-pg-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgres(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistavailableextensions.Config{ Name: "example_tool", - Kind: "postgres-list-available-extensions", + Type: "postgres-list-available-extensions", Source: "my-pg-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistdatabasestats/postgreslistdatabasestats.go b/internal/tools/postgres/postgreslistdatabasestats/postgreslistdatabasestats.go index b6c3e987c1..e997b1c4dd 100644 --- a/internal/tools/postgres/postgreslistdatabasestats/postgreslistdatabasestats.go +++ b/internal/tools/postgres/postgreslistdatabasestats/postgreslistdatabasestats.go @@ -97,7 +97,7 @@ const listDatabaseStats = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -116,7 +116,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -125,7 +125,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -188,7 +188,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistdatabasestats/postgreslistdatabasestats_test.go b/internal/tools/postgres/postgreslistdatabasestats/postgreslistdatabasestats_test.go index 760370f630..1833dc13c0 100644 --- a/internal/tools/postgres/postgreslistdatabasestats/postgreslistdatabasestats_test.go +++ b/internal/tools/postgres/postgreslistdatabasestats/postgreslistdatabasestats_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListDatabaseStats(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistdatabasestats.Config{ Name: "example_tool", - Kind: "postgres-list-database-stats", + Type: "postgres-list-database-stats", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListDatabaseStats(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistdatabasestats.Config{ Name: "example_tool", - Kind: "postgres-list-database-stats", + Type: "postgres-list-database-stats", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistindexes/postgreslistindexes.go b/internal/tools/postgres/postgreslistindexes/postgreslistindexes.go index ac5a9b1d40..4ffaf6fa5c 100644 --- a/internal/tools/postgres/postgreslistindexes/postgreslistindexes.go +++ b/internal/tools/postgres/postgreslistindexes/postgreslistindexes.go @@ -76,7 +76,7 @@ const listIndexesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -95,7 +95,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -104,7 +104,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -150,7 +150,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistindexes/postgreslistindexes_test.go b/internal/tools/postgres/postgreslistindexes/postgreslistindexes_test.go index c5aaacfab7..72f69b3094 100644 --- a/internal/tools/postgres/postgreslistindexes/postgreslistindexes_test.go +++ b/internal/tools/postgres/postgreslistindexes/postgreslistindexes_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListIndexes(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistindexes.Config{ Name: "example_tool", - Kind: "postgres-list-indexes", + Type: "postgres-list-indexes", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListIndexes(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistindexes.Config{ Name: "example_tool", - Kind: "postgres-list-indexes", + Type: "postgres-list-indexes", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistinstalledextensions/postgreslistinstalledextensions.go b/internal/tools/postgres/postgreslistinstalledextensions/postgreslistinstalledextensions.go index f9e5773329..e110fb683b 100644 --- a/internal/tools/postgres/postgreslistinstalledextensions/postgreslistinstalledextensions.go +++ b/internal/tools/postgres/postgreslistinstalledextensions/postgreslistinstalledextensions.go @@ -51,7 +51,7 @@ const listAvailableExtensionsQuery = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -70,7 +70,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -79,7 +79,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -110,7 +110,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistinstalledextensions/postgreslistinstalledextensions_test.go b/internal/tools/postgres/postgreslistinstalledextensions/postgreslistinstalledextensions_test.go index 8fb6b1e2a3..abb2baf5e6 100644 --- a/internal/tools/postgres/postgreslistinstalledextensions/postgreslistinstalledextensions_test.go +++ b/internal/tools/postgres/postgreslistinstalledextensions/postgreslistinstalledextensions_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgres(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistinstalledextensions.Config{ Name: "example_tool", - Kind: "postgres-list-installed-extensions", + Type: "postgres-list-installed-extensions", Source: "my-pg-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgres(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistinstalledextensions.Config{ Name: "example_tool", - Kind: "postgres-list-installed-extensions", + Type: "postgres-list-installed-extensions", Source: "my-pg-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistlocks/postgreslistlocks.go b/internal/tools/postgres/postgreslistlocks/postgreslistlocks.go index b7cd44054c..c36b6d2119 100644 --- a/internal/tools/postgres/postgreslistlocks/postgreslistlocks.go +++ b/internal/tools/postgres/postgreslistlocks/postgreslistlocks.go @@ -51,7 +51,7 @@ const listLocks = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -70,7 +70,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -79,7 +79,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -121,7 +121,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistlocks/postgreslistlocks_test.go b/internal/tools/postgres/postgreslistlocks/postgreslistlocks_test.go index 1615e4870b..324d63a859 100644 --- a/internal/tools/postgres/postgreslistlocks/postgreslistlocks_test.go +++ b/internal/tools/postgres/postgreslistlocks/postgreslistlocks_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListLocks(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistlocks.Config{ Name: "example_tool", - Kind: "postgres-list-locks", + Type: "postgres-list-locks", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListLocks(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistlocks.Config{ Name: "example_tool", - Kind: "postgres-list-locks", + Type: "postgres-list-locks", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings.go b/internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings.go index 707c5f299b..1670fbc11e 100644 --- a/internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings.go +++ b/internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings.go @@ -49,7 +49,7 @@ const listPgSettingsStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -68,7 +68,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -77,7 +77,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -116,7 +116,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings_test.go b/internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings_test.go index a2aa9fe78b..b38ee67b96 100644 --- a/internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings_test.go +++ b/internal/tools/postgres/postgreslistpgsettings/postgreslistpgsettings_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgreslistPgSettings(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistpgsettings.Config{ Name: "example_tool", - Kind: "postgres-list-pg-settings", + Type: "postgres-list-pg-settings", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgreslistPgSettings(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistpgsettings.Config{ Name: "example_tool", - Kind: "postgres-list-pg-settings", + Type: "postgres-list-pg-settings", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables.go b/internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables.go index b9d57c44e7..3b2f2cc1c4 100644 --- a/internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables.go +++ b/internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables.go @@ -60,7 +60,7 @@ const listPublicationTablesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -79,7 +79,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -88,7 +88,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -129,7 +129,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables_test.go b/internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables_test.go index 211567c4a8..a2e8cfb03e 100644 --- a/internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables_test.go +++ b/internal/tools/postgres/postgreslistpublicationtables/postgreslistpublicationtables_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListPublicationTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistpublicationtables.Config{ Name: "example_tool", - Kind: "postgres-list-publication-tables", + Type: "postgres-list-publication-tables", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListPublicationTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistpublicationtables.Config{ Name: "example_tool", - Kind: "postgres-list-publication-tables", + Type: "postgres-list-publication-tables", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistquerystats/postgreslistquerystats.go b/internal/tools/postgres/postgreslistquerystats/postgreslistquerystats.go index d07dd4001e..6b6d14c25e 100644 --- a/internal/tools/postgres/postgreslistquerystats/postgreslistquerystats.go +++ b/internal/tools/postgres/postgreslistquerystats/postgreslistquerystats.go @@ -50,7 +50,7 @@ const listQueryStats = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -69,7 +69,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -78,7 +78,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -123,7 +123,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistquerystats/postgreslistquerystats_test.go b/internal/tools/postgres/postgreslistquerystats/postgreslistquerystats_test.go index c8408aa952..528e6a6d2d 100644 --- a/internal/tools/postgres/postgreslistquerystats/postgreslistquerystats_test.go +++ b/internal/tools/postgres/postgreslistquerystats/postgreslistquerystats_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListQueryStats(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistquerystats.Config{ Name: "example_tool", - Kind: "postgres-list-query-stats", + Type: "postgres-list-query-stats", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListQueryStats(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistquerystats.Config{ Name: "example_tool", - Kind: "postgres-list-query-stats", + Type: "postgres-list-query-stats", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistroles/postgreslistroles.go b/internal/tools/postgres/postgreslistroles/postgreslistroles.go index b180e0451c..d4de0606d4 100644 --- a/internal/tools/postgres/postgreslistroles/postgreslistroles.go +++ b/internal/tools/postgres/postgreslistroles/postgreslistroles.go @@ -72,7 +72,7 @@ const listRolesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -91,7 +91,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -100,7 +100,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -144,7 +144,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistroles/postgreslistroles_test.go b/internal/tools/postgres/postgreslistroles/postgreslistroles_test.go index cf4249f6ff..7a29e662a4 100644 --- a/internal/tools/postgres/postgreslistroles/postgreslistroles_test.go +++ b/internal/tools/postgres/postgreslistroles/postgreslistroles_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListRoles(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistroles.Config{ Name: "example_tool", - Kind: "postgres-list-roles", + Type: "postgres-list-roles", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListRoles(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistroles.Config{ Name: "example_tool", - Kind: "postgres-list-roles", + Type: "postgres-list-roles", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistschemas/postgreslistschemas.go b/internal/tools/postgres/postgreslistschemas/postgreslistschemas.go index d97976a7e3..ae839a9b23 100644 --- a/internal/tools/postgres/postgreslistschemas/postgreslistschemas.go +++ b/internal/tools/postgres/postgreslistschemas/postgreslistschemas.go @@ -84,7 +84,7 @@ const listSchemasStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -103,7 +103,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -112,7 +112,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -152,7 +152,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistschemas/postgreslistschemas_test.go b/internal/tools/postgres/postgreslistschemas/postgreslistschemas_test.go index a416d584bd..c610ed523e 100644 --- a/internal/tools/postgres/postgreslistschemas/postgreslistschemas_test.go +++ b/internal/tools/postgres/postgreslistschemas/postgreslistschemas_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgreslistSchemas(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistschemas.Config{ Name: "example_tool", - Kind: "postgres-list-schemas", + Type: "postgres-list-schemas", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgreslistSchemas(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistschemas.Config{ Name: "example_tool", - Kind: "postgres-list-schemas", + Type: "postgres-list-schemas", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistsequences/postgreslistsequences.go b/internal/tools/postgres/postgreslistsequences/postgreslistsequences.go index fb55b9208c..588745adeb 100644 --- a/internal/tools/postgres/postgreslistsequences/postgreslistsequences.go +++ b/internal/tools/postgres/postgreslistsequences/postgreslistsequences.go @@ -50,7 +50,7 @@ const listSequencesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -69,7 +69,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -78,7 +78,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -122,7 +122,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistsequences/postgreslistsequences_test.go b/internal/tools/postgres/postgreslistsequences/postgreslistsequences_test.go index 566da0ef7b..496e639d2e 100644 --- a/internal/tools/postgres/postgreslistsequences/postgreslistsequences_test.go +++ b/internal/tools/postgres/postgreslistsequences/postgreslistsequences_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListSequences(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistsequences.Config{ Name: "example_tool", - Kind: "postgres-list-sequences", + Type: "postgres-list-sequences", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListSequences(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistsequences.Config{ Name: "example_tool", - Kind: "postgres-list-sequences", + Type: "postgres-list-sequences", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgresliststoredprocedure/postgresliststoredprocedure.go b/internal/tools/postgres/postgresliststoredprocedure/postgresliststoredprocedure.go index 54d32ade0c..e5fe3dc718 100644 --- a/internal/tools/postgres/postgresliststoredprocedure/postgresliststoredprocedure.go +++ b/internal/tools/postgres/postgresliststoredprocedure/postgresliststoredprocedure.go @@ -54,7 +54,7 @@ const listStoredProcedure = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -75,11 +75,11 @@ var _ compatibleSource = &alloydbpg.Source{} var _ compatibleSource = &cloudsqlpg.Source{} var _ compatibleSource = &postgres.Source{} -var compatibleSources = [...]string{alloydbpg.SourceKind, cloudsqlpg.SourceKind, postgres.SourceKind} +var compatibleSources = [...]string{alloydbpg.SourceType, cloudsqlpg.SourceType, postgres.SourceType} type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -88,7 +88,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -121,7 +121,7 @@ func (cfg Config) Initialize(srcs map[string]sources.Source) (tools.Tool, error) // finish tool setup return Tool{ name: cfg.Name, - kind: cfg.Kind, + kind: cfg.Type, authRequired: cfg.AuthRequired, allParams: allParameters, pool: s.PostgresPool(), diff --git a/internal/tools/postgres/postgresliststoredprocedure/postgresliststoredprocedure_test.go b/internal/tools/postgres/postgresliststoredprocedure/postgresliststoredprocedure_test.go index 0ded95f2d5..34821c2380 100644 --- a/internal/tools/postgres/postgresliststoredprocedure/postgresliststoredprocedure_test.go +++ b/internal/tools/postgres/postgresliststoredprocedure/postgresliststoredprocedure_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListStoredProcedure(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgresliststoredprocedure.Config{ Name: "example_tool", - Kind: "postgres-list-stored-procedure", + Type: "postgres-list-stored-procedure", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListStoredProcedure(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgresliststoredprocedure.Config{ Name: "example_tool", - Kind: "postgres-list-stored-procedure", + Type: "postgres-list-stored-procedure", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslisttables/postgreslisttables.go b/internal/tools/postgres/postgreslisttables/postgreslisttables.go index 3f10551edd..389a7eb13c 100644 --- a/internal/tools/postgres/postgreslisttables/postgreslisttables.go +++ b/internal/tools/postgres/postgreslisttables/postgreslisttables.go @@ -108,7 +108,7 @@ const listTablesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -127,7 +127,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -136,7 +136,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -169,7 +169,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslisttables/postgreslisttables_test.go b/internal/tools/postgres/postgreslisttables/postgreslisttables_test.go index ded7f9e4cb..907244af3d 100644 --- a/internal/tools/postgres/postgreslisttables/postgreslisttables_test.go +++ b/internal/tools/postgres/postgreslisttables/postgreslisttables_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslisttables.Config{ Name: "example_tool", - Kind: "postgres-list-tables", + Type: "postgres-list-tables", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/postgres/postgreslisttablespaces/postgreslisttablespaces.go b/internal/tools/postgres/postgreslisttablespaces/postgreslisttablespaces.go index 51d7b61f45..e532434539 100644 --- a/internal/tools/postgres/postgreslisttablespaces/postgreslisttablespaces.go +++ b/internal/tools/postgres/postgreslisttablespaces/postgreslisttablespaces.go @@ -56,7 +56,7 @@ const listTableSpacesStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -75,7 +75,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -84,7 +84,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -127,7 +127,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslisttablespaces/postgreslisttablespaces_test.go b/internal/tools/postgres/postgreslisttablespaces/postgreslisttablespaces_test.go index 0d28d5abf3..f97b89a797 100644 --- a/internal/tools/postgres/postgreslisttablespaces/postgreslisttablespaces_test.go +++ b/internal/tools/postgres/postgreslisttablespaces/postgreslisttablespaces_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListTablespaces(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslisttablespaces.Config{ Name: "example_tool", - Kind: "postgres-list-tablespaces", + Type: "postgres-list-tablespaces", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListTablespaces(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslisttablespaces.Config{ Name: "example_tool", - Kind: "postgres-list-tablespaces", + Type: "postgres-list-tablespaces", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslisttablestats/postgreslisttablestats.go b/internal/tools/postgres/postgreslisttablestats/postgreslisttablestats.go index c4f8b34729..4b002d93ca 100644 --- a/internal/tools/postgres/postgreslisttablestats/postgreslisttablestats.go +++ b/internal/tools/postgres/postgreslisttablestats/postgreslisttablestats.go @@ -77,7 +77,7 @@ const listTableStats = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -96,7 +96,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -105,7 +105,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -161,7 +161,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslisttablestats/postgreslisttablestats_test.go b/internal/tools/postgres/postgreslisttablestats/postgreslisttablestats_test.go index cfaac3eda5..df65f7f713 100644 --- a/internal/tools/postgres/postgreslisttablestats/postgreslisttablestats_test.go +++ b/internal/tools/postgres/postgreslisttablestats/postgreslisttablestats_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListTableStats(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslisttablestats.Config{ Name: "example_tool", - Kind: "postgres-list-table-stats", + Type: "postgres-list-table-stats", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListTableStats(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslisttablestats.Config{ Name: "example_tool", - Kind: "postgres-list-table-stats", + Type: "postgres-list-table-stats", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslisttriggers/postgreslisttriggers.go b/internal/tools/postgres/postgreslisttriggers/postgreslisttriggers.go index d92261ea9f..d73b8521c0 100644 --- a/internal/tools/postgres/postgreslisttriggers/postgreslisttriggers.go +++ b/internal/tools/postgres/postgreslisttriggers/postgreslisttriggers.go @@ -76,7 +76,7 @@ const listTriggersStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -95,7 +95,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -104,7 +104,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -149,7 +149,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslisttriggers/postgreslisttriggers_test.go b/internal/tools/postgres/postgreslisttriggers/postgreslisttriggers_test.go index ac3efb4337..55f9e475bd 100644 --- a/internal/tools/postgres/postgreslisttriggers/postgreslisttriggers_test.go +++ b/internal/tools/postgres/postgreslisttriggers/postgreslisttriggers_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgreslistTriggers(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslisttriggers.Config{ Name: "example_tool", - Kind: "postgres-list-triggers", + Type: "postgres-list-triggers", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgreslistTriggers(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslisttriggers.Config{ Name: "example_tool", - Kind: "postgres-list-triggers", + Type: "postgres-list-triggers", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslistviews/postgreslistviews.go b/internal/tools/postgres/postgreslistviews/postgreslistviews.go index fa4c897da1..6099a94d37 100644 --- a/internal/tools/postgres/postgreslistviews/postgreslistviews.go +++ b/internal/tools/postgres/postgreslistviews/postgreslistviews.go @@ -51,7 +51,7 @@ const listViewsStatement = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -70,7 +70,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -79,7 +79,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -119,7 +119,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslistviews/postgreslistviews_test.go b/internal/tools/postgres/postgreslistviews/postgreslistviews_test.go index ffa234569f..2b601c8c93 100644 --- a/internal/tools/postgres/postgreslistviews/postgreslistviews_test.go +++ b/internal/tools/postgres/postgreslistviews/postgreslistviews_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresListViews(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistviews.Config{ Name: "example_tool", - Kind: "postgres-list-views", + Type: "postgres-list-views", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresListViews(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslistviews.Config{ Name: "example_tool", - Kind: "postgres-list-views", + Type: "postgres-list-views", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgreslongrunningtransactions/postgreslongrunningtransactions.go b/internal/tools/postgres/postgreslongrunningtransactions/postgreslongrunningtransactions.go index 2faa16d2a0..ebbf5bff52 100644 --- a/internal/tools/postgres/postgreslongrunningtransactions/postgreslongrunningtransactions.go +++ b/internal/tools/postgres/postgreslongrunningtransactions/postgreslongrunningtransactions.go @@ -58,7 +58,7 @@ const longRunningTransactions = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -77,7 +77,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -86,7 +86,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -131,7 +131,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgreslongrunningtransactions/postgreslongrunningtransactions_test.go b/internal/tools/postgres/postgreslongrunningtransactions/postgreslongrunningtransactions_test.go index d1809933da..aa6f0fe828 100644 --- a/internal/tools/postgres/postgreslongrunningtransactions/postgreslongrunningtransactions_test.go +++ b/internal/tools/postgres/postgreslongrunningtransactions/postgreslongrunningtransactions_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresLongRunningTransactions(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslongrunningtransactions.Config{ Name: "example_tool", - Kind: "postgres-long-running-transactions", + Type: "postgres-long-running-transactions", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresLongRunningTransactions(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgreslongrunningtransactions.Config{ Name: "example_tool", - Kind: "postgres-long-running-transactions", + Type: "postgres-long-running-transactions", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgresreplicationstats/postgresreplicationstats.go b/internal/tools/postgres/postgresreplicationstats/postgresreplicationstats.go index b30f41e2b9..eb78952db9 100644 --- a/internal/tools/postgres/postgresreplicationstats/postgresreplicationstats.go +++ b/internal/tools/postgres/postgresreplicationstats/postgresreplicationstats.go @@ -48,7 +48,7 @@ const replicationStats = ` func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -67,7 +67,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -76,7 +76,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -118,7 +118,7 @@ func (t Tool) ToConfig() tools.ToolConfig { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgresreplicationstats/postgresreplicationstats_test.go b/internal/tools/postgres/postgresreplicationstats/postgresreplicationstats_test.go index 1958d42895..428d5731b8 100644 --- a/internal/tools/postgres/postgresreplicationstats/postgresreplicationstats_test.go +++ b/internal/tools/postgres/postgresreplicationstats/postgresreplicationstats_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlPostgresReplicationStats(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgresreplicationstats.Config{ Name: "example_tool", - Kind: "postgres-replication-stats", + Type: "postgres-replication-stats", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, @@ -68,7 +68,7 @@ func TestParseFromYamlPostgresReplicationStats(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgresreplicationstats.Config{ Name: "example_tool", - Kind: "postgres-replication-stats", + Type: "postgres-replication-stats", Source: "my-postgres-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/postgres/postgressql/postgressql.go b/internal/tools/postgres/postgressql/postgressql.go index ab2464ddf9..7876591c3b 100644 --- a/internal/tools/postgres/postgressql/postgressql.go +++ b/internal/tools/postgres/postgressql/postgressql.go @@ -30,7 +30,7 @@ const kind string = "postgres-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/postgres/postgressql/postgressql_test.go b/internal/tools/postgres/postgressql/postgressql_test.go index c29152ad9b..2e22e64bc4 100644 --- a/internal/tools/postgres/postgressql/postgressql_test.go +++ b/internal/tools/postgres/postgressql/postgressql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlPostgres(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgressql.Config{ Name: "example_tool", - Kind: "postgres-sql", + Type: "postgres-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -132,7 +132,7 @@ func TestParseFromYamlWithTemplateParamsPostgres(t *testing.T) { want: server.ToolConfigs{ "example_tool": postgressql.Config{ Name: "example_tool", - Kind: "postgres-sql", + Type: "postgres-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/redis/redis.go b/internal/tools/redis/redis.go index e322306bab..a48ae0c4e2 100644 --- a/internal/tools/redis/redis.go +++ b/internal/tools/redis/redis.go @@ -29,7 +29,7 @@ const kind string = "redis" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -48,7 +48,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Commands [][]string `yaml:"commands" validate:"required"` @@ -59,7 +59,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -85,7 +85,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/redis/redis_test.go b/internal/tools/redis/redis_test.go index 5ee4ce3841..7c3c477e96 100644 --- a/internal/tools/redis/redis_test.go +++ b/internal/tools/redis/redis_test.go @@ -54,7 +54,7 @@ func TestParseFromYamlRedis(t *testing.T) { want: server.ToolConfigs{ "redis_tool": redis.Config{ Name: "redis_tool", - Kind: "redis", + Type: "redis", Source: "my-redis-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/serverlessspark/createbatch/config.go b/internal/tools/serverlessspark/createbatch/config.go index bcbf611584..2616ff794d 100644 --- a/internal/tools/serverlessspark/createbatch/config.go +++ b/internal/tools/serverlessspark/createbatch/config.go @@ -43,7 +43,7 @@ type compatibleSource interface { // Initialize implementation. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` RuntimeConfig *dataprocpb.RuntimeConfig `yaml:"runtimeConfig"` @@ -56,7 +56,7 @@ func NewConfig(ctx context.Context, name string, decoder *yaml.Decoder) (Config, // conversion for RuntimeConfig and EnvironmentConfig. var ymlCfg struct { Name string `yaml:"name"` - Kind string `yaml:"kind"` + Type string `yaml:"kind"` Source string `yaml:"source"` Description string `yaml:"description"` RuntimeConfig any `yaml:"runtimeConfig"` @@ -70,7 +70,7 @@ func NewConfig(ctx context.Context, name string, decoder *yaml.Decoder) (Config, cfg := Config{ Name: name, - Kind: ymlCfg.Kind, + Type: ymlCfg.Type, Source: ymlCfg.Source, Description: ymlCfg.Description, AuthRequired: ymlCfg.AuthRequired, diff --git a/internal/tools/serverlessspark/createbatch/tool.go b/internal/tools/serverlessspark/createbatch/tool.go index dca7081aa6..cec6635d2c 100644 --- a/internal/tools/serverlessspark/createbatch/tool.go +++ b/internal/tools/serverlessspark/createbatch/tool.go @@ -34,7 +34,7 @@ type BatchBuilder interface { func NewTool(cfg Config, originalCfg tools.ToolConfig, srcs map[string]sources.Source, builder BatchBuilder) (*Tool, error) { desc := cfg.Description if desc == "" { - desc = fmt.Sprintf("Creates a Serverless Spark (aka Dataproc Serverless) %s operation.", cfg.Kind) + desc = fmt.Sprintf("Creates a Serverless Spark (aka Dataproc Serverless) %s operation.", cfg.Type) } allParameters := builder.Parameters() @@ -66,7 +66,7 @@ type Tool struct { } func (t *Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch.go b/internal/tools/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch.go index fe072f0760..2acbc91999 100644 --- a/internal/tools/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch.go +++ b/internal/tools/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch.go @@ -31,7 +31,7 @@ const kind = "serverless-spark-cancel-batch" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the unique name for this tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the unique name for this tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -100,7 +100,7 @@ type Tool struct { // Invoke executes the tool's operation. func (t *Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch_test.go b/internal/tools/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch_test.go index 5348399a32..43278f1d37 100644 --- a/internal/tools/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch_test.go +++ b/internal/tools/serverlessspark/serverlesssparkcancelbatch/serverlesssparkcancelbatch_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "example_tool": serverlesssparkcancelbatch.Config{ Name: "example_tool", - Kind: "serverless-spark-cancel-batch", + Type: "serverless-spark-cancel-batch", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/serverlessspark/serverlesssparkcreatepysparkbatch/serverlesssparkcreatepysparkbatch.go b/internal/tools/serverlessspark/serverlesssparkcreatepysparkbatch/serverlesssparkcreatepysparkbatch.go index d07fa01b92..c7ae185237 100644 --- a/internal/tools/serverlessspark/serverlesssparkcreatepysparkbatch/serverlesssparkcreatepysparkbatch.go +++ b/internal/tools/serverlessspark/serverlesssparkcreatepysparkbatch/serverlesssparkcreatepysparkbatch.go @@ -30,7 +30,7 @@ const kind = "serverless-spark-create-pyspark-batch" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,8 +49,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the unique name for this tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the unique name for this tool. +func (cfg Config) ToolConfigType() string { return kind } diff --git a/internal/tools/serverlessspark/serverlesssparkcreatesparkbatch/serverlesssparkcreatesparkbatch.go b/internal/tools/serverlessspark/serverlesssparkcreatesparkbatch/serverlesssparkcreatesparkbatch.go index e16b1904e2..91d6e811ba 100644 --- a/internal/tools/serverlessspark/serverlesssparkcreatesparkbatch/serverlesssparkcreatesparkbatch.go +++ b/internal/tools/serverlessspark/serverlesssparkcreatesparkbatch/serverlesssparkcreatesparkbatch.go @@ -30,7 +30,7 @@ const kind = "serverless-spark-create-spark-batch" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,8 +49,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the unique name for this tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the unique name for this tool. +func (cfg Config) ToolConfigType() string { return kind } diff --git a/internal/tools/serverlessspark/serverlesssparkgetbatch/serverlesssparkgetbatch.go b/internal/tools/serverlessspark/serverlesssparkgetbatch/serverlesssparkgetbatch.go index 85d1247fff..0f1229a696 100644 --- a/internal/tools/serverlessspark/serverlesssparkgetbatch/serverlesssparkgetbatch.go +++ b/internal/tools/serverlessspark/serverlesssparkgetbatch/serverlesssparkgetbatch.go @@ -31,7 +31,7 @@ const kind = "serverless-spark-get-batch" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -59,8 +59,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the unique name for this tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the unique name for this tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -100,7 +100,7 @@ type Tool struct { // Invoke executes the tool's operation. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/serverlessspark/serverlesssparkgetbatch/serverlesssparkgetbatch_test.go b/internal/tools/serverlessspark/serverlesssparkgetbatch/serverlesssparkgetbatch_test.go index f7589f7b07..67b7df94c3 100644 --- a/internal/tools/serverlessspark/serverlesssparkgetbatch/serverlesssparkgetbatch_test.go +++ b/internal/tools/serverlessspark/serverlesssparkgetbatch/serverlesssparkgetbatch_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "example_tool": serverlesssparkgetbatch.Config{ Name: "example_tool", - Kind: "serverless-spark-get-batch", + Type: "serverless-spark-get-batch", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/serverlessspark/serverlesssparklistbatches/serverlesssparklistbatches.go b/internal/tools/serverlessspark/serverlesssparklistbatches/serverlesssparklistbatches.go index 3757b9a6e6..94fc755778 100644 --- a/internal/tools/serverlessspark/serverlesssparklistbatches/serverlesssparklistbatches.go +++ b/internal/tools/serverlessspark/serverlesssparklistbatches/serverlesssparklistbatches.go @@ -30,7 +30,7 @@ const kind = "serverless-spark-list-batches" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -58,8 +58,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the unique name for this tool. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the unique name for this tool. +func (cfg Config) ToolConfigType() string { return kind } @@ -101,7 +101,7 @@ type Tool struct { // Invoke executes the tool's operation. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/serverlessspark/serverlesssparklistbatches/serverlesssparklistbatches_test.go b/internal/tools/serverlessspark/serverlesssparklistbatches/serverlesssparklistbatches_test.go index 95a1123740..6093c5a811 100644 --- a/internal/tools/serverlessspark/serverlesssparklistbatches/serverlesssparklistbatches_test.go +++ b/internal/tools/serverlessspark/serverlesssparklistbatches/serverlesssparklistbatches_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "example_tool": serverlesssparklistbatches.Config{ Name: "example_tool", - Kind: "serverless-spark-list-batches", + Type: "serverless-spark-list-batches", Source: "my-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/serverlessspark/testutils/testutils.go b/internal/tools/serverlessspark/testutils/testutils.go index a8a2cfc5a3..bb0d8c8e32 100644 --- a/internal/tools/serverlessspark/testutils/testutils.go +++ b/internal/tools/serverlessspark/testutils/testutils.go @@ -55,7 +55,7 @@ func RunParseFromYAMLTests(t *testing.T, kind string, newConfig func(c createbat want: server.ToolConfigs{ "example_tool": newConfig(createbatch.Config{ Name: "example_tool", - Kind: kind, + Type: kind, Source: "my-instance", Description: "some description", AuthRequired: []string{}, @@ -80,7 +80,7 @@ func RunParseFromYAMLTests(t *testing.T, kind string, newConfig func(c createbat want: server.ToolConfigs{ "example_tool": newConfig(createbatch.Config{ Name: "example_tool", - Kind: kind, + Type: kind, Source: "my-instance", Description: "some description", RuntimeConfig: &dataproc.RuntimeConfig{ diff --git a/internal/tools/singlestore/singlestoreexecutesql/singlestoreexecutesql.go b/internal/tools/singlestore/singlestoreexecutesql/singlestoreexecutesql.go index dda577f2eb..48b7abd2e1 100644 --- a/internal/tools/singlestore/singlestoreexecutesql/singlestoreexecutesql.go +++ b/internal/tools/singlestore/singlestoreexecutesql/singlestoreexecutesql.go @@ -31,7 +31,7 @@ const kind string = "singlestore-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { // Config represents the configuration for the singlestore-execute-sql tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -60,8 +60,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool configuration. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool configuration. +func (cfg Config) ToolConfigType() string { return kind } @@ -99,7 +99,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // Invoke executes the provided SQL query using the tool's database connection and returns the results. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/singlestore/singlestoreexecutesql/singlestoreexecutesql_test.go b/internal/tools/singlestore/singlestoreexecutesql/singlestoreexecutesql_test.go index f68455cf42..df27e46890 100644 --- a/internal/tools/singlestore/singlestoreexecutesql/singlestoreexecutesql_test.go +++ b/internal/tools/singlestore/singlestoreexecutesql/singlestoreexecutesql_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": singlestoreexecutesql.Config{ Name: "example_tool", - Kind: "singlestore-execute-sql", + Type: "singlestore-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/singlestore/singlestoresql/singlestoresql.go b/internal/tools/singlestore/singlestoresql/singlestoresql.go index ff5862ef26..50051ea211 100644 --- a/internal/tools/singlestore/singlestoresql/singlestoresql.go +++ b/internal/tools/singlestore/singlestoresql/singlestoresql.go @@ -30,7 +30,7 @@ const kind string = "singlestore-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { // Config defines the configuration for a SingleStore SQL tool. type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -62,8 +62,8 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -// ToolConfigKind returns the kind of the tool configuration. -func (cfg Config) ToolConfigKind() string { +// ToolConfigType returns the kind of the tool configuration. +func (cfg Config) ToolConfigType() string { return kind } @@ -127,7 +127,7 @@ func (t Tool) ToConfig() tools.ToolConfig { // - A slice of maps, where each map represents a row with column names as keys. // - An error if template resolution, parameter extraction, query execution, or result processing fails. func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/singlestore/singlestoresql/singlestoresql_test.go b/internal/tools/singlestore/singlestoresql/singlestoresql_test.go index a4c7559cf4..f65a147487 100644 --- a/internal/tools/singlestore/singlestoresql/singlestoresql_test.go +++ b/internal/tools/singlestore/singlestoresql/singlestoresql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlSingleStore(t *testing.T) { want: server.ToolConfigs{ "example_tool": singlestoresql.Config{ Name: "example_tool", - Kind: "singlestore-sql", + Type: "singlestore-sql", Source: "my-singlestore-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -139,7 +139,7 @@ func TestParseFromYamlWithTemplateParamsSingleStore(t *testing.T) { want: server.ToolConfigs{ "example_tool": singlestoresql.Config{ Name: "example_tool", - Kind: "singlestore-sql", + Type: "singlestore-sql", Source: "my-singlestore-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/snowflake/snowflakeexecutesql/snowflakeexecutesql.go b/internal/tools/snowflake/snowflakeexecutesql/snowflakeexecutesql.go index ce089a87cb..1ac6eb6fe0 100644 --- a/internal/tools/snowflake/snowflakeexecutesql/snowflakeexecutesql.go +++ b/internal/tools/snowflake/snowflakeexecutesql/snowflakeexecutesql.go @@ -31,7 +31,7 @@ const kind string = "snowflake-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -59,7 +59,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -90,7 +90,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/snowflake/snowflakeexecutesql/snowflakeexecutesql_test.go b/internal/tools/snowflake/snowflakeexecutesql/snowflakeexecutesql_test.go index b9cd5da63b..c6513c6097 100644 --- a/internal/tools/snowflake/snowflakeexecutesql/snowflakeexecutesql_test.go +++ b/internal/tools/snowflake/snowflakeexecutesql/snowflakeexecutesql_test.go @@ -46,7 +46,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "my-snowflake-tool": snowflakeexecutesql.Config{ Name: "my-snowflake-tool", - Kind: "snowflake-execute-sql", + Type: "snowflake-execute-sql", Source: "my-snowflake-source", Description: "Execute SQL on Snowflake", AuthRequired: []string{}, diff --git a/internal/tools/snowflake/snowflakesql/snowflakesql.go b/internal/tools/snowflake/snowflakesql/snowflakesql.go index c53e265a3a..3591907202 100644 --- a/internal/tools/snowflake/snowflakesql/snowflakesql.go +++ b/internal/tools/snowflake/snowflakesql/snowflakesql.go @@ -30,7 +30,7 @@ const kind string = "snowflake-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/snowflake/snowflakesql/snowflakesql_test.go b/internal/tools/snowflake/snowflakesql/snowflakesql_test.go index 3432108482..969634ed85 100644 --- a/internal/tools/snowflake/snowflakesql/snowflakesql_test.go +++ b/internal/tools/snowflake/snowflakesql/snowflakesql_test.go @@ -47,7 +47,7 @@ func TestParseFromYaml(t *testing.T) { want: server.ToolConfigs{ "my-snowflake-tool": snowflakesql.Config{ Name: "my-snowflake-tool", - Kind: "snowflake-sql", + Type: "snowflake-sql", Source: "my-snowflake-source", Description: "Execute parameterized SQL on Snowflake", Statement: "SELECT * FROM my_table WHERE id = $1", diff --git a/internal/tools/spanner/spannerexecutesql/spannerexecutesql.go b/internal/tools/spanner/spannerexecutesql/spannerexecutesql.go index 8a5f6c6d0c..38a3a4059d 100644 --- a/internal/tools/spanner/spannerexecutesql/spannerexecutesql.go +++ b/internal/tools/spanner/spannerexecutesql/spannerexecutesql.go @@ -31,7 +31,7 @@ const kind string = "spanner-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -92,7 +92,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/spanner/spannerexecutesql/spannerexecutesql_test.go b/internal/tools/spanner/spannerexecutesql/spannerexecutesql_test.go index a406b37880..1a42ee97b7 100644 --- a/internal/tools/spanner/spannerexecutesql/spannerexecutesql_test.go +++ b/internal/tools/spanner/spannerexecutesql/spannerexecutesql_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannerexecutesql.Config{ Name: "example_tool", - Kind: "spanner-execute-sql", + Type: "spanner-execute-sql", Source: "my-spanner-instance", Description: "some description", AuthRequired: []string{}, @@ -67,7 +67,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannerexecutesql.Config{ Name: "example_tool", - Kind: "spanner-execute-sql", + Type: "spanner-execute-sql", Source: "my-spanner-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/spanner/spannerlistgraphs/spannerlistgraphs.go b/internal/tools/spanner/spannerlistgraphs/spannerlistgraphs.go index 6db7da58f9..23b7bfea59 100644 --- a/internal/tools/spanner/spannerlistgraphs/spannerlistgraphs.go +++ b/internal/tools/spanner/spannerlistgraphs/spannerlistgraphs.go @@ -31,7 +31,7 @@ const kind string = "spanner-list-graphs" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -106,7 +106,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/spanner/spannerlistgraphs/spannerlistgraphs_test.go b/internal/tools/spanner/spannerlistgraphs/spannerlistgraphs_test.go index eb4cca9e95..905fe3b38a 100644 --- a/internal/tools/spanner/spannerlistgraphs/spannerlistgraphs_test.go +++ b/internal/tools/spanner/spannerlistgraphs/spannerlistgraphs_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlListGraphs(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannerlistgraphs.Config{ Name: "example_tool", - Kind: "spanner-list-graphs", + Type: "spanner-list-graphs", Source: "my-spanner-instance", Description: "Lists graphs in the database", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYamlListGraphs(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannerlistgraphs.Config{ Name: "example_tool", - Kind: "spanner-list-graphs", + Type: "spanner-list-graphs", Source: "my-spanner-instance", Description: "Lists graphs in the database", AuthRequired: []string{"auth1", "auth2"}, @@ -86,7 +86,7 @@ func TestParseFromYamlListGraphs(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannerlistgraphs.Config{ Name: "example_tool", - Kind: "spanner-list-graphs", + Type: "spanner-list-graphs", Source: "my-spanner-instance", Description: "", AuthRequired: []string{}, diff --git a/internal/tools/spanner/spannerlisttables/spannerlisttables.go b/internal/tools/spanner/spannerlisttables/spannerlisttables.go index 9c9d1322c6..5551afd784 100644 --- a/internal/tools/spanner/spannerlisttables/spannerlisttables.go +++ b/internal/tools/spanner/spannerlisttables/spannerlisttables.go @@ -31,7 +31,7 @@ const kind string = "spanner-list-tables" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description"` AuthRequired []string `yaml:"authRequired"` @@ -60,7 +60,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -118,7 +118,7 @@ func getStatement(dialect string) string { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/spanner/spannerlisttables/spannerlisttables_test.go b/internal/tools/spanner/spannerlisttables/spannerlisttables_test.go index da4a9885c5..2a12ba8b36 100644 --- a/internal/tools/spanner/spannerlisttables/spannerlisttables_test.go +++ b/internal/tools/spanner/spannerlisttables/spannerlisttables_test.go @@ -46,7 +46,7 @@ func TestParseFromYamlListTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannerlisttables.Config{ Name: "example_tool", - Kind: "spanner-list-tables", + Type: "spanner-list-tables", Source: "my-spanner-instance", Description: "Lists tables in the database", AuthRequired: []string{}, @@ -68,7 +68,7 @@ func TestParseFromYamlListTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannerlisttables.Config{ Name: "example_tool", - Kind: "spanner-list-tables", + Type: "spanner-list-tables", Source: "my-spanner-instance", Description: "Lists tables in the database", AuthRequired: []string{"auth1", "auth2"}, @@ -86,7 +86,7 @@ func TestParseFromYamlListTables(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannerlisttables.Config{ Name: "example_tool", - Kind: "spanner-list-tables", + Type: "spanner-list-tables", Source: "my-spanner-instance", Description: "", AuthRequired: []string{}, diff --git a/internal/tools/spanner/spannersql/spanner_test.go b/internal/tools/spanner/spannersql/spanner_test.go index 5f86bcae6f..c261c4e53d 100644 --- a/internal/tools/spanner/spannersql/spanner_test.go +++ b/internal/tools/spanner/spannersql/spanner_test.go @@ -53,7 +53,7 @@ func TestParseFromYamlSpanner(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannersql.Config{ Name: "example_tool", - Kind: "spanner-sql", + Type: "spanner-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -83,7 +83,7 @@ func TestParseFromYamlSpanner(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannersql.Config{ Name: "example_tool", - Kind: "spanner-sql", + Type: "spanner-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -153,7 +153,7 @@ func TestParseFromYamlWithTemplateParamsSpanner(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannersql.Config{ Name: "example_tool", - Kind: "spanner-sql", + Type: "spanner-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -187,7 +187,7 @@ func TestParseFromYamlWithTemplateParamsSpanner(t *testing.T) { want: server.ToolConfigs{ "example_tool": spannersql.Config{ Name: "example_tool", - Kind: "spanner-sql", + Type: "spanner-sql", Source: "my-pg-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/spanner/spannersql/spannersql.go b/internal/tools/spanner/spannersql/spannersql.go index 7da22f5562..5bd8b9c622 100644 --- a/internal/tools/spanner/spannersql/spannersql.go +++ b/internal/tools/spanner/spannersql/spannersql.go @@ -31,7 +31,7 @@ const kind string = "spanner-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -51,7 +51,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -64,7 +64,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -108,7 +108,7 @@ func getMapParams(params parameters.ParamValues, dialect string) (map[string]int } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/sqlite/sqliteexecutesql/sqliteexecutesql.go b/internal/tools/sqlite/sqliteexecutesql/sqliteexecutesql.go index 682959d045..3fc76657c6 100644 --- a/internal/tools/sqlite/sqliteexecutesql/sqliteexecutesql.go +++ b/internal/tools/sqlite/sqliteexecutesql/sqliteexecutesql.go @@ -31,7 +31,7 @@ const kind string = "sqlite-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -59,7 +59,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -89,7 +89,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/sqlite/sqliteexecutesql/sqliteexecutesql_test.go b/internal/tools/sqlite/sqliteexecutesql/sqliteexecutesql_test.go index 63079a883e..0745da1308 100644 --- a/internal/tools/sqlite/sqliteexecutesql/sqliteexecutesql_test.go +++ b/internal/tools/sqlite/sqliteexecutesql/sqliteexecutesql_test.go @@ -50,7 +50,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": sqliteexecutesql.Config{ Name: "example_tool", - Kind: "sqlite-execute-sql", + Type: "sqlite-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/sqlite/sqlitesql/sqlitesql.go b/internal/tools/sqlite/sqlitesql/sqlitesql.go index f582c20841..45f83ae5ef 100644 --- a/internal/tools/sqlite/sqlitesql/sqlitesql.go +++ b/internal/tools/sqlite/sqlitesql/sqlitesql.go @@ -30,7 +30,7 @@ const kind string = "sqlite-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/sqlite/sqlitesql/sqlitesql_test.go b/internal/tools/sqlite/sqlitesql/sqlitesql_test.go index eea6fddf4f..c7716d69f3 100644 --- a/internal/tools/sqlite/sqlitesql/sqlitesql_test.go +++ b/internal/tools/sqlite/sqlitesql/sqlitesql_test.go @@ -62,7 +62,7 @@ func TestParseFromYamlSQLite(t *testing.T) { want: server.ToolConfigs{ "example_tool": sqlitesql.Config{ Name: "example_tool", - Kind: "sqlite-sql", + Type: "sqlite-sql", Source: "my-sqlite-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -141,7 +141,7 @@ func TestParseFromYamlWithTemplateSqlite(t *testing.T) { want: server.ToolConfigs{ "example_tool": sqlitesql.Config{ Name: "example_tool", - Kind: "sqlite-sql", + Type: "sqlite-sql", Source: "my-sqlite-db", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/tidb/tidbexecutesql/tidbexecutesql.go b/internal/tools/tidb/tidbexecutesql/tidbexecutesql.go index b530399d39..3878b1b663 100644 --- a/internal/tools/tidb/tidbexecutesql/tidbexecutesql.go +++ b/internal/tools/tidb/tidbexecutesql/tidbexecutesql.go @@ -31,7 +31,7 @@ const kind string = "tidb-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -50,7 +50,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -59,7 +59,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -90,7 +90,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/tidb/tidbexecutesql/tidbexecutesql_test.go b/internal/tools/tidb/tidbexecutesql/tidbexecutesql_test.go index 432743dbd9..4112386a11 100644 --- a/internal/tools/tidb/tidbexecutesql/tidbexecutesql_test.go +++ b/internal/tools/tidb/tidbexecutesql/tidbexecutesql_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlExecuteSql(t *testing.T) { want: server.ToolConfigs{ "example_tool": tidbexecutesql.Config{ Name: "example_tool", - Kind: "tidb-execute-sql", + Type: "tidb-execute-sql", Source: "my-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/tidb/tidbsql/tidbsql.go b/internal/tools/tidb/tidbsql/tidbsql.go index 421db27527..6a9295e94f 100644 --- a/internal/tools/tidb/tidbsql/tidbsql.go +++ b/internal/tools/tidb/tidbsql/tidbsql.go @@ -30,7 +30,7 @@ const kind string = "tidb-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/tidb/tidbsql/tidbsql_test.go b/internal/tools/tidb/tidbsql/tidbsql_test.go index 4a5c425d03..aa1d2b0328 100644 --- a/internal/tools/tidb/tidbsql/tidbsql_test.go +++ b/internal/tools/tidb/tidbsql/tidbsql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlTiDB(t *testing.T) { want: server.ToolConfigs{ "example_tool": tidbsql.Config{ Name: "example_tool", - Kind: "tidb-sql", + Type: "tidb-sql", Source: "my-tidb-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", @@ -139,7 +139,7 @@ func TestParseFromYamlWithTemplateParamsTiDB(t *testing.T) { want: server.ToolConfigs{ "example_tool": tidbsql.Config{ Name: "example_tool", - Kind: "tidb-sql", + Type: "tidb-sql", Source: "my-tidb-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/internal/tools/tools.go b/internal/tools/tools.go index daadf385b7..6eec101679 100644 --- a/internal/tools/tools.go +++ b/internal/tools/tools.go @@ -53,7 +53,7 @@ func Register(kind string, factory ToolConfigFactory) bool { func DecodeConfig(ctx context.Context, kind string, name string, decoder *yaml.Decoder) (ToolConfig, error) { factory, found := toolRegistry[kind] if !found { - return nil, fmt.Errorf("unknown tool kind: %q", kind) + return nil, fmt.Errorf("unknown tool type: %q", kind) } toolConfig, err := factory(ctx, name, decoder) if err != nil { @@ -63,7 +63,7 @@ func DecodeConfig(ctx context.Context, kind string, name string, decoder *yaml.D } type ToolConfig interface { - ToolConfigKind() string + ToolConfigType() string Initialize(map[string]sources.Source) (Tool, error) } @@ -160,7 +160,7 @@ func IsAuthorized(authRequiredSources []string, verifiedAuthServices []string) b return false } -func GetCompatibleSource[T any](resourceMgr SourceProvider, sourceName, toolName, toolKind string) (T, error) { +func GetCompatibleSource[T any](resourceMgr SourceProvider, sourceName, toolName, toolType string) (T, error) { var zero T s, ok := resourceMgr.GetSource(sourceName) if !ok { @@ -168,7 +168,7 @@ func GetCompatibleSource[T any](resourceMgr SourceProvider, sourceName, toolName } source, ok := s.(T) if !ok { - return zero, fmt.Errorf("invalid source for %q tool: source %q is not a compatible type", toolKind, sourceName) + return zero, fmt.Errorf("invalid source for %q tool: source %q is not a compatible type", toolType, sourceName) } return source, nil } diff --git a/internal/tools/trino/trinoexecutesql/trinoexecutesql.go b/internal/tools/trino/trinoexecutesql/trinoexecutesql.go index 529590e35e..a7e274e2fd 100644 --- a/internal/tools/trino/trinoexecutesql/trinoexecutesql.go +++ b/internal/tools/trino/trinoexecutesql/trinoexecutesql.go @@ -30,7 +30,7 @@ const kind string = "trino-execute-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -58,7 +58,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -89,7 +89,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/trino/trinoexecutesql/trinoexecutesql_test.go b/internal/tools/trino/trinoexecutesql/trinoexecutesql_test.go index 0af7ce1762..6a40a32b68 100644 --- a/internal/tools/trino/trinoexecutesql/trinoexecutesql_test.go +++ b/internal/tools/trino/trinoexecutesql/trinoexecutesql_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlTrinoExecuteSQL(t *testing.T) { want: server.ToolConfigs{ "example_tool": trinoexecutesql.Config{ Name: "example_tool", - Kind: "trino-execute-sql", + Type: "trino-execute-sql", Source: "my-trino-instance", Description: "some description", AuthRequired: []string{"my-google-auth-service", "other-auth-service"}, diff --git a/internal/tools/trino/trinosql/trinosql.go b/internal/tools/trino/trinosql/trinosql.go index eb75db07ee..00f7adb9ca 100644 --- a/internal/tools/trino/trinosql/trinosql.go +++ b/internal/tools/trino/trinosql/trinosql.go @@ -30,7 +30,7 @@ const kind string = "trino-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/trino/trinosql/trinosql_test.go b/internal/tools/trino/trinosql/trinosql_test.go index 2974e0dd04..4d55f5186b 100644 --- a/internal/tools/trino/trinosql/trinosql_test.go +++ b/internal/tools/trino/trinosql/trinosql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlTrino(t *testing.T) { want: server.ToolConfigs{ "example_tool": trinosql.Config{ Name: "example_tool", - Kind: "trino-sql", + Type: "trino-sql", Source: "my-trino-instance", Description: "some description", Statement: "SELECT * FROM catalog.schema.table WHERE id = ?;\n", @@ -145,7 +145,7 @@ func TestParseFromYamlWithTemplateParamsTrino(t *testing.T) { want: server.ToolConfigs{ "example_tool": trinosql.Config{ Name: "example_tool", - Kind: "trino-sql", + Type: "trino-sql", Source: "my-trino-instance", Description: "some description", Statement: "SELECT * FROM {{ .catalog }}.{{ .schema }}.{{ .tableName }} WHERE country = ?;\n", diff --git a/internal/tools/utility/wait/wait.go b/internal/tools/utility/wait/wait.go index a5724fdac9..14b1bc9624 100644 --- a/internal/tools/utility/wait/wait.go +++ b/internal/tools/utility/wait/wait.go @@ -30,7 +30,7 @@ const kind string = "wait" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -44,7 +44,7 @@ func newConfig(ctx context.Context, name string, decoder *yaml.Decoder) (tools.T type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Description string `yaml:"description" validate:"required"` Timeout string `yaml:"timeout" validate:"required"` AuthRequired []string `yaml:"authRequired"` @@ -52,7 +52,7 @@ type Config struct { var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } diff --git a/internal/tools/utility/wait/wait_test.go b/internal/tools/utility/wait/wait_test.go index fcd060ac6b..4d3a01c913 100644 --- a/internal/tools/utility/wait/wait_test.go +++ b/internal/tools/utility/wait/wait_test.go @@ -49,7 +49,7 @@ func TestParseFromYamlWait(t *testing.T) { want: server.ToolConfigs{ "example_tool": wait.Config{ Name: "example_tool", - Kind: "wait", + Type: "wait", Description: "some description", Timeout: "10s", AuthRequired: []string{"my-google-auth-service"}, diff --git a/internal/tools/valkey/valkey.go b/internal/tools/valkey/valkey.go index 6d3a8effc1..f14e5f1b24 100644 --- a/internal/tools/valkey/valkey.go +++ b/internal/tools/valkey/valkey.go @@ -29,7 +29,7 @@ const kind string = "valkey" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -48,7 +48,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Commands [][]string `yaml:"commands" validate:"required"` @@ -59,7 +59,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -85,7 +85,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/valkey/valkey_test.go b/internal/tools/valkey/valkey_test.go index 8b99471806..3ae44a4afa 100644 --- a/internal/tools/valkey/valkey_test.go +++ b/internal/tools/valkey/valkey_test.go @@ -54,7 +54,7 @@ func TestParseFromYamlvalkey(t *testing.T) { want: server.ToolConfigs{ "valkey_tool": valkey.Config{ Name: "valkey_tool", - Kind: "valkey", + Type: "valkey", Source: "my-valkey-instance", Description: "some description", AuthRequired: []string{}, diff --git a/internal/tools/yugabytedbsql/yugabytedbsql.go b/internal/tools/yugabytedbsql/yugabytedbsql.go index 53e05dcc99..52e8cbb76e 100644 --- a/internal/tools/yugabytedbsql/yugabytedbsql.go +++ b/internal/tools/yugabytedbsql/yugabytedbsql.go @@ -30,7 +30,7 @@ const kind string = "yugabytedb-sql" func init() { if !tools.Register(kind, newConfig) { - panic(fmt.Sprintf("tool kind %q already registered", kind)) + panic(fmt.Sprintf("tool type %q already registered", kind)) } } @@ -49,7 +49,7 @@ type compatibleSource interface { type Config struct { Name string `yaml:"name" validate:"required"` - Kind string `yaml:"kind" validate:"required"` + Type string `yaml:"kind" validate:"required"` Source string `yaml:"source" validate:"required"` Description string `yaml:"description" validate:"required"` Statement string `yaml:"statement" validate:"required"` @@ -61,7 +61,7 @@ type Config struct { // validate interface var _ tools.ToolConfig = Config{} -func (cfg Config) ToolConfigKind() string { +func (cfg Config) ToolConfigType() string { return kind } @@ -94,7 +94,7 @@ type Tool struct { } func (t Tool) Invoke(ctx context.Context, resourceMgr tools.SourceProvider, params parameters.ParamValues, accessToken tools.AccessToken) (any, error) { - source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Kind) + source, err := tools.GetCompatibleSource[compatibleSource](resourceMgr, t.Source, t.Name, t.Type) if err != nil { return nil, err } diff --git a/internal/tools/yugabytedbsql/yugabytedbsql_test.go b/internal/tools/yugabytedbsql/yugabytedbsql_test.go index e0a9cd1d04..16f6be8f33 100644 --- a/internal/tools/yugabytedbsql/yugabytedbsql_test.go +++ b/internal/tools/yugabytedbsql/yugabytedbsql_test.go @@ -61,7 +61,7 @@ func TestParseFromYamlYugabyteDBSQL(t *testing.T) { want: server.ToolConfigs{ "hotel_search": yugabytedbsql.Config{ Name: "hotel_search", - Kind: "yugabytedb-sql", + Type: "yugabytedb-sql", Source: "yb-source", Description: "search hotels by city", Statement: "SELECT * FROM hotels WHERE city = $1;\n", @@ -179,7 +179,7 @@ func TestParseFromYamlWithTemplateParamsYugabyteDB(t *testing.T) { want: server.ToolConfigs{ "example_tool": yugabytedbsql.Config{ Name: "example_tool", - Kind: "yugabytedb-sql", + Type: "yugabytedb-sql", Source: "my-yb-instance", Description: "some description", Statement: "SELECT * FROM SQL_STATEMENT;\n", diff --git a/tests/alloydb/alloydb_wait_for_operation_test.go b/tests/alloydb/alloydb_wait_for_operation_test.go index 1f027f5568..f4ba000723 100644 --- a/tests/alloydb/alloydb_wait_for_operation_test.go +++ b/tests/alloydb/alloydb_wait_for_operation_test.go @@ -37,7 +37,7 @@ import ( ) var ( - waitToolKind = "alloydb-wait-for-operation" + waitToolType = "alloydb-wait-for-operation" ) type waitForOperationTransport struct { @@ -245,12 +245,12 @@ func getWaitToolsConfig() map[string]any { }, "tools": map[string]any{ "wait-for-op1": map[string]any{ - "kind": waitToolKind, + "kind": waitToolType, "source": "my-alloydb-source", "description": "wait for op1", }, "wait-for-op2": map[string]any{ - "kind": waitToolKind, + "kind": waitToolType, "source": "my-alloydb-source", "description": "wait for op2", }, diff --git a/tests/alloydbainl/alloydb_ai_nl_integration_test.go b/tests/alloydbainl/alloydb_ai_nl_integration_test.go index 4c8754fdf4..7c9c31e134 100644 --- a/tests/alloydbainl/alloydb_ai_nl_integration_test.go +++ b/tests/alloydbainl/alloydb_ai_nl_integration_test.go @@ -33,8 +33,8 @@ import ( ) var ( - AlloyDBAINLSourceKind = "alloydb-postgres" - AlloyDBAINLToolKind = "alloydb-ai-nl" + AlloyDBAINLSourceType = "alloydb-postgres" + AlloyDBAINLToolType = "alloydb-ai-nl" AlloyDBAINLProject = os.Getenv("ALLOYDB_AI_NL_PROJECT") AlloyDBAINLRegion = os.Getenv("ALLOYDB_AI_NL_REGION") AlloyDBAINLCluster = os.Getenv("ALLOYDB_AI_NL_CLUSTER") @@ -62,7 +62,7 @@ func getAlloyDBAINLVars(t *testing.T) map[string]any { t.Fatal("'ALLOYDB_AI_NL_PASS' not set") } return map[string]any{ - "kind": AlloyDBAINLSourceKind, + "kind": AlloyDBAINLSourceType, "project": AlloyDBAINLProject, "cluster": AlloyDBAINLCluster, "instance": AlloyDBAINLInstance, @@ -291,13 +291,13 @@ func getAINLToolsConfig(sourceConfig map[string]any) map[string]any { }, "tools": map[string]any{ "my-simple-tool": map[string]any{ - "kind": AlloyDBAINLToolKind, + "kind": AlloyDBAINLToolType, "source": "my-instance", "description": "Simple tool to test end to end functionality.", "nlConfig": "my_nl_config", }, "my-auth-tool": map[string]any{ - "kind": AlloyDBAINLToolKind, + "kind": AlloyDBAINLToolType, "source": "my-instance", "description": "Tool to test authenticated parameters.", "nlConfig": "my_nl_config", @@ -316,7 +316,7 @@ func getAINLToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-required-tool": map[string]any{ - "kind": AlloyDBAINLToolKind, + "kind": AlloyDBAINLToolType, "source": "my-instance", "description": "Tool to test auth required invocation.", "nlConfig": "my_nl_config", diff --git a/tests/alloydbpg/alloydb_pg_integration_test.go b/tests/alloydbpg/alloydb_pg_integration_test.go index 32463f1ea0..191b9e8e21 100644 --- a/tests/alloydbpg/alloydb_pg_integration_test.go +++ b/tests/alloydbpg/alloydb_pg_integration_test.go @@ -32,8 +32,8 @@ import ( ) var ( - AlloyDBPostgresSourceKind = "alloydb-postgres" - AlloyDBPostgresToolKind = "postgres-sql" + AlloyDBPostgresSourceType = "alloydb-postgres" + AlloyDBPostgresToolType = "postgres-sql" AlloyDBPostgresProject = os.Getenv("ALLOYDB_POSTGRES_PROJECT") AlloyDBPostgresRegion = os.Getenv("ALLOYDB_POSTGRES_REGION") AlloyDBPostgresCluster = os.Getenv("ALLOYDB_POSTGRES_CLUSTER") @@ -61,7 +61,7 @@ func getAlloyDBPgVars(t *testing.T) map[string]any { t.Fatal("'ALLOYDB_POSTGRES_PASS' not set") } return map[string]any{ - "kind": AlloyDBPostgresSourceKind, + "kind": AlloyDBPostgresSourceType, "project": AlloyDBPostgresProject, "cluster": AlloyDBPostgresCluster, "instance": AlloyDBPostgresInstance, @@ -152,10 +152,10 @@ func TestAlloyDBPgToolEndpoints(t *testing.T) { defer tearDownVectorTable(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, AlloyDBPostgresToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, AlloyDBPostgresToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddExecuteSqlConfig(t, toolsFile, "postgres-execute-sql") tmplSelectCombined, tmplSelectFilterCombined := tests.GetPostgresSQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, AlloyDBPostgresToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, AlloyDBPostgresToolType, tmplSelectCombined, tmplSelectFilterCombined, "") // Add semantic search tool config insertStmt, searchStmt := tests.GetPostgresVectorSearchStmts(vectorTableName) @@ -232,7 +232,7 @@ func TestAlloyDBPgIpConnection(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { sourceConfig["ipType"] = tc.ipType - err := tests.RunSourceConnectionTest(t, sourceConfig, AlloyDBPostgresToolKind) + err := tests.RunSourceConnectionTest(t, sourceConfig, AlloyDBPostgresToolType) if err != nil { t.Fatalf("Connection test failure: %s", err) } @@ -247,7 +247,7 @@ func TestAlloyDBPgIAMConnection(t *testing.T) { serviceAccountEmail := strings.TrimSuffix(tests.ServiceAccountEmail, ".gserviceaccount.com") noPassSourceConfig := map[string]any{ - "kind": AlloyDBPostgresSourceKind, + "kind": AlloyDBPostgresSourceType, "project": AlloyDBPostgresProject, "cluster": AlloyDBPostgresCluster, "instance": AlloyDBPostgresInstance, @@ -257,7 +257,7 @@ func TestAlloyDBPgIAMConnection(t *testing.T) { } noUserSourceConfig := map[string]any{ - "kind": AlloyDBPostgresSourceKind, + "kind": AlloyDBPostgresSourceType, "project": AlloyDBPostgresProject, "cluster": AlloyDBPostgresCluster, "instance": AlloyDBPostgresInstance, @@ -267,7 +267,7 @@ func TestAlloyDBPgIAMConnection(t *testing.T) { } noUserNoPassSourceConfig := map[string]any{ - "kind": AlloyDBPostgresSourceKind, + "kind": AlloyDBPostgresSourceType, "project": AlloyDBPostgresProject, "cluster": AlloyDBPostgresCluster, "instance": AlloyDBPostgresInstance, @@ -297,7 +297,7 @@ func TestAlloyDBPgIAMConnection(t *testing.T) { } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - err := tests.RunSourceConnectionTest(t, tc.sourceConfig, AlloyDBPostgresToolKind) + err := tests.RunSourceConnectionTest(t, tc.sourceConfig, AlloyDBPostgresToolType) if err != nil { if tc.isErr { return diff --git a/tests/bigquery/bigquery_integration_test.go b/tests/bigquery/bigquery_integration_test.go index de5126cd24..94954ac2b8 100644 --- a/tests/bigquery/bigquery_integration_test.go +++ b/tests/bigquery/bigquery_integration_test.go @@ -41,8 +41,8 @@ import ( ) var ( - BigquerySourceKind = "bigquery" - BigqueryToolKind = "bigquery-sql" + BigquerySourceType = "bigquery" + BigqueryToolType = "bigquery-sql" BigqueryProject = os.Getenv("BIGQUERY_PROJECT") ) @@ -53,7 +53,7 @@ func getBigQueryVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": BigquerySourceKind, + "kind": BigquerySourceType, "project": BigqueryProject, } } @@ -146,12 +146,12 @@ func TestBigQueryToolEndpoints(t *testing.T) { defer teardownTable5(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, BigqueryToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, BigqueryToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = addClientAuthSourceConfig(t, toolsFile) toolsFile = addBigQuerySqlToolConfig(t, toolsFile, dataTypeToolStmt, arrayDataTypeToolStmt) toolsFile = addBigQueryPrebuiltToolsConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := getBigQueryTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, BigqueryToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, BigqueryToolType, tmplSelectCombined, tmplSelectFilterCombined, "") cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { @@ -879,7 +879,7 @@ func addClientAuthSourceConfig(t *testing.T, config map[string]any) map[string]a t.Fatalf("unable to get sources from config") } sources["my-client-auth-source"] = map[string]any{ - "kind": BigquerySourceKind, + "kind": BigquerySourceType, "project": BigqueryProject, "useClientOAuth": true, } diff --git a/tests/bigtable/bigtable_integration_test.go b/tests/bigtable/bigtable_integration_test.go index 12246cf398..1672095b76 100644 --- a/tests/bigtable/bigtable_integration_test.go +++ b/tests/bigtable/bigtable_integration_test.go @@ -35,8 +35,8 @@ import ( ) var ( - BigtableSourceKind = "bigtable" - BigtableToolKind = "bigtable-sql" + BigtableSourceType = "bigtable" + BigtableToolType = "bigtable-sql" BigtableProject = os.Getenv("BIGTABLE_PROJECT") BigtableInstance = os.Getenv("BIGTABLE_INSTANCE") ) @@ -50,7 +50,7 @@ func getBigtableVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": BigtableSourceKind, + "kind": BigtableSourceType, "project": BigtableProject, "instance": BigtableInstance, } @@ -99,7 +99,7 @@ func TestBigtableToolEndpoints(t *testing.T) { defer teardownTableTmpl(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, BigtableToolKind, paramTestStatement, idParamTestStatement, nameParamTestStatement, arrayTestStatement, authToolStatement) + toolsFile := tests.GetToolsConfig(sourceConfig, BigtableToolType, paramTestStatement, idParamTestStatement, nameParamTestStatement, arrayTestStatement, authToolStatement) toolsFile = addTemplateParamConfig(t, toolsFile) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) diff --git a/tests/cassandra/cassandra_integration_test.go b/tests/cassandra/cassandra_integration_test.go index 21d41beb5f..ec52324591 100644 --- a/tests/cassandra/cassandra_integration_test.go +++ b/tests/cassandra/cassandra_integration_test.go @@ -31,8 +31,8 @@ import ( ) var ( - CassandraSourceKind = "cassandra" - CassandraToolKind = "cassandra-cql" + CassandraSourceType = "cassandra" + CassandraToolType = "cassandra-cql" Hosts = os.Getenv("CASSANDRA_HOST") Keyspace = "example_keyspace" Username = os.Getenv("CASSANDRA_USER") @@ -49,7 +49,7 @@ func getCassandraVars(t *testing.T) map[string]any { t.Fatal("'Password' not set") } return map[string]any{ - "kind": CassandraSourceKind, + "kind": CassandraSourceType, "hosts": strings.Split(Hosts, ","), "keyspace": Keyspace, "username": Username, @@ -204,12 +204,12 @@ func TestCassandra(t *testing.T) { paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt := createParamToolInfo(paramTableName) _, _, authToolStmt := getCassandraAuthToolInfo(tableNameAuth) - toolsFile := tests.GetToolsConfig(sourceConfig, CassandraToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, CassandraToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) tmplSelectCombined, tmplSelectFilterCombined := getCassandraTmplToolInfo() tmpSelectAll := "SELECT * FROM {{.tableName}} where id = 1" - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, CassandraToolKind, tmplSelectCombined, tmplSelectFilterCombined, tmpSelectAll) + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, CassandraToolType, tmplSelectCombined, tmplSelectFilterCombined, tmpSelectAll) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/clickhouse/clickhouse_integration_test.go b/tests/clickhouse/clickhouse_integration_test.go index 058e4d1b1a..eddec8de8f 100644 --- a/tests/clickhouse/clickhouse_integration_test.go +++ b/tests/clickhouse/clickhouse_integration_test.go @@ -35,8 +35,8 @@ import ( ) var ( - ClickHouseSourceKind = "clickhouse" - ClickHouseToolKind = "clickhouse-sql" + ClickHouseSourceType = "clickhouse" + ClickHouseToolType = "clickhouse-sql" ClickHouseDatabase = os.Getenv("CLICKHOUSE_DATABASE") ClickHouseHost = os.Getenv("CLICKHOUSE_HOST") ClickHousePort = os.Getenv("CLICKHOUSE_PORT") @@ -64,7 +64,7 @@ func getClickHouseVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": ClickHouseSourceKind, + "kind": ClickHouseSourceType, "host": ClickHouseHost, "port": ClickHousePort, "database": ClickHouseDatabase, @@ -126,10 +126,10 @@ func TestClickHouse(t *testing.T) { teardownTable2 := setupClickHouseSQLTable(t, ctx, pool, createAuthTableStmt, insertAuthTableStmt, tableNameAuth, authTestParams) defer teardownTable2(t) - toolsFile := tests.GetToolsConfig(sourceConfig, ClickHouseToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, ClickHouseToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = addClickHouseExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := getClickHouseSQLTmplToolStatement() - toolsFile = addClickHouseTemplateParamConfig(t, toolsFile, ClickHouseToolKind, tmplSelectCombined, tmplSelectFilterCombined) + toolsFile = addClickHouseTemplateParamConfig(t, toolsFile, ClickHouseToolType, tmplSelectCombined, tmplSelectFilterCombined) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { @@ -178,7 +178,7 @@ func addClickHouseExecuteSqlConfig(t *testing.T, config map[string]any) map[stri return config } -func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplSelectCombined, tmplSelectFilterCombined string) map[string]any { +func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplSelectCombined, tmplSelectFilterCombined string) map[string]any { toolsMap, ok := config["tools"].(map[string]any) if !ok { t.Fatalf("unable to get tools from config") @@ -186,7 +186,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolK // ClickHouse-specific template parameter tools with compatible syntax toolsMap["create-table-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Create table tool with template parameters", "statement": "CREATE TABLE {{.tableName}} ({{array .columns}}) ORDER BY id", @@ -196,7 +196,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolK }, } toolsMap["insert-table-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Insert table tool with template parameters", "statement": "INSERT INTO {{.tableName}} ({{array .columns}}) VALUES ({{.values}})", @@ -207,7 +207,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolK }, } toolsMap["select-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Select table tool with template parameters", "statement": "SELECT id AS \"id\", name AS \"name\", age AS \"age\" FROM {{.tableName}} ORDER BY id", @@ -216,7 +216,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolK }, } toolsMap["select-templateParams-combined-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Select table tool with combined template parameters", "statement": tmplSelectCombined, @@ -228,7 +228,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolK }, } toolsMap["select-fields-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Select specific fields tool with template parameters", "statement": "SELECT name AS \"name\" FROM {{.tableName}} ORDER BY id", @@ -237,7 +237,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolK }, } toolsMap["select-filter-templateParams-combined-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Select table tool with filter template parameters", "statement": tmplSelectFilterCombined, @@ -251,7 +251,7 @@ func addClickHouseTemplateParamConfig(t *testing.T, config map[string]any, toolK } // Firebird uses simple DROP TABLE syntax without IF EXISTS toolsMap["drop-table-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Drop table tool with template parameters", "statement": "DROP TABLE {{.tableName}}", @@ -310,7 +310,7 @@ func TestClickHouseBasicConnection(t *testing.T) { }, "tools": map[string]any{ "my-simple-tool": map[string]any{ - "kind": ClickHouseToolKind, + "kind": ClickHouseToolType, "source": "my-instance", "description": "Simple tool to test end to end functionality.", "statement": "SELECT 1;", @@ -386,13 +386,13 @@ func TestClickHouseSQLTool(t *testing.T) { }, "tools": map[string]any{ "test-select": map[string]any{ - "kind": ClickHouseToolKind, + "kind": ClickHouseToolType, "source": "my-instance", "description": "Test select query", "statement": fmt.Sprintf("SELECT * FROM %s ORDER BY id", tableName), }, "test-param-query": map[string]any{ - "kind": ClickHouseToolKind, + "kind": ClickHouseToolType, "source": "my-instance", "description": "Test parameterized query", "statement": fmt.Sprintf("SELECT * FROM %s WHERE age > ? ORDER BY id", tableName), @@ -401,7 +401,7 @@ func TestClickHouseSQLTool(t *testing.T) { }, }, "test-empty-result": map[string]any{ - "kind": ClickHouseToolKind, + "kind": ClickHouseToolType, "source": "my-instance", "description": "Test query with no results", "statement": fmt.Sprintf("SELECT * FROM %s WHERE id = ?", tableName), @@ -410,7 +410,7 @@ func TestClickHouseSQLTool(t *testing.T) { }, }, "test-invalid-sql": map[string]any{ - "kind": ClickHouseToolKind, + "kind": ClickHouseToolType, "source": "my-instance", "description": "Test invalid SQL", "statement": "SELEC * FROM nonexistent_table", // Typo in SELECT diff --git a/tests/cloudgda/cloud_gda_integration_test.go b/tests/cloudgda/cloud_gda_integration_test.go index 343973f147..ed9ac6a94c 100644 --- a/tests/cloudgda/cloud_gda_integration_test.go +++ b/tests/cloudgda/cloud_gda_integration_test.go @@ -33,7 +33,7 @@ import ( ) var ( - cloudGdaToolKind = "cloud-gemini-data-analytics-query" + cloudGdaToolType = "cloud-gemini-data-analytics-query" ) type cloudGdaTransport struct { @@ -211,7 +211,7 @@ func getCloudGdaToolsConfig() map[string]any { }, "tools": map[string]any{ "cloud-gda-query": map[string]any{ - "kind": cloudGdaToolKind, + "kind": cloudGdaToolType, "source": "my-gda-source", "description": "Test GDA Tool", "location": "us-central1", diff --git a/tests/cloudhealthcare/cloud_healthcare_integration_test.go b/tests/cloudhealthcare/cloud_healthcare_integration_test.go index 4fdddcb84a..714c260996 100644 --- a/tests/cloudhealthcare/cloud_healthcare_integration_test.go +++ b/tests/cloudhealthcare/cloud_healthcare_integration_test.go @@ -41,22 +41,22 @@ import ( ) var ( - healthcareSourceKind = "cloud-healthcare" - getDatasetToolKind = "cloud-healthcare-get-dataset" - listFHIRStoresToolKind = "cloud-healthcare-list-fhir-stores" - listDICOMStoresToolKind = "cloud-healthcare-list-dicom-stores" - getFHIRStoreToolKind = "cloud-healthcare-get-fhir-store" - getFHIRStoreMetricsToolKind = "cloud-healthcare-get-fhir-store-metrics" - getFHIRResourceToolKind = "cloud-healthcare-get-fhir-resource" - fhirPatientSearchToolKind = "cloud-healthcare-fhir-patient-search" - fhirPatientEverythingToolKind = "cloud-healthcare-fhir-patient-everything" - fhirFetchPageToolKind = "cloud-healthcare-fhir-fetch-page" - getDICOMStoreToolKind = "cloud-healthcare-get-dicom-store" - getDICOMStoreMetricsToolKind = "cloud-healthcare-get-dicom-store-metrics" - searchDICOMStudiesToolKind = "cloud-healthcare-search-dicom-studies" - searchDICOMSeriesToolKind = "cloud-healthcare-search-dicom-series" - searchDICOMInstancesToolKind = "cloud-healthcare-search-dicom-instances" - retrieveRenderedDICOMInstanceToolKind = "cloud-healthcare-retrieve-rendered-dicom-instance" + healthcareSourceType = "cloud-healthcare" + getDatasetToolType = "cloud-healthcare-get-dataset" + listFHIRStoresToolType = "cloud-healthcare-list-fhir-stores" + listDICOMStoresToolType = "cloud-healthcare-list-dicom-stores" + getFHIRStoreToolType = "cloud-healthcare-get-fhir-store" + getFHIRStoreMetricsToolType = "cloud-healthcare-get-fhir-store-metrics" + getFHIRResourceToolType = "cloud-healthcare-get-fhir-resource" + fhirPatientSearchToolType = "cloud-healthcare-fhir-patient-search" + fhirPatientEverythingToolType = "cloud-healthcare-fhir-patient-everything" + fhirFetchPageToolType = "cloud-healthcare-fhir-fetch-page" + getDICOMStoreToolType = "cloud-healthcare-get-dicom-store" + getDICOMStoreMetricsToolType = "cloud-healthcare-get-dicom-store-metrics" + searchDICOMStudiesToolType = "cloud-healthcare-search-dicom-studies" + searchDICOMSeriesToolType = "cloud-healthcare-search-dicom-series" + searchDICOMInstancesToolType = "cloud-healthcare-search-dicom-instances" + retrieveRenderedDICOMInstanceToolType = "cloud-healthcare-retrieve-rendered-dicom-instance" healthcareProject = os.Getenv("HEALTHCARE_PROJECT") healthcareRegion = os.Getenv("HEALTHCARE_REGION") healthcareDataset = os.Getenv("HEALTHCARE_DATASET") @@ -92,7 +92,7 @@ func getHealthcareVars(t *testing.T) map[string]any { t.Fatal("'HEALTHCARE_PREPOPULATED_DICOM_STORE' not set") } return map[string]any{ - "kind": healthcareSourceKind, + "kind": healthcareSourceType, "project": healthcareProject, "region": healthcareRegion, "dataset": healthcareDataset, @@ -336,157 +336,157 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, "tools": map[string]any{ "my-get-dataset-tool": map[string]any{ - "kind": getDatasetToolKind, + "kind": getDatasetToolType, "source": "my-instance", "description": "Tool to get a healthcare dataset", }, "my-list-fhir-stores-tool": map[string]any{ - "kind": listFHIRStoresToolKind, + "kind": listFHIRStoresToolType, "source": "my-instance", "description": "Tool to list FHIR stores", }, "my-list-dicom-stores-tool": map[string]any{ - "kind": listDICOMStoresToolKind, + "kind": listDICOMStoresToolType, "source": "my-instance", "description": "Tool to list DICOM stores", }, "my-get-fhir-store-tool": map[string]any{ - "kind": getFHIRStoreToolKind, + "kind": getFHIRStoreToolType, "source": "my-instance", "description": "Tool to get a FHIR store", }, "my-get-fhir-store-metrics-tool": map[string]any{ - "kind": getFHIRStoreMetricsToolKind, + "kind": getFHIRStoreMetricsToolType, "source": "my-instance", "description": "Tool to get FHIR store metrics", }, "my-get-fhir-resource-tool": map[string]any{ - "kind": getFHIRResourceToolKind, + "kind": getFHIRResourceToolType, "source": "my-instance", "description": "Tool to get FHIR resource", }, "my-fhir-patient-search-tool": map[string]any{ - "kind": fhirPatientSearchToolKind, + "kind": fhirPatientSearchToolType, "source": "my-instance", "description": "Tool to search for patients", }, "my-fhir-patient-everything-tool": map[string]any{ - "kind": fhirPatientEverythingToolKind, + "kind": fhirPatientEverythingToolType, "source": "my-instance", "description": "Tool for patient everything", }, "my-fhir-fetch-page-tool": map[string]any{ - "kind": fhirFetchPageToolKind, + "kind": fhirFetchPageToolType, "source": "my-instance", "description": "Tool to fetch a page of FHIR resources", }, "my-get-dicom-store-tool": map[string]any{ - "kind": getDICOMStoreToolKind, + "kind": getDICOMStoreToolType, "source": "my-instance", "description": "Tool to get a DICOM store", }, "my-get-dicom-store-metrics-tool": map[string]any{ - "kind": getDICOMStoreMetricsToolKind, + "kind": getDICOMStoreMetricsToolType, "source": "my-instance", "description": "Tool to get DICOM store metrics", }, "my-search-dicom-studies-tool": map[string]any{ - "kind": searchDICOMStudiesToolKind, + "kind": searchDICOMStudiesToolType, "source": "my-instance", "description": "Tool to search DICOM studies", }, "my-search-dicom-series-tool": map[string]any{ - "kind": searchDICOMSeriesToolKind, + "kind": searchDICOMSeriesToolType, "source": "my-instance", "description": "Tool to search DICOM series", }, "my-search-dicom-instances-tool": map[string]any{ - "kind": searchDICOMInstancesToolKind, + "kind": searchDICOMInstancesToolType, "source": "my-instance", "description": "Tool to search DICOM instances", }, "my-retrieve-rendered-dicom-instance-tool": map[string]any{ - "kind": retrieveRenderedDICOMInstanceToolKind, + "kind": retrieveRenderedDICOMInstanceToolType, "source": "my-instance", "description": "Tool to retrieve rendered DICOM instance", }, "my-client-auth-get-dataset-tool": map[string]any{ - "kind": getDatasetToolKind, + "kind": getDatasetToolType, "source": "my-client-auth-source", "description": "Tool to get a healthcare dataset", }, "my-client-auth-list-fhir-stores-tool": map[string]any{ - "kind": listFHIRStoresToolKind, + "kind": listFHIRStoresToolType, "source": "my-client-auth-source", "description": "Tool to list FHIR stores", }, "my-client-auth-list-dicom-stores-tool": map[string]any{ - "kind": listDICOMStoresToolKind, + "kind": listDICOMStoresToolType, "source": "my-client-auth-source", "description": "Tool to list DICOM stores", }, "my-client-auth-get-fhir-store-tool": map[string]any{ - "kind": getFHIRStoreToolKind, + "kind": getFHIRStoreToolType, "source": "my-client-auth-source", "description": "Tool to get a FHIR store", }, "my-client-auth-get-fhir-store-metrics-tool": map[string]any{ - "kind": getFHIRStoreMetricsToolKind, + "kind": getFHIRStoreMetricsToolType, "source": "my-client-auth-source", "description": "Tool to get FHIR store metrics", }, "my-client-auth-get-fhir-resource-tool": map[string]any{ - "kind": getFHIRResourceToolKind, + "kind": getFHIRResourceToolType, "source": "my-client-auth-source", "description": "Tool to get FHIR resource", }, "my-client-auth-fhir-patient-search-tool": map[string]any{ - "kind": fhirPatientSearchToolKind, + "kind": fhirPatientSearchToolType, "source": "my-client-auth-source", "description": "Tool to search for patients", }, "my-client-auth-fhir-patient-everything-tool": map[string]any{ - "kind": fhirPatientEverythingToolKind, + "kind": fhirPatientEverythingToolType, "source": "my-client-auth-source", "description": "Tool for patient everything", }, "my-client-auth-fhir-fetch-page-tool": map[string]any{ - "kind": fhirFetchPageToolKind, + "kind": fhirFetchPageToolType, "source": "my-client-auth-source", "description": "Tool to fetch a page of FHIR resources", }, "my-client-auth-get-dicom-store-tool": map[string]any{ - "kind": getDICOMStoreToolKind, + "kind": getDICOMStoreToolType, "source": "my-client-auth-source", "description": "Tool to get a DICOM store", }, "my-client-auth-get-dicom-store-metrics-tool": map[string]any{ - "kind": getDICOMStoreMetricsToolKind, + "kind": getDICOMStoreMetricsToolType, "source": "my-client-auth-source", "description": "Tool to get DICOM store metrics", }, "my-client-auth-search-dicom-studies-tool": map[string]any{ - "kind": searchDICOMStudiesToolKind, + "kind": searchDICOMStudiesToolType, "source": "my-client-auth-source", "description": "Tool to search DICOM studies", }, "my-client-auth-search-dicom-series-tool": map[string]any{ - "kind": searchDICOMSeriesToolKind, + "kind": searchDICOMSeriesToolType, "source": "my-client-auth-source", "description": "Tool to search DICOM series", }, "my-client-auth-search-dicom-instances-tool": map[string]any{ - "kind": searchDICOMInstancesToolKind, + "kind": searchDICOMInstancesToolType, "source": "my-client-auth-source", "description": "Tool to search DICOM instances", }, "my-client-auth-retrieve-rendered-dicom-instance-tool": map[string]any{ - "kind": retrieveRenderedDICOMInstanceToolKind, + "kind": retrieveRenderedDICOMInstanceToolType, "source": "my-client-auth-source", "description": "Tool to retrieve rendered DICOM instance", }, "my-auth-get-dataset-tool": map[string]any{ - "kind": getDatasetToolKind, + "kind": getDatasetToolType, "source": "my-instance", "description": "Tool to get a healthcare dataset with auth", "authRequired": []string{ @@ -494,7 +494,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-list-fhir-stores-tool": map[string]any{ - "kind": listFHIRStoresToolKind, + "kind": listFHIRStoresToolType, "source": "my-instance", "description": "Tool to list FHIR stores with auth", "authRequired": []string{ @@ -502,7 +502,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-list-dicom-stores-tool": map[string]any{ - "kind": listDICOMStoresToolKind, + "kind": listDICOMStoresToolType, "source": "my-instance", "description": "Tool to list DICOM stores with auth", "authRequired": []string{ @@ -510,7 +510,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-get-fhir-store-tool": map[string]any{ - "kind": getFHIRStoreToolKind, + "kind": getFHIRStoreToolType, "source": "my-instance", "description": "Tool to get a FHIR store", "authRequired": []string{ @@ -518,7 +518,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-get-fhir-store-metrics-tool": map[string]any{ - "kind": getFHIRStoreMetricsToolKind, + "kind": getFHIRStoreMetricsToolType, "source": "my-instance", "description": "Tool to get FHIR store metrics", "authRequired": []string{ @@ -526,7 +526,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-get-fhir-resource-tool": map[string]any{ - "kind": getFHIRResourceToolKind, + "kind": getFHIRResourceToolType, "source": "my-instance", "description": "Tool to get FHIR resource", "authRequired": []string{ @@ -534,7 +534,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-fhir-patient-search-tool": map[string]any{ - "kind": fhirPatientSearchToolKind, + "kind": fhirPatientSearchToolType, "source": "my-instance", "description": "Tool to search for patients", "authRequired": []string{ @@ -542,7 +542,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-fhir-patient-everything-tool": map[string]any{ - "kind": fhirPatientEverythingToolKind, + "kind": fhirPatientEverythingToolType, "source": "my-instance", "description": "Tool for patient everything", "authRequired": []string{ @@ -550,7 +550,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-fhir-fetch-page-tool": map[string]any{ - "kind": fhirFetchPageToolKind, + "kind": fhirFetchPageToolType, "source": "my-instance", "description": "Tool to fetch a page of FHIR resources", "authRequired": []string{ @@ -558,7 +558,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-get-dicom-store-tool": map[string]any{ - "kind": getDICOMStoreToolKind, + "kind": getDICOMStoreToolType, "source": "my-instance", "description": "Tool to get a DICOM store", "authRequired": []string{ @@ -566,7 +566,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-get-dicom-store-metrics-tool": map[string]any{ - "kind": getDICOMStoreMetricsToolKind, + "kind": getDICOMStoreMetricsToolType, "source": "my-instance", "description": "Tool to get DICOM store metrics", "authRequired": []string{ @@ -574,7 +574,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-search-dicom-studies-tool": map[string]any{ - "kind": searchDICOMStudiesToolKind, + "kind": searchDICOMStudiesToolType, "source": "my-instance", "description": "Tool to search DICOM studies", "authRequired": []string{ @@ -582,7 +582,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-search-dicom-series-tool": map[string]any{ - "kind": searchDICOMSeriesToolKind, + "kind": searchDICOMSeriesToolType, "source": "my-instance", "description": "Tool to search DICOM series", "authRequired": []string{ @@ -590,7 +590,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-search-dicom-instances-tool": map[string]any{ - "kind": searchDICOMInstancesToolKind, + "kind": searchDICOMInstancesToolType, "source": "my-instance", "description": "Tool to search DICOM instances", "authRequired": []string{ @@ -598,7 +598,7 @@ func getToolsConfig(sourceConfig map[string]any) map[string]any { }, }, "my-auth-retrieve-rendered-dicom-instance-tool": map[string]any{ - "kind": retrieveRenderedDICOMInstanceToolKind, + "kind": retrieveRenderedDICOMInstanceToolType, "source": "my-instance", "description": "Tool to retrieve rendered DICOM instance", "authRequired": []string{ @@ -622,7 +622,7 @@ func addClientAuthSourceConfig(t *testing.T, config map[string]any) map[string]a t.Fatalf("unable to get sources from config") } sources["my-client-auth-source"] = map[string]any{ - "kind": healthcareSourceKind, + "kind": healthcareSourceType, "project": healthcareProject, "region": healthcareRegion, "dataset": healthcareDataset, diff --git a/tests/cloudmonitoring/cloud_monitoring_integration_test.go b/tests/cloudmonitoring/cloud_monitoring_integration_test.go index f5833244a6..54295cf5fb 100644 --- a/tests/cloudmonitoring/cloud_monitoring_integration_test.go +++ b/tests/cloudmonitoring/cloud_monitoring_integration_test.go @@ -49,7 +49,7 @@ func TestTool_Invoke(t *testing.T) { tool := cloudmonitoring.Tool{ Config: cloudmonitoring.Config{ Name: "test-cloudmonitoring", - Kind: "cloud-monitoring-query-prometheus", + Type: "cloud-monitoring-query-prometheus", Description: "Test Cloudmonitoring Tool", }, AllParams: parameters.Parameters{}, @@ -93,7 +93,7 @@ func TestTool_Invoke_Error(t *testing.T) { tool := cloudmonitoring.Tool{ Config: cloudmonitoring.Config{ Name: "test-cloudmonitoring", - Kind: "clou-monitoring-query-prometheus", + Type: "clou-monitoring-query-prometheus", Description: "Test Cloudmonitoring Tool", }, AllParams: parameters.Parameters{}, diff --git a/tests/cloudsql/cloud_sql_clone_instance_test.go b/tests/cloudsql/cloud_sql_clone_instance_test.go index f41062cb9a..b3a43d987f 100644 --- a/tests/cloudsql/cloud_sql_clone_instance_test.go +++ b/tests/cloudsql/cloud_sql_clone_instance_test.go @@ -38,7 +38,7 @@ import ( ) var ( - cloneInstanceToolKind = "cloud-sql-clone-instance" + cloneInstanceToolType = "cloud-sql-clone-instance" ) type cloneInstanceTransport struct { @@ -236,7 +236,7 @@ func getCloneInstanceToolsConfig() map[string]any { }, "tools": map[string]any{ "clone-instance": map[string]any{ - "kind": cloneInstanceToolKind, + "kind": cloneInstanceToolType, "source": "my-cloud-sql-source", }, }, diff --git a/tests/cloudsql/cloud_sql_create_backup_test.go b/tests/cloudsql/cloud_sql_create_backup_test.go index d9b7d05264..c637b00a92 100644 --- a/tests/cloudsql/cloud_sql_create_backup_test.go +++ b/tests/cloudsql/cloud_sql_create_backup_test.go @@ -36,7 +36,7 @@ import ( ) var ( - createBackupToolKind = "cloud-sql-create-backup" + createBackupToolType = "cloud-sql-create-backup" ) type createBackupTransport struct { @@ -224,7 +224,7 @@ func getCreateBackupToolsConfig() map[string]any { }, "tools": map[string]any{ "create-backup": map[string]any{ - "kind": createBackupToolKind, + "kind": createBackupToolType, "source": "my-cloud-sql-source", }, }, diff --git a/tests/cloudsql/cloud_sql_create_database_test.go b/tests/cloudsql/cloud_sql_create_database_test.go index a87bc8200b..2d2ab6da9e 100644 --- a/tests/cloudsql/cloud_sql_create_database_test.go +++ b/tests/cloudsql/cloud_sql_create_database_test.go @@ -35,7 +35,7 @@ import ( ) var ( - createDatabaseToolKind = "cloud-sql-create-database" + createDatabaseToolType = "cloud-sql-create-database" ) type createDatabaseTransport struct { @@ -222,7 +222,7 @@ func getCreateDatabaseToolsConfig() map[string]any { }, "tools": map[string]any{ "create-database": map[string]any{ - "kind": createDatabaseToolKind, + "kind": createDatabaseToolType, "source": "my-cloud-sql-source", }, }, diff --git a/tests/cloudsql/cloud_sql_create_users_test.go b/tests/cloudsql/cloud_sql_create_users_test.go index 39cc4320f1..fa566ae97e 100644 --- a/tests/cloudsql/cloud_sql_create_users_test.go +++ b/tests/cloudsql/cloud_sql_create_users_test.go @@ -35,7 +35,7 @@ import ( ) var ( - createUserToolKind = "cloud-sql-create-users" + createUserToolType = "cloud-sql-create-users" ) type createUsersTransport struct { @@ -234,7 +234,7 @@ func getCreateUsersToolsConfig() map[string]any { }, "tools": map[string]any{ "create-user": map[string]any{ - "kind": createUserToolKind, + "kind": createUserToolType, "source": "my-cloud-sql-source", }, }, diff --git a/tests/cloudsql/cloud_sql_get_instances_test.go b/tests/cloudsql/cloud_sql_get_instances_test.go index dc920a80dd..a94e751052 100644 --- a/tests/cloudsql/cloud_sql_get_instances_test.go +++ b/tests/cloudsql/cloud_sql_get_instances_test.go @@ -35,7 +35,7 @@ import ( ) var ( - getInstancesToolKind = "cloud-sql-get-instance" + getInstancesToolType = "cloud-sql-get-instance" ) type getInstancesTransport struct { @@ -53,7 +53,7 @@ func (t *getInstancesTransport) RoundTrip(req *http.Request) (*http.Response, er type instance struct { Name string `json:"name"` - Kind string `json:"kind"` + Type string `json:"kind"` } type handler struct { @@ -95,7 +95,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { func TestGetInstancesToolEndpoints(t *testing.T) { h := &handler{ instances: map[string]*instance{ - "instance-1": {Name: "instance-1", Kind: "sql#instance"}, + "instance-1": {Name: "instance-1", Type: "sql#instance"}, }, t: t, } @@ -240,12 +240,12 @@ func getToolsConfig() map[string]any { }, "tools": map[string]any{ "get-instance-1": map[string]any{ - "kind": getInstancesToolKind, + "kind": getInstancesToolType, "description": "get instance 1", "source": "my-cloud-sql-source", }, "get-instance-2": map[string]any{ - "kind": getInstancesToolKind, + "kind": getInstancesToolType, "description": "get instance 2", "source": "my-invalid-cloud-sql-source", }, diff --git a/tests/cloudsql/cloud_sql_list_databases_test.go b/tests/cloudsql/cloud_sql_list_databases_test.go index 6ee0f9b9eb..e17b0ffd18 100644 --- a/tests/cloudsql/cloud_sql_list_databases_test.go +++ b/tests/cloudsql/cloud_sql_list_databases_test.go @@ -34,7 +34,7 @@ import ( ) var ( - listDatabasesToolKind = "cloud-sql-list-databases" + listDatabasesToolType = "cloud-sql-list-databases" ) type listDatabasesTransport struct { @@ -205,7 +205,7 @@ func getListDatabasesToolsConfig() map[string]any { }, "tools": map[string]any{ "list-databases": map[string]any{ - "kind": listDatabasesToolKind, + "kind": listDatabasesToolType, "source": "my-cloud-sql-source", }, }, diff --git a/tests/cloudsql/cloudsql_wait_for_operation_test.go b/tests/cloudsql/cloudsql_wait_for_operation_test.go index ab8cab808e..7fcbf56b41 100644 --- a/tests/cloudsql/cloudsql_wait_for_operation_test.go +++ b/tests/cloudsql/cloudsql_wait_for_operation_test.go @@ -37,7 +37,7 @@ import ( ) var ( - cloudsqlWaitToolKind = "cloud-sql-wait-for-operation" + cloudsqlWaitToolType = "cloud-sql-wait-for-operation" ) type waitForOperationTransport struct { @@ -296,17 +296,17 @@ func getCloudSQLWaitToolsConfig() map[string]any { }, "tools": map[string]any{ "wait-for-op1": map[string]any{ - "kind": cloudsqlWaitToolKind, + "kind": cloudsqlWaitToolType, "source": "my-cloud-sql-source", "description": "wait for op1", }, "wait-for-op2": map[string]any{ - "kind": cloudsqlWaitToolKind, + "kind": cloudsqlWaitToolType, "source": "my-cloud-sql-source", "description": "wait for op2", }, "wait-for-op3": map[string]any{ - "kind": cloudsqlWaitToolKind, + "kind": cloudsqlWaitToolType, "source": "my-cloud-sql-source", "description": "wait for op3", }, diff --git a/tests/cloudsqlmssql/cloud_sql_mssql_create_instance_integration_test.go b/tests/cloudsqlmssql/cloud_sql_mssql_create_instance_integration_test.go index 05bbe2d8e5..c4fe537406 100644 --- a/tests/cloudsqlmssql/cloud_sql_mssql_create_instance_integration_test.go +++ b/tests/cloudsqlmssql/cloud_sql_mssql_create_instance_integration_test.go @@ -36,7 +36,7 @@ import ( ) var ( - createInstanceToolKind = "cloud-sql-mssql-create-instance" + createInstanceToolType = "cloud-sql-mssql-create-instance" ) type createInstanceTransport struct { @@ -265,11 +265,11 @@ func getCreateInstanceToolsConfig() map[string]any { }, "tools": map[string]any{ "create-instance-prod": map[string]any{ - "kind": createInstanceToolKind, + "kind": createInstanceToolType, "source": "my-cloud-sql-source", }, "create-instance-dev": map[string]any{ - "kind": createInstanceToolKind, + "kind": createInstanceToolType, "source": "my-cloud-sql-source", }, }, diff --git a/tests/cloudsqlmssql/cloud_sql_mssql_integration_test.go b/tests/cloudsqlmssql/cloud_sql_mssql_integration_test.go index b53ca030ce..a2e373b8fa 100644 --- a/tests/cloudsqlmssql/cloud_sql_mssql_integration_test.go +++ b/tests/cloudsqlmssql/cloud_sql_mssql_integration_test.go @@ -34,8 +34,8 @@ import ( ) var ( - CloudSQLMSSQLSourceKind = "cloud-sql-mssql" - CloudSQLMSSQLToolKind = "mssql-sql" + CloudSQLMSSQLSourceType = "cloud-sql-mssql" + CloudSQLMSSQLToolType = "mssql-sql" CloudSQLMSSQLProject = os.Getenv("CLOUD_SQL_MSSQL_PROJECT") CloudSQLMSSQLRegion = os.Getenv("CLOUD_SQL_MSSQL_REGION") CloudSQLMSSQLInstance = os.Getenv("CLOUD_SQL_MSSQL_INSTANCE") @@ -61,7 +61,7 @@ func getCloudSQLMSSQLVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": CloudSQLMSSQLSourceKind, + "kind": CloudSQLMSSQLSourceType, "project": CloudSQLMSSQLProject, "instance": CloudSQLMSSQLInstance, "region": CloudSQLMSSQLRegion, @@ -137,10 +137,10 @@ func TestCloudSQLMSSQLToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, CloudSQLMSSQLToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, CloudSQLMSSQLToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddMSSQLExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := tests.GetMSSQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, CloudSQLMSSQLToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, CloudSQLMSSQLToolType, tmplSelectCombined, tmplSelectFilterCombined, "") toolsFile = tests.AddMSSQLPrebuiltToolConfig(t, toolsFile) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) @@ -191,7 +191,7 @@ func TestCloudSQLMSSQLIpConnection(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { sourceConfig["ipType"] = tc.ipType - err := tests.RunSourceConnectionTest(t, sourceConfig, CloudSQLMSSQLToolKind) + err := tests.RunSourceConnectionTest(t, sourceConfig, CloudSQLMSSQLToolType) if err != nil { t.Fatalf("Connection test failure: %s", err) } diff --git a/tests/cloudsqlmysql/cloud_sql_mysql_create_instance_integration_test.go b/tests/cloudsqlmysql/cloud_sql_mysql_create_instance_integration_test.go index 7ddec92faa..1cb4b1a612 100644 --- a/tests/cloudsqlmysql/cloud_sql_mysql_create_instance_integration_test.go +++ b/tests/cloudsqlmysql/cloud_sql_mysql_create_instance_integration_test.go @@ -36,7 +36,7 @@ import ( ) var ( - createInstanceToolKind = "cloud-sql-mysql-create-instance" + createInstanceToolType = "cloud-sql-mysql-create-instance" ) type createInstanceTransport struct { @@ -266,11 +266,11 @@ func getCreateInstanceToolsConfig() map[string]any { }, "tools": map[string]any{ "create-instance-prod": map[string]any{ - "kind": createInstanceToolKind, + "kind": createInstanceToolType, "source": "my-cloud-sql-source", }, "create-instance-dev": map[string]any{ - "kind": createInstanceToolKind, + "kind": createInstanceToolType, "source": "my-cloud-sql-source", }, }, diff --git a/tests/cloudsqlmysql/cloud_sql_mysql_integration_test.go b/tests/cloudsqlmysql/cloud_sql_mysql_integration_test.go index 55b3035868..c61078bef2 100644 --- a/tests/cloudsqlmysql/cloud_sql_mysql_integration_test.go +++ b/tests/cloudsqlmysql/cloud_sql_mysql_integration_test.go @@ -33,8 +33,8 @@ import ( ) var ( - CloudSQLMySQLSourceKind = "cloud-sql-mysql" - CloudSQLMySQLToolKind = "mysql-sql" + CloudSQLMySQLSourceType = "cloud-sql-mysql" + CloudSQLMySQLToolType = "mysql-sql" CloudSQLMySQLProject = os.Getenv("CLOUD_SQL_MYSQL_PROJECT") CloudSQLMySQLRegion = os.Getenv("CLOUD_SQL_MYSQL_REGION") CloudSQLMySQLInstance = os.Getenv("CLOUD_SQL_MYSQL_INSTANCE") @@ -60,7 +60,7 @@ func getCloudSQLMySQLVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": CloudSQLMySQLSourceKind, + "kind": CloudSQLMySQLSourceType, "project": CloudSQLMySQLProject, "instance": CloudSQLMySQLInstance, "region": CloudSQLMySQLRegion, @@ -129,10 +129,10 @@ func TestCloudSQLMySQLToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, CloudSQLMySQLToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, CloudSQLMySQLToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddMySqlExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := tests.GetMySQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, CloudSQLMySQLToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, CloudSQLMySQLToolType, tmplSelectCombined, tmplSelectFilterCombined, "") toolsFile = tests.AddMySQLPrebuiltToolConfig(t, toolsFile) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) @@ -186,7 +186,7 @@ func TestCloudSQLMySQLIpConnection(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { sourceConfig["ipType"] = tc.ipType - err := tests.RunSourceConnectionTest(t, sourceConfig, CloudSQLMySQLToolKind) + err := tests.RunSourceConnectionTest(t, sourceConfig, CloudSQLMySQLToolType) if err != nil { t.Fatalf("Connection test failure: %s", err) } @@ -200,7 +200,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) { serviceAccountEmail, _, _ := strings.Cut(tests.ServiceAccountEmail, "@") noPassSourceConfig := map[string]any{ - "kind": CloudSQLMySQLSourceKind, + "kind": CloudSQLMySQLSourceType, "project": CloudSQLMySQLProject, "instance": CloudSQLMySQLInstance, "region": CloudSQLMySQLRegion, @@ -208,7 +208,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) { "user": serviceAccountEmail, } noUserSourceConfig := map[string]any{ - "kind": CloudSQLMySQLSourceKind, + "kind": CloudSQLMySQLSourceType, "project": CloudSQLMySQLProject, "instance": CloudSQLMySQLInstance, "region": CloudSQLMySQLRegion, @@ -216,7 +216,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) { "password": "random", } noUserNoPassSourceConfig := map[string]any{ - "kind": CloudSQLMySQLSourceKind, + "kind": CloudSQLMySQLSourceType, "project": CloudSQLMySQLProject, "instance": CloudSQLMySQLInstance, "region": CloudSQLMySQLRegion, @@ -260,7 +260,7 @@ func TestCloudSQLMySQLIAMConnection(t *testing.T) { }, "tools": map[string]any{ "my-simple-tool": map[string]any{ - "kind": CloudSQLMySQLToolKind, + "kind": CloudSQLMySQLToolType, "source": uniqueSourceName, "description": "Simple tool to test end to end functionality.", "statement": "SELECT 1;", diff --git a/tests/cloudsqlpg/cloud_sql_pg_create_instances_test.go b/tests/cloudsqlpg/cloud_sql_pg_create_instances_test.go index 85fb011085..bb1405f590 100644 --- a/tests/cloudsqlpg/cloud_sql_pg_create_instances_test.go +++ b/tests/cloudsqlpg/cloud_sql_pg_create_instances_test.go @@ -36,7 +36,7 @@ import ( ) var ( - createInstanceToolKind = "cloud-sql-postgres-create-instance" + createInstanceToolType = "cloud-sql-postgres-create-instance" ) type createInstanceTransport struct { @@ -267,11 +267,11 @@ func getCreateInstanceToolsConfig() map[string]any { }, "tools": map[string]any{ "create-instance-prod": map[string]any{ - "kind": createInstanceToolKind, + "kind": createInstanceToolType, "source": "my-cloud-sql-source", }, "create-instance-dev": map[string]any{ - "kind": createInstanceToolKind, + "kind": createInstanceToolType, "source": "my-cloud-sql-source", }, }, diff --git a/tests/cloudsqlpg/cloud_sql_pg_integration_test.go b/tests/cloudsqlpg/cloud_sql_pg_integration_test.go index dc8ecb27bf..165a906354 100644 --- a/tests/cloudsqlpg/cloud_sql_pg_integration_test.go +++ b/tests/cloudsqlpg/cloud_sql_pg_integration_test.go @@ -32,8 +32,8 @@ import ( ) var ( - CloudSQLPostgresSourceKind = "cloud-sql-postgres" - CloudSQLPostgresToolKind = "postgres-sql" + CloudSQLPostgresSourceType = "cloud-sql-postgres" + CloudSQLPostgresToolType = "postgres-sql" CloudSQLPostgresProject = os.Getenv("CLOUD_SQL_POSTGRES_PROJECT") CloudSQLPostgresRegion = os.Getenv("CLOUD_SQL_POSTGRES_REGION") CloudSQLPostgresInstance = os.Getenv("CLOUD_SQL_POSTGRES_INSTANCE") @@ -59,7 +59,7 @@ func getCloudSQLPgVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": CloudSQLPostgresSourceKind, + "kind": CloudSQLPostgresSourceType, "project": CloudSQLPostgresProject, "instance": CloudSQLPostgresInstance, "region": CloudSQLPostgresRegion, @@ -137,10 +137,10 @@ func TestCloudSQLPgSimpleToolEndpoints(t *testing.T) { defer tearDownVectorTable(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, CloudSQLPostgresToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, CloudSQLPostgresToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddExecuteSqlConfig(t, toolsFile, "postgres-execute-sql") tmplSelectCombined, tmplSelectFilterCombined := tests.GetPostgresSQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, CloudSQLPostgresToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, CloudSQLPostgresToolType, tmplSelectCombined, tmplSelectFilterCombined, "") // Add semantic search tool config insertStmt, searchStmt := tests.GetPostgresVectorSearchStmts(vectorTableName) @@ -217,7 +217,7 @@ func TestCloudSQLPgIpConnection(t *testing.T) { for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { sourceConfig["ipType"] = tc.ipType - err := tests.RunSourceConnectionTest(t, sourceConfig, CloudSQLPostgresToolKind) + err := tests.RunSourceConnectionTest(t, sourceConfig, CloudSQLPostgresToolType) if err != nil { t.Fatalf("Connection test failure: %s", err) } @@ -231,7 +231,7 @@ func TestCloudSQLPgIAMConnection(t *testing.T) { serviceAccountEmail := strings.TrimSuffix(tests.ServiceAccountEmail, ".gserviceaccount.com") noPassSourceConfig := map[string]any{ - "kind": CloudSQLPostgresSourceKind, + "kind": CloudSQLPostgresSourceType, "project": CloudSQLPostgresProject, "instance": CloudSQLPostgresInstance, "region": CloudSQLPostgresRegion, @@ -240,7 +240,7 @@ func TestCloudSQLPgIAMConnection(t *testing.T) { } noUserSourceConfig := map[string]any{ - "kind": CloudSQLPostgresSourceKind, + "kind": CloudSQLPostgresSourceType, "project": CloudSQLPostgresProject, "instance": CloudSQLPostgresInstance, "region": CloudSQLPostgresRegion, @@ -249,7 +249,7 @@ func TestCloudSQLPgIAMConnection(t *testing.T) { } noUserNoPassSourceConfig := map[string]any{ - "kind": CloudSQLPostgresSourceKind, + "kind": CloudSQLPostgresSourceType, "project": CloudSQLPostgresProject, "instance": CloudSQLPostgresInstance, "region": CloudSQLPostgresRegion, @@ -278,7 +278,7 @@ func TestCloudSQLPgIAMConnection(t *testing.T) { } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - err := tests.RunSourceConnectionTest(t, tc.sourceConfig, CloudSQLPostgresToolKind) + err := tests.RunSourceConnectionTest(t, tc.sourceConfig, CloudSQLPostgresToolType) if err != nil { if tc.isErr { return diff --git a/tests/cloudsqlpg/cloud_sql_pg_upgrade_precheck_test.go b/tests/cloudsqlpg/cloud_sql_pg_upgrade_precheck_test.go index 7db191f5be..c2f39659a4 100644 --- a/tests/cloudsqlpg/cloud_sql_pg_upgrade_precheck_test.go +++ b/tests/cloudsqlpg/cloud_sql_pg_upgrade_precheck_test.go @@ -35,7 +35,7 @@ import ( ) var ( - preCheckToolKind = "postgres-upgrade-precheck" + preCheckToolType = "postgres-upgrade-precheck" ) type preCheckTransport struct { @@ -373,7 +373,7 @@ func getPreCheckToolsConfig() map[string]any { }, "tools": map[string]any{ "precheck-tool": map[string]any{ - "kind": preCheckToolKind, + "kind": preCheckToolType, "source": "my-cloud-sql-source", "authRequired": []string{ "https://www.googleapis.com/auth/cloud-platform", diff --git a/tests/common.go b/tests/common.go index a567b5eae8..a4dd6f0d98 100644 --- a/tests/common.go +++ b/tests/common.go @@ -34,7 +34,7 @@ import ( ) // GetToolsConfig returns a mock tools config file -func GetToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement string) map[string]any { +func GetToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement string) map[string]any { // Write config into a file and pass it to command toolsFile := map[string]any{ "sources": map[string]any{ @@ -48,13 +48,13 @@ func GetToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, i }, "tools": map[string]any{ "my-simple-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Simple tool to test end to end functionality.", "statement": "SELECT 1", }, "my-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "statement": paramToolStatement, @@ -72,7 +72,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, i }, }, "my-tool-by-id": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "statement": idParamToolStmt, @@ -85,7 +85,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, i }, }, "my-tool-by-name": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "statement": nameParamToolStmt, @@ -99,7 +99,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, i }, }, "my-array-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with array params.", "statement": arrayToolStatement, @@ -127,7 +127,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, i }, }, "my-auth-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test authenticated parameters.", // statement to auto-fill authenticated parameter @@ -147,7 +147,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, i }, }, "my-auth-required-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test auth required invocation.", "statement": "SELECT 1", @@ -156,7 +156,7 @@ func GetToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, i }, }, "my-fail-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test statement with incorrect syntax.", "statement": "SELEC 1;", @@ -168,18 +168,18 @@ func GetToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, i } // AddExecuteSqlConfig gets the tools config for `execute-sql` tools -func AddExecuteSqlConfig(t *testing.T, config map[string]any, toolKind string) map[string]any { +func AddExecuteSqlConfig(t *testing.T, config map[string]any, toolType string) map[string]any { tools, ok := config["tools"].(map[string]any) if !ok { t.Fatalf("unable to get tools from config") } tools["my-exec-sql-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to execute sql", } tools["my-auth-exec-sql-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to execute sql", "authRequired": []string{ @@ -192,28 +192,28 @@ func AddExecuteSqlConfig(t *testing.T, config map[string]any, toolKind string) m func AddPostgresPrebuiltConfig(t *testing.T, config map[string]any) map[string]any { var ( - PostgresListSchemasToolKind = "postgres-list-schemas" - PostgresListTablesToolKind = "postgres-list-tables" - PostgresListActiveQueriesToolKind = "postgres-list-active-queries" - PostgresListInstalledExtensionsToolKind = "postgres-list-installed-extensions" - PostgresListAvailableExtensionsToolKind = "postgres-list-available-extensions" - PostgresListViewsToolKind = "postgres-list-views" - PostgresDatabaseOverviewToolKind = "postgres-database-overview" - PostgresListTriggersToolKind = "postgres-list-triggers" - PostgresListIndexesToolKind = "postgres-list-indexes" - PostgresListSequencesToolKind = "postgres-list-sequences" - PostgresLongRunningTransactionsToolKind = "postgres-long-running-transactions" - PostgresListLocksToolKind = "postgres-list-locks" - PostgresReplicationStatsToolKind = "postgres-replication-stats" - PostgresListQueryStatsToolKind = "postgres-list-query-stats" - PostgresGetColumnCardinalityToolKind = "postgres-get-column-cardinality" + PostgresListSchemasToolType = "postgres-list-schemas" + PostgresListTablesToolType = "postgres-list-tables" + PostgresListActiveQueriesToolType = "postgres-list-active-queries" + PostgresListInstalledExtensionsToolType = "postgres-list-installed-extensions" + PostgresListAvailableExtensionsToolType = "postgres-list-available-extensions" + PostgresListViewsToolType = "postgres-list-views" + PostgresDatabaseOverviewToolType = "postgres-database-overview" + PostgresListTriggersToolType = "postgres-list-triggers" + PostgresListIndexesToolType = "postgres-list-indexes" + PostgresListSequencesToolType = "postgres-list-sequences" + PostgresLongRunningTransactionsToolType = "postgres-long-running-transactions" + PostgresListLocksToolType = "postgres-list-locks" + PostgresReplicationStatsToolType = "postgres-replication-stats" + PostgresListQueryStatsToolType = "postgres-list-query-stats" + PostgresGetColumnCardinalityToolType = "postgres-get-column-cardinality" PostgresListTableStats = "postgres-list-table-stats" - PostgresListPublicationTablesToolKind = "postgres-list-publication-tables" - PostgresListTablespacesToolKind = "postgres-list-tablespaces" - PostgresListPGSettingsToolKind = "postgres-list-pg-settings" - PostgresListDatabaseStatsToolKind = "postgres-list-database-stats" - PostgresListRolesToolKind = "postgres-list-roles" - PostgresListStoredProcedureToolKind = "postgres-list-stored-procedure" + PostgresListPublicationTablesToolType = "postgres-list-publication-tables" + PostgresListTablespacesToolType = "postgres-list-tablespaces" + PostgresListPGSettingsToolType = "postgres-list-pg-settings" + PostgresListDatabaseStatsToolType = "postgres-list-database-stats" + PostgresListRolesToolType = "postgres-list-roles" + PostgresListStoredProcedureToolType = "postgres-list-stored-procedure" ) tools, ok := config["tools"].(map[string]any) @@ -221,71 +221,71 @@ func AddPostgresPrebuiltConfig(t *testing.T, config map[string]any) map[string]a t.Fatalf("unable to get tools from config") } tools["list_tables"] = map[string]any{ - "kind": PostgresListTablesToolKind, + "kind": PostgresListTablesToolType, "source": "my-instance", "description": "Lists tables in the database.", } tools["list_active_queries"] = map[string]any{ - "kind": PostgresListActiveQueriesToolKind, + "kind": PostgresListActiveQueriesToolType, "source": "my-instance", "description": "Lists active queries in the database.", } tools["list_installed_extensions"] = map[string]any{ - "kind": PostgresListInstalledExtensionsToolKind, + "kind": PostgresListInstalledExtensionsToolType, "source": "my-instance", "description": "Lists installed extensions in the database.", } tools["list_available_extensions"] = map[string]any{ - "kind": PostgresListAvailableExtensionsToolKind, + "kind": PostgresListAvailableExtensionsToolType, "source": "my-instance", "description": "Lists available extensions in the database.", } tools["list_views"] = map[string]any{ - "kind": PostgresListViewsToolKind, + "kind": PostgresListViewsToolType, "source": "my-instance", } tools["list_schemas"] = map[string]any{ - "kind": PostgresListSchemasToolKind, + "kind": PostgresListSchemasToolType, "source": "my-instance", } tools["database_overview"] = map[string]any{ - "kind": PostgresDatabaseOverviewToolKind, + "kind": PostgresDatabaseOverviewToolType, "source": "my-instance", } tools["list_triggers"] = map[string]any{ - "kind": PostgresListTriggersToolKind, + "kind": PostgresListTriggersToolType, "source": "my-instance", } tools["list_indexes"] = map[string]any{ - "kind": PostgresListIndexesToolKind, + "kind": PostgresListIndexesToolType, "source": "my-instance", } tools["list_sequences"] = map[string]any{ - "kind": PostgresListSequencesToolKind, + "kind": PostgresListSequencesToolType, "source": "my-instance", } tools["list_publication_tables"] = map[string]any{ - "kind": PostgresListPublicationTablesToolKind, + "kind": PostgresListPublicationTablesToolType, "source": "my-instance", } tools["long_running_transactions"] = map[string]any{ - "kind": PostgresLongRunningTransactionsToolKind, + "kind": PostgresLongRunningTransactionsToolType, "source": "my-instance", } tools["list_locks"] = map[string]any{ - "kind": PostgresListLocksToolKind, + "kind": PostgresListLocksToolType, "source": "my-instance", } tools["replication_stats"] = map[string]any{ - "kind": PostgresReplicationStatsToolKind, + "kind": PostgresReplicationStatsToolType, "source": "my-instance", } tools["list_query_stats"] = map[string]any{ - "kind": PostgresListQueryStatsToolKind, + "kind": PostgresListQueryStatsToolType, "source": "my-instance", } tools["get_column_cardinality"] = map[string]any{ - "kind": PostgresGetColumnCardinalityToolKind, + "kind": PostgresGetColumnCardinalityToolType, "source": "my-instance", } @@ -295,32 +295,32 @@ func AddPostgresPrebuiltConfig(t *testing.T, config map[string]any) map[string]a } tools["list_tablespaces"] = map[string]any{ - "kind": PostgresListTablespacesToolKind, + "kind": PostgresListTablespacesToolType, "source": "my-instance", } tools["list_pg_settings"] = map[string]any{ - "kind": PostgresListPGSettingsToolKind, + "kind": PostgresListPGSettingsToolType, "source": "my-instance", } tools["list_database_stats"] = map[string]any{ - "kind": PostgresListDatabaseStatsToolKind, + "kind": PostgresListDatabaseStatsToolType, "source": "my-instance", } tools["list_roles"] = map[string]any{ - "kind": PostgresListRolesToolKind, + "kind": PostgresListRolesToolType, "source": "my-instance", } tools["list_stored_procedure"] = map[string]any{ - "kind": PostgresListStoredProcedureToolKind, + "kind": PostgresListStoredProcedureToolType, "source": "my-instance", } config["tools"] = tools return config } -func AddTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplSelectCombined, tmplSelectFilterCombined string, tmplSelectAll string) map[string]any { +func AddTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplSelectCombined, tmplSelectFilterCombined string, tmplSelectAll string) map[string]any { toolsMap, ok := config["tools"].(map[string]any) if !ok { t.Fatalf("unable to get tools from config") @@ -332,7 +332,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplS } toolsMap["create-table-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Create table tool with template parameters", "statement": "CREATE TABLE {{.tableName}} ({{array .columns}})", @@ -342,7 +342,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplS }, } toolsMap["insert-table-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Insert tool with template parameters", "statement": "INSERT INTO {{.tableName}} ({{array .columns}}) VALUES ({{.values}})", @@ -353,7 +353,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplS }, } toolsMap["select-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Create table tool with template parameters", "statement": selectAll, @@ -362,7 +362,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplS }, } toolsMap["select-templateParams-combined-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Create table tool with template parameters", "statement": tmplSelectCombined, @@ -372,7 +372,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplS }, } toolsMap["select-fields-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Create table tool with template parameters", "statement": "SELECT {{array .fields}} FROM {{.tableName}} ORDER BY id", @@ -382,7 +382,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplS }, } toolsMap["select-filter-templateParams-combined-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Create table tool with template parameters", "statement": tmplSelectFilterCombined, @@ -393,7 +393,7 @@ func AddTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplS }, } toolsMap["drop-table-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Drop table tool with template parameters", "statement": "DROP TABLE IF EXISTS {{.tableName}}", @@ -711,7 +711,7 @@ func GetRedisValkeyWants() (string, string, string, string, string, string, stri return select1Want, mcpMyFailToolWant, invokeParamWant, invokeIdNullWant, nullWant, mcpSelect1Want, mcpInvokeParamWant } -func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolKind string) map[string]any { +func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolType string) map[string]any { toolsFile := map[string]any{ "sources": map[string]any{ "my-instance": sourceConfig, @@ -724,13 +724,13 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolKind string) map }, "tools": map[string]any{ "my-simple-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Simple tool to test end to end functionality.", "commands": [][]string{{"PING"}}, }, "my-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "commands": [][]string{{"HGETALL", "row1"}, {"HGETALL", "row3"}}, @@ -748,7 +748,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolKind string) map }, }, "my-tool-by-id": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "commands": [][]string{{"HGETALL", "row4"}}, @@ -761,7 +761,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolKind string) map }, }, "my-tool-by-name": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "commands": [][]string{{"GET", "null"}}, @@ -775,7 +775,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolKind string) map }, }, "my-array-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with array params.", "commands": [][]string{{"HGETALL", "row1"}, {"$cmdArray"}}, @@ -793,7 +793,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolKind string) map }, }, "my-auth-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test authenticated parameters.", // statement to auto-fill authenticated parameter @@ -813,7 +813,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolKind string) map }, }, "my-auth-required-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test auth required invocation.", "commands": [][]string{{"PING"}}, @@ -822,7 +822,7 @@ func GetRedisValkeyToolsConfig(sourceConfig map[string]any, toolKind string) map }, }, "my-fail-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test statement with incorrect syntax.", "commands": [][]string{{"SELEC 1;"}}, @@ -856,7 +856,7 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": cloudsqlmysql.Config{ Name: "my-mysql-instance", - Kind: cloudsqlmysql.SourceKind, + Type: cloudsqlmysql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -884,7 +884,7 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": cloudsqlmysql.Config{ Name: "my-mysql-instance", - Kind: cloudsqlmysql.SourceKind, + Type: cloudsqlmysql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", @@ -912,7 +912,7 @@ func TestCloudSQLMySQL_IPTypeParsingFromYAML(t *testing.T) { want: server.SourceConfigs{ "my-mysql-instance": cloudsqlmysql.Config{ Name: "my-mysql-instance", - Kind: cloudsqlmysql.SourceKind, + Type: cloudsqlmysql.SourceType, Project: "my-project", Region: "my-region", Instance: "my-instance", diff --git a/tests/couchbase/couchbase_integration_test.go b/tests/couchbase/couchbase_integration_test.go index fcb0493c32..3caaf84a93 100644 --- a/tests/couchbase/couchbase_integration_test.go +++ b/tests/couchbase/couchbase_integration_test.go @@ -30,8 +30,8 @@ import ( ) const ( - couchbaseSourceKind = "couchbase" - couchbaseToolKind = "couchbase-sql" + couchbaseSourceType = "couchbase" + couchbaseToolType = "couchbase-sql" ) var ( @@ -58,7 +58,7 @@ func getCouchbaseVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": couchbaseSourceKind, + "kind": couchbaseSourceType, "connectionString": couchbaseConnection, "bucket": couchbaseBucket, "scope": couchbaseScope, @@ -118,8 +118,8 @@ func TestCouchbaseToolEndpoints(t *testing.T) { defer teardownCollection3(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, couchbaseToolKind, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement) - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, couchbaseToolKind, tmplSelectCombined, tmplSelectFilterCombined, tmplSelectAll) + toolsFile := tests.GetToolsConfig(sourceConfig, couchbaseToolType, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement) + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, couchbaseToolType, tmplSelectCombined, tmplSelectFilterCombined, tmplSelectAll) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/dataplex/dataplex_integration_test.go b/tests/dataplex/dataplex_integration_test.go index 4466a50cf8..7e05008571 100644 --- a/tests/dataplex/dataplex_integration_test.go +++ b/tests/dataplex/dataplex_integration_test.go @@ -40,10 +40,10 @@ import ( ) var ( - DataplexSourceKind = "dataplex" - DataplexSearchEntriesToolKind = "dataplex-search-entries" - DataplexLookupEntryToolKind = "dataplex-lookup-entry" - DataplexSearchAspectTypesToolKind = "dataplex-search-aspect-types" + DataplexSourceType = "dataplex" + DataplexSearchEntriesToolType = "dataplex-search-entries" + DataplexLookupEntryToolType = "dataplex-lookup-entry" + DataplexSearchAspectTypesToolType = "dataplex-search-aspect-types" DataplexProject = os.Getenv("DATAPLEX_PROJECT") ) @@ -53,7 +53,7 @@ func getDataplexVars(t *testing.T) map[string]any { t.Fatal("'DATAPLEX_PROJECT' not set") } return map[string]any{ - "kind": DataplexSourceKind, + "kind": DataplexSourceType, "project": DataplexProject, } } @@ -289,34 +289,34 @@ func getDataplexToolsConfig(sourceConfig map[string]any) map[string]any { }, "tools": map[string]any{ "my-dataplex-search-entries-tool": map[string]any{ - "kind": DataplexSearchEntriesToolKind, + "kind": DataplexSearchEntriesToolType, "source": "my-dataplex-instance", "description": "Simple dataplex search entries tool to test end to end functionality.", }, "my-auth-dataplex-search-entries-tool": map[string]any{ - "kind": DataplexSearchEntriesToolKind, + "kind": DataplexSearchEntriesToolType, "source": "my-dataplex-instance", "description": "Simple dataplex search entries tool to test end to end functionality.", "authRequired": []string{"my-google-auth"}, }, "my-dataplex-lookup-entry-tool": map[string]any{ - "kind": DataplexLookupEntryToolKind, + "kind": DataplexLookupEntryToolType, "source": "my-dataplex-instance", "description": "Simple dataplex lookup entry tool to test end to end functionality.", }, "my-auth-dataplex-lookup-entry-tool": map[string]any{ - "kind": DataplexLookupEntryToolKind, + "kind": DataplexLookupEntryToolType, "source": "my-dataplex-instance", "description": "Simple dataplex lookup entry tool to test end to end functionality.", "authRequired": []string{"my-google-auth"}, }, "my-dataplex-search-aspect-types-tool": map[string]any{ - "kind": DataplexSearchAspectTypesToolKind, + "kind": DataplexSearchAspectTypesToolType, "source": "my-dataplex-instance", "description": "Simple dataplex search aspect types tool to test end to end functionality.", }, "my-auth-dataplex-search-aspect-types-tool": map[string]any{ - "kind": DataplexSearchAspectTypesToolKind, + "kind": DataplexSearchAspectTypesToolType, "source": "my-dataplex-instance", "description": "Simple dataplex search aspect types tool to test end to end functionality.", "authRequired": []string{"my-google-auth"}, diff --git a/tests/dgraph/dgraph_integration_test.go b/tests/dgraph/dgraph_integration_test.go index f27cd8dab1..c5339a61e6 100644 --- a/tests/dgraph/dgraph_integration_test.go +++ b/tests/dgraph/dgraph_integration_test.go @@ -31,7 +31,7 @@ import ( ) var ( - DgraphSourceKind = "dgraph" + DgraphSourceType = "dgraph" DgraphApiKey = "api-key" DgraphUrl = os.Getenv("DGRAPH_URL") ) @@ -41,7 +41,7 @@ func getDgraphVars(t *testing.T) map[string]any { t.Fatal("'DGRAPH_URL' not set") } return map[string]any{ - "kind": DgraphSourceKind, + "kind": DgraphSourceType, "dgraphUrl": DgraphUrl, "apiKey": DgraphApiKey, } diff --git a/tests/elasticsearch/elasticsearch_integration_test.go b/tests/elasticsearch/elasticsearch_integration_test.go index 16a7b39b7b..24a405d7a4 100644 --- a/tests/elasticsearch/elasticsearch_integration_test.go +++ b/tests/elasticsearch/elasticsearch_integration_test.go @@ -31,8 +31,8 @@ import ( ) var ( - ElasticsearchSourceKind = "elasticsearch" - ElasticsearchToolKind = "elasticsearch-esql" + ElasticsearchSourceType = "elasticsearch" + ElasticsearchToolType = "elasticsearch-esql" EsAddress = os.Getenv("ELASTICSEARCH_HOST") EsUser = os.Getenv("ELASTICSEARCH_USER") EsPass = os.Getenv("ELASTICSEARCH_PASS") @@ -43,7 +43,7 @@ func getElasticsearchVars(t *testing.T) map[string]any { t.Fatal("'ELASTICSEARCH_HOST' not set") } return map[string]any{ - "kind": ElasticsearchSourceKind, + "kind": ElasticsearchSourceType, "addresses": []string{EsAddress}, "username": EsUser, "password": EsPass, @@ -72,7 +72,7 @@ func TestElasticsearchToolEndpoints(t *testing.T) { paramToolStatement, idParamToolStatement, nameParamToolStatement, arrayParamToolStatement, authToolStatement := getElasticsearchQueries(index) - toolsConfig := getElasticsearchToolsConfig(sourceConfig, ElasticsearchToolKind, paramToolStatement, idParamToolStatement, nameParamToolStatement, arrayParamToolStatement, authToolStatement) + toolsConfig := getElasticsearchToolsConfig(sourceConfig, ElasticsearchToolType, paramToolStatement, idParamToolStatement, nameParamToolStatement, arrayParamToolStatement, authToolStatement) cmd, cleanup, err := tests.StartCmd(ctx, toolsConfig, args...) if err != nil { @@ -177,7 +177,7 @@ func getElasticsearchWants() ElasticsearchWants { } } -func getElasticsearchToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement string) map[string]any { +func getElasticsearchToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement string) map[string]any { toolsFile := map[string]any{ "sources": map[string]any{ "my-instance": sourceConfig, @@ -190,13 +190,13 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolKind, paramToo }, "tools": map[string]any{ "my-simple-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Simple tool to test end to end functionality.", "query": "FROM test-index | SORT id ASC", }, "my-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "query": paramToolStatement, @@ -214,7 +214,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolKind, paramToo }, }, "my-tool-by-id": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "query": idParamToolStmt, @@ -227,7 +227,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolKind, paramToo }, }, "my-tool-by-name": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "query": nameParamToolStmt, @@ -241,7 +241,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolKind, paramToo }, }, "my-array-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with array params.", "query": arrayToolStatement, @@ -269,7 +269,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolKind, paramToo }, }, "my-auth-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test authenticated parameters.", // statement to auto-fill authenticated parameter @@ -289,7 +289,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolKind, paramToo }, }, "my-auth-required-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test auth required invocation.", "query": "FROM test-index | SORT id ASC", @@ -298,7 +298,7 @@ func getElasticsearchToolsConfig(sourceConfig map[string]any, toolKind, paramToo }, }, "my-fail-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test statement with incorrect syntax.", "query": "SELEC 1;", diff --git a/tests/firebird/firebird_integration_test.go b/tests/firebird/firebird_integration_test.go index af0246d11c..f04ee479c0 100644 --- a/tests/firebird/firebird_integration_test.go +++ b/tests/firebird/firebird_integration_test.go @@ -32,8 +32,8 @@ import ( ) var ( - FirebirdSourceKind = "firebird" - FirebirdToolKind = "firebird-sql" + FirebirdSourceType = "firebird" + FirebirdToolType = "firebird-sql" FirebirdDatabase = os.Getenv("FIREBIRD_DATABASE") FirebirdHost = os.Getenv("FIREBIRD_HOST") FirebirdPort = os.Getenv("FIREBIRD_PORT") @@ -56,7 +56,7 @@ func getFirebirdVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": FirebirdSourceKind, + "kind": FirebirdSourceType, "host": FirebirdHost, "port": FirebirdPort, "database": FirebirdDatabase, @@ -107,10 +107,10 @@ func TestFirebirdToolEndpoints(t *testing.T) { teardownTable2 := setupFirebirdTable(t, ctx, db, createAuthTableStmts, insertAuthTableStmt, tableNameAuth, authTestParams) defer teardownTable2(t) - toolsFile := getFirebirdToolsConfig(sourceConfig, FirebirdToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := getFirebirdToolsConfig(sourceConfig, FirebirdToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = addFirebirdExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := getFirebirdTmplToolStatement() - toolsFile = addFirebirdTemplateParamConfig(t, toolsFile, FirebirdToolKind, tmplSelectCombined, tmplSelectFilterCombined) + toolsFile = addFirebirdTemplateParamConfig(t, toolsFile, FirebirdToolType, tmplSelectCombined, tmplSelectFilterCombined) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { @@ -311,8 +311,8 @@ func getFirebirdWants() (string, string, string, string) { return select1Want, mcpMyFailToolWant, createTableStatement, mcpSelect1Want } -func getFirebirdToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement string) map[string]any { - toolsFile := tests.GetToolsConfig(sourceConfig, toolKind, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement) +func getFirebirdToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement string) map[string]any { + toolsFile := tests.GetToolsConfig(sourceConfig, toolType, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement) toolsMap, ok := toolsFile["tools"].(map[string]any) if !ok { @@ -350,7 +350,7 @@ func getFirebirdToolsConfig(sourceConfig map[string]any, toolKind, paramToolStat return toolsFile } -func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolKind, tmplSelectCombined, tmplSelectFilterCombined string) map[string]any { +func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolType, tmplSelectCombined, tmplSelectFilterCombined string) map[string]any { toolsMap, ok := config["tools"].(map[string]any) if !ok { t.Fatalf("unable to get tools from config") @@ -358,7 +358,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolKin // Firebird-specific template parameter tools with compatible syntax toolsMap["create-table-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Create table tool with template parameters", "statement": "CREATE TABLE {{.tableName}} ({{array .columns}})", @@ -368,7 +368,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolKin }, } toolsMap["insert-table-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Insert table tool with template parameters", "statement": "INSERT INTO {{.tableName}} ({{array .columns}}) VALUES ({{.values}})", @@ -379,7 +379,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolKin }, } toolsMap["select-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Select table tool with template parameters", "statement": "SELECT id AS \"id\", name AS \"name\", age AS \"age\" FROM {{.tableName}}", @@ -388,7 +388,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolKin }, } toolsMap["select-templateParams-combined-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Select table tool with combined template parameters", "statement": tmplSelectCombined, @@ -400,7 +400,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolKin }, } toolsMap["select-fields-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Select specific fields tool with template parameters", "statement": "SELECT name AS \"name\" FROM {{.tableName}}", @@ -409,7 +409,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolKin }, } toolsMap["select-filter-templateParams-combined-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Select table tool with filter template parameters", "statement": tmplSelectFilterCombined, @@ -423,7 +423,7 @@ func addFirebirdTemplateParamConfig(t *testing.T, config map[string]any, toolKin } // Firebird uses simple DROP TABLE syntax without IF EXISTS toolsMap["drop-table-templateParams-tool"] = map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Drop table tool with template parameters", "statement": "DROP TABLE {{.tableName}}", diff --git a/tests/firestore/firestore_integration_test.go b/tests/firestore/firestore_integration_test.go index 5b1610e01a..4b0ce0f1c9 100644 --- a/tests/firestore/firestore_integration_test.go +++ b/tests/firestore/firestore_integration_test.go @@ -37,7 +37,7 @@ import ( ) var ( - FirestoreSourceKind = "firestore" + FirestoreSourceType = "firestore" FirestoreProject = os.Getenv("FIRESTORE_PROJECT") FirestoreDatabase = os.Getenv("FIRESTORE_DATABASE") // Optional, defaults to "(default)" ) @@ -48,7 +48,7 @@ func getFirestoreVars(t *testing.T) map[string]any { } vars := map[string]any{ - "kind": FirestoreSourceKind, + "kind": FirestoreSourceType, "project": FirestoreProject, } diff --git a/tests/http/http_integration_test.go b/tests/http/http_integration_test.go index dcaab03011..848eea92fa 100644 --- a/tests/http/http_integration_test.go +++ b/tests/http/http_integration_test.go @@ -34,8 +34,8 @@ import ( ) var ( - HttpSourceKind = "http" - HttpToolKind = "http" + HttpSourceType = "http" + HttpToolType = "http" ) func getHTTPSourceConfig(t *testing.T) map[string]any { @@ -46,7 +46,7 @@ func getHTTPSourceConfig(t *testing.T) map[string]any { idToken = "Bearer " + idToken return map[string]any{ - "kind": HttpSourceKind, + "kind": HttpSourceType, "headers": map[string]string{"Authorization": idToken}, } } @@ -309,7 +309,7 @@ func TestHttpToolEndpoints(t *testing.T) { var args []string - toolsFile := getHTTPToolsConfig(sourceConfig, HttpToolKind) + toolsFile := getHTTPToolsConfig(sourceConfig, HttpToolType) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { t.Fatalf("command initialization returned an error: %s", err) @@ -475,7 +475,7 @@ func runAdvancedHTTPInvokeTest(t *testing.T) { } // getHTTPToolsConfig returns a mock HTTP tool's config file -func getHTTPToolsConfig(sourceConfig map[string]any, toolKind string) map[string]any { +func getHTTPToolsConfig(sourceConfig map[string]any, toolType string) map[string]any { // Write config into a file and pass it to command otherSourceConfig := make(map[string]any) for k, v := range sourceConfig { @@ -497,7 +497,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolKind string) map[string }, "tools": map[string]any{ "my-simple-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "path": "/tool0", "method": "POST", "source": "my-instance", @@ -505,7 +505,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolKind string) map[string "description": "Simple tool to test end to end functionality.", }, "my-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "method": "GET", "path": "/tool1", @@ -521,7 +521,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolKind string) map[string "headers": map[string]string{"Content-Type": "application/json"}, }, "my-tool-by-id": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "method": "GET", "path": "/tool1id", @@ -531,7 +531,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolKind string) map[string "headers": map[string]string{"Content-Type": "application/json"}, }, "my-tool-by-name": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "method": "GET", "path": "/tool1name", @@ -541,7 +541,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolKind string) map[string "headers": map[string]string{"Content-Type": "application/json"}, }, "my-query-param-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "method": "GET", "path": "/toolQueryTest", @@ -553,7 +553,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolKind string) map[string }, }, "my-auth-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "method": "GET", "path": "/tool2", @@ -565,7 +565,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolKind string) map[string }, }, "my-auth-required-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "method": "POST", "path": "/tool0", @@ -574,7 +574,7 @@ func getHTTPToolsConfig(sourceConfig map[string]any, toolKind string) map[string "authRequired": []string{"my-google-auth"}, }, "my-advanced-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "other-instance", "method": "get", "path": "/{{.path}}?id=2", diff --git a/tests/looker/looker_integration_test.go b/tests/looker/looker_integration_test.go index c360455907..2aada5d034 100644 --- a/tests/looker/looker_integration_test.go +++ b/tests/looker/looker_integration_test.go @@ -36,7 +36,7 @@ import ( ) var ( - LookerSourceKind = "looker" + LookerSourceType = "looker" LookerBaseUrl = os.Getenv("LOOKER_BASE_URL") LookerVerifySsl = os.Getenv("LOOKER_VERIFY_SSL") LookerClientId = os.Getenv("LOOKER_CLIENT_ID") @@ -62,7 +62,7 @@ func getLookerVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": LookerSourceKind, + "kind": LookerSourceType, "base_url": LookerBaseUrl, "verify_ssl": (LookerVerifySsl == "true"), "client_id": LookerClientId, diff --git a/tests/mariadb/mariadb_integration_test.go b/tests/mariadb/mariadb_integration_test.go index 60d734ace7..dbfcdc49ae 100644 --- a/tests/mariadb/mariadb_integration_test.go +++ b/tests/mariadb/mariadb_integration_test.go @@ -36,8 +36,8 @@ import ( ) var ( - MariaDBSourceKind = "mysql" - MariaDBToolKind = "mysql-sql" + MariaDBSourceType = "mysql" + MariaDBToolType = "mysql-sql" MariaDBDatabase = os.Getenv("MARIADB_DATABASE") MariaDBHost = os.Getenv("MARIADB_HOST") MariaDBPort = os.Getenv("MARIADB_PORT") @@ -60,7 +60,7 @@ func getMariaDBVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": MariaDBSourceKind, + "kind": MariaDBSourceType, "host": MariaDBHost, "port": MariaDBPort, "database": MariaDBDatabase, @@ -112,10 +112,10 @@ func TestMySQLToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, MariaDBToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, MariaDBToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddMySqlExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := tests.GetMySQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, MariaDBToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, MariaDBToolType, tmplSelectCombined, tmplSelectFilterCombined, "") toolsFile = tests.AddMySQLPrebuiltToolConfig(t, toolsFile) diff --git a/tests/mindsdb/mindsdb_integration_test.go b/tests/mindsdb/mindsdb_integration_test.go index cbebce8238..222fe59aba 100644 --- a/tests/mindsdb/mindsdb_integration_test.go +++ b/tests/mindsdb/mindsdb_integration_test.go @@ -33,8 +33,8 @@ import ( ) var ( - MindsDBSourceKind = "mindsdb" - MindsDBToolKind = "mindsdb-sql" + MindsDBSourceType = "mindsdb" + MindsDBToolType = "mindsdb-sql" MindsDBDatabase = os.Getenv("MINDSDB_DATABASE") MindsDBHost = os.Getenv("MINDSDB_HOST") MindsDBPort = os.Getenv("MINDSDB_PORT") @@ -66,7 +66,7 @@ func getMindsDBVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": MindsDBSourceKind, + "kind": MindsDBSourceType, "host": MindsDBHost, "port": MindsDBPort, "database": MindsDBDatabase, @@ -113,13 +113,13 @@ func TestMindsDBToolEndpoints(t *testing.T) { }, "tools": map[string]any{ "my-simple-tool": map[string]any{ - "kind": MindsDBToolKind, + "kind": MindsDBToolType, "source": "my-instance", "description": "Simple tool to test end to end functionality.", "statement": "SELECT 1", }, "my-tool": map[string]any{ - "kind": MindsDBToolKind, + "kind": MindsDBToolType, "source": "my-instance", "description": "Tool to test invocation with params.", "statement": paramToolStmt, @@ -137,7 +137,7 @@ func TestMindsDBToolEndpoints(t *testing.T) { }, }, "my-tool-by-id": map[string]any{ - "kind": MindsDBToolKind, + "kind": MindsDBToolType, "source": "my-instance", "description": "Tool to test invocation with params.", "statement": idParamToolStmt, @@ -150,7 +150,7 @@ func TestMindsDBToolEndpoints(t *testing.T) { }, }, "my-tool-by-name": map[string]any{ - "kind": MindsDBToolKind, + "kind": MindsDBToolType, "source": "my-instance", "description": "Tool to test invocation with params.", "statement": nameParamToolStmt, @@ -164,13 +164,13 @@ func TestMindsDBToolEndpoints(t *testing.T) { }, }, "my-array-tool": map[string]any{ - "kind": MindsDBToolKind, + "kind": MindsDBToolType, "source": "my-instance", "description": "Tool to test invocation with array params.", "statement": "SELECT 1 as id, 'Alice' as name UNION SELECT 3 as id, 'Sid' as name", }, "my-auth-tool": map[string]any{ - "kind": MindsDBToolKind, + "kind": MindsDBToolType, "source": "my-instance", "description": "Tool to test authenticated parameters.", "statement": authToolStmt, @@ -189,7 +189,7 @@ func TestMindsDBToolEndpoints(t *testing.T) { }, }, "my-auth-required-tool": map[string]any{ - "kind": MindsDBToolKind, + "kind": MindsDBToolType, "source": "my-instance", "description": "Tool to test auth required invocation.", "statement": "SELECT 1", @@ -198,7 +198,7 @@ func TestMindsDBToolEndpoints(t *testing.T) { }, }, "my-fail-tool": map[string]any{ - "kind": MindsDBToolKind, + "kind": MindsDBToolType, "source": "my-instance", "description": "Tool to test statement with incorrect syntax.", "statement": "INVALID SQL STATEMENT", diff --git a/tests/mongodb/mongodb_integration_test.go b/tests/mongodb/mongodb_integration_test.go index 3d84837de8..42af54c077 100644 --- a/tests/mongodb/mongodb_integration_test.go +++ b/tests/mongodb/mongodb_integration_test.go @@ -33,8 +33,8 @@ import ( ) var ( - MongoDbSourceKind = "mongodb" - MongoDbToolKind = "mongodb-find" + MongoDbSourceType = "mongodb" + MongoDbToolType = "mongodb-find" MongoDbUri = os.Getenv("MONGODB_URI") MongoDbDatabase = os.Getenv("MONGODB_DATABASE") ServiceAccountEmail = os.Getenv("SERVICE_ACCOUNT_EMAIL") @@ -48,7 +48,7 @@ func getMongoDBVars(t *testing.T) map[string]any { t.Fatal("'MongoDbDatabase' not set") } return map[string]any{ - "kind": MongoDbSourceKind, + "kind": MongoDbSourceType, "uri": MongoDbUri, } } @@ -83,7 +83,7 @@ func TestMongoDBToolEndpoints(t *testing.T) { defer teardownDB(t) // Write config into a file and pass it to command - toolsFile := getMongoDBToolsConfig(sourceConfig, MongoDbToolKind) + toolsFile := getMongoDBToolsConfig(sourceConfig, MongoDbToolType) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { @@ -482,7 +482,7 @@ func setupMongoDB(t *testing.T, ctx context.Context, database *mongo.Database) f } -func getMongoDBToolsConfig(sourceConfig map[string]any, toolKind string) map[string]any { +func getMongoDBToolsConfig(sourceConfig map[string]any, toolType string) map[string]any { toolsFile := map[string]any{ "sources": map[string]any{ "my-instance": sourceConfig, @@ -505,7 +505,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolKind string) map[str "database": MongoDbDatabase, }, "my-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "authRequired": []string{}, @@ -528,7 +528,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolKind string) map[str "limit": 10, }, "my-tool-by-id": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "authRequired": []string{}, @@ -546,7 +546,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolKind string) map[str "limit": 10, }, "my-tool-by-name": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with params.", "authRequired": []string{}, @@ -565,7 +565,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolKind string) map[str "limit": 10, }, "my-array-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test invocation with array.", "authRequired": []string{}, @@ -587,7 +587,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolKind string) map[str "limit": 10, }, "my-auth-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test authenticated parameters.", "authRequired": []string{}, @@ -611,7 +611,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolKind string) map[str "limit": 10, }, "my-auth-required-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test auth required invocation.", "authRequired": []string{ @@ -624,7 +624,7 @@ func getMongoDBToolsConfig(sourceConfig map[string]any, toolKind string) map[str "limit": 10, }, "my-fail-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Tool to test statement with incorrect syntax.", "authRequired": []string{}, diff --git a/tests/mssql/mssql_integration_test.go b/tests/mssql/mssql_integration_test.go index b9dbe4712a..8a7bc34a80 100644 --- a/tests/mssql/mssql_integration_test.go +++ b/tests/mssql/mssql_integration_test.go @@ -32,8 +32,8 @@ import ( ) var ( - MSSQLSourceKind = "mssql" - MSSQLToolKind = "mssql-sql" + MSSQLSourceType = "mssql" + MSSQLToolType = "mssql-sql" MSSQLDatabase = os.Getenv("MSSQL_DATABASE") MSSQLHost = os.Getenv("MSSQL_HOST") MSSQLPort = os.Getenv("MSSQL_PORT") @@ -56,7 +56,7 @@ func getMsSQLVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": MSSQLSourceKind, + "kind": MSSQLSourceType, "host": MSSQLHost, "port": MSSQLPort, "database": MSSQLDatabase, @@ -116,10 +116,10 @@ func TestMSSQLToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, MSSQLToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, MSSQLToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddMSSQLExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := tests.GetMSSQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, MSSQLToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, MSSQLToolType, tmplSelectCombined, tmplSelectFilterCombined, "") toolsFile = tests.AddMSSQLPrebuiltToolConfig(t, toolsFile) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) diff --git a/tests/mysql/mysql_integration_test.go b/tests/mysql/mysql_integration_test.go index 113767fd1d..b4e9c3accb 100644 --- a/tests/mysql/mysql_integration_test.go +++ b/tests/mysql/mysql_integration_test.go @@ -30,8 +30,8 @@ import ( ) var ( - MySQLSourceKind = "mysql" - MySQLToolKind = "mysql-sql" + MySQLSourceType = "mysql" + MySQLToolType = "mysql-sql" MySQLDatabase = os.Getenv("MYSQL_DATABASE") MySQLHost = os.Getenv("MYSQL_HOST") MySQLPort = os.Getenv("MYSQL_PORT") @@ -54,7 +54,7 @@ func getMySQLVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": MySQLSourceKind, + "kind": MySQLSourceType, "host": MySQLHost, "port": MySQLPort, "database": MySQLDatabase, @@ -106,10 +106,10 @@ func TestMySQLToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, MySQLToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, MySQLToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddMySqlExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := tests.GetMySQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, MySQLToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, MySQLToolType, tmplSelectCombined, tmplSelectFilterCombined, "") toolsFile = tests.AddMySQLPrebuiltToolConfig(t, toolsFile) diff --git a/tests/neo4j/neo4j_integration_test.go b/tests/neo4j/neo4j_integration_test.go index 5f2f357b4f..ee2cb2a03b 100644 --- a/tests/neo4j/neo4j_integration_test.go +++ b/tests/neo4j/neo4j_integration_test.go @@ -34,7 +34,7 @@ import ( ) var ( - Neo4jSourceKind = "neo4j" + Neo4jSourceType = "neo4j" Neo4jDatabase = os.Getenv("NEO4J_DATABASE") Neo4jUri = os.Getenv("NEO4J_URI") Neo4jUser = os.Getenv("NEO4J_USER") @@ -56,7 +56,7 @@ func getNeo4jVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": Neo4jSourceKind, + "kind": Neo4jSourceType, "uri": Neo4jUri, "database": Neo4jDatabase, "user": Neo4jUser, diff --git a/tests/oceanbase/oceanbase_integration_test.go b/tests/oceanbase/oceanbase_integration_test.go index e7691808fb..68eb50b19e 100644 --- a/tests/oceanbase/oceanbase_integration_test.go +++ b/tests/oceanbase/oceanbase_integration_test.go @@ -32,8 +32,8 @@ import ( ) var ( - OceanBaseSourceKind = "oceanbase" - OceanBaseToolKind = "oceanbase-sql" + OceanBaseSourceType = "oceanbase" + OceanBaseToolType = "oceanbase-sql" OceanBaseDatabase = os.Getenv("OCEANBASE_DATABASE") OceanBaseHost = os.Getenv("OCEANBASE_HOST") OceanBasePort = os.Getenv("OCEANBASE_PORT") @@ -56,7 +56,7 @@ func getOceanBaseVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": OceanBaseSourceKind, + "kind": OceanBaseSourceType, "host": OceanBaseHost, "port": OceanBasePort, "database": OceanBaseDatabase, @@ -105,10 +105,10 @@ func TestOceanBaseToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, OceanBaseToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, OceanBaseToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = addOceanBaseExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := getOceanBaseTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, OceanBaseToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, OceanBaseToolType, tmplSelectCombined, tmplSelectFilterCombined, "") cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/oracle/oracle_integration_test.go b/tests/oracle/oracle_integration_test.go index 0021679e9e..88ded6b294 100644 --- a/tests/oracle/oracle_integration_test.go +++ b/tests/oracle/oracle_integration_test.go @@ -18,8 +18,8 @@ import ( ) var ( - OracleSourceKind = "oracle" - OracleToolKind = "oracle-sql" + OracleSourceType = "oracle" + OracleToolType = "oracle-sql" OracleHost = os.Getenv("ORACLE_HOST") OracleUser = os.Getenv("ORACLE_USER") OraclePass = os.Getenv("ORACLE_PASS") @@ -41,7 +41,7 @@ func getOracleVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": OracleSourceKind, + "kind": OracleSourceType, "connectionString": OracleConnStr, "useOCI": true, "user": OracleUser, @@ -98,10 +98,10 @@ func TestOracleSimpleToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, OracleToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, OracleToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddExecuteSqlConfig(t, toolsFile, "oracle-execute-sql") tmplSelectCombined, tmplSelectFilterCombined := tests.GetMySQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, OracleToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, OracleToolType, tmplSelectCombined, tmplSelectFilterCombined, "") cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/postgres/postgres_integration_test.go b/tests/postgres/postgres_integration_test.go index ea34a4a8bc..ec0fd78117 100644 --- a/tests/postgres/postgres_integration_test.go +++ b/tests/postgres/postgres_integration_test.go @@ -31,8 +31,8 @@ import ( ) var ( - PostgresSourceKind = "postgres" - PostgresToolKind = "postgres-sql" + PostgresSourceType = "postgres" + PostgresToolType = "postgres-sql" PostgresDatabase = os.Getenv("POSTGRES_DATABASE") PostgresHost = os.Getenv("POSTGRES_HOST") PostgresPort = os.Getenv("POSTGRES_PORT") @@ -55,7 +55,7 @@ func getPostgresVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": PostgresSourceKind, + "kind": PostgresSourceType, "host": PostgresHost, "port": PostgresPort, "database": PostgresDatabase, @@ -116,10 +116,10 @@ func TestPostgres(t *testing.T) { defer tearDownVectorTable(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, PostgresToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, PostgresToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = tests.AddExecuteSqlConfig(t, toolsFile, "postgres-execute-sql") tmplSelectCombined, tmplSelectFilterCombined := tests.GetPostgresSQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, PostgresToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, PostgresToolType, tmplSelectCombined, tmplSelectFilterCombined, "") toolsFile = tests.AddPostgresPrebuiltConfig(t, toolsFile) // Add semantic search tool config diff --git a/tests/redis/redis_test.go b/tests/redis/redis_test.go index 6ee611da51..0ce450e648 100644 --- a/tests/redis/redis_test.go +++ b/tests/redis/redis_test.go @@ -28,8 +28,8 @@ import ( ) var ( - RedisSourceKind = "redis" - RedisToolKind = "redis" + RedisSourceType = "redis" + RedisToolType = "redis" RedisAddress = os.Getenv("REDIS_ADDRESS") RedisPass = os.Getenv("REDIS_PASS") ) @@ -42,7 +42,7 @@ func getRedisVars(t *testing.T) map[string]any { t.Fatal("'REDIS_PASS' not set") } return map[string]any{ - "kind": RedisSourceKind, + "kind": RedisSourceType, "address": []string{RedisAddress}, "password": RedisPass, } @@ -81,7 +81,7 @@ func TestRedisToolEndpoints(t *testing.T) { defer teardownDB(t) // Write config into a file and pass it to command - toolsFile := tests.GetRedisValkeyToolsConfig(sourceConfig, RedisToolKind) + toolsFile := tests.GetRedisValkeyToolsConfig(sourceConfig, RedisToolType) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/singlestore/singlestore_integration_test.go b/tests/singlestore/singlestore_integration_test.go index 28419d49f3..58c00e21ec 100644 --- a/tests/singlestore/singlestore_integration_test.go +++ b/tests/singlestore/singlestore_integration_test.go @@ -30,8 +30,8 @@ import ( ) var ( - SingleStoreSourceKind = "singlestore" - SingleStoreToolKind = "singlestore-sql" + SingleStoreSourceType = "singlestore" + SingleStoreToolType = "singlestore-sql" SingleStoreDatabase = os.Getenv("SINGLESTORE_DATABASE") SingleStoreHost = os.Getenv("SINGLESTORE_HOST") SingleStorePort = os.Getenv("SINGLESTORE_PORT") @@ -54,7 +54,7 @@ func getSingleStoreVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": SingleStoreSourceKind, + "kind": SingleStoreSourceType, "host": SingleStoreHost, "port": SingleStorePort, "database": SingleStoreDatabase, @@ -130,8 +130,8 @@ func setupSingleStoreTable(t *testing.T, ctx context.Context, pool *sql.DB, crea } } -func getSingleStoreToolsConfig(sourceConfig map[string]any, toolKind, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement string) map[string]any { - toolsFile := tests.GetToolsConfig(sourceConfig, toolKind, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement) +func getSingleStoreToolsConfig(sourceConfig map[string]any, toolType, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement string) map[string]any { + toolsFile := tests.GetToolsConfig(sourceConfig, toolType, paramToolStatement, idParamToolStmt, nameParamToolStmt, arrayToolStatement, authToolStatement) toolsMap, ok := toolsFile["tools"].(map[string]any) if !ok { @@ -207,10 +207,10 @@ func TestSingleStoreToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := getSingleStoreToolsConfig(sourceConfig, SingleStoreToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := getSingleStoreToolsConfig(sourceConfig, SingleStoreToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = addSingleStoreExecuteSQLConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := getSingleStoreTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, SingleStoreToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, SingleStoreToolType, tmplSelectCombined, tmplSelectFilterCombined, "") cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/snowflake/snowflake_integration_test.go b/tests/snowflake/snowflake_integration_test.go index cd81c8289f..b7e205a9b6 100644 --- a/tests/snowflake/snowflake_integration_test.go +++ b/tests/snowflake/snowflake_integration_test.go @@ -31,8 +31,8 @@ import ( ) var ( - SnowflakeSourceKind = "snowflake" - SnowflakeToolKind = "snowflake-sql" + SnowflakeSourceType = "snowflake" + SnowflakeToolType = "snowflake-sql" SnowflakeAccount = os.Getenv("SNOWFLAKE_ACCOUNT") SnowflakeUser = os.Getenv("SNOWFLAKE_USER") SnowflakePassword = os.Getenv("SNOWFLAKE_PASS") @@ -65,7 +65,7 @@ func getSnowflakeVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": SnowflakeSourceKind, + "kind": SnowflakeSourceType, "account": SnowflakeAccount, "user": SnowflakeUser, "password": SnowflakePassword, @@ -125,10 +125,10 @@ func TestSnowflake(t *testing.T) { t.Logf("Test table setup complete.") // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, SnowflakeToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, SnowflakeToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = addSnowflakeExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := getSnowflakeTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, SnowflakeToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, SnowflakeToolType, tmplSelectCombined, tmplSelectFilterCombined, "") cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/source.go b/tests/source.go index 6ef647f823..9aba1c43ce 100644 --- a/tests/source.go +++ b/tests/source.go @@ -30,7 +30,7 @@ import ( ) // RunSourceConnection test for source connection -func RunSourceConnectionTest(t *testing.T, sourceConfig map[string]any, toolKind string) error { +func RunSourceConnectionTest(t *testing.T, sourceConfig map[string]any, toolType string) error { ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() @@ -43,7 +43,7 @@ func RunSourceConnectionTest(t *testing.T, sourceConfig map[string]any, toolKind }, "tools": map[string]any{ "my-simple-tool": map[string]any{ - "kind": toolKind, + "kind": toolType, "source": "my-instance", "description": "Simple tool to test end to end functionality.", "statement": "SELECT 1;", diff --git a/tests/spanner/spanner_integration_test.go b/tests/spanner/spanner_integration_test.go index 4daf87a27e..f8dfd6bcba 100644 --- a/tests/spanner/spanner_integration_test.go +++ b/tests/spanner/spanner_integration_test.go @@ -37,8 +37,8 @@ import ( ) var ( - SpannerSourceKind = "spanner" - SpannerToolKind = "spanner-sql" + SpannerSourceType = "spanner" + SpannerToolType = "spanner-sql" SpannerProject = os.Getenv("SPANNER_PROJECT") SpannerDatabase = os.Getenv("SPANNER_DATABASE") SpannerInstance = os.Getenv("SPANNER_INSTANCE") @@ -55,7 +55,7 @@ func getSpannerVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": SpannerSourceKind, + "kind": SpannerSourceType, "project": SpannerProject, "instance": SpannerInstance, "database": SpannerDatabase, @@ -163,7 +163,7 @@ func TestSpannerToolEndpoints(t *testing.T) { defer teardownGraph(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, SpannerToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, SpannerToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = addSpannerExecuteSqlConfig(t, toolsFile) toolsFile = addSpannerReadOnlyConfig(t, toolsFile) toolsFile = addTemplateParamConfig(t, toolsFile) diff --git a/tests/sqlite/sqlite_integration_test.go b/tests/sqlite/sqlite_integration_test.go index 730e70f4f5..699d0918c2 100644 --- a/tests/sqlite/sqlite_integration_test.go +++ b/tests/sqlite/sqlite_integration_test.go @@ -32,14 +32,14 @@ import ( ) var ( - SQLiteSourceKind = "sqlite" - SQLiteToolKind = "sqlite-sql" + SQLiteSourceType = "sqlite" + SQLiteToolType = "sqlite-sql" SQLiteDatabase = os.Getenv("SQLITE_DATABASE") ) func getSQLiteVars(t *testing.T) map[string]any { return map[string]any{ - "kind": SQLiteSourceKind, + "kind": SQLiteSourceType, "database": SQLiteDatabase, } } @@ -137,9 +137,9 @@ func TestSQLiteToolEndpoint(t *testing.T) { setupSQLiteTestDB(t, ctx, db, createAuthTableStmt, insertAuthTableStmt, tableNameAuth, authTestParams) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, SQLiteToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, SQLiteToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) tmplSelectCombined, tmplSelectFilterCombined := getSQLiteTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, SQLiteToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, SQLiteToolType, tmplSelectCombined, tmplSelectFilterCombined, "") cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/tidb/tidb_integration_test.go b/tests/tidb/tidb_integration_test.go index 29efca8f35..ff7f16d0c1 100644 --- a/tests/tidb/tidb_integration_test.go +++ b/tests/tidb/tidb_integration_test.go @@ -30,8 +30,8 @@ import ( ) var ( - TiDBSourceKind = "tidb" - TiDBToolKind = "tidb-sql" + TiDBSourceType = "tidb" + TiDBToolType = "tidb-sql" TiDBDatabase = os.Getenv("TIDB_DATABASE") TiDBHost = os.Getenv("TIDB_HOST") TiDBPort = os.Getenv("TIDB_PORT") @@ -54,7 +54,7 @@ func getTiDBVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": TiDBSourceKind, + "kind": TiDBSourceType, "host": TiDBHost, "port": TiDBPort, "database": TiDBDatabase, @@ -135,10 +135,10 @@ func TestTiDBToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, TiDBToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, TiDBToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = addTiDBExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := tests.GetMySQLTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, TiDBToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, TiDBToolType, tmplSelectCombined, tmplSelectFilterCombined, "") cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/trino/trino_integration_test.go b/tests/trino/trino_integration_test.go index 126e887b22..a5931a95ce 100644 --- a/tests/trino/trino_integration_test.go +++ b/tests/trino/trino_integration_test.go @@ -31,8 +31,8 @@ import ( ) var ( - TrinoSourceKind = "trino" - TrinoToolKind = "trino-sql" + TrinoSourceType = "trino" + TrinoToolType = "trino-sql" TrinoHost = os.Getenv("TRINO_HOST") TrinoPort = os.Getenv("TRINO_PORT") TrinoUser = os.Getenv("TRINO_USER") @@ -55,7 +55,7 @@ func getTrinoVars(t *testing.T) map[string]any { } return map[string]any{ - "kind": TrinoSourceKind, + "kind": TrinoSourceType, "host": TrinoHost, "port": TrinoPort, "user": TrinoUser, @@ -236,10 +236,10 @@ func TestTrinoToolEndpoints(t *testing.T) { defer teardownTable2(t) // Write config into a file and pass it to command - toolsFile := tests.GetToolsConfig(sourceConfig, TrinoToolKind, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) + toolsFile := tests.GetToolsConfig(sourceConfig, TrinoToolType, paramToolStmt, idParamToolStmt, nameParamToolStmt, arrayToolStmt, authToolStmt) toolsFile = addTrinoExecuteSqlConfig(t, toolsFile) tmplSelectCombined, tmplSelectFilterCombined := getTrinoTmplToolStatement() - toolsFile = tests.AddTemplateParamConfig(t, toolsFile, TrinoToolKind, tmplSelectCombined, tmplSelectFilterCombined, "") + toolsFile = tests.AddTemplateParamConfig(t, toolsFile, TrinoToolType, tmplSelectCombined, tmplSelectFilterCombined, "") cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil { diff --git a/tests/valkey/valkey_test.go b/tests/valkey/valkey_test.go index 23f2b09df2..328376fe99 100644 --- a/tests/valkey/valkey_test.go +++ b/tests/valkey/valkey_test.go @@ -28,8 +28,8 @@ import ( ) var ( - ValkeySourceKind = "valkey" - ValkeyToolKind = "valkey" + ValkeySourceType = "valkey" + ValkeyToolType = "valkey" ValkeyAddress = os.Getenv("VALKEY_ADDRESS") ) @@ -39,7 +39,7 @@ func getValkeyVars(t *testing.T) map[string]any { t.Fatal("'VALKEY_ADDRESS' not set") } return map[string]any{ - "kind": ValkeySourceKind, + "kind": ValkeySourceType, "address": []string{ValkeyAddress}, "disableCache": true, } @@ -84,7 +84,7 @@ func TestValkeyToolEndpoints(t *testing.T) { defer teardownDB(t) // Write config into a file and pass it to command - toolsFile := tests.GetRedisValkeyToolsConfig(sourceConfig, ValkeyToolKind) + toolsFile := tests.GetRedisValkeyToolsConfig(sourceConfig, ValkeyToolType) cmd, cleanup, err := tests.StartCmd(ctx, toolsFile, args...) if err != nil {