github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/formats/cyclonedxjson/format.go (about)

     1  package cyclonedxjson
     2  
     3  import (
     4  	"github.com/CycloneDX/cyclonedx-go"
     5  
     6  	"github.com/anchore/syft/syft/formats/common/cyclonedxhelpers"
     7  	"github.com/anchore/syft/syft/sbom"
     8  )
     9  
    10  const ID sbom.FormatID = "cyclonedx-json"
    11  
    12  var Format = Format1_4
    13  
    14  func Format1_0() sbom.Format {
    15  	return sbom.NewFormat(
    16  		cyclonedx.SpecVersion1_0.String(),
    17  		encoderV1_0,
    18  		cyclonedxhelpers.GetDecoder(cyclonedx.BOMFileFormatJSON),
    19  		cyclonedxhelpers.GetValidator(cyclonedx.BOMFileFormatJSON),
    20  		ID,
    21  	)
    22  }
    23  
    24  func Format1_1() sbom.Format {
    25  	return sbom.NewFormat(
    26  		cyclonedx.SpecVersion1_1.String(),
    27  		encoderV1_1,
    28  		cyclonedxhelpers.GetDecoder(cyclonedx.BOMFileFormatJSON),
    29  		cyclonedxhelpers.GetValidator(cyclonedx.BOMFileFormatJSON),
    30  		ID,
    31  	)
    32  }
    33  
    34  func Format1_2() sbom.Format {
    35  	return sbom.NewFormat(
    36  		cyclonedx.SpecVersion1_2.String(),
    37  		encoderV1_2,
    38  		cyclonedxhelpers.GetDecoder(cyclonedx.BOMFileFormatJSON),
    39  		cyclonedxhelpers.GetValidator(cyclonedx.BOMFileFormatJSON),
    40  		ID,
    41  	)
    42  }
    43  
    44  func Format1_3() sbom.Format {
    45  	return sbom.NewFormat(
    46  		cyclonedx.SpecVersion1_3.String(),
    47  		encoderV1_3,
    48  		cyclonedxhelpers.GetDecoder(cyclonedx.BOMFileFormatJSON),
    49  		cyclonedxhelpers.GetValidator(cyclonedx.BOMFileFormatJSON),
    50  		ID,
    51  	)
    52  }
    53  
    54  func Format1_4() sbom.Format {
    55  	return sbom.NewFormat(
    56  		cyclonedx.SpecVersion1_4.String(),
    57  		encoderV1_4,
    58  		cyclonedxhelpers.GetDecoder(cyclonedx.BOMFileFormatJSON),
    59  		cyclonedxhelpers.GetValidator(cyclonedx.BOMFileFormatJSON),
    60  		ID,
    61  	)
    62  }
    63  
    64  func Format1_5() sbom.Format {
    65  	return sbom.NewFormat(
    66  		cyclonedx.SpecVersion1_5.String(),
    67  		encoderV1_5,
    68  		cyclonedxhelpers.GetDecoder(cyclonedx.BOMFileFormatJSON),
    69  		cyclonedxhelpers.GetValidator(cyclonedx.BOMFileFormatJSON),
    70  		ID,
    71  	)
    72  }