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 23 commits into
base: main
Choose a base branch
from
Draft
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
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 @@ -43,13 +43,13 @@ type Config struct {
}

// 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
2 changes: 1 addition & 1 deletion common/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func TestConfig_Validate(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
is := is.New(t)
err := tc.cfg.Validate()
err := tc.cfg.Validate(context.Background())
is.True(err != nil)
if actualErr, ok := tc.wantErr.(error); ok {
is.True(errors.Is(err, actualErr))
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