Skip to content

Commit

Permalink
added validation for invalid id (#260)
Browse files Browse the repository at this point in the history
* added validation for invalid id
  • Loading branch information
AnikaAgiwal2711 authored Nov 20, 2024
1 parent 21e18ff commit 42bf570
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions powerscale/provider/synciq_replication_reports_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,11 @@ func (d *ReplicationReportDataSource) Read(ctx context.Context, req datasource.R
)
return
}

if len(*replicationReportList) == 0 {
resp.Diagnostics.AddError("Error reading replication reports", "No replication report found")
}

var rr []models.ReplicationReportsDetail
for _, rrItem := range *replicationReportList {
entity := models.ReplicationReportsDetail{}
Expand All @@ -865,6 +870,7 @@ func (d *ReplicationReportDataSource) Read(ctx context.Context, req datasource.R
}
rr = append(rr, entity)
}

state.Reports = rr
state.ID = types.StringValue("synciq_replication_report_datasource")
// Save data into Terraform state
Expand Down

0 comments on commit 42bf570

Please sign in to comment.