Skip to content

Commit

Permalink
Update with new SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
deanhuynh committed Jan 6, 2024
1 parent fdb492f commit 2de0a8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/provider/models/transformation.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type FQLDefinedProperty struct {
PropertyName types.String `tfsdk:"property_name"`
}

func (t *TransformationState) Fill(transformation api.Transformation5) {
func (t *TransformationState) Fill(transformation api.TransformationV1) {
t.ID = types.StringValue(transformation.Id)
t.SourceID = types.StringValue(transformation.SourceId)
t.DestinationMetadataID = types.StringPointerValue(transformation.DestinationMetadataId)
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/transformation_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (r *transformationResource) Create(ctx context.Context, req resource.Create
return
}

out, body, err := r.client.TransformationsApi.CreateTransformation(r.authContext).CreateTransformationV1Input(api.CreateTransformationV1Input{
out, body, err := r.client.TransformationsAPI.CreateTransformation(r.authContext).CreateTransformationV1Input(api.CreateTransformationV1Input{
Name: plan.Name.ValueString(),
SourceId: plan.SourceID.ValueString(),
DestinationMetadataId: plan.DestinationMetadataID.ValueStringPointer(),
Expand Down Expand Up @@ -196,7 +196,7 @@ func (r *transformationResource) Read(ctx context.Context, req resource.ReadRequ
return
}

out, body, err := r.client.TransformationsApi.GetTransformation(r.authContext, previousState.ID.ValueString()).Execute()
out, body, err := r.client.TransformationsAPI.GetTransformation(r.authContext, previousState.ID.ValueString()).Execute()
if body != nil {
defer body.Body.Close()
}
Expand All @@ -211,7 +211,7 @@ func (r *transformationResource) Read(ctx context.Context, req resource.ReadRequ

var state models.TransformationState

state.Fill(api.Transformation5(out.Data.Transformation))
state.Fill(out.Data.Transformation)

diags = resp.State.Set(ctx, &state)
resp.Diagnostics.Append(diags...)
Expand Down Expand Up @@ -253,7 +253,7 @@ func (r *transformationResource) Update(ctx context.Context, req resource.Update
return
}

out, body, err := r.client.TransformationsApi.UpdateTransformation(r.authContext, state.ID.ValueString()).UpdateTransformationV1Input(api.UpdateTransformationV1Input{
out, body, err := r.client.TransformationsAPI.UpdateTransformation(r.authContext, state.ID.ValueString()).UpdateTransformationV1Input(api.UpdateTransformationV1Input{
Name: plan.Name.ValueStringPointer(),
Enabled: plan.Enabled.ValueBoolPointer(),
If: plan.If.ValueStringPointer(),
Expand All @@ -276,7 +276,7 @@ func (r *transformationResource) Update(ctx context.Context, req resource.Update
return
}

state.Fill(api.Transformation5(out.Data.Transformation))
state.Fill(out.Data.Transformation)

diags = resp.State.Set(ctx, &state)
resp.Diagnostics.Append(diags...)
Expand All @@ -293,7 +293,7 @@ func (r *transformationResource) Delete(ctx context.Context, req resource.Delete
return
}

_, body, err := r.client.TransformationsApi.DeleteTransformation(r.authContext, config.ID.ValueString()).Execute()
_, body, err := r.client.TransformationsAPI.DeleteTransformation(r.authContext, config.ID.ValueString()).Execute()
if body != nil {
defer body.Body.Close()
}
Expand Down

0 comments on commit 2de0a8b

Please sign in to comment.