-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added docker reference type component. Added check in the converter t…
…o filter out null values. (#98) * Added docker reference type component. Added check in the converter to filter out null values * Removed ws * Added copyright headers * Removed ws
- Loading branch information
Showing
6 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...Microsoft.Sbom.Adapters/Adapters/ComponentDetection/DockerReferenceComponentExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Microsoft.ComponentDetection.Contracts.TypedComponent; | ||
using Microsoft.Sbom.Contracts; | ||
using Microsoft.Sbom.Contracts.Enums; | ||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.Sbom.Adapters.ComponentDetection | ||
{ | ||
/// <summary> | ||
/// Extensions methods for <see cref="DockerReferenceComponent"/>. | ||
/// </summary> | ||
internal static class DockerReferenceComponentExtensions | ||
{ | ||
/// <summary> | ||
/// Converts a <see cref="DockerReferenceComponent"/> to an <see cref="SBOMPackage"/>. | ||
/// </summary> | ||
public static SBOMPackage? ToSbomPackage(this DockerReferenceComponent dockerReferenceComponent) => new SBOMPackage | ||
{ | ||
Id = dockerReferenceComponent.Id, | ||
PackageUrl = dockerReferenceComponent.PackageUrl?.ToString(), | ||
PackageName = dockerReferenceComponent.Name, | ||
Checksum = new List<Checksum>() | ||
{ | ||
new Checksum() | ||
{ | ||
Algorithm = AlgorithmName.SHA256, | ||
ChecksumValue = dockerReferenceComponent.Digest | ||
}, | ||
}, | ||
FilesAnalyzed = false, | ||
Type = "docker-reference" | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters