diff --git a/dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go b/dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go index 8dc9c34b56..94c6685862 100644 --- a/dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go +++ b/dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go @@ -732,6 +732,18 @@ func krmFromProtoFunctionName(protoField protoreflect.FieldDescriptor, krmFieldN return "direct.StringValue_FromProto" case "google.protobuf.BoolValue": return "direct.BoolValue_FromProto" + case "google.protobuf.FloatValue": + return "direct.FloatValue_FromProto" + case "google.protobuf.DoubleValue": + return "direct.DoubleValue_FromProto" + case "google.protobuf.Int32Value": + return "direct.Int32Value_FromProto" + case "google.protobuf.UInt32Value": + return "direct.UInt32Value_FromProto" + case "google.protobuf.UInt64Value": + return "direct.UInt64Value_FromProto" + case "google.protobuf.BytesValue": + return "direct.BytesValue_FromProto" } klog.Fatalf("unhandled case in krmFromProtoFunctionName for proto field %s", fullname) return "" @@ -752,6 +764,18 @@ func krmToProtoFunctionName(protoField protoreflect.FieldDescriptor, krmFieldNam return "direct.StringValue_ToProto" case "google.protobuf.BoolValue": return "direct.BoolValue_ToProto" + case "google.protobuf.FloatValue": + return "direct.FloatValue_ToProto" + case "google.protobuf.DoubleValue": + return "direct.DoubleValue_ToProto" + case "google.protobuf.Int32Value": + return "direct.Int32Value_ToProto" + case "google.protobuf.UInt32Value": + return "direct.UInt32Value_ToProto" + case "google.protobuf.UInt64Value": + return "direct.UInt64Value_ToProto" + case "google.protobuf.BytesValue": + return "direct.BytesValue_ToProto" } klog.Fatalf("unhandled case in krmToProtoFunctionName for proto field %s", fullname) return "" diff --git a/pkg/controller/direct/maputils.go b/pkg/controller/direct/maputils.go index 397c847dc1..293419ae9e 100644 --- a/pkg/controller/direct/maputils.go +++ b/pkg/controller/direct/maputils.go @@ -366,3 +366,98 @@ func Int64Value_FromProto(mapCtx *MapContext, ts *wrapperspb.Int64Value) int64 { func Int64Value_ToProto(mapCtx *MapContext, s int64) *wrapperspb.Int64Value { return wrapperspb.Int64(s) } + +func FloatValue_FromProto(mapCtx *MapContext, in *wrapperspb.FloatValue) *float32 { + if in == nil { + return nil + } + out := in.Value + return &out +} + +func FloatValue_ToProto(mapCtx *MapContext, in *float32) *wrapperspb.FloatValue { + if in == nil { + return nil + } + out := wrapperspb.Float(*in) + return out +} + +// Float64 wrapper functions +func DoubleValue_FromProto(mapCtx *MapContext, in *wrapperspb.DoubleValue) *float64 { + if in == nil { + return nil + } + out := in.Value + return &out +} + +func DoubleValue_ToProto(mapCtx *MapContext, in *float64) *wrapperspb.DoubleValue { + if in == nil { + return nil + } + out := wrapperspb.Double(*in) + return out +} + +func Int32Value_FromProto(mapCtx *MapContext, in *wrapperspb.Int32Value) *int32 { + if in == nil { + return nil + } + out := in.Value + return &out +} + +func Int32Value_ToProto(mapCtx *MapContext, in *int32) *wrapperspb.Int32Value { + if in == nil { + return nil + } + out := wrapperspb.Int32(*in) + return out +} + +func UInt32Value_FromProto(mapCtx *MapContext, in *wrapperspb.UInt32Value) *uint32 { + if in == nil { + return nil + } + out := in.Value + return &out +} + +func UInt32Value_ToProto(mapCtx *MapContext, in *uint32) *wrapperspb.UInt32Value { + if in == nil { + return nil + } + out := wrapperspb.UInt32(*in) + return out +} + +func UInt64Value_FromProto(mapCtx *MapContext, in *wrapperspb.UInt64Value) *uint64 { + if in == nil { + return nil + } + out := in.Value + return &out +} + +func UInt64Value_ToProto(mapCtx *MapContext, in *uint64) *wrapperspb.UInt64Value { + if in == nil { + return nil + } + out := wrapperspb.UInt64(*in) + return out +} + +func BytesValue_FromProto(mapCtx *MapContext, in *wrapperspb.BytesValue) []byte { + if in == nil { + return nil + } + return in.Value +} + +func BytesValue_ToProto(mapCtx *MapContext, in []byte) *wrapperspb.BytesValue { + if in == nil { + return nil + } + return wrapperspb.Bytes(in) +}