Documentation
¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func BoolValue(v *bool) bool
- func BuildChanges(a, e, changes interface{}) bool
- func BuildTimestampString() string
- func CannotChangeField(key string) error
- func CopyResource(dest io.Writer, r Resource) (int64, error)
- func DebugAsJsonString(v interface{}) string
- func DebugAsJsonStringIndent(v interface{}) string
- func DebugPrint(o interface{}) string
- func DefaultDeltaRunMethod(e Task, c *Context) error
- func DownloadURL(url string, dest string, hash *hashing.Hash) (*hashing.Hash, error)
- func EnsureFileMode(destPath string, fileMode os.FileMode) (bool, error)
- func EnsureFileOwner(destPath string, owner string, groupName string) (bool, error)
- func FileModeToString(mode os.FileMode) string
- func FindTaskDependencies(tasks map[string]Task) map[string][]string
- func IdForTask(taskMap map[string]Task, t Task) string
- func Int(v int) *int
- func Int64(v int64) *int64
- func Int64Value(v *int64) int64
- func IntValue(v *int) int
- func IsNilOrEmpty(s *string) bool
- func ParseFileMode(s string, defaultMode os.FileMode) (os.FileMode, error)
- func RequiredField(key string) error
- func ResourceAsBytes(r Resource) ([]byte, error)
- func ResourceAsString(r Resource) (string, error)
- func ResourcesMatch(a, b Resource) (bool, error)
- func SafeClose(r io.Reader)
- func String(s string) *string
- func StringValue(s *string) string
- func TaskAsString(t Task) string
- func Uint64Value(v *uint64) uint64
- func ValueAsString(value reflect.Value) string
- func WriteFile(destPath string, contents Resource, fileMode os.FileMode, dirMode os.FileMode) error
- type AssetStore
- type BytesResource
- type CAStore
- type Certificate
- type CertificatePool
- type Cloud
- type CloudProviderID
- type CompareWithID
- type Context
- type Deletion
- type DryRunTarget
- type FileResource
- type Group
- type HasAddress
- type HasCheckExisting
- type HasDependencies
- type HasName
- type HasSource
- type KeystoreItem
- type PrivateKey
- type ProducesDeletions
- type Resource
- type ResourceHolder
- type Secret
- type SecretStore
- type Source
- type StateStore
- type StringResource
- type Target
- type Task
- type TemplateResource
- type User
- type VFSCAStore
- func (c *VFSCAStore) AddCert(id string, cert *Certificate) error
- func (c *VFSCAStore) AddSSHPublicKey(name string, pubkey []byte) error
- func (c *VFSCAStore) Cert(id string) (*Certificate, error)
- func (c *VFSCAStore) CertificatePool(id string) (*CertificatePool, error)
- func (c *VFSCAStore) CreateKeypair(id string, template *x509.Certificate) (*Certificate, *PrivateKey, error)
- func (c *VFSCAStore) CreatePrivateKey(id string, serial *big.Int) (*PrivateKey, error)
- func (c *VFSCAStore) DeleteSecret(item *KeystoreItem) error
- func (c *VFSCAStore) FindCert(id string) (*Certificate, error)
- func (c *VFSCAStore) FindCertificatePool(id string) (*CertificatePool, error)
- func (c *VFSCAStore) FindPrivateKey(id string) (*PrivateKey, error)
- func (c *VFSCAStore) FindSSHPublicKeys(name string) ([]*KeystoreItem, error)
- func (c *VFSCAStore) IssueCert(id string, serial *big.Int, privateKey *PrivateKey, template *x509.Certificate) (*Certificate, error)
- func (c *VFSCAStore) List() ([]*KeystoreItem, error)
- func (c *VFSCAStore) PrivateKey(id string) (*PrivateKey, error)
- func (s *VFSCAStore) VFSPath() vfs.Path
- type VFSResource
- type VFSSecretStore
- func (c *VFSSecretStore) FindSecret(id string) (*Secret, error)
- func (c *VFSSecretStore) GetOrCreateSecret(id string, secret *Secret) (*Secret, bool, error)
- func (c *VFSSecretStore) ListSecrets() ([]string, error)
- func (c *VFSSecretStore) Secret(id string) (*Secret, error)
- func (s *VFSSecretStore) VFSPath() vfs.Path
- type VFSStateStore
- func (s *VFSStateStore) CA() CAStore
- func (s *VFSStateStore) ListChildren(pathPrefix string) ([]string, error)
- func (s *VFSStateStore) ReadConfig(path string, config interface{}) error
- func (s *VFSStateStore) Secrets() SecretStore
- func (s *VFSStateStore) VFSPath() vfs.Path
- func (s *VFSStateStore) WriteConfig(path string, config interface{}, writeOptions ...WriteOption) error
- type WriteOption
Constants ¶
const (
SecretTypeSSHPublicKey = "SSHPublicKey"
SecretTypeKeypair = "Keypair"
SecretTypeSecret = "Secret"
// Name for the primary SSH key
SecretNameSSHPrimary = "admin"
)
const CertificateId_CA = "ca"
Variables ¶
This section is empty.
Functions ¶
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 BuildTimestampString ¶
func BuildTimestampString() string
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 *hashing.Hash) (*hashing.Hash, error)
func EnsureFileMode ¶
func EnsureFileMode(destPath string, fileMode os.FileMode) (bool, error)
func EnsureFileOwner ¶
func EnsureFileOwner(destPath string, owner string, groupName string) (bool, error)
func FileModeToString ¶
func FileModeToString(mode os.FileMode) string
func FindTaskDependencies ¶
func FindTaskDependencies(tasks map[string]Task) map[string][]string
FindTaskDependencies returns a map from each task's key to the discovered list of dependencies
func Int64Value ¶
func Int64Value(v *int64) int64
func IsNilOrEmpty ¶
func IsNilOrEmpty(s *string) bool
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 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 Uint64Value ¶
func Uint64Value(v *uint64) uint64
func ValueAsString ¶
func ValueAsString(value reflect.Value) string
asString returns a human-readable string representation of the passed value
Types ¶
type AssetStore ¶
type AssetStore struct {
// contains filtered or unexported fields
}
func NewAssetStore ¶
func NewAssetStore(cacheDir string) *AssetStore
type BytesResource ¶
type BytesResource struct {
// contains filtered or unexported fields
}
func NewBytesResource ¶
func NewBytesResource(data []byte) *BytesResource
type CAStore ¶
type CAStore interface {
// Cert returns the primary specified certificate
Cert(name string) (*Certificate, error)
// CertificatePool returns all active certificates with the specified id
CertificatePool(name string) (*CertificatePool, error)
PrivateKey(name string) (*PrivateKey, error)
FindCert(name string) (*Certificate, error)
FindPrivateKey(name string) (*PrivateKey, error)
CreateKeypair(name string, template *x509.Certificate) (*Certificate, *PrivateKey, error)
// List will list all the items, but will not fetch the data
List() ([]*KeystoreItem, error)
// VFSPath returns the path where the CAStore is stored
VFSPath() vfs.Path
// AddCert adds an alternative certificate to the pool (primarily useful for CAs)
AddCert(name string, cert *Certificate) error
// AddSSHPublicKey adds an SSH public key
AddSSHPublicKey(name string, data []byte) error
// FindSSHPublicKeys retrieves the SSH public keys with the specific name
FindSSHPublicKeys(name string) ([]*KeystoreItem, error)
// DeleteSecret will delete the specified item
DeleteSecret(item *KeystoreItem) error
}
func NewVFSCAStore ¶
func NewVFSCAStore(basedir vfs.Path) CAStore
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) MarshalJSON ¶
func (c *Certificate) MarshalJSON() ([]byte, error)
func (*Certificate) UnmarshalJSON ¶
func (c *Certificate) UnmarshalJSON(b []byte) error
type CertificatePool ¶
type CertificatePool struct {
Secondary []*Certificate
Primary *Certificate
}
type Cloud ¶
type Cloud interface {
ProviderID() CloudProviderID
FindDNSHostedZone(dnsName string) (string, error)
DNS() (dnsprovider.Interface, error)
}
type CloudProviderID ¶
type CloudProviderID string
const CloudProviderAWS CloudProviderID = "aws"
const CloudProviderGCE CloudProviderID = "gce"
func GuessCloudForZone ¶
func GuessCloudForZone(zone string) (CloudProviderID, bool)
GuessCloudForZone tries to infer the cloudprovider from the zone name
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
SecretStore SecretStore
ClusterConfigBase vfs.Path
CheckExisting bool
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(target Target, cloud Cloud, castore CAStore, secretStore SecretStore, clusterConfigBase vfs.Path, checkExisting bool, tasks map[string]Task) (*Context, error)
func (*Context) NewTempDir ¶
func (c *Context) NewTempDir(prefix string) (string, error)
type Deletion ¶
type Deletion interface {
Delete(target Target) error
TaskName() string
Item() string
}
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) HasChanges ¶
func (t *DryRunTarget) HasChanges() bool
HasChanges returns true iff any changes would have been made
func (*DryRunTarget) PrintReport ¶
func (t *DryRunTarget) PrintReport(taskMap map[string]Task, out io.Writer) error
type FileResource ¶
type FileResource struct {
Path string
}
func NewFileResource ¶
func NewFileResource(path string) *FileResource
type Group ¶
type Group struct {
Name string
Gid int
}
func LookupGroup ¶
func LookupGroup(name string) (*Group, error)
func LookupGroupById ¶
func LookupGroupById(gid int) (*Group, error)
type HasAddress ¶
type HasAddress interface {
// FindAddress returns the address associated with the implementor. If there is no address, returns (nil, nil)
FindAddress(context *Context) (*string, error)
}
HasAddress is implemented by elastic/floating IP addresses, to expose the address For example, this is used so that the master SSL certificate can be configured with the dynamically allocated IP
type HasCheckExisting ¶
type HasCheckExisting interface {
CheckExisting(c *Context) bool
}
type HasDependencies ¶
type HasDependencies interface {
GetDependencies(tasks map[string]Task) []Task
}
type HasName ¶
type HasName interface {
GetName() *string
SetName(name string)
}
HasName indicates that the task has a Name
type KeystoreItem ¶
type KeystoreItem struct {
Type string
Name string
Id string
Data []byte
}
type PrivateKey ¶
type PrivateKey struct {
Key crypto.PrivateKey
}
func ParsePEMPrivateKey ¶
func ParsePEMPrivateKey(data []byte) (*PrivateKey, error)
func (*PrivateKey) MarshalJSON ¶
func (k *PrivateKey) MarshalJSON() ([]byte, error)
func (*PrivateKey) UnmarshalJSON ¶
func (k *PrivateKey) UnmarshalJSON(b []byte) (err error)
type ProducesDeletions ¶
type ProducesDeletions interface {
FindDeletions(*Context) ([]Deletion, error)
}
type ResourceHolder ¶
type ResourceHolder struct {
Name string
Resource Resource
}
func WrapResource ¶
func WrapResource(r Resource) *ResourceHolder
func (*ResourceHolder) UnmarshalJSON ¶
func (o *ResourceHolder) UnmarshalJSON(data []byte) error
type Secret ¶
type Secret struct {
Data []byte
}
func CreateSecret ¶
func CreateSecret() (*Secret, error)
type SecretStore ¶
type SecretStore interface {
// Get a secret. Returns an error if not found
Secret(id string) (*Secret, error)
// Find a secret, if exists. Returns nil,nil if not found
FindSecret(id string) (*Secret, error)
// Create or replace a secret
GetOrCreateSecret(id string, secret *Secret) (current *Secret, created bool, err error)
// Lists the ids of all known secrets
ListSecrets() ([]string, error)
// VFSPath returns the path where the SecretStore is stored
VFSPath() vfs.Path
}
func NewVFSSecretStore ¶
func NewVFSSecretStore(basedir vfs.Path) SecretStore
type Source ¶
type Source struct {
Parent *Source
URL string
Hash *hashing.Hash
ExtractFromArchive string
}
type StateStore ¶
type StateStore interface {
// VFSPath returns the path where the StateStore is stored
VFSPath() vfs.Path
CA() CAStore
Secrets() SecretStore
ReadConfig(path string, config interface{}) error
WriteConfig(path string, config interface{}, options ...WriteOption) error
// ListChildren returns a list of all (direct) children of the specified path
// It only returns the raw names, not the prefixes
ListChildren(pathPrefix string) ([]string, error)
}
type StringResource ¶
type StringResource struct {
// contains filtered or unexported fields
}
func NewStringResource ¶
func NewStringResource(s string) *StringResource
type Target ¶
type Target interface {
// Lifecycle methods, called by the driver
Finish(taskMap map[string]Task) error
}
type TemplateResource ¶
type TemplateResource interface {
Resource
Curry(args []string) TemplateResource
}
type User ¶
type User struct {
Name string
Uid int
Gid int
Comment string
Home string
Shell string
}
func LookupUser ¶
func LookupUser(name string) (*User, error)
func LookupUserById ¶
func LookupUserById(uid int) (*User, error)
type VFSCAStore ¶
type VFSCAStore struct {
DryRun bool
// contains filtered or unexported fields
}
func (*VFSCAStore) AddSSHPublicKey ¶
func (c *VFSCAStore) AddSSHPublicKey(name string, pubkey []byte) error
AddSSHPublicKey stores an SSH public key
func (*VFSCAStore) CertificatePool ¶
func (c *VFSCAStore) CertificatePool(id string) (*CertificatePool, error)
func (*VFSCAStore) CreateKeypair ¶
func (c *VFSCAStore) CreateKeypair(id string, template *x509.Certificate) (*Certificate, *PrivateKey, error)
func (*VFSCAStore) CreatePrivateKey ¶
func (c *VFSCAStore) CreatePrivateKey(id string, serial *big.Int) (*PrivateKey, error)
func (*VFSCAStore) DeleteSecret ¶
func (c *VFSCAStore) DeleteSecret(item *KeystoreItem) error
func (*VFSCAStore) FindCertificatePool ¶
func (c *VFSCAStore) FindCertificatePool(id string) (*CertificatePool, error)
func (*VFSCAStore) FindPrivateKey ¶
func (c *VFSCAStore) FindPrivateKey(id string) (*PrivateKey, error)
func (*VFSCAStore) FindSSHPublicKeys ¶
func (c *VFSCAStore) FindSSHPublicKeys(name string) ([]*KeystoreItem, error)
func (*VFSCAStore) IssueCert ¶
func (c *VFSCAStore) IssueCert(id string, serial *big.Int, privateKey *PrivateKey, template *x509.Certificate) (*Certificate, error)
func (*VFSCAStore) PrivateKey ¶
func (c *VFSCAStore) PrivateKey(id string) (*PrivateKey, error)
type VFSResource ¶
type VFSResource struct {
Path vfs.Path
}
func NewVFSResource ¶
func NewVFSResource(path vfs.Path) *VFSResource
type VFSSecretStore ¶
type VFSSecretStore struct {
// contains filtered or unexported fields
}
func (*VFSSecretStore) FindSecret ¶
func (c *VFSSecretStore) FindSecret(id string) (*Secret, error)
func (*VFSSecretStore) GetOrCreateSecret ¶
func (c *VFSSecretStore) GetOrCreateSecret(id string, secret *Secret) (*Secret, bool, error)
func (*VFSSecretStore) ListSecrets ¶
func (c *VFSSecretStore) ListSecrets() ([]string, error)
type VFSStateStore ¶
type VFSStateStore struct {
// contains filtered or unexported fields
}
func NewVFSStateStore ¶
func NewVFSStateStore(base vfs.Path, clusterName string) *VFSStateStore
func (*VFSStateStore) ListChildren ¶
func (s *VFSStateStore) ListChildren(pathPrefix string) ([]string, error)
func (*VFSStateStore) ReadConfig ¶
func (s *VFSStateStore) ReadConfig(path string, config interface{}) error
func (*VFSStateStore) WriteConfig ¶
func (s *VFSStateStore) WriteConfig(path string, config interface{}, writeOptions ...WriteOption) error
type WriteOption ¶
type WriteOption string
const (
WriteOptionCreate WriteOption = "Create"
WriteOptionOnlyIfExists WriteOption = "IfExists"
)
Source Files
¶
- assetstore.go
- ca.go
- changes.go
- cloud.go
- compare_with_id.go
- context.go
- default_methods.go
- deletions.go
- dryrun_target.go
- errors.go
- executor.go
- files.go
- has_address.go
- http.go
- named.go
- options.go
- resources.go
- secrets.go
- statestore.go
- target.go
- task.go
- timestamp.go
- topological_sort.go
- users.go
- values.go
- vfs_castore.go
- vfs_secretstore.go