blueprint

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBlueprint = BlueprintV1Alpha1{
	Kind:       "Blueprint",
	ApiVersion: "blueprints.windsorcli.dev/v1alpha1",
	Metadata: MetadataV1Alpha1{
		Name:        "default",
		Description: "A default blueprint",
		Authors:     []string{},
	},
	Sources:             []SourceV1Alpha1{},
	TerraformComponents: []TerraformComponentV1Alpha1{},
}

Functions

This section is empty.

Types

type BaseBlueprintHandler

type BaseBlueprintHandler struct {
	BlueprintHandler
	// contains filtered or unexported fields
}

BaseBlueprintHandler is a base implementation of the BlueprintHandler interface

func NewBlueprintHandler

func NewBlueprintHandler(injector di.Injector) *BaseBlueprintHandler

Create a new blueprint handler

func (*BaseBlueprintHandler) GetMetadata

func (b *BaseBlueprintHandler) GetMetadata() MetadataV1Alpha1

GetMetadata retrieves the metadata for the blueprint

func (*BaseBlueprintHandler) GetSources

func (b *BaseBlueprintHandler) GetSources() []SourceV1Alpha1

GetSources retrieves the sources for the blueprint

func (*BaseBlueprintHandler) GetTerraformComponents

func (b *BaseBlueprintHandler) GetTerraformComponents() []TerraformComponentV1Alpha1

GetTerraformComponents retrieves the Terraform components for the blueprint

func (*BaseBlueprintHandler) Initialize

func (b *BaseBlueprintHandler) Initialize() error

Initialize sets up the blueprint handler by resolving dependencies

func (*BaseBlueprintHandler) LoadConfig

func (b *BaseBlueprintHandler) LoadConfig(path ...string) error

LoadConfig loads a blueprint from a path, using Jsonnet or YAML data.

func (*BaseBlueprintHandler) SetMetadata

func (b *BaseBlueprintHandler) SetMetadata(metadata MetadataV1Alpha1) error

SetMetadata sets the metadata for the blueprint

func (*BaseBlueprintHandler) SetSources

func (b *BaseBlueprintHandler) SetSources(sources []SourceV1Alpha1) error

SetSources sets the sources for the blueprint

func (*BaseBlueprintHandler) SetTerraformComponents

func (b *BaseBlueprintHandler) SetTerraformComponents(terraformComponents []TerraformComponentV1Alpha1) error

SetTerraformComponents sets the Terraform components for the blueprint

func (*BaseBlueprintHandler) WriteConfig

func (b *BaseBlueprintHandler) WriteConfig(path ...string) error

WriteConfig saves the current blueprint to a specified file path

type BlueprintHandler

type BlueprintHandler interface {
	Initialize() error
	LoadConfig(path ...string) error
	GetMetadata() MetadataV1Alpha1
	GetSources() []SourceV1Alpha1
	GetTerraformComponents() []TerraformComponentV1Alpha1
	SetMetadata(metadata MetadataV1Alpha1) error
	SetSources(sources []SourceV1Alpha1) error
	SetTerraformComponents(terraformComponents []TerraformComponentV1Alpha1) error
	WriteConfig(path ...string) error
}

BlueprintHandler defines the interface for handling blueprint operations

type BlueprintV1Alpha1

type BlueprintV1Alpha1 struct {
	Kind                string                       `yaml:"kind"`       // The Kind of the blueprint
	ApiVersion          string                       `yaml:"apiVersion"` // The API Version of the blueprint
	Metadata            MetadataV1Alpha1             `yaml:"metadata"`   // The Metadata for the blueprint
	Sources             []SourceV1Alpha1             `yaml:"sources"`    // The Sources for the blueprint
	TerraformComponents []TerraformComponentV1Alpha1 `yaml:"terraform"`  // The Terraform components
}

A Blueprint is a collection of metadata that can be used to initialize a project

func (*BlueprintV1Alpha1) Copy

Copy creates a deep copy of the BlueprintV1Alpha1.

func (*BlueprintV1Alpha1) Merge

func (b *BlueprintV1Alpha1) Merge(overlay *BlueprintV1Alpha1)

Merge merges another BlueprintV1Alpha1 into the current one.

type MetadataV1Alpha1

type MetadataV1Alpha1 struct {
	Name        string   `yaml:"name"`                  // The Name of the blueprint
	Description string   `yaml:"description,omitempty"` // The Description of the blueprint
	Authors     []string `yaml:"authors,omitempty"`     // The Authors of the blueprint
}

Metadata describes the metadata for a blueprint

type MockBlueprintHandler

type MockBlueprintHandler struct {
	InitializeFunc             func() error
	LoadConfigFunc             func(path ...string) error
	GetMetadataFunc            func() MetadataV1Alpha1
	GetSourcesFunc             func() []SourceV1Alpha1
	GetTerraformComponentsFunc func() []TerraformComponentV1Alpha1
	SetMetadataFunc            func(metadata MetadataV1Alpha1) error
	SetSourcesFunc             func(sources []SourceV1Alpha1) error
	SetTerraformComponentsFunc func(terraformComponents []TerraformComponentV1Alpha1) error
	WriteConfigFunc            func(path ...string) error
}

MockBlueprintHandler is a mock implementation of the BlueprintHandler interface for testing purposes

func NewMockBlueprintHandler

func NewMockBlueprintHandler(injector di.Injector) *MockBlueprintHandler

NewMockBlueprintHandler creates a new instance of MockBlueprintHandler

func (*MockBlueprintHandler) GetMetadata

func (m *MockBlueprintHandler) GetMetadata() MetadataV1Alpha1

GetMetadata calls the mock GetMetadataFunc if set, otherwise returns a reasonable default MetadataV1Alpha1

func (*MockBlueprintHandler) GetSources

func (m *MockBlueprintHandler) GetSources() []SourceV1Alpha1

GetSources calls the mock GetSourcesFunc if set, otherwise returns a reasonable default slice of SourceV1Alpha1

func (*MockBlueprintHandler) GetTerraformComponents

func (m *MockBlueprintHandler) GetTerraformComponents() []TerraformComponentV1Alpha1

GetTerraformComponents calls the mock GetTerraformComponentsFunc if set, otherwise returns a reasonable default slice of TerraformComponentV1Alpha1

func (*MockBlueprintHandler) Initialize

func (m *MockBlueprintHandler) Initialize() error

Initialize initializes the blueprint handler

func (*MockBlueprintHandler) LoadConfig

func (m *MockBlueprintHandler) LoadConfig(path ...string) error

LoadConfig calls the mock LoadConfigFunc if set, otherwise returns nil

func (*MockBlueprintHandler) SetMetadata

func (m *MockBlueprintHandler) SetMetadata(metadata MetadataV1Alpha1) error

SetMetadata calls the mock SetMetadataFunc if set, otherwise returns nil

func (*MockBlueprintHandler) SetSources

func (m *MockBlueprintHandler) SetSources(sources []SourceV1Alpha1) error

SetSources calls the mock SetSourcesFunc if set, otherwise returns nil

func (*MockBlueprintHandler) SetTerraformComponents

func (m *MockBlueprintHandler) SetTerraformComponents(terraformComponents []TerraformComponentV1Alpha1) error

SetTerraformComponents calls the mock SetTerraformComponentsFunc if set, otherwise returns nil

func (*MockBlueprintHandler) WriteConfig

func (m *MockBlueprintHandler) WriteConfig(path ...string) error

WriteConfig calls the mock WriteConfigFunc if set, otherwise returns nil

type SourceV1Alpha1

type SourceV1Alpha1 struct {
	Name       string `yaml:"name"`                 // The Name of the source
	Url        string `yaml:"url"`                  // The URL of the source
	PathPrefix string `yaml:"pathPrefix,omitempty"` // The Path Prefix of the source
	Ref        string `yaml:"ref"`                  // The Ref of the source
}

Source describes a source for a blueprint

type TerraformComponentV1Alpha1

type TerraformComponentV1Alpha1 struct {
	Source    string                               `yaml:"source,omitempty"`    // The Source of the module
	Path      string                               `yaml:"path"`                // The Path of the module
	FullPath  string                               `yaml:"-"`                   // The Full Path of the module
	Values    map[string]interface{}               `yaml:"values,omitempty"`    // The Values for the module
	Variables map[string]TerraformVariableV1Alpha1 `yaml:"variables,omitempty"` // The Variables for the module
}

TerraformComponent describes a Terraform component for a blueprint

type TerraformVariableV1Alpha1

type TerraformVariableV1Alpha1 struct {
	Type        string      `yaml:"type,omitempty"`        // The Type of the variable
	Default     interface{} `yaml:"default,omitempty"`     // The Default value of the variable
	Description string      `yaml:"description,omitempty"` // The Description of the variable
}

TerraformVariable describes a Terraform variable for a Terraform component

Jump to

Keyboard shortcuts

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