diff --git a/proto/sbom/sbom.proto b/proto/sbom/sbom.proto index c18c54e5..427152f4 100644 --- a/proto/sbom/sbom.proto +++ b/proto/sbom/sbom.proto @@ -27,8 +27,10 @@ message SBOMEntity { optional google.protobuf.Duration generationDuration = 6; // SBOM generation duration (how long it took to generate the SBOM report) oneof sbom { cyclonedx.v1_4.Bom cyclonedx = 10; // only cyclonedx will be supported initially but putting it optional will allow us to move to another format later - // spdx.SBOM spdx = 11; // SPDX can be added later as any other format. + // spdx.SBOM spdx = 13; // SPDX can be added later as any other format. + string error = 12; } + SBOMStatus status = 11; } enum SBOMSourceType { @@ -38,3 +40,9 @@ enum SBOMSourceType { HOST_FILE_SYSTEM = 3; CI_PIPELINE = 4; } + +enum SBOMStatus { + PENDING = 0; + SUCCESS = 1; + FAILED = 2; +} diff --git a/sbom/sbom.pb.go b/sbom/sbom.pb.go index 693e78f2..28ec74c3 100644 --- a/sbom/sbom.pb.go +++ b/sbom/sbom.pb.go @@ -78,6 +78,55 @@ func (SBOMSourceType) EnumDescriptor() ([]byte, []int) { return file_proto_sbom_sbom_proto_rawDescGZIP(), []int{0} } +type SBOMStatus int32 + +const ( + SBOMStatus_PENDING SBOMStatus = 0 + SBOMStatus_SUCCESS SBOMStatus = 1 + SBOMStatus_FAILED SBOMStatus = 2 +) + +// Enum value maps for SBOMStatus. +var ( + SBOMStatus_name = map[int32]string{ + 0: "PENDING", + 1: "SUCCESS", + 2: "FAILED", + } + SBOMStatus_value = map[string]int32{ + "PENDING": 0, + "SUCCESS": 1, + "FAILED": 2, + } +) + +func (x SBOMStatus) Enum() *SBOMStatus { + p := new(SBOMStatus) + *p = x + return p +} + +func (x SBOMStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SBOMStatus) Descriptor() protoreflect.EnumDescriptor { + return file_proto_sbom_sbom_proto_enumTypes[1].Descriptor() +} + +func (SBOMStatus) Type() protoreflect.EnumType { + return &file_proto_sbom_sbom_proto_enumTypes[1] +} + +func (x SBOMStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SBOMStatus.Descriptor instead. +func (SBOMStatus) EnumDescriptor() ([]byte, []int) { + return file_proto_sbom_sbom_proto_rawDescGZIP(), []int{1} +} + // SBOMPayload represents the main SBOM payload type SBOMPayload struct { state protoimpl.MessageState @@ -172,7 +221,9 @@ type SBOMEntity struct { GenerationDuration *duration.Duration `protobuf:"bytes,6,opt,name=generationDuration,proto3,oneof" json:"generationDuration,omitempty"` // SBOM generation duration (how long it took to generate the SBOM report) // Types that are assignable to Sbom: // *SBOMEntity_Cyclonedx - Sbom isSBOMEntity_Sbom `protobuf_oneof:"sbom"` + // *SBOMEntity_Error + Sbom isSBOMEntity_Sbom `protobuf_oneof:"sbom"` + Status SBOMStatus `protobuf:"varint,11,opt,name=status,proto3,enum=datadog.sbom.SBOMStatus" json:"status,omitempty"` } func (x *SBOMEntity) Reset() { @@ -270,6 +321,20 @@ func (x *SBOMEntity) GetCyclonedx() *cyclonedx_v1_4.Bom { return nil } +func (x *SBOMEntity) GetError() string { + if x, ok := x.GetSbom().(*SBOMEntity_Error); ok { + return x.Error + } + return "" +} + +func (x *SBOMEntity) GetStatus() SBOMStatus { + if x != nil { + return x.Status + } + return SBOMStatus_PENDING +} + type isSBOMEntity_Sbom interface { isSBOMEntity_Sbom() } @@ -278,8 +343,15 @@ type SBOMEntity_Cyclonedx struct { Cyclonedx *cyclonedx_v1_4.Bom `protobuf:"bytes,10,opt,name=cyclonedx,proto3,oneof"` // only cyclonedx will be supported initially but putting it optional will allow us to move to another format later } +type SBOMEntity_Error struct { + // spdx.SBOM spdx = 13; // SPDX can be added later as any other format. + Error string `protobuf:"bytes,12,opt,name=error,proto3,oneof"` +} + func (*SBOMEntity_Cyclonedx) isSBOMEntity_Sbom() {} +func (*SBOMEntity_Error) isSBOMEntity_Sbom() {} + var File_proto_sbom_sbom_proto protoreflect.FileDescriptor var file_proto_sbom_sbom_proto_rawDesc = []byte{ @@ -305,7 +377,7 @@ var file_proto_sbom_sbom_proto_rawDesc = []byte{ 0x79, 0x52, 0x08, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x1a, 0x0a, 0x06, 0x64, 0x64, 0x5f, 0x65, 0x6e, 0x76, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x05, 0x64, 0x64, 0x45, 0x6e, 0x76, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x64, 0x64, 0x5f, 0x65, 0x6e, 0x76, 0x22, 0x91, 0x03, + 0x63, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x64, 0x64, 0x5f, 0x65, 0x6e, 0x76, 0x22, 0xdb, 0x03, 0x0a, 0x0a, 0x53, 0x42, 0x4f, 0x4d, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x73, 0x62, 0x6f, 0x6d, 0x2e, 0x53, 0x42, 0x4f, 0x4d, 0x53, 0x6f, @@ -328,21 +400,29 @@ var file_proto_sbom_sbom_proto_rawDesc = []byte{ 0x09, 0x63, 0x79, 0x63, 0x6c, 0x6f, 0x6e, 0x65, 0x64, 0x78, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x79, 0x63, 0x6c, 0x6f, 0x6e, 0x65, 0x64, 0x78, 0x2e, 0x76, 0x31, 0x5f, 0x34, 0x2e, 0x42, 0x6f, 0x6d, 0x48, 0x00, 0x52, 0x09, 0x63, 0x79, 0x63, 0x6c, 0x6f, 0x6e, 0x65, - 0x64, 0x78, 0x42, 0x06, 0x0a, 0x04, 0x73, 0x62, 0x6f, 0x6d, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x67, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x67, - 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x2a, 0x7f, 0x0a, 0x0e, 0x53, 0x42, 0x4f, 0x4d, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, - 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, - 0x52, 0x5f, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0x01, - 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x49, - 0x4c, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x48, - 0x4f, 0x53, 0x54, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, - 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x49, 0x5f, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, - 0x10, 0x04, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x44, 0x61, 0x74, 0x61, 0x44, 0x6f, 0x67, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2d, 0x70, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x76, 0x35, 0x2f, 0x73, 0x62, 0x6f, 0x6d, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x78, 0x12, 0x16, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x64, 0x61, 0x74, + 0x61, 0x64, 0x6f, 0x67, 0x2e, 0x73, 0x62, 0x6f, 0x6d, 0x2e, 0x53, 0x42, 0x4f, 0x4d, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x06, 0x0a, 0x04, + 0x73, 0x62, 0x6f, 0x6d, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x42, 0x15, 0x0a, 0x13, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2a, 0x7f, 0x0a, 0x0e, 0x53, + 0x42, 0x4f, 0x4d, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, + 0x0b, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1a, + 0x0a, 0x16, 0x43, 0x4f, 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x49, 0x4d, 0x41, 0x47, + 0x45, 0x5f, 0x4c, 0x41, 0x59, 0x45, 0x52, 0x53, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, + 0x4e, 0x54, 0x41, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x53, 0x59, 0x53, + 0x54, 0x45, 0x4d, 0x10, 0x02, 0x12, 0x14, 0x0a, 0x10, 0x48, 0x4f, 0x53, 0x54, 0x5f, 0x46, 0x49, + 0x4c, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x43, + 0x49, 0x5f, 0x50, 0x49, 0x50, 0x45, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x04, 0x2a, 0x32, 0x0a, 0x0a, + 0x53, 0x42, 0x4f, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, + 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, + 0x53, 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, + 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, + 0x61, 0x74, 0x61, 0x44, 0x6f, 0x67, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2d, 0x70, 0x61, 0x79, + 0x6c, 0x6f, 0x61, 0x64, 0x2f, 0x76, 0x35, 0x2f, 0x73, 0x62, 0x6f, 0x6d, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -357,27 +437,29 @@ func file_proto_sbom_sbom_proto_rawDescGZIP() []byte { return file_proto_sbom_sbom_proto_rawDescData } -var file_proto_sbom_sbom_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_proto_sbom_sbom_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_proto_sbom_sbom_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_proto_sbom_sbom_proto_goTypes = []interface{}{ (SBOMSourceType)(0), // 0: datadog.sbom.SBOMSourceType - (*SBOMPayload)(nil), // 1: datadog.sbom.SBOMPayload - (*SBOMEntity)(nil), // 2: datadog.sbom.SBOMEntity - (*timestamp.Timestamp)(nil), // 3: google.protobuf.Timestamp - (*duration.Duration)(nil), // 4: google.protobuf.Duration - (*cyclonedx_v1_4.Bom)(nil), // 5: cyclonedx.v1_4.Bom + (SBOMStatus)(0), // 1: datadog.sbom.SBOMStatus + (*SBOMPayload)(nil), // 2: datadog.sbom.SBOMPayload + (*SBOMEntity)(nil), // 3: datadog.sbom.SBOMEntity + (*timestamp.Timestamp)(nil), // 4: google.protobuf.Timestamp + (*duration.Duration)(nil), // 5: google.protobuf.Duration + (*cyclonedx_v1_4.Bom)(nil), // 6: cyclonedx.v1_4.Bom } var file_proto_sbom_sbom_proto_depIdxs = []int32{ - 2, // 0: datadog.sbom.SBOMPayload.entities:type_name -> datadog.sbom.SBOMEntity + 3, // 0: datadog.sbom.SBOMPayload.entities:type_name -> datadog.sbom.SBOMEntity 0, // 1: datadog.sbom.SBOMEntity.type:type_name -> datadog.sbom.SBOMSourceType - 3, // 2: datadog.sbom.SBOMEntity.generatedAt:type_name -> google.protobuf.Timestamp - 4, // 3: datadog.sbom.SBOMEntity.generationDuration:type_name -> google.protobuf.Duration - 5, // 4: datadog.sbom.SBOMEntity.cyclonedx:type_name -> cyclonedx.v1_4.Bom - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 4, // 2: datadog.sbom.SBOMEntity.generatedAt:type_name -> google.protobuf.Timestamp + 5, // 3: datadog.sbom.SBOMEntity.generationDuration:type_name -> google.protobuf.Duration + 6, // 4: datadog.sbom.SBOMEntity.cyclonedx:type_name -> cyclonedx.v1_4.Bom + 1, // 5: datadog.sbom.SBOMEntity.status:type_name -> datadog.sbom.SBOMStatus + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_proto_sbom_sbom_proto_init() } @@ -414,13 +496,14 @@ func file_proto_sbom_sbom_proto_init() { file_proto_sbom_sbom_proto_msgTypes[0].OneofWrappers = []interface{}{} file_proto_sbom_sbom_proto_msgTypes[1].OneofWrappers = []interface{}{ (*SBOMEntity_Cyclonedx)(nil), + (*SBOMEntity_Error)(nil), } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_proto_sbom_sbom_proto_rawDesc, - NumEnums: 1, + NumEnums: 2, NumMessages: 2, NumExtensions: 0, NumServices: 0,