Skip to content

Commit 4cee48b

Browse files
lineage creation fixes
1 parent 428ccd5 commit 4cee48b

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

internal/provider/lineage_resource.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func (r *LineageResource) Schema(ctx context.Context, req resource.SchemaRequest
6868
"type": schema.StringAttribute{
6969
MarkdownDescription: "Lineage type",
7070
Computed: true,
71+
Optional: true,
7172
},
7273
},
7374
}
@@ -123,13 +124,17 @@ func (r *LineageResource) Read(ctx context.Context, req resource.ReadRequest, re
123124
return
124125
}
125126

126-
tflog.Info(ctx, "Read lineage", map[string]interface{}{
127-
"id": data.ResourceID.ValueString(),
128-
"source": data.Source.ValueString(),
129-
"target": data.Target.ValueString(),
130-
})
127+
params := lineage.NewGetLineageDirectIDParams().WithID(data.ResourceID.ValueString())
128+
result, err := r.client.Lineage.GetLineageDirectID(params)
129+
if err != nil {
130+
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Unable to read lineage: %s", err))
131+
return
132+
}
133+
134+
data.Source = types.StringValue(result.Payload.Source)
135+
data.Target = types.StringValue(result.Payload.Target)
136+
data.Type = types.StringValue(result.Payload.Type)
131137

132-
// Set state
133138
resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
134139
}
135140

0 commit comments

Comments
 (0)