-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(Partner SDK): Add V2 examples for SourceConnector (#80)
* v2_examples folder * proto changes * java example change * setup form change * configuration form response changes * python example * nodejs example changes * golang examples change * v1 golang example change --------- Co-authored-by: Satvik Patil <[email protected]>
- Loading branch information
1 parent
09a813c
commit 3825371
Showing
35 changed files
with
2,249 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
syntax = "proto3"; | ||
option optimize_for = SPEED; | ||
option java_multiple_files = true; | ||
option go_package = "fivetran.com/fivetran_sdk_v2"; | ||
package fivetran_sdk.v2; | ||
|
||
import "google/protobuf/timestamp.proto"; | ||
|
||
message ConfigurationFormRequest {} | ||
|
||
message ConfigurationFormResponse { | ||
bool schema_selection_supported = 1; | ||
bool table_selection_supported = 2; | ||
repeated FormField fields = 3; | ||
repeated ConfigurationTest tests = 4; | ||
} | ||
|
||
message FormField { | ||
string name = 1; | ||
string label = 2; | ||
optional bool required = 3; | ||
optional string description = 4; | ||
oneof type { | ||
TextField text_field = 5; | ||
DropdownField dropdown_field = 6; | ||
ToggleField toggle_field = 7; | ||
ConditionalFields conditional_fields = 10; | ||
} | ||
optional string default_value = 8; | ||
optional string placeholder = 9; | ||
} | ||
|
||
message ConditionalFields { | ||
VisibilityCondition condition = 1; | ||
repeated FormField fields = 2; | ||
} | ||
|
||
message VisibilityCondition { | ||
string condition_field = 1; | ||
oneof visible_when { | ||
bool bool_value = 2; | ||
string string_value = 3; | ||
bool empty_value = 4; | ||
} | ||
} | ||
|
||
message DropdownField { | ||
repeated string dropdown_field = 1; | ||
} | ||
|
||
message ToggleField {} | ||
|
||
enum TextField { | ||
PlainText = 0; | ||
Password = 1; | ||
Hidden = 2; | ||
} | ||
|
||
message ConfigurationTest { | ||
string name = 1; // unique identifier for the test | ||
string label = 2; // A few words indicating what we are testing, e.g. 'Connecting to database' | ||
} | ||
|
||
message TestRequest { | ||
string name = 1; | ||
map<string, string> configuration = 2; | ||
} | ||
|
||
message TestResponse { | ||
oneof response { | ||
bool success = 1; | ||
string failure = 2; | ||
} | ||
} | ||
|
||
message SchemaList { | ||
repeated Schema schemas = 1; | ||
} | ||
|
||
message TableList { | ||
repeated Table tables = 1; | ||
} | ||
|
||
message Schema { | ||
string name = 1; | ||
repeated Table tables = 2; | ||
} | ||
|
||
enum DataType { | ||
UNSPECIFIED = 0; | ||
BOOLEAN = 1; | ||
SHORT = 2; | ||
INT = 3; | ||
LONG = 4; | ||
DECIMAL = 5; | ||
FLOAT = 6; | ||
DOUBLE = 7; | ||
NAIVE_DATE = 8; | ||
NAIVE_DATETIME = 9; | ||
UTC_DATETIME = 10; | ||
BINARY = 11; | ||
XML = 12; | ||
STRING = 13; | ||
JSON = 14; | ||
NAIVE_TIME = 15; | ||
} | ||
|
||
message DataTypeParams { | ||
oneof params { | ||
DecimalParams decimal = 1; | ||
int32 string_byte_length = 2; | ||
} | ||
} | ||
|
||
message DecimalParams { | ||
uint32 precision = 1; | ||
uint32 scale = 2; | ||
} | ||
|
||
enum RecordType { | ||
UPSERT = 0; | ||
UPDATE = 1; | ||
DELETE = 2; | ||
TRUNCATE = 3; | ||
} | ||
|
||
message ValueType { | ||
oneof inner { | ||
bool null = 1; | ||
bool bool = 2; | ||
int32 short = 3; | ||
int32 int = 4; | ||
int64 long = 5; | ||
float float = 6; | ||
double double = 7; | ||
google.protobuf.Timestamp naive_date = 8; | ||
google.protobuf.Timestamp naive_datetime = 9; | ||
google.protobuf.Timestamp utc_datetime = 10; | ||
string decimal = 11; | ||
bytes binary = 12; | ||
string string = 13; | ||
string json = 14; | ||
string xml = 15; | ||
google.protobuf.Timestamp naive_time = 16; | ||
} | ||
} | ||
|
||
message Table { | ||
string name = 1; | ||
repeated Column columns = 2; | ||
} | ||
|
||
message Column { | ||
string name = 1; | ||
DataType type = 2; | ||
bool primary_key = 3; | ||
optional DataTypeParams params = 4; | ||
} | ||
|
||
message Warning { | ||
string message = 1; | ||
} | ||
|
||
message Task { | ||
string message = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM golang:1.18-alpine | ||
|
||
WORKDIR /app | ||
|
||
# We want to populate the module cache based on the go.{mod,sum} files. | ||
COPY go.mod . | ||
COPY go.sum . | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
# Build the Go app | ||
RUN go build -o ./out/golang_connector ./golang_connector | ||
|
||
# This container exposes port to the outside world | ||
EXPOSE 50051 | ||
|
||
# Run the binary program produced by `go install` | ||
CMD ["./out/golang_connector"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# GoLang Connector gRPC Server | ||
Run all commands from the golang folder root | ||
|
||
## Steps | ||
``` | ||
> cd examples/connector/golang | ||
> scripts/copy_protos.sh | ||
> scripts/compile_protos.sh | ||
> scripts/build.sh | ||
> ./main | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module fivetran.com/fivetran_sdk | ||
|
||
go 1.21 | ||
|
||
require ( | ||
google.golang.org/grpc v1.65.0 | ||
google.golang.org/protobuf v1.35.1 | ||
) | ||
|
||
require ( | ||
golang.org/x/net v0.30.0 // indirect | ||
golang.org/x/sys v0.26.0 // indirect | ||
golang.org/x/text v0.19.0 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= | ||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= | ||
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= | ||
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= | ||
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= | ||
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= | ||
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= | ||
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI= | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= | ||
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= | ||
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= | ||
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= | ||
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= |
Oops, something went wrong.