Skip to content

Commit bc8df2f

Browse files
committed
Stop default source and warehouse connections and upgrade Public API SDK
1 parent d06a3c0 commit bc8df2f

File tree

5 files changed

+26
-9
lines changed

5 files changed

+26
-9
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ require (
1111
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0
1212
github.com/hashicorp/terraform-plugin-go v0.23.0
1313
github.com/hashicorp/terraform-plugin-testing v1.10.0
14-
github.com/segmentio/public-api-sdk-go v0.0.0-20240819211447-e2f7f9318028
14+
github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a
1515
gotest.tools/gotestsum v1.12.0
1616
)
1717

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU
185185
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
186186
github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww=
187187
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
188-
github.com/segmentio/public-api-sdk-go v0.0.0-20231114153454-3be55fde5c99 h1:55dfJRsEeZLLFln+0gQ1pNZvalFMyeMV9nTPQwShkok=
189-
github.com/segmentio/public-api-sdk-go v0.0.0-20231114153454-3be55fde5c99/go.mod h1:1mLoKkR7t90unwNx7qx9PicO3AX5NflFD7ny3TvLExU=
190-
github.com/segmentio/public-api-sdk-go v0.0.0-20240819211447-e2f7f9318028 h1:mY+y1F+uVH9D2rGZDzrJf8fNaoGAWXMKNz857VYpc3k=
191-
github.com/segmentio/public-api-sdk-go v0.0.0-20240819211447-e2f7f9318028/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY=
188+
github.com/segmentio/public-api-sdk-go v0.0.0-20240820173358-a52384e5ccc7 h1:04d9X+Bw1RY+lmbs0DajdA61xSQOZCAIUJuZfcFpz0g=
189+
github.com/segmentio/public-api-sdk-go v0.0.0-20240820173358-a52384e5ccc7/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY=
190+
github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a h1:vSCltBxaOD5NRP3zGh/Xha3evkt0ZeXdAc6fTDTuwzg=
191+
github.com/segmentio/public-api-sdk-go v0.0.0-20240820210528-faf5e1da4b4a/go.mod h1:yKkoPfcOkkYjiZQj4lRWxji0Qwc6ncNEf7wCfywochY=
192192
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
193193
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
194194
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=

internal/provider/function_resource.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (r *functionResource) Create(ctx context.Context, req resource.CreateReques
159159
resp.State.SetAttribute(ctx, path.Root("id"), function.Id)
160160

161161
var state models.FunctionState
162-
state.Fill(api.Function(function))
162+
state.Fill(api.FunctionV1(function))
163163

164164
// Destination functions append workspace name to display name causing inconsistency
165165
if state.ResourceType.ValueString() == "DESTINATION" || state.ResourceType.ValueString() == "INSERT_DESTINATION" {
@@ -256,7 +256,7 @@ func (r *functionResource) Update(ctx context.Context, req resource.UpdateReques
256256

257257
function := out.Data.GetFunction()
258258

259-
state.Fill(api.Function(function))
259+
state.Fill(api.FunctionV1(function))
260260

261261
// Destination functions append workspace name to display name causing inconsistency
262262
if state.ResourceType.ValueString() == "DESTINATION" || state.ResourceType.ValueString() == "INSERT_DESTINATION" {

internal/provider/models/function.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type FunctionPlan struct {
4141
Settings types.Set `tfsdk:"settings"`
4242
}
4343

44-
func (f *FunctionState) Fill(function api.Function) {
44+
func (f *FunctionState) Fill(function api.FunctionV1) {
4545
f.ID = types.StringPointerValue(function.Id)
4646
f.Code = types.StringPointerValue(function.Code)
4747
f.DisplayName = types.StringPointerValue(function.DisplayName)

internal/provider/models/reverse_etl_model.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (r *ReverseETLModelState) Fill(model api.ReverseEtlModel) error {
2727
r.ScheduleStrategy = types.StringValue(model.ScheduleStrategy)
2828
r.Query = types.StringValue(model.Query)
2929
r.QueryIdentifierColumn = types.StringValue(model.QueryIdentifierColumn)
30-
scheduleConfig, err := GetSettings(model.ScheduleConfig)
30+
scheduleConfig, err := GetScheduleConfig(model.ScheduleConfig)
3131
if err != nil {
3232
return err
3333
}
@@ -39,3 +39,20 @@ func (r *ReverseETLModelState) Fill(model api.ReverseEtlModel) error {
3939

4040
return nil
4141
}
42+
43+
func GetScheduleConfig(scheduleConfig api.NullableScheduleConfig) (jsontypes.Normalized, error) {
44+
if !scheduleConfig.IsSet() {
45+
return jsontypes.NewNormalizedNull(), nil
46+
}
47+
48+
jsonScheduleConfigString, err := scheduleConfig.Get().MarshalJSON()
49+
if err != nil {
50+
return jsontypes.NewNormalizedNull(), err
51+
}
52+
53+
if jsonScheduleConfigString == nil {
54+
return jsontypes.NewNormalizedValue("{}"), nil
55+
}
56+
57+
return jsontypes.NewNormalizedValue(string(jsonScheduleConfigString)), nil
58+
}

0 commit comments

Comments
 (0)