Documentation
¶
Index ¶
- Constants
- func ConsumerIdentityForConfigHandlerFunc[T runtime.Typed](...) http.HandlerFunc
- func NewCredentialRepositoryPluginConverter(plugin v1.CredentialRepositoryPluginContract[runtime.Typed]) credentials.RepositoryPlugin
- func RegisterCredentialRepository[T runtime.Typed](proto T, handler v1.CredentialRepositoryPluginContract[T], ...) error
- func RegisterInternalCredentialRepositoryPlugin[T runtime.Typed](scheme *runtime.Scheme, r *RepositoryRegistry, ...) error
- func ResolveHandlerFunc[T runtime.Typed](...) http.HandlerFunc
- type RepositoryPlugin
- func (r *RepositoryPlugin) ConsumerIdentityForConfig(ctx context.Context, cfg v1.ConsumerIdentityForConfigRequest[runtime.Typed]) (runtime.Identity, error)
- func (r *RepositoryPlugin) Ping(ctx context.Context) error
- func (r *RepositoryPlugin) Resolve(ctx context.Context, cfg v1.ResolveRequest[runtime.Typed], ...) (map[string]string, error)
- type RepositoryRegistry
- func (r *RepositoryRegistry) AddPlugin(plugin mtypes.Plugin, consumerIdentityType, configType runtime.Type) error
- func (r *RepositoryRegistry) GetPlugin(ctx context.Context, spec runtime.Typed) (credentials.RepositoryPlugin, error)
- func (r *RepositoryRegistry) GetRepositoryPlugin(ctx context.Context, consumer runtime.Typed) (credentials.RepositoryPlugin, error)
- func (r *RepositoryRegistry) RepositoryScheme() *runtime.Scheme
- func (r *RepositoryRegistry) Shutdown(ctx context.Context) error
- type TypeToUntypedPlugin
- func (r *TypeToUntypedPlugin[T]) ConsumerIdentityForConfig(ctx context.Context, cfg v1.ConsumerIdentityForConfigRequest[runtime.Typed]) (runtime.Identity, error)
- func (r *TypeToUntypedPlugin[T]) Ping(ctx context.Context) error
- func (r *TypeToUntypedPlugin[T]) Resolve(ctx context.Context, cfg v1.ResolveRequest[runtime.Typed], ...) (map[string]string, error)
Constants ¶
const ( // ConsumerIdentityForConfig defines the endpoint to get consumer identity for configuration. ConsumerIdentityForConfig = "/consumer-identity" // Resolve defines the endpoint to resolve credentials using the credential graph. Resolve = "/resolve" )
Endpoints
Variables ¶
This section is empty.
Functions ¶
func ConsumerIdentityForConfigHandlerFunc ¶
func ConsumerIdentityForConfigHandlerFunc[T runtime.Typed](f func(ctx context.Context, cfg v1.ConsumerIdentityForConfigRequest[T]) (runtime.Identity, error), scheme *runtime.Scheme, typ T) http.HandlerFunc
ConsumerIdentityForConfigHandlerFunc is a wrapper around calling the interface method ConsumerIdentityForConfig for the plugin. This is a convenience wrapper containing header and query parameter parsing logic that is not important to know for the plugin implementor.
func NewCredentialRepositoryPluginConverter ¶
func NewCredentialRepositoryPluginConverter(plugin v1.CredentialRepositoryPluginContract[runtime.Typed]) credentials.RepositoryPlugin
NewCredentialRepositoryPluginConverter creates a new converter that wraps an external CredentialRepositoryPluginContract to implement the internal credentials.RepositoryPlugin interface.
func RegisterCredentialRepository ¶
func RegisterCredentialRepository[T runtime.Typed]( proto T, handler v1.CredentialRepositoryPluginContract[T], c *endpoints.EndpointBuilder, ) error
RegisterCredentialRepository takes a builder and a handler and based on the handler's contract type will construct a list of endpoint handlers that they will need. Once completed, MarshalJSON can be used to construct the supported endpoint list to give back to the plugin manager. This information is stored about the plugin and then used for later lookup. The type is also saved with the endpoint, meaning during lookup the right endpoint + type is used.
func RegisterInternalCredentialRepositoryPlugin ¶
func RegisterInternalCredentialRepositoryPlugin[T runtime.Typed]( scheme *runtime.Scheme, r *RepositoryRegistry, plugin credentials.RepositoryPlugin, cfg T, consumerTypes []runtime.Type, ) error
RegisterInternalCredentialRepositoryPlugin can be called by actual implementations in the source. It will register any implementations directly for a given type and capability.
func ResolveHandlerFunc ¶
func ResolveHandlerFunc[T runtime.Typed](f func(ctx context.Context, cfg v1.ResolveRequest[T], credentials map[string]string) (map[string]string, error), scheme *runtime.Scheme, typ T) http.HandlerFunc
ResolveHandlerFunc is a wrapper around calling the interface method Resolve for the plugin. This is a convenience wrapper containing header and query parameter parsing logic that is not important to know for the plugin implementor.
Types ¶
type RepositoryPlugin ¶
type RepositoryPlugin struct { ID string // contains filtered or unexported fields }
func NewCredentialRepositoryPlugin ¶
func NewCredentialRepositoryPlugin(client *http.Client, id string, path string, config types.Config, loc string, jsonSchema []byte) *RepositoryPlugin
NewCredentialRepositoryPlugin creates a new credential repository plugin instance with the provided configuration. It initializes the plugin with an HTTP client, unique ID, path, configuration, location, and JSON schema.
func (*RepositoryPlugin) ConsumerIdentityForConfig ¶
func (r *RepositoryPlugin) ConsumerIdentityForConfig(ctx context.Context, cfg v1.ConsumerIdentityForConfigRequest[runtime.Typed]) (runtime.Identity, error)
type RepositoryRegistry ¶
type RepositoryRegistry struct {
// contains filtered or unexported fields
}
RepositoryRegistry holds all plugins that implement capabilities corresponding to RepositoryPlugin operations.
func NewCredentialRepositoryRegistry ¶
func NewCredentialRepositoryRegistry(ctx context.Context) *RepositoryRegistry
NewCredentialRepositoryRegistry creates a new registry and initializes maps.
func (*RepositoryRegistry) AddPlugin ¶
func (r *RepositoryRegistry) AddPlugin(plugin mtypes.Plugin, consumerIdentityType, configType runtime.Type) error
AddPlugin takes a credentialGraphPlugin discovered by the manager and adds it to the stored credentialGraphPlugin registry. This function will return an error if the given capability + type already has a registered credentialGraphPlugin. Multiple plugins for the same cap+typ is not allowed.
func (*RepositoryRegistry) GetPlugin ¶
func (r *RepositoryRegistry) GetPlugin(ctx context.Context, spec runtime.Typed) (credentials.RepositoryPlugin, error)
func (*RepositoryRegistry) GetRepositoryPlugin ¶
func (r *RepositoryRegistry) GetRepositoryPlugin(ctx context.Context, consumer runtime.Typed) (credentials.RepositoryPlugin, error)
func (*RepositoryRegistry) RepositoryScheme ¶
func (r *RepositoryRegistry) RepositoryScheme() *runtime.Scheme
func (*RepositoryRegistry) Shutdown ¶
func (r *RepositoryRegistry) Shutdown(ctx context.Context) error
Shutdown will loop through all _STARTED_ plugins and will send an Interrupt signal to them. All plugins should handle interrupt signals gracefully. For Go, this is done automatically by the plugin SDK.
type TypeToUntypedPlugin ¶
func (*TypeToUntypedPlugin[T]) ConsumerIdentityForConfig ¶
func (r *TypeToUntypedPlugin[T]) ConsumerIdentityForConfig(ctx context.Context, cfg v1.ConsumerIdentityForConfigRequest[runtime.Typed]) (runtime.Identity, error)