Documentation
¶
Overview ¶
Package plugin provides the tooling to use the notation plugin.
includes a CLIManager and a CLIPlugin implementation.
Index ¶
- Variables
- type CLIInstallOptions
- type CLIManager
- func (m *CLIManager) Get(ctx context.Context, name string) (plugin.Plugin, error)
- func (m *CLIManager) Install(ctx context.Context, installOpts CLIInstallOptions) (*plugin.GetMetadataResponse, *plugin.GetMetadataResponse, error)
- func (m *CLIManager) List(ctx context.Context) ([]string, error)
- func (m *CLIManager) Uninstall(ctx context.Context, name string) error
- type CLIPlugin
- func (p *CLIPlugin) DescribeKey(ctx context.Context, req *plugin.DescribeKeyRequest) (*plugin.DescribeKeyResponse, error)
- func (p *CLIPlugin) GenerateEnvelope(ctx context.Context, req *plugin.GenerateEnvelopeRequest) (*plugin.GenerateEnvelopeResponse, error)
- func (p *CLIPlugin) GenerateSignature(ctx context.Context, req *plugin.GenerateSignatureRequest) (*plugin.GenerateSignatureResponse, error)
- func (p *CLIPlugin) GetMetadata(ctx context.Context, req *plugin.GetMetadataRequest) (*plugin.GetMetadataResponse, error)
- func (p *CLIPlugin) VerifySignature(ctx context.Context, req *plugin.VerifySignatureRequest) (*plugin.VerifySignatureResponse, error)
- type GenericPlugindeprecated
- type InstallEqualVersionError
- type Manager
- type Plugindeprecated
- type PluginDirectoryWalkError
- type PluginDowngradeError
- type PluginExecutableFileError
- type PluginMalformedError
- type SignPlugindeprecated
- type VerifyPlugindeprecated
Constants ¶
This section is empty.
Variables ¶
var ErrNotCompliant = errors.New("plugin not compliant")
ErrNotCompliant is returned by plugin methods when the response is not compliant.
var ErrNotRegularFile = errors.New("plugin executable file is not a regular file")
ErrNotRegularFile is returned when the plugin file is not an regular file.
Functions ¶
This section is empty.
Types ¶
type CLIInstallOptions ¶ added in v1.1.0
type CLIInstallOptions struct {
// PluginPath can be path of:
//
// 1. A directory which contains plugin related files. Sub-directories are
// ignored. It MUST contain one and only one valid plugin executable file
// following spec: https://github.com/notaryproject/specifications/blob/v1.0.0/specs/plugin-extensibility.md#installation
// It may contain extra lib files and LICENSE files.
// On success, these files will be installed as well.
//
// 2. A single plugin executable file following the spec.
PluginPath string
// Overwrite is a boolean flag. When set, always install the new plugin.
Overwrite bool
}
CLIInstallOptions provides user customized options for plugin installation
type CLIManager ¶
type CLIManager struct {
// contains filtered or unexported fields
}
CLIManager implements Manager
func NewCLIManager ¶
func NewCLIManager(pluginFS dir.SysFS) *CLIManager
NewCLIManager returns CLIManager for named pluginFS.
func (*CLIManager) Get ¶
Get returns a plugin on the system by its name.
If the plugin is not found, the error is of type os.ErrNotExist.
func (*CLIManager) Install ¶ added in v1.1.0
func (m *CLIManager) Install(ctx context.Context, installOpts CLIInstallOptions) (*plugin.GetMetadataResponse, *plugin.GetMetadataResponse, error)
Install installs a plugin to the system. It returns existing plugin metadata, new plugin metadata, and error. It returns nil error if and only if the installation succeeded.
If plugin does not exist, directly install the new plugin.
If plugin already exists:
If overwrite is not set, then the new plugin version MUST be higher than the existing plugin version.
If overwrite is set, version check is skipped. If existing plugin is malfunctioning, it will be overwritten.
type CLIPlugin ¶
type CLIPlugin struct {
// contains filtered or unexported fields
}
CLIPlugin implements Plugin interface to CLI plugins.
func NewCLIPlugin ¶
NewCLIPlugin returns a *CLIPlugin.
func (*CLIPlugin) DescribeKey ¶
func (p *CLIPlugin) DescribeKey(ctx context.Context, req *plugin.DescribeKeyRequest) (*plugin.DescribeKeyResponse, error)
DescribeKey returns the KeySpec of a key.
if ContractVersion is not set, it will be set by the function.
func (*CLIPlugin) GenerateEnvelope ¶
func (p *CLIPlugin) GenerateEnvelope(ctx context.Context, req *plugin.GenerateEnvelopeRequest) (*plugin.GenerateEnvelopeResponse, error)
GenerateEnvelope generates the Envelope with signature based on the request.
if ContractVersion is not set, it will be set by the function.
func (*CLIPlugin) GenerateSignature ¶
func (p *CLIPlugin) GenerateSignature(ctx context.Context, req *plugin.GenerateSignatureRequest) (*plugin.GenerateSignatureResponse, error)
GenerateSignature generates the raw signature based on the request.
if ContractVersion is not set, it will be set by the function.
func (*CLIPlugin) GetMetadata ¶
func (p *CLIPlugin) GetMetadata(ctx context.Context, req *plugin.GetMetadataRequest) (*plugin.GetMetadataResponse, error)
GetMetadata returns the metadata information of the plugin.
func (*CLIPlugin) VerifySignature ¶
func (p *CLIPlugin) VerifySignature(ctx context.Context, req *plugin.VerifySignatureRequest) (*plugin.VerifySignatureResponse, error)
VerifySignature validates the signature based on the request.
if ContractVersion is not set, it will be set by the function.
type GenericPlugin
deprecated
type GenericPlugin = plugin.GenericPlugin
GenericPlugin is the base requirement to be a plugin.
Deprecated: GenericPlugin exists for historical compatibility and should not be used. To access GenericPlugin, use the notation-plugin-framework-go's plugin.GenericPlugin type.
type InstallEqualVersionError ¶ added in v1.1.0
type InstallEqualVersionError struct {
Msg string
}
InstallEqualVersionError is returned when installing a plugin with version equal to the exisiting plugin version.
func (InstallEqualVersionError) Error ¶ added in v1.1.0
func (e InstallEqualVersionError) Error() string
Error returns the error message.
type Manager ¶
type Manager interface {
Get(ctx context.Context, name string) (plugin.Plugin, error)
List(ctx context.Context) ([]string, error)
}
Manager manages plugins installed on the system.
type PluginDirectoryWalkError ¶ added in v1.1.0
type PluginDirectoryWalkError error
PluginDirectoryWalkError is used when there is an issue with plugins directory and should suggest user to check the permission of plugin directory.
type PluginDowngradeError ¶ added in v1.1.0
type PluginDowngradeError struct {
Msg string
}
PluginDowngradeError is returned when installing a plugin with version lower than the exisiting plugin version.
func (PluginDowngradeError) Error ¶ added in v1.1.0
func (e PluginDowngradeError) Error() string
Error returns the error message.
type PluginExecutableFileError ¶ added in v1.1.0
PluginExecutableFileError is used when there is an issue with plugin executable file and should suggest user to check the existence, permission and platform/arch compatibility of plugin.
func (PluginExecutableFileError) Error ¶ added in v1.1.0
func (e PluginExecutableFileError) Error() string
Error returns the error message.
func (PluginExecutableFileError) Unwrap ¶ added in v1.1.0
func (e PluginExecutableFileError) Unwrap() error
Unwrap returns the inner error.
type PluginMalformedError ¶ added in v1.1.0
PluginMalformedError is used when there is an issue with plugin and should be fixed by plugin developers.
func (PluginMalformedError) Error ¶ added in v1.1.0
func (e PluginMalformedError) Error() string
Error returns the error message.
func (PluginMalformedError) Unwrap ¶ added in v1.1.0
func (e PluginMalformedError) Unwrap() error
Unwrap returns the inner error.
type SignPlugin
deprecated
type SignPlugin = plugin.SignPlugin
SignPlugin defines the required methods to be a SignPlugin.
Deprecated: SignPlugin exists for historical compatibility and should not be used. To access SignPlugin, use the notation-plugin-framework-go's plugin.SignPlugin type.
type VerifyPlugin
deprecated
type VerifyPlugin = plugin.VerifyPlugin
VerifyPlugin defines the required method to be a VerifyPlugin.
Deprecated: VerifyPlugin exists for historical compatibility and should not be used. To access VerifyPlugin, use the notation-plugin-framework-go's plugin.VerifyPlugin type.