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
14 changes: 9 additions & 5 deletions cli/connector_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func ConfigureConnectorCommand(parentCmd commandHost, opts *Options) {
saveCmd.Arg("id", "The id of the connector to create or modify").Required().StringVar(&c.id)
saveCmd.Flag("file", "Use the connector definition from the given file").Short('f').IsSetByUser(&c.fileSetByUser).Default("./ConnectFile").StringVar(&c.file)
saveCmd.Flag("runtime", "The runtime id").Default("wombat").StringVar(&c.runtime)
saveCmd.Flag("runtime-version", "The runtime version").Required().StringVar(&c.runtimeVersion)

copyCmd := connectorCmd.Command("copy", "Copy a connector").Action(c.copyConnector)
copyCmd.Arg("id", "The id of the connector to copy").Required().StringVar(&c.id)
Expand Down Expand Up @@ -344,9 +343,10 @@ func (c *connectorCommand) saveConnector(pc *fisk.ParseContext) error {
var sp spec.ConnectorSpec
if exists {
sp = spec.ConnectorSpec{
Description: conn.Description,
RuntimeId: conn.RuntimeId,
Steps: convert.ConvertStepsToSpec(conn.Steps),
Description: conn.Description,
RuntimeId: conn.RuntimeId,
RuntimeVersion: &conn.RuntimeVersion,
Steps: convert.ConvertStepsToSpec(conn.Steps),
}
} else {
if !c.fileSetByUser {
Expand All @@ -373,7 +373,11 @@ func (c *connectorCommand) saveConnector(pc *fisk.ParseContext) error {

var connector *model.Connector
if !exists {
connector, err = appCtx.Client.CreateConnector(c.id, result.Description, result.RuntimeId, c.runtimeVersion, convert.ConvertStepsFromSpec(result.Steps), c.opts.Timeout)
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)
if err != nil {
color.Red("Could not save connector: %s", err)
os.Exit(1)
Expand Down
6 changes: 5 additions & 1 deletion cli/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ func renderConnector(c model.Connector) string {
tbl.SetTitle(fmt.Sprintf("Connector: %s", c.ConnectorId))
tbl.AppendRow(table.Row{"Description", text.WrapSoft(c.Description, 50)})

tbl.AppendRow(table.Row{"Runtime", c.RuntimeId})
runtime := c.RuntimeId
if c.RuntimeVersion != "" {
runtime = fmt.Sprintf("%s:%s", c.RuntimeId, c.RuntimeVersion)
}
tbl.AppendRow(table.Row{"Runtime", runtime})

b, err := yaml.Marshal(c.Steps)
fisk.FatalIfError(err, "failed to render steps")
Expand Down
13 changes: 8 additions & 5 deletions client/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,14 @@ func (c *connectorClient) GetConnectorStatus(name string, timeout time.Duration)

func (c *connectorClient) CreateConnector(id, description, runtimeId string, runtimeVersion string, steps model.Steps, timeout time.Duration) (*model.Connector, error) {
req := model.ConnectorCreateRequest{
Id: id,
Description: description,
RuntimeId: runtimeId,
RuntimeVersion: &runtimeVersion,
Steps: steps,
Id: id,
Description: description,
RuntimeId: runtimeId,
Steps: steps,
}

if runtimeVersion != "" {
req.RuntimeVersion = &runtimeVersion
}

var resp model.ConnectorCreateResponse
Expand Down
63 changes: 62 additions & 1 deletion model/library.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions spec/connector.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions spec/schemas/connector-spec.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
"type": "string",
"description": "The runtime to use for this connector. The runtime can be suffixed with the version, e.g. 'wombat:edge'"
},
"runtime_version": {
"type": "string",
"description": "The version of the runtime"
},
"steps": {
"$ref": "connector-steps-model.schema.json"
}
Expand Down
Loading