Documentation ¶
Index ¶
- Constants
- func Bool(v bool) *bool
- func BoolValue(v *bool) bool
- func BuildChanges(a, e, changes interface{}) bool
- 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 string) (string, error)
- func EnsureFileMode(destPath string, fileMode os.FileMode) (bool, error)
- func FileModeToString(mode os.FileMode) string
- func HashFile(f string, hashAlgorithm HashAlgorithm) (string, error)
- func HashForResource(r Resource, hashAlgorithm HashAlgorithm) (string, error)
- func HashesForResource(r Resource, hashAlgorithms []HashAlgorithm) (map[HashAlgorithm]string, error)
- func IdForTask(taskMap map[string]Task, t Task) string
- func Int(v int) *int
- func Int64(v int64) *int64
- func NewHasher(hashAlgorithm HashAlgorithm) hash.Hash
- 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 TopologicalSort(tasks map[string]Task) [][]string
- func WriteFile(destPath string, contents Resource, fileMode os.FileMode, dirMode os.FileMode) error
- func WritePrivateKey(privateKey crypto.PrivateKey, w io.Writer) error
- type AssetStore
- type BytesResource
- type CAStore
- type Certificate
- type Cloud
- type CloudProviderID
- type CompareWithID
- type Context
- type DryRunTarget
- type FileResource
- type FilesystemCAStore
- func (c *FilesystemCAStore) Cert(id string) (*Certificate, error)
- func (c *FilesystemCAStore) CreatePrivateKey(id string) (*PrivateKey, error)
- func (c *FilesystemCAStore) FindCert(id string) (*Certificate, error)
- func (c *FilesystemCAStore) FindPrivateKey(id string) (*PrivateKey, error)
- func (c *FilesystemCAStore) IssueCert(id string, privateKey *PrivateKey, template *x509.Certificate) (*Certificate, error)
- func (c *FilesystemCAStore) PrivateKey(id string) (*PrivateKey, error)
- type FilesystemSecretStore
- type HasDependencies
- type HasSource
- type HashAlgorithm
- type PrivateKey
- type Resource
- type Secret
- type SecretStore
- type Source
- type StringResource
- type Target
- type Task
- type TemplateResource
Constants ¶
const ( HashAlgorithmSHA256 = "sha256" HashAlgorithmSHA1 = "sha1" HashAlgorithmMD5 = "md5" )
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 CannotChangeField ¶
func DebugAsJsonString ¶
func DebugAsJsonString(v interface{}) string
func DebugAsJsonStringIndent ¶
func DebugAsJsonStringIndent(v interface{}) string
func DebugPrint ¶
func DebugPrint(o interface{}) string
func DefaultDeltaRunMethod ¶
DefaultDeltaRunMethod implements the standard change-based run procedure: find the existing item; compare properties; call render with (actual, expected, changes)
func FileModeToString ¶
func HashForResource ¶
func HashForResource(r Resource, hashAlgorithm HashAlgorithm) (string, error)
func HashesForResource ¶
func HashesForResource(r Resource, hashAlgorithms []HashAlgorithm) (map[HashAlgorithm]string, error)
func NewHasher ¶
func NewHasher(hashAlgorithm HashAlgorithm) hash.Hash
func RequiredField ¶
func ResourceAsBytes ¶
func ResourceAsString ¶
func ResourcesMatch ¶
func StringValue ¶
func TaskAsString ¶
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 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
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 ¶
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 ¶
func NewContext ¶
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 (*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)
type HasDependencies ¶
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 SecretStore ¶
type SecretStore interface { Secret(id string) (*Secret, error) FindSecret(id string) (*Secret, error) }
func NewFilesystemSecretStore ¶
func NewFilesystemSecretStore(basedir string) (SecretStore, error)
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)
type TemplateResource ¶
type TemplateResource interface { Resource Curry(args []string) TemplateResource }