Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion builders/consumer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ConsumerStepBuilder struct {
res *model.ConsumerStep
Expand Down
2 changes: 1 addition & 1 deletion builders/consumer_core.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ConsumerStepCoreBuilder struct {
res *model.ConsumerStepCore
Expand Down
2 changes: 1 addition & 1 deletion builders/consumer_kv.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ConsumerStepKvBuilder struct {
res *model.ConsumerStepKv
Expand Down
2 changes: 1 addition & 1 deletion builders/consumer_stream.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ConsumerStepStreamBuilder struct {
res *model.ConsumerStepStream
Expand Down
2 changes: 1 addition & 1 deletion builders/nats.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

const DefaultNatsUrl = "nats://localhost:4222"

Expand Down
2 changes: 1 addition & 1 deletion builders/producer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ProducerStepBuilder struct {
res *model.ProducerStep
Expand Down
2 changes: 1 addition & 1 deletion builders/producer_core.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ProducerStepCoreBuilder struct {
res *model.ProducerStepCore
Expand Down
2 changes: 1 addition & 1 deletion builders/producer_kv.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ProducerStepKvBuilder struct {
res *model.ProducerStepKv
Expand Down
2 changes: 1 addition & 1 deletion builders/producer_stream.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ProducerStepStreamBuilder struct {
res *model.ProducerStepStream
Expand Down
2 changes: 1 addition & 1 deletion builders/sink.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type SinkStepBuilder struct {
res *model.SinkStep
Expand Down
2 changes: 1 addition & 1 deletion builders/source.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type SourceStepBuilder struct {
res *model.SourceStep
Expand Down
2 changes: 1 addition & 1 deletion builders/steps.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type StepsBuilder struct {
steps *model.Steps
Expand Down
2 changes: 1 addition & 1 deletion builders/transformer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type TransformerStepBuilder struct {
res *model.TransformerStep
Expand Down
2 changes: 1 addition & 1 deletion builders/transformer_combine.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type CombineTransformerStepBuilder struct {
res *model.CombineTransformerStep
Expand Down
2 changes: 1 addition & 1 deletion builders/transformer_composite.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type CompositeTransformerStepBuilder struct {
res *model.CompositeTransformerStep
Expand Down
2 changes: 1 addition & 1 deletion builders/transformer_explode.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ExplodeTransformerStepBuilder struct {
res *model.ExplodeTransformerStep
Expand Down
2 changes: 1 addition & 1 deletion builders/transformer_mapping.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type MappingTransformerStepBuilder struct {
res *model.MappingTransformerStep
Expand Down
2 changes: 1 addition & 1 deletion builders/transformer_service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package builders

import "github.com/synadia-io/connect/v2/model"
import "github.com/synadia-io/connect/model"

type ServiceTransformerStepBuilder struct {
res *model.ServiceTransformerStep
Expand Down
2 changes: 1 addition & 1 deletion builders/transformer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package builders
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/synadia-io/connect/v2/model"
"github.com/synadia-io/connect/model"
)

var _ = Describe("TransformerStepBuilder", func() {
Expand Down
33 changes: 18 additions & 15 deletions cli/connector_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import (

"github.com/jedib0t/go-pretty/v6/text"
"github.com/joho/godotenv"
"github.com/synadia-io/connect/v2/client"
"github.com/synadia-io/connect/v2/convert"
"github.com/synadia-io/connect/v2/spec"
"github.com/synadia-io/connect/client"
"github.com/synadia-io/connect/convert"
"github.com/synadia-io/connect/spec"

"github.com/AlecAivazis/survey/v2"
"github.com/choria-io/fisk"
jsonpatch "github.com/evanphx/json-patch/v5"
"github.com/fatih/color"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/mitchellh/mapstructure"
"github.com/synadia-io/connect/v2/model"
"github.com/synadia-io/connect/model"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -341,10 +341,9 @@ func (c *connectorCommand) saveConnector(pc *fisk.ParseContext) error {
var sp spec.ConnectorSpec
if exists {
sp = spec.ConnectorSpec{
Description: conn.Description,
RuntimeId: conn.RuntimeId,
RuntimeVersion: &conn.RuntimeVersion,
Steps: convert.ConvertStepsToSpec(conn.Steps),
Description: conn.Description,
RuntimeId: conn.RuntimeId,
Steps: convert.ConvertStepsToSpec(conn.Steps),
}
} else {
if !c.fileSetByUser {
Expand All @@ -371,11 +370,7 @@ func (c *connectorCommand) saveConnector(pc *fisk.ParseContext) error {

var connector *model.Connector
if !exists {
runtimeVersion := ""
if result.RuntimeVersion != nil {
runtimeVersion = *result.RuntimeVersion
}
connector, err = appCtx.Client.CreateConnector(c.id, result.Description, result.RuntimeId, runtimeVersion, convert.ConvertStepsFromSpec(result.Steps), c.opts.Timeout)
connector, err = appCtx.Client.CreateConnector(c.id, result.Description, result.RuntimeId, convert.ConvertStepsFromSpec(result.Steps), c.opts.Timeout)
if err != nil {
color.Red("Could not save connector: %s", err)
os.Exit(1)
Expand Down Expand Up @@ -430,7 +425,7 @@ func (c *connectorCommand) copyConnector(context *fisk.ParseContext) error {
return nil
}

_, err = appCtx.Client.CreateConnector(c.targetId, conn.Description, conn.RuntimeId, conn.RuntimeVersion, convert.ConvertStepsFromSpec(convert.ConvertStepsToSpec(conn.Steps)), c.opts.Timeout)
_, err = appCtx.Client.CreateConnector(c.targetId, conn.Description, conn.RuntimeId, convert.ConvertStepsFromSpec(convert.ConvertStepsToSpec(conn.Steps)), c.opts.Timeout)
fisk.FatalIfError(err, "failed to create connector %s: %v", c.targetId, err)

fmt.Printf("Created connector %s\n", color.GreenString(c.targetId))
Expand Down Expand Up @@ -515,6 +510,14 @@ func fromEditor(existing *spec.ConnectorSpec) (*spec.ConnectorSpec, bool, error)
}

func (c *connectorCommand) selectConnectorTemplate(cl client.Client) (*spec.ConnectorSpec, error) {
rt, err := cl.GetRuntime(c.runtime, 5*time.Second)
if err != nil {
return nil, fmt.Errorf("could not get runtime: %s", err)
}
if rt == nil {
return nil, fmt.Errorf("runtime %s not found", c.runtime)
}

var options []string
mapping := make(map[string]spec.ConnectorSpec)
for _, template := range templates {
Expand All @@ -523,7 +526,7 @@ func (c *connectorCommand) selectConnectorTemplate(cl client.Client) (*spec.Conn
}

choice := ""
err := survey.AskOne(&survey.Select{
err = survey.AskOne(&survey.Select{
Message: "Connector Template",
Options: options,
}, &choice, survey.WithValidator(survey.Required))
Expand Down
4 changes: 2 additions & 2 deletions cli/connector_command_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/fatih/color"
"github.com/jedib0t/go-pretty/v6/table"
"github.com/jedib0t/go-pretty/v6/text"
"github.com/synadia-io/connect/v2/model"
"github.com/synadia-io/connect/model"
)

// These are testable helper functions that can be called with a provided AppContext
Expand Down Expand Up @@ -142,7 +142,7 @@ func (c *connectorCommand) copyConnectorWithClient(appCtx *AppContext) error {
}

// Create the copy
copied, err := appCtx.Client.CreateConnector(c.targetId, connector.Description, connector.RuntimeId, connector.RuntimeVersion, connector.Steps, c.opts.Timeout)
copied, err := appCtx.Client.CreateConnector(c.targetId, connector.Description, connector.RuntimeId, connector.Steps, c.opts.Timeout)
if err != nil {
return fmt.Errorf("failed to create connector copy: %w", err)
}
Expand Down
9 changes: 4 additions & 5 deletions cli/connector_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/synadia-io/connect/v2/model"
"github.com/synadia-io/connect/model"
)

var _ = Describe("ConnectorCommand", func() {
Expand Down Expand Up @@ -264,10 +264,9 @@ var _ = Describe("ConnectorCommand", func() {
It("should copy a connector", func() {
// First it gets the source connector
mockCl.connector = &model.Connector{
ConnectorId: "source-connector",
Description: "Source Connector",
RuntimeId: "synadia",
RuntimeVersion: "v1.0.0",
ConnectorId: "source-connector",
Description: "Source Connector",
RuntimeId: "synadia",
Steps: model.Steps{
Source: &model.SourceStep{
Type: "generate",
Expand Down
Loading