Skip to content

Commit

Permalink
Improve checking in Configure method
Browse files Browse the repository at this point in the history
  • Loading branch information
csquire committed Dec 6, 2024
1 parent e340fc6 commit 65523ce
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pkg/framework/objects/azure_dev_ops_project/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,16 @@ func (d *azureDevOpsProjectDataSource) Read(
func (d *azureDevOpsProjectDataSource) Configure(
_ context.Context,
req datasource.ConfigureRequest,
_ *datasource.ConfigureResponse,
resp *datasource.ConfigureResponse,
) {
if req.ProviderData == nil {
return
switch c := req.ProviderData.(type) {
case nil: // do nothing
case *dbt_cloud.Client:
d.client = c
default:
resp.Diagnostics.AddError(
"Missing client",
"A client is required to configure the Azure DevOps Project data source",
)
}

d.client = req.ProviderData.(*dbt_cloud.Client)
}

0 comments on commit 65523ce

Please sign in to comment.