mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-12 02:15:01 +00:00
* 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 <[email protected]> * 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 <[email protected]>
36 lines
1009 B
Go
36 lines
1009 B
Go
// Copyright 2023 Gravitational, Inc
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
sheets "google.golang.org/api/sheets/v4"
|
|
|
|
"github.com/gravitational/teleport/api/client"
|
|
"github.com/gravitational/teleport/api/types"
|
|
)
|
|
|
|
type AccessRequestPlugin struct {
|
|
TeleportClient *client.Client
|
|
EventHandler interface {
|
|
HandleEvent(ctx context.Context, event types.Event) error
|
|
}
|
|
}
|
|
|
|
type googleSheetsClient struct {
|
|
sheetsClient *sheets.SpreadsheetsService
|
|
}
|