instance

package
v0.0.0-...-a355528 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RollingUpdate is context indicating rolling update
	RollingUpdate = Context{Reason: "rolling_update"}

	// Termination is context indicating termination
	Termination = Context{Reason: "terminate"}
)
View Source
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) Len

func (list Descriptions) Len() int

Len is part of sort.Interface.

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.

func (Descriptions) Swap

func (list Descriptions) Swap(i, j int)

Swap is part of sort.Interface.

type ID

type ID string

ID is the identifier for an instance.

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

Jump to

Keyboard shortcuts

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