I'm running into 2 separate issues using the Grafeas golang proto/v1beta1 API.
What I'm trying to do
- Call ListOccurrencesRequest() with a Filter to get a list of occurrences for deletion
- Call DeleteOccurrence() on each occurrence from above list to delete it
Issue #1
I'm trying to set
filterStr := fmt.Sprintf(`kind=%q`, grafeas_common_proto.NoteKind_BUILD.String())
ListOccurrencesRequest{
Parent: "projects/broker_builds",
Filter:
filterStr,
PageSize: 100,
}
But I get this error:
filterStr {"filterStr": "kind=\"BUILD\""}
failed to iterate over occurrences {"error": "rpc error: code = Internal desc = error while parsing filter expression: 4 errors occurred:\n\t* error parsing filter\n\t* Syntax error: token recognition error at: '=\"' (1:4)\n\t* Syntax error: token recognition error at: '\"' (1:11)\n\t* Syntax error: extraneous input 'BUILD' expecting <EOF> (1:6)\n\n"}
Issue #2
When trying to delete an occurrence, I can see that the occurrence is deleted using
But the err in the following code is always set by Grafeas:
for _, o := range occToDelete {
log.Info("occToDelete", zap.String("occurrence", o))
_, err := r.grafeasCommon.DeleteOccurrence(ctx, &grafeas_proto.DeleteOccurrenceRequest{
Name: o,
})
if err != nil {
log.Error("failed to delete occurrence", zap.String("occurrence", o), zap.NamedError("error", err))
}
}
And here's the error:
failed to delete occurrence {"occurrence": "projects/broker_builds/occurrences/f61a4c57-a3d3-44a9-86ee-5d58cb6c6052", "error": "rpc error: code = Internal desc = grpc: error while marshaling: proto: Marshal called with nil"}
Would anyone be able to point me in the right direction?
Thanks.