Documentation
¶
Index ¶
- func GenerateSlug(title string) string
- type AddToCollectionCommand
- type AddToCollectionSettings
- type CollectionMember
- type CreateCollectionCommand
- type CreateCollectionSettings
- type DeployCommand
- type DeploySettings
- type Deployment
- type Entity
- type EntityMetadata
- type EntityType
- type GetMetadataCommand
- type GetMetadataSettings
- type ListCommand
- type ListSettings
- type RefreshCommand
- type RefreshSettings
- type RegisterCommand
- type RegisterSettings
- type RemoveCommand
- type RemoveSettings
- type SearchCommand
- type SearchSettings
- type SetMetadataCommand
- type SetMetadataSettings
- type ShowCommand
- type ShowSettings
- type Storage
- func (s *Storage) AddToCollection(collectionID, memberID int64, relativePath *string) error
- func (s *Storage) Close() error
- func (s *Storage) CreateEntity(entity *Entity) error
- func (s *Storage) DeleteEntity(id int64) error
- func (s *Storage) DeleteMetadata(entityID int64, key string) error
- func (s *Storage) GetCollectionMembers(collectionID int64) ([]*CollectionMember, error)
- func (s *Storage) GetDeployments(entityID int64) ([]*Deployment, error)
- func (s *Storage) GetEntityByID(id int64) (*Entity, error)
- func (s *Storage) GetEntityBySlug(slug string) (*Entity, error)
- func (s *Storage) GetMetadata(entityID int64) (map[string]string, error)
- func (s *Storage) ListEntities(entityType *EntityType, tags []string) ([]*Entity, error)
- func (s *Storage) RecordDeployment(entityID int64, targetDirectory string) error
- func (s *Storage) RemoveFromCollection(collectionID, memberID int64) error
- func (s *Storage) SearchEntities(query string, entityType *EntityType) ([]*Entity, error)
- func (s *Storage) SetMetadata(entityID int64, key, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSlug ¶
GenerateSlug creates a URL-friendly slug from the title
Types ¶
type AddToCollectionCommand ¶
type AddToCollectionCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
AddToCollectionCommand adds entities to collections
func NewAddToCollectionCommand ¶
func NewAddToCollectionCommand(storage *Storage) (*AddToCollectionCommand, error)
func (*AddToCollectionCommand) RunIntoWriter ¶
func (c *AddToCollectionCommand) RunIntoWriter(ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer) error
type AddToCollectionSettings ¶
type CollectionMember ¶
type CollectionMember struct {
CollectionID int64 `json:"collection_id" db:"collection_id"`
MemberID int64 `json:"member_id" db:"member_id"`
RelativePath *string `json:"relative_path,omitempty" db:"relative_path"`
}
CollectionMember represents membership in a collection
type CreateCollectionCommand ¶
type CreateCollectionCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
CreateCollectionCommand creates a new collection
func NewCreateCollectionCommand ¶
func NewCreateCollectionCommand(storage *Storage) (*CreateCollectionCommand, error)
func (*CreateCollectionCommand) RunIntoWriter ¶
func (c *CreateCollectionCommand) RunIntoWriter(ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer) error
type CreateCollectionSettings ¶
type CreateCollectionSettings struct {
Name string `glazed.parameter:"name"`
Title string `glazed.parameter:"title"`
Description string `glazed.parameter:"description"`
Summary string `glazed.parameter:"summary"`
Metadata []string `glazed.parameter:"metadata"`
Tags []string `glazed.parameter:"tags"`
}
type DeployCommand ¶
type DeployCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
DeployCommand deploys entities to directories
func NewDeployCommand ¶
func NewDeployCommand(storage *Storage) (*DeployCommand, error)
func (*DeployCommand) RunIntoWriter ¶
func (c *DeployCommand) RunIntoWriter(ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer) error
type DeploySettings ¶
type Deployment ¶
type Deployment struct {
ID int64 `json:"id" db:"id"`
EntityID int64 `json:"entity_id" db:"entity_id"`
TargetDirectory string `json:"target_directory" db:"target_directory"`
DeployedAt time.Time `json:"deployed_at" db:"deployed_at"`
}
Deployment represents a deployment of an entity to a directory
type Entity ¶
type Entity struct {
ID int64 `json:"id" db:"id"`
Slug string `json:"slug" db:"slug"`
Type EntityType `json:"type" db:"type"`
Title string `json:"title" db:"title"`
Description string `json:"description" db:"description"`
Summary string `json:"summary" db:"summary"`
CanonicalURL *string `json:"canonical_url,omitempty" db:"canonical_url"`
Content *string `json:"content,omitempty" db:"content"`
Command *string `json:"command,omitempty" db:"command"`
ContentHash *string `json:"content_hash,omitempty" db:"content_hash"`
Filename *string `json:"filename,omitempty" db:"filename"`
Tags []string `json:"tags" db:"tags"`
LastFetched *time.Time `json:"last_fetched,omitempty" db:"last_fetched"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
Metadata map[string]string `json:"metadata,omitempty"`
}
Entity represents both playbooks and collections
func (*Entity) GetContentOrCommand ¶
GetContentOrCommand returns the content for file-based playbooks or command for shell playbooks
func (*Entity) MarshalTags ¶
MarshalTags converts tags slice to JSON string for database storage
func (*Entity) UnmarshalTags ¶
UnmarshalTags converts JSON string from database to tags slice
type EntityMetadata ¶
type EntityMetadata struct {
EntityID int64 `json:"entity_id" db:"entity_id"`
Key string `json:"key" db:"key"`
Value string `json:"value" db:"value"`
}
EntityMetadata represents key-value metadata for entities
type EntityType ¶
type EntityType string
const ( TypePlaybook EntityType = "playbook" TypeCollection EntityType = "collection" )
type GetMetadataCommand ¶
type GetMetadataCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
GetMetadataCommand gets metadata for an entity
func NewGetMetadataCommand ¶
func NewGetMetadataCommand(storage *Storage) (*GetMetadataCommand, error)
func (*GetMetadataCommand) RunIntoGlazeProcessor ¶
func (c *GetMetadataCommand) RunIntoGlazeProcessor(ctx context.Context, parsedLayers *layers.ParsedLayers, gp middlewares.Processor) error
type GetMetadataSettings ¶
type ListCommand ¶
type ListCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
ListCommand lists entities with optional filters
func NewListCommand ¶
func NewListCommand(storage *Storage) (*ListCommand, error)
func (*ListCommand) RunIntoGlazeProcessor ¶
func (c *ListCommand) RunIntoGlazeProcessor(ctx context.Context, parsedLayers *layers.ParsedLayers, gp middlewares.Processor) error
type ListSettings ¶
type RefreshCommand ¶
type RefreshCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
RefreshCommand refreshes deployments by re-executing commands
func NewRefreshCommand ¶
func NewRefreshCommand(storage *Storage) (*RefreshCommand, error)
func (*RefreshCommand) RunIntoWriter ¶
func (c *RefreshCommand) RunIntoWriter(ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer) error
type RefreshSettings ¶
type RegisterCommand ¶
type RegisterCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
RegisterCommand registers a playbook from file or URL
func NewRegisterCommand ¶
func NewRegisterCommand(storage *Storage) (*RegisterCommand, error)
func (*RegisterCommand) RunIntoWriter ¶
func (c *RegisterCommand) RunIntoWriter(ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer) error
type RegisterSettings ¶
type RegisterSettings struct {
Title string `glazed.parameter:"title"`
Description string `glazed.parameter:"description"`
Summary string `glazed.parameter:"summary"`
Metadata []string `glazed.parameter:"metadata"`
Tags []string `glazed.parameter:"tags"`
Filename string `glazed.parameter:"filename"`
Source string `glazed.parameter:"source"`
IsCommand bool `glazed.parameter:"command"`
}
type RemoveCommand ¶
type RemoveCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
RemoveCommand removes entities from collections or deletes entities
func NewRemoveCommand ¶
func NewRemoveCommand(storage *Storage) (*RemoveCommand, error)
func (*RemoveCommand) RunIntoWriter ¶
func (c *RemoveCommand) RunIntoWriter(ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer) error
type RemoveSettings ¶
type SearchCommand ¶
type SearchCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
SearchCommand searches entities
func NewSearchCommand ¶
func NewSearchCommand(storage *Storage) (*SearchCommand, error)
func (*SearchCommand) RunIntoGlazeProcessor ¶
func (c *SearchCommand) RunIntoGlazeProcessor(ctx context.Context, parsedLayers *layers.ParsedLayers, gp middlewares.Processor) error
type SearchSettings ¶
type SetMetadataCommand ¶
type SetMetadataCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
SetMetadataCommand sets metadata for an entity
func NewSetMetadataCommand ¶
func NewSetMetadataCommand(storage *Storage) (*SetMetadataCommand, error)
func (*SetMetadataCommand) RunIntoWriter ¶
func (c *SetMetadataCommand) RunIntoWriter(ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer) error
type SetMetadataSettings ¶
type ShowCommand ¶
type ShowCommand struct {
*cmds.CommandDescription
// contains filtered or unexported fields
}
ShowCommand shows detailed information about an entity
func NewShowCommand ¶
func NewShowCommand(storage *Storage) (*ShowCommand, error)
func (*ShowCommand) RunIntoWriter ¶
func (c *ShowCommand) RunIntoWriter(ctx context.Context, parsedLayers *layers.ParsedLayers, w io.Writer) error
type ShowSettings ¶
type ShowSettings struct {
Slug string `glazed.parameter:"slug"`
}
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage handles database operations for playbooks
func NewStorage ¶
NewStorage creates a new storage instance and initializes the database
func (*Storage) AddToCollection ¶
AddToCollection adds an entity to a collection
func (*Storage) CreateEntity ¶
CreateEntity creates a new entity (playbook or collection)
func (*Storage) DeleteEntity ¶
DeleteEntity deletes an entity and all related data
func (*Storage) DeleteMetadata ¶
DeleteMetadata removes metadata for an entity
func (*Storage) GetCollectionMembers ¶
func (s *Storage) GetCollectionMembers(collectionID int64) ([]*CollectionMember, error)
GetCollectionMembers gets all members of a collection
func (*Storage) GetDeployments ¶
func (s *Storage) GetDeployments(entityID int64) ([]*Deployment, error)
GetDeployments gets deployments for an entity
func (*Storage) GetEntityByID ¶
GetEntityByID retrieves an entity by its ID
func (*Storage) GetEntityBySlug ¶
GetEntityBySlug retrieves an entity by its slug
func (*Storage) GetMetadata ¶
GetMetadata gets all metadata for an entity
func (*Storage) ListEntities ¶
func (s *Storage) ListEntities(entityType *EntityType, tags []string) ([]*Entity, error)
ListEntities lists entities with optional filters
func (*Storage) RecordDeployment ¶
RecordDeployment records a deployment
func (*Storage) RemoveFromCollection ¶
RemoveFromCollection removes an entity from a collection
func (*Storage) SearchEntities ¶
func (s *Storage) SearchEntities(query string, entityType *EntityType) ([]*Entity, error)
SearchEntities searches entities by query string