1 Commits
Author SHA1 Message Date
Paul GottschlingandBrian Joerger 5cf2fa504f Use the examples directory for example plugin code (#23255)
* Use the examples directory for example plugin code

Also edit the Access Request plugin API guide to use this directory,
rather than having the reader copy/paste individual code snippets. This
makes the guide easier to follow, and users will have a compilable
example before they proceed through the guide.

* Run make fix-license

* Run make fix-imports

* Fix spelling

* Run go mod tidy

* Extract Access Request plugin example to partials

This way, we can reuse the actual program in the Access Request plugin
API guide and avoid unintended discrepancies and drift.

* Use types.Events.NewWatcher instead of watcherjob

Need to test this out, but it compiles

* Remove outdated information

- Types that are no longer reachable via public interfaces
- The description of the demo implementation that used the old
  `watcherjob` package

* Update text to reflect new `run` logic

* Make the example program more modular

Respond to Joerger feedback

* Respond to alexfornuto feedback

* Apply suggestions from code review

Co-authored-by: Brian Joerger <bjoerger@goteleport.com>

* Respond to zmb3 feedback

- Split up "types.go". Reserve a single file for configuration values so
  these are visible in a single place within the guide.
- Return an error on an unsuccessful HTTP request when creating or
  updating a row
- Simplify requestStates lookup
- Clearly mark values that a user must change
- Update the text of the guide to match changes to the program

* Spell fixes

* Respond to zmb3 feedback

---------

Co-authored-by: Brian Joerger <bjoerger@goteleport.com>
2023-07-14 18:53:35 +00:00