example

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Example

type Example struct {
	Options *ImportOptions
	// RawRecords holds all raw CSV records from the import phase
	RawRecords []import_.CsvRecord
	// SystemData holds parsed system CSV data (multi-section format)
	SystemData *import_.SystemCSV
}

Example implements the provider.Provider interface

func GetInstance

func GetInstance() *Example

GetInstance returns the singleton Example provider instance. Used by sub-packages to store/access raw records between ETL phases.

func New

func New() *Example

New creates a new Example provider instance

func (*Example) BindExportFlags

func (p *Example) BindExportFlags(cmd *cobra.Command) error

BindExportFlags binds CLI flags to Viper for the export command. This enables precedence: CLI flags > env vars > config file > defaults.

func (*Example) BindImportFlags

func (p *Example) BindImportFlags(cmd *cobra.Command) error

BindImportFlags binds CLI flags to Viper for the import command. This enables precedence: CLI flags > env vars > config file > defaults.

func (*Example) ClearRecords

func (p *Example) ClearRecords()

ClearRecords resets the raw record storage for a fresh import

func (*Example) ClearSystemRecords

func (p *Example) ClearSystemRecords()

ClearSystemRecords resets system CSV data

func (*Example) Export

func (p *Example) Export(cmd *cobra.Command, args []string, inventory *devicetypes.Inventory) error

Export syncs the local CANI inventory to an external system. This is the "Load" step in ETL.

func (*Example) GetDefaultOptions

func (p *Example) GetDefaultOptions() map[string]any

GetDefaultOptions returns the default configuration options for this provider. These are auto-populated in the config file if they do not exist.

func (*Example) GetExportDefaults

func (p *Example) GetExportDefaults() map[string]any

GetExportDefaults returns default export configuration options.

func (*Example) GetExportOptionsStruct

func (p *Example) GetExportOptionsStruct() interface{}

GetExportOptionsStruct returns the export options struct for reflection.

func (*Example) GetImportDefaults

func (p *Example) GetImportDefaults() map[string]any

GetImportDefaults returns default import configuration options.

func (*Example) GetImportOptionsStruct

func (p *Example) GetImportOptionsStruct() interface{}

GetImportOptionsStruct returns the import options struct for reflection.

func (*Example) GetOptionsStruct

func (p *Example) GetOptionsStruct() interface{}

GetOptionsStruct returns the configuration struct for comment extraction. This enables YAML serialization with preserved field ordering and comments.

func (*Example) GetRecords

func (p *Example) GetRecords() []import_.CsvRecord

GetRecords returns the raw records for the transform phase

func (*Example) GetSystemRecords

func (p *Example) GetSystemRecords() *import_.SystemCSV

GetSystemRecords returns the system CSV data for transform

func (*Example) Import

func (p *Example) Import(cmd *cobra.Command, args []string, inventory *devicetypes.Inventory) error

Import syncs the local CANI inventory from an external system. This is the "Extract" step in ETL.

func (*Example) IsSystemImport

func (p *Example) IsSystemImport() bool

IsSystemImport returns true if a system CSV was parsed

func (*Example) NewProviderCmd

func (p *Example) NewProviderCmd(base *cobra.Command) (*cobra.Command, error)

NewProviderCmd returns provider-specific CLI commands. This is called for each base command (import, add, show, etc.) to allow the provider to customize or extend the command.

func (*Example) SetRecords

func (p *Example) SetRecords(records []import_.CsvRecord)

SetRecords stores raw records from the import phase

func (*Example) SetSystemRecords

func (p *Example) SetSystemRecords(data *import_.SystemCSV)

SetSystemRecords stores parsed system CSV data

func (*Example) Slug

func (p *Example) Slug() string

func (*Example) Transform

func (p *Example) Transform(existing devicetypes.Inventory) (*devicetypes.TransformResult, error)

Transform converts queued data into CANI types (devices, racks, cables). Delegates to the transform package which processes all records in a single pass.

type ExportOptions

type ExportOptions struct {
}

ExportOptions holds export-specific configuration. These options correspond to CLI flags for the export command. TODO: Add export-specific configuration fields

type ImportOptions

type ImportOptions struct {
}

ImportOptions holds import-specific configuration. These options correspond to CLI flags for the import command. TODO: Add import-specific configuration fields

type Options

type Options struct {
}

Options holds the provider's configuration options. These are written to the config file with YAML comments preserved. TODO: Add provider-specific configuration fields

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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