remote

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2015 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltinClients = map[string]Factory{
	"atlas":  atlasFactory,
	"consul": consulFactory,
	"http":   httpFactory,

	"_local": fileFactory,
}

BuiltinClients is the list of built-in clients that can be used with NewClient.

Functions

This section is empty.

Types

type AtlasClient

type AtlasClient struct {
	Server      string
	ServerURL   *url.URL
	User        string
	Name        string
	AccessToken string
}

AtlasClient implements the Client interface for an Atlas compatible server.

func (*AtlasClient) Delete

func (c *AtlasClient) Delete() error

func (*AtlasClient) Get

func (c *AtlasClient) Get() (*Payload, error)

func (*AtlasClient) Put

func (c *AtlasClient) Put(state []byte) error

type Client

type Client interface {
	Get() (*Payload, error)
	Put([]byte) error
	Delete() error
}

Client is the interface that must be implemented for a remote state driver. It supports dumb put/get/delete, and the higher level structs handle persisting the state properly here.

func NewClient

func NewClient(t string, conf map[string]string) (Client, error)

NewClient returns a new Client with the given type and configuration. The client is looked up in the BuiltinClients variable.

type ConsulClient

type ConsulClient struct {
	Client *consulapi.Client
	Path   string
}

ConsulClient is a remote client that stores data in Consul.

func (*ConsulClient) Delete

func (c *ConsulClient) Delete() error

func (*ConsulClient) Get

func (c *ConsulClient) Get() (*Payload, error)

func (*ConsulClient) Put

func (c *ConsulClient) Put(data []byte) error

type Factory

type Factory func(map[string]string) (Client, error)

Factory is the factory function to create a remote client.

type FileClient

type FileClient struct {
	Path string
}

FileClient is a remote client that stores data locally on disk. This is only used for development reasons to test remote state... locally.

func (*FileClient) Delete

func (c *FileClient) Delete() error

func (*FileClient) Get

func (c *FileClient) Get() (*Payload, error)

func (*FileClient) Put

func (c *FileClient) Put(data []byte) error

type HTTPClient

type HTTPClient struct {
	URL *url.URL
}

HTTPClient is a remote client that stores data in Consul.

func (*HTTPClient) Delete

func (c *HTTPClient) Delete() error

func (*HTTPClient) Get

func (c *HTTPClient) Get() (*Payload, error)

func (*HTTPClient) Put

func (c *HTTPClient) Put(data []byte) error

type InmemClient

type InmemClient struct {
	Data []byte
	MD5  []byte
}

InmemClient is a Client implementation that stores data in memory.

func (*InmemClient) Delete

func (c *InmemClient) Delete() error

func (*InmemClient) Get

func (c *InmemClient) Get() (*Payload, error)

func (*InmemClient) Put

func (c *InmemClient) Put(data []byte) error

type Payload

type Payload struct {
	MD5  []byte
	Data []byte
}

Payload is the return value from the remote state storage.

type State

type State struct {
	Client Client
	// contains filtered or unexported fields
}

State implements the State interfaces in the state package to handle reading and writing the remote state. This State on its own does no local caching so every persist will go to the remote storage and local writes will go to memory.

func (*State) PersistState

func (s *State) PersistState() error

StatePersister impl.

func (*State) RefreshState

func (s *State) RefreshState() error

StateRefresher impl.

func (*State) State

func (s *State) State() *terraform.State

StateReader impl.

func (*State) WriteState

func (s *State) WriteState(state *terraform.State) error

StateWriter impl.

Jump to

Keyboard shortcuts

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