plugin

package
v0.0.0-...-1ad39a8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package plugin provides tools for managing rotation, disablement, and storage plugins. It provides tooling for managing plugin instantiation and caching of instatiated plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(pkg string, b Builder)

Register should be called during package initialization to add a plugin package to the registered list of plugins. The Go package name is preferred as the registered alias by convention, but it could be anything.

Types

type Builder

type Builder interface {
	Build(ctx context.Context, c *config.Plugin) (Instance, error)
}

Builder is the interface that the registered plugins will implement. It simply provides a means for constructing the plugin.

func Get

func Get(pkg string) Builder

Get retrieves the builder associated with the given package or nil.

type Instance

type Instance interface {
	// Name is the descriptive name of the plugin used in logging messages.
	Name() string
}

Instance is the interface that all constructed plugins must implement. Presumably, they will also implement rotate.Client and/or rotate.Storage and/or disable.Client as well.

func Build

func Build(ctx context.Context, c *config.Plugin) (Instance, error)

Build will construct a plugin instance and return it. If the instance fails during construction, an error will be returned. If no plugin is registered for the given package, an error will be returned.

type InstanceList

type InstanceList map[string]Instance

InstanceList maps strings to constructed instances.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager provides a mechanism for building plugis lazily and caching them. Plugins returned by the methods of this object will be constructed the first the first time they are requested. Every subsequent call will return the cached value.

func NewManager

func NewManager(plugins config.PluginList) *Manager

NewManager returns a Manager object for the given configuration.

func (*Manager) Instance

func (m *Manager) Instance(ctx context.Context, name string) (Instance, error)

Instance first checks to see if the named plugin has already been built and cached. If so, it short-circuits the build process and returns the cached copy. If not, it looks up the configuration for the named plugin and then calls the Build() function to build it. It caches the instance and returns it.

If no plugin with the given name can be found it will return a nil instance and an error.

If an error occurs building the plugin, it will return an nil instance and an error.

Directories

Path Synopsis
aws
iam/user/access
Package iam provides a plugin which implements both the rotate.Client and the disable.Client and is used to rotate IAM AWS user accounts and disable inactive access keys associated with those accounts.
Package iam provides a plugin which implements both the rotate.Client and the disable.Client and is used to rotate IAM AWS user accounts and disable inactive access keys associated with those accounts.
circleci
project/env
Package circleci provides a plugin that implemetns the rotate.Storage interface for storing keys in CircleCI environment variables.
Package circleci provides a plugin that implemetns the rotate.Storage interface for storing keys in CircleCI environment variables.
github
action/secret
Package github provides a plugin that implements the rotate.Storage interface to store the results of password rotation into the action secret store of a github project.
Package github provides a plugin that implements the rotate.Storage interface to store the results of password rotation into the action secret store of a github project.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL