-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 "billing_information" RBAC resource #5676
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e52f713
tmp
alex-kovoy 853cd6d
tmp
alex-kovoy 8eaeae0
Update E-ref
alex-kovoy 810c3d0
Address CR comments
alex-kovoy fedbabc
Expose GRPC client connection to plugins
alex-kovoy de8b938
Address CR comments
alex-kovoy f22da14
Cleanup
alex-kovoy 0c12477
Update E-ref
alex-kovoy 3f747d0
Address CR comments
alex-kovoy 030b072
Update e-ref
alex-kovoy 68c4fa0
Address CR comments
alex-kovoy cf30564
E ref
alex-kovoy a629777
refactor plugins
alex-kovoy b9070d3
Update e-ref
alex-kovoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule e
updated
from f8bf84 to 0e18de
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/* | ||
Copyright 2015-2021 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 plugin | ||
|
||
import "github.com/gravitational/trace" | ||
|
||
// Plugin describes interfaces of the teleport core plugin | ||
type Plugin interface { | ||
// GetName returns plugin name | ||
GetName() string | ||
// RegisterProxyWebHandlers registers new methods with the ProxyWebHandler | ||
RegisterProxyWebHandlers(handler interface{}) error | ||
// RegisterAuthWebHandlers registers new methods with the Auth Web Handler | ||
RegisterAuthWebHandlers(service interface{}) error | ||
// RegisterAuthServices registers new services on the AuthServer | ||
RegisterAuthServices(server interface{}) error | ||
} | ||
|
||
// Registry is the plugin registry | ||
type Registry interface { | ||
// Add adds plugin to the registry | ||
Add(plugin Plugin) error | ||
// RegisterProxyWebHandlers registers Teleport Proxy web handlers | ||
RegisterProxyWebHandlers(hander interface{}) error | ||
// RegisterAuthWebHandlers registers Teleport Auth web handlers | ||
RegisterAuthWebHandlers(handler interface{}) error | ||
// RegisterAuthServices registerse Teleport AuthServer services | ||
RegisterAuthServices(server interface{}) error | ||
} | ||
|
||
// NewRegistry creates an instance of the Registry | ||
func NewRegistry() Registry { | ||
return ®istry{ | ||
plugins: make(map[string]Plugin), | ||
} | ||
} | ||
|
||
type registry struct { | ||
plugins map[string]Plugin | ||
} | ||
|
||
// Add adds plugin to the plugin registry | ||
func (r *registry) Add(p Plugin) error { | ||
if p == nil { | ||
return trace.BadParameter("missing plugin") | ||
} | ||
|
||
name := p.GetName() | ||
if name == "" { | ||
return trace.BadParameter("missing plugin name") | ||
} | ||
|
||
_, exists := r.plugins[name] | ||
if exists { | ||
return trace.AlreadyExists("plugin %v already exists", name) | ||
} | ||
|
||
r.plugins[name] = p | ||
|
||
return nil | ||
} | ||
|
||
// RegisterProxyWebHandlers registers Teleport Proxy web handlers | ||
func (r *registry) RegisterProxyWebHandlers(hander interface{}) error { | ||
for _, p := range r.plugins { | ||
if err := p.RegisterProxyWebHandlers(hander); err != nil { | ||
return trace.Wrap(err, "plugin %v failed to register", p.GetName()) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// RegisterAuthWebHandlers registers Teleport Auth web handlers | ||
func (r *registry) RegisterAuthWebHandlers(handler interface{}) error { | ||
for _, p := range r.plugins { | ||
if err := p.RegisterAuthWebHandlers(handler); err != nil { | ||
return trace.Wrap(err, "plugin %v failed to register", p.GetName()) | ||
} | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// RegisterAuthServices registerse Teleport AuthServer services | ||
func (r *registry) RegisterAuthServices(server interface{}) error { | ||
for _, p := range r.plugins { | ||
if err := p.RegisterAuthServices(server); err != nil { | ||
return trace.Wrap(err, "plugin %v failed to register", p.GetName()) | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This map is not going to be used concurrently as plugin registrations happen during the initialization time.
Btw, @klizhentas i am not happy with the package name
plugin
as it overlaps with other plugins (data). What if I name it asenterprise
implying enterprise only extensions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think either
plugin
orextensions
is fine. I would stay away fromenterprise