Documentation ¶
Index ¶
- Variables
- func Apply(resources Resources) error
- func ConfigureProviderRegistry(providers []Provider)
- func Diff(resources Resources) error
- func Export(exportDir string, resources Resources) error
- func FindResourceFiles(resourcePath string) ([]string, error)
- func Get(UID string) error
- func List(resources Resources) error
- func ListRemote(opts Opts) error
- func Listen(UID, filename string) error
- func MarshalYAML(resource Resource, filename string) error
- func Preview(resources Resources, opts *PreviewOpts) error
- func Pull(resourcePath string, opts Opts) error
- func Show(resources Resources) error
- func Watch(watchDir string, parser WatchParser) error
- type APIErr
- type ExtendedImporter
- type Handler
- type ListenHandler
- type LoggingOpts
- type Opts
- type PreviewHandler
- type PreviewOpts
- type Provider
- type Resource
- func (r *Resource) APIVersion() string
- func (r *Resource) DeleteSpecKey(key string)
- func (r *Resource) GetMetadata(key string) string
- func (r *Resource) GetSpecString(key string) (string, bool)
- func (r *Resource) GetSpecValue(key string) interface{}
- func (r *Resource) HasMetadata(key string) bool
- func (r *Resource) Key() string
- func (r *Resource) Kind() string
- func (r *Resource) MatchesTarget(targets []string) bool
- func (r *Resource) Name() string
- func (r *Resource) SetMetadata(key, value string)
- func (r *Resource) SetSpecString(key, value string)
- func (r *Resource) SetSpecValue(key string, value interface{})
- func (r *Resource) Spec() map[string]interface{}
- func (r *Resource) SpecAsJSON() (string, error)
- func (r Resource) String() string
- func (r Resource) UID() string
- func (r *Resource) YAML() (string, error)
- type Resources
- type WatchParser
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is used to signal a missing resource ErrNotFound = errors.New("not found") // ErrNotImplemented signals a feature that is not supported by a provider ErrNotImplemented = errors.New("not implemented") // ErrHandlerNotFound indicates that no handler was found for a particular resource Kind. ErrHandlerNotFound = errors.New("handler not found") )
var Registry registry
Global Handler registry
Functions ¶
func ConfigureProviderRegistry ¶
func ConfigureProviderRegistry(providers []Provider)
NewProviderRegistry returns a new registry instance
func FindResourceFiles ¶
func MarshalYAML ¶
MarshalYAML takes a resource and renders it to a source file as a YAML string
func Preview ¶
func Preview(resources Resources, opts *PreviewOpts) error
Preview pushes resources to endpoints as previews, if supported
func Watch ¶
func Watch(watchDir string, parser WatchParser) error
Watch watches a directory for changes then pushes Jsonnet resource to endpoints when changes are noticed.
Types ¶
type ExtendedImporter ¶
type ExtendedImporter struct {
// contains filtered or unexported fields
}
ExtendedImporter does stuff
type Handler ¶
type Handler interface { APIVersion() string Kind() string GetExtension() string // FindResourceFiles identifies files within a directory that this handler can process FindResourceFiles(dir string) ([]string, error) // ResourceFilePath returns the location on disk where a resource should be updated ResourceFilePath(resource Resource, filetype string) string // Parse parses a manifest object into a struct for this resource type Parse(m manifest.Manifest) (Resources, error) // Unprepare removes unnecessary elements from a remote resource ready for presentation/comparison Unprepare(resource Resource) *Resource // Prepare gets a resource ready for dispatch to the remote endpoint Prepare(existing, resource Resource) *Resource // Retrieves a UID for a resource GetUID(resource Resource) (string, error) // Get retrieves JSON for a resource from an endpoint, by UID GetByUID(UID string) (*Resource, error) // GetRemote retrieves a remote equivalent of a remote resource GetRemote(resource Resource) (*Resource, error) // ListRemote retrieves as list of UIDs of all remote resources ListRemote() ([]string, error) // Add pushes a new resource to the endpoint Add(resource Resource) error // Update pushes an existing resource to the endpoint Update(existing, resource Resource) error // Validate gets or build the uid of corresponding resource Validate(resource Resource) error }
Handler describes a handler for a single API resource handled by a single provider
type ListenHandler ¶
type ListenHandler interface { // Listen watches a resource and update local file on changes Listen(UID, filename string) error }
ListenHandler describes a handler that has the ability to watch a single resource for changes, and write changes to that resource to a local file
type LoggingOpts ¶
type LoggingOpts struct {
LogLevel string
}
LoggingOpts contains logging options (used in all commands)
type Opts ¶
type Opts struct { LoggingOpts Directory bool JsonnetPaths []string Targets []string }
Opts contains options for most Grizzly commands
type PreviewHandler ¶
type PreviewHandler interface { // Preview renders Jsonnet then pushes them to the endpoint if previews are possible Preview(resource Resource, opts *PreviewOpts) error }
PreviewHandler describes a handler that has the ability to render a preview of a resource
type PreviewOpts ¶
type PreviewOpts struct {
ExpiresSeconds int
}
PreviewOpts contains options to configure a preview
type Provider ¶
type Provider interface { Group() string Version() string APIVersion() string GetHandlers() []Handler }
Provider describes a single Endpoint Provider
type Resource ¶
type Resource map[string]interface{}
Resource represents a single Resource destined for a single endpoint
func NewResource ¶
NewResource returns a new Resource object
func (*Resource) APIVersion ¶
APIVersion returns the group and version of the provider of the resource
func (*Resource) DeleteSpecKey ¶
func (*Resource) GetMetadata ¶
func (*Resource) GetSpecValue ¶
func (*Resource) HasMetadata ¶
func (*Resource) MatchesTarget ¶
MatchesTarget identifies whether a resource is in a target list
func (*Resource) SetMetadata ¶
func (*Resource) SetSpecString ¶
func (*Resource) SetSpecValue ¶
func (*Resource) SpecAsJSON ¶
type Resources ¶
type Resources []Resource
Resources represents a set of resources
func ParseJsonnet ¶
ParseJsonnet evaluates a jsonnet file and parses it into an object tree
type WatchParser ¶
WatchParser encapsulates the action of parsing a resource (jsonnet or otherwise)