Skip to content

Commit

Permalink
Include 'id' in datastore read
Browse files Browse the repository at this point in the history
The datastore 'id' returned in the datastore read
response should be the same as the 'id' used in the
GET request. Nevertheless we use the returned value,
mainly to detect the extremely unlikely case where
the API returns an unexpected 'id' value.
  • Loading branch information
stuart-mclaren-hpe committed Aug 27, 2024
1 parent 85f2849 commit 227f6fe
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/resources/datastore/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,18 @@ func doRead(
return
}

id := datastore.GetId()
if id == nil {
(*diagsP).AddError(
"error reading datastore",
"'id' is nil",
)

return
}

(*dataP).Id = types.StringValue(*id)

datastoreName := datastore.GetName()
if datastoreName == nil {
(*diagsP).AddError(
Expand Down

0 comments on commit 227f6fe

Please sign in to comment.