schema

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentSchema

type ComponentSchema struct {
	Resources string
	Variables string
	DependsOn []string
	Providers []string
}

type MachComposerPlugin

type MachComposerPlugin interface {

	// Identifier returns the identifier of the plugin
	Identifier() string

	// Configure is called when the plugin is loaded
	Configure(environment string, provider string) error

	// GetValidationSchema returns the validation schema for the plugin
	GetValidationSchema() (*ValidationSchema, error)

	// SetGlobalConfig is called when the global config is set
	SetGlobalConfig(data map[string]any) error

	// SetSiteConfig is called when the site config is set
	SetSiteConfig(site string, data map[string]any) error

	// SetSiteComponentConfig is called when the site component config is set
	SetSiteComponentConfig(site string, component string, data map[string]any) error

	// SetSiteEndpointConfig is called when the site endpoint config is set
	//
	// Deprecated: move endpoints to the terraform module instead
	SetSiteEndpointConfig(site string, name string, data map[string]any) error

	// SetComponentConfig is called when the component config is set
	SetComponentConfig(component, version string, data map[string]any) error

	// SetComponentEndpointsConfig is called when the component endpoints config is set
	//
	// Deprecated: move endpoints to the terraform module instead
	SetComponentEndpointsConfig(component string, data map[string]string) error

	// RenderTerraformProviders returns the terraform providers for the site
	RenderTerraformProviders(site string) (string, error)

	// RenderTerraformResources returns the terraform resources for the site
	RenderTerraformResources(site string) (string, error)

	// RenderTerraformComponent returns the terraform component for the site
	RenderTerraformComponent(site string, component string) (*ComponentSchema, error)
}

MachComposerPlugin is the interface that plugins must implement. Note that in combination with PluginSchema you can omit functions that you don't need

type PluginSchema

type PluginSchema struct {
	Identifier string

	Configure           func(environment, provider string) error
	GetValidationSchema func() (*ValidationSchema, error)

	SetGlobalConfig        func(data map[string]any) error
	SetSiteConfig          func(site string, data map[string]any) error
	SetSiteComponentConfig func(site string, component string, data map[string]any) error
	SetSiteEndpointConfig  func(site string, endpoint string, data map[string]any) error

	SetComponentConfig          func(component, version string, data map[string]any) error
	SetComponentEndpointsConfig func(component string, endpoints map[string]string) error

	RenderTerraformProviders func(site string) (string, error)
	RenderTerraformResources func(site string) (string, error)
	RenderTerraformComponent func(site string, component string) (*ComponentSchema, error)
}

PluginSchema is the schema implementation for a plugin. Together with protocol.Adapter this allows for the selective implementation of methods

type ValidationSchema

type ValidationSchema struct {
	GlobalConfigSchema             map[string]any
	RemoteStateSchema              map[string]any
	SiteConfigSchema               map[string]any
	SiteComponentConfigSchema      map[string]any
	SiteEndpointConfig             map[string]any
	ComponentConfigSchema          map[string]any
	ComponentEndpointsConfigSchema map[string]any
}

func (*ValidationSchema) Validate

func (v *ValidationSchema) Validate(schema map[string]any, data map[string]any) error

Jump to

Keyboard shortcuts

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