chore: add ExtraInfo field for extensions

Add an extra field to extensions to store arbitrary info.

Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
Noel Georgi 2024-04-01 19:25:20 +05:30
parent 0fc24eeb09
commit bac366e43e
No known key found for this signature in database
GPG Key ID: 21A9F444075C9E36
5 changed files with 63 additions and 8 deletions

View File

@ -27,5 +27,6 @@ message Metadata {
string author = 3;
string description = 4;
Compatibility compatibility = 5;
string extra_info = 6;
}

View File

@ -184,6 +184,7 @@ type Metadata struct {
Author string `protobuf:"bytes,3,opt,name=author,proto3" json:"author,omitempty"`
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`
Compatibility *Compatibility `protobuf:"bytes,5,opt,name=compatibility,proto3" json:"compatibility,omitempty"`
ExtraInfo string `protobuf:"bytes,6,opt,name=extra_info,json=extraInfo,proto3" json:"extra_info,omitempty"`
}
func (x *Metadata) Reset() {
@ -253,6 +254,13 @@ func (x *Metadata) GetCompatibility() *Compatibility {
return nil
}
func (x *Metadata) GetExtraInfo() string {
if x != nil {
return x.ExtraInfo
}
return ""
}
var File_resource_definitions_extensions_extensions_proto protoreflect.FileDescriptor
var file_resource_definitions_extensions_extensions_proto_rawDesc = []byte{
@ -276,7 +284,7 @@ var file_resource_definitions_extensions_extensions_proto_rawDesc = []byte{
0x61, 0x6c, 0x6f, 0x73, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x65,
0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73,
0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xce, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xed, 0x01, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61,
0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69,
@ -289,13 +297,14 @@ var file_resource_definitions_extensions_extensions_proto_rawDesc = []byte{
0x75, 0x72, 0x63, 0x65, 0x2e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x2e, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x43, 0x6f, 0x6d, 0x70,
0x61, 0x74, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0d, 0x63, 0x6f, 0x6d, 0x70, 0x61,
0x74, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x4f, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68,
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x69, 0x64, 0x65, 0x72, 0x6f, 0x6c, 0x61, 0x62,
0x73, 0x2f, 0x74, 0x61, 0x6c, 0x6f, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x61, 0x63, 0x68,
0x69, 0x6e, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x65,
0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
0x74, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x74, 0x72,
0x61, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x65, 0x78,
0x74, 0x72, 0x61, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x4f, 0x5a, 0x4d, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x69, 0x64, 0x65, 0x72, 0x6f, 0x6c, 0x61, 0x62, 0x73,
0x2f, 0x74, 0x61, 0x6c, 0x6f, 0x73, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x61, 0x63, 0x68, 0x69,
0x6e, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
0x65, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x65, 0x78,
0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -182,6 +182,13 @@ func (m *Metadata) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
i -= len(m.unknownFields)
copy(dAtA[i:], m.unknownFields)
}
if len(m.ExtraInfo) > 0 {
i -= len(m.ExtraInfo)
copy(dAtA[i:], m.ExtraInfo)
i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ExtraInfo)))
i--
dAtA[i] = 0x32
}
if m.Compatibility != nil {
size, err := m.Compatibility.MarshalToSizedBufferVT(dAtA[:i])
if err != nil {
@ -295,6 +302,10 @@ func (m *Metadata) SizeVT() (n int) {
l = m.Compatibility.SizeVT()
n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
}
l = len(m.ExtraInfo)
if l > 0 {
n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
}
n += len(m.unknownFields)
return n
}
@ -781,6 +792,38 @@ func (m *Metadata) UnmarshalVT(dAtA []byte) error {
return err
}
iNdEx = postIndex
case 6:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ExtraInfo", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protohelpers.ErrIntOverflow
}
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 protohelpers.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protohelpers.ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ExtraInfo = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := protohelpers.Skip(dAtA[iNdEx:])

View File

@ -19,6 +19,7 @@ type Metadata struct {
Author string `yaml:"author" protobuf:"3"`
Description string `yaml:"description" protobuf:"4"`
Compatibility Compatibility `yaml:"compatibility" protobuf:"5"`
ExtraInfo string `yaml:"extraInfo,omitempty" protobuf:"6"`
}
// Compatibility describes extension compatibility.

View File

@ -1761,6 +1761,7 @@ Metadata describes base extension metadata.
| author | [string](#string) | | |
| description | [string](#string) | | |
| compatibility | [Compatibility](#talos.resource.definitions.extensions.Compatibility) | | |
| extra_info | [string](#string) | | |