fi

package
v0.0.0-...-d54b621 Latest Latest
Warning

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

Go to latest
Published: May 13, 2016 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashAlgorithmSHA256 = "sha256"
	HashAlgorithmSHA1   = "sha1"
	HashAlgorithmMD5    = "md5"
)

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

func BoolValue

func BoolValue(v *bool) bool

func BuildChanges

func BuildChanges(a, e, changes interface{}) bool

BuildChanges compares the values of a & e, and populates differences into changes, except that if a value is nil in e, the corresponding value in a is ignored. a, e and changes must all be of the same type a is the actual object found, e is the expected value Note that the ignore-nil-in-e logic therefore implements the idea that nil value in e means "don't care" If a is nil, all the non-nil values in e will be copied over to changes, because every field in e must be applied

func CannotChangeField

func CannotChangeField(key string) error

func CopyResource

func CopyResource(dest io.Writer, r Resource) (int64, error)

func DebugAsJsonString

func DebugAsJsonString(v interface{}) string

func DebugAsJsonStringIndent

func DebugAsJsonStringIndent(v interface{}) string

func DebugPrint

func DebugPrint(o interface{}) string

func DefaultDeltaRunMethod

func DefaultDeltaRunMethod(e Task, c *Context) error

DefaultDeltaRunMethod implements the standard change-based run procedure: find the existing item; compare properties; call render with (actual, expected, changes)

func DownloadURL

func DownloadURL(url string, dest string, hash string) (string, error)

func EnsureFileMode

func EnsureFileMode(destPath string, fileMode os.FileMode) (bool, error)

func FileModeToString

func FileModeToString(mode os.FileMode) string

func HashFile

func HashFile(f string, hashAlgorithm HashAlgorithm) (string, error)

func HashForResource

func HashForResource(r Resource, hashAlgorithm HashAlgorithm) (string, error)

func HashesForResource

func HashesForResource(r Resource, hashAlgorithms []HashAlgorithm) (map[HashAlgorithm]string, error)

func IdForTask

func IdForTask(taskMap map[string]Task, t Task) string

func Int

func Int(v int) *int

func Int64

func Int64(v int64) *int64

func NewHasher

func NewHasher(hashAlgorithm HashAlgorithm) hash.Hash

func ParseFileMode

func ParseFileMode(s string, defaultMode os.FileMode) (os.FileMode, error)

func RequiredField

func RequiredField(key string) error

func ResourceAsBytes

func ResourceAsBytes(r Resource) ([]byte, error)

func ResourceAsString

func ResourceAsString(r Resource) (string, error)

func ResourcesMatch

func ResourcesMatch(a, b Resource) (bool, error)

func SafeClose

func SafeClose(r io.Reader)

func String

func String(s string) *string

func StringValue

func StringValue(s *string) string

func TaskAsString

func TaskAsString(t Task) string

TaskAsString renders the task for debug output TODO: Use reflection to make this cleaner: don't recurse into tasks - print their names instead also print resources in a cleaner way (use the resource source information?)

func TopologicalSort

func TopologicalSort(tasks map[string]Task) [][]string

func WriteFile

func WriteFile(destPath string, contents Resource, fileMode os.FileMode, dirMode os.FileMode) error

func WritePrivateKey

func WritePrivateKey(privateKey crypto.PrivateKey, w io.Writer) error

Types

type AssetStore

type AssetStore struct {
	// contains filtered or unexported fields
}

func NewAssetStore

func NewAssetStore(assetDir string) *AssetStore

func (*AssetStore) Add

func (a *AssetStore) Add(id string) error

func (*AssetStore) Find

func (a *AssetStore) Find(key string, assetPath string) (Resource, error)

type BytesResource

type BytesResource struct {
	// contains filtered or unexported fields
}

func NewBytesResource

func NewBytesResource(data []byte) *BytesResource

func (*BytesResource) Open

func (r *BytesResource) Open() (io.ReadSeeker, error)

type CAStore

type CAStore interface {
	Cert(id string) (*Certificate, error)
	PrivateKey(id string) (*PrivateKey, error)

	FindCert(id string) (*Certificate, error)
	FindPrivateKey(id string) (*PrivateKey, error)

	IssueCert(id string, privateKey *PrivateKey, template *x509.Certificate) (*Certificate, error)
	CreatePrivateKey(id string) (*PrivateKey, error)
}

func NewFilesystemCAStore

func NewFilesystemCAStore(basedir string) (CAStore, error)

type Certificate

type Certificate struct {
	Subject pkix.Name
	IsCA    bool

	Certificate *x509.Certificate
	PublicKey   crypto.PublicKey
}

func LoadPEMCertificate

func LoadPEMCertificate(pemData []byte) (*Certificate, error)

func SignNewCertificate

func SignNewCertificate(privateKey *PrivateKey, template *x509.Certificate, signer *x509.Certificate, signerPrivateKey *PrivateKey) (*Certificate, error)

func (*Certificate) AsString

func (c *Certificate) AsString() (string, error)

func (*Certificate) MarshalJSON

func (c *Certificate) MarshalJSON() ([]byte, error)

func (*Certificate) UnmarshalJSON

func (c *Certificate) UnmarshalJSON(b []byte) error

func (*Certificate) WriteCertificate

func (c *Certificate) WriteCertificate(w io.Writer) error

type Cloud

type Cloud interface {
	ProviderID() CloudProviderID
}

type CloudProviderID

type CloudProviderID string
const CloudProviderAWS CloudProviderID = "aws"
const CloudProviderGCE CloudProviderID = "gce"

type CompareWithID

type CompareWithID interface {
	CompareWithID() *string
}

CompareWithID indicates that the value should be compared by the returned ID value (instead of a deep comparison) Most Tasks implement this, because typically when a Task references another task, it only is concerned with being linked to that task, not the values of the task. For example, when an instance is linked to a disk, it cares that the disk is attached to that instance, not the size or speed of the disk.

type Context

type Context struct {
	Tmpdir string

	Target  Target
	Cloud   Cloud
	CAStore CAStore

	CheckExisting bool
}

func NewContext

func NewContext(target Target, cloud Cloud, castore CAStore, checkExisting bool) (*Context, error)

func (*Context) Close

func (c *Context) Close()

func (*Context) NewTempDir

func (c *Context) NewTempDir(prefix string) (string, error)

func (*Context) Render

func (c *Context) Render(a, e, changes Task) error

func (*Context) RunTasks

func (c *Context) RunTasks(taskMap map[string]Task) error

type DryRunTarget

type DryRunTarget struct {
	// contains filtered or unexported fields
}

DryRunTarget is a special Target that does not execute anything, but instead tracks all changes. By running against a DryRunTarget, a list of changes that would be made can be easily collected, without any special support from the Tasks.

func NewDryRunTarget

func NewDryRunTarget(out io.Writer) *DryRunTarget

func (*DryRunTarget) Finish

func (t *DryRunTarget) Finish(taskMap map[string]Task) error

Finish is called at the end of a run, and prints a list of changes to the configured Writer

func (*DryRunTarget) PrintReport

func (t *DryRunTarget) PrintReport(taskMap map[string]Task, out io.Writer) error

func (*DryRunTarget) Render

func (t *DryRunTarget) Render(a, e, changes Task) error

type FileResource

type FileResource struct {
	Path string
}

func NewFileResource

func NewFileResource(path string) *FileResource

func (*FileResource) Open

func (r *FileResource) Open() (io.ReadSeeker, error)

type FilesystemCAStore

type FilesystemCAStore struct {
	// contains filtered or unexported fields
}

func (*FilesystemCAStore) Cert

func (c *FilesystemCAStore) Cert(id string) (*Certificate, error)

func (*FilesystemCAStore) CreatePrivateKey

func (c *FilesystemCAStore) CreatePrivateKey(id string) (*PrivateKey, error)

func (*FilesystemCAStore) FindCert

func (c *FilesystemCAStore) FindCert(id string) (*Certificate, error)

func (*FilesystemCAStore) FindPrivateKey

func (c *FilesystemCAStore) FindPrivateKey(id string) (*PrivateKey, error)

func (*FilesystemCAStore) IssueCert

func (c *FilesystemCAStore) IssueCert(id string, privateKey *PrivateKey, template *x509.Certificate) (*Certificate, error)

func (*FilesystemCAStore) PrivateKey

func (c *FilesystemCAStore) PrivateKey(id string) (*PrivateKey, error)

type FilesystemSecretStore

type FilesystemSecretStore struct {
	// contains filtered or unexported fields
}

func (*FilesystemSecretStore) CreateSecret

func (c *FilesystemSecretStore) CreateSecret(id string) (*Secret, error)

func (*FilesystemSecretStore) FindSecret

func (c *FilesystemSecretStore) FindSecret(id string) (*Secret, error)

func (*FilesystemSecretStore) Secret

func (c *FilesystemSecretStore) Secret(id string) (*Secret, error)

type HasDependencies

type HasDependencies interface {
	GetDependencies(tasks map[string]Task) []string
}

type HasSource

type HasSource interface {
	GetSource() *Source
}

type HashAlgorithm

type HashAlgorithm string

type PrivateKey

type PrivateKey struct {
	Key crypto.PrivateKey
}

func (*PrivateKey) AsString

func (c *PrivateKey) AsString() (string, error)

func (*PrivateKey) MarshalJSON

func (k *PrivateKey) MarshalJSON() ([]byte, error)

func (*PrivateKey) UnmarshalJSON

func (k *PrivateKey) UnmarshalJSON(b []byte) (err error)

type Resource

type Resource interface {
	Open() (io.ReadSeeker, error)
}

type Secret

type Secret struct {
	Data []byte
}

func CreateSecret

func CreateSecret() (*Secret, error)

func (*Secret) AsString

func (s *Secret) AsString() (string, error)

type SecretStore

type SecretStore interface {
	Secret(id string) (*Secret, error)
	FindSecret(id string) (*Secret, error)
}

func NewFilesystemSecretStore

func NewFilesystemSecretStore(basedir string) (SecretStore, error)

type Source

type Source struct {
	Parent             *Source
	URL                string
	Hash               string
	ExtractFromArchive string
}

func (*Source) Key

func (s *Source) Key() string

Builds a unique key for this source

func (*Source) String

func (s *Source) String() string

type StringResource

type StringResource struct {
	// contains filtered or unexported fields
}

func NewStringResource

func NewStringResource(s string) *StringResource

func (*StringResource) Open

func (s *StringResource) Open() (io.ReadSeeker, error)

func (*StringResource) WriteTo

func (s *StringResource) WriteTo(out io.Writer) error

type Target

type Target interface {
	// Lifecycle methods, called by the driver
	Finish(taskMap map[string]Task) error
}

type Task

type Task interface {
	Run(*Context) error
}

type TemplateResource

type TemplateResource interface {
	Resource
	Curry(args []string) TemplateResource
}

Directories

Path Synopsis
gce

Jump to

Keyboard shortcuts

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