Skip to content

Commit

Permalink
[v11] Use the examples directory for example plugin code (#29149)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
ptgott and Joerger authored Jul 19, 2023
1 parent e8600e7 commit 9782c8d
Show file tree
Hide file tree
Showing 13 changed files with 1,147 additions and 377 deletions.
4 changes: 4 additions & 0 deletions docs/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
"createkey",
"createnongalleryapp",
"createrole",
"createrow",
"creds",
"crond",
"customizability",
Expand Down Expand Up @@ -484,6 +485,7 @@
"machineid",
"machineidnote",
"mactor",
"makerowdata",
"mallocs",
"managedclusters",
"mant",
Expand Down Expand Up @@ -734,8 +736,10 @@
"unmarshal",
"unprefixed",
"unregistering",
"updaterow",
"updaterreleasechannel",
"updaterversionserver",
"updatespreadsheet",
"uqcje",
"urandom",
"userdel",
Expand Down
Loading

0 comments on commit 9782c8d

Please sign in to comment.