github.com/zoomfoo/nomad@v0.8.5-0.20180907175415-f28fd3a1a056/plugins/base/base.go (about)

     1  package base
     2  
     3  import (
     4  	"github.com/hashicorp/nomad/plugins/shared/hclspec"
     5  )
     6  
     7  // BasePlugin is the interface that all Nomad plugins must support.
     8  type BasePlugin interface {
     9  	// PluginInfo describes the type and version of a plugin.
    10  	PluginInfo() (*PluginInfoResponse, error)
    11  
    12  	// ConfigSchema returns the schema for parsing the plugins configuration.
    13  	ConfigSchema() (*hclspec.Spec, error)
    14  
    15  	// SetConfig is used to set the configuration by passing a MessagePack
    16  	// encoding of it.
    17  	SetConfig(data []byte) error
    18  }
    19  
    20  // PluginInfoResponse returns basic information about the plugin such that Nomad
    21  // can decide whether to load the plugin or not.
    22  type PluginInfoResponse struct {
    23  	// Type returns the plugins type
    24  	Type string
    25  
    26  	// PluginApiVersion returns the version of the Nomad plugin API it is built
    27  	// against.
    28  	PluginApiVersion string
    29  
    30  	// PluginVersion is the version of the plugin.
    31  	PluginVersion string
    32  
    33  	// Name is the plugins name.
    34  	Name string
    35  }