Documentation
¶
Index ¶
- Constants
- func CalcLineAndCharacterPos(data []byte, offset int64) (lineNum int, charNum int)
- func CompileRegex(test string) (expression *regexp.Regexp, err error)
- func EncodeAnyToDefaultIndentedJSONStr(any interface{}) (outputBuffer bytes.Buffer, err error)
- func EncodeAnyToIndentedJSONInt(any interface{}, numSpaces int) (outputBuffer bytes.Buffer, err error)
- func EncodeAnyToIndentedJSONStr(any interface{}, indent string) (outputBuffer bytes.Buffer, err error)
- func FindVerifyConfigFileAbsPath(logger *log.MiniLogger, filename string) (absFilename string, err error)
- func GenerateIndentString(length int) (prefix string)
- func GetCallerFunctionName(skip int) (fxName string)
- func IsJsonMapType(any interface{}) (isMapType bool)
- func IsJsonSliceType(any interface{}) (isSliceType bool)
- func IsValidJsonRaw(test []byte) bool
- func MarshalAnyToFormattedJsonString(any interface{}) (string, error)
- func MarshalStructToJsonMap(any interface{}) (mapOut map[string]interface{}, err error)
- func PrintlnJSONObject(any interface{})
- func PrintlnLabeledJSONObject(any interface{}, label string)
- func TruncateTimeStampISO8601Date(fullTimestamp string) (date string, err error)
- func ValidateISO8601TimestampISO8601DateTime(timestamp string, regex string) (valid bool)
- func WriteAnyAsEncodedJSONInt(writer io.Writer, any interface{}, numSpaces int) (outputBuffer bytes.Buffer, err error)
- type CommandFlags
- type ComponentCommandFlags
- type CustomValidationFlags
- type DiffCommandFlags
- type LicenseCommandFlags
- type PatchCommandFlags
- type PersistentCommandFlags
- type ReportCommandFlags
- type ResourceCommandFlags
- type SchemaCommandFlags
- type StatsCommandFlags
- type TrimCommandFlags
- type ValidateCommandFlags
- type VulnerabilityCommandFlags
Constants ¶
const ( DEFAULT_JSON_INDENT_STRING = " " DEFAULT_JSON_PREFIX_STRING = "" )
const ISO8601_TIME_SEPARATOR = 'T'
const (
PROJECT_NAME = "sbom-utility"
)
const REGEX_ISO_8601_DATE = "[0-9]{4}-[0-9]{2}-[0-9]{2}"
const REGEX_ISO_8601_DATE_TIME = "[0-9]{4}-[0-9]{2}-[0-9]{2}T([0-9]{2}:){2}[0-9]{2}[+|-][0-9]{2}:[0-9]{2}"
Currently, truncate
Variables ¶
This section is empty.
Functions ¶
func CalcLineAndCharacterPos ¶ added in v0.15.0
func CompileRegex ¶ added in v0.14.0
func EncodeAnyToDefaultIndentedJSONStr ¶ added in v0.14.0
func EncodeAnyToIndentedJSONInt ¶ added in v0.14.0
func EncodeAnyToIndentedJSONStr ¶ added in v0.14.0
func EncodeAnyToIndentedJSONStr(any interface{}, indent string) (outputBuffer bytes.Buffer, err error)
NOTE: Using this custom encoder avoids the json.Marshal() default behavior of encoding utf8 characters such as: '@', '<', '>', etc. as unicode.
func FindVerifyConfigFileAbsPath ¶
func FindVerifyConfigFileAbsPath(logger *log.MiniLogger, filename string) (absFilename string, err error)
func GenerateIndentString ¶ added in v0.14.0
Creates strings of spaces based upon provided integer length (e.g., the --indent <length> flag)
func GetCallerFunctionName ¶ added in v0.14.0
func IsJsonMapType ¶ added in v0.14.0
func IsJsonMapType(any interface{}) (isMapType bool)
func IsJsonSliceType ¶ added in v0.14.0
func IsJsonSliceType(any interface{}) (isSliceType bool)
func IsValidJsonRaw ¶
func MarshalAnyToFormattedJsonString ¶ added in v0.14.0
NOTE: simple wrapper method on json package to standardize parms WARNING: By default, json.Marshal() methods will use a unicode encoding which will encode utf8 characters such as: '@', '<', '>', etc.
func MarshalStructToJsonMap ¶ added in v0.14.0
func PrintlnJSONObject ¶ added in v0.15.0
func PrintlnJSONObject(any interface{})
func PrintlnLabeledJSONObject ¶ added in v0.15.0
func PrintlnLabeledJSONObject(any interface{}, label string)
func TruncateTimeStampISO8601Date ¶ added in v0.14.0
TODO we SHOULD normalize the timestamp to Z (0)
func ValidateISO8601TimestampISO8601DateTime ¶ added in v0.14.0
Validates a complete Date-Time ISO8601 timestamp TODO verify it works for data, date-time, date-time-timezone formats
Types ¶
type CommandFlags ¶
type CommandFlags struct {
// Not flags, but "main" package var copies
Project string
Binary string
Version string
WorkingDir string
ExecDir string
// Configurations
ConfigSchemaFile string
ConfigCustomValidationFile string
ConfigLicensePolicyFile string
// persistent flags (common to all commands)
PersistentFlags PersistentCommandFlags
// Command-specific flags
ComponentFlags ComponentCommandFlags
CustomValidationOptions CustomValidationFlags
DiffFlags DiffCommandFlags
LicenseFlags LicenseCommandFlags
PatchFlags PatchCommandFlags
ResourceFlags ResourceCommandFlags
SchemaFlags SchemaCommandFlags
StatsFlags StatsCommandFlags
TrimFlags TrimCommandFlags
ValidateFlags ValidateCommandFlags
VulnerabilityFlags VulnerabilityCommandFlags
// Misc flags
LogOutputIndentCallstack bool // Log indent
}
var GlobalFlags CommandFlags
Globals
func (*CommandFlags) String ¶
func (flags *CommandFlags) String() string
format and output the MyFlags struct as a string using Go's Stringer interface
type ComponentCommandFlags ¶ added in v0.16.0
type ComponentCommandFlags struct {
ReportCommandFlags
Types []string
}
type CustomValidationFlags ¶
type DiffCommandFlags ¶ added in v0.12.0
type LicenseCommandFlags ¶ added in v0.10.0
type LicenseCommandFlags struct {
ReportCommandFlags
}
type PatchCommandFlags ¶ added in v0.15.0
type PersistentCommandFlags ¶ added in v0.12.0
type PersistentCommandFlags struct {
Quiet bool // suppresses all non-essential (informational) output from a command. Overrides any other log-level commands.
Trace bool // trace logging
Debug bool // debug logging
InputFile string
OutputFile string // TODO: TODO: Note: not used by `validate` command, which emits a warning if supplied
OutputFormat string // e.g., "txt", "csv"", "md" (markdown) (normalized to lowercase)
OutputIndent uint8
OutputNormalize bool
}
NOTE: These flags are shared by both the list and policy subcommands
func (PersistentCommandFlags) GetOutputIndentInt ¶ added in v0.14.0
func (persistentFlags PersistentCommandFlags) GetOutputIndentInt() int
type ReportCommandFlags ¶ added in v0.16.0
type ReportCommandFlags struct {
Summary bool
ListLineWrap bool // NOTE: SHOULD ONLY be used for "text" output; currently only used by "license policy" command.
}
Common flags for all "list" (report) commands (e.g., license list, vulnerability list, etc.)
type ResourceCommandFlags ¶ added in v0.14.0
type ResourceCommandFlags struct {
ReportCommandFlags // NOTE: currently unused; as # columns grows, please implement
ResourceType string
}
func NewResourceCommandFlags ¶ added in v0.14.0
func NewResourceCommandFlags(resourceType string) ResourceCommandFlags
type SchemaCommandFlags ¶ added in v0.14.0
type SchemaCommandFlags struct {
ReportCommandFlags // NOTE: currently unused; as # columns grows, please implement
}
type StatsCommandFlags ¶ added in v0.14.0
type StatsCommandFlags struct {
}
TODO: unused/unimplemented
type TrimCommandFlags ¶ added in v0.14.0
TODO: write a "parse" method for the struct (i.e., from "raw" to slice)
type ValidateCommandFlags ¶ added in v0.11.0
type ValidateCommandFlags struct {
SchemaVariant string
ForcedJsonSchemaFile string
CustomValidation bool // Uses custom validation flags if "true"; defaults to config. "custom.json"
// validation error result (output) processing
MaxNumErrors int
MaxErrorDescriptionLength int
ColorizeErrorOutput bool
ShowErrorValue bool
}
type VulnerabilityCommandFlags ¶ added in v0.11.0
type VulnerabilityCommandFlags struct {
ReportCommandFlags
}