Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // RollingUpdate is context indicating rolling update RollingUpdate = Context{Reason: "rolling_update"} // Termination is context indicating termination Termination = Context{Reason: "terminate"} )
var InterfaceSpec = spi.InterfaceSpec{
Name: "Instance",
Version: "0.6.0",
}
InterfaceSpec is the current name and version of the Instance API.
Functions ¶
This section is empty.
Types ¶
type Attachment ¶
type Attachment struct {
// ID is the unique identifier for the attachment.
ID string
// Type is the kind of attachment. This allows multiple attachments of different types, with the supported
// types defined by the plugin.
Type string
}
Attachment is an identifier for a resource to attach to an instance.
type Context ¶
type Context struct {
// Reason is a string that provides some information about the operation
// The string pointer denotes the field is optional
Reason string
}
Context provides additional information to certain operations. For example, context is used for Destroy to denote whether the destroy is for rolling update or termination
type Description ¶
type Description struct {
ID ID
LogicalID *LogicalID
Tags map[string]string
// Properties carry the opaque, platform specific blob about the resource.
// It can represent the current state of the resource.
Properties *types.Any `json:",omitempty" yaml:",omitempty"`
}
Description contains details about an instance.
func (Description) Compare ¶
func (d Description) Compare(other Description) int
Compare compares the two descriptions by ID
func (Description) Fingerprint ¶
func (d Description) Fingerprint() string
Fingerprint returns the fingerprint of the spec
type Descriptions ¶
type Descriptions []Description
Descriptions is a collection of descriptions
func (Descriptions) Less ¶
func (list Descriptions) Less(i, j int) bool
Less is part of sort.Interface. It is implemented by calling the "by" closure in the sorter.
type LogicalID ¶
type LogicalID string
LogicalID is the logical identifier to associate with an instance.
type Plugin ¶
type Plugin interface {
// Validate performs local validation on a provision request.
Validate(req *types.Any) error
// Provision creates a new instance based on the spec.
Provision(spec Spec) (*ID, error)
// Label labels the instance
Label(instance ID, labels map[string]string) error
// Destroy terminates an existing instance.
Destroy(instance ID, context Context) error
// DescribeInstances returns descriptions of all instances matching all of the provided tags.
// The properties flag indicates the client is interested in receiving details about each instance.
DescribeInstances(labels map[string]string, properties bool) ([]Description, error)
}
Plugin is a vendor-agnostic API used to create and manage resources with an infrastructure provider.
type Spec ¶
type Spec struct {
// Properties is the opaque instance plugin configuration.
Properties *types.Any
// Tags are metadata that describes an instance.
Tags map[string]string
// Init is the boot script to execute when the instance is created.
Init string
// LogicalID is the logical identifier assigned to this instance, which may be absent.
LogicalID *LogicalID
// Attachments are instructions for external entities that should be attached to the instance.
Attachments []Attachment
}
Spec is a specification of an instance to be provisioned