Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a guide to writing an Access Request plugin #22441

Merged
merged 5 commits into from
Mar 14, 2023

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Feb 28, 2023

Closes #22227

This guide uses a minimal working example of an Access Request plugin to demonstrate some of the key libraries that Teleport makes available to plugin developers. The guide is based on a 270-line plugin that manages Access Requests using Google Sheets.

```go
func (g *googleSheetsPlugin) makeRowData(ar types.AccessRequest) *sheets.RowData {

t := ar.GetCreationTime().String()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this hard to follow, since the variables have non-descriptive names and are used a dozen or so lines after they are declared.

How about a helper:

func stringPtr(s string) *string { return &s 

Then you don't need these variables here and you inline them below.

UserEnteredValue: &sheets.ExtendedValue{
    StringValue: stringPtr(ar.GetCreationTime().String()),
},

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added for the one-line assignments. For the request state and link string, I used descriptive variable names instead.

@ptgott ptgott requested review from zmb3 and hugoShaka March 1, 2023 22:43
@ptgott ptgott force-pushed the paul.gottschling/22227-access-plugin branch 2 times, most recently from a036718 to 6cc2f72 Compare March 2, 2023 22:28
@ptgott
Copy link
Contributor Author

ptgott commented Mar 7, 2023

@alexfornuto This should be ready for a copy review

ptgott added 4 commits March 7, 2023 16:26
Closes #22227

This guide uses a minimal working example of an Access Request plugin to
demonstrate some of the key libraries that Teleport makes available to
plugin developers. The guide is based on a 270-line plugin that manages
Access Requests using Google Sheets.
- Update the line of code count in the demo program
- Mention Machine ID
@ptgott ptgott force-pushed the paul.gottschling/22227-access-plugin branch from 6cc2f72 to 4c64f7c Compare March 7, 2023 21:26
@ptgott ptgott requested a review from alexfornuto March 9, 2023 21:38
@ptgott
Copy link
Contributor Author

ptgott commented Mar 14, 2023

@hugoShaka @zmb3 Just checking to see if you were planning to give this another review. Thanks!

@ptgott ptgott enabled auto-merge March 14, 2023 17:34
@ptgott ptgott added this pull request to the merge queue Mar 14, 2023
Merged via the queue into master with commit c553fa7 Mar 14, 2023
@public-teleport-github-review-bot

@ptgott See the table below for backport results.

Branch Result
branch/v10 Failed
branch/v11 Failed
branch/v12 Failed

@stevenGravy
Copy link
Contributor

@ptgott some misspellings here. I'll post in here the master PR so you can apply them in the backports.

@zmb3 zmb3 deleted the paul.gottschling/22227-access-plugin branch March 14, 2023 18:57
@stevenGravy
Copy link
Contributor

Spell fixes in #23068

ptgott added a commit that referenced this pull request Mar 14, 2023
* Add a guide to writing an Access Request plugin

Closes #22227

This guide uses a minimal working example of an Access Request plugin to
demonstrate some of the key libraries that Teleport makes available to
plugin developers. The guide is based on a 270-line plugin that manages
Access Requests using Google Sheets.

* Respond to hugoShaka feedback

* Respond to zmb3 feedback

* Add some minor tweaks

- Update the line of code count in the demo program
- Mention Machine ID

* Respond to alexfornuto PR feedback
ptgott added a commit that referenced this pull request Mar 14, 2023
* Add a guide to writing an Access Request plugin

Closes #22227

This guide uses a minimal working example of an Access Request plugin to
demonstrate some of the key libraries that Teleport makes available to
plugin developers. The guide is based on a 270-line plugin that manages
Access Requests using Google Sheets.

* Respond to hugoShaka feedback

* Respond to zmb3 feedback

* Add some minor tweaks

- Update the line of code count in the demo program
- Mention Machine ID

* Respond to alexfornuto PR feedback
ptgott added a commit that referenced this pull request Mar 15, 2023
* Add a guide to writing an Access Request plugin (#22441)

* Add a guide to writing an Access Request plugin

Closes #22227

This guide uses a minimal working example of an Access Request plugin to
demonstrate some of the key libraries that Teleport makes available to
plugin developers. The guide is based on a 270-line plugin that manages
Access Requests using Google Sheets.

* Respond to hugoShaka feedback

* Respond to zmb3 feedback

* Add some minor tweaks

- Update the line of code count in the demo program
- Mention Machine ID

* Respond to alexfornuto PR feedback

* spell fixes plugin api docs (#23068)

---------

Co-authored-by: Steven Martin <steven@goteleport.com>
ptgott added a commit that referenced this pull request Mar 15, 2023
* Add a guide to writing an Access Request plugin (#22441)

* Add a guide to writing an Access Request plugin

Closes #22227

This guide uses a minimal working example of an Access Request plugin to
demonstrate some of the key libraries that Teleport makes available to
plugin developers. The guide is based on a 270-line plugin that manages
Access Requests using Google Sheets.

* Respond to hugoShaka feedback

* Respond to zmb3 feedback

* Add some minor tweaks

- Update the line of code count in the demo program
- Mention Machine ID

* Respond to alexfornuto PR feedback

* spell fixes plugin api docs (#23068)

---------

Co-authored-by: Steven Martin <steven@goteleport.com>
ptgott added a commit that referenced this pull request Mar 16, 2023
* Add a guide to writing an Access Request plugin

Closes #22227

This guide uses a minimal working example of an Access Request plugin to
demonstrate some of the key libraries that Teleport makes available to
plugin developers. The guide is based on a 270-line plugin that manages
Access Requests using Google Sheets.

* Respond to hugoShaka feedback

* Respond to zmb3 feedback

* Add some minor tweaks

- Update the line of code count in the demo program
- Mention Machine ID

* Respond to alexfornuto PR feedback
ptgott added a commit that referenced this pull request Mar 16, 2023
* Add a guide to writing an Access Request plugin (#22441)

* Add a guide to writing an Access Request plugin

Closes #22227

This guide uses a minimal working example of an Access Request plugin to
demonstrate some of the key libraries that Teleport makes available to
plugin developers. The guide is based on a 270-line plugin that manages
Access Requests using Google Sheets.

* Respond to hugoShaka feedback

* Respond to zmb3 feedback

* Add some minor tweaks

- Update the line of code count in the demo program
- Mention Machine ID

* Respond to alexfornuto PR feedback

* spell fixes plugin api docs (#23068)

* Linter fixes

---------

Co-authored-by: Steven Martin <steven@goteleport.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add instructions for building a custom Access Request plugin
5 participants