github.com/nextlinux/gosbom@v0.81.1-0.20230627115839-1ff50c281391/gosbom/formats.go (about) 1 package gosbom 2 3 import ( 4 "github.com/nextlinux/gosbom/gosbom/formats" 5 "github.com/nextlinux/gosbom/gosbom/formats/cyclonedxjson" 6 "github.com/nextlinux/gosbom/gosbom/formats/cyclonedxxml" 7 "github.com/nextlinux/gosbom/gosbom/formats/github" 8 "github.com/nextlinux/gosbom/gosbom/formats/gosbomjson" 9 "github.com/nextlinux/gosbom/gosbom/formats/spdxjson" 10 "github.com/nextlinux/gosbom/gosbom/formats/spdxtagvalue" 11 "github.com/nextlinux/gosbom/gosbom/formats/table" 12 "github.com/nextlinux/gosbom/gosbom/formats/template" 13 "github.com/nextlinux/gosbom/gosbom/formats/text" 14 "github.com/nextlinux/gosbom/gosbom/sbom" 15 ) 16 17 // these have been exported for the benefit of API users 18 // TODO: deprecated: now that the formats package has been moved to gosbom/formats, will be removed in v1.0.0 19 const ( 20 JSONFormatID = gosbomjson.ID 21 TextFormatID = text.ID 22 TableFormatID = table.ID 23 CycloneDxXMLFormatID = cyclonedxxml.ID 24 CycloneDxJSONFormatID = cyclonedxjson.ID 25 GitHubFormatID = github.ID 26 SPDXTagValueFormatID = spdxtagvalue.ID 27 SPDXJSONFormatID = spdxjson.ID 28 TemplateFormatID = template.ID 29 ) 30 31 // TODO: deprecated, moved to gosbom/formats/formats.go. will be removed in v1.0.0 32 func FormatIDs() (ids []sbom.FormatID) { 33 return formats.AllIDs() 34 } 35 36 // TODO: deprecated, moved to gosbom/formats/formats.go. will be removed in v1.0.0 37 func FormatByID(id sbom.FormatID) sbom.Format { 38 return formats.ByNameAndVersion(string(id), "") 39 } 40 41 // TODO: deprecated, moved to gosbom/formats/formats.go. will be removed in v1.0.0 42 func FormatByName(name string) sbom.Format { 43 return formats.ByName(name) 44 } 45 46 // TODO: deprecated, moved to gosbom/formats/formats.go. will be removed in v1.0.0 47 func IdentifyFormat(by []byte) sbom.Format { 48 return formats.Identify(by) 49 }