diff --git a/Rakefile b/Rakefile index ada6b567..83d62043 100644 --- a/Rakefile +++ b/Rakefile @@ -71,6 +71,9 @@ BASH echo "Generating contlcycle proto" PATH=/tmp/gogo-bin-v1.0.0 #{protoc_binary} --proto_path=$GOPATH/src:#{gogo_dir}/src:. --gogofast_out=$GOPATH/src proto/contlcycle/contlcycle.proto + echo "Generating contimage proto" + PATH=/tmp/gogo-bin-v1.0.0 #{protoc_binary} --proto_path=$GOPATH/src:#{gogo_dir}/src:. --gogofast_out=$GOPATH/src proto/contimage/contimage.proto + cp -r v5/* . rm -rf v5 BASH diff --git a/contimage/contimage.pb.go b/contimage/contimage.pb.go new file mode 100644 index 00000000..2cf340e1 --- /dev/null +++ b/contimage/contimage.pb.go @@ -0,0 +1,1154 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: proto/contimage/contimage.proto + +/* + Package contimage is a generated protocol buffer package. + + It is generated from these files: + proto/contimage/contimage.proto + + It has these top-level messages: + ContainerImagePayload + ContainerImage +*/ +package contimage + +import proto "github.com/gogo/protobuf/proto" +import fmt "fmt" +import math "math" + +import io "io" + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// ContainerImagePayload represents the main container image payload +type ContainerImagePayload struct { + Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` + Host string `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"` + Images []*ContainerImage `protobuf:"bytes,3,rep,name=images" json:"images,omitempty"` +} + +func (m *ContainerImagePayload) Reset() { *m = ContainerImagePayload{} } +func (m *ContainerImagePayload) String() string { return proto.CompactTextString(m) } +func (*ContainerImagePayload) ProtoMessage() {} +func (*ContainerImagePayload) Descriptor() ([]byte, []int) { return fileDescriptorContimage, []int{0} } + +func (m *ContainerImagePayload) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + +func (m *ContainerImagePayload) GetHost() string { + if m != nil { + return m.Host + } + return "" +} + +func (m *ContainerImagePayload) GetImages() []*ContainerImage { + if m != nil { + return m.Images + } + return nil +} + +// ContainerImage contains the details of a container image +type ContainerImage struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Registry string `protobuf:"bytes,2,opt,name=registry,proto3" json:"registry,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Tags []string `protobuf:"bytes,4,rep,name=tags" json:"tags,omitempty"` + Digest string `protobuf:"bytes,5,opt,name=digest,proto3" json:"digest,omitempty"` + Size_ int64 `protobuf:"varint,6,opt,name=size,proto3" json:"size,omitempty"` + RepoDigest string `protobuf:"bytes,7,opt,name=repo_digest,json=repoDigest,proto3" json:"repo_digest,omitempty"` + Layers []*ContainerImage_ContainerImageLayer `protobuf:"bytes,9,rep,name=layers" json:"layers,omitempty"` +} + +func (m *ContainerImage) Reset() { *m = ContainerImage{} } +func (m *ContainerImage) String() string { return proto.CompactTextString(m) } +func (*ContainerImage) ProtoMessage() {} +func (*ContainerImage) Descriptor() ([]byte, []int) { return fileDescriptorContimage, []int{1} } + +func (m *ContainerImage) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ContainerImage) GetRegistry() string { + if m != nil { + return m.Registry + } + return "" +} + +func (m *ContainerImage) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *ContainerImage) GetTags() []string { + if m != nil { + return m.Tags + } + return nil +} + +func (m *ContainerImage) GetDigest() string { + if m != nil { + return m.Digest + } + return "" +} + +func (m *ContainerImage) GetSize_() int64 { + if m != nil { + return m.Size_ + } + return 0 +} + +func (m *ContainerImage) GetRepoDigest() string { + if m != nil { + return m.RepoDigest + } + return "" +} + +func (m *ContainerImage) GetLayers() []*ContainerImage_ContainerImageLayer { + if m != nil { + return m.Layers + } + return nil +} + +type ContainerImage_ContainerImageLayer struct { + Urls string `protobuf:"bytes,1,opt,name=urls,proto3" json:"urls,omitempty"` + MediaType string `protobuf:"bytes,2,opt,name=mediaType,proto3" json:"mediaType,omitempty"` + Digest string `protobuf:"bytes,3,opt,name=digest,proto3" json:"digest,omitempty"` + Size_ int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` +} + +func (m *ContainerImage_ContainerImageLayer) Reset() { *m = ContainerImage_ContainerImageLayer{} } +func (m *ContainerImage_ContainerImageLayer) String() string { return proto.CompactTextString(m) } +func (*ContainerImage_ContainerImageLayer) ProtoMessage() {} +func (*ContainerImage_ContainerImageLayer) Descriptor() ([]byte, []int) { + return fileDescriptorContimage, []int{1, 0} +} + +func (m *ContainerImage_ContainerImageLayer) GetUrls() string { + if m != nil { + return m.Urls + } + return "" +} + +func (m *ContainerImage_ContainerImageLayer) GetMediaType() string { + if m != nil { + return m.MediaType + } + return "" +} + +func (m *ContainerImage_ContainerImageLayer) GetDigest() string { + if m != nil { + return m.Digest + } + return "" +} + +func (m *ContainerImage_ContainerImageLayer) GetSize_() int64 { + if m != nil { + return m.Size_ + } + return 0 +} + +func init() { + proto.RegisterType((*ContainerImagePayload)(nil), "datadog.contimage.ContainerImagePayload") + proto.RegisterType((*ContainerImage)(nil), "datadog.contimage.ContainerImage") + proto.RegisterType((*ContainerImage_ContainerImageLayer)(nil), "datadog.contimage.ContainerImage.ContainerImageLayer") +} +func (m *ContainerImagePayload) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerImagePayload) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Version) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.Version))) + i += copy(dAtA[i:], m.Version) + } + if len(m.Host) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.Host))) + i += copy(dAtA[i:], m.Host) + } + if len(m.Images) > 0 { + for _, msg := range m.Images { + dAtA[i] = 0x1a + i++ + i = encodeVarintContimage(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ContainerImage) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerImage) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Id) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.Id))) + i += copy(dAtA[i:], m.Id) + } + if len(m.Registry) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.Registry))) + i += copy(dAtA[i:], m.Registry) + } + if len(m.Name) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.Name))) + i += copy(dAtA[i:], m.Name) + } + if len(m.Tags) > 0 { + for _, s := range m.Tags { + dAtA[i] = 0x22 + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } + if len(m.Digest) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.Digest))) + i += copy(dAtA[i:], m.Digest) + } + if m.Size_ != 0 { + dAtA[i] = 0x30 + i++ + i = encodeVarintContimage(dAtA, i, uint64(m.Size_)) + } + if len(m.RepoDigest) > 0 { + dAtA[i] = 0x3a + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.RepoDigest))) + i += copy(dAtA[i:], m.RepoDigest) + } + if len(m.Layers) > 0 { + for _, msg := range m.Layers { + dAtA[i] = 0x4a + i++ + i = encodeVarintContimage(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *ContainerImage_ContainerImageLayer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ContainerImage_ContainerImageLayer) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Urls) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.Urls))) + i += copy(dAtA[i:], m.Urls) + } + if len(m.MediaType) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.MediaType))) + i += copy(dAtA[i:], m.MediaType) + } + if len(m.Digest) > 0 { + dAtA[i] = 0x1a + i++ + i = encodeVarintContimage(dAtA, i, uint64(len(m.Digest))) + i += copy(dAtA[i:], m.Digest) + } + if m.Size_ != 0 { + dAtA[i] = 0x20 + i++ + i = encodeVarintContimage(dAtA, i, uint64(m.Size_)) + } + return i, nil +} + +func encodeVarintContimage(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *ContainerImagePayload) Size() (n int) { + var l int + _ = l + l = len(m.Version) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + l = len(m.Host) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + if len(m.Images) > 0 { + for _, e := range m.Images { + l = e.Size() + n += 1 + l + sovContimage(uint64(l)) + } + } + return n +} + +func (m *ContainerImage) Size() (n int) { + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + l = len(m.Registry) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + if len(m.Tags) > 0 { + for _, s := range m.Tags { + l = len(s) + n += 1 + l + sovContimage(uint64(l)) + } + } + l = len(m.Digest) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + if m.Size_ != 0 { + n += 1 + sovContimage(uint64(m.Size_)) + } + l = len(m.RepoDigest) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + if len(m.Layers) > 0 { + for _, e := range m.Layers { + l = e.Size() + n += 1 + l + sovContimage(uint64(l)) + } + } + return n +} + +func (m *ContainerImage_ContainerImageLayer) Size() (n int) { + var l int + _ = l + l = len(m.Urls) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + l = len(m.MediaType) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + l = len(m.Digest) + if l > 0 { + n += 1 + l + sovContimage(uint64(l)) + } + if m.Size_ != 0 { + n += 1 + sovContimage(uint64(m.Size_)) + } + return n +} + +func sovContimage(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozContimage(x uint64) (n int) { + return sovContimage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ContainerImagePayload) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerImagePayload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerImagePayload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Host", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Host = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Images", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Images = append(m.Images, &ContainerImage{}) + if err := m.Images[len(m.Images)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContimage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContimage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContainerImage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerImage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerImage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Registry", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Registry = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tags = append(m.Tags, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Digest", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Digest = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) + } + m.Size_ = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Size_ |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RepoDigest", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RepoDigest = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Layers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Layers = append(m.Layers, &ContainerImage_ContainerImageLayer{}) + if err := m.Layers[len(m.Layers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipContimage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContimage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ContainerImage_ContainerImageLayer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ContainerImageLayer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ContainerImageLayer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Urls", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Urls = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MediaType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MediaType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Digest", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthContimage + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Digest = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Size_", wireType) + } + m.Size_ = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowContimage + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Size_ |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipContimage(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthContimage + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipContimage(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContimage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContimage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContimage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + iNdEx += length + if length < 0 { + return 0, ErrInvalidLengthContimage + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowContimage + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipContimage(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthContimage = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowContimage = fmt.Errorf("proto: integer overflow") +) + +func init() { proto.RegisterFile("proto/contimage/contimage.proto", fileDescriptorContimage) } + +var fileDescriptorContimage = []byte{ + // 357 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x41, 0x4b, 0x33, 0x31, + 0x10, 0x65, 0x77, 0xfb, 0x6d, 0xbf, 0x4e, 0xa1, 0x60, 0x44, 0x09, 0x45, 0xda, 0xb5, 0xa7, 0x5e, + 0xba, 0x0b, 0x4a, 0x0f, 0xe2, 0x4d, 0x7b, 0x11, 0x14, 0x64, 0xf1, 0xe4, 0x45, 0xd2, 0x6e, 0x48, + 0x03, 0xdd, 0xcd, 0x92, 0xa4, 0x85, 0xf5, 0xe4, 0xcf, 0xf3, 0xe8, 0x4f, 0x90, 0xfe, 0x07, 0xef, + 0x92, 0x34, 0x76, 0xad, 0x16, 0xbc, 0xbd, 0x79, 0x93, 0x97, 0x37, 0x6f, 0x18, 0xe8, 0x97, 0x52, + 0x68, 0x91, 0xcc, 0x44, 0xa1, 0x79, 0x4e, 0x18, 0xad, 0x51, 0x6c, 0x3b, 0xe8, 0x20, 0x23, 0x9a, + 0x64, 0x82, 0xc5, 0xdb, 0xc6, 0xe0, 0xc5, 0x83, 0xa3, 0x6b, 0x51, 0x68, 0xc2, 0x0b, 0x2a, 0x6f, + 0x0c, 0x75, 0x4f, 0xaa, 0x85, 0x20, 0x19, 0xc2, 0xd0, 0x5c, 0x51, 0xa9, 0xb8, 0x28, 0xb0, 0x17, + 0x79, 0xc3, 0x56, 0xfa, 0x55, 0x22, 0x04, 0x8d, 0xb9, 0x50, 0x1a, 0xfb, 0x96, 0xb6, 0x18, 0x5d, + 0x40, 0x68, 0x3f, 0x54, 0x38, 0x88, 0x82, 0x61, 0xfb, 0xec, 0x34, 0xfe, 0xe5, 0x15, 0xef, 0xfa, + 0xa4, 0x4e, 0x30, 0xf8, 0xf0, 0xa1, 0xb3, 0xdb, 0x42, 0x1d, 0xf0, 0x79, 0xe6, 0x6c, 0x7d, 0x9e, + 0xa1, 0x2e, 0xfc, 0x97, 0x94, 0x71, 0xa5, 0x65, 0xe5, 0x5c, 0xb7, 0xb5, 0x99, 0xa6, 0x20, 0x39, + 0xc5, 0xc1, 0x66, 0x1a, 0x83, 0x0d, 0xa7, 0x09, 0x53, 0xb8, 0x11, 0x05, 0x86, 0x33, 0x18, 0x1d, + 0x43, 0x98, 0x71, 0x46, 0x95, 0xc6, 0xff, 0xec, 0x4b, 0x57, 0x99, 0xb7, 0x8a, 0x3f, 0x53, 0x1c, + 0x46, 0xde, 0x30, 0x48, 0x2d, 0x46, 0x7d, 0x68, 0x4b, 0x5a, 0x8a, 0x27, 0x27, 0x68, 0x5a, 0x01, + 0x18, 0x6a, 0xb2, 0x11, 0xdd, 0x41, 0xb8, 0x20, 0x15, 0x95, 0x0a, 0xb7, 0x6c, 0xdc, 0xf1, 0x9f, + 0x71, 0x7f, 0x94, 0xb7, 0x46, 0x9d, 0xba, 0x4f, 0xba, 0x0a, 0x0e, 0xf7, 0xb4, 0xcd, 0x68, 0x4b, + 0xb9, 0x50, 0x6e, 0x11, 0x16, 0xa3, 0x13, 0x68, 0xe5, 0x34, 0xe3, 0xe4, 0xa1, 0x2a, 0xa9, 0xdb, + 0x45, 0x4d, 0x7c, 0x0b, 0x19, 0xec, 0x0d, 0xd9, 0xa8, 0x43, 0x5e, 0x5d, 0xbe, 0xae, 0x7b, 0xde, + 0xdb, 0xba, 0xe7, 0xbd, 0xaf, 0x7b, 0xde, 0xe3, 0x88, 0x71, 0x3d, 0x5f, 0x4e, 0xe3, 0x99, 0xc8, + 0x93, 0x09, 0xd1, 0x64, 0x22, 0x58, 0x42, 0x18, 0x2d, 0xf4, 0xa8, 0xdc, 0x1c, 0x44, 0xb2, 0x1a, + 0xd7, 0x07, 0x35, 0x0d, 0xed, 0x45, 0x9d, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x56, 0xbd, 0x76, + 0x6a, 0x74, 0x02, 0x00, 0x00, +} diff --git a/proto/contimage/contimage.go b/proto/contimage/contimage.go new file mode 100644 index 00000000..1105bf72 --- /dev/null +++ b/proto/contimage/contimage.go @@ -0,0 +1,2 @@ +// package contimage contains the container images proto definitions +package contimage diff --git a/proto/contimage/contimage.proto b/proto/contimage/contimage.proto new file mode 100644 index 00000000..ad1022fe --- /dev/null +++ b/proto/contimage/contimage.proto @@ -0,0 +1,53 @@ +syntax = "proto3"; + +option go_package = "github.com/DataDog/agent-payload/v5/contimage"; + +package datadog.contimage; + +// ContainerImagePayload represents the main container image payload +message ContainerImagePayload { + string version = 1; // version represents the ContainerImagePayload message version + string host = 2; // host contains the hostname + repeated ContainerImage images = 3; // Images metadata + // repeated VulneratibilityReport reports = 4; // vulneratibility reports +} + +// ContainerImage contains the details of a container image +message ContainerImage { + string id = 1; + string registry = 2; + string name = 3; + repeated string tags = 4; + string digest = 5; + int64 size = 6; + string repo_digest = 7; + + // # platform info + // message OperatingSystem { + // string name = 1; + // string version = 2; + // string architecture = 3; + // } + // optional OperatingSystem os = 8 + + message ContainerImageLayer { + string urls = 1; + string mediaType = 2; + string digest = 3; + int64 size = 4; + } + repeated ContainerImageLayer layers = 9; + + // optional ImageSBOM sbom = 10; + + // optional VulneratibilityReport vulns = 10; +} + +// // VulneratibilityReport container a +// message VulneratibilityReport { +// // TODO +// } + +// message ImageSBOM { +// // TODO +// }