Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate connector yaml #180

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ VERSION=$(shell git describe --tags --dirty --always)

.PHONY: build
build:
go build -ldflags "-X 'github.com/conduitio/conduit-connector-kafka.version=${VERSION}'" -o conduit-connector-kafka cmd/connector/main.go
sed -i '/specification:/,/version:/ s/version: .*/version: '"${VERSION}"'/' connector.yaml
go build -o conduit-connector-kafka cmd/connector/main.go

.PHONY: test-kafka
test-kafka:
Expand Down
6 changes: 3 additions & 3 deletions common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"errors"
"time"

sdk "github.com/conduitio/conduit-connector-sdk"

Check failure on line 22 in common/config.go

View workflow job for this annotation

GitHub Actions / test-kafka

github.com/conduitio/conduit-connector-sdk@v0.12.1-0.20241128142715-415d5f0909e0: replacement directory ../conduit-connector-sdk does not exist

Check failure on line 22 in common/config.go

View workflow job for this annotation

GitHub Actions / test-redpanda

github.com/conduitio/conduit-connector-sdk@v0.12.1-0.20241128142715-415d5f0909e0: replacement directory ../conduit-connector-sdk does not exist
"github.com/twmb/franz-go/pkg/kgo"
)

Expand All @@ -43,13 +43,13 @@
}

// Validate executes manual validations beyond what is defined in struct tags.
func (c Config) Validate() error {
func (c Config) Validate(ctx context.Context) error {
var multierr []error

if err := c.ConfigSASL.Validate(); err != nil {
if err := c.ConfigSASL.Validate(ctx); err != nil {
multierr = append(multierr, err)
}
if err := c.ConfigTLS.Validate(); err != nil {
if err := c.ConfigTLS.Validate(ctx); err != nil {
multierr = append(multierr, err)
}

Expand Down
3 changes: 2 additions & 1 deletion common/sasl.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package common

import (
"context"
"errors"
"fmt"

Expand All @@ -36,7 +37,7 @@ type ConfigSASL struct {
}

// Validate executes manual validations beyond what is defined in struct tags.
func (c ConfigSASL) Validate() error {
func (c ConfigSASL) Validate(context.Context) error {
var multierr []error

if _, err := c.sasl(); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion common/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package common

import (
"context"
"crypto/tls"
"crypto/x509"
"fmt"
Expand All @@ -36,7 +37,7 @@ type ConfigTLS struct {
}

// Validate executes manual validations beyond what is defined in struct tags.
func (c ConfigTLS) Validate() error {
func (c ConfigTLS) Validate(context.Context) error {
_, err := c.tls()
return err
}
Expand Down
9 changes: 8 additions & 1 deletion connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate specgen

// Package kafka contains implementations for Kafka source and destination
// connectors for Conduit.
package kafka

import (
_ "embed"

sdk "github.com/conduitio/conduit-connector-sdk"
)

//go:embed connector.yaml
var specs string

var Connector = sdk.Connector{
NewSpecification: Specification,
NewSpecification: sdk.YAMLSpecification(specs),
NewSource: NewSource,
NewDestination: NewDestination,
}
Loading
Loading