puppet

package
v0.0.0-...-408d360 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type ApiClient

type ApiClient struct {
	// contains filtered or unexported fields
}

func NewApiClient

func NewApiClient(options ...ApiClientOption) *ApiClient

func (*ApiClient) GetNodes

func (client *ApiClient) GetNodes() ([]Node, error)

GetNodes - Get all nodes from the PuppetDB API

func (*ApiClient) GetReportHashInfo

func (client *ApiClient) GetReportHashInfo(hash string) ([]ReportLogEntry, error)

type ApiClientOption

type ApiClientOption func(client *ApiClient) error

func WithUrl

func WithUrl(uri string) ApiClientOption

WithUrl - ApiClientOption set the URL of the PuppetDB API

type Level

type Level string
const (
	LevelDebug   Level = "debug"
	LevelInfo    Level = "info"
	LevelNotice  Level = "notice"
	LevelWarning Level = "warning"
	LevelErr     Level = "err"
	LevelAlert   Level = "alert"
	LevelEmerg   Level = "emerg"
	LevelCrit    Level = "crit"
)

type Node

type Node struct {
	Deactivated                  interface{}  `json:"deactivated"`
	LatestReportHash             string       `json:"latest_report_hash"`
	FactsEnvironment             string       `json:"facts_environment"`
	CachedCatalogStatus          string       `json:"cached_catalog_status"`
	ReportEnvironment            string       `json:"report_environment"`
	LatestReportCorrectiveChange interface{}  `json:"latest_report_corrective_change"`
	CatalogEnvironment           string       `json:"catalog_environment"`
	FactsTimestamp               time.Time    `json:"facts_timestamp"`
	LatestReportNoop             bool         `json:"latest_report_noop"`
	Expired                      interface{}  `json:"expired"`
	LatestReportNoopPending      bool         `json:"latest_report_noop_pending"`
	ReportTimestamp              time.Time    `json:"report_timestamp"`
	Certname                     string       `json:"certname"`
	CatalogTimestamp             time.Time    `json:"catalog_timestamp"`
	LatestReportJobId            interface{}  `json:"latest_report_job_id"`
	LatestReportStatus           ReportStatus `json:"latest_report_status"`
}

type ReportData

type ReportData struct {
	Host        string           `yaml:"host"`
	Logs        []ReportLogEntry `yaml:"logs"`
	Environment string           `yaml:"environment"`
	Status      ReportStatus     `yaml:"status"`
}

type ReportLogEntry

type ReportLogEntry struct {
	File    interface{} `json:"file" yaml:"file"`
	Line    interface{} `json:"line" yaml:"line"`
	Tags    []string    `json:"tags" yaml:"tags"`
	Time    time.Time   `json:"time" yaml:"time"`
	Level   string      `json:"level" yaml:"level"`
	Source  string      `json:"source" yaml:"source"`
	Message string      `json:"message" yaml:"message"`
}

ReportLogEntry - representation of https://puppet.com/docs/puppet/7/format_report.html#format_report-puppet-util-log

type ReportStatus

type ReportStatus string
const (
	ReportStatusChanged   ReportStatus = "changed"
	ReportStatusFailed    ReportStatus = "failed"
	ReportStatusUnchanged ReportStatus = "unchanged"
)

func (ReportStatus) ToNumeric

func (s ReportStatus) ToNumeric() uint8

Jump to

Keyboard shortcuts

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