github.com/kastenhq/syft@v0.0.0-20230821225854-0710af25cdbe/syft/formats.go (about)

     1  package syft
     2  
     3  import (
     4  	"github.com/kastenhq/syft/syft/formats"
     5  	"github.com/kastenhq/syft/syft/formats/cyclonedxjson"
     6  	"github.com/kastenhq/syft/syft/formats/cyclonedxxml"
     7  	"github.com/kastenhq/syft/syft/formats/github"
     8  	"github.com/kastenhq/syft/syft/formats/spdxjson"
     9  	"github.com/kastenhq/syft/syft/formats/spdxtagvalue"
    10  	"github.com/kastenhq/syft/syft/formats/syftjson"
    11  	"github.com/kastenhq/syft/syft/formats/table"
    12  	"github.com/kastenhq/syft/syft/formats/template"
    13  	"github.com/kastenhq/syft/syft/formats/text"
    14  	"github.com/kastenhq/syft/syft/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 syft/formats, will be removed in v1.0.0
    19  const (
    20  	JSONFormatID          = syftjson.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 syft/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 syft/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 syft/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 syft/formats/formats.go. will be removed in v1.0.0
    47  func IdentifyFormat(by []byte) sbom.Format {
    48  	return formats.Identify(by)
    49  }