Skip to content

Commit

Permalink
Fix WatchStatus event on AccessPlugin example (#38670)
Browse files Browse the repository at this point in the history
* Fix WatchStatus event on AccessPlugin example

* use watchstatusv1
  • Loading branch information
marcoandredinis authored Feb 28, 2024
1 parent 6a4e175 commit be05a11
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion examples/access-plugin-minimal/watcherjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,16 @@ func (g *googleSheetsClient) HandleEvent(ctx context.Context, event types.Event)
return nil
}

r := event.Resource.(types.AccessRequest)
if _, ok := event.Resource.(*types.WatchStatusV1); ok {
fmt.Println("Successfully started listening for Access Requests...")
return nil
}

r, ok := event.Resource.(types.AccessRequest)
if !ok {
fmt.Printf("Unknown (%T) event received, skipping.\n", event.Resource)
return nil
}

if r.GetState() == types.RequestState_PENDING {
if err := g.createRow(r); err != nil {
Expand Down

0 comments on commit be05a11

Please sign in to comment.