From 7f449b6d825a2af5ae32e8af502bd8aed57a3593 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Wed, 11 Mar 2026 20:12:43 +0100 Subject: [PATCH 01/27] feat: krypton plugins --- .../cipher_wrapper/v1/cipher_wrapper.pb.go | 495 ++++++++++++++++++ .../v1/cipher_wrapper.pb.validate.go | 490 +++++++++++++++++ .../cipher_wrapper/v1/cipher_wrapper.proto | 96 ++++ .../v1/cipher_wrapper_ext_plugin.pb.go | 56 ++ .../v1/cipher_wrapper_grpc.pb.go | 176 +++++++ 5 files changed, 1313 insertions(+) create mode 100644 proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go create mode 100644 proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go create mode 100644 proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto create mode 100644 proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go create mode 100644 proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go new file mode 100644 index 0000000..3a1e966 --- /dev/null +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go @@ -0,0 +1,495 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc (unknown) +// source: plugin/cipher_wrapper/v1/cipher_wrapper.proto + +package cipher_wrapperv1 + +import ( + reflect "reflect" + sync "sync" + unsafe "unsafe" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// WrapRequest contains the raw key material and the context needed to encrypt it. +type WrapRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: The raw cryptographic material to be wrapped. + Plaintext []byte `protobuf:"bytes,1,opt,name=plaintext,proto3" json:"plaintext,omitempty"` + // REQUIRED: The universal locator for the cryptographic key (ARN, URI, or Path). + KeyUri string `protobuf:"bytes,2,opt,name=key_uri,json=keyUri,proto3" json:"key_uri,omitempty"` + // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. + // Explicitly marked optional so the Go plugin can check `if req.Aad != nil`. + Aad []byte `protobuf:"bytes,3,opt,name=aad,proto3,oneof" json:"aad,omitempty"` + // OPTIONAL (Map): Key-Value Encryption Context (used by AWS/GCP/Alibaba). + // Maps cannot use the 'optional' keyword in proto3, but are implicitly optional. + EncryptionContext map[string]string `protobuf:"bytes,4,rep,name=encryption_context,json=encryptionContext,proto3" json:"encryption_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // OPTIONAL: The explicit cryptographic wrapping mechanism (e.g., "RSA-OAEP-256"). + // Required for Azure and HSMs, safely omitted for AWS/Vault. + Mechanism *string `protobuf:"bytes,5,opt,name=mechanism,proto3,oneof" json:"mechanism,omitempty"` + // OPTIONAL: Initialization Vector (IV) or Nonce. + // Provided only if the CMK core is dictating the IV to an HSM. + Iv []byte `protobuf:"bytes,6,opt,name=iv,proto3,oneof" json:"iv,omitempty"` + // OPTIONAL (Map): Dynamic Configuration Pass-through. + Options map[string]string `protobuf:"bytes,7,rep,name=options,proto3" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WrapRequest) Reset() { + *x = WrapRequest{} + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WrapRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WrapRequest) ProtoMessage() {} + +func (x *WrapRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WrapRequest.ProtoReflect.Descriptor instead. +func (*WrapRequest) Descriptor() ([]byte, []int) { + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{0} +} + +func (x *WrapRequest) GetPlaintext() []byte { + if x != nil { + return x.Plaintext + } + return nil +} + +func (x *WrapRequest) GetKeyUri() string { + if x != nil { + return x.KeyUri + } + return "" +} + +func (x *WrapRequest) GetAad() []byte { + if x != nil { + return x.Aad + } + return nil +} + +func (x *WrapRequest) GetEncryptionContext() map[string]string { + if x != nil { + return x.EncryptionContext + } + return nil +} + +func (x *WrapRequest) GetMechanism() string { + if x != nil && x.Mechanism != nil { + return *x.Mechanism + } + return "" +} + +func (x *WrapRequest) GetIv() []byte { + if x != nil { + return x.Iv + } + return nil +} + +func (x *WrapRequest) GetOptions() map[string]string { + if x != nil { + return x.Options + } + return nil +} + +// WrapResponse returns the provider-specific ciphertext and metadata. +type WrapResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: The opaque, vendor-specific ciphertext. + Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` + // OPTIONAL: The exact key version ID used during the operation. + // Some providers (like HSMs) do not have a concept of version IDs. + KeyVersionId *string `protobuf:"bytes,2,opt,name=key_version_id,json=keyVersionId,proto3,oneof" json:"key_version_id,omitempty"` + // OPTIONAL: The Initialization Vector generated by the provider. + // Returned only if the provider generated it and CMK needs to store it. + Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3,oneof" json:"iv,omitempty"` + // OPTIONAL (Map): Vendor-specific metadata. + Metadata map[string]string `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *WrapResponse) Reset() { + *x = WrapResponse{} + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *WrapResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WrapResponse) ProtoMessage() {} + +func (x *WrapResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use WrapResponse.ProtoReflect.Descriptor instead. +func (*WrapResponse) Descriptor() ([]byte, []int) { + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{1} +} + +func (x *WrapResponse) GetCiphertext() []byte { + if x != nil { + return x.Ciphertext + } + return nil +} + +func (x *WrapResponse) GetKeyVersionId() string { + if x != nil && x.KeyVersionId != nil { + return *x.KeyVersionId + } + return "" +} + +func (x *WrapResponse) GetIv() []byte { + if x != nil { + return x.Iv + } + return nil +} + +func (x *WrapResponse) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +// UnwrapRequest contains the opaque ciphertext and the exact parameters +// originally used during the Wrap operation. +type UnwrapRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. + Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` + // REQUIRED: The universal locator for the cryptographic key. + KeyUri string `protobuf:"bytes,2,opt,name=key_uri,json=keyUri,proto3" json:"key_uri,omitempty"` + // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. + Aad []byte `protobuf:"bytes,3,opt,name=aad,proto3,oneof" json:"aad,omitempty"` + // OPTIONAL (Map): Key-Value Encryption Context. + EncryptionContext map[string]string `protobuf:"bytes,4,rep,name=encryption_context,json=encryptionContext,proto3" json:"encryption_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + // OPTIONAL: The explicit cryptographic unwrapping mechanism. + Mechanism *string `protobuf:"bytes,5,opt,name=mechanism,proto3,oneof" json:"mechanism,omitempty"` + // OPTIONAL: Initialization Vector (IV) or Nonce. + // Must be provided if it was returned in the WrapResponse. + Iv []byte `protobuf:"bytes,6,opt,name=iv,proto3,oneof" json:"iv,omitempty"` + // OPTIONAL (Map): Dynamic Configuration Pass-through. + Options map[string]string `protobuf:"bytes,7,rep,name=options,proto3" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnwrapRequest) Reset() { + *x = UnwrapRequest{} + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnwrapRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnwrapRequest) ProtoMessage() {} + +func (x *UnwrapRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnwrapRequest.ProtoReflect.Descriptor instead. +func (*UnwrapRequest) Descriptor() ([]byte, []int) { + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{2} +} + +func (x *UnwrapRequest) GetCiphertext() []byte { + if x != nil { + return x.Ciphertext + } + return nil +} + +func (x *UnwrapRequest) GetKeyUri() string { + if x != nil { + return x.KeyUri + } + return "" +} + +func (x *UnwrapRequest) GetAad() []byte { + if x != nil { + return x.Aad + } + return nil +} + +func (x *UnwrapRequest) GetEncryptionContext() map[string]string { + if x != nil { + return x.EncryptionContext + } + return nil +} + +func (x *UnwrapRequest) GetMechanism() string { + if x != nil && x.Mechanism != nil { + return *x.Mechanism + } + return "" +} + +func (x *UnwrapRequest) GetIv() []byte { + if x != nil { + return x.Iv + } + return nil +} + +func (x *UnwrapRequest) GetOptions() map[string]string { + if x != nil { + return x.Options + } + return nil +} + +// UnwrapResponse returns the recovered raw cryptographic material. +type UnwrapResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: The recovered raw cryptographic material. + Plaintext []byte `protobuf:"bytes,1,opt,name=plaintext,proto3" json:"plaintext,omitempty"` + // OPTIONAL (Map): Vendor-specific metadata. + Metadata map[string]string `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnwrapResponse) Reset() { + *x = UnwrapResponse{} + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnwrapResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnwrapResponse) ProtoMessage() {} + +func (x *UnwrapResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnwrapResponse.ProtoReflect.Descriptor instead. +func (*UnwrapResponse) Descriptor() ([]byte, []int) { + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{3} +} + +func (x *UnwrapResponse) GetPlaintext() []byte { + if x != nil { + return x.Plaintext + } + return nil +} + +func (x *UnwrapResponse) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +var File_plugin_cipher_wrapper_v1_cipher_wrapper_proto protoreflect.FileDescriptor + +const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + + "\n" + + "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x18plugin.cipher_wrapper.v1\"\xed\x03\n" + + "\vWrapRequest\x12\x1c\n" + + "\tplaintext\x18\x01 \x01(\fR\tplaintext\x12\x17\n" + + "\akey_uri\x18\x02 \x01(\tR\x06keyUri\x12\x15\n" + + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12k\n" + + "\x12encryption_context\x18\x04 \x03(\v2<.plugin.cipher_wrapper.v1.WrapRequest.EncryptionContextEntryR\x11encryptionContext\x12!\n" + + "\tmechanism\x18\x05 \x01(\tH\x01R\tmechanism\x88\x01\x01\x12\x13\n" + + "\x02iv\x18\x06 \x01(\fH\x02R\x02iv\x88\x01\x01\x12L\n" + + "\aoptions\x18\a \x03(\v22.plugin.cipher_wrapper.v1.WrapRequest.OptionsEntryR\aoptions\x1aD\n" + + "\x16EncryptionContextEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a:\n" + + "\fOptionsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + + "\x04_aadB\f\n" + + "\n" + + "_mechanismB\x05\n" + + "\x03_iv\"\x97\x02\n" + + "\fWrapResponse\x12\x1e\n" + + "\n" + + "ciphertext\x18\x01 \x01(\fR\n" + + "ciphertext\x12)\n" + + "\x0ekey_version_id\x18\x02 \x01(\tH\x00R\fkeyVersionId\x88\x01\x01\x12\x13\n" + + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12P\n" + + "\bmetadata\x18\x04 \x03(\v24.plugin.cipher_wrapper.v1.WrapResponse.MetadataEntryR\bmetadata\x1a;\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x11\n" + + "\x0f_key_version_idB\x05\n" + + "\x03_iv\"\xf5\x03\n" + + "\rUnwrapRequest\x12\x1e\n" + + "\n" + + "ciphertext\x18\x01 \x01(\fR\n" + + "ciphertext\x12\x17\n" + + "\akey_uri\x18\x02 \x01(\tR\x06keyUri\x12\x15\n" + + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12m\n" + + "\x12encryption_context\x18\x04 \x03(\v2>.plugin.cipher_wrapper.v1.UnwrapRequest.EncryptionContextEntryR\x11encryptionContext\x12!\n" + + "\tmechanism\x18\x05 \x01(\tH\x01R\tmechanism\x88\x01\x01\x12\x13\n" + + "\x02iv\x18\x06 \x01(\fH\x02R\x02iv\x88\x01\x01\x12N\n" + + "\aoptions\x18\a \x03(\v24.plugin.cipher_wrapper.v1.UnwrapRequest.OptionsEntryR\aoptions\x1aD\n" + + "\x16EncryptionContextEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a:\n" + + "\fOptionsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + + "\x04_aadB\f\n" + + "\n" + + "_mechanismB\x05\n" + + "\x03_iv\"\xbf\x01\n" + + "\x0eUnwrapResponse\x12\x1c\n" + + "\tplaintext\x18\x01 \x01(\fR\tplaintext\x12R\n" + + "\bmetadata\x18\x02 \x03(\v26.plugin.cipher_wrapper.v1.UnwrapResponse.MetadataEntryR\bmetadata\x1a;\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x012\xc3\x01\n" + + "\rCipherWrapper\x12U\n" + + "\x04Wrap\x12%.plugin.cipher_wrapper.v1.WrapRequest\x1a&.plugin.cipher_wrapper.v1.WrapResponse\x12[\n" + + "\x06Unwrap\x12'.plugin.cipher_wrapper.v1.UnwrapRequest\x1a(.plugin.cipher_wrapper.v1.UnwrapResponseB\xff\x01\n" + + "\x1ccom.plugin.cipher_wrapper.v1B\x12CipherWrapperProtoP\x01ZMgithub.com/openkcm/plugin-sdk/proto/plugin/cipher_wrapper/v1;cipher_wrapperv1\xa2\x02\x03PCX\xaa\x02\x17Plugin.CipherWrapper.V1\xca\x02\x17Plugin\\CipherWrapper\\V1\xe2\x02#Plugin\\CipherWrapper\\V1\\GPBMetadata\xea\x02\x19Plugin::CipherWrapper::V1b\x06proto3" + +var ( + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescOnce sync.Once + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescData []byte +) + +func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP() []byte { + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescOnce.Do(func() { + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc), len(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc))) + }) + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescData +} + +var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_goTypes = []any{ + (*WrapRequest)(nil), // 0: plugin.cipher_wrapper.v1.WrapRequest + (*WrapResponse)(nil), // 1: plugin.cipher_wrapper.v1.WrapResponse + (*UnwrapRequest)(nil), // 2: plugin.cipher_wrapper.v1.UnwrapRequest + (*UnwrapResponse)(nil), // 3: plugin.cipher_wrapper.v1.UnwrapResponse + nil, // 4: plugin.cipher_wrapper.v1.WrapRequest.EncryptionContextEntry + nil, // 5: plugin.cipher_wrapper.v1.WrapRequest.OptionsEntry + nil, // 6: plugin.cipher_wrapper.v1.WrapResponse.MetadataEntry + nil, // 7: plugin.cipher_wrapper.v1.UnwrapRequest.EncryptionContextEntry + nil, // 8: plugin.cipher_wrapper.v1.UnwrapRequest.OptionsEntry + nil, // 9: plugin.cipher_wrapper.v1.UnwrapResponse.MetadataEntry +} +var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_depIdxs = []int32{ + 4, // 0: plugin.cipher_wrapper.v1.WrapRequest.encryption_context:type_name -> plugin.cipher_wrapper.v1.WrapRequest.EncryptionContextEntry + 5, // 1: plugin.cipher_wrapper.v1.WrapRequest.options:type_name -> plugin.cipher_wrapper.v1.WrapRequest.OptionsEntry + 6, // 2: plugin.cipher_wrapper.v1.WrapResponse.metadata:type_name -> plugin.cipher_wrapper.v1.WrapResponse.MetadataEntry + 7, // 3: plugin.cipher_wrapper.v1.UnwrapRequest.encryption_context:type_name -> plugin.cipher_wrapper.v1.UnwrapRequest.EncryptionContextEntry + 8, // 4: plugin.cipher_wrapper.v1.UnwrapRequest.options:type_name -> plugin.cipher_wrapper.v1.UnwrapRequest.OptionsEntry + 9, // 5: plugin.cipher_wrapper.v1.UnwrapResponse.metadata:type_name -> plugin.cipher_wrapper.v1.UnwrapResponse.MetadataEntry + 0, // 6: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> plugin.cipher_wrapper.v1.WrapRequest + 2, // 7: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> plugin.cipher_wrapper.v1.UnwrapRequest + 1, // 8: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> plugin.cipher_wrapper.v1.WrapResponse + 3, // 9: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> plugin.cipher_wrapper.v1.UnwrapResponse + 8, // [8:10] is the sub-list for method output_type + 6, // [6:8] 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_plugin_cipher_wrapper_v1_cipher_wrapper_proto_init() } +func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_init() { + if File_plugin_cipher_wrapper_v1_cipher_wrapper_proto != nil { + return + } + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[0].OneofWrappers = []any{} + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1].OneofWrappers = []any{} + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc), len(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc)), + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_goTypes, + DependencyIndexes: file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_depIdxs, + MessageInfos: file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes, + }.Build() + File_plugin_cipher_wrapper_v1_cipher_wrapper_proto = out.File + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_goTypes = nil + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_depIdxs = nil +} diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go new file mode 100644 index 0000000..9f93709 --- /dev/null +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go @@ -0,0 +1,490 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: plugin/cipher_wrapper/v1/cipher_wrapper.proto + +package cipher_wrapperv1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on WrapRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *WrapRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WrapRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in WrapRequestMultiError, or +// nil if none found. +func (m *WrapRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *WrapRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Plaintext + + // no validation rules for KeyUri + + // no validation rules for EncryptionContext + + // no validation rules for Options + + if m.Aad != nil { + // no validation rules for Aad + } + + if m.Mechanism != nil { + // no validation rules for Mechanism + } + + if m.Iv != nil { + // no validation rules for Iv + } + + if len(errors) > 0 { + return WrapRequestMultiError(errors) + } + + return nil +} + +// WrapRequestMultiError is an error wrapping multiple validation errors +// returned by WrapRequest.ValidateAll() if the designated constraints aren't met. +type WrapRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WrapRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WrapRequestMultiError) AllErrors() []error { return m } + +// WrapRequestValidationError is the validation error returned by +// WrapRequest.Validate if the designated constraints aren't met. +type WrapRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e WrapRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e WrapRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e WrapRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e WrapRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e WrapRequestValidationError) ErrorName() string { return "WrapRequestValidationError" } + +// Error satisfies the builtin error interface +func (e WrapRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sWrapRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = WrapRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = WrapRequestValidationError{} + +// Validate checks the field values on WrapResponse with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *WrapResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on WrapResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in WrapResponseMultiError, or +// nil if none found. +func (m *WrapResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *WrapResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Ciphertext + + // no validation rules for Metadata + + if m.KeyVersionId != nil { + // no validation rules for KeyVersionId + } + + if m.Iv != nil { + // no validation rules for Iv + } + + if len(errors) > 0 { + return WrapResponseMultiError(errors) + } + + return nil +} + +// WrapResponseMultiError is an error wrapping multiple validation errors +// returned by WrapResponse.ValidateAll() if the designated constraints aren't met. +type WrapResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m WrapResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m WrapResponseMultiError) AllErrors() []error { return m } + +// WrapResponseValidationError is the validation error returned by +// WrapResponse.Validate if the designated constraints aren't met. +type WrapResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e WrapResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e WrapResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e WrapResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e WrapResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e WrapResponseValidationError) ErrorName() string { return "WrapResponseValidationError" } + +// Error satisfies the builtin error interface +func (e WrapResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sWrapResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = WrapResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = WrapResponseValidationError{} + +// Validate checks the field values on UnwrapRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *UnwrapRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UnwrapRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in UnwrapRequestMultiError, or +// nil if none found. +func (m *UnwrapRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *UnwrapRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Ciphertext + + // no validation rules for KeyUri + + // no validation rules for EncryptionContext + + // no validation rules for Options + + if m.Aad != nil { + // no validation rules for Aad + } + + if m.Mechanism != nil { + // no validation rules for Mechanism + } + + if m.Iv != nil { + // no validation rules for Iv + } + + if len(errors) > 0 { + return UnwrapRequestMultiError(errors) + } + + return nil +} + +// UnwrapRequestMultiError is an error wrapping multiple validation errors +// returned by UnwrapRequest.ValidateAll() if the designated constraints +// aren't met. +type UnwrapRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UnwrapRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UnwrapRequestMultiError) AllErrors() []error { return m } + +// UnwrapRequestValidationError is the validation error returned by +// UnwrapRequest.Validate if the designated constraints aren't met. +type UnwrapRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UnwrapRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UnwrapRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UnwrapRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UnwrapRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UnwrapRequestValidationError) ErrorName() string { return "UnwrapRequestValidationError" } + +// Error satisfies the builtin error interface +func (e UnwrapRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUnwrapRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UnwrapRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UnwrapRequestValidationError{} + +// Validate checks the field values on UnwrapResponse with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *UnwrapResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on UnwrapResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in UnwrapResponseMultiError, +// or nil if none found. +func (m *UnwrapResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *UnwrapResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Plaintext + + // no validation rules for Metadata + + if len(errors) > 0 { + return UnwrapResponseMultiError(errors) + } + + return nil +} + +// UnwrapResponseMultiError is an error wrapping multiple validation errors +// returned by UnwrapResponse.ValidateAll() if the designated constraints +// aren't met. +type UnwrapResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m UnwrapResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m UnwrapResponseMultiError) AllErrors() []error { return m } + +// UnwrapResponseValidationError is the validation error returned by +// UnwrapResponse.Validate if the designated constraints aren't met. +type UnwrapResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e UnwrapResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e UnwrapResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e UnwrapResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e UnwrapResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e UnwrapResponseValidationError) ErrorName() string { return "UnwrapResponseValidationError" } + +// Error satisfies the builtin error interface +func (e UnwrapResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sUnwrapResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = UnwrapResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = UnwrapResponseValidationError{} diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto new file mode 100644 index 0000000..d3a0553 --- /dev/null +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto @@ -0,0 +1,96 @@ +syntax = "proto3"; + +package plugin.cipher_wrapper.v1; + +// KeyWrapper defines the universal envelope encryption interface for CMK. +// It allows the core engine to delegate cryptographic wrapping and unwrapping +// to any external provider (AWS KMS, Google Cloud KMS, Azure Key Vault, +// HashiCorp Vault, or hardware HSMs via PKCS#11) over a local gRPC socket. +service CipherWrapper { + // Wrap encrypts the provided plaintext using the remote KMS provider. + rpc Wrap(WrapRequest) returns (WrapResponse); + + // Unwrap decrypts the provided ciphertext using the remote KMS provider, + // returning the raw plaintext key material. + rpc Unwrap(UnwrapRequest) returns (UnwrapResponse); +} + +// WrapRequest contains the raw key material and the context needed to encrypt it. +message WrapRequest { + // REQUIRED: The raw cryptographic material to be wrapped. + bytes plaintext = 1; + + // REQUIRED: The universal locator for the cryptographic key (ARN, URI, or Path). + string key_uri = 2; + + // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. + // Explicitly marked optional so the Go plugin can check `if req.Aad != nil`. + optional bytes aad = 3; + + // OPTIONAL (Map): Key-Value Encryption Context (used by AWS/GCP/Alibaba). + // Maps cannot use the 'optional' keyword in proto3, but are implicitly optional. + map encryption_context = 4; + + // OPTIONAL: The explicit cryptographic wrapping mechanism (e.g., "RSA-OAEP-256"). + // Required for Azure and HSMs, safely omitted for AWS/Vault. + optional string mechanism = 5; + + // OPTIONAL: Initialization Vector (IV) or Nonce. + // Provided only if the CMK core is dictating the IV to an HSM. + optional bytes iv = 6; + + // OPTIONAL (Map): Dynamic Configuration Pass-through. + map options = 7; +} + +// WrapResponse returns the provider-specific ciphertext and metadata. +message WrapResponse { + // REQUIRED: The opaque, vendor-specific ciphertext. + bytes ciphertext = 1; + + // OPTIONAL: The exact key version ID used during the operation. + // Some providers (like HSMs) do not have a concept of version IDs. + optional string key_version_id = 2; + + // OPTIONAL: The Initialization Vector generated by the provider. + // Returned only if the provider generated it and CMK needs to store it. + optional bytes iv = 3; + + // OPTIONAL (Map): Vendor-specific metadata. + map metadata = 4; +} + +// UnwrapRequest contains the opaque ciphertext and the exact parameters +// originally used during the Wrap operation. +message UnwrapRequest { + // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. + bytes ciphertext = 1; + + // REQUIRED: The universal locator for the cryptographic key. + string key_uri = 2; + + // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. + optional bytes aad = 3; + + // OPTIONAL (Map): Key-Value Encryption Context. + map encryption_context = 4; + + // OPTIONAL: The explicit cryptographic unwrapping mechanism. + optional string mechanism = 5; + + // OPTIONAL: Initialization Vector (IV) or Nonce. + // Must be provided if it was returned in the WrapResponse. + optional bytes iv = 6; + + // OPTIONAL (Map): Dynamic Configuration Pass-through. + map options = 7; +} + +// UnwrapResponse returns the recovered raw cryptographic material. +message UnwrapResponse { + // REQUIRED: The recovered raw cryptographic material. + bytes plaintext = 1; + + // OPTIONAL (Map): Vendor-specific metadata. + map metadata = 2; +} diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go new file mode 100644 index 0000000..eebbf6a --- /dev/null +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go @@ -0,0 +1,56 @@ +// Code generated by protoc-gen-go-extension. DO NOT EDIT. + +package cipher_wrapperv1 + +import ( + grpc "google.golang.org/grpc" + + api "github.com/openkcm/plugin-sdk/api" +) + +const ( + Type = "CipherWrapper" + GRPCServiceFullName = "plugin.cipher_wrapper.v1.CipherWrapper" +) + +func CipherWrapperPluginServer(server CipherWrapperServer) api.PluginServer { + return cipherWrapperPluginServer{CipherWrapperServer: server} +} + +type cipherWrapperPluginServer struct { + CipherWrapperServer +} + +func (s cipherWrapperPluginServer) Type() string { + return Type +} + +func (s cipherWrapperPluginServer) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (s cipherWrapperPluginServer) RegisterServer(server *grpc.Server) any { + RegisterCipherWrapperServer(server, s.CipherWrapperServer) + return s.CipherWrapperServer +} + +type CipherWrapperPluginClient struct { + CipherWrapperClient +} + +func (s CipherWrapperPluginClient) Type() string { + return Type +} + +func (c *CipherWrapperPluginClient) IsInitialized() bool { + return c.CipherWrapperClient != nil +} + +func (c *CipherWrapperPluginClient) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (c *CipherWrapperPluginClient) InitClient(conn grpc.ClientConnInterface) any { + c.CipherWrapperClient = NewCipherWrapperClient(conn) + return c.CipherWrapperClient +} diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go new file mode 100644 index 0000000..197aeba --- /dev/null +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go @@ -0,0 +1,176 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc (unknown) +// source: plugin/cipher_wrapper/v1/cipher_wrapper.proto + +package cipher_wrapperv1 + +import ( + context "context" + + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + CipherWrapper_Wrap_FullMethodName = "/plugin.cipher_wrapper.v1.CipherWrapper/Wrap" + CipherWrapper_Unwrap_FullMethodName = "/plugin.cipher_wrapper.v1.CipherWrapper/Unwrap" +) + +// CipherWrapperClient is the client API for CipherWrapper service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// KeyWrapper defines the universal envelope encryption interface for CMK. +// It allows the core engine to delegate cryptographic wrapping and unwrapping +// to any external provider (AWS KMS, Google Cloud KMS, Azure Key Vault, +// HashiCorp Vault, or hardware HSMs via PKCS#11) over a local gRPC socket. +type CipherWrapperClient interface { + // Wrap encrypts the provided plaintext using the remote KMS provider. + Wrap(ctx context.Context, in *WrapRequest, opts ...grpc.CallOption) (*WrapResponse, error) + // Unwrap decrypts the provided ciphertext using the remote KMS provider, + // returning the raw plaintext key material. + Unwrap(ctx context.Context, in *UnwrapRequest, opts ...grpc.CallOption) (*UnwrapResponse, error) +} + +type cipherWrapperClient struct { + cc grpc.ClientConnInterface +} + +func NewCipherWrapperClient(cc grpc.ClientConnInterface) CipherWrapperClient { + return &cipherWrapperClient{cc} +} + +func (c *cipherWrapperClient) Wrap(ctx context.Context, in *WrapRequest, opts ...grpc.CallOption) (*WrapResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(WrapResponse) + err := c.cc.Invoke(ctx, CipherWrapper_Wrap_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *cipherWrapperClient) Unwrap(ctx context.Context, in *UnwrapRequest, opts ...grpc.CallOption) (*UnwrapResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UnwrapResponse) + err := c.cc.Invoke(ctx, CipherWrapper_Unwrap_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// CipherWrapperServer is the server API for CipherWrapper service. +// All implementations must embed UnimplementedCipherWrapperServer +// for forward compatibility. +// +// KeyWrapper defines the universal envelope encryption interface for CMK. +// It allows the core engine to delegate cryptographic wrapping and unwrapping +// to any external provider (AWS KMS, Google Cloud KMS, Azure Key Vault, +// HashiCorp Vault, or hardware HSMs via PKCS#11) over a local gRPC socket. +type CipherWrapperServer interface { + // Wrap encrypts the provided plaintext using the remote KMS provider. + Wrap(context.Context, *WrapRequest) (*WrapResponse, error) + // Unwrap decrypts the provided ciphertext using the remote KMS provider, + // returning the raw plaintext key material. + Unwrap(context.Context, *UnwrapRequest) (*UnwrapResponse, error) + mustEmbedUnimplementedCipherWrapperServer() +} + +// UnimplementedCipherWrapperServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedCipherWrapperServer struct{} + +func (UnimplementedCipherWrapperServer) Wrap(context.Context, *WrapRequest) (*WrapResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Wrap not implemented") +} +func (UnimplementedCipherWrapperServer) Unwrap(context.Context, *UnwrapRequest) (*UnwrapResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Unwrap not implemented") +} +func (UnimplementedCipherWrapperServer) mustEmbedUnimplementedCipherWrapperServer() {} +func (UnimplementedCipherWrapperServer) testEmbeddedByValue() {} + +// UnsafeCipherWrapperServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to CipherWrapperServer will +// result in compilation errors. +type UnsafeCipherWrapperServer interface { + mustEmbedUnimplementedCipherWrapperServer() +} + +func RegisterCipherWrapperServer(s grpc.ServiceRegistrar, srv CipherWrapperServer) { + // If the following call panics, it indicates UnimplementedCipherWrapperServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&CipherWrapper_ServiceDesc, srv) +} + +func _CipherWrapper_Wrap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(WrapRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CipherWrapperServer).Wrap(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CipherWrapper_Wrap_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CipherWrapperServer).Wrap(ctx, req.(*WrapRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CipherWrapper_Unwrap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UnwrapRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CipherWrapperServer).Unwrap(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CipherWrapper_Unwrap_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CipherWrapperServer).Unwrap(ctx, req.(*UnwrapRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// CipherWrapper_ServiceDesc is the grpc.ServiceDesc for CipherWrapper service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var CipherWrapper_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "plugin.cipher_wrapper.v1.CipherWrapper", + HandlerType: (*CipherWrapperServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Wrap", + Handler: _CipherWrapper_Wrap_Handler, + }, + { + MethodName: "Unwrap", + Handler: _CipherWrapper_Unwrap_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "plugin/cipher_wrapper/v1/cipher_wrapper.proto", +} From bedac885bd69f0ad157ec70016ce2669255a471b Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Wed, 11 Mar 2026 20:41:24 +0100 Subject: [PATCH 02/27] add tags for PluginConfig --- pkg/catalog/plugin.go | 47 +++++++++++++------------------------------ 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/pkg/catalog/plugin.go b/pkg/catalog/plugin.go index 4343dca..e3dbc47 100644 --- a/pkg/catalog/plugin.go +++ b/pkg/catalog/plugin.go @@ -24,40 +24,21 @@ import ( type PluginConfigs []PluginConfig type PluginConfig struct { - // Name of the plugin - Name string - - // Type is the plugin type - Type string - - // Path is the path on disk to the plugin. - Path string - - // Args are the command line arguments to supply to the plugin - Args []string - - // Env is the environment variables to supply to the plugin - Env map[string]string - - // Checksum is the hex-encoded SHA256 hash of the plugin binary. - Checksum string - - Version uint32 - - DataSource DataSource - - YamlConfiguration string - - LogLevel string - - Disabled bool - - Logger *slog.Logger - + Name string `yaml:"name" json:"name"` + Type string `yaml:"type" json:"type"` + Path string `yaml:"path" json:"path"` + Args []string `yaml:"args" json:"args"` + Env map[string]string `yaml:"env" json:"env"` + Checksum string `yaml:"checksum" json:"checksum"` + Version uint32 `yaml:"version" json:"version"` + YamlConfiguration string `yaml:"yamlConfiguration" json:"yamlConfiguration"` + LogLevel string `yaml:"logLevel" json:"logLevel"` + Disabled bool `yaml:"disabled" json:"disabled"` + Tags []string `yaml:"tags" json:"tags"` + + Logger *slog.Logger + DataSource DataSource HostServices []api.ServiceServer - - // Tags are the metadata associated with a plugin these can be used to filter plugins later e.g. ['FeatureA'] on client side. - Tags []string } func (c *PluginConfig) IsExternal() bool { From 3f56f302e43123dd5f404b9a6b035b7849de1db1 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Wed, 11 Mar 2026 21:11:33 +0100 Subject: [PATCH 03/27] update the proto --- .../cipher_wrapper/v1/cipher_wrapper.pb.go | 214 +++++------------- .../v1/cipher_wrapper.pb.validate.go | 24 +- .../cipher_wrapper/v1/cipher_wrapper.proto | 48 +--- 3 files changed, 69 insertions(+), 217 deletions(-) diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go index 3a1e966..229fedc 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go @@ -27,24 +27,17 @@ type WrapRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // REQUIRED: The raw cryptographic material to be wrapped. Plaintext []byte `protobuf:"bytes,1,opt,name=plaintext,proto3" json:"plaintext,omitempty"` - // REQUIRED: The universal locator for the cryptographic key (ARN, URI, or Path). - KeyUri string `protobuf:"bytes,2,opt,name=key_uri,json=keyUri,proto3" json:"key_uri,omitempty"` // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. - // Explicitly marked optional so the Go plugin can check `if req.Aad != nil`. - Aad []byte `protobuf:"bytes,3,opt,name=aad,proto3,oneof" json:"aad,omitempty"` - // OPTIONAL (Map): Key-Value Encryption Context (used by AWS/GCP/Alibaba). - // Maps cannot use the 'optional' keyword in proto3, but are implicitly optional. - EncryptionContext map[string]string `protobuf:"bytes,4,rep,name=encryption_context,json=encryptionContext,proto3" json:"encryption_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - // OPTIONAL: The explicit cryptographic wrapping mechanism (e.g., "RSA-OAEP-256"). - // Required for Azure and HSMs, safely omitted for AWS/Vault. - Mechanism *string `protobuf:"bytes,5,opt,name=mechanism,proto3,oneof" json:"mechanism,omitempty"` + // Kept in proto because AAD often changes per request (e.g., binding to a specific Tenant ID). + Aad []byte `protobuf:"bytes,2,opt,name=aad,proto3,oneof" json:"aad,omitempty"` // OPTIONAL: Initialization Vector (IV) or Nonce. - // Provided only if the CMK core is dictating the IV to an HSM. - Iv []byte `protobuf:"bytes,6,opt,name=iv,proto3,oneof" json:"iv,omitempty"` - // OPTIONAL (Map): Dynamic Configuration Pass-through. - Options map[string]string `protobuf:"bytes,7,rep,name=options,proto3" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // Cryptographically dynamic, must remain in proto. + Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3,oneof" json:"iv,omitempty"` + // OPTIONAL: Per-request dynamic context (if needed). + // Kept as an escape hatch for truly dynamic per-request overrides. + DynamicContext map[string]string `protobuf:"bytes,900,rep,name=dynamic_context,json=dynamicContext,proto3" json:"dynamic_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *WrapRequest) Reset() { @@ -84,13 +77,6 @@ func (x *WrapRequest) GetPlaintext() []byte { return nil } -func (x *WrapRequest) GetKeyUri() string { - if x != nil { - return x.KeyUri - } - return "" -} - func (x *WrapRequest) GetAad() []byte { if x != nil { return x.Aad @@ -98,20 +84,6 @@ func (x *WrapRequest) GetAad() []byte { return nil } -func (x *WrapRequest) GetEncryptionContext() map[string]string { - if x != nil { - return x.EncryptionContext - } - return nil -} - -func (x *WrapRequest) GetMechanism() string { - if x != nil && x.Mechanism != nil { - return *x.Mechanism - } - return "" -} - func (x *WrapRequest) GetIv() []byte { if x != nil { return x.Iv @@ -119,9 +91,9 @@ func (x *WrapRequest) GetIv() []byte { return nil } -func (x *WrapRequest) GetOptions() map[string]string { +func (x *WrapRequest) GetDynamicContext() map[string]string { if x != nil { - return x.Options + return x.DynamicContext } return nil } @@ -136,9 +108,7 @@ type WrapResponse struct { KeyVersionId *string `protobuf:"bytes,2,opt,name=key_version_id,json=keyVersionId,proto3,oneof" json:"key_version_id,omitempty"` // OPTIONAL: The Initialization Vector generated by the provider. // Returned only if the provider generated it and CMK needs to store it. - Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3,oneof" json:"iv,omitempty"` - // OPTIONAL (Map): Vendor-specific metadata. - Metadata map[string]string `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3,oneof" json:"iv,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -194,34 +164,22 @@ func (x *WrapResponse) GetIv() []byte { return nil } -func (x *WrapResponse) GetMetadata() map[string]string { - if x != nil { - return x.Metadata - } - return nil -} - // UnwrapRequest contains the opaque ciphertext and the exact parameters // originally used during the Wrap operation. type UnwrapRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` - // REQUIRED: The universal locator for the cryptographic key. - KeyUri string `protobuf:"bytes,2,opt,name=key_uri,json=keyUri,proto3" json:"key_uri,omitempty"` // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. - Aad []byte `protobuf:"bytes,3,opt,name=aad,proto3,oneof" json:"aad,omitempty"` - // OPTIONAL (Map): Key-Value Encryption Context. - EncryptionContext map[string]string `protobuf:"bytes,4,rep,name=encryption_context,json=encryptionContext,proto3" json:"encryption_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - // OPTIONAL: The explicit cryptographic unwrapping mechanism. - Mechanism *string `protobuf:"bytes,5,opt,name=mechanism,proto3,oneof" json:"mechanism,omitempty"` + Aad []byte `protobuf:"bytes,2,opt,name=aad,proto3,oneof" json:"aad,omitempty"` // OPTIONAL: Initialization Vector (IV) or Nonce. // Must be provided if it was returned in the WrapResponse. - Iv []byte `protobuf:"bytes,6,opt,name=iv,proto3,oneof" json:"iv,omitempty"` - // OPTIONAL (Map): Dynamic Configuration Pass-through. - Options map[string]string `protobuf:"bytes,7,rep,name=options,proto3" json:"options,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3,oneof" json:"iv,omitempty"` + // OPTIONAL: Per-request dynamic context (if needed). + // Kept as an escape hatch for truly dynamic per-request overrides. + DynamicContext map[string]string `protobuf:"bytes,900,rep,name=dynamic_context,json=dynamicContext,proto3" json:"dynamic_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UnwrapRequest) Reset() { @@ -261,13 +219,6 @@ func (x *UnwrapRequest) GetCiphertext() []byte { return nil } -func (x *UnwrapRequest) GetKeyUri() string { - if x != nil { - return x.KeyUri - } - return "" -} - func (x *UnwrapRequest) GetAad() []byte { if x != nil { return x.Aad @@ -275,20 +226,6 @@ func (x *UnwrapRequest) GetAad() []byte { return nil } -func (x *UnwrapRequest) GetEncryptionContext() map[string]string { - if x != nil { - return x.EncryptionContext - } - return nil -} - -func (x *UnwrapRequest) GetMechanism() string { - if x != nil && x.Mechanism != nil { - return *x.Mechanism - } - return "" -} - func (x *UnwrapRequest) GetIv() []byte { if x != nil { return x.Iv @@ -296,9 +233,9 @@ func (x *UnwrapRequest) GetIv() []byte { return nil } -func (x *UnwrapRequest) GetOptions() map[string]string { +func (x *UnwrapRequest) GetDynamicContext() map[string]string { if x != nil { - return x.Options + return x.DynamicContext } return nil } @@ -307,9 +244,7 @@ func (x *UnwrapRequest) GetOptions() map[string]string { type UnwrapResponse struct { state protoimpl.MessageState `protogen:"open.v1"` // REQUIRED: The recovered raw cryptographic material. - Plaintext []byte `protobuf:"bytes,1,opt,name=plaintext,proto3" json:"plaintext,omitempty"` - // OPTIONAL (Map): Vendor-specific metadata. - Metadata map[string]string `protobuf:"bytes,2,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Plaintext []byte `protobuf:"bytes,1,opt,name=plaintext,proto3" json:"plaintext,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -351,74 +286,43 @@ func (x *UnwrapResponse) GetPlaintext() []byte { return nil } -func (x *UnwrapResponse) GetMetadata() map[string]string { - if x != nil { - return x.Metadata - } - return nil -} - var File_plugin_cipher_wrapper_v1_cipher_wrapper_proto protoreflect.FileDescriptor const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\n" + - "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x18plugin.cipher_wrapper.v1\"\xed\x03\n" + + "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x18plugin.cipher_wrapper.v1\"\x8e\x02\n" + "\vWrapRequest\x12\x1c\n" + - "\tplaintext\x18\x01 \x01(\fR\tplaintext\x12\x17\n" + - "\akey_uri\x18\x02 \x01(\tR\x06keyUri\x12\x15\n" + - "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12k\n" + - "\x12encryption_context\x18\x04 \x03(\v2<.plugin.cipher_wrapper.v1.WrapRequest.EncryptionContextEntryR\x11encryptionContext\x12!\n" + - "\tmechanism\x18\x05 \x01(\tH\x01R\tmechanism\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x06 \x01(\fH\x02R\x02iv\x88\x01\x01\x12L\n" + - "\aoptions\x18\a \x03(\v22.plugin.cipher_wrapper.v1.WrapRequest.OptionsEntryR\aoptions\x1aD\n" + - "\x16EncryptionContextEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a:\n" + - "\fOptionsEntry\x12\x10\n" + + "\tplaintext\x18\x01 \x01(\fR\tplaintext\x12\x15\n" + + "\x03aad\x18\x02 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12c\n" + + "\x0fdynamic_context\x18\x84\a \x03(\v29.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + + "\x13DynamicContextEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + - "\x04_aadB\f\n" + - "\n" + - "_mechanismB\x05\n" + - "\x03_iv\"\x97\x02\n" + + "\x04_aadB\x05\n" + + "\x03_iv\"\x88\x01\n" + "\fWrapResponse\x12\x1e\n" + "\n" + "ciphertext\x18\x01 \x01(\fR\n" + "ciphertext\x12)\n" + "\x0ekey_version_id\x18\x02 \x01(\tH\x00R\fkeyVersionId\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12P\n" + - "\bmetadata\x18\x04 \x03(\v24.plugin.cipher_wrapper.v1.WrapResponse.MetadataEntryR\bmetadata\x1a;\n" + - "\rMetadataEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x11\n" + + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01B\x11\n" + "\x0f_key_version_idB\x05\n" + - "\x03_iv\"\xf5\x03\n" + + "\x03_iv\"\x94\x02\n" + "\rUnwrapRequest\x12\x1e\n" + "\n" + "ciphertext\x18\x01 \x01(\fR\n" + - "ciphertext\x12\x17\n" + - "\akey_uri\x18\x02 \x01(\tR\x06keyUri\x12\x15\n" + - "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12m\n" + - "\x12encryption_context\x18\x04 \x03(\v2>.plugin.cipher_wrapper.v1.UnwrapRequest.EncryptionContextEntryR\x11encryptionContext\x12!\n" + - "\tmechanism\x18\x05 \x01(\tH\x01R\tmechanism\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x06 \x01(\fH\x02R\x02iv\x88\x01\x01\x12N\n" + - "\aoptions\x18\a \x03(\v24.plugin.cipher_wrapper.v1.UnwrapRequest.OptionsEntryR\aoptions\x1aD\n" + - "\x16EncryptionContextEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a:\n" + - "\fOptionsEntry\x12\x10\n" + + "ciphertext\x12\x15\n" + + "\x03aad\x18\x02 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12e\n" + + "\x0fdynamic_context\x18\x84\a \x03(\v2;.plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + + "\x13DynamicContextEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + - "\x04_aadB\f\n" + - "\n" + - "_mechanismB\x05\n" + - "\x03_iv\"\xbf\x01\n" + + "\x04_aadB\x05\n" + + "\x03_iv\".\n" + "\x0eUnwrapResponse\x12\x1c\n" + - "\tplaintext\x18\x01 \x01(\fR\tplaintext\x12R\n" + - "\bmetadata\x18\x02 \x03(\v26.plugin.cipher_wrapper.v1.UnwrapResponse.MetadataEntryR\bmetadata\x1a;\n" + - "\rMetadataEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x012\xc3\x01\n" + + "\tplaintext\x18\x01 \x01(\fR\tplaintext2\xc3\x01\n" + "\rCipherWrapper\x12U\n" + "\x04Wrap\x12%.plugin.cipher_wrapper.v1.WrapRequest\x1a&.plugin.cipher_wrapper.v1.WrapResponse\x12[\n" + "\x06Unwrap\x12'.plugin.cipher_wrapper.v1.UnwrapRequest\x1a(.plugin.cipher_wrapper.v1.UnwrapResponseB\xff\x01\n" + @@ -436,35 +340,27 @@ func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP() []byte { return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescData } -var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_goTypes = []any{ (*WrapRequest)(nil), // 0: plugin.cipher_wrapper.v1.WrapRequest (*WrapResponse)(nil), // 1: plugin.cipher_wrapper.v1.WrapResponse (*UnwrapRequest)(nil), // 2: plugin.cipher_wrapper.v1.UnwrapRequest (*UnwrapResponse)(nil), // 3: plugin.cipher_wrapper.v1.UnwrapResponse - nil, // 4: plugin.cipher_wrapper.v1.WrapRequest.EncryptionContextEntry - nil, // 5: plugin.cipher_wrapper.v1.WrapRequest.OptionsEntry - nil, // 6: plugin.cipher_wrapper.v1.WrapResponse.MetadataEntry - nil, // 7: plugin.cipher_wrapper.v1.UnwrapRequest.EncryptionContextEntry - nil, // 8: plugin.cipher_wrapper.v1.UnwrapRequest.OptionsEntry - nil, // 9: plugin.cipher_wrapper.v1.UnwrapResponse.MetadataEntry + nil, // 4: plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry + nil, // 5: plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry } var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_depIdxs = []int32{ - 4, // 0: plugin.cipher_wrapper.v1.WrapRequest.encryption_context:type_name -> plugin.cipher_wrapper.v1.WrapRequest.EncryptionContextEntry - 5, // 1: plugin.cipher_wrapper.v1.WrapRequest.options:type_name -> plugin.cipher_wrapper.v1.WrapRequest.OptionsEntry - 6, // 2: plugin.cipher_wrapper.v1.WrapResponse.metadata:type_name -> plugin.cipher_wrapper.v1.WrapResponse.MetadataEntry - 7, // 3: plugin.cipher_wrapper.v1.UnwrapRequest.encryption_context:type_name -> plugin.cipher_wrapper.v1.UnwrapRequest.EncryptionContextEntry - 8, // 4: plugin.cipher_wrapper.v1.UnwrapRequest.options:type_name -> plugin.cipher_wrapper.v1.UnwrapRequest.OptionsEntry - 9, // 5: plugin.cipher_wrapper.v1.UnwrapResponse.metadata:type_name -> plugin.cipher_wrapper.v1.UnwrapResponse.MetadataEntry - 0, // 6: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> plugin.cipher_wrapper.v1.WrapRequest - 2, // 7: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> plugin.cipher_wrapper.v1.UnwrapRequest - 1, // 8: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> plugin.cipher_wrapper.v1.WrapResponse - 3, // 9: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> plugin.cipher_wrapper.v1.UnwrapResponse - 8, // [8:10] is the sub-list for method output_type - 6, // [6:8] 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 + 4, // 0: plugin.cipher_wrapper.v1.WrapRequest.dynamic_context:type_name -> plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry + 5, // 1: plugin.cipher_wrapper.v1.UnwrapRequest.dynamic_context:type_name -> plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry + 0, // 2: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> plugin.cipher_wrapper.v1.WrapRequest + 2, // 3: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> plugin.cipher_wrapper.v1.UnwrapRequest + 1, // 4: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> plugin.cipher_wrapper.v1.WrapResponse + 3, // 5: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> plugin.cipher_wrapper.v1.UnwrapResponse + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_init() } @@ -481,7 +377,7 @@ func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc), len(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc)), NumEnums: 0, - NumMessages: 10, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go index 9f93709..a7926e3 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go @@ -59,20 +59,12 @@ func (m *WrapRequest) validate(all bool) error { // no validation rules for Plaintext - // no validation rules for KeyUri - - // no validation rules for EncryptionContext - - // no validation rules for Options + // no validation rules for DynamicContext if m.Aad != nil { // no validation rules for Aad } - if m.Mechanism != nil { - // no validation rules for Mechanism - } - if m.Iv != nil { // no validation rules for Iv } @@ -178,8 +170,6 @@ func (m *WrapResponse) validate(all bool) error { // no validation rules for Ciphertext - // no validation rules for Metadata - if m.KeyVersionId != nil { // no validation rules for KeyVersionId } @@ -289,20 +279,12 @@ func (m *UnwrapRequest) validate(all bool) error { // no validation rules for Ciphertext - // no validation rules for KeyUri - - // no validation rules for EncryptionContext - - // no validation rules for Options + // no validation rules for DynamicContext if m.Aad != nil { // no validation rules for Aad } - if m.Mechanism != nil { - // no validation rules for Mechanism - } - if m.Iv != nil { // no validation rules for Iv } @@ -409,8 +391,6 @@ func (m *UnwrapResponse) validate(all bool) error { // no validation rules for Plaintext - // no validation rules for Metadata - if len(errors) > 0 { return UnwrapResponseMultiError(errors) } diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto index d3a0553..b33ce84 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto @@ -20,27 +20,17 @@ message WrapRequest { // REQUIRED: The raw cryptographic material to be wrapped. bytes plaintext = 1; - // REQUIRED: The universal locator for the cryptographic key (ARN, URI, or Path). - string key_uri = 2; - // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. - // Explicitly marked optional so the Go plugin can check `if req.Aad != nil`. - optional bytes aad = 3; - - // OPTIONAL (Map): Key-Value Encryption Context (used by AWS/GCP/Alibaba). - // Maps cannot use the 'optional' keyword in proto3, but are implicitly optional. - map encryption_context = 4; - - // OPTIONAL: The explicit cryptographic wrapping mechanism (e.g., "RSA-OAEP-256"). - // Required for Azure and HSMs, safely omitted for AWS/Vault. - optional string mechanism = 5; + // Kept in proto because AAD often changes per request (e.g., binding to a specific Tenant ID). + optional bytes aad = 2; // OPTIONAL: Initialization Vector (IV) or Nonce. - // Provided only if the CMK core is dictating the IV to an HSM. - optional bytes iv = 6; + // Cryptographically dynamic, must remain in proto. + optional bytes iv = 3; - // OPTIONAL (Map): Dynamic Configuration Pass-through. - map options = 7; + // OPTIONAL: Per-request dynamic context (if needed). + // Kept as an escape hatch for truly dynamic per-request overrides. + map dynamic_context = 900; } // WrapResponse returns the provider-specific ciphertext and metadata. @@ -55,9 +45,6 @@ message WrapResponse { // OPTIONAL: The Initialization Vector generated by the provider. // Returned only if the provider generated it and CMK needs to store it. optional bytes iv = 3; - - // OPTIONAL (Map): Vendor-specific metadata. - map metadata = 4; } // UnwrapRequest contains the opaque ciphertext and the exact parameters @@ -66,31 +53,20 @@ message UnwrapRequest { // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. bytes ciphertext = 1; - // REQUIRED: The universal locator for the cryptographic key. - string key_uri = 2; - // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. - optional bytes aad = 3; - - // OPTIONAL (Map): Key-Value Encryption Context. - map encryption_context = 4; - - // OPTIONAL: The explicit cryptographic unwrapping mechanism. - optional string mechanism = 5; + optional bytes aad = 2; // OPTIONAL: Initialization Vector (IV) or Nonce. // Must be provided if it was returned in the WrapResponse. - optional bytes iv = 6; + optional bytes iv = 3; - // OPTIONAL (Map): Dynamic Configuration Pass-through. - map options = 7; + // OPTIONAL: Per-request dynamic context (if needed). + // Kept as an escape hatch for truly dynamic per-request overrides. + map dynamic_context = 900; } // UnwrapResponse returns the recovered raw cryptographic material. message UnwrapResponse { // REQUIRED: The recovered raw cryptographic material. bytes plaintext = 1; - - // OPTIONAL (Map): Vendor-specific metadata. - map metadata = 2; } From 1c90087315817649ec7ba09446be09b538f72b7f Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Wed, 11 Mar 2026 21:22:50 +0100 Subject: [PATCH 04/27] update the proto --- .../plugin/cipher_wrapper/v1/cipher_wrapper.pb.go | 15 +++++++++------ .../plugin/cipher_wrapper/v1/cipher_wrapper.proto | 12 ++++++++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go index 229fedc..a403184 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go @@ -11,6 +11,7 @@ import ( sync "sync" unsafe "unsafe" + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) @@ -290,9 +291,10 @@ var File_plugin_cipher_wrapper_v1_cipher_wrapper_proto protoreflect.FileDescript const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\n" + - "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x18plugin.cipher_wrapper.v1\"\x8e\x02\n" + - "\vWrapRequest\x12\x1c\n" + - "\tplaintext\x18\x01 \x01(\fR\tplaintext\x12\x15\n" + + "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x18plugin.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\x9a\x02\n" + + "\vWrapRequest\x12(\n" + + "\tplaintext\x18\x01 \x01(\fB\n" + + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tplaintext\x12\x15\n" + "\x03aad\x18\x02 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12c\n" + "\x0fdynamic_context\x18\x84\a \x03(\v29.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + @@ -308,10 +310,11 @@ const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\x0ekey_version_id\x18\x02 \x01(\tH\x00R\fkeyVersionId\x88\x01\x01\x12\x13\n" + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01B\x11\n" + "\x0f_key_version_idB\x05\n" + - "\x03_iv\"\x94\x02\n" + - "\rUnwrapRequest\x12\x1e\n" + + "\x03_iv\"\xa0\x02\n" + + "\rUnwrapRequest\x12*\n" + "\n" + - "ciphertext\x18\x01 \x01(\fR\n" + + "ciphertext\x18\x01 \x01(\fB\n" + + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\n" + "ciphertext\x12\x15\n" + "\x03aad\x18\x02 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12e\n" + diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto index b33ce84..2cd1f55 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package plugin.cipher_wrapper.v1; +import "buf/validate/validate.proto"; + // KeyWrapper defines the universal envelope encryption interface for CMK. // It allows the core engine to delegate cryptographic wrapping and unwrapping // to any external provider (AWS KMS, Google Cloud KMS, Azure Key Vault, @@ -18,7 +20,10 @@ service CipherWrapper { // WrapRequest contains the raw key material and the context needed to encrypt it. message WrapRequest { // REQUIRED: The raw cryptographic material to be wrapped. - bytes plaintext = 1; + bytes plaintext = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. // Kept in proto because AAD often changes per request (e.g., binding to a specific Tenant ID). @@ -51,7 +56,10 @@ message WrapResponse { // originally used during the Wrap operation. message UnwrapRequest { // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. - bytes ciphertext = 1; + bytes ciphertext = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. optional bytes aad = 2; From fac6632c3f077a68748cbf23324379e010ac35b2 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Wed, 11 Mar 2026 22:24:36 +0100 Subject: [PATCH 05/27] update the proto --- internal/proto/service/init/v1/init.pb.go | 5 ++--- internal/proto/service/init/v1/init_ext_service.pb.go | 3 +-- internal/proto/service/init/v1/init_grpc.pb.go | 1 - proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go | 4 ++-- proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto | 4 ++-- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/internal/proto/service/init/v1/init.pb.go b/internal/proto/service/init/v1/init.pb.go index 9b50700..a0fe002 100644 --- a/internal/proto/service/init/v1/init.pb.go +++ b/internal/proto/service/init/v1/init.pb.go @@ -7,11 +7,10 @@ package initv1 import ( - reflect "reflect" - sync "sync" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) const ( diff --git a/internal/proto/service/init/v1/init_ext_service.pb.go b/internal/proto/service/init/v1/init_ext_service.pb.go index 2eb7c75..11b10a7 100644 --- a/internal/proto/service/init/v1/init_ext_service.pb.go +++ b/internal/proto/service/init/v1/init_ext_service.pb.go @@ -3,9 +3,8 @@ package initv1 import ( - grpc "google.golang.org/grpc" - api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" ) const ( diff --git a/internal/proto/service/init/v1/init_grpc.pb.go b/internal/proto/service/init/v1/init_grpc.pb.go index f4f4276..7fd786d 100644 --- a/internal/proto/service/init/v1/init_grpc.pb.go +++ b/internal/proto/service/init/v1/init_grpc.pb.go @@ -8,7 +8,6 @@ package initv1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go index a403184..b23f6ba 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go @@ -294,7 +294,7 @@ const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x18plugin.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\x9a\x02\n" + "\vWrapRequest\x12(\n" + "\tplaintext\x18\x01 \x01(\fB\n" + - "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tplaintext\x12\x15\n" + + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\tplaintext\x12\x15\n" + "\x03aad\x18\x02 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12c\n" + "\x0fdynamic_context\x18\x84\a \x03(\v29.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + @@ -314,7 +314,7 @@ const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\rUnwrapRequest\x12*\n" + "\n" + "ciphertext\x18\x01 \x01(\fB\n" + - "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\n" + + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\n" + "ciphertext\x12\x15\n" + "\x03aad\x18\x02 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12e\n" + diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto index 2cd1f55..49b5586 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto @@ -22,7 +22,7 @@ message WrapRequest { // REQUIRED: The raw cryptographic material to be wrapped. bytes plaintext = 1 [ (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 + (buf.validate.field).bytes.min_len = 1 ]; // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. @@ -58,7 +58,7 @@ message UnwrapRequest { // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. bytes ciphertext = 1 [ (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 + (buf.validate.field).bytes.min_len = 1 ]; // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. From 41bd7cf979ac680bd410655247b275074efe3d65 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Thu, 12 Mar 2026 13:05:50 +0100 Subject: [PATCH 06/27] fix: add KeyMaterialStorage plugin --- .../v1/key_material_storage.pb.go | 358 +++++++++++ .../v1/key_material_storage.pb.validate.go | 600 ++++++++++++++++++ .../v1/key_material_storage.proto | 75 +++ .../v1/key_material_storage_ext_plugin.pb.go | 56 ++ .../v1/key_material_storage_grpc.pb.go | 174 +++++ 5 files changed, 1263 insertions(+) create mode 100644 proto/plugin/key_material_storage/v1/key_material_storage.pb.go create mode 100644 proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go create mode 100644 proto/plugin/key_material_storage/v1/key_material_storage.proto create mode 100644 proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go create mode 100644 proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go new file mode 100644 index 0000000..855190e --- /dev/null +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -0,0 +1,358 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc (unknown) +// source: plugin/key_material_storage/v1/key_material_storage.proto + +package key_material_storagev1 + +import ( + reflect "reflect" + sync "sync" + unsafe "unsafe" + + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// KeyMaterial represents a single unit of stored data. +// It is intentionally generic and algorithm-agnostic. +type KeyMaterial struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: The unique identifier for this item. + // e.g., "L2_01H8XGJWBWBAQ9Z7J6C6XJ6C6X" + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // REQUIRED: The opaque data blob. + // This typically contains the encrypted/wrapped key material. + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyMaterial) Reset() { + *x = KeyMaterial{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyMaterial) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyMaterial) ProtoMessage() {} + +func (x *KeyMaterial) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyMaterial.ProtoReflect.Descriptor instead. +func (*KeyMaterial) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{0} +} + +func (x *KeyMaterial) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *KeyMaterial) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +type StoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: The namespace for this key material. This provides isolation + // and can be mapped to a tenant, project, or customer ID. + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + // REQUIRED: The item to be stored. + KeyMaterial *KeyMaterial `protobuf:"bytes,2,opt,name=key_material,json=keyMaterial,proto3" json:"key_material,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StoreRequest) Reset() { + *x = StoreRequest{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StoreRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StoreRequest) ProtoMessage() {} + +func (x *StoreRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StoreRequest.ProtoReflect.Descriptor instead. +func (*StoreRequest) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{1} +} + +func (x *StoreRequest) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *StoreRequest) GetKeyMaterial() *KeyMaterial { + if x != nil { + return x.KeyMaterial + } + return nil +} + +type StoreResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *StoreResponse) Reset() { + *x = StoreResponse{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *StoreResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StoreResponse) ProtoMessage() {} + +func (x *StoreResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StoreResponse.ProtoReflect.Descriptor instead. +func (*StoreResponse) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{2} +} + +type LoadRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: The namespace for the item. + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + // REQUIRED: The unique ID of the item to retrieve. + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoadRequest) Reset() { + *x = LoadRequest{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoadRequest) ProtoMessage() {} + +func (x *LoadRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoadRequest.ProtoReflect.Descriptor instead. +func (*LoadRequest) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{3} +} + +func (x *LoadRequest) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *LoadRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +type LoadResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The retrieved key material. + // If the key is not found, the RPC will return a `NOT_FOUND` gRPC error. + KeyMaterial *KeyMaterial `protobuf:"bytes,1,opt,name=key_material,json=keyMaterial,proto3" json:"key_material,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoadResponse) Reset() { + *x = LoadResponse{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoadResponse) ProtoMessage() {} + +func (x *LoadResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoadResponse.ProtoReflect.Descriptor instead. +func (*LoadResponse) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{4} +} + +func (x *LoadResponse) GetKeyMaterial() *KeyMaterial { + if x != nil { + return x.KeyMaterial + } + return nil +} + +var File_plugin_key_material_storage_v1_key_material_storage_proto protoreflect.FileDescriptor + +const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = "" + + "\n" + + "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\"I\n" + + "\vKeyMaterial\x12\x1a\n" + + "\x02id\x18\x01 \x01(\tB\n" + + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\x02id\x12\x1e\n" + + "\x04data\x18\x02 \x01(\fB\n" + + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\x04data\"\x90\x01\n" + + "\fStoreRequest\x12(\n" + + "\tnamespace\x18\x01 \x01(\tB\n" + + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tnamespace\x12V\n" + + "\fkey_material\x18\x02 \x01(\v2+.plugin.key_material_storage.v1.KeyMaterialB\x06\xbaH\x03\xc8\x01\x01R\vkeyMaterial\"\x0f\n" + + "\rStoreResponse\"S\n" + + "\vLoadRequest\x12(\n" + + "\tnamespace\x18\x01 \x01(\tB\n" + + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tnamespace\x12\x1a\n" + + "\x02id\x18\x02 \x01(\tB\n" + + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\x02id\"^\n" + + "\fLoadResponse\x12N\n" + + "\fkey_material\x18\x01 \x01(\v2+.plugin.key_material_storage.v1.KeyMaterialR\vkeyMaterial2\xdd\x01\n" + + "\x12KeyMaterialStorage\x12d\n" + + "\x05Store\x12,.plugin.key_material_storage.v1.StoreRequest\x1a-.plugin.key_material_storage.v1.StoreResponse\x12a\n" + + "\x04Load\x12+.plugin.key_material_storage.v1.LoadRequest\x1a,.plugin.key_material_storage.v1.LoadResponseB\xaa\x02\n" + + "\"com.plugin.key_material_storage.v1B\x17KeyMaterialStorageProtoP\x01ZYgithub.com/openkcm/plugin-sdk/proto/plugin/key_material_storage/v1;key_material_storagev1\xa2\x02\x03PKX\xaa\x02\x1cPlugin.KeyMaterialStorage.V1\xca\x02\x1cPlugin\\KeyMaterialStorage\\V1\xe2\x02(Plugin\\KeyMaterialStorage\\V1\\GPBMetadata\xea\x02\x1ePlugin::KeyMaterialStorage::V1b\x06proto3" + +var ( + file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescOnce sync.Once + file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescData []byte +) + +func file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP() []byte { + file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescOnce.Do(func() { + file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc), len(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc))) + }) + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescData +} + +var file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_plugin_key_material_storage_v1_key_material_storage_proto_goTypes = []any{ + (*KeyMaterial)(nil), // 0: plugin.key_material_storage.v1.KeyMaterial + (*StoreRequest)(nil), // 1: plugin.key_material_storage.v1.StoreRequest + (*StoreResponse)(nil), // 2: plugin.key_material_storage.v1.StoreResponse + (*LoadRequest)(nil), // 3: plugin.key_material_storage.v1.LoadRequest + (*LoadResponse)(nil), // 4: plugin.key_material_storage.v1.LoadResponse +} +var file_plugin_key_material_storage_v1_key_material_storage_proto_depIdxs = []int32{ + 0, // 0: plugin.key_material_storage.v1.StoreRequest.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial + 0, // 1: plugin.key_material_storage.v1.LoadResponse.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial + 1, // 2: plugin.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> plugin.key_material_storage.v1.StoreRequest + 3, // 3: plugin.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> plugin.key_material_storage.v1.LoadRequest + 2, // 4: plugin.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> plugin.key_material_storage.v1.StoreResponse + 4, // 5: plugin.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> plugin.key_material_storage.v1.LoadResponse + 4, // [4:6] is the sub-list for method output_type + 2, // [2:4] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_plugin_key_material_storage_v1_key_material_storage_proto_init() } +func file_plugin_key_material_storage_v1_key_material_storage_proto_init() { + if File_plugin_key_material_storage_v1_key_material_storage_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc), len(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc)), + NumEnums: 0, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_plugin_key_material_storage_v1_key_material_storage_proto_goTypes, + DependencyIndexes: file_plugin_key_material_storage_v1_key_material_storage_proto_depIdxs, + MessageInfos: file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes, + }.Build() + File_plugin_key_material_storage_v1_key_material_storage_proto = out.File + file_plugin_key_material_storage_v1_key_material_storage_proto_goTypes = nil + file_plugin_key_material_storage_v1_key_material_storage_proto_depIdxs = nil +} diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go new file mode 100644 index 0000000..c45a9d9 --- /dev/null +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go @@ -0,0 +1,600 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: plugin/key_material_storage/v1/key_material_storage.proto + +package key_material_storagev1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on KeyMaterial with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *KeyMaterial) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeyMaterial with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in KeyMaterialMultiError, or +// nil if none found. +func (m *KeyMaterial) ValidateAll() error { + return m.validate(true) +} + +func (m *KeyMaterial) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Id + + // no validation rules for Data + + if len(errors) > 0 { + return KeyMaterialMultiError(errors) + } + + return nil +} + +// KeyMaterialMultiError is an error wrapping multiple validation errors +// returned by KeyMaterial.ValidateAll() if the designated constraints aren't met. +type KeyMaterialMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyMaterialMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyMaterialMultiError) AllErrors() []error { return m } + +// KeyMaterialValidationError is the validation error returned by +// KeyMaterial.Validate if the designated constraints aren't met. +type KeyMaterialValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyMaterialValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyMaterialValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyMaterialValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyMaterialValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyMaterialValidationError) ErrorName() string { return "KeyMaterialValidationError" } + +// Error satisfies the builtin error interface +func (e KeyMaterialValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyMaterial.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyMaterialValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyMaterialValidationError{} + +// Validate checks the field values on StoreRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *StoreRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on StoreRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in StoreRequestMultiError, or +// nil if none found. +func (m *StoreRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *StoreRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Namespace + + if all { + switch v := interface{}(m.GetKeyMaterial()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, StoreRequestValidationError{ + field: "KeyMaterial", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, StoreRequestValidationError{ + field: "KeyMaterial", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyMaterial()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return StoreRequestValidationError{ + field: "KeyMaterial", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return StoreRequestMultiError(errors) + } + + return nil +} + +// StoreRequestMultiError is an error wrapping multiple validation errors +// returned by StoreRequest.ValidateAll() if the designated constraints aren't met. +type StoreRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m StoreRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m StoreRequestMultiError) AllErrors() []error { return m } + +// StoreRequestValidationError is the validation error returned by +// StoreRequest.Validate if the designated constraints aren't met. +type StoreRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e StoreRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e StoreRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e StoreRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e StoreRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e StoreRequestValidationError) ErrorName() string { return "StoreRequestValidationError" } + +// Error satisfies the builtin error interface +func (e StoreRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sStoreRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = StoreRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = StoreRequestValidationError{} + +// Validate checks the field values on StoreResponse with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *StoreResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on StoreResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in StoreResponseMultiError, or +// nil if none found. +func (m *StoreResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *StoreResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return StoreResponseMultiError(errors) + } + + return nil +} + +// StoreResponseMultiError is an error wrapping multiple validation errors +// returned by StoreResponse.ValidateAll() if the designated constraints +// aren't met. +type StoreResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m StoreResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m StoreResponseMultiError) AllErrors() []error { return m } + +// StoreResponseValidationError is the validation error returned by +// StoreResponse.Validate if the designated constraints aren't met. +type StoreResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e StoreResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e StoreResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e StoreResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e StoreResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e StoreResponseValidationError) ErrorName() string { return "StoreResponseValidationError" } + +// Error satisfies the builtin error interface +func (e StoreResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sStoreResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = StoreResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = StoreResponseValidationError{} + +// Validate checks the field values on LoadRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *LoadRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on LoadRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in LoadRequestMultiError, or +// nil if none found. +func (m *LoadRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *LoadRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Namespace + + // no validation rules for Id + + if len(errors) > 0 { + return LoadRequestMultiError(errors) + } + + return nil +} + +// LoadRequestMultiError is an error wrapping multiple validation errors +// returned by LoadRequest.ValidateAll() if the designated constraints aren't met. +type LoadRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m LoadRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m LoadRequestMultiError) AllErrors() []error { return m } + +// LoadRequestValidationError is the validation error returned by +// LoadRequest.Validate if the designated constraints aren't met. +type LoadRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e LoadRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e LoadRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e LoadRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e LoadRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e LoadRequestValidationError) ErrorName() string { return "LoadRequestValidationError" } + +// Error satisfies the builtin error interface +func (e LoadRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sLoadRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = LoadRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = LoadRequestValidationError{} + +// Validate checks the field values on LoadResponse with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *LoadResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on LoadResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in LoadResponseMultiError, or +// nil if none found. +func (m *LoadResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *LoadResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetKeyMaterial()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, LoadResponseValidationError{ + field: "KeyMaterial", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, LoadResponseValidationError{ + field: "KeyMaterial", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyMaterial()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return LoadResponseValidationError{ + field: "KeyMaterial", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return LoadResponseMultiError(errors) + } + + return nil +} + +// LoadResponseMultiError is an error wrapping multiple validation errors +// returned by LoadResponse.ValidateAll() if the designated constraints aren't met. +type LoadResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m LoadResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m LoadResponseMultiError) AllErrors() []error { return m } + +// LoadResponseValidationError is the validation error returned by +// LoadResponse.Validate if the designated constraints aren't met. +type LoadResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e LoadResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e LoadResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e LoadResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e LoadResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e LoadResponseValidationError) ErrorName() string { return "LoadResponseValidationError" } + +// Error satisfies the builtin error interface +func (e LoadResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sLoadResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = LoadResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = LoadResponseValidationError{} diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto new file mode 100644 index 0000000..8e0d036 --- /dev/null +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; + +package plugin.key_material_storage.v1; + +import "buf/validate/validate.proto"; + +// KeyMaterialStorage defines the universal interface for persisting and +// retrieving opaque blobs of data, typically wrapped key material. +// This allows Krypton to delegate storage to any backend (DB, Vault, File) +// in a completely generic way. +service KeyMaterialStorage { + // Store persists a single item. This operation must be idempotent. + rpc Store(StoreRequest) returns (StoreResponse); + + // Load retrieves a single item by its unique ID. + rpc Load(LoadRequest) returns (LoadResponse); +} + +// KeyMaterial represents a single unit of stored data. +// It is intentionally generic and algorithm-agnostic. +message KeyMaterial { + // REQUIRED: The unique identifier for this item. + // e.g., "L2_01H8XGJWBWBAQ9Z7J6C6XJ6C6X" + string id = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // REQUIRED: The opaque data blob. + // This typically contains the encrypted/wrapped key material. + bytes data = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).bytes.min_len = 1 + ]; +} + +// --- Store RPC Messages --- + +message StoreRequest { + // REQUIRED: The namespace for this key material. This provides isolation + // and can be mapped to a tenant, project, or customer ID. + string namespace = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // REQUIRED: The item to be stored. + KeyMaterial key_material = 2 [(buf.validate.field).required = true]; +} + +message StoreResponse { + // This response is empty on success. Errors are communicated via gRPC status codes. +} + +// --- Load RPC Messages --- + +message LoadRequest { + // REQUIRED: The namespace for the item. + string namespace = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // REQUIRED: The unique ID of the item to retrieve. + string id = 2 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; +} + +message LoadResponse { + // The retrieved key material. + // If the key is not found, the RPC will return a `NOT_FOUND` gRPC error. + KeyMaterial key_material = 1; +} diff --git a/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go new file mode 100644 index 0000000..9f108c7 --- /dev/null +++ b/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go @@ -0,0 +1,56 @@ +// Code generated by protoc-gen-go-extension. DO NOT EDIT. + +package key_material_storagev1 + +import ( + grpc "google.golang.org/grpc" + + api "github.com/openkcm/plugin-sdk/api" +) + +const ( + Type = "KeyMaterialStorage" + GRPCServiceFullName = "plugin.key_material_storage.v1.KeyMaterialStorage" +) + +func KeyMaterialStoragePluginServer(server KeyMaterialStorageServer) api.PluginServer { + return keyMaterialStoragePluginServer{KeyMaterialStorageServer: server} +} + +type keyMaterialStoragePluginServer struct { + KeyMaterialStorageServer +} + +func (s keyMaterialStoragePluginServer) Type() string { + return Type +} + +func (s keyMaterialStoragePluginServer) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (s keyMaterialStoragePluginServer) RegisterServer(server *grpc.Server) any { + RegisterKeyMaterialStorageServer(server, s.KeyMaterialStorageServer) + return s.KeyMaterialStorageServer +} + +type KeyMaterialStoragePluginClient struct { + KeyMaterialStorageClient +} + +func (s KeyMaterialStoragePluginClient) Type() string { + return Type +} + +func (c *KeyMaterialStoragePluginClient) IsInitialized() bool { + return c.KeyMaterialStorageClient != nil +} + +func (c *KeyMaterialStoragePluginClient) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (c *KeyMaterialStoragePluginClient) InitClient(conn grpc.ClientConnInterface) any { + c.KeyMaterialStorageClient = NewKeyMaterialStorageClient(conn) + return c.KeyMaterialStorageClient +} diff --git a/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go new file mode 100644 index 0000000..64a0e82 --- /dev/null +++ b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go @@ -0,0 +1,174 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc (unknown) +// source: plugin/key_material_storage/v1/key_material_storage.proto + +package key_material_storagev1 + +import ( + context "context" + + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + KeyMaterialStorage_Store_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Store" + KeyMaterialStorage_Load_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Load" +) + +// KeyMaterialStorageClient is the client API for KeyMaterialStorage service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// KeyMaterialStorage defines the universal interface for persisting and +// retrieving opaque blobs of data, typically wrapped key material. +// This allows Krypton to delegate storage to any backend (DB, Vault, File) +// in a completely generic way. +type KeyMaterialStorageClient interface { + // Store persists a single item. This operation must be idempotent. + Store(ctx context.Context, in *StoreRequest, opts ...grpc.CallOption) (*StoreResponse, error) + // Load retrieves a single item by its unique ID. + Load(ctx context.Context, in *LoadRequest, opts ...grpc.CallOption) (*LoadResponse, error) +} + +type keyMaterialStorageClient struct { + cc grpc.ClientConnInterface +} + +func NewKeyMaterialStorageClient(cc grpc.ClientConnInterface) KeyMaterialStorageClient { + return &keyMaterialStorageClient{cc} +} + +func (c *keyMaterialStorageClient) Store(ctx context.Context, in *StoreRequest, opts ...grpc.CallOption) (*StoreResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(StoreResponse) + err := c.cc.Invoke(ctx, KeyMaterialStorage_Store_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keyMaterialStorageClient) Load(ctx context.Context, in *LoadRequest, opts ...grpc.CallOption) (*LoadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LoadResponse) + err := c.cc.Invoke(ctx, KeyMaterialStorage_Load_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// KeyMaterialStorageServer is the server API for KeyMaterialStorage service. +// All implementations must embed UnimplementedKeyMaterialStorageServer +// for forward compatibility. +// +// KeyMaterialStorage defines the universal interface for persisting and +// retrieving opaque blobs of data, typically wrapped key material. +// This allows Krypton to delegate storage to any backend (DB, Vault, File) +// in a completely generic way. +type KeyMaterialStorageServer interface { + // Store persists a single item. This operation must be idempotent. + Store(context.Context, *StoreRequest) (*StoreResponse, error) + // Load retrieves a single item by its unique ID. + Load(context.Context, *LoadRequest) (*LoadResponse, error) + mustEmbedUnimplementedKeyMaterialStorageServer() +} + +// UnimplementedKeyMaterialStorageServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedKeyMaterialStorageServer struct{} + +func (UnimplementedKeyMaterialStorageServer) Store(context.Context, *StoreRequest) (*StoreResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Store not implemented") +} +func (UnimplementedKeyMaterialStorageServer) Load(context.Context, *LoadRequest) (*LoadResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Load not implemented") +} +func (UnimplementedKeyMaterialStorageServer) mustEmbedUnimplementedKeyMaterialStorageServer() {} +func (UnimplementedKeyMaterialStorageServer) testEmbeddedByValue() {} + +// UnsafeKeyMaterialStorageServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to KeyMaterialStorageServer will +// result in compilation errors. +type UnsafeKeyMaterialStorageServer interface { + mustEmbedUnimplementedKeyMaterialStorageServer() +} + +func RegisterKeyMaterialStorageServer(s grpc.ServiceRegistrar, srv KeyMaterialStorageServer) { + // If the following call panics, it indicates UnimplementedKeyMaterialStorageServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&KeyMaterialStorage_ServiceDesc, srv) +} + +func _KeyMaterialStorage_Store_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StoreRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyMaterialStorageServer).Store(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KeyMaterialStorage_Store_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyMaterialStorageServer).Store(ctx, req.(*StoreRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KeyMaterialStorage_Load_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LoadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyMaterialStorageServer).Load(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KeyMaterialStorage_Load_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyMaterialStorageServer).Load(ctx, req.(*LoadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// KeyMaterialStorage_ServiceDesc is the grpc.ServiceDesc for KeyMaterialStorage service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var KeyMaterialStorage_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "plugin.key_material_storage.v1.KeyMaterialStorage", + HandlerType: (*KeyMaterialStorageServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Store", + Handler: _KeyMaterialStorage_Store_Handler, + }, + { + MethodName: "Load", + Handler: _KeyMaterialStorage_Load_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "plugin/key_material_storage/v1/key_material_storage.proto", +} From 917ac4fbf6b3468d4066fcb56c3ca5df122a9cb0 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Thu, 12 Mar 2026 13:53:20 +0100 Subject: [PATCH 07/27] fix: add KeyMaterialStorage plugin --- .../v1/key_material_storage.pb.go | 223 ++++++++++- .../v1/key_material_storage.pb.validate.go | 345 ++++++++++++++++++ .../v1/key_material_storage.proto | 32 ++ .../v1/key_material_storage_grpc.pb.go | 50 ++- 4 files changed, 629 insertions(+), 21 deletions(-) diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index 855190e..b2a0861 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -272,6 +272,170 @@ func (x *LoadResponse) GetKeyMaterial() *KeyMaterial { return nil } +type ListIDsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // REQUIRED: The namespace to search in. + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + // OPTIONAL: Filter criteria for listing IDs. + // If not provided, all IDs in the namespace are returned. + Filter *Filter `protobuf:"bytes,2,opt,name=filter,proto3,oneof" json:"filter,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListIDsRequest) Reset() { + *x = ListIDsRequest{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListIDsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIDsRequest) ProtoMessage() {} + +func (x *ListIDsRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIDsRequest.ProtoReflect.Descriptor instead. +func (*ListIDsRequest) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{5} +} + +func (x *ListIDsRequest) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *ListIDsRequest) GetFilter() *Filter { + if x != nil { + return x.Filter + } + return nil +} + +type Filter struct { + state protoimpl.MessageState `protogen:"open.v1"` + // OPTIONAL: Filter IDs that start with this string. + Prefix *string `protobuf:"bytes,1,opt,name=prefix,proto3,oneof" json:"prefix,omitempty"` + // OPTIONAL: Filter IDs that end with this string. + Suffix *string `protobuf:"bytes,2,opt,name=suffix,proto3,oneof" json:"suffix,omitempty"` + // OPTIONAL: Filter IDs that contain this string. + Contains *string `protobuf:"bytes,3,opt,name=contains,proto3,oneof" json:"contains,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Filter) Reset() { + *x = Filter{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Filter) ProtoMessage() {} + +func (x *Filter) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Filter.ProtoReflect.Descriptor instead. +func (*Filter) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{6} +} + +func (x *Filter) GetPrefix() string { + if x != nil && x.Prefix != nil { + return *x.Prefix + } + return "" +} + +func (x *Filter) GetSuffix() string { + if x != nil && x.Suffix != nil { + return *x.Suffix + } + return "" +} + +func (x *Filter) GetContains() string { + if x != nil && x.Contains != nil { + return *x.Contains + } + return "" +} + +type ListIDsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // A list of key material IDs that match the request criteria. + // The server may stream multiple responses, each containing a batch of IDs. + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListIDsResponse) Reset() { + *x = ListIDsResponse{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListIDsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIDsResponse) ProtoMessage() {} + +func (x *ListIDsResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIDsResponse.ProtoReflect.Descriptor instead. +func (*ListIDsResponse) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{7} +} + +func (x *ListIDsResponse) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + var File_plugin_key_material_storage_v1_key_material_storage_proto protoreflect.FileDescriptor const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = "" + @@ -293,10 +457,25 @@ const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = " "\x02id\x18\x02 \x01(\tB\n" + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\x02id\"^\n" + "\fLoadResponse\x12N\n" + - "\fkey_material\x18\x01 \x01(\v2+.plugin.key_material_storage.v1.KeyMaterialR\vkeyMaterial2\xdd\x01\n" + + "\fkey_material\x18\x01 \x01(\v2+.plugin.key_material_storage.v1.KeyMaterialR\vkeyMaterial\"\x8a\x01\n" + + "\x0eListIDsRequest\x12(\n" + + "\tnamespace\x18\x01 \x01(\tB\n" + + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tnamespace\x12C\n" + + "\x06filter\x18\x02 \x01(\v2&.plugin.key_material_storage.v1.FilterH\x00R\x06filter\x88\x01\x01B\t\n" + + "\a_filter\"\x86\x01\n" + + "\x06Filter\x12\x1b\n" + + "\x06prefix\x18\x01 \x01(\tH\x00R\x06prefix\x88\x01\x01\x12\x1b\n" + + "\x06suffix\x18\x02 \x01(\tH\x01R\x06suffix\x88\x01\x01\x12\x1f\n" + + "\bcontains\x18\x03 \x01(\tH\x02R\bcontains\x88\x01\x01B\t\n" + + "\a_prefixB\t\n" + + "\a_suffixB\v\n" + + "\t_contains\"#\n" + + "\x0fListIDsResponse\x12\x10\n" + + "\x03ids\x18\x01 \x03(\tR\x03ids2\xcb\x02\n" + "\x12KeyMaterialStorage\x12d\n" + "\x05Store\x12,.plugin.key_material_storage.v1.StoreRequest\x1a-.plugin.key_material_storage.v1.StoreResponse\x12a\n" + - "\x04Load\x12+.plugin.key_material_storage.v1.LoadRequest\x1a,.plugin.key_material_storage.v1.LoadResponseB\xaa\x02\n" + + "\x04Load\x12+.plugin.key_material_storage.v1.LoadRequest\x1a,.plugin.key_material_storage.v1.LoadResponse\x12l\n" + + "\aListIDs\x12..plugin.key_material_storage.v1.ListIDsRequest\x1a/.plugin.key_material_storage.v1.ListIDsResponse0\x01B\xaa\x02\n" + "\"com.plugin.key_material_storage.v1B\x17KeyMaterialStorageProtoP\x01ZYgithub.com/openkcm/plugin-sdk/proto/plugin/key_material_storage/v1;key_material_storagev1\xa2\x02\x03PKX\xaa\x02\x1cPlugin.KeyMaterialStorage.V1\xca\x02\x1cPlugin\\KeyMaterialStorage\\V1\xe2\x02(Plugin\\KeyMaterialStorage\\V1\\GPBMetadata\xea\x02\x1ePlugin::KeyMaterialStorage::V1b\x06proto3" var ( @@ -311,26 +490,32 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP( return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescData } -var file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_plugin_key_material_storage_v1_key_material_storage_proto_goTypes = []any{ - (*KeyMaterial)(nil), // 0: plugin.key_material_storage.v1.KeyMaterial - (*StoreRequest)(nil), // 1: plugin.key_material_storage.v1.StoreRequest - (*StoreResponse)(nil), // 2: plugin.key_material_storage.v1.StoreResponse - (*LoadRequest)(nil), // 3: plugin.key_material_storage.v1.LoadRequest - (*LoadResponse)(nil), // 4: plugin.key_material_storage.v1.LoadResponse + (*KeyMaterial)(nil), // 0: plugin.key_material_storage.v1.KeyMaterial + (*StoreRequest)(nil), // 1: plugin.key_material_storage.v1.StoreRequest + (*StoreResponse)(nil), // 2: plugin.key_material_storage.v1.StoreResponse + (*LoadRequest)(nil), // 3: plugin.key_material_storage.v1.LoadRequest + (*LoadResponse)(nil), // 4: plugin.key_material_storage.v1.LoadResponse + (*ListIDsRequest)(nil), // 5: plugin.key_material_storage.v1.ListIDsRequest + (*Filter)(nil), // 6: plugin.key_material_storage.v1.Filter + (*ListIDsResponse)(nil), // 7: plugin.key_material_storage.v1.ListIDsResponse } var file_plugin_key_material_storage_v1_key_material_storage_proto_depIdxs = []int32{ 0, // 0: plugin.key_material_storage.v1.StoreRequest.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial 0, // 1: plugin.key_material_storage.v1.LoadResponse.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial - 1, // 2: plugin.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> plugin.key_material_storage.v1.StoreRequest - 3, // 3: plugin.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> plugin.key_material_storage.v1.LoadRequest - 2, // 4: plugin.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> plugin.key_material_storage.v1.StoreResponse - 4, // 5: plugin.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> plugin.key_material_storage.v1.LoadResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 6, // 2: plugin.key_material_storage.v1.ListIDsRequest.filter:type_name -> plugin.key_material_storage.v1.Filter + 1, // 3: plugin.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> plugin.key_material_storage.v1.StoreRequest + 3, // 4: plugin.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> plugin.key_material_storage.v1.LoadRequest + 5, // 5: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:input_type -> plugin.key_material_storage.v1.ListIDsRequest + 2, // 6: plugin.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> plugin.key_material_storage.v1.StoreResponse + 4, // 7: plugin.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> plugin.key_material_storage.v1.LoadResponse + 7, // 8: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:output_type -> plugin.key_material_storage.v1.ListIDsResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_plugin_key_material_storage_v1_key_material_storage_proto_init() } @@ -338,13 +523,15 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_init() { if File_plugin_key_material_storage_v1_key_material_storage_proto != nil { return } + file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[5].OneofWrappers = []any{} + file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[6].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc), len(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc)), NumEnums: 0, - NumMessages: 5, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go index c45a9d9..c2199ad 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go @@ -598,3 +598,348 @@ var _ interface { Cause() error ErrorName() string } = LoadResponseValidationError{} + +// Validate checks the field values on ListIDsRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ListIDsRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListIDsRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ListIDsRequestMultiError, +// or nil if none found. +func (m *ListIDsRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListIDsRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Namespace + + if m.Filter != nil { + + if all { + switch v := interface{}(m.GetFilter()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListIDsRequestValidationError{ + field: "Filter", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListIDsRequestValidationError{ + field: "Filter", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListIDsRequestValidationError{ + field: "Filter", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ListIDsRequestMultiError(errors) + } + + return nil +} + +// ListIDsRequestMultiError is an error wrapping multiple validation errors +// returned by ListIDsRequest.ValidateAll() if the designated constraints +// aren't met. +type ListIDsRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListIDsRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListIDsRequestMultiError) AllErrors() []error { return m } + +// ListIDsRequestValidationError is the validation error returned by +// ListIDsRequest.Validate if the designated constraints aren't met. +type ListIDsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListIDsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListIDsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListIDsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListIDsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListIDsRequestValidationError) ErrorName() string { return "ListIDsRequestValidationError" } + +// Error satisfies the builtin error interface +func (e ListIDsRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListIDsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListIDsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListIDsRequestValidationError{} + +// Validate checks the field values on Filter with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Filter) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Filter with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in FilterMultiError, or nil if none found. +func (m *Filter) ValidateAll() error { + return m.validate(true) +} + +func (m *Filter) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.Prefix != nil { + // no validation rules for Prefix + } + + if m.Suffix != nil { + // no validation rules for Suffix + } + + if m.Contains != nil { + // no validation rules for Contains + } + + if len(errors) > 0 { + return FilterMultiError(errors) + } + + return nil +} + +// FilterMultiError is an error wrapping multiple validation errors returned by +// Filter.ValidateAll() if the designated constraints aren't met. +type FilterMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m FilterMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m FilterMultiError) AllErrors() []error { return m } + +// FilterValidationError is the validation error returned by Filter.Validate if +// the designated constraints aren't met. +type FilterValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e FilterValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e FilterValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e FilterValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e FilterValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e FilterValidationError) ErrorName() string { return "FilterValidationError" } + +// Error satisfies the builtin error interface +func (e FilterValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sFilter.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = FilterValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = FilterValidationError{} + +// Validate checks the field values on ListIDsResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ListIDsResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListIDsResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListIDsResponseMultiError, or nil if none found. +func (m *ListIDsResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListIDsResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return ListIDsResponseMultiError(errors) + } + + return nil +} + +// ListIDsResponseMultiError is an error wrapping multiple validation errors +// returned by ListIDsResponse.ValidateAll() if the designated constraints +// aren't met. +type ListIDsResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListIDsResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListIDsResponseMultiError) AllErrors() []error { return m } + +// ListIDsResponseValidationError is the validation error returned by +// ListIDsResponse.Validate if the designated constraints aren't met. +type ListIDsResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListIDsResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListIDsResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListIDsResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListIDsResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListIDsResponseValidationError) ErrorName() string { return "ListIDsResponseValidationError" } + +// Error satisfies the builtin error interface +func (e ListIDsResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListIDsResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListIDsResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListIDsResponseValidationError{} diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index 8e0d036..55ba5c1 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -14,6 +14,9 @@ service KeyMaterialStorage { // Load retrieves a single item by its unique ID. rpc Load(LoadRequest) returns (LoadResponse); + + // ListIDs streams back all IDs that match a given prefix within a namespace. + rpc ListIDs(ListIDsRequest) returns (stream ListIDsResponse); } // KeyMaterial represents a single unit of stored data. @@ -73,3 +76,32 @@ message LoadResponse { // If the key is not found, the RPC will return a `NOT_FOUND` gRPC error. KeyMaterial key_material = 1; } + +message ListIDsRequest { + // REQUIRED: The namespace to search in. + string namespace = 1 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; + + // OPTIONAL: Filter criteria for listing IDs. + // If not provided, all IDs in the namespace are returned. + optional Filter filter = 2; +} + +message Filter { + // OPTIONAL: Filter IDs that start with this string. + optional string prefix = 1; + + // OPTIONAL: Filter IDs that end with this string. + optional string suffix = 2; + + // OPTIONAL: Filter IDs that contain this string. + optional string contains = 3; +} + +message ListIDsResponse { + // A list of key material IDs that match the request criteria. + // The server may stream multiple responses, each containing a batch of IDs. + repeated string ids = 1; +} diff --git a/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go index 64a0e82..1eaafaa 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go @@ -20,8 +20,9 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - KeyMaterialStorage_Store_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Store" - KeyMaterialStorage_Load_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Load" + KeyMaterialStorage_Store_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Store" + KeyMaterialStorage_Load_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Load" + KeyMaterialStorage_ListIDs_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/ListIDs" ) // KeyMaterialStorageClient is the client API for KeyMaterialStorage service. @@ -37,6 +38,8 @@ type KeyMaterialStorageClient interface { Store(ctx context.Context, in *StoreRequest, opts ...grpc.CallOption) (*StoreResponse, error) // Load retrieves a single item by its unique ID. Load(ctx context.Context, in *LoadRequest, opts ...grpc.CallOption) (*LoadResponse, error) + // ListIDs streams back all IDs that match a given prefix within a namespace. + ListIDs(ctx context.Context, in *ListIDsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListIDsResponse], error) } type keyMaterialStorageClient struct { @@ -67,6 +70,25 @@ func (c *keyMaterialStorageClient) Load(ctx context.Context, in *LoadRequest, op return out, nil } +func (c *keyMaterialStorageClient) ListIDs(ctx context.Context, in *ListIDsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListIDsResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &KeyMaterialStorage_ServiceDesc.Streams[0], KeyMaterialStorage_ListIDs_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[ListIDsRequest, ListIDsResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type KeyMaterialStorage_ListIDsClient = grpc.ServerStreamingClient[ListIDsResponse] + // KeyMaterialStorageServer is the server API for KeyMaterialStorage service. // All implementations must embed UnimplementedKeyMaterialStorageServer // for forward compatibility. @@ -80,6 +102,8 @@ type KeyMaterialStorageServer interface { Store(context.Context, *StoreRequest) (*StoreResponse, error) // Load retrieves a single item by its unique ID. Load(context.Context, *LoadRequest) (*LoadResponse, error) + // ListIDs streams back all IDs that match a given prefix within a namespace. + ListIDs(*ListIDsRequest, grpc.ServerStreamingServer[ListIDsResponse]) error mustEmbedUnimplementedKeyMaterialStorageServer() } @@ -96,6 +120,9 @@ func (UnimplementedKeyMaterialStorageServer) Store(context.Context, *StoreReques func (UnimplementedKeyMaterialStorageServer) Load(context.Context, *LoadRequest) (*LoadResponse, error) { return nil, status.Error(codes.Unimplemented, "method Load not implemented") } +func (UnimplementedKeyMaterialStorageServer) ListIDs(*ListIDsRequest, grpc.ServerStreamingServer[ListIDsResponse]) error { + return status.Error(codes.Unimplemented, "method ListIDs not implemented") +} func (UnimplementedKeyMaterialStorageServer) mustEmbedUnimplementedKeyMaterialStorageServer() {} func (UnimplementedKeyMaterialStorageServer) testEmbeddedByValue() {} @@ -153,6 +180,17 @@ func _KeyMaterialStorage_Load_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _KeyMaterialStorage_ListIDs_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(ListIDsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(KeyMaterialStorageServer).ListIDs(m, &grpc.GenericServerStream[ListIDsRequest, ListIDsResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type KeyMaterialStorage_ListIDsServer = grpc.ServerStreamingServer[ListIDsResponse] + // KeyMaterialStorage_ServiceDesc is the grpc.ServiceDesc for KeyMaterialStorage service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -169,6 +207,12 @@ var KeyMaterialStorage_ServiceDesc = grpc.ServiceDesc{ Handler: _KeyMaterialStorage_Load_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "ListIDs", + Handler: _KeyMaterialStorage_ListIDs_Handler, + ServerStreams: true, + }, + }, Metadata: "plugin/key_material_storage/v1/key_material_storage.proto", } From 69d86368b0d2fb69e880cf401ae1653fcae0a80d Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Thu, 12 Mar 2026 17:03:04 +0100 Subject: [PATCH 08/27] add new field algorithm --- .../v1/key_material_storage.pb.go | 18 +++++++++++++++--- .../v1/key_material_storage.pb.validate.go | 2 ++ .../v1/key_material_storage.proto | 7 +++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index b2a0861..5273fdf 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -32,7 +32,10 @@ type KeyMaterial struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // REQUIRED: The opaque data blob. // This typically contains the encrypted/wrapped key material. - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + // REQUIRED: The name of algorithm + // This typically contains the encrypted/wrapped key material. + Algorithm []byte `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -81,6 +84,13 @@ func (x *KeyMaterial) GetData() []byte { return nil } +func (x *KeyMaterial) GetAlgorithm() []byte { + if x != nil { + return x.Algorithm + } + return nil +} + type StoreRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // REQUIRED: The namespace for this key material. This provides isolation @@ -440,12 +450,14 @@ var File_plugin_key_material_storage_v1_key_material_storage_proto protoreflect. const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = "" + "\n" + - "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\"I\n" + + "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\"s\n" + "\vKeyMaterial\x12\x1a\n" + "\x02id\x18\x01 \x01(\tB\n" + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\x02id\x12\x1e\n" + "\x04data\x18\x02 \x01(\fB\n" + - "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\x04data\"\x90\x01\n" + + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\x04data\x12(\n" + + "\talgorithm\x18\x03 \x01(\fB\n" + + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\talgorithm\"\x90\x01\n" + "\fStoreRequest\x12(\n" + "\tnamespace\x18\x01 \x01(\tB\n" + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tnamespace\x12V\n" + diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go index c2199ad..c26201c 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go @@ -61,6 +61,8 @@ func (m *KeyMaterial) validate(all bool) error { // no validation rules for Data + // no validation rules for Algorithm + if len(errors) > 0 { return KeyMaterialMultiError(errors) } diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index 55ba5c1..8c9265d 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -35,6 +35,13 @@ message KeyMaterial { (buf.validate.field).required = true, (buf.validate.field).bytes.min_len = 1 ]; + + // REQUIRED: The name of algorithm + // This typically contains the encrypted/wrapped key material. + bytes algorithm = 3 [ + (buf.validate.field).required = true, + (buf.validate.field).string.min_len = 1 + ]; } // --- Store RPC Messages --- From 87ae2f98d7bfd0621c89b0857aed199927594f0f Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Thu, 12 Mar 2026 17:05:06 +0100 Subject: [PATCH 09/27] modify --- .../key_material_storage/v1/key_material_storage.pb.go | 8 ++++---- .../key_material_storage/v1/key_material_storage.proto | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index 5273fdf..9762b83 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -35,7 +35,7 @@ type KeyMaterial struct { Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // REQUIRED: The name of algorithm // This typically contains the encrypted/wrapped key material. - Algorithm []byte `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` + Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -84,11 +84,11 @@ func (x *KeyMaterial) GetData() []byte { return nil } -func (x *KeyMaterial) GetAlgorithm() []byte { +func (x *KeyMaterial) GetAlgorithm() string { if x != nil { return x.Algorithm } - return nil + return "" } type StoreRequest struct { @@ -456,7 +456,7 @@ const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = " "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\x02id\x12\x1e\n" + "\x04data\x18\x02 \x01(\fB\n" + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\x04data\x12(\n" + - "\talgorithm\x18\x03 \x01(\fB\n" + + "\talgorithm\x18\x03 \x01(\tB\n" + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\talgorithm\"\x90\x01\n" + "\fStoreRequest\x12(\n" + "\tnamespace\x18\x01 \x01(\tB\n" + diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index 8c9265d..2388dc6 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -38,7 +38,7 @@ message KeyMaterial { // REQUIRED: The name of algorithm // This typically contains the encrypted/wrapped key material. - bytes algorithm = 3 [ + string algorithm = 3 [ (buf.validate.field).required = true, (buf.validate.field).string.min_len = 1 ]; From cd5a9ea43dcdcf1c14ef44173092ae9233beae65 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Thu, 12 Mar 2026 17:54:26 +0100 Subject: [PATCH 10/27] modify --- .../v1/key_material_storage.pb.go | 23 ++++++++++++++----- .../v1/key_material_storage.pb.validate.go | 4 ++++ .../v1/key_material_storage.proto | 4 +++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index 9762b83..3582214 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -28,16 +28,17 @@ const ( type KeyMaterial struct { state protoimpl.MessageState `protogen:"open.v1"` // REQUIRED: The unique identifier for this item. - // e.g., "L2_01H8XGJWBWBAQ9Z7J6C6XJ6C6X" + // e.g., "L2/01H8XGJWBWBAQ9Z7J6C6XJ6C6X" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // REQUIRED: The opaque data blob. // This typically contains the encrypted/wrapped key material. Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // REQUIRED: The name of algorithm // This typically contains the encrypted/wrapped key material. - Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` + PreviousVersionId *string `protobuf:"bytes,4,opt,name=previous_version_id,json=previousVersionId,proto3,oneof" json:"previous_version_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *KeyMaterial) Reset() { @@ -91,6 +92,13 @@ func (x *KeyMaterial) GetAlgorithm() string { return "" } +func (x *KeyMaterial) GetPreviousVersionId() string { + if x != nil && x.PreviousVersionId != nil { + return *x.PreviousVersionId + } + return "" +} + type StoreRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // REQUIRED: The namespace for this key material. This provides isolation @@ -450,14 +458,16 @@ var File_plugin_key_material_storage_v1_key_material_storage_proto protoreflect. const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = "" + "\n" + - "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\"s\n" + + "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\"\xc0\x01\n" + "\vKeyMaterial\x12\x1a\n" + "\x02id\x18\x01 \x01(\tB\n" + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\x02id\x12\x1e\n" + "\x04data\x18\x02 \x01(\fB\n" + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\x04data\x12(\n" + "\talgorithm\x18\x03 \x01(\tB\n" + - "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\talgorithm\"\x90\x01\n" + + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\talgorithm\x123\n" + + "\x13previous_version_id\x18\x04 \x01(\tH\x00R\x11previousVersionId\x88\x01\x01B\x16\n" + + "\x14_previous_version_id\"\x90\x01\n" + "\fStoreRequest\x12(\n" + "\tnamespace\x18\x01 \x01(\tB\n" + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tnamespace\x12V\n" + @@ -535,6 +545,7 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_init() { if File_plugin_key_material_storage_v1_key_material_storage_proto != nil { return } + file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[0].OneofWrappers = []any{} file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[5].OneofWrappers = []any{} file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[6].OneofWrappers = []any{} type x struct{} diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go index c26201c..8e0a10d 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go @@ -63,6 +63,10 @@ func (m *KeyMaterial) validate(all bool) error { // no validation rules for Algorithm + if m.PreviousVersionId != nil { + // no validation rules for PreviousVersionId + } + if len(errors) > 0 { return KeyMaterialMultiError(errors) } diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index 2388dc6..decf174 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -23,7 +23,7 @@ service KeyMaterialStorage { // It is intentionally generic and algorithm-agnostic. message KeyMaterial { // REQUIRED: The unique identifier for this item. - // e.g., "L2_01H8XGJWBWBAQ9Z7J6C6XJ6C6X" + // e.g., "L2/01H8XGJWBWBAQ9Z7J6C6XJ6C6X" string id = 1 [ (buf.validate.field).required = true, (buf.validate.field).string.min_len = 1 @@ -42,6 +42,8 @@ message KeyMaterial { (buf.validate.field).required = true, (buf.validate.field).string.min_len = 1 ]; + + optional string previous_version_id = 4; } // --- Store RPC Messages --- From 9b499a038755031e9db44f965a698470edbe2b69 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Fri, 13 Mar 2026 23:54:39 +0100 Subject: [PATCH 11/27] modify --- .../cipher_wrapper/v1/cipher_wrapper.pb.go | 191 +++++++++++++----- .../v1/cipher_wrapper.pb.validate.go | 165 +++++++++++++++ .../cipher_wrapper/v1/cipher_wrapper.proto | 24 ++- 3 files changed, 327 insertions(+), 53 deletions(-) diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go index b23f6ba..7346807 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go @@ -23,17 +23,79 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type KeyReference struct { + state protoimpl.MessageState `protogen:"open.v1"` + KeyId string `protobuf:"bytes,1,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` + Version *string `protobuf:"bytes,2,opt,name=version,proto3,oneof" json:"version,omitempty"` + Properties map[string]string `protobuf:"bytes,3,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyReference) Reset() { + *x = KeyReference{} + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyReference) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyReference) ProtoMessage() {} + +func (x *KeyReference) ProtoReflect() protoreflect.Message { + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyReference.ProtoReflect.Descriptor instead. +func (*KeyReference) Descriptor() ([]byte, []int) { + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{0} +} + +func (x *KeyReference) GetKeyId() string { + if x != nil { + return x.KeyId + } + return "" +} + +func (x *KeyReference) GetVersion() string { + if x != nil && x.Version != nil { + return *x.Version + } + return "" +} + +func (x *KeyReference) GetProperties() map[string]string { + if x != nil { + return x.Properties + } + return nil +} + // WrapRequest contains the raw key material and the context needed to encrypt it. type WrapRequest struct { state protoimpl.MessageState `protogen:"open.v1"` + // OPTIONAL/REQUIRED: The structured definition of the key to use. + Key *KeyReference `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // REQUIRED: The raw cryptographic material to be wrapped. - Plaintext []byte `protobuf:"bytes,1,opt,name=plaintext,proto3" json:"plaintext,omitempty"` + Plaintext []byte `protobuf:"bytes,2,opt,name=plaintext,proto3" json:"plaintext,omitempty"` // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. // Kept in proto because AAD often changes per request (e.g., binding to a specific Tenant ID). - Aad []byte `protobuf:"bytes,2,opt,name=aad,proto3,oneof" json:"aad,omitempty"` + Aad []byte `protobuf:"bytes,3,opt,name=aad,proto3,oneof" json:"aad,omitempty"` // OPTIONAL: Initialization Vector (IV) or Nonce. // Cryptographically dynamic, must remain in proto. - Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3,oneof" json:"iv,omitempty"` + Iv []byte `protobuf:"bytes,4,opt,name=iv,proto3,oneof" json:"iv,omitempty"` // OPTIONAL: Per-request dynamic context (if needed). // Kept as an escape hatch for truly dynamic per-request overrides. DynamicContext map[string]string `protobuf:"bytes,900,rep,name=dynamic_context,json=dynamicContext,proto3" json:"dynamic_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` @@ -43,7 +105,7 @@ type WrapRequest struct { func (x *WrapRequest) Reset() { *x = WrapRequest{} - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[0] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -55,7 +117,7 @@ func (x *WrapRequest) String() string { func (*WrapRequest) ProtoMessage() {} func (x *WrapRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[0] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -68,7 +130,14 @@ func (x *WrapRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WrapRequest.ProtoReflect.Descriptor instead. func (*WrapRequest) Descriptor() ([]byte, []int) { - return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{0} + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{1} +} + +func (x *WrapRequest) GetKey() *KeyReference { + if x != nil { + return x.Key + } + return nil } func (x *WrapRequest) GetPlaintext() []byte { @@ -116,7 +185,7 @@ type WrapResponse struct { func (x *WrapResponse) Reset() { *x = WrapResponse{} - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -128,7 +197,7 @@ func (x *WrapResponse) String() string { func (*WrapResponse) ProtoMessage() {} func (x *WrapResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -141,7 +210,7 @@ func (x *WrapResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use WrapResponse.ProtoReflect.Descriptor instead. func (*WrapResponse) Descriptor() ([]byte, []int) { - return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{1} + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{2} } func (x *WrapResponse) GetCiphertext() []byte { @@ -169,13 +238,15 @@ func (x *WrapResponse) GetIv() []byte { // originally used during the Wrap operation. type UnwrapRequest struct { state protoimpl.MessageState `protogen:"open.v1"` + // OPTIONAL/REQUIRED: The structured definition of the key to use. + Key *KeyReference `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. - Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` + Ciphertext []byte `protobuf:"bytes,2,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. - Aad []byte `protobuf:"bytes,2,opt,name=aad,proto3,oneof" json:"aad,omitempty"` + Aad []byte `protobuf:"bytes,3,opt,name=aad,proto3,oneof" json:"aad,omitempty"` // OPTIONAL: Initialization Vector (IV) or Nonce. // Must be provided if it was returned in the WrapResponse. - Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3,oneof" json:"iv,omitempty"` + Iv []byte `protobuf:"bytes,4,opt,name=iv,proto3,oneof" json:"iv,omitempty"` // OPTIONAL: Per-request dynamic context (if needed). // Kept as an escape hatch for truly dynamic per-request overrides. DynamicContext map[string]string `protobuf:"bytes,900,rep,name=dynamic_context,json=dynamicContext,proto3" json:"dynamic_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` @@ -185,7 +256,7 @@ type UnwrapRequest struct { func (x *UnwrapRequest) Reset() { *x = UnwrapRequest{} - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -197,7 +268,7 @@ func (x *UnwrapRequest) String() string { func (*UnwrapRequest) ProtoMessage() {} func (x *UnwrapRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -210,7 +281,14 @@ func (x *UnwrapRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UnwrapRequest.ProtoReflect.Descriptor instead. func (*UnwrapRequest) Descriptor() ([]byte, []int) { - return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{2} + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{3} +} + +func (x *UnwrapRequest) GetKey() *KeyReference { + if x != nil { + return x.Key + } + return nil } func (x *UnwrapRequest) GetCiphertext() []byte { @@ -252,7 +330,7 @@ type UnwrapResponse struct { func (x *UnwrapResponse) Reset() { *x = UnwrapResponse{} - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -264,7 +342,7 @@ func (x *UnwrapResponse) String() string { func (*UnwrapResponse) ProtoMessage() {} func (x *UnwrapResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -277,7 +355,7 @@ func (x *UnwrapResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UnwrapResponse.ProtoReflect.Descriptor instead. func (*UnwrapResponse) Descriptor() ([]byte, []int) { - return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{3} + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{4} } func (x *UnwrapResponse) GetPlaintext() []byte { @@ -291,12 +369,24 @@ var File_plugin_cipher_wrapper_v1_cipher_wrapper_proto protoreflect.FileDescript const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\n" + - "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x18plugin.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\x9a\x02\n" + - "\vWrapRequest\x12(\n" + - "\tplaintext\x18\x01 \x01(\fB\n" + + "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x18plugin.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\xe7\x01\n" + + "\fKeyReference\x12\x15\n" + + "\x06key_id\x18\x01 \x01(\tR\x05keyId\x12\x1d\n" + + "\aversion\x18\x02 \x01(\tH\x00R\aversion\x88\x01\x01\x12V\n" + + "\n" + + "properties\x18\x03 \x03(\v26.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntryR\n" + + "properties\x1a=\n" + + "\x0fPropertiesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\n" + + "\n" + + "\b_version\"\xdc\x02\n" + + "\vWrapRequest\x12@\n" + + "\x03key\x18\x01 \x01(\v2&.plugin.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12(\n" + + "\tplaintext\x18\x02 \x01(\fB\n" + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\tplaintext\x12\x15\n" + - "\x03aad\x18\x02 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12c\n" + + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + + "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12c\n" + "\x0fdynamic_context\x18\x84\a \x03(\v29.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + "\x13DynamicContextEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + @@ -310,14 +400,15 @@ const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\x0ekey_version_id\x18\x02 \x01(\tH\x00R\fkeyVersionId\x88\x01\x01\x12\x13\n" + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01B\x11\n" + "\x0f_key_version_idB\x05\n" + - "\x03_iv\"\xa0\x02\n" + - "\rUnwrapRequest\x12*\n" + + "\x03_iv\"\xe2\x02\n" + + "\rUnwrapRequest\x12@\n" + + "\x03key\x18\x01 \x01(\v2&.plugin.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12*\n" + "\n" + - "ciphertext\x18\x01 \x01(\fB\n" + + "ciphertext\x18\x02 \x01(\fB\n" + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\n" + "ciphertext\x12\x15\n" + - "\x03aad\x18\x02 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01\x12e\n" + + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + + "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12e\n" + "\x0fdynamic_context\x18\x84\a \x03(\v2;.plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + "\x13DynamicContextEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + @@ -343,27 +434,32 @@ func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP() []byte { return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescData } -var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_goTypes = []any{ - (*WrapRequest)(nil), // 0: plugin.cipher_wrapper.v1.WrapRequest - (*WrapResponse)(nil), // 1: plugin.cipher_wrapper.v1.WrapResponse - (*UnwrapRequest)(nil), // 2: plugin.cipher_wrapper.v1.UnwrapRequest - (*UnwrapResponse)(nil), // 3: plugin.cipher_wrapper.v1.UnwrapResponse - nil, // 4: plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry - nil, // 5: plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry + (*KeyReference)(nil), // 0: plugin.cipher_wrapper.v1.KeyReference + (*WrapRequest)(nil), // 1: plugin.cipher_wrapper.v1.WrapRequest + (*WrapResponse)(nil), // 2: plugin.cipher_wrapper.v1.WrapResponse + (*UnwrapRequest)(nil), // 3: plugin.cipher_wrapper.v1.UnwrapRequest + (*UnwrapResponse)(nil), // 4: plugin.cipher_wrapper.v1.UnwrapResponse + nil, // 5: plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry + nil, // 6: plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry + nil, // 7: plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry } var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_depIdxs = []int32{ - 4, // 0: plugin.cipher_wrapper.v1.WrapRequest.dynamic_context:type_name -> plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry - 5, // 1: plugin.cipher_wrapper.v1.UnwrapRequest.dynamic_context:type_name -> plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry - 0, // 2: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> plugin.cipher_wrapper.v1.WrapRequest - 2, // 3: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> plugin.cipher_wrapper.v1.UnwrapRequest - 1, // 4: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> plugin.cipher_wrapper.v1.WrapResponse - 3, // 5: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> plugin.cipher_wrapper.v1.UnwrapResponse - 4, // [4:6] is the sub-list for method output_type - 2, // [2:4] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 5, // 0: plugin.cipher_wrapper.v1.KeyReference.properties:type_name -> plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry + 0, // 1: plugin.cipher_wrapper.v1.WrapRequest.key:type_name -> plugin.cipher_wrapper.v1.KeyReference + 6, // 2: plugin.cipher_wrapper.v1.WrapRequest.dynamic_context:type_name -> plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry + 0, // 3: plugin.cipher_wrapper.v1.UnwrapRequest.key:type_name -> plugin.cipher_wrapper.v1.KeyReference + 7, // 4: plugin.cipher_wrapper.v1.UnwrapRequest.dynamic_context:type_name -> plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry + 1, // 5: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> plugin.cipher_wrapper.v1.WrapRequest + 3, // 6: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> plugin.cipher_wrapper.v1.UnwrapRequest + 2, // 7: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> plugin.cipher_wrapper.v1.WrapResponse + 4, // 8: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> plugin.cipher_wrapper.v1.UnwrapResponse + 7, // [7:9] is the sub-list for method output_type + 5, // [5:7] 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 } func init() { file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_init() } @@ -374,13 +470,14 @@ func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_init() { file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[0].OneofWrappers = []any{} file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1].OneofWrappers = []any{} file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2].OneofWrappers = []any{} + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc), len(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc)), NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go index a7926e3..88c88c1 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go @@ -35,6 +35,113 @@ var ( _ = sort.Sort ) +// Validate checks the field values on KeyReference with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *KeyReference) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeyReference with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in KeyReferenceMultiError, or +// nil if none found. +func (m *KeyReference) ValidateAll() error { + return m.validate(true) +} + +func (m *KeyReference) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for KeyId + + // no validation rules for Properties + + if m.Version != nil { + // no validation rules for Version + } + + if len(errors) > 0 { + return KeyReferenceMultiError(errors) + } + + return nil +} + +// KeyReferenceMultiError is an error wrapping multiple validation errors +// returned by KeyReference.ValidateAll() if the designated constraints aren't met. +type KeyReferenceMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyReferenceMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyReferenceMultiError) AllErrors() []error { return m } + +// KeyReferenceValidationError is the validation error returned by +// KeyReference.Validate if the designated constraints aren't met. +type KeyReferenceValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyReferenceValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyReferenceValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyReferenceValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyReferenceValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyReferenceValidationError) ErrorName() string { return "KeyReferenceValidationError" } + +// Error satisfies the builtin error interface +func (e KeyReferenceValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyReference.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyReferenceValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyReferenceValidationError{} + // Validate checks the field values on WrapRequest with the rules defined in // the proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. @@ -57,6 +164,35 @@ func (m *WrapRequest) validate(all bool) error { var errors []error + if all { + switch v := interface{}(m.GetKey()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WrapRequestValidationError{ + field: "Key", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WrapRequestValidationError{ + field: "Key", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKey()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return WrapRequestValidationError{ + field: "Key", + reason: "embedded message failed validation", + cause: err, + } + } + } + // no validation rules for Plaintext // no validation rules for DynamicContext @@ -277,6 +413,35 @@ func (m *UnwrapRequest) validate(all bool) error { var errors []error + if all { + switch v := interface{}(m.GetKey()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UnwrapRequestValidationError{ + field: "Key", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UnwrapRequestValidationError{ + field: "Key", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKey()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UnwrapRequestValidationError{ + field: "Key", + reason: "embedded message failed validation", + cause: err, + } + } + } + // no validation rules for Ciphertext // no validation rules for DynamicContext diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto index 49b5586..924d620 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto @@ -17,21 +17,30 @@ service CipherWrapper { rpc Unwrap(UnwrapRequest) returns (UnwrapResponse); } +message KeyReference { + string key_id = 1; + optional string version = 2; + map properties = 3; +} + // WrapRequest contains the raw key material and the context needed to encrypt it. message WrapRequest { + // OPTIONAL/REQUIRED: The structured definition of the key to use. + KeyReference key = 1 [(buf.validate.field).required = true]; + // REQUIRED: The raw cryptographic material to be wrapped. - bytes plaintext = 1 [ + bytes plaintext = 2 [ (buf.validate.field).required = true, (buf.validate.field).bytes.min_len = 1 ]; // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. // Kept in proto because AAD often changes per request (e.g., binding to a specific Tenant ID). - optional bytes aad = 2; + optional bytes aad = 3; // OPTIONAL: Initialization Vector (IV) or Nonce. // Cryptographically dynamic, must remain in proto. - optional bytes iv = 3; + optional bytes iv = 4; // OPTIONAL: Per-request dynamic context (if needed). // Kept as an escape hatch for truly dynamic per-request overrides. @@ -55,18 +64,21 @@ message WrapResponse { // UnwrapRequest contains the opaque ciphertext and the exact parameters // originally used during the Wrap operation. message UnwrapRequest { + // OPTIONAL/REQUIRED: The structured definition of the key to use. + KeyReference key = 1 [(buf.validate.field).required = true]; + // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. - bytes ciphertext = 1 [ + bytes ciphertext = 2 [ (buf.validate.field).required = true, (buf.validate.field).bytes.min_len = 1 ]; // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. - optional bytes aad = 2; + optional bytes aad = 3; // OPTIONAL: Initialization Vector (IV) or Nonce. // Must be provided if it was returned in the WrapResponse. - optional bytes iv = 3; + optional bytes iv = 4; // OPTIONAL: Per-request dynamic context (if needed). // Kept as an escape hatch for truly dynamic per-request overrides. From 051a3bab18c9b7996329ce351268635c9216df0c Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Sat, 14 Mar 2026 02:13:12 +0100 Subject: [PATCH 12/27] modify --- .../v1/key_material_storage.pb.go | 96 +++++++++++++------ .../v1/key_material_storage.pb.validate.go | 39 ++++++++ .../v1/key_material_storage.proto | 7 ++ 3 files changed, 113 insertions(+), 29 deletions(-) diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index 3582214..b6a4efe 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -14,6 +14,7 @@ import ( _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" ) const ( @@ -35,8 +36,11 @@ type KeyMaterial struct { Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // REQUIRED: The name of algorithm // This typically contains the encrypted/wrapped key material. - Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` - PreviousVersionId *string `protobuf:"bytes,4,opt,name=previous_version_id,json=previousVersionId,proto3,oneof" json:"previous_version_id,omitempty"` + Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` + PreviousVersionId *string `protobuf:"bytes,4,opt,name=previous_version_id,json=previousVersionId,proto3,oneof" json:"previous_version_id,omitempty"` + Checksum *string `protobuf:"bytes,5,opt,name=checksum,proto3,oneof" json:"checksum,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3,oneof" json:"created_at,omitempty"` + Tags map[string]string `protobuf:"bytes,100,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -99,6 +103,27 @@ func (x *KeyMaterial) GetPreviousVersionId() string { return "" } +func (x *KeyMaterial) GetChecksum() string { + if x != nil && x.Checksum != nil { + return *x.Checksum + } + return "" +} + +func (x *KeyMaterial) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +func (x *KeyMaterial) GetTags() map[string]string { + if x != nil { + return x.Tags + } + return nil +} + type StoreRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // REQUIRED: The namespace for this key material. This provides isolation @@ -458,7 +483,7 @@ var File_plugin_key_material_storage_v1_key_material_storage_proto protoreflect. const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = "" + "\n" + - "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\"\xc0\x01\n" + + "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc1\x03\n" + "\vKeyMaterial\x12\x1a\n" + "\x02id\x18\x01 \x01(\tB\n" + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\x02id\x12\x1e\n" + @@ -466,8 +491,17 @@ const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = " "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\x04data\x12(\n" + "\talgorithm\x18\x03 \x01(\tB\n" + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\talgorithm\x123\n" + - "\x13previous_version_id\x18\x04 \x01(\tH\x00R\x11previousVersionId\x88\x01\x01B\x16\n" + - "\x14_previous_version_id\"\x90\x01\n" + + "\x13previous_version_id\x18\x04 \x01(\tH\x00R\x11previousVersionId\x88\x01\x01\x12\x1f\n" + + "\bchecksum\x18\x05 \x01(\tH\x01R\bchecksum\x88\x01\x01\x12>\n" + + "\n" + + "created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampH\x02R\tcreatedAt\x88\x01\x01\x12I\n" + + "\x04tags\x18d \x03(\v25.plugin.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + + "\tTagsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x16\n" + + "\x14_previous_version_idB\v\n" + + "\t_checksumB\r\n" + + "\v_created_at\"\x90\x01\n" + "\fStoreRequest\x12(\n" + "\tnamespace\x18\x01 \x01(\tB\n" + "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tnamespace\x12V\n" + @@ -512,32 +546,36 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP( return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescData } -var file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_plugin_key_material_storage_v1_key_material_storage_proto_goTypes = []any{ - (*KeyMaterial)(nil), // 0: plugin.key_material_storage.v1.KeyMaterial - (*StoreRequest)(nil), // 1: plugin.key_material_storage.v1.StoreRequest - (*StoreResponse)(nil), // 2: plugin.key_material_storage.v1.StoreResponse - (*LoadRequest)(nil), // 3: plugin.key_material_storage.v1.LoadRequest - (*LoadResponse)(nil), // 4: plugin.key_material_storage.v1.LoadResponse - (*ListIDsRequest)(nil), // 5: plugin.key_material_storage.v1.ListIDsRequest - (*Filter)(nil), // 6: plugin.key_material_storage.v1.Filter - (*ListIDsResponse)(nil), // 7: plugin.key_material_storage.v1.ListIDsResponse + (*KeyMaterial)(nil), // 0: plugin.key_material_storage.v1.KeyMaterial + (*StoreRequest)(nil), // 1: plugin.key_material_storage.v1.StoreRequest + (*StoreResponse)(nil), // 2: plugin.key_material_storage.v1.StoreResponse + (*LoadRequest)(nil), // 3: plugin.key_material_storage.v1.LoadRequest + (*LoadResponse)(nil), // 4: plugin.key_material_storage.v1.LoadResponse + (*ListIDsRequest)(nil), // 5: plugin.key_material_storage.v1.ListIDsRequest + (*Filter)(nil), // 6: plugin.key_material_storage.v1.Filter + (*ListIDsResponse)(nil), // 7: plugin.key_material_storage.v1.ListIDsResponse + nil, // 8: plugin.key_material_storage.v1.KeyMaterial.TagsEntry + (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp } var file_plugin_key_material_storage_v1_key_material_storage_proto_depIdxs = []int32{ - 0, // 0: plugin.key_material_storage.v1.StoreRequest.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial - 0, // 1: plugin.key_material_storage.v1.LoadResponse.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial - 6, // 2: plugin.key_material_storage.v1.ListIDsRequest.filter:type_name -> plugin.key_material_storage.v1.Filter - 1, // 3: plugin.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> plugin.key_material_storage.v1.StoreRequest - 3, // 4: plugin.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> plugin.key_material_storage.v1.LoadRequest - 5, // 5: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:input_type -> plugin.key_material_storage.v1.ListIDsRequest - 2, // 6: plugin.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> plugin.key_material_storage.v1.StoreResponse - 4, // 7: plugin.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> plugin.key_material_storage.v1.LoadResponse - 7, // 8: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:output_type -> plugin.key_material_storage.v1.ListIDsResponse - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 9, // 0: plugin.key_material_storage.v1.KeyMaterial.created_at:type_name -> google.protobuf.Timestamp + 8, // 1: plugin.key_material_storage.v1.KeyMaterial.tags:type_name -> plugin.key_material_storage.v1.KeyMaterial.TagsEntry + 0, // 2: plugin.key_material_storage.v1.StoreRequest.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial + 0, // 3: plugin.key_material_storage.v1.LoadResponse.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial + 6, // 4: plugin.key_material_storage.v1.ListIDsRequest.filter:type_name -> plugin.key_material_storage.v1.Filter + 1, // 5: plugin.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> plugin.key_material_storage.v1.StoreRequest + 3, // 6: plugin.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> plugin.key_material_storage.v1.LoadRequest + 5, // 7: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:input_type -> plugin.key_material_storage.v1.ListIDsRequest + 2, // 8: plugin.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> plugin.key_material_storage.v1.StoreResponse + 4, // 9: plugin.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> plugin.key_material_storage.v1.LoadResponse + 7, // 10: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:output_type -> plugin.key_material_storage.v1.ListIDsResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] 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 } func init() { file_plugin_key_material_storage_v1_key_material_storage_proto_init() } @@ -554,7 +592,7 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc), len(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc)), NumEnums: 0, - NumMessages: 8, + NumMessages: 9, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go index 8e0a10d..d0b2702 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go @@ -63,10 +63,49 @@ func (m *KeyMaterial) validate(all bool) error { // no validation rules for Algorithm + // no validation rules for Tags + if m.PreviousVersionId != nil { // no validation rules for PreviousVersionId } + if m.Checksum != nil { + // no validation rules for Checksum + } + + if m.CreatedAt != nil { + + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyMaterialValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyMaterialValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyMaterialValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + if len(errors) > 0 { return KeyMaterialMultiError(errors) } diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index decf174..f612a1d 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package plugin.key_material_storage.v1; import "buf/validate/validate.proto"; +import "google/protobuf/timestamp.proto"; // KeyMaterialStorage defines the universal interface for persisting and // retrieving opaque blobs of data, typically wrapped key material. @@ -44,6 +45,12 @@ message KeyMaterial { ]; optional string previous_version_id = 4; + + optional string checksum = 5; + + optional google.protobuf.Timestamp created_at = 6; + + map tags = 100; } // --- Store RPC Messages --- From d3d3204a5c9a04cca3d626e90813995ddc389ce3 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Sat, 14 Mar 2026 02:18:27 +0100 Subject: [PATCH 13/27] modify --- .../v1/key_material_storage.pb.go | 644 +++++++++---- .../v1/key_material_storage.pb.validate.go | 845 +++++++++++++++--- .../v1/key_material_storage.proto | 140 ++- .../v1/key_material_storage_grpc.pb.go | 50 +- 4 files changed, 1283 insertions(+), 396 deletions(-) diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index b6a4efe..d57aa1a 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -25,22 +25,15 @@ const ( ) // KeyMaterial represents a single unit of stored data. -// It is intentionally generic and algorithm-agnostic. type KeyMaterial struct { - state protoimpl.MessageState `protogen:"open.v1"` - // REQUIRED: The unique identifier for this item. - // e.g., "L2/01H8XGJWBWBAQ9Z7J6C6XJ6C6X" - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // REQUIRED: The opaque data blob. - // This typically contains the encrypted/wrapped key material. - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - // REQUIRED: The name of algorithm - // This typically contains the encrypted/wrapped key material. + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` PreviousVersionId *string `protobuf:"bytes,4,opt,name=previous_version_id,json=previousVersionId,proto3,oneof" json:"previous_version_id,omitempty"` Checksum *string `protobuf:"bytes,5,opt,name=checksum,proto3,oneof" json:"checksum,omitempty"` - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3,oneof" json:"created_at,omitempty"` - Tags map[string]string `protobuf:"bytes,100,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Tags map[string]string `protobuf:"bytes,7,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -124,20 +117,209 @@ func (x *KeyMaterial) GetTags() map[string]string { return nil } -type StoreRequest struct { +type Filter struct { state protoimpl.MessageState `protogen:"open.v1"` - // REQUIRED: The namespace for this key material. This provides isolation - // and can be mapped to a tenant, project, or customer ID. - Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` - // REQUIRED: The item to be stored. - KeyMaterial *KeyMaterial `protobuf:"bytes,2,opt,name=key_material,json=keyMaterial,proto3" json:"key_material,omitempty"` + Id *Filter_StringMatch `protobuf:"bytes,1,opt,name=id,proto3,oneof" json:"id,omitempty"` + // Filter by cryptographic algorithm (e.g., "AES-256-GCM"). + Algorithm *string `protobuf:"bytes,2,opt,name=algorithm,proto3,oneof" json:"algorithm,omitempty"` + // Filter by metadata tags (e.g., {"env": "prod"}). + // Match is typically performed as "contains all". + Tags map[string]string `protobuf:"bytes,3,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + CreatedAt *Filter_TimeRange `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3,oneof" json:"created_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Filter) Reset() { + *x = Filter{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Filter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Filter) ProtoMessage() {} + +func (x *Filter) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Filter.ProtoReflect.Descriptor instead. +func (*Filter) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{1} +} + +func (x *Filter) GetId() *Filter_StringMatch { + if x != nil { + return x.Id + } + return nil +} + +func (x *Filter) GetAlgorithm() string { + if x != nil && x.Algorithm != nil { + return *x.Algorithm + } + return "" +} + +func (x *Filter) GetTags() map[string]string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Filter) GetCreatedAt() *Filter_TimeRange { + if x != nil { + return x.CreatedAt + } + return nil +} + +type ListIDsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + Filter *Filter `protobuf:"bytes,2,opt,name=filter,proto3,oneof" json:"filter,omitempty"` + // Pagination support + PageSize uint32 `protobuf:"varint,3,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + PageToken string `protobuf:"bytes,4,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListIDsRequest) Reset() { + *x = ListIDsRequest{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListIDsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIDsRequest) ProtoMessage() {} + +func (x *ListIDsRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIDsRequest.ProtoReflect.Descriptor instead. +func (*ListIDsRequest) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{2} +} + +func (x *ListIDsRequest) GetNamespace() string { + if x != nil { + return x.Namespace + } + return "" +} + +func (x *ListIDsRequest) GetFilter() *Filter { + if x != nil { + return x.Filter + } + return nil +} + +func (x *ListIDsRequest) GetPageSize() uint32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListIDsRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type ListIDsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListIDsResponse) Reset() { + *x = ListIDsResponse{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListIDsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListIDsResponse) ProtoMessage() {} + +func (x *ListIDsResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListIDsResponse.ProtoReflect.Descriptor instead. +func (*ListIDsResponse) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{3} +} + +func (x *ListIDsResponse) GetIds() []string { + if x != nil { + return x.Ids + } + return nil +} + +func (x *ListIDsResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +type StoreRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + KeyMaterial *KeyMaterial `protobuf:"bytes,2,opt,name=key_material,json=keyMaterial,proto3" json:"key_material,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *StoreRequest) Reset() { *x = StoreRequest{} - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[1] + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -149,7 +331,7 @@ func (x *StoreRequest) String() string { func (*StoreRequest) ProtoMessage() {} func (x *StoreRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[1] + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -162,7 +344,7 @@ func (x *StoreRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StoreRequest.ProtoReflect.Descriptor instead. func (*StoreRequest) Descriptor() ([]byte, []int) { - return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{1} + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{4} } func (x *StoreRequest) GetNamespace() string { @@ -187,7 +369,7 @@ type StoreResponse struct { func (x *StoreResponse) Reset() { *x = StoreResponse{} - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[2] + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -199,7 +381,7 @@ func (x *StoreResponse) String() string { func (*StoreResponse) ProtoMessage() {} func (x *StoreResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[2] + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -212,22 +394,20 @@ func (x *StoreResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use StoreResponse.ProtoReflect.Descriptor instead. func (*StoreResponse) Descriptor() ([]byte, []int) { - return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{2} + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{5} } type LoadRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // REQUIRED: The namespace for the item. - Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` - // REQUIRED: The unique ID of the item to retrieve. - Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *LoadRequest) Reset() { *x = LoadRequest{} - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[3] + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -239,7 +419,7 @@ func (x *LoadRequest) String() string { func (*LoadRequest) ProtoMessage() {} func (x *LoadRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[3] + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -252,7 +432,7 @@ func (x *LoadRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LoadRequest.ProtoReflect.Descriptor instead. func (*LoadRequest) Descriptor() ([]byte, []int) { - return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{3} + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{6} } func (x *LoadRequest) GetNamespace() string { @@ -270,17 +450,15 @@ func (x *LoadRequest) GetId() string { } type LoadResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // The retrieved key material. - // If the key is not found, the RPC will return a `NOT_FOUND` gRPC error. - KeyMaterial *KeyMaterial `protobuf:"bytes,1,opt,name=key_material,json=keyMaterial,proto3" json:"key_material,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + KeyMaterial *KeyMaterial `protobuf:"bytes,1,opt,name=key_material,json=keyMaterial,proto3" json:"key_material,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *LoadResponse) Reset() { *x = LoadResponse{} - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[4] + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -292,7 +470,7 @@ func (x *LoadResponse) String() string { func (*LoadResponse) ProtoMessage() {} func (x *LoadResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[4] + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -305,7 +483,7 @@ func (x *LoadResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use LoadResponse.ProtoReflect.Descriptor instead. func (*LoadResponse) Descriptor() ([]byte, []int) { - return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{4} + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{7} } func (x *LoadResponse) GetKeyMaterial() *KeyMaterial { @@ -315,32 +493,29 @@ func (x *LoadResponse) GetKeyMaterial() *KeyMaterial { return nil } -type ListIDsRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // REQUIRED: The namespace to search in. - Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` - // OPTIONAL: Filter criteria for listing IDs. - // If not provided, all IDs in the namespace are returned. - Filter *Filter `protobuf:"bytes,2,opt,name=filter,proto3,oneof" json:"filter,omitempty"` +type DeleteRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ListIDsRequest) Reset() { - *x = ListIDsRequest{} - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[5] +func (x *DeleteRequest) Reset() { + *x = DeleteRequest{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ListIDsRequest) String() string { +func (x *DeleteRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListIDsRequest) ProtoMessage() {} +func (*DeleteRequest) ProtoMessage() {} -func (x *ListIDsRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[5] +func (x *DeleteRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -351,52 +526,90 @@ func (x *ListIDsRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListIDsRequest.ProtoReflect.Descriptor instead. -func (*ListIDsRequest) Descriptor() ([]byte, []int) { - return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{5} +// Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. +func (*DeleteRequest) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{8} } -func (x *ListIDsRequest) GetNamespace() string { +func (x *DeleteRequest) GetNamespace() string { if x != nil { return x.Namespace } return "" } -func (x *ListIDsRequest) GetFilter() *Filter { +func (x *DeleteRequest) GetId() string { if x != nil { - return x.Filter + return x.Id } - return nil + return "" } -type Filter struct { +type DeleteResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteResponse) Reset() { + *x = DeleteResponse{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteResponse) ProtoMessage() {} + +func (x *DeleteResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. +func (*DeleteResponse) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{9} +} + +// Pattern-based matching for the primary Key ID. +type Filter_StringMatch struct { state protoimpl.MessageState `protogen:"open.v1"` - // OPTIONAL: Filter IDs that start with this string. - Prefix *string `protobuf:"bytes,1,opt,name=prefix,proto3,oneof" json:"prefix,omitempty"` - // OPTIONAL: Filter IDs that end with this string. - Suffix *string `protobuf:"bytes,2,opt,name=suffix,proto3,oneof" json:"suffix,omitempty"` - // OPTIONAL: Filter IDs that contain this string. - Contains *string `protobuf:"bytes,3,opt,name=contains,proto3,oneof" json:"contains,omitempty"` + // Types that are valid to be assigned to Type: + // + // *Filter_StringMatch_Prefix + // *Filter_StringMatch_Suffix + // *Filter_StringMatch_Contains + // *Filter_StringMatch_Exact + Type isFilter_StringMatch_Type `protobuf_oneof:"type"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *Filter) Reset() { - *x = Filter{} - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[6] +func (x *Filter_StringMatch) Reset() { + *x = Filter_StringMatch{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *Filter) String() string { +func (x *Filter_StringMatch) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Filter) ProtoMessage() {} +func (*Filter_StringMatch) ProtoMessage() {} -func (x *Filter) ProtoReflect() protoreflect.Message { - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[6] +func (x *Filter_StringMatch) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -407,56 +620,106 @@ func (x *Filter) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Filter.ProtoReflect.Descriptor instead. -func (*Filter) Descriptor() ([]byte, []int) { - return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{6} +// Deprecated: Use Filter_StringMatch.ProtoReflect.Descriptor instead. +func (*Filter_StringMatch) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{1, 0} } -func (x *Filter) GetPrefix() string { - if x != nil && x.Prefix != nil { - return *x.Prefix +func (x *Filter_StringMatch) GetType() isFilter_StringMatch_Type { + if x != nil { + return x.Type + } + return nil +} + +func (x *Filter_StringMatch) GetPrefix() string { + if x != nil { + if x, ok := x.Type.(*Filter_StringMatch_Prefix); ok { + return x.Prefix + } } return "" } -func (x *Filter) GetSuffix() string { - if x != nil && x.Suffix != nil { - return *x.Suffix +func (x *Filter_StringMatch) GetSuffix() string { + if x != nil { + if x, ok := x.Type.(*Filter_StringMatch_Suffix); ok { + return x.Suffix + } } return "" } -func (x *Filter) GetContains() string { - if x != nil && x.Contains != nil { - return *x.Contains +func (x *Filter_StringMatch) GetContains() string { + if x != nil { + if x, ok := x.Type.(*Filter_StringMatch_Contains); ok { + return x.Contains + } } return "" } -type ListIDsResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // A list of key material IDs that match the request criteria. - // The server may stream multiple responses, each containing a batch of IDs. - Ids []string `protobuf:"bytes,1,rep,name=ids,proto3" json:"ids,omitempty"` +func (x *Filter_StringMatch) GetExact() string { + if x != nil { + if x, ok := x.Type.(*Filter_StringMatch_Exact); ok { + return x.Exact + } + } + return "" +} + +type isFilter_StringMatch_Type interface { + isFilter_StringMatch_Type() +} + +type Filter_StringMatch_Prefix struct { + Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3,oneof"` +} + +type Filter_StringMatch_Suffix struct { + Suffix string `protobuf:"bytes,2,opt,name=suffix,proto3,oneof"` +} + +type Filter_StringMatch_Contains struct { + Contains string `protobuf:"bytes,3,opt,name=contains,proto3,oneof"` +} + +type Filter_StringMatch_Exact struct { + Exact string `protobuf:"bytes,4,opt,name=exact,proto3,oneof"` +} + +func (*Filter_StringMatch_Prefix) isFilter_StringMatch_Type() {} + +func (*Filter_StringMatch_Suffix) isFilter_StringMatch_Type() {} + +func (*Filter_StringMatch_Contains) isFilter_StringMatch_Type() {} + +func (*Filter_StringMatch_Exact) isFilter_StringMatch_Type() {} + +// Filter by the time the key was created. +type Filter_TimeRange struct { + state protoimpl.MessageState `protogen:"open.v1"` + From *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"` + To *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } -func (x *ListIDsResponse) Reset() { - *x = ListIDsResponse{} - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[7] +func (x *Filter_TimeRange) Reset() { + *x = Filter_TimeRange{} + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *ListIDsResponse) String() string { +func (x *Filter_TimeRange) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListIDsResponse) ProtoMessage() {} +func (*Filter_TimeRange) ProtoMessage() {} -func (x *ListIDsResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[7] +func (x *Filter_TimeRange) ProtoReflect() protoreflect.Message { + mi := &file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -467,14 +730,21 @@ func (x *ListIDsResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListIDsResponse.ProtoReflect.Descriptor instead. -func (*ListIDsResponse) Descriptor() ([]byte, []int) { - return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{7} +// Deprecated: Use Filter_TimeRange.ProtoReflect.Descriptor instead. +func (*Filter_TimeRange) Descriptor() ([]byte, []int) { + return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP(), []int{1, 2} } -func (x *ListIDsResponse) GetIds() []string { +func (x *Filter_TimeRange) GetFrom() *timestamppb.Timestamp { if x != nil { - return x.Ids + return x.From + } + return nil +} + +func (x *Filter_TimeRange) GetTo() *timestamppb.Timestamp { + if x != nil { + return x.To } return nil } @@ -483,54 +753,70 @@ var File_plugin_key_material_storage_v1_key_material_storage_proto protoreflect. const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = "" + "\n" + - "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc1\x03\n" + - "\vKeyMaterial\x12\x1a\n" + - "\x02id\x18\x01 \x01(\tB\n" + - "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\x02id\x12\x1e\n" + - "\x04data\x18\x02 \x01(\fB\n" + - "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\x04data\x12(\n" + - "\talgorithm\x18\x03 \x01(\tB\n" + - "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\talgorithm\x123\n" + + "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa4\x03\n" + + "\vKeyMaterial\x12\x17\n" + + "\x02id\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\x12\x1b\n" + + "\x04data\x18\x02 \x01(\fB\a\xbaH\x04z\x02\x10\x01R\x04data\x12%\n" + + "\talgorithm\x18\x03 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\talgorithm\x123\n" + "\x13previous_version_id\x18\x04 \x01(\tH\x00R\x11previousVersionId\x88\x01\x01\x12\x1f\n" + - "\bchecksum\x18\x05 \x01(\tH\x01R\bchecksum\x88\x01\x01\x12>\n" + + "\bchecksum\x18\x05 \x01(\tH\x01R\bchecksum\x88\x01\x01\x129\n" + "\n" + - "created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampH\x02R\tcreatedAt\x88\x01\x01\x12I\n" + - "\x04tags\x18d \x03(\v25.plugin.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + + "created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x12I\n" + + "\x04tags\x18\a \x03(\v25.plugin.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + "\tTagsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x16\n" + "\x14_previous_version_idB\v\n" + - "\t_checksumB\r\n" + - "\v_created_at\"\x90\x01\n" + - "\fStoreRequest\x12(\n" + - "\tnamespace\x18\x01 \x01(\tB\n" + - "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tnamespace\x12V\n" + + "\t_checksum\"\xd7\x04\n" + + "\x06Filter\x12G\n" + + "\x02id\x18\x01 \x01(\v22.plugin.key_material_storage.v1.Filter.StringMatchH\x00R\x02id\x88\x01\x01\x12!\n" + + "\talgorithm\x18\x02 \x01(\tH\x01R\talgorithm\x88\x01\x01\x12D\n" + + "\x04tags\x18\x03 \x03(\v20.plugin.key_material_storage.v1.Filter.TagsEntryR\x04tags\x12T\n" + + "\n" + + "created_at\x18\x04 \x01(\v20.plugin.key_material_storage.v1.Filter.TimeRangeH\x02R\tcreatedAt\x88\x01\x01\x1a\x7f\n" + + "\vStringMatch\x12\x18\n" + + "\x06prefix\x18\x01 \x01(\tH\x00R\x06prefix\x12\x18\n" + + "\x06suffix\x18\x02 \x01(\tH\x00R\x06suffix\x12\x1c\n" + + "\bcontains\x18\x03 \x01(\tH\x00R\bcontains\x12\x16\n" + + "\x05exact\x18\x04 \x01(\tH\x00R\x05exactB\x06\n" + + "\x04type\x1a7\n" + + "\tTagsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1ag\n" + + "\tTimeRange\x12.\n" + + "\x04from\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\x04from\x12*\n" + + "\x02to\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x02toB\x05\n" + + "\x03_idB\f\n" + + "\n" + + "_algorithmB\r\n" + + "\v_created_at\"\xc3\x01\n" + + "\x0eListIDsRequest\x12%\n" + + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12C\n" + + "\x06filter\x18\x02 \x01(\v2&.plugin.key_material_storage.v1.FilterH\x00R\x06filter\x88\x01\x01\x12\x1b\n" + + "\tpage_size\x18\x03 \x01(\rR\bpageSize\x12\x1d\n" + + "\n" + + "page_token\x18\x04 \x01(\tR\tpageTokenB\t\n" + + "\a_filter\"K\n" + + "\x0fListIDsResponse\x12\x10\n" + + "\x03ids\x18\x01 \x03(\tR\x03ids\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x8d\x01\n" + + "\fStoreRequest\x12%\n" + + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12V\n" + "\fkey_material\x18\x02 \x01(\v2+.plugin.key_material_storage.v1.KeyMaterialB\x06\xbaH\x03\xc8\x01\x01R\vkeyMaterial\"\x0f\n" + - "\rStoreResponse\"S\n" + - "\vLoadRequest\x12(\n" + - "\tnamespace\x18\x01 \x01(\tB\n" + - "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tnamespace\x12\x1a\n" + - "\x02id\x18\x02 \x01(\tB\n" + - "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\x02id\"^\n" + + "\rStoreResponse\"M\n" + + "\vLoadRequest\x12%\n" + + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12\x17\n" + + "\x02id\x18\x02 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\"^\n" + "\fLoadResponse\x12N\n" + - "\fkey_material\x18\x01 \x01(\v2+.plugin.key_material_storage.v1.KeyMaterialR\vkeyMaterial\"\x8a\x01\n" + - "\x0eListIDsRequest\x12(\n" + - "\tnamespace\x18\x01 \x01(\tB\n" + - "\xbaH\a\xc8\x01\x01r\x02\x10\x01R\tnamespace\x12C\n" + - "\x06filter\x18\x02 \x01(\v2&.plugin.key_material_storage.v1.FilterH\x00R\x06filter\x88\x01\x01B\t\n" + - "\a_filter\"\x86\x01\n" + - "\x06Filter\x12\x1b\n" + - "\x06prefix\x18\x01 \x01(\tH\x00R\x06prefix\x88\x01\x01\x12\x1b\n" + - "\x06suffix\x18\x02 \x01(\tH\x01R\x06suffix\x88\x01\x01\x12\x1f\n" + - "\bcontains\x18\x03 \x01(\tH\x02R\bcontains\x88\x01\x01B\t\n" + - "\a_prefixB\t\n" + - "\a_suffixB\v\n" + - "\t_contains\"#\n" + - "\x0fListIDsResponse\x12\x10\n" + - "\x03ids\x18\x01 \x03(\tR\x03ids2\xcb\x02\n" + + "\fkey_material\x18\x01 \x01(\v2+.plugin.key_material_storage.v1.KeyMaterialR\vkeyMaterial\"O\n" + + "\rDeleteRequest\x12%\n" + + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12\x17\n" + + "\x02id\x18\x02 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\"\x10\n" + + "\x0eDeleteResponse2\xb4\x03\n" + "\x12KeyMaterialStorage\x12d\n" + "\x05Store\x12,.plugin.key_material_storage.v1.StoreRequest\x1a-.plugin.key_material_storage.v1.StoreResponse\x12a\n" + - "\x04Load\x12+.plugin.key_material_storage.v1.LoadRequest\x1a,.plugin.key_material_storage.v1.LoadResponse\x12l\n" + + "\x04Load\x12+.plugin.key_material_storage.v1.LoadRequest\x1a,.plugin.key_material_storage.v1.LoadResponse\x12g\n" + + "\x06Delete\x12-.plugin.key_material_storage.v1.DeleteRequest\x1a..plugin.key_material_storage.v1.DeleteResponse\x12l\n" + "\aListIDs\x12..plugin.key_material_storage.v1.ListIDsRequest\x1a/.plugin.key_material_storage.v1.ListIDsResponse0\x01B\xaa\x02\n" + "\"com.plugin.key_material_storage.v1B\x17KeyMaterialStorageProtoP\x01ZYgithub.com/openkcm/plugin-sdk/proto/plugin/key_material_storage/v1;key_material_storagev1\xa2\x02\x03PKX\xaa\x02\x1cPlugin.KeyMaterialStorage.V1\xca\x02\x1cPlugin\\KeyMaterialStorage\\V1\xe2\x02(Plugin\\KeyMaterialStorage\\V1\\GPBMetadata\xea\x02\x1ePlugin::KeyMaterialStorage::V1b\x06proto3" @@ -546,36 +832,48 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP( return file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescData } -var file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_plugin_key_material_storage_v1_key_material_storage_proto_goTypes = []any{ (*KeyMaterial)(nil), // 0: plugin.key_material_storage.v1.KeyMaterial - (*StoreRequest)(nil), // 1: plugin.key_material_storage.v1.StoreRequest - (*StoreResponse)(nil), // 2: plugin.key_material_storage.v1.StoreResponse - (*LoadRequest)(nil), // 3: plugin.key_material_storage.v1.LoadRequest - (*LoadResponse)(nil), // 4: plugin.key_material_storage.v1.LoadResponse - (*ListIDsRequest)(nil), // 5: plugin.key_material_storage.v1.ListIDsRequest - (*Filter)(nil), // 6: plugin.key_material_storage.v1.Filter - (*ListIDsResponse)(nil), // 7: plugin.key_material_storage.v1.ListIDsResponse - nil, // 8: plugin.key_material_storage.v1.KeyMaterial.TagsEntry - (*timestamppb.Timestamp)(nil), // 9: google.protobuf.Timestamp + (*Filter)(nil), // 1: plugin.key_material_storage.v1.Filter + (*ListIDsRequest)(nil), // 2: plugin.key_material_storage.v1.ListIDsRequest + (*ListIDsResponse)(nil), // 3: plugin.key_material_storage.v1.ListIDsResponse + (*StoreRequest)(nil), // 4: plugin.key_material_storage.v1.StoreRequest + (*StoreResponse)(nil), // 5: plugin.key_material_storage.v1.StoreResponse + (*LoadRequest)(nil), // 6: plugin.key_material_storage.v1.LoadRequest + (*LoadResponse)(nil), // 7: plugin.key_material_storage.v1.LoadResponse + (*DeleteRequest)(nil), // 8: plugin.key_material_storage.v1.DeleteRequest + (*DeleteResponse)(nil), // 9: plugin.key_material_storage.v1.DeleteResponse + nil, // 10: plugin.key_material_storage.v1.KeyMaterial.TagsEntry + (*Filter_StringMatch)(nil), // 11: plugin.key_material_storage.v1.Filter.StringMatch + nil, // 12: plugin.key_material_storage.v1.Filter.TagsEntry + (*Filter_TimeRange)(nil), // 13: plugin.key_material_storage.v1.Filter.TimeRange + (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp } var file_plugin_key_material_storage_v1_key_material_storage_proto_depIdxs = []int32{ - 9, // 0: plugin.key_material_storage.v1.KeyMaterial.created_at:type_name -> google.protobuf.Timestamp - 8, // 1: plugin.key_material_storage.v1.KeyMaterial.tags:type_name -> plugin.key_material_storage.v1.KeyMaterial.TagsEntry - 0, // 2: plugin.key_material_storage.v1.StoreRequest.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial - 0, // 3: plugin.key_material_storage.v1.LoadResponse.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial - 6, // 4: plugin.key_material_storage.v1.ListIDsRequest.filter:type_name -> plugin.key_material_storage.v1.Filter - 1, // 5: plugin.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> plugin.key_material_storage.v1.StoreRequest - 3, // 6: plugin.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> plugin.key_material_storage.v1.LoadRequest - 5, // 7: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:input_type -> plugin.key_material_storage.v1.ListIDsRequest - 2, // 8: plugin.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> plugin.key_material_storage.v1.StoreResponse - 4, // 9: plugin.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> plugin.key_material_storage.v1.LoadResponse - 7, // 10: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:output_type -> plugin.key_material_storage.v1.ListIDsResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] 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 + 14, // 0: plugin.key_material_storage.v1.KeyMaterial.created_at:type_name -> google.protobuf.Timestamp + 10, // 1: plugin.key_material_storage.v1.KeyMaterial.tags:type_name -> plugin.key_material_storage.v1.KeyMaterial.TagsEntry + 11, // 2: plugin.key_material_storage.v1.Filter.id:type_name -> plugin.key_material_storage.v1.Filter.StringMatch + 12, // 3: plugin.key_material_storage.v1.Filter.tags:type_name -> plugin.key_material_storage.v1.Filter.TagsEntry + 13, // 4: plugin.key_material_storage.v1.Filter.created_at:type_name -> plugin.key_material_storage.v1.Filter.TimeRange + 1, // 5: plugin.key_material_storage.v1.ListIDsRequest.filter:type_name -> plugin.key_material_storage.v1.Filter + 0, // 6: plugin.key_material_storage.v1.StoreRequest.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial + 0, // 7: plugin.key_material_storage.v1.LoadResponse.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial + 14, // 8: plugin.key_material_storage.v1.Filter.TimeRange.from:type_name -> google.protobuf.Timestamp + 14, // 9: plugin.key_material_storage.v1.Filter.TimeRange.to:type_name -> google.protobuf.Timestamp + 4, // 10: plugin.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> plugin.key_material_storage.v1.StoreRequest + 6, // 11: plugin.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> plugin.key_material_storage.v1.LoadRequest + 8, // 12: plugin.key_material_storage.v1.KeyMaterialStorage.Delete:input_type -> plugin.key_material_storage.v1.DeleteRequest + 2, // 13: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:input_type -> plugin.key_material_storage.v1.ListIDsRequest + 5, // 14: plugin.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> plugin.key_material_storage.v1.StoreResponse + 7, // 15: plugin.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> plugin.key_material_storage.v1.LoadResponse + 9, // 16: plugin.key_material_storage.v1.KeyMaterialStorage.Delete:output_type -> plugin.key_material_storage.v1.DeleteResponse + 3, // 17: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:output_type -> plugin.key_material_storage.v1.ListIDsResponse + 14, // [14:18] is the sub-list for method output_type + 10, // [10:14] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name } func init() { file_plugin_key_material_storage_v1_key_material_storage_proto_init() } @@ -584,15 +882,21 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_init() { return } file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[0].OneofWrappers = []any{} - file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[5].OneofWrappers = []any{} - file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[6].OneofWrappers = []any{} + file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[1].OneofWrappers = []any{} + file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[2].OneofWrappers = []any{} + file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[11].OneofWrappers = []any{ + (*Filter_StringMatch_Prefix)(nil), + (*Filter_StringMatch_Suffix)(nil), + (*Filter_StringMatch_Contains)(nil), + (*Filter_StringMatch_Exact)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc), len(file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc)), NumEnums: 0, - NumMessages: 9, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go index d0b2702..40394cd 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go @@ -63,6 +63,35 @@ func (m *KeyMaterial) validate(all bool) error { // no validation rules for Algorithm + if all { + switch v := interface{}(m.GetCreatedAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyMaterialValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyMaterialValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyMaterialValidationError{ + field: "CreatedAt", + reason: "embedded message failed validation", + cause: err, + } + } + } + // no validation rules for Tags if m.PreviousVersionId != nil { @@ -73,13 +102,150 @@ func (m *KeyMaterial) validate(all bool) error { // no validation rules for Checksum } + if len(errors) > 0 { + return KeyMaterialMultiError(errors) + } + + return nil +} + +// KeyMaterialMultiError is an error wrapping multiple validation errors +// returned by KeyMaterial.ValidateAll() if the designated constraints aren't met. +type KeyMaterialMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyMaterialMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyMaterialMultiError) AllErrors() []error { return m } + +// KeyMaterialValidationError is the validation error returned by +// KeyMaterial.Validate if the designated constraints aren't met. +type KeyMaterialValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyMaterialValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyMaterialValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyMaterialValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyMaterialValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyMaterialValidationError) ErrorName() string { return "KeyMaterialValidationError" } + +// Error satisfies the builtin error interface +func (e KeyMaterialValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyMaterial.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyMaterialValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyMaterialValidationError{} + +// Validate checks the field values on Filter with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Filter) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Filter with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in FilterMultiError, or nil if none found. +func (m *Filter) ValidateAll() error { + return m.validate(true) +} + +func (m *Filter) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Tags + + if m.Id != nil { + + if all { + switch v := interface{}(m.GetId()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, FilterValidationError{ + field: "Id", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, FilterValidationError{ + field: "Id", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetId()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return FilterValidationError{ + field: "Id", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if m.Algorithm != nil { + // no validation rules for Algorithm + } + if m.CreatedAt != nil { if all { switch v := interface{}(m.GetCreatedAt()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyMaterialValidationError{ + errors = append(errors, FilterValidationError{ field: "CreatedAt", reason: "embedded message failed validation", cause: err, @@ -87,7 +253,7 @@ func (m *KeyMaterial) validate(all bool) error { } case interface{ Validate() error }: if err := v.Validate(); err != nil { - errors = append(errors, KeyMaterialValidationError{ + errors = append(errors, FilterValidationError{ field: "CreatedAt", reason: "embedded message failed validation", cause: err, @@ -96,7 +262,7 @@ func (m *KeyMaterial) validate(all bool) error { } } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { - return KeyMaterialValidationError{ + return FilterValidationError{ field: "CreatedAt", reason: "embedded message failed validation", cause: err, @@ -107,18 +273,18 @@ func (m *KeyMaterial) validate(all bool) error { } if len(errors) > 0 { - return KeyMaterialMultiError(errors) + return FilterMultiError(errors) } return nil } -// KeyMaterialMultiError is an error wrapping multiple validation errors -// returned by KeyMaterial.ValidateAll() if the designated constraints aren't met. -type KeyMaterialMultiError []error +// FilterMultiError is an error wrapping multiple validation errors returned by +// Filter.ValidateAll() if the designated constraints aren't met. +type FilterMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m KeyMaterialMultiError) Error() string { +func (m FilterMultiError) Error() string { msgs := make([]string, 0, len(m)) for _, err := range m { msgs = append(msgs, err.Error()) @@ -127,11 +293,11 @@ func (m KeyMaterialMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m KeyMaterialMultiError) AllErrors() []error { return m } +func (m FilterMultiError) AllErrors() []error { return m } -// KeyMaterialValidationError is the validation error returned by -// KeyMaterial.Validate if the designated constraints aren't met. -type KeyMaterialValidationError struct { +// FilterValidationError is the validation error returned by Filter.Validate if +// the designated constraints aren't met. +type FilterValidationError struct { field string reason string cause error @@ -139,22 +305,263 @@ type KeyMaterialValidationError struct { } // Field function returns field value. -func (e KeyMaterialValidationError) Field() string { return e.field } +func (e FilterValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e KeyMaterialValidationError) Reason() string { return e.reason } +func (e FilterValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e KeyMaterialValidationError) Cause() error { return e.cause } +func (e FilterValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e FilterValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e FilterValidationError) ErrorName() string { return "FilterValidationError" } + +// Error satisfies the builtin error interface +func (e FilterValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sFilter.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = FilterValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = FilterValidationError{} + +// Validate checks the field values on ListIDsRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ListIDsRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListIDsRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ListIDsRequestMultiError, +// or nil if none found. +func (m *ListIDsRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ListIDsRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Namespace + + // no validation rules for PageSize + + // no validation rules for PageToken + + if m.Filter != nil { + + if all { + switch v := interface{}(m.GetFilter()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ListIDsRequestValidationError{ + field: "Filter", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ListIDsRequestValidationError{ + field: "Filter", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ListIDsRequestValidationError{ + field: "Filter", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ListIDsRequestMultiError(errors) + } + + return nil +} + +// ListIDsRequestMultiError is an error wrapping multiple validation errors +// returned by ListIDsRequest.ValidateAll() if the designated constraints +// aren't met. +type ListIDsRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListIDsRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListIDsRequestMultiError) AllErrors() []error { return m } + +// ListIDsRequestValidationError is the validation error returned by +// ListIDsRequest.Validate if the designated constraints aren't met. +type ListIDsRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListIDsRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListIDsRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListIDsRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ListIDsRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ListIDsRequestValidationError) ErrorName() string { return "ListIDsRequestValidationError" } + +// Error satisfies the builtin error interface +func (e ListIDsRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sListIDsRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ListIDsRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ListIDsRequestValidationError{} + +// Validate checks the field values on ListIDsResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ListIDsResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ListIDsResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ListIDsResponseMultiError, or nil if none found. +func (m *ListIDsResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ListIDsResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for NextPageToken + + if len(errors) > 0 { + return ListIDsResponseMultiError(errors) + } + + return nil +} + +// ListIDsResponseMultiError is an error wrapping multiple validation errors +// returned by ListIDsResponse.ValidateAll() if the designated constraints +// aren't met. +type ListIDsResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ListIDsResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ListIDsResponseMultiError) AllErrors() []error { return m } + +// ListIDsResponseValidationError is the validation error returned by +// ListIDsResponse.Validate if the designated constraints aren't met. +type ListIDsResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ListIDsResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ListIDsResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ListIDsResponseValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e KeyMaterialValidationError) Key() bool { return e.key } +func (e ListIDsResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e KeyMaterialValidationError) ErrorName() string { return "KeyMaterialValidationError" } +func (e ListIDsResponseValidationError) ErrorName() string { return "ListIDsResponseValidationError" } // Error satisfies the builtin error interface -func (e KeyMaterialValidationError) Error() string { +func (e ListIDsResponseValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -166,14 +573,14 @@ func (e KeyMaterialValidationError) Error() string { } return fmt.Sprintf( - "invalid %sKeyMaterial.%s: %s%s", + "invalid %sListIDsResponse.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = KeyMaterialValidationError{} +var _ error = ListIDsResponseValidationError{} var _ interface { Field() string @@ -181,7 +588,7 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = KeyMaterialValidationError{} +} = ListIDsResponseValidationError{} // Validate checks the field values on StoreRequest with the rules defined in // the proto definition for this message. If any rules are violated, the first @@ -644,22 +1051,22 @@ var _ interface { ErrorName() string } = LoadResponseValidationError{} -// Validate checks the field values on ListIDsRequest with the rules defined in +// Validate checks the field values on DeleteRequest with the rules defined in // the proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. -func (m *ListIDsRequest) Validate() error { +func (m *DeleteRequest) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on ListIDsRequest with the rules defined +// ValidateAll checks the field values on DeleteRequest with the rules defined // in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ListIDsRequestMultiError, -// or nil if none found. -func (m *ListIDsRequest) ValidateAll() error { +// result is a list of violation errors wrapped in DeleteRequestMultiError, or +// nil if none found. +func (m *DeleteRequest) ValidateAll() error { return m.validate(true) } -func (m *ListIDsRequest) validate(all bool) error { +func (m *DeleteRequest) validate(all bool) error { if m == nil { return nil } @@ -668,53 +1075,22 @@ func (m *ListIDsRequest) validate(all bool) error { // no validation rules for Namespace - if m.Filter != nil { - - if all { - switch v := interface{}(m.GetFilter()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ListIDsRequestValidationError{ - field: "Filter", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ListIDsRequestValidationError{ - field: "Filter", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ListIDsRequestValidationError{ - field: "Filter", - reason: "embedded message failed validation", - cause: err, - } - } - } - - } + // no validation rules for Id if len(errors) > 0 { - return ListIDsRequestMultiError(errors) + return DeleteRequestMultiError(errors) } return nil } -// ListIDsRequestMultiError is an error wrapping multiple validation errors -// returned by ListIDsRequest.ValidateAll() if the designated constraints +// DeleteRequestMultiError is an error wrapping multiple validation errors +// returned by DeleteRequest.ValidateAll() if the designated constraints // aren't met. -type ListIDsRequestMultiError []error +type DeleteRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m ListIDsRequestMultiError) Error() string { +func (m DeleteRequestMultiError) Error() string { msgs := make([]string, 0, len(m)) for _, err := range m { msgs = append(msgs, err.Error()) @@ -723,11 +1099,11 @@ func (m ListIDsRequestMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m ListIDsRequestMultiError) AllErrors() []error { return m } +func (m DeleteRequestMultiError) AllErrors() []error { return m } -// ListIDsRequestValidationError is the validation error returned by -// ListIDsRequest.Validate if the designated constraints aren't met. -type ListIDsRequestValidationError struct { +// DeleteRequestValidationError is the validation error returned by +// DeleteRequest.Validate if the designated constraints aren't met. +type DeleteRequestValidationError struct { field string reason string cause error @@ -735,22 +1111,22 @@ type ListIDsRequestValidationError struct { } // Field function returns field value. -func (e ListIDsRequestValidationError) Field() string { return e.field } +func (e DeleteRequestValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e ListIDsRequestValidationError) Reason() string { return e.reason } +func (e DeleteRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e ListIDsRequestValidationError) Cause() error { return e.cause } +func (e DeleteRequestValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e ListIDsRequestValidationError) Key() bool { return e.key } +func (e DeleteRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e ListIDsRequestValidationError) ErrorName() string { return "ListIDsRequestValidationError" } +func (e DeleteRequestValidationError) ErrorName() string { return "DeleteRequestValidationError" } // Error satisfies the builtin error interface -func (e ListIDsRequestValidationError) Error() string { +func (e DeleteRequestValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -762,14 +1138,14 @@ func (e ListIDsRequestValidationError) Error() string { } return fmt.Sprintf( - "invalid %sListIDsRequest.%s: %s%s", + "invalid %sDeleteRequest.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = ListIDsRequestValidationError{} +var _ error = DeleteRequestValidationError{} var _ interface { Field() string @@ -777,54 +1153,197 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = ListIDsRequestValidationError{} +} = DeleteRequestValidationError{} -// Validate checks the field values on Filter with the rules defined in the -// proto definition for this message. If any rules are violated, the first +// Validate checks the field values on DeleteResponse with the rules defined in +// the proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. -func (m *Filter) Validate() error { +func (m *DeleteResponse) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on Filter with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in FilterMultiError, or nil if none found. -func (m *Filter) ValidateAll() error { +// ValidateAll checks the field values on DeleteResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in DeleteResponseMultiError, +// or nil if none found. +func (m *DeleteResponse) ValidateAll() error { return m.validate(true) } -func (m *Filter) validate(all bool) error { +func (m *DeleteResponse) validate(all bool) error { if m == nil { return nil } var errors []error - if m.Prefix != nil { - // no validation rules for Prefix + if len(errors) > 0 { + return DeleteResponseMultiError(errors) } - if m.Suffix != nil { - // no validation rules for Suffix + return nil +} + +// DeleteResponseMultiError is an error wrapping multiple validation errors +// returned by DeleteResponse.ValidateAll() if the designated constraints +// aren't met. +type DeleteResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m DeleteResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m DeleteResponseMultiError) AllErrors() []error { return m } + +// DeleteResponseValidationError is the validation error returned by +// DeleteResponse.Validate if the designated constraints aren't met. +type DeleteResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e DeleteResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e DeleteResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e DeleteResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e DeleteResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e DeleteResponseValidationError) ErrorName() string { return "DeleteResponseValidationError" } + +// Error satisfies the builtin error interface +func (e DeleteResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sDeleteResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = DeleteResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = DeleteResponseValidationError{} + +// Validate checks the field values on Filter_StringMatch with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *Filter_StringMatch) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Filter_StringMatch with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// Filter_StringMatchMultiError, or nil if none found. +func (m *Filter_StringMatch) ValidateAll() error { + return m.validate(true) +} + +func (m *Filter_StringMatch) validate(all bool) error { + if m == nil { + return nil } - if m.Contains != nil { + var errors []error + + switch v := m.Type.(type) { + case *Filter_StringMatch_Prefix: + if v == nil { + err := Filter_StringMatchValidationError{ + field: "Type", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + // no validation rules for Prefix + case *Filter_StringMatch_Suffix: + if v == nil { + err := Filter_StringMatchValidationError{ + field: "Type", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + // no validation rules for Suffix + case *Filter_StringMatch_Contains: + if v == nil { + err := Filter_StringMatchValidationError{ + field: "Type", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } // no validation rules for Contains + case *Filter_StringMatch_Exact: + if v == nil { + err := Filter_StringMatchValidationError{ + field: "Type", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + // no validation rules for Exact + default: + _ = v // ensures v is used } if len(errors) > 0 { - return FilterMultiError(errors) + return Filter_StringMatchMultiError(errors) } return nil } -// FilterMultiError is an error wrapping multiple validation errors returned by -// Filter.ValidateAll() if the designated constraints aren't met. -type FilterMultiError []error +// Filter_StringMatchMultiError is an error wrapping multiple validation errors +// returned by Filter_StringMatch.ValidateAll() if the designated constraints +// aren't met. +type Filter_StringMatchMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m FilterMultiError) Error() string { +func (m Filter_StringMatchMultiError) Error() string { msgs := make([]string, 0, len(m)) for _, err := range m { msgs = append(msgs, err.Error()) @@ -833,11 +1352,11 @@ func (m FilterMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m FilterMultiError) AllErrors() []error { return m } +func (m Filter_StringMatchMultiError) AllErrors() []error { return m } -// FilterValidationError is the validation error returned by Filter.Validate if -// the designated constraints aren't met. -type FilterValidationError struct { +// Filter_StringMatchValidationError is the validation error returned by +// Filter_StringMatch.Validate if the designated constraints aren't met. +type Filter_StringMatchValidationError struct { field string reason string cause error @@ -845,22 +1364,24 @@ type FilterValidationError struct { } // Field function returns field value. -func (e FilterValidationError) Field() string { return e.field } +func (e Filter_StringMatchValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e FilterValidationError) Reason() string { return e.reason } +func (e Filter_StringMatchValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e FilterValidationError) Cause() error { return e.cause } +func (e Filter_StringMatchValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e FilterValidationError) Key() bool { return e.key } +func (e Filter_StringMatchValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e FilterValidationError) ErrorName() string { return "FilterValidationError" } +func (e Filter_StringMatchValidationError) ErrorName() string { + return "Filter_StringMatchValidationError" +} // Error satisfies the builtin error interface -func (e FilterValidationError) Error() string { +func (e Filter_StringMatchValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -872,14 +1393,14 @@ func (e FilterValidationError) Error() string { } return fmt.Sprintf( - "invalid %sFilter.%s: %s%s", + "invalid %sFilter_StringMatch.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = FilterValidationError{} +var _ error = Filter_StringMatchValidationError{} var _ interface { Field() string @@ -887,44 +1408,102 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = FilterValidationError{} +} = Filter_StringMatchValidationError{} -// Validate checks the field values on ListIDsResponse with the rules defined +// Validate checks the field values on Filter_TimeRange with the rules defined // in the proto definition for this message. If any rules are violated, the // first error encountered is returned, or nil if there are no violations. -func (m *ListIDsResponse) Validate() error { +func (m *Filter_TimeRange) Validate() error { return m.validate(false) } -// ValidateAll checks the field values on ListIDsResponse with the rules +// ValidateAll checks the field values on Filter_TimeRange with the rules // defined in the proto definition for this message. If any rules are // violated, the result is a list of violation errors wrapped in -// ListIDsResponseMultiError, or nil if none found. -func (m *ListIDsResponse) ValidateAll() error { +// Filter_TimeRangeMultiError, or nil if none found. +func (m *Filter_TimeRange) ValidateAll() error { return m.validate(true) } -func (m *ListIDsResponse) validate(all bool) error { +func (m *Filter_TimeRange) validate(all bool) error { if m == nil { return nil } var errors []error + if all { + switch v := interface{}(m.GetFrom()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, Filter_TimeRangeValidationError{ + field: "From", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, Filter_TimeRangeValidationError{ + field: "From", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetFrom()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Filter_TimeRangeValidationError{ + field: "From", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetTo()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, Filter_TimeRangeValidationError{ + field: "To", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, Filter_TimeRangeValidationError{ + field: "To", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTo()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return Filter_TimeRangeValidationError{ + field: "To", + reason: "embedded message failed validation", + cause: err, + } + } + } + if len(errors) > 0 { - return ListIDsResponseMultiError(errors) + return Filter_TimeRangeMultiError(errors) } return nil } -// ListIDsResponseMultiError is an error wrapping multiple validation errors -// returned by ListIDsResponse.ValidateAll() if the designated constraints +// Filter_TimeRangeMultiError is an error wrapping multiple validation errors +// returned by Filter_TimeRange.ValidateAll() if the designated constraints // aren't met. -type ListIDsResponseMultiError []error +type Filter_TimeRangeMultiError []error // Error returns a concatenation of all the error messages it wraps. -func (m ListIDsResponseMultiError) Error() string { +func (m Filter_TimeRangeMultiError) Error() string { msgs := make([]string, 0, len(m)) for _, err := range m { msgs = append(msgs, err.Error()) @@ -933,11 +1512,11 @@ func (m ListIDsResponseMultiError) Error() string { } // AllErrors returns a list of validation violation errors. -func (m ListIDsResponseMultiError) AllErrors() []error { return m } +func (m Filter_TimeRangeMultiError) AllErrors() []error { return m } -// ListIDsResponseValidationError is the validation error returned by -// ListIDsResponse.Validate if the designated constraints aren't met. -type ListIDsResponseValidationError struct { +// Filter_TimeRangeValidationError is the validation error returned by +// Filter_TimeRange.Validate if the designated constraints aren't met. +type Filter_TimeRangeValidationError struct { field string reason string cause error @@ -945,22 +1524,22 @@ type ListIDsResponseValidationError struct { } // Field function returns field value. -func (e ListIDsResponseValidationError) Field() string { return e.field } +func (e Filter_TimeRangeValidationError) Field() string { return e.field } // Reason function returns reason value. -func (e ListIDsResponseValidationError) Reason() string { return e.reason } +func (e Filter_TimeRangeValidationError) Reason() string { return e.reason } // Cause function returns cause value. -func (e ListIDsResponseValidationError) Cause() error { return e.cause } +func (e Filter_TimeRangeValidationError) Cause() error { return e.cause } // Key function returns key value. -func (e ListIDsResponseValidationError) Key() bool { return e.key } +func (e Filter_TimeRangeValidationError) Key() bool { return e.key } // ErrorName returns error name. -func (e ListIDsResponseValidationError) ErrorName() string { return "ListIDsResponseValidationError" } +func (e Filter_TimeRangeValidationError) ErrorName() string { return "Filter_TimeRangeValidationError" } // Error satisfies the builtin error interface -func (e ListIDsResponseValidationError) Error() string { +func (e Filter_TimeRangeValidationError) Error() string { cause := "" if e.cause != nil { cause = fmt.Sprintf(" | caused by: %v", e.cause) @@ -972,14 +1551,14 @@ func (e ListIDsResponseValidationError) Error() string { } return fmt.Sprintf( - "invalid %sListIDsResponse.%s: %s%s", + "invalid %sFilter_TimeRange.%s: %s%s", key, e.field, e.reason, cause) } -var _ error = ListIDsResponseValidationError{} +var _ error = Filter_TimeRangeValidationError{} var _ interface { Field() string @@ -987,4 +1566,4 @@ var _ interface { Key() bool Cause() error ErrorName() string -} = ListIDsResponseValidationError{} +} = Filter_TimeRangeValidationError{} diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index f612a1d..1ce3d51 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -7,117 +7,91 @@ import "google/protobuf/timestamp.proto"; // KeyMaterialStorage defines the universal interface for persisting and // retrieving opaque blobs of data, typically wrapped key material. -// This allows Krypton to delegate storage to any backend (DB, Vault, File) -// in a completely generic way. service KeyMaterialStorage { - // Store persists a single item. This operation must be idempotent. rpc Store(StoreRequest) returns (StoreResponse); - - // Load retrieves a single item by its unique ID. rpc Load(LoadRequest) returns (LoadResponse); + rpc Delete(DeleteRequest) returns (DeleteResponse); - // ListIDs streams back all IDs that match a given prefix within a namespace. + // ListIDs returns batches of IDs matching the criteria. rpc ListIDs(ListIDsRequest) returns (stream ListIDsResponse); } // KeyMaterial represents a single unit of stored data. -// It is intentionally generic and algorithm-agnostic. message KeyMaterial { - // REQUIRED: The unique identifier for this item. - // e.g., "L2/01H8XGJWBWBAQ9Z7J6C6XJ6C6X" - string id = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // REQUIRED: The opaque data blob. - // This typically contains the encrypted/wrapped key material. - bytes data = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).bytes.min_len = 1 - ]; - - // REQUIRED: The name of algorithm - // This typically contains the encrypted/wrapped key material. - string algorithm = 3 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; + string id = 1 [(buf.validate.field).string.min_len = 1]; + bytes data = 2 [(buf.validate.field).bytes.min_len = 1]; + string algorithm = 3 [(buf.validate.field).string.min_len = 1]; optional string previous_version_id = 4; - optional string checksum = 5; + google.protobuf.Timestamp created_at = 6; + map tags = 7; +} - optional google.protobuf.Timestamp created_at = 6; +// --- Filter Refactor --- - map tags = 100; +message Filter { + // Pattern-based matching for the primary Key ID. + message StringMatch { + oneof type { + string prefix = 1; + string suffix = 2; + string contains = 3; + string exact = 4; + } + } + optional StringMatch id = 1; + + // Filter by cryptographic algorithm (e.g., "AES-256-GCM"). + optional string algorithm = 2; + + // Filter by metadata tags (e.g., {"env": "prod"}). + // Match is typically performed as "contains all". + map tags = 3; + + // Filter by the time the key was created. + message TimeRange { + google.protobuf.Timestamp from = 1; + google.protobuf.Timestamp to = 2; + } + optional TimeRange created_at = 4; } -// --- Store RPC Messages --- +// --- RPC Messages --- -message StoreRequest { - // REQUIRED: The namespace for this key material. This provides isolation - // and can be mapped to a tenant, project, or customer ID. - string namespace = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // REQUIRED: The item to be stored. - KeyMaterial key_material = 2 [(buf.validate.field).required = true]; +message ListIDsRequest { + string namespace = 1 [(buf.validate.field).string.min_len = 1]; + optional Filter filter = 2; + + // Pagination support + uint32 page_size = 3; + string page_token = 4; } -message StoreResponse { - // This response is empty on success. Errors are communicated via gRPC status codes. +message ListIDsResponse { + repeated string ids = 1; + string next_page_token = 2; } -// --- Load RPC Messages --- +message StoreRequest { + string namespace = 1 [(buf.validate.field).string.min_len = 1]; + KeyMaterial key_material = 2 [(buf.validate.field).required = true]; +} + +message StoreResponse {} message LoadRequest { - // REQUIRED: The namespace for the item. - string namespace = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // REQUIRED: The unique ID of the item to retrieve. - string id = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; + string namespace = 1 [(buf.validate.field).string.min_len = 1]; + string id = 2 [(buf.validate.field).string.min_len = 1]; } message LoadResponse { - // The retrieved key material. - // If the key is not found, the RPC will return a `NOT_FOUND` gRPC error. KeyMaterial key_material = 1; } -message ListIDsRequest { - // REQUIRED: The namespace to search in. - string namespace = 1 [ - (buf.validate.field).required = true, - (buf.validate.field).string.min_len = 1 - ]; - - // OPTIONAL: Filter criteria for listing IDs. - // If not provided, all IDs in the namespace are returned. - optional Filter filter = 2; -} - -message Filter { - // OPTIONAL: Filter IDs that start with this string. - optional string prefix = 1; - - // OPTIONAL: Filter IDs that end with this string. - optional string suffix = 2; - - // OPTIONAL: Filter IDs that contain this string. - optional string contains = 3; +message DeleteRequest { + string namespace = 1 [(buf.validate.field).string.min_len = 1]; + string id = 2 [(buf.validate.field).string.min_len = 1]; } -message ListIDsResponse { - // A list of key material IDs that match the request criteria. - // The server may stream multiple responses, each containing a batch of IDs. - repeated string ids = 1; -} +message DeleteResponse {} diff --git a/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go index 1eaafaa..eb7193e 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go @@ -22,6 +22,7 @@ const _ = grpc.SupportPackageIsVersion9 const ( KeyMaterialStorage_Store_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Store" KeyMaterialStorage_Load_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Load" + KeyMaterialStorage_Delete_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Delete" KeyMaterialStorage_ListIDs_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/ListIDs" ) @@ -31,14 +32,11 @@ const ( // // KeyMaterialStorage defines the universal interface for persisting and // retrieving opaque blobs of data, typically wrapped key material. -// This allows Krypton to delegate storage to any backend (DB, Vault, File) -// in a completely generic way. type KeyMaterialStorageClient interface { - // Store persists a single item. This operation must be idempotent. Store(ctx context.Context, in *StoreRequest, opts ...grpc.CallOption) (*StoreResponse, error) - // Load retrieves a single item by its unique ID. Load(ctx context.Context, in *LoadRequest, opts ...grpc.CallOption) (*LoadResponse, error) - // ListIDs streams back all IDs that match a given prefix within a namespace. + Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) + // ListIDs returns batches of IDs matching the criteria. ListIDs(ctx context.Context, in *ListIDsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListIDsResponse], error) } @@ -70,6 +68,16 @@ func (c *keyMaterialStorageClient) Load(ctx context.Context, in *LoadRequest, op return out, nil } +func (c *keyMaterialStorageClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteResponse) + err := c.cc.Invoke(ctx, KeyMaterialStorage_Delete_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *keyMaterialStorageClient) ListIDs(ctx context.Context, in *ListIDsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ListIDsResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &KeyMaterialStorage_ServiceDesc.Streams[0], KeyMaterialStorage_ListIDs_FullMethodName, cOpts...) @@ -95,14 +103,11 @@ type KeyMaterialStorage_ListIDsClient = grpc.ServerStreamingClient[ListIDsRespon // // KeyMaterialStorage defines the universal interface for persisting and // retrieving opaque blobs of data, typically wrapped key material. -// This allows Krypton to delegate storage to any backend (DB, Vault, File) -// in a completely generic way. type KeyMaterialStorageServer interface { - // Store persists a single item. This operation must be idempotent. Store(context.Context, *StoreRequest) (*StoreResponse, error) - // Load retrieves a single item by its unique ID. Load(context.Context, *LoadRequest) (*LoadResponse, error) - // ListIDs streams back all IDs that match a given prefix within a namespace. + Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) + // ListIDs returns batches of IDs matching the criteria. ListIDs(*ListIDsRequest, grpc.ServerStreamingServer[ListIDsResponse]) error mustEmbedUnimplementedKeyMaterialStorageServer() } @@ -120,6 +125,9 @@ func (UnimplementedKeyMaterialStorageServer) Store(context.Context, *StoreReques func (UnimplementedKeyMaterialStorageServer) Load(context.Context, *LoadRequest) (*LoadResponse, error) { return nil, status.Error(codes.Unimplemented, "method Load not implemented") } +func (UnimplementedKeyMaterialStorageServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Delete not implemented") +} func (UnimplementedKeyMaterialStorageServer) ListIDs(*ListIDsRequest, grpc.ServerStreamingServer[ListIDsResponse]) error { return status.Error(codes.Unimplemented, "method ListIDs not implemented") } @@ -180,6 +188,24 @@ func _KeyMaterialStorage_Load_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _KeyMaterialStorage_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyMaterialStorageServer).Delete(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KeyMaterialStorage_Delete_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyMaterialStorageServer).Delete(ctx, req.(*DeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _KeyMaterialStorage_ListIDs_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(ListIDsRequest) if err := stream.RecvMsg(m); err != nil { @@ -206,6 +232,10 @@ var KeyMaterialStorage_ServiceDesc = grpc.ServiceDesc{ MethodName: "Load", Handler: _KeyMaterialStorage_Load_Handler, }, + { + MethodName: "Delete", + Handler: _KeyMaterialStorage_Delete_Handler, + }, }, Streams: []grpc.StreamDesc{ { From 77b72d4bf95fc8d603259c45b41480a3786403ea Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Fri, 15 May 2026 16:49:33 +0200 Subject: [PATCH 14/27] modify --- buf.lock | 4 +- proto/plugin/llm/v1/llm.pb.go | 438 ++++++++++++++ proto/plugin/llm/v1/llm.pb.validate.go | 724 +++++++++++++++++++++++ proto/plugin/llm/v1/llm.proto | 54 ++ proto/plugin/llm/v1/llm_ext_plugin.pb.go | 56 ++ proto/plugin/llm/v1/llm_grpc.pb.go | 176 ++++++ 6 files changed, 1450 insertions(+), 2 deletions(-) create mode 100644 proto/plugin/llm/v1/llm.pb.go create mode 100644 proto/plugin/llm/v1/llm.pb.validate.go create mode 100644 proto/plugin/llm/v1/llm.proto create mode 100644 proto/plugin/llm/v1/llm_ext_plugin.pb.go create mode 100644 proto/plugin/llm/v1/llm_grpc.pb.go diff --git a/buf.lock b/buf.lock index d15a117..709ae02 100644 --- a/buf.lock +++ b/buf.lock @@ -2,5 +2,5 @@ version: v2 deps: - name: buf.build/bufbuild/protovalidate - commit: 80ab13bee0bf4272b6161a72bf7034e0 - digest: b5:1aa6a965be5d02d64e1d81954fa2e78ef9d1e33a0c30f92bc2626039006a94deb3a5b05f14ed8893f5c3ffce444ac008f7e968188ad225c4c29c813aa5f2daa1 + commit: 50325440f8f24053b047484a6bf60b76 + digest: b5:74cb6f5c0853c3c10aafc701614194bbd63326bdb8ef4068214454b8894b03ba4113e04b3a33a8321cdf05336e37db4dc14a5e2495db8462566914f36086ba31 diff --git a/proto/plugin/llm/v1/llm.pb.go b/proto/plugin/llm/v1/llm.pb.go new file mode 100644 index 0000000..297015f --- /dev/null +++ b/proto/plugin/llm/v1/llm.pb.go @@ -0,0 +1,438 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc (unknown) +// source: plugin/llm/v1/llm.proto + +package llmv1 + +import ( + reflect "reflect" + sync "sync" + unsafe "unsafe" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// FindingSummary is a single rule-engine finding passed to the LLM for enrichment. +// Only aggregate metrics are included — never key material or key IDs. +type FindingSummary struct { + state protoimpl.MessageState `protogen:"open.v1"` + Category string `protobuf:"bytes,1,opt,name=category,proto3" json:"category,omitempty"` + Severity string `protobuf:"bytes,2,opt,name=severity,proto3" json:"severity,omitempty"` + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` + Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` + // aggregate_metadata contains counts and names only (e.g. algorithm="AES-256", count="12"). + AggregateMetadata map[string]string `protobuf:"bytes,5,rep,name=aggregate_metadata,json=aggregateMetadata,proto3" json:"aggregate_metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FindingSummary) Reset() { + *x = FindingSummary{} + mi := &file_plugin_llm_v1_llm_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FindingSummary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindingSummary) ProtoMessage() {} + +func (x *FindingSummary) ProtoReflect() protoreflect.Message { + mi := &file_plugin_llm_v1_llm_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FindingSummary.ProtoReflect.Descriptor instead. +func (*FindingSummary) Descriptor() ([]byte, []int) { + return file_plugin_llm_v1_llm_proto_rawDescGZIP(), []int{0} +} + +func (x *FindingSummary) GetCategory() string { + if x != nil { + return x.Category + } + return "" +} + +func (x *FindingSummary) GetSeverity() string { + if x != nil { + return x.Severity + } + return "" +} + +func (x *FindingSummary) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *FindingSummary) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +func (x *FindingSummary) GetAggregateMetadata() map[string]string { + if x != nil { + return x.AggregateMetadata + } + return nil +} + +// EnrichedFinding contains LLM-enhanced descriptions for a single finding. +type EnrichedFinding struct { + state protoimpl.MessageState `protogen:"open.v1"` + EnrichedDescription string `protobuf:"bytes,1,opt,name=enriched_description,json=enrichedDescription,proto3" json:"enriched_description,omitempty"` + EnrichedRemediation string `protobuf:"bytes,2,opt,name=enriched_remediation,json=enrichedRemediation,proto3" json:"enriched_remediation,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EnrichedFinding) Reset() { + *x = EnrichedFinding{} + mi := &file_plugin_llm_v1_llm_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EnrichedFinding) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnrichedFinding) ProtoMessage() {} + +func (x *EnrichedFinding) ProtoReflect() protoreflect.Message { + mi := &file_plugin_llm_v1_llm_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnrichedFinding.ProtoReflect.Descriptor instead. +func (*EnrichedFinding) Descriptor() ([]byte, []int) { + return file_plugin_llm_v1_llm_proto_rawDescGZIP(), []int{1} +} + +func (x *EnrichedFinding) GetEnrichedDescription() string { + if x != nil { + return x.EnrichedDescription + } + return "" +} + +func (x *EnrichedFinding) GetEnrichedRemediation() string { + if x != nil { + return x.EnrichedRemediation + } + return "" +} + +type EnrichRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Findings []*FindingSummary `protobuf:"bytes,1,rep,name=findings,proto3" json:"findings,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EnrichRequest) Reset() { + *x = EnrichRequest{} + mi := &file_plugin_llm_v1_llm_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EnrichRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnrichRequest) ProtoMessage() {} + +func (x *EnrichRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_llm_v1_llm_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnrichRequest.ProtoReflect.Descriptor instead. +func (*EnrichRequest) Descriptor() ([]byte, []int) { + return file_plugin_llm_v1_llm_proto_rawDescGZIP(), []int{2} +} + +func (x *EnrichRequest) GetFindings() []*FindingSummary { + if x != nil { + return x.Findings + } + return nil +} + +type EnrichResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Enriched []*EnrichedFinding `protobuf:"bytes,1,rep,name=enriched,proto3" json:"enriched,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EnrichResponse) Reset() { + *x = EnrichResponse{} + mi := &file_plugin_llm_v1_llm_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EnrichResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EnrichResponse) ProtoMessage() {} + +func (x *EnrichResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_llm_v1_llm_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EnrichResponse.ProtoReflect.Descriptor instead. +func (*EnrichResponse) Descriptor() ([]byte, []int) { + return file_plugin_llm_v1_llm_proto_rawDescGZIP(), []int{3} +} + +func (x *EnrichResponse) GetEnriched() []*EnrichedFinding { + if x != nil { + return x.Enriched + } + return nil +} + +// AnswerRequest carries a free-form question and aggregate context signals. +// context_signals must contain only counts and names — never key material. +type AnswerRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Question string `protobuf:"bytes,1,opt,name=question,proto3" json:"question,omitempty"` + ContextSignals map[string]string `protobuf:"bytes,2,rep,name=context_signals,json=contextSignals,proto3" json:"context_signals,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AnswerRequest) Reset() { + *x = AnswerRequest{} + mi := &file_plugin_llm_v1_llm_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AnswerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnswerRequest) ProtoMessage() {} + +func (x *AnswerRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_llm_v1_llm_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AnswerRequest.ProtoReflect.Descriptor instead. +func (*AnswerRequest) Descriptor() ([]byte, []int) { + return file_plugin_llm_v1_llm_proto_rawDescGZIP(), []int{4} +} + +func (x *AnswerRequest) GetQuestion() string { + if x != nil { + return x.Question + } + return "" +} + +func (x *AnswerRequest) GetContextSignals() map[string]string { + if x != nil { + return x.ContextSignals + } + return nil +} + +type AnswerResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Answer string `protobuf:"bytes,1,opt,name=answer,proto3" json:"answer,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AnswerResponse) Reset() { + *x = AnswerResponse{} + mi := &file_plugin_llm_v1_llm_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AnswerResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AnswerResponse) ProtoMessage() {} + +func (x *AnswerResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_llm_v1_llm_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AnswerResponse.ProtoReflect.Descriptor instead. +func (*AnswerResponse) Descriptor() ([]byte, []int) { + return file_plugin_llm_v1_llm_proto_rawDescGZIP(), []int{5} +} + +func (x *AnswerResponse) GetAnswer() string { + if x != nil { + return x.Answer + } + return "" +} + +var File_plugin_llm_v1_llm_proto protoreflect.FileDescriptor + +const file_plugin_llm_v1_llm_proto_rawDesc = "" + + "\n" + + "\x17plugin/llm/v1/llm.proto\x12\rplugin.llm.v1\"\xab\x02\n" + + "\x0eFindingSummary\x12\x1a\n" + + "\bcategory\x18\x01 \x01(\tR\bcategory\x12\x1a\n" + + "\bseverity\x18\x02 \x01(\tR\bseverity\x12\x14\n" + + "\x05title\x18\x03 \x01(\tR\x05title\x12 \n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x12c\n" + + "\x12aggregate_metadata\x18\x05 \x03(\v24.plugin.llm.v1.FindingSummary.AggregateMetadataEntryR\x11aggregateMetadata\x1aD\n" + + "\x16AggregateMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"w\n" + + "\x0fEnrichedFinding\x121\n" + + "\x14enriched_description\x18\x01 \x01(\tR\x13enrichedDescription\x121\n" + + "\x14enriched_remediation\x18\x02 \x01(\tR\x13enrichedRemediation\"J\n" + + "\rEnrichRequest\x129\n" + + "\bfindings\x18\x01 \x03(\v2\x1d.plugin.llm.v1.FindingSummaryR\bfindings\"L\n" + + "\x0eEnrichResponse\x12:\n" + + "\benriched\x18\x01 \x03(\v2\x1e.plugin.llm.v1.EnrichedFindingR\benriched\"\xc9\x01\n" + + "\rAnswerRequest\x12\x1a\n" + + "\bquestion\x18\x01 \x01(\tR\bquestion\x12Y\n" + + "\x0fcontext_signals\x18\x02 \x03(\v20.plugin.llm.v1.AnswerRequest.ContextSignalsEntryR\x0econtextSignals\x1aA\n" + + "\x13ContextSignalsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"(\n" + + "\x0eAnswerResponse\x12\x16\n" + + "\x06answer\x18\x01 \x01(\tR\x06answer2\x93\x01\n" + + "\x03LLM\x12E\n" + + "\x06Enrich\x12\x1c.plugin.llm.v1.EnrichRequest\x1a\x1d.plugin.llm.v1.EnrichResponse\x12E\n" + + "\x06Answer\x12\x1c.plugin.llm.v1.AnswerRequest\x1a\x1d.plugin.llm.v1.AnswerResponseB\xac\x01\n" + + "\x11com.plugin.llm.v1B\bLlmProtoP\x01Z7github.com/openkcm/plugin-sdk/proto/plugin/llm/v1;llmv1\xa2\x02\x03PLX\xaa\x02\rPlugin.Llm.V1\xca\x02\rPlugin\\Llm\\V1\xe2\x02\x19Plugin\\Llm\\V1\\GPBMetadata\xea\x02\x0fPlugin::Llm::V1b\x06proto3" + +var ( + file_plugin_llm_v1_llm_proto_rawDescOnce sync.Once + file_plugin_llm_v1_llm_proto_rawDescData []byte +) + +func file_plugin_llm_v1_llm_proto_rawDescGZIP() []byte { + file_plugin_llm_v1_llm_proto_rawDescOnce.Do(func() { + file_plugin_llm_v1_llm_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_llm_v1_llm_proto_rawDesc), len(file_plugin_llm_v1_llm_proto_rawDesc))) + }) + return file_plugin_llm_v1_llm_proto_rawDescData +} + +var file_plugin_llm_v1_llm_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_plugin_llm_v1_llm_proto_goTypes = []any{ + (*FindingSummary)(nil), // 0: plugin.llm.v1.FindingSummary + (*EnrichedFinding)(nil), // 1: plugin.llm.v1.EnrichedFinding + (*EnrichRequest)(nil), // 2: plugin.llm.v1.EnrichRequest + (*EnrichResponse)(nil), // 3: plugin.llm.v1.EnrichResponse + (*AnswerRequest)(nil), // 4: plugin.llm.v1.AnswerRequest + (*AnswerResponse)(nil), // 5: plugin.llm.v1.AnswerResponse + nil, // 6: plugin.llm.v1.FindingSummary.AggregateMetadataEntry + nil, // 7: plugin.llm.v1.AnswerRequest.ContextSignalsEntry +} +var file_plugin_llm_v1_llm_proto_depIdxs = []int32{ + 6, // 0: plugin.llm.v1.FindingSummary.aggregate_metadata:type_name -> plugin.llm.v1.FindingSummary.AggregateMetadataEntry + 0, // 1: plugin.llm.v1.EnrichRequest.findings:type_name -> plugin.llm.v1.FindingSummary + 1, // 2: plugin.llm.v1.EnrichResponse.enriched:type_name -> plugin.llm.v1.EnrichedFinding + 7, // 3: plugin.llm.v1.AnswerRequest.context_signals:type_name -> plugin.llm.v1.AnswerRequest.ContextSignalsEntry + 2, // 4: plugin.llm.v1.LLM.Enrich:input_type -> plugin.llm.v1.EnrichRequest + 4, // 5: plugin.llm.v1.LLM.Answer:input_type -> plugin.llm.v1.AnswerRequest + 3, // 6: plugin.llm.v1.LLM.Enrich:output_type -> plugin.llm.v1.EnrichResponse + 5, // 7: plugin.llm.v1.LLM.Answer:output_type -> plugin.llm.v1.AnswerResponse + 6, // [6:8] is the sub-list for method output_type + 4, // [4:6] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_plugin_llm_v1_llm_proto_init() } +func file_plugin_llm_v1_llm_proto_init() { + if File_plugin_llm_v1_llm_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_llm_v1_llm_proto_rawDesc), len(file_plugin_llm_v1_llm_proto_rawDesc)), + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_plugin_llm_v1_llm_proto_goTypes, + DependencyIndexes: file_plugin_llm_v1_llm_proto_depIdxs, + MessageInfos: file_plugin_llm_v1_llm_proto_msgTypes, + }.Build() + File_plugin_llm_v1_llm_proto = out.File + file_plugin_llm_v1_llm_proto_goTypes = nil + file_plugin_llm_v1_llm_proto_depIdxs = nil +} diff --git a/proto/plugin/llm/v1/llm.pb.validate.go b/proto/plugin/llm/v1/llm.pb.validate.go new file mode 100644 index 0000000..bfe21ac --- /dev/null +++ b/proto/plugin/llm/v1/llm.pb.validate.go @@ -0,0 +1,724 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: plugin/llm/v1/llm.proto + +package llmv1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on FindingSummary with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *FindingSummary) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on FindingSummary with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in FindingSummaryMultiError, +// or nil if none found. +func (m *FindingSummary) ValidateAll() error { + return m.validate(true) +} + +func (m *FindingSummary) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Category + + // no validation rules for Severity + + // no validation rules for Title + + // no validation rules for Description + + // no validation rules for AggregateMetadata + + if len(errors) > 0 { + return FindingSummaryMultiError(errors) + } + + return nil +} + +// FindingSummaryMultiError is an error wrapping multiple validation errors +// returned by FindingSummary.ValidateAll() if the designated constraints +// aren't met. +type FindingSummaryMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m FindingSummaryMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m FindingSummaryMultiError) AllErrors() []error { return m } + +// FindingSummaryValidationError is the validation error returned by +// FindingSummary.Validate if the designated constraints aren't met. +type FindingSummaryValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e FindingSummaryValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e FindingSummaryValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e FindingSummaryValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e FindingSummaryValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e FindingSummaryValidationError) ErrorName() string { return "FindingSummaryValidationError" } + +// Error satisfies the builtin error interface +func (e FindingSummaryValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sFindingSummary.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = FindingSummaryValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = FindingSummaryValidationError{} + +// Validate checks the field values on EnrichedFinding with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *EnrichedFinding) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EnrichedFinding with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// EnrichedFindingMultiError, or nil if none found. +func (m *EnrichedFinding) ValidateAll() error { + return m.validate(true) +} + +func (m *EnrichedFinding) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for EnrichedDescription + + // no validation rules for EnrichedRemediation + + if len(errors) > 0 { + return EnrichedFindingMultiError(errors) + } + + return nil +} + +// EnrichedFindingMultiError is an error wrapping multiple validation errors +// returned by EnrichedFinding.ValidateAll() if the designated constraints +// aren't met. +type EnrichedFindingMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EnrichedFindingMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EnrichedFindingMultiError) AllErrors() []error { return m } + +// EnrichedFindingValidationError is the validation error returned by +// EnrichedFinding.Validate if the designated constraints aren't met. +type EnrichedFindingValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EnrichedFindingValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EnrichedFindingValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EnrichedFindingValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EnrichedFindingValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EnrichedFindingValidationError) ErrorName() string { return "EnrichedFindingValidationError" } + +// Error satisfies the builtin error interface +func (e EnrichedFindingValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEnrichedFinding.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EnrichedFindingValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EnrichedFindingValidationError{} + +// Validate checks the field values on EnrichRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *EnrichRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EnrichRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in EnrichRequestMultiError, or +// nil if none found. +func (m *EnrichRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *EnrichRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetFindings() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, EnrichRequestValidationError{ + field: fmt.Sprintf("Findings[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, EnrichRequestValidationError{ + field: fmt.Sprintf("Findings[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return EnrichRequestValidationError{ + field: fmt.Sprintf("Findings[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return EnrichRequestMultiError(errors) + } + + return nil +} + +// EnrichRequestMultiError is an error wrapping multiple validation errors +// returned by EnrichRequest.ValidateAll() if the designated constraints +// aren't met. +type EnrichRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EnrichRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EnrichRequestMultiError) AllErrors() []error { return m } + +// EnrichRequestValidationError is the validation error returned by +// EnrichRequest.Validate if the designated constraints aren't met. +type EnrichRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EnrichRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EnrichRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EnrichRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EnrichRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EnrichRequestValidationError) ErrorName() string { return "EnrichRequestValidationError" } + +// Error satisfies the builtin error interface +func (e EnrichRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEnrichRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EnrichRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EnrichRequestValidationError{} + +// Validate checks the field values on EnrichResponse with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *EnrichResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EnrichResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in EnrichResponseMultiError, +// or nil if none found. +func (m *EnrichResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *EnrichResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetEnriched() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, EnrichResponseValidationError{ + field: fmt.Sprintf("Enriched[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, EnrichResponseValidationError{ + field: fmt.Sprintf("Enriched[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return EnrichResponseValidationError{ + field: fmt.Sprintf("Enriched[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return EnrichResponseMultiError(errors) + } + + return nil +} + +// EnrichResponseMultiError is an error wrapping multiple validation errors +// returned by EnrichResponse.ValidateAll() if the designated constraints +// aren't met. +type EnrichResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EnrichResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EnrichResponseMultiError) AllErrors() []error { return m } + +// EnrichResponseValidationError is the validation error returned by +// EnrichResponse.Validate if the designated constraints aren't met. +type EnrichResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EnrichResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EnrichResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EnrichResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EnrichResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EnrichResponseValidationError) ErrorName() string { return "EnrichResponseValidationError" } + +// Error satisfies the builtin error interface +func (e EnrichResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEnrichResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EnrichResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EnrichResponseValidationError{} + +// Validate checks the field values on AnswerRequest with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *AnswerRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on AnswerRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in AnswerRequestMultiError, or +// nil if none found. +func (m *AnswerRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *AnswerRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Question + + // no validation rules for ContextSignals + + if len(errors) > 0 { + return AnswerRequestMultiError(errors) + } + + return nil +} + +// AnswerRequestMultiError is an error wrapping multiple validation errors +// returned by AnswerRequest.ValidateAll() if the designated constraints +// aren't met. +type AnswerRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AnswerRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m AnswerRequestMultiError) AllErrors() []error { return m } + +// AnswerRequestValidationError is the validation error returned by +// AnswerRequest.Validate if the designated constraints aren't met. +type AnswerRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AnswerRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AnswerRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AnswerRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AnswerRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AnswerRequestValidationError) ErrorName() string { return "AnswerRequestValidationError" } + +// Error satisfies the builtin error interface +func (e AnswerRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAnswerRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AnswerRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AnswerRequestValidationError{} + +// Validate checks the field values on AnswerResponse with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *AnswerResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on AnswerResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in AnswerResponseMultiError, +// or nil if none found. +func (m *AnswerResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *AnswerResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Answer + + if len(errors) > 0 { + return AnswerResponseMultiError(errors) + } + + return nil +} + +// AnswerResponseMultiError is an error wrapping multiple validation errors +// returned by AnswerResponse.ValidateAll() if the designated constraints +// aren't met. +type AnswerResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AnswerResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m AnswerResponseMultiError) AllErrors() []error { return m } + +// AnswerResponseValidationError is the validation error returned by +// AnswerResponse.Validate if the designated constraints aren't met. +type AnswerResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AnswerResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AnswerResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AnswerResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AnswerResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AnswerResponseValidationError) ErrorName() string { return "AnswerResponseValidationError" } + +// Error satisfies the builtin error interface +func (e AnswerResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAnswerResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AnswerResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AnswerResponseValidationError{} diff --git a/proto/plugin/llm/v1/llm.proto b/proto/plugin/llm/v1/llm.proto new file mode 100644 index 0000000..a4d28a4 --- /dev/null +++ b/proto/plugin/llm/v1/llm.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; + +package plugin.llm.v1; + +option go_package = "github.com/nnicora/krypton/proto/plugin/llm/v1;llmv1"; + +// LLM is the plugin interface for AI language-model backends used by the +// Advisor module. Only aggregate, privacy-safe statistics are ever transmitted — +// no key material, no key IDs, and no principal names. +service LLM { + // Enrich takes rule-engine findings (plain text, no sensitive data) and + // returns enriched descriptions and remediation steps. + rpc Enrich(EnrichRequest) returns (EnrichResponse); + + // Answer responds to a free-form question about key posture using only the + // supplied aggregate signals — no key material, no key IDs, no principal names. + rpc Answer(AnswerRequest) returns (AnswerResponse); +} + +// FindingSummary is a single rule-engine finding passed to the LLM for enrichment. +// Only aggregate metrics are included — never key material or key IDs. +message FindingSummary { + string category = 1; + string severity = 2; + string title = 3; + string description = 4; + // aggregate_metadata contains counts and names only (e.g. algorithm="AES-256", count="12"). + map aggregate_metadata = 5; +} + +// EnrichedFinding contains LLM-enhanced descriptions for a single finding. +message EnrichedFinding { + string enriched_description = 1; + string enriched_remediation = 2; +} + +message EnrichRequest { + repeated FindingSummary findings = 1; +} + +message EnrichResponse { + repeated EnrichedFinding enriched = 1; +} + +// AnswerRequest carries a free-form question and aggregate context signals. +// context_signals must contain only counts and names — never key material. +message AnswerRequest { + string question = 1; + map context_signals = 2; +} + +message AnswerResponse { + string answer = 1; +} diff --git a/proto/plugin/llm/v1/llm_ext_plugin.pb.go b/proto/plugin/llm/v1/llm_ext_plugin.pb.go new file mode 100644 index 0000000..867144f --- /dev/null +++ b/proto/plugin/llm/v1/llm_ext_plugin.pb.go @@ -0,0 +1,56 @@ +// Code generated by protoc-gen-go-extension. DO NOT EDIT. + +package llmv1 + +import ( + grpc "google.golang.org/grpc" + + api "github.com/openkcm/plugin-sdk/api" +) + +const ( + Type = "LLM" + GRPCServiceFullName = "plugin.llm.v1.LLM" +) + +func LLMPluginServer(server LLMServer) api.PluginServer { + return lLMPluginServer{LLMServer: server} +} + +type lLMPluginServer struct { + LLMServer +} + +func (s lLMPluginServer) Type() string { + return Type +} + +func (s lLMPluginServer) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (s lLMPluginServer) RegisterServer(server *grpc.Server) any { + RegisterLLMServer(server, s.LLMServer) + return s.LLMServer +} + +type LLMPluginClient struct { + LLMClient +} + +func (s LLMPluginClient) Type() string { + return Type +} + +func (c *LLMPluginClient) IsInitialized() bool { + return c.LLMClient != nil +} + +func (c *LLMPluginClient) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (c *LLMPluginClient) InitClient(conn grpc.ClientConnInterface) any { + c.LLMClient = NewLLMClient(conn) + return c.LLMClient +} diff --git a/proto/plugin/llm/v1/llm_grpc.pb.go b/proto/plugin/llm/v1/llm_grpc.pb.go new file mode 100644 index 0000000..e10fb70 --- /dev/null +++ b/proto/plugin/llm/v1/llm_grpc.pb.go @@ -0,0 +1,176 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc (unknown) +// source: plugin/llm/v1/llm.proto + +package llmv1 + +import ( + context "context" + + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + LLM_Enrich_FullMethodName = "/plugin.llm.v1.LLM/Enrich" + LLM_Answer_FullMethodName = "/plugin.llm.v1.LLM/Answer" +) + +// LLMClient is the client API for LLM service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// LLM is the plugin interface for AI language-model backends used by the +// Advisor module. Only aggregate, privacy-safe statistics are ever transmitted — +// no key material, no key IDs, and no principal names. +type LLMClient interface { + // Enrich takes rule-engine findings (plain text, no sensitive data) and + // returns enriched descriptions and remediation steps. + Enrich(ctx context.Context, in *EnrichRequest, opts ...grpc.CallOption) (*EnrichResponse, error) + // Answer responds to a free-form question about key posture using only the + // supplied aggregate signals — no key material, no key IDs, no principal names. + Answer(ctx context.Context, in *AnswerRequest, opts ...grpc.CallOption) (*AnswerResponse, error) +} + +type lLMClient struct { + cc grpc.ClientConnInterface +} + +func NewLLMClient(cc grpc.ClientConnInterface) LLMClient { + return &lLMClient{cc} +} + +func (c *lLMClient) Enrich(ctx context.Context, in *EnrichRequest, opts ...grpc.CallOption) (*EnrichResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(EnrichResponse) + err := c.cc.Invoke(ctx, LLM_Enrich_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *lLMClient) Answer(ctx context.Context, in *AnswerRequest, opts ...grpc.CallOption) (*AnswerResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AnswerResponse) + err := c.cc.Invoke(ctx, LLM_Answer_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LLMServer is the server API for LLM service. +// All implementations must embed UnimplementedLLMServer +// for forward compatibility. +// +// LLM is the plugin interface for AI language-model backends used by the +// Advisor module. Only aggregate, privacy-safe statistics are ever transmitted — +// no key material, no key IDs, and no principal names. +type LLMServer interface { + // Enrich takes rule-engine findings (plain text, no sensitive data) and + // returns enriched descriptions and remediation steps. + Enrich(context.Context, *EnrichRequest) (*EnrichResponse, error) + // Answer responds to a free-form question about key posture using only the + // supplied aggregate signals — no key material, no key IDs, no principal names. + Answer(context.Context, *AnswerRequest) (*AnswerResponse, error) + mustEmbedUnimplementedLLMServer() +} + +// UnimplementedLLMServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedLLMServer struct{} + +func (UnimplementedLLMServer) Enrich(context.Context, *EnrichRequest) (*EnrichResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Enrich not implemented") +} +func (UnimplementedLLMServer) Answer(context.Context, *AnswerRequest) (*AnswerResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Answer not implemented") +} +func (UnimplementedLLMServer) mustEmbedUnimplementedLLMServer() {} +func (UnimplementedLLMServer) testEmbeddedByValue() {} + +// UnsafeLLMServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to LLMServer will +// result in compilation errors. +type UnsafeLLMServer interface { + mustEmbedUnimplementedLLMServer() +} + +func RegisterLLMServer(s grpc.ServiceRegistrar, srv LLMServer) { + // If the following call panics, it indicates UnimplementedLLMServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&LLM_ServiceDesc, srv) +} + +func _LLM_Enrich_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(EnrichRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LLMServer).Enrich(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LLM_Enrich_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LLMServer).Enrich(ctx, req.(*EnrichRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _LLM_Answer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AnswerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LLMServer).Answer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: LLM_Answer_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LLMServer).Answer(ctx, req.(*AnswerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// LLM_ServiceDesc is the grpc.ServiceDesc for LLM service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var LLM_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "plugin.llm.v1.LLM", + HandlerType: (*LLMServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Enrich", + Handler: _LLM_Enrich_Handler, + }, + { + MethodName: "Answer", + Handler: _LLM_Answer_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "plugin/llm/v1/llm.proto", +} From 76881f2bff19f6b1dc78d48f211f33b4b83cf8bd Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Fri, 15 May 2026 17:25:45 +0200 Subject: [PATCH 15/27] modify --- cmd/protoc-gen-go-extension/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/protoc-gen-go-extension/main.go b/cmd/protoc-gen-go-extension/main.go index 33dd7a6..da6e412 100644 --- a/cmd/protoc-gen-go-extension/main.go +++ b/cmd/protoc-gen-go-extension/main.go @@ -99,7 +99,7 @@ func generateServiceBridges(g *protogen.GeneratedFile, serviceName, serviceFullN g.P() g.P("const (") if isPlugin { - g.P(" Type = ", strconv.Quote(serviceName)) + g.P(" Type = ", strconv.Quote(strings.TrimSuffix(serviceName, "Service"))) } g.P(" GRPCServiceFullName = ", strconv.Quote(serviceFullName)) g.P(")") From 10d178a1efe30c22afa9570a8c9260e21154071e Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Wed, 20 May 2026 12:41:10 +0200 Subject: [PATCH 16/27] modify --- .../v1/certificate_issuer_ext_plugin.pb.go | 2 +- .../cipher_wrapper/v1/cipher_wrapper.pb.go | 70 +- .../cipher_wrapper/v1/cipher_wrapper.proto | 2 +- .../v1/cipher_wrapper_ext_plugin.pb.go | 2 +- .../v1/cipher_wrapper_grpc.pb.go | 6 +- .../v1/identity_management_ext_plugin.pb.go | 2 +- .../v1/key_material_storage.pb.go | 114 +- .../v1/key_material_storage.proto | 2 +- .../v1/key_material_storage_ext_plugin.pb.go | 2 +- .../v1/key_material_storage_grpc.pb.go | 10 +- proto/plugin/llm/v1/llm.pb.go | 62 +- proto/plugin/llm/v1/llm.proto | 4 +- proto/plugin/llm/v1/llm_ext_plugin.pb.go | 2 +- proto/plugin/llm/v1/llm_grpc.pb.go | 6 +- .../v1/notification_ext_plugin.pb.go | 2 +- proto/plugin/reconciler/v1/ast.pb.go | 2226 ++++++++ proto/plugin/reconciler/v1/ast.pb.validate.go | 4835 +++++++++++++++++ proto/plugin/reconciler/v1/ast.proto | 273 + proto/plugin/reconciler/v1/reconciler.pb.go | 226 + .../reconciler/v1/reconciler.pb.validate.go | 250 + proto/plugin/reconciler/v1/reconciler.proto | 49 + .../reconciler/v1/reconciler_ext_plugin.pb.go | 56 + .../reconciler/v1/reconciler_grpc.pb.go | 138 + .../v1/systeminformation_ext_plugin.pb.go | 2 +- proto/plugin/test/v1/test_ext_plugin.pb.go | 2 +- 25 files changed, 8199 insertions(+), 146 deletions(-) create mode 100644 proto/plugin/reconciler/v1/ast.pb.go create mode 100644 proto/plugin/reconciler/v1/ast.pb.validate.go create mode 100644 proto/plugin/reconciler/v1/ast.proto create mode 100644 proto/plugin/reconciler/v1/reconciler.pb.go create mode 100644 proto/plugin/reconciler/v1/reconciler.pb.validate.go create mode 100644 proto/plugin/reconciler/v1/reconciler.proto create mode 100644 proto/plugin/reconciler/v1/reconciler_ext_plugin.pb.go create mode 100644 proto/plugin/reconciler/v1/reconciler_grpc.pb.go diff --git a/proto/plugin/certificate_issuer/v1/certificate_issuer_ext_plugin.pb.go b/proto/plugin/certificate_issuer/v1/certificate_issuer_ext_plugin.pb.go index dfe9e3a..7d0d285 100644 --- a/proto/plugin/certificate_issuer/v1/certificate_issuer_ext_plugin.pb.go +++ b/proto/plugin/certificate_issuer/v1/certificate_issuer_ext_plugin.pb.go @@ -9,7 +9,7 @@ import ( ) const ( - Type = "CertificateIssuerService" + Type = "CertificateIssuer" GRPCServiceFullName = "plugin.certificate_issuer.v1.CertificateIssuerService" ) diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go index 7346807..5381580 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go @@ -369,25 +369,25 @@ var File_plugin_cipher_wrapper_v1_cipher_wrapper_proto protoreflect.FileDescript const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\n" + - "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x18plugin.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\xe7\x01\n" + + "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x19krypton.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\xe8\x01\n" + "\fKeyReference\x12\x15\n" + "\x06key_id\x18\x01 \x01(\tR\x05keyId\x12\x1d\n" + - "\aversion\x18\x02 \x01(\tH\x00R\aversion\x88\x01\x01\x12V\n" + + "\aversion\x18\x02 \x01(\tH\x00R\aversion\x88\x01\x01\x12W\n" + "\n" + - "properties\x18\x03 \x03(\v26.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntryR\n" + + "properties\x18\x03 \x03(\v27.krypton.cipher_wrapper.v1.KeyReference.PropertiesEntryR\n" + "properties\x1a=\n" + "\x0fPropertiesEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\n" + "\n" + - "\b_version\"\xdc\x02\n" + - "\vWrapRequest\x12@\n" + - "\x03key\x18\x01 \x01(\v2&.plugin.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12(\n" + + "\b_version\"\xde\x02\n" + + "\vWrapRequest\x12A\n" + + "\x03key\x18\x01 \x01(\v2'.krypton.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12(\n" + "\tplaintext\x18\x02 \x01(\fB\n" + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\tplaintext\x12\x15\n" + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12c\n" + - "\x0fdynamic_context\x18\x84\a \x03(\v29.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + + "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12d\n" + + "\x0fdynamic_context\x18\x84\a \x03(\v2:.krypton.cipher_wrapper.v1.WrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + "\x13DynamicContextEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + @@ -400,27 +400,27 @@ const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\x0ekey_version_id\x18\x02 \x01(\tH\x00R\fkeyVersionId\x88\x01\x01\x12\x13\n" + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01B\x11\n" + "\x0f_key_version_idB\x05\n" + - "\x03_iv\"\xe2\x02\n" + - "\rUnwrapRequest\x12@\n" + - "\x03key\x18\x01 \x01(\v2&.plugin.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12*\n" + + "\x03_iv\"\xe4\x02\n" + + "\rUnwrapRequest\x12A\n" + + "\x03key\x18\x01 \x01(\v2'.krypton.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12*\n" + "\n" + "ciphertext\x18\x02 \x01(\fB\n" + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\n" + "ciphertext\x12\x15\n" + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12e\n" + - "\x0fdynamic_context\x18\x84\a \x03(\v2;.plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + + "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12f\n" + + "\x0fdynamic_context\x18\x84\a \x03(\v2<.krypton.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + "\x13DynamicContextEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + "\x04_aadB\x05\n" + "\x03_iv\".\n" + "\x0eUnwrapResponse\x12\x1c\n" + - "\tplaintext\x18\x01 \x01(\fR\tplaintext2\xc3\x01\n" + - "\rCipherWrapper\x12U\n" + - "\x04Wrap\x12%.plugin.cipher_wrapper.v1.WrapRequest\x1a&.plugin.cipher_wrapper.v1.WrapResponse\x12[\n" + - "\x06Unwrap\x12'.plugin.cipher_wrapper.v1.UnwrapRequest\x1a(.plugin.cipher_wrapper.v1.UnwrapResponseB\xff\x01\n" + - "\x1ccom.plugin.cipher_wrapper.v1B\x12CipherWrapperProtoP\x01ZMgithub.com/openkcm/plugin-sdk/proto/plugin/cipher_wrapper/v1;cipher_wrapperv1\xa2\x02\x03PCX\xaa\x02\x17Plugin.CipherWrapper.V1\xca\x02\x17Plugin\\CipherWrapper\\V1\xe2\x02#Plugin\\CipherWrapper\\V1\\GPBMetadata\xea\x02\x19Plugin::CipherWrapper::V1b\x06proto3" + "\tplaintext\x18\x01 \x01(\fR\tplaintext2\xc7\x01\n" + + "\rCipherWrapper\x12W\n" + + "\x04Wrap\x12&.krypton.cipher_wrapper.v1.WrapRequest\x1a'.krypton.cipher_wrapper.v1.WrapResponse\x12]\n" + + "\x06Unwrap\x12(.krypton.cipher_wrapper.v1.UnwrapRequest\x1a).krypton.cipher_wrapper.v1.UnwrapResponseB\x84\x02\n" + + "\x1dcom.krypton.cipher_wrapper.v1B\x12CipherWrapperProtoP\x01ZMgithub.com/openkcm/plugin-sdk/proto/plugin/cipher_wrapper/v1;cipher_wrapperv1\xa2\x02\x03KCX\xaa\x02\x18Krypton.CipherWrapper.V1\xca\x02\x18Krypton\\CipherWrapper\\V1\xe2\x02$Krypton\\CipherWrapper\\V1\\GPBMetadata\xea\x02\x1aKrypton::CipherWrapper::V1b\x06proto3" var ( file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescOnce sync.Once @@ -436,25 +436,25 @@ func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP() []byte { var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_goTypes = []any{ - (*KeyReference)(nil), // 0: plugin.cipher_wrapper.v1.KeyReference - (*WrapRequest)(nil), // 1: plugin.cipher_wrapper.v1.WrapRequest - (*WrapResponse)(nil), // 2: plugin.cipher_wrapper.v1.WrapResponse - (*UnwrapRequest)(nil), // 3: plugin.cipher_wrapper.v1.UnwrapRequest - (*UnwrapResponse)(nil), // 4: plugin.cipher_wrapper.v1.UnwrapResponse - nil, // 5: plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry - nil, // 6: plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry - nil, // 7: plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry + (*KeyReference)(nil), // 0: krypton.cipher_wrapper.v1.KeyReference + (*WrapRequest)(nil), // 1: krypton.cipher_wrapper.v1.WrapRequest + (*WrapResponse)(nil), // 2: krypton.cipher_wrapper.v1.WrapResponse + (*UnwrapRequest)(nil), // 3: krypton.cipher_wrapper.v1.UnwrapRequest + (*UnwrapResponse)(nil), // 4: krypton.cipher_wrapper.v1.UnwrapResponse + nil, // 5: krypton.cipher_wrapper.v1.KeyReference.PropertiesEntry + nil, // 6: krypton.cipher_wrapper.v1.WrapRequest.DynamicContextEntry + nil, // 7: krypton.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry } var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_depIdxs = []int32{ - 5, // 0: plugin.cipher_wrapper.v1.KeyReference.properties:type_name -> plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry - 0, // 1: plugin.cipher_wrapper.v1.WrapRequest.key:type_name -> plugin.cipher_wrapper.v1.KeyReference - 6, // 2: plugin.cipher_wrapper.v1.WrapRequest.dynamic_context:type_name -> plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry - 0, // 3: plugin.cipher_wrapper.v1.UnwrapRequest.key:type_name -> plugin.cipher_wrapper.v1.KeyReference - 7, // 4: plugin.cipher_wrapper.v1.UnwrapRequest.dynamic_context:type_name -> plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry - 1, // 5: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> plugin.cipher_wrapper.v1.WrapRequest - 3, // 6: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> plugin.cipher_wrapper.v1.UnwrapRequest - 2, // 7: plugin.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> plugin.cipher_wrapper.v1.WrapResponse - 4, // 8: plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> plugin.cipher_wrapper.v1.UnwrapResponse + 5, // 0: krypton.cipher_wrapper.v1.KeyReference.properties:type_name -> krypton.cipher_wrapper.v1.KeyReference.PropertiesEntry + 0, // 1: krypton.cipher_wrapper.v1.WrapRequest.key:type_name -> krypton.cipher_wrapper.v1.KeyReference + 6, // 2: krypton.cipher_wrapper.v1.WrapRequest.dynamic_context:type_name -> krypton.cipher_wrapper.v1.WrapRequest.DynamicContextEntry + 0, // 3: krypton.cipher_wrapper.v1.UnwrapRequest.key:type_name -> krypton.cipher_wrapper.v1.KeyReference + 7, // 4: krypton.cipher_wrapper.v1.UnwrapRequest.dynamic_context:type_name -> krypton.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry + 1, // 5: krypton.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> krypton.cipher_wrapper.v1.WrapRequest + 3, // 6: krypton.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> krypton.cipher_wrapper.v1.UnwrapRequest + 2, // 7: krypton.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> krypton.cipher_wrapper.v1.WrapResponse + 4, // 8: krypton.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> krypton.cipher_wrapper.v1.UnwrapResponse 7, // [7:9] is the sub-list for method output_type 5, // [5:7] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto index 924d620..2e7b9dc 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package plugin.cipher_wrapper.v1; +package krypton.cipher_wrapper.v1; import "buf/validate/validate.proto"; diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go index eebbf6a..ff7cecb 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go @@ -10,7 +10,7 @@ import ( const ( Type = "CipherWrapper" - GRPCServiceFullName = "plugin.cipher_wrapper.v1.CipherWrapper" + GRPCServiceFullName = "krypton.cipher_wrapper.v1.CipherWrapper" ) func CipherWrapperPluginServer(server CipherWrapperServer) api.PluginServer { diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go index 197aeba..7f804a9 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go @@ -20,8 +20,8 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - CipherWrapper_Wrap_FullMethodName = "/plugin.cipher_wrapper.v1.CipherWrapper/Wrap" - CipherWrapper_Unwrap_FullMethodName = "/plugin.cipher_wrapper.v1.CipherWrapper/Unwrap" + CipherWrapper_Wrap_FullMethodName = "/krypton.cipher_wrapper.v1.CipherWrapper/Wrap" + CipherWrapper_Unwrap_FullMethodName = "/krypton.cipher_wrapper.v1.CipherWrapper/Unwrap" ) // CipherWrapperClient is the client API for CipherWrapper service. @@ -159,7 +159,7 @@ func _CipherWrapper_Unwrap_Handler(srv interface{}, ctx context.Context, dec fun // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var CipherWrapper_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "plugin.cipher_wrapper.v1.CipherWrapper", + ServiceName: "krypton.cipher_wrapper.v1.CipherWrapper", HandlerType: (*CipherWrapperServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/proto/plugin/identity_management/v1/identity_management_ext_plugin.pb.go b/proto/plugin/identity_management/v1/identity_management_ext_plugin.pb.go index a047d65..ecd0fc7 100644 --- a/proto/plugin/identity_management/v1/identity_management_ext_plugin.pb.go +++ b/proto/plugin/identity_management/v1/identity_management_ext_plugin.pb.go @@ -9,7 +9,7 @@ import ( ) const ( - Type = "IdentityManagementService" + Type = "IdentityManagement" GRPCServiceFullName = "plugin.identity_management.v1.IdentityManagementService" ) diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index d57aa1a..efaf7ac 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -753,7 +753,7 @@ var File_plugin_key_material_storage_v1_key_material_storage_proto protoreflect. const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = "" + "\n" + - "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1eplugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa4\x03\n" + + "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1fkrypton.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa5\x03\n" + "\vKeyMaterial\x12\x17\n" + "\x02id\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\x12\x1b\n" + "\x04data\x18\x02 \x01(\fB\a\xbaH\x04z\x02\x10\x01R\x04data\x12%\n" + @@ -761,19 +761,19 @@ const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = " "\x13previous_version_id\x18\x04 \x01(\tH\x00R\x11previousVersionId\x88\x01\x01\x12\x1f\n" + "\bchecksum\x18\x05 \x01(\tH\x01R\bchecksum\x88\x01\x01\x129\n" + "\n" + - "created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x12I\n" + - "\x04tags\x18\a \x03(\v25.plugin.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + + "created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x12J\n" + + "\x04tags\x18\a \x03(\v26.krypton.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + "\tTagsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x16\n" + "\x14_previous_version_idB\v\n" + - "\t_checksum\"\xd7\x04\n" + - "\x06Filter\x12G\n" + - "\x02id\x18\x01 \x01(\v22.plugin.key_material_storage.v1.Filter.StringMatchH\x00R\x02id\x88\x01\x01\x12!\n" + - "\talgorithm\x18\x02 \x01(\tH\x01R\talgorithm\x88\x01\x01\x12D\n" + - "\x04tags\x18\x03 \x03(\v20.plugin.key_material_storage.v1.Filter.TagsEntryR\x04tags\x12T\n" + + "\t_checksum\"\xda\x04\n" + + "\x06Filter\x12H\n" + + "\x02id\x18\x01 \x01(\v23.krypton.key_material_storage.v1.Filter.StringMatchH\x00R\x02id\x88\x01\x01\x12!\n" + + "\talgorithm\x18\x02 \x01(\tH\x01R\talgorithm\x88\x01\x01\x12E\n" + + "\x04tags\x18\x03 \x03(\v21.krypton.key_material_storage.v1.Filter.TagsEntryR\x04tags\x12U\n" + "\n" + - "created_at\x18\x04 \x01(\v20.plugin.key_material_storage.v1.Filter.TimeRangeH\x02R\tcreatedAt\x88\x01\x01\x1a\x7f\n" + + "created_at\x18\x04 \x01(\v21.krypton.key_material_storage.v1.Filter.TimeRangeH\x02R\tcreatedAt\x88\x01\x01\x1a\x7f\n" + "\vStringMatch\x12\x18\n" + "\x06prefix\x18\x01 \x01(\tH\x00R\x06prefix\x12\x18\n" + "\x06suffix\x18\x02 \x01(\tH\x00R\x06suffix\x12\x1c\n" + @@ -789,36 +789,36 @@ const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = " "\x03_idB\f\n" + "\n" + "_algorithmB\r\n" + - "\v_created_at\"\xc3\x01\n" + + "\v_created_at\"\xc4\x01\n" + "\x0eListIDsRequest\x12%\n" + - "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12C\n" + - "\x06filter\x18\x02 \x01(\v2&.plugin.key_material_storage.v1.FilterH\x00R\x06filter\x88\x01\x01\x12\x1b\n" + + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12D\n" + + "\x06filter\x18\x02 \x01(\v2'.krypton.key_material_storage.v1.FilterH\x00R\x06filter\x88\x01\x01\x12\x1b\n" + "\tpage_size\x18\x03 \x01(\rR\bpageSize\x12\x1d\n" + "\n" + "page_token\x18\x04 \x01(\tR\tpageTokenB\t\n" + "\a_filter\"K\n" + "\x0fListIDsResponse\x12\x10\n" + "\x03ids\x18\x01 \x03(\tR\x03ids\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x8d\x01\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x8e\x01\n" + "\fStoreRequest\x12%\n" + - "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12V\n" + - "\fkey_material\x18\x02 \x01(\v2+.plugin.key_material_storage.v1.KeyMaterialB\x06\xbaH\x03\xc8\x01\x01R\vkeyMaterial\"\x0f\n" + + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12W\n" + + "\fkey_material\x18\x02 \x01(\v2,.krypton.key_material_storage.v1.KeyMaterialB\x06\xbaH\x03\xc8\x01\x01R\vkeyMaterial\"\x0f\n" + "\rStoreResponse\"M\n" + "\vLoadRequest\x12%\n" + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12\x17\n" + - "\x02id\x18\x02 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\"^\n" + - "\fLoadResponse\x12N\n" + - "\fkey_material\x18\x01 \x01(\v2+.plugin.key_material_storage.v1.KeyMaterialR\vkeyMaterial\"O\n" + + "\x02id\x18\x02 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\"_\n" + + "\fLoadResponse\x12O\n" + + "\fkey_material\x18\x01 \x01(\v2,.krypton.key_material_storage.v1.KeyMaterialR\vkeyMaterial\"O\n" + "\rDeleteRequest\x12%\n" + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12\x17\n" + "\x02id\x18\x02 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\"\x10\n" + - "\x0eDeleteResponse2\xb4\x03\n" + - "\x12KeyMaterialStorage\x12d\n" + - "\x05Store\x12,.plugin.key_material_storage.v1.StoreRequest\x1a-.plugin.key_material_storage.v1.StoreResponse\x12a\n" + - "\x04Load\x12+.plugin.key_material_storage.v1.LoadRequest\x1a,.plugin.key_material_storage.v1.LoadResponse\x12g\n" + - "\x06Delete\x12-.plugin.key_material_storage.v1.DeleteRequest\x1a..plugin.key_material_storage.v1.DeleteResponse\x12l\n" + - "\aListIDs\x12..plugin.key_material_storage.v1.ListIDsRequest\x1a/.plugin.key_material_storage.v1.ListIDsResponse0\x01B\xaa\x02\n" + - "\"com.plugin.key_material_storage.v1B\x17KeyMaterialStorageProtoP\x01ZYgithub.com/openkcm/plugin-sdk/proto/plugin/key_material_storage/v1;key_material_storagev1\xa2\x02\x03PKX\xaa\x02\x1cPlugin.KeyMaterialStorage.V1\xca\x02\x1cPlugin\\KeyMaterialStorage\\V1\xe2\x02(Plugin\\KeyMaterialStorage\\V1\\GPBMetadata\xea\x02\x1ePlugin::KeyMaterialStorage::V1b\x06proto3" + "\x0eDeleteResponse2\xbc\x03\n" + + "\x12KeyMaterialStorage\x12f\n" + + "\x05Store\x12-.krypton.key_material_storage.v1.StoreRequest\x1a..krypton.key_material_storage.v1.StoreResponse\x12c\n" + + "\x04Load\x12,.krypton.key_material_storage.v1.LoadRequest\x1a-.krypton.key_material_storage.v1.LoadResponse\x12i\n" + + "\x06Delete\x12..krypton.key_material_storage.v1.DeleteRequest\x1a/.krypton.key_material_storage.v1.DeleteResponse\x12n\n" + + "\aListIDs\x12/.krypton.key_material_storage.v1.ListIDsRequest\x1a0.krypton.key_material_storage.v1.ListIDsResponse0\x01B\xaf\x02\n" + + "#com.krypton.key_material_storage.v1B\x17KeyMaterialStorageProtoP\x01ZYgithub.com/openkcm/plugin-sdk/proto/plugin/key_material_storage/v1;key_material_storagev1\xa2\x02\x03KKX\xaa\x02\x1dKrypton.KeyMaterialStorage.V1\xca\x02\x1dKrypton\\KeyMaterialStorage\\V1\xe2\x02)Krypton\\KeyMaterialStorage\\V1\\GPBMetadata\xea\x02\x1fKrypton::KeyMaterialStorage::V1b\x06proto3" var ( file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescOnce sync.Once @@ -834,41 +834,41 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP( var file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_plugin_key_material_storage_v1_key_material_storage_proto_goTypes = []any{ - (*KeyMaterial)(nil), // 0: plugin.key_material_storage.v1.KeyMaterial - (*Filter)(nil), // 1: plugin.key_material_storage.v1.Filter - (*ListIDsRequest)(nil), // 2: plugin.key_material_storage.v1.ListIDsRequest - (*ListIDsResponse)(nil), // 3: plugin.key_material_storage.v1.ListIDsResponse - (*StoreRequest)(nil), // 4: plugin.key_material_storage.v1.StoreRequest - (*StoreResponse)(nil), // 5: plugin.key_material_storage.v1.StoreResponse - (*LoadRequest)(nil), // 6: plugin.key_material_storage.v1.LoadRequest - (*LoadResponse)(nil), // 7: plugin.key_material_storage.v1.LoadResponse - (*DeleteRequest)(nil), // 8: plugin.key_material_storage.v1.DeleteRequest - (*DeleteResponse)(nil), // 9: plugin.key_material_storage.v1.DeleteResponse - nil, // 10: plugin.key_material_storage.v1.KeyMaterial.TagsEntry - (*Filter_StringMatch)(nil), // 11: plugin.key_material_storage.v1.Filter.StringMatch - nil, // 12: plugin.key_material_storage.v1.Filter.TagsEntry - (*Filter_TimeRange)(nil), // 13: plugin.key_material_storage.v1.Filter.TimeRange + (*KeyMaterial)(nil), // 0: krypton.key_material_storage.v1.KeyMaterial + (*Filter)(nil), // 1: krypton.key_material_storage.v1.Filter + (*ListIDsRequest)(nil), // 2: krypton.key_material_storage.v1.ListIDsRequest + (*ListIDsResponse)(nil), // 3: krypton.key_material_storage.v1.ListIDsResponse + (*StoreRequest)(nil), // 4: krypton.key_material_storage.v1.StoreRequest + (*StoreResponse)(nil), // 5: krypton.key_material_storage.v1.StoreResponse + (*LoadRequest)(nil), // 6: krypton.key_material_storage.v1.LoadRequest + (*LoadResponse)(nil), // 7: krypton.key_material_storage.v1.LoadResponse + (*DeleteRequest)(nil), // 8: krypton.key_material_storage.v1.DeleteRequest + (*DeleteResponse)(nil), // 9: krypton.key_material_storage.v1.DeleteResponse + nil, // 10: krypton.key_material_storage.v1.KeyMaterial.TagsEntry + (*Filter_StringMatch)(nil), // 11: krypton.key_material_storage.v1.Filter.StringMatch + nil, // 12: krypton.key_material_storage.v1.Filter.TagsEntry + (*Filter_TimeRange)(nil), // 13: krypton.key_material_storage.v1.Filter.TimeRange (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp } var file_plugin_key_material_storage_v1_key_material_storage_proto_depIdxs = []int32{ - 14, // 0: plugin.key_material_storage.v1.KeyMaterial.created_at:type_name -> google.protobuf.Timestamp - 10, // 1: plugin.key_material_storage.v1.KeyMaterial.tags:type_name -> plugin.key_material_storage.v1.KeyMaterial.TagsEntry - 11, // 2: plugin.key_material_storage.v1.Filter.id:type_name -> plugin.key_material_storage.v1.Filter.StringMatch - 12, // 3: plugin.key_material_storage.v1.Filter.tags:type_name -> plugin.key_material_storage.v1.Filter.TagsEntry - 13, // 4: plugin.key_material_storage.v1.Filter.created_at:type_name -> plugin.key_material_storage.v1.Filter.TimeRange - 1, // 5: plugin.key_material_storage.v1.ListIDsRequest.filter:type_name -> plugin.key_material_storage.v1.Filter - 0, // 6: plugin.key_material_storage.v1.StoreRequest.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial - 0, // 7: plugin.key_material_storage.v1.LoadResponse.key_material:type_name -> plugin.key_material_storage.v1.KeyMaterial - 14, // 8: plugin.key_material_storage.v1.Filter.TimeRange.from:type_name -> google.protobuf.Timestamp - 14, // 9: plugin.key_material_storage.v1.Filter.TimeRange.to:type_name -> google.protobuf.Timestamp - 4, // 10: plugin.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> plugin.key_material_storage.v1.StoreRequest - 6, // 11: plugin.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> plugin.key_material_storage.v1.LoadRequest - 8, // 12: plugin.key_material_storage.v1.KeyMaterialStorage.Delete:input_type -> plugin.key_material_storage.v1.DeleteRequest - 2, // 13: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:input_type -> plugin.key_material_storage.v1.ListIDsRequest - 5, // 14: plugin.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> plugin.key_material_storage.v1.StoreResponse - 7, // 15: plugin.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> plugin.key_material_storage.v1.LoadResponse - 9, // 16: plugin.key_material_storage.v1.KeyMaterialStorage.Delete:output_type -> plugin.key_material_storage.v1.DeleteResponse - 3, // 17: plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:output_type -> plugin.key_material_storage.v1.ListIDsResponse + 14, // 0: krypton.key_material_storage.v1.KeyMaterial.created_at:type_name -> google.protobuf.Timestamp + 10, // 1: krypton.key_material_storage.v1.KeyMaterial.tags:type_name -> krypton.key_material_storage.v1.KeyMaterial.TagsEntry + 11, // 2: krypton.key_material_storage.v1.Filter.id:type_name -> krypton.key_material_storage.v1.Filter.StringMatch + 12, // 3: krypton.key_material_storage.v1.Filter.tags:type_name -> krypton.key_material_storage.v1.Filter.TagsEntry + 13, // 4: krypton.key_material_storage.v1.Filter.created_at:type_name -> krypton.key_material_storage.v1.Filter.TimeRange + 1, // 5: krypton.key_material_storage.v1.ListIDsRequest.filter:type_name -> krypton.key_material_storage.v1.Filter + 0, // 6: krypton.key_material_storage.v1.StoreRequest.key_material:type_name -> krypton.key_material_storage.v1.KeyMaterial + 0, // 7: krypton.key_material_storage.v1.LoadResponse.key_material:type_name -> krypton.key_material_storage.v1.KeyMaterial + 14, // 8: krypton.key_material_storage.v1.Filter.TimeRange.from:type_name -> google.protobuf.Timestamp + 14, // 9: krypton.key_material_storage.v1.Filter.TimeRange.to:type_name -> google.protobuf.Timestamp + 4, // 10: krypton.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> krypton.key_material_storage.v1.StoreRequest + 6, // 11: krypton.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> krypton.key_material_storage.v1.LoadRequest + 8, // 12: krypton.key_material_storage.v1.KeyMaterialStorage.Delete:input_type -> krypton.key_material_storage.v1.DeleteRequest + 2, // 13: krypton.key_material_storage.v1.KeyMaterialStorage.ListIDs:input_type -> krypton.key_material_storage.v1.ListIDsRequest + 5, // 14: krypton.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> krypton.key_material_storage.v1.StoreResponse + 7, // 15: krypton.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> krypton.key_material_storage.v1.LoadResponse + 9, // 16: krypton.key_material_storage.v1.KeyMaterialStorage.Delete:output_type -> krypton.key_material_storage.v1.DeleteResponse + 3, // 17: krypton.key_material_storage.v1.KeyMaterialStorage.ListIDs:output_type -> krypton.key_material_storage.v1.ListIDsResponse 14, // [14:18] is the sub-list for method output_type 10, // [10:14] is the sub-list for method input_type 10, // [10:10] is the sub-list for extension type_name diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index 1ce3d51..f91cd0f 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package plugin.key_material_storage.v1; +package krypton.key_material_storage.v1; import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; diff --git a/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go index 9f108c7..b8aa587 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go @@ -10,7 +10,7 @@ import ( const ( Type = "KeyMaterialStorage" - GRPCServiceFullName = "plugin.key_material_storage.v1.KeyMaterialStorage" + GRPCServiceFullName = "krypton.key_material_storage.v1.KeyMaterialStorage" ) func KeyMaterialStoragePluginServer(server KeyMaterialStorageServer) api.PluginServer { diff --git a/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go index eb7193e..ec594a0 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go @@ -20,10 +20,10 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - KeyMaterialStorage_Store_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Store" - KeyMaterialStorage_Load_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Load" - KeyMaterialStorage_Delete_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/Delete" - KeyMaterialStorage_ListIDs_FullMethodName = "/plugin.key_material_storage.v1.KeyMaterialStorage/ListIDs" + KeyMaterialStorage_Store_FullMethodName = "/krypton.key_material_storage.v1.KeyMaterialStorage/Store" + KeyMaterialStorage_Load_FullMethodName = "/krypton.key_material_storage.v1.KeyMaterialStorage/Load" + KeyMaterialStorage_Delete_FullMethodName = "/krypton.key_material_storage.v1.KeyMaterialStorage/Delete" + KeyMaterialStorage_ListIDs_FullMethodName = "/krypton.key_material_storage.v1.KeyMaterialStorage/ListIDs" ) // KeyMaterialStorageClient is the client API for KeyMaterialStorage service. @@ -221,7 +221,7 @@ type KeyMaterialStorage_ListIDsServer = grpc.ServerStreamingServer[ListIDsRespon // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var KeyMaterialStorage_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "plugin.key_material_storage.v1.KeyMaterialStorage", + ServiceName: "krypton.key_material_storage.v1.KeyMaterialStorage", HandlerType: (*KeyMaterialStorageServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/proto/plugin/llm/v1/llm.pb.go b/proto/plugin/llm/v1/llm.pb.go index 297015f..d067a63 100644 --- a/proto/plugin/llm/v1/llm.pb.go +++ b/proto/plugin/llm/v1/llm.pb.go @@ -344,35 +344,35 @@ var File_plugin_llm_v1_llm_proto protoreflect.FileDescriptor const file_plugin_llm_v1_llm_proto_rawDesc = "" + "\n" + - "\x17plugin/llm/v1/llm.proto\x12\rplugin.llm.v1\"\xab\x02\n" + + "\x17plugin/llm/v1/llm.proto\x12\x0ekrypton.llm.v1\"\xac\x02\n" + "\x0eFindingSummary\x12\x1a\n" + "\bcategory\x18\x01 \x01(\tR\bcategory\x12\x1a\n" + "\bseverity\x18\x02 \x01(\tR\bseverity\x12\x14\n" + "\x05title\x18\x03 \x01(\tR\x05title\x12 \n" + - "\vdescription\x18\x04 \x01(\tR\vdescription\x12c\n" + - "\x12aggregate_metadata\x18\x05 \x03(\v24.plugin.llm.v1.FindingSummary.AggregateMetadataEntryR\x11aggregateMetadata\x1aD\n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x12d\n" + + "\x12aggregate_metadata\x18\x05 \x03(\v25.krypton.llm.v1.FindingSummary.AggregateMetadataEntryR\x11aggregateMetadata\x1aD\n" + "\x16AggregateMetadataEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"w\n" + "\x0fEnrichedFinding\x121\n" + "\x14enriched_description\x18\x01 \x01(\tR\x13enrichedDescription\x121\n" + - "\x14enriched_remediation\x18\x02 \x01(\tR\x13enrichedRemediation\"J\n" + - "\rEnrichRequest\x129\n" + - "\bfindings\x18\x01 \x03(\v2\x1d.plugin.llm.v1.FindingSummaryR\bfindings\"L\n" + - "\x0eEnrichResponse\x12:\n" + - "\benriched\x18\x01 \x03(\v2\x1e.plugin.llm.v1.EnrichedFindingR\benriched\"\xc9\x01\n" + + "\x14enriched_remediation\x18\x02 \x01(\tR\x13enrichedRemediation\"K\n" + + "\rEnrichRequest\x12:\n" + + "\bfindings\x18\x01 \x03(\v2\x1e.krypton.llm.v1.FindingSummaryR\bfindings\"M\n" + + "\x0eEnrichResponse\x12;\n" + + "\benriched\x18\x01 \x03(\v2\x1f.krypton.llm.v1.EnrichedFindingR\benriched\"\xca\x01\n" + "\rAnswerRequest\x12\x1a\n" + - "\bquestion\x18\x01 \x01(\tR\bquestion\x12Y\n" + - "\x0fcontext_signals\x18\x02 \x03(\v20.plugin.llm.v1.AnswerRequest.ContextSignalsEntryR\x0econtextSignals\x1aA\n" + + "\bquestion\x18\x01 \x01(\tR\bquestion\x12Z\n" + + "\x0fcontext_signals\x18\x02 \x03(\v21.krypton.llm.v1.AnswerRequest.ContextSignalsEntryR\x0econtextSignals\x1aA\n" + "\x13ContextSignalsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"(\n" + "\x0eAnswerResponse\x12\x16\n" + - "\x06answer\x18\x01 \x01(\tR\x06answer2\x93\x01\n" + - "\x03LLM\x12E\n" + - "\x06Enrich\x12\x1c.plugin.llm.v1.EnrichRequest\x1a\x1d.plugin.llm.v1.EnrichResponse\x12E\n" + - "\x06Answer\x12\x1c.plugin.llm.v1.AnswerRequest\x1a\x1d.plugin.llm.v1.AnswerResponseB\xac\x01\n" + - "\x11com.plugin.llm.v1B\bLlmProtoP\x01Z7github.com/openkcm/plugin-sdk/proto/plugin/llm/v1;llmv1\xa2\x02\x03PLX\xaa\x02\rPlugin.Llm.V1\xca\x02\rPlugin\\Llm\\V1\xe2\x02\x19Plugin\\Llm\\V1\\GPBMetadata\xea\x02\x0fPlugin::Llm::V1b\x06proto3" + "\x06answer\x18\x01 \x01(\tR\x06answer2\x97\x01\n" + + "\x03LLM\x12G\n" + + "\x06Enrich\x12\x1d.krypton.llm.v1.EnrichRequest\x1a\x1e.krypton.llm.v1.EnrichResponse\x12G\n" + + "\x06Answer\x12\x1d.krypton.llm.v1.AnswerRequest\x1a\x1e.krypton.llm.v1.AnswerResponseB\xb1\x01\n" + + "\x12com.krypton.llm.v1B\bLlmProtoP\x01Z7github.com/openkcm/plugin-sdk/proto/plugin/llm/v1;llmv1\xa2\x02\x03KLX\xaa\x02\x0eKrypton.Llm.V1\xca\x02\x0eKrypton\\Llm\\V1\xe2\x02\x1aKrypton\\Llm\\V1\\GPBMetadata\xea\x02\x10Krypton::Llm::V1b\x06proto3" var ( file_plugin_llm_v1_llm_proto_rawDescOnce sync.Once @@ -388,24 +388,24 @@ func file_plugin_llm_v1_llm_proto_rawDescGZIP() []byte { var file_plugin_llm_v1_llm_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_plugin_llm_v1_llm_proto_goTypes = []any{ - (*FindingSummary)(nil), // 0: plugin.llm.v1.FindingSummary - (*EnrichedFinding)(nil), // 1: plugin.llm.v1.EnrichedFinding - (*EnrichRequest)(nil), // 2: plugin.llm.v1.EnrichRequest - (*EnrichResponse)(nil), // 3: plugin.llm.v1.EnrichResponse - (*AnswerRequest)(nil), // 4: plugin.llm.v1.AnswerRequest - (*AnswerResponse)(nil), // 5: plugin.llm.v1.AnswerResponse - nil, // 6: plugin.llm.v1.FindingSummary.AggregateMetadataEntry - nil, // 7: plugin.llm.v1.AnswerRequest.ContextSignalsEntry + (*FindingSummary)(nil), // 0: krypton.llm.v1.FindingSummary + (*EnrichedFinding)(nil), // 1: krypton.llm.v1.EnrichedFinding + (*EnrichRequest)(nil), // 2: krypton.llm.v1.EnrichRequest + (*EnrichResponse)(nil), // 3: krypton.llm.v1.EnrichResponse + (*AnswerRequest)(nil), // 4: krypton.llm.v1.AnswerRequest + (*AnswerResponse)(nil), // 5: krypton.llm.v1.AnswerResponse + nil, // 6: krypton.llm.v1.FindingSummary.AggregateMetadataEntry + nil, // 7: krypton.llm.v1.AnswerRequest.ContextSignalsEntry } var file_plugin_llm_v1_llm_proto_depIdxs = []int32{ - 6, // 0: plugin.llm.v1.FindingSummary.aggregate_metadata:type_name -> plugin.llm.v1.FindingSummary.AggregateMetadataEntry - 0, // 1: plugin.llm.v1.EnrichRequest.findings:type_name -> plugin.llm.v1.FindingSummary - 1, // 2: plugin.llm.v1.EnrichResponse.enriched:type_name -> plugin.llm.v1.EnrichedFinding - 7, // 3: plugin.llm.v1.AnswerRequest.context_signals:type_name -> plugin.llm.v1.AnswerRequest.ContextSignalsEntry - 2, // 4: plugin.llm.v1.LLM.Enrich:input_type -> plugin.llm.v1.EnrichRequest - 4, // 5: plugin.llm.v1.LLM.Answer:input_type -> plugin.llm.v1.AnswerRequest - 3, // 6: plugin.llm.v1.LLM.Enrich:output_type -> plugin.llm.v1.EnrichResponse - 5, // 7: plugin.llm.v1.LLM.Answer:output_type -> plugin.llm.v1.AnswerResponse + 6, // 0: krypton.llm.v1.FindingSummary.aggregate_metadata:type_name -> krypton.llm.v1.FindingSummary.AggregateMetadataEntry + 0, // 1: krypton.llm.v1.EnrichRequest.findings:type_name -> krypton.llm.v1.FindingSummary + 1, // 2: krypton.llm.v1.EnrichResponse.enriched:type_name -> krypton.llm.v1.EnrichedFinding + 7, // 3: krypton.llm.v1.AnswerRequest.context_signals:type_name -> krypton.llm.v1.AnswerRequest.ContextSignalsEntry + 2, // 4: krypton.llm.v1.LLM.Enrich:input_type -> krypton.llm.v1.EnrichRequest + 4, // 5: krypton.llm.v1.LLM.Answer:input_type -> krypton.llm.v1.AnswerRequest + 3, // 6: krypton.llm.v1.LLM.Enrich:output_type -> krypton.llm.v1.EnrichResponse + 5, // 7: krypton.llm.v1.LLM.Answer:output_type -> krypton.llm.v1.AnswerResponse 6, // [6:8] is the sub-list for method output_type 4, // [4:6] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name diff --git a/proto/plugin/llm/v1/llm.proto b/proto/plugin/llm/v1/llm.proto index a4d28a4..d6eb963 100644 --- a/proto/plugin/llm/v1/llm.proto +++ b/proto/plugin/llm/v1/llm.proto @@ -1,8 +1,8 @@ syntax = "proto3"; -package plugin.llm.v1; +package krypton.llm.v1; -option go_package = "github.com/nnicora/krypton/proto/plugin/llm/v1;llmv1"; +option go_package = "github.com/openkcm/krypton/proto/plugin/llm/v1;llmv1"; // LLM is the plugin interface for AI language-model backends used by the // Advisor module. Only aggregate, privacy-safe statistics are ever transmitted — diff --git a/proto/plugin/llm/v1/llm_ext_plugin.pb.go b/proto/plugin/llm/v1/llm_ext_plugin.pb.go index 867144f..82c06ed 100644 --- a/proto/plugin/llm/v1/llm_ext_plugin.pb.go +++ b/proto/plugin/llm/v1/llm_ext_plugin.pb.go @@ -10,7 +10,7 @@ import ( const ( Type = "LLM" - GRPCServiceFullName = "plugin.llm.v1.LLM" + GRPCServiceFullName = "krypton.llm.v1.LLM" ) func LLMPluginServer(server LLMServer) api.PluginServer { diff --git a/proto/plugin/llm/v1/llm_grpc.pb.go b/proto/plugin/llm/v1/llm_grpc.pb.go index e10fb70..ca4467d 100644 --- a/proto/plugin/llm/v1/llm_grpc.pb.go +++ b/proto/plugin/llm/v1/llm_grpc.pb.go @@ -20,8 +20,8 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - LLM_Enrich_FullMethodName = "/plugin.llm.v1.LLM/Enrich" - LLM_Answer_FullMethodName = "/plugin.llm.v1.LLM/Answer" + LLM_Enrich_FullMethodName = "/krypton.llm.v1.LLM/Enrich" + LLM_Answer_FullMethodName = "/krypton.llm.v1.LLM/Answer" ) // LLMClient is the client API for LLM service. @@ -159,7 +159,7 @@ func _LLM_Answer_Handler(srv interface{}, ctx context.Context, dec func(interfac // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var LLM_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "plugin.llm.v1.LLM", + ServiceName: "krypton.llm.v1.LLM", HandlerType: (*LLMServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/proto/plugin/notification/v1/notification_ext_plugin.pb.go b/proto/plugin/notification/v1/notification_ext_plugin.pb.go index dd6783a..5e56ebd 100644 --- a/proto/plugin/notification/v1/notification_ext_plugin.pb.go +++ b/proto/plugin/notification/v1/notification_ext_plugin.pb.go @@ -9,7 +9,7 @@ import ( ) const ( - Type = "NotificationService" + Type = "Notification" GRPCServiceFullName = "plugin.notification.v1.NotificationService" ) diff --git a/proto/plugin/reconciler/v1/ast.pb.go b/proto/plugin/reconciler/v1/ast.pb.go new file mode 100644 index 0000000..92ade50 --- /dev/null +++ b/proto/plugin/reconciler/v1/ast.pb.go @@ -0,0 +1,2226 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc (unknown) +// source: plugin/reconciler/v1/ast.proto + +package reconcilerv1 + +import ( + reflect "reflect" + sync "sync" + unsafe "unsafe" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + structpb "google.golang.org/protobuf/types/known/structpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// ExecutionPlan is the root of the AST returned by a plugin's Reconcile call. +// It describes every operation Krypton core must execute to drive the custom +// resource to its desired state. Core is the sole executor — the plugin never +// touches keys, state, or the database directly. +type ExecutionPlan struct { + state protoimpl.MessageState `protogen:"open.v1"` + // plan_id identifies this plan for tracing. Recommended: echo the operation ID. + PlanId string `protobuf:"bytes,1,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"` + // root is the root node of the execution tree. + Root *ASTNode `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"` + // bindings are pre-declared variables available to every node in the plan. + // Use them to pass tenant_id, api_group, external IDs, or any other values + // the plugin resolved during planning and wants to thread through execution. + Bindings map[string]string `protobuf:"bytes,3,rep,name=bindings,proto3" json:"bindings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExecutionPlan) Reset() { + *x = ExecutionPlan{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExecutionPlan) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecutionPlan) ProtoMessage() {} + +func (x *ExecutionPlan) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExecutionPlan.ProtoReflect.Descriptor instead. +func (*ExecutionPlan) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{0} +} + +func (x *ExecutionPlan) GetPlanId() string { + if x != nil { + return x.PlanId + } + return "" +} + +func (x *ExecutionPlan) GetRoot() *ASTNode { + if x != nil { + return x.Root + } + return nil +} + +func (x *ExecutionPlan) GetBindings() map[string]string { + if x != nil { + return x.Bindings + } + return nil +} + +type ASTNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + // node_id is an optional stable identifier used for checkpoint persistence. + // When set, the executor stores progress so retries resume from here. + // Must be stable across retries (use a semantic name, not a random UUID). + NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` + // label is a human-readable description surfaced in logs and audit events. + Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` + // result_var, when non-empty, binds the primary string output of this node + // (typically a provisioned key ID) into the execution state so downstream + // nodes can reference it via ValueRef.var_ref. + ResultVar string `protobuf:"bytes,3,opt,name=result_var,json=resultVar,proto3" json:"result_var,omitempty"` + // Types that are valid to be assigned to Node: + // + // *ASTNode_Sequence + // *ASTNode_Parallel + // *ASTNode_Conditional + // *ASTNode_TryCatch + // *ASTNode_Checkpoint + // *ASTNode_Assert + // *ASTNode_KeySync + // *ASTNode_KeyDelete + // *ASTNode_KeyTransition + // *ASTNode_KeyRotate + // *ASTNode_KeySchedule + // *ASTNode_CredentialSync + // *ASTNode_CredentialDelete + // *ASTNode_Bind + // *ASTNode_Emit + Node isASTNode_Node `protobuf_oneof:"node"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ASTNode) Reset() { + *x = ASTNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ASTNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ASTNode) ProtoMessage() {} + +func (x *ASTNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ASTNode.ProtoReflect.Descriptor instead. +func (*ASTNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{1} +} + +func (x *ASTNode) GetNodeId() string { + if x != nil { + return x.NodeId + } + return "" +} + +func (x *ASTNode) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *ASTNode) GetResultVar() string { + if x != nil { + return x.ResultVar + } + return "" +} + +func (x *ASTNode) GetNode() isASTNode_Node { + if x != nil { + return x.Node + } + return nil +} + +func (x *ASTNode) GetSequence() *SequenceNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_Sequence); ok { + return x.Sequence + } + } + return nil +} + +func (x *ASTNode) GetParallel() *ParallelNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_Parallel); ok { + return x.Parallel + } + } + return nil +} + +func (x *ASTNode) GetConditional() *ConditionalNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_Conditional); ok { + return x.Conditional + } + } + return nil +} + +func (x *ASTNode) GetTryCatch() *TryCatchNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_TryCatch); ok { + return x.TryCatch + } + } + return nil +} + +func (x *ASTNode) GetCheckpoint() *CheckpointNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_Checkpoint); ok { + return x.Checkpoint + } + } + return nil +} + +func (x *ASTNode) GetAssert() *AssertNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_Assert); ok { + return x.Assert + } + } + return nil +} + +func (x *ASTNode) GetKeySync() *KeySyncNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_KeySync); ok { + return x.KeySync + } + } + return nil +} + +func (x *ASTNode) GetKeyDelete() *KeyDeleteNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_KeyDelete); ok { + return x.KeyDelete + } + } + return nil +} + +func (x *ASTNode) GetKeyTransition() *KeyTransitionNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_KeyTransition); ok { + return x.KeyTransition + } + } + return nil +} + +func (x *ASTNode) GetKeyRotate() *KeyRotateNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_KeyRotate); ok { + return x.KeyRotate + } + } + return nil +} + +func (x *ASTNode) GetKeySchedule() *KeyScheduleNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_KeySchedule); ok { + return x.KeySchedule + } + } + return nil +} + +func (x *ASTNode) GetCredentialSync() *CredentialSyncNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_CredentialSync); ok { + return x.CredentialSync + } + } + return nil +} + +func (x *ASTNode) GetCredentialDelete() *CredentialDeleteNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_CredentialDelete); ok { + return x.CredentialDelete + } + } + return nil +} + +func (x *ASTNode) GetBind() *BindNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_Bind); ok { + return x.Bind + } + } + return nil +} + +func (x *ASTNode) GetEmit() *EmitNode { + if x != nil { + if x, ok := x.Node.(*ASTNode_Emit); ok { + return x.Emit + } + } + return nil +} + +type isASTNode_Node interface { + isASTNode_Node() +} + +type ASTNode_Sequence struct { + // ── Control flow ────────────────────────────────────────── + Sequence *SequenceNode `protobuf:"bytes,10,opt,name=sequence,proto3,oneof"` +} + +type ASTNode_Parallel struct { + Parallel *ParallelNode `protobuf:"bytes,11,opt,name=parallel,proto3,oneof"` +} + +type ASTNode_Conditional struct { + Conditional *ConditionalNode `protobuf:"bytes,12,opt,name=conditional,proto3,oneof"` +} + +type ASTNode_TryCatch struct { + TryCatch *TryCatchNode `protobuf:"bytes,13,opt,name=try_catch,json=tryCatch,proto3,oneof"` +} + +type ASTNode_Checkpoint struct { + // ── Checkpoint ──────────────────────────────────────────── + // Persists progress at this point; uses node_id as the checkpoint name. + Checkpoint *CheckpointNode `protobuf:"bytes,14,opt,name=checkpoint,proto3,oneof"` +} + +type ASTNode_Assert struct { + // ── Assertions / pre-conditions ─────────────────────────── + // Fails the plan with error_message if the predicate is false. + Assert *AssertNode `protobuf:"bytes,20,opt,name=assert,proto3,oneof"` +} + +type ASTNode_KeySync struct { + // ── Key lifecycle ───────────────────────────────────────── + KeySync *KeySyncNode `protobuf:"bytes,30,opt,name=key_sync,json=keySync,proto3,oneof"` // create or idempotently update +} + +type ASTNode_KeyDelete struct { + KeyDelete *KeyDeleteNode `protobuf:"bytes,31,opt,name=key_delete,json=keyDelete,proto3,oneof"` // destroy key material +} + +type ASTNode_KeyTransition struct { + KeyTransition *KeyTransitionNode `protobuf:"bytes,32,opt,name=key_transition,json=keyTransition,proto3,oneof"` // explicit lifecycle state change +} + +type ASTNode_KeyRotate struct { + KeyRotate *KeyRotateNode `protobuf:"bytes,33,opt,name=key_rotate,json=keyRotate,proto3,oneof"` // generate new key material (forced rotation) +} + +type ASTNode_KeySchedule struct { + KeySchedule *KeyScheduleNode `protobuf:"bytes,34,opt,name=key_schedule,json=keySchedule,proto3,oneof"` // set expiry / scheduled transition +} + +type ASTNode_CredentialSync struct { + // ── Credential lifecycle ─────────────────────────────────── + CredentialSync *CredentialSyncNode `protobuf:"bytes,40,opt,name=credential_sync,json=credentialSync,proto3,oneof"` +} + +type ASTNode_CredentialDelete struct { + CredentialDelete *CredentialDeleteNode `protobuf:"bytes,41,opt,name=credential_delete,json=credentialDelete,proto3,oneof"` +} + +type ASTNode_Bind struct { + // ── Utility ─────────────────────────────────────────────── + Bind *BindNode `protobuf:"bytes,60,opt,name=bind,proto3,oneof"` // set a variable in execution state +} + +type ASTNode_Emit struct { + Emit *EmitNode `protobuf:"bytes,61,opt,name=emit,proto3,oneof"` // write a custom audit event +} + +func (*ASTNode_Sequence) isASTNode_Node() {} + +func (*ASTNode_Parallel) isASTNode_Node() {} + +func (*ASTNode_Conditional) isASTNode_Node() {} + +func (*ASTNode_TryCatch) isASTNode_Node() {} + +func (*ASTNode_Checkpoint) isASTNode_Node() {} + +func (*ASTNode_Assert) isASTNode_Node() {} + +func (*ASTNode_KeySync) isASTNode_Node() {} + +func (*ASTNode_KeyDelete) isASTNode_Node() {} + +func (*ASTNode_KeyTransition) isASTNode_Node() {} + +func (*ASTNode_KeyRotate) isASTNode_Node() {} + +func (*ASTNode_KeySchedule) isASTNode_Node() {} + +func (*ASTNode_CredentialSync) isASTNode_Node() {} + +func (*ASTNode_CredentialDelete) isASTNode_Node() {} + +func (*ASTNode_Bind) isASTNode_Node() {} + +func (*ASTNode_Emit) isASTNode_Node() {} + +// SequenceNode runs steps in order; the first error aborts the remainder +// and triggers rollback of already-executed steps (same as Pipeline). +type SequenceNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Steps []*ASTNode `protobuf:"bytes,1,rep,name=steps,proto3" json:"steps,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SequenceNode) Reset() { + *x = SequenceNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SequenceNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SequenceNode) ProtoMessage() {} + +func (x *SequenceNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SequenceNode.ProtoReflect.Descriptor instead. +func (*SequenceNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{2} +} + +func (x *SequenceNode) GetSteps() []*ASTNode { + if x != nil { + return x.Steps + } + return nil +} + +// ParallelNode fans steps out concurrently. +// When fail_fast = true a single error cancels the remaining goroutines. +type ParallelNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Steps []*ASTNode `protobuf:"bytes,1,rep,name=steps,proto3" json:"steps,omitempty"` + FailFast bool `protobuf:"varint,2,opt,name=fail_fast,json=failFast,proto3" json:"fail_fast,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ParallelNode) Reset() { + *x = ParallelNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ParallelNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParallelNode) ProtoMessage() {} + +func (x *ParallelNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ParallelNode.ProtoReflect.Descriptor instead. +func (*ParallelNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{3} +} + +func (x *ParallelNode) GetSteps() []*ASTNode { + if x != nil { + return x.Steps + } + return nil +} + +func (x *ParallelNode) GetFailFast() bool { + if x != nil { + return x.FailFast + } + return false +} + +// ConditionalNode evaluates a runtime predicate and executes exactly one branch. +type ConditionalNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Condition *Predicate `protobuf:"bytes,1,opt,name=condition,proto3" json:"condition,omitempty"` + ThenNode *ASTNode `protobuf:"bytes,2,opt,name=then_node,json=thenNode,proto3" json:"then_node,omitempty"` + ElseNode *ASTNode `protobuf:"bytes,3,opt,name=else_node,json=elseNode,proto3" json:"else_node,omitempty"` // optional — omit for pure guard + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ConditionalNode) Reset() { + *x = ConditionalNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ConditionalNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ConditionalNode) ProtoMessage() {} + +func (x *ConditionalNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ConditionalNode.ProtoReflect.Descriptor instead. +func (*ConditionalNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{4} +} + +func (x *ConditionalNode) GetCondition() *Predicate { + if x != nil { + return x.Condition + } + return nil +} + +func (x *ConditionalNode) GetThenNode() *ASTNode { + if x != nil { + return x.ThenNode + } + return nil +} + +func (x *ConditionalNode) GetElseNode() *ASTNode { + if x != nil { + return x.ElseNode + } + return nil +} + +// TryCatchNode executes try_node; on any error executes catch_node instead. +// Useful for compensating transactions and optional / best-effort steps. +type TryCatchNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + TryNode *ASTNode `protobuf:"bytes,1,opt,name=try_node,json=tryNode,proto3" json:"try_node,omitempty"` + CatchNode *ASTNode `protobuf:"bytes,2,opt,name=catch_node,json=catchNode,proto3" json:"catch_node,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TryCatchNode) Reset() { + *x = TryCatchNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TryCatchNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TryCatchNode) ProtoMessage() {} + +func (x *TryCatchNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TryCatchNode.ProtoReflect.Descriptor instead. +func (*TryCatchNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{5} +} + +func (x *TryCatchNode) GetTryNode() *ASTNode { + if x != nil { + return x.TryNode + } + return nil +} + +func (x *TryCatchNode) GetCatchNode() *ASTNode { + if x != nil { + return x.CatchNode + } + return nil +} + +// CheckpointNode persists the current execution position so retries skip +// completed steps. Uses the parent ASTNode.node_id as the checkpoint name. +type CheckpointNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CheckpointNode) Reset() { + *x = CheckpointNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CheckpointNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckpointNode) ProtoMessage() {} + +func (x *CheckpointNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CheckpointNode.ProtoReflect.Descriptor instead. +func (*CheckpointNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{6} +} + +type AssertNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Condition *Predicate `protobuf:"bytes,1,opt,name=condition,proto3" json:"condition,omitempty"` + ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AssertNode) Reset() { + *x = AssertNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AssertNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssertNode) ProtoMessage() {} + +func (x *AssertNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AssertNode.ProtoReflect.Descriptor instead. +func (*AssertNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{7} +} + +func (x *AssertNode) GetCondition() *Predicate { + if x != nil { + return x.Condition + } + return nil +} + +func (x *AssertNode) GetErrorMessage() string { + if x != nil { + return x.ErrorMessage + } + return "" +} + +// Predicate is a composable boolean expression resolved against live Krypton +// state at execution time. Core owns all state reads; the plugin only declares +// what must be true. +type Predicate struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Expr: + // + // *Predicate_KeyExists + // *Predicate_KeyState + // *Predicate_TenantActive + // *Predicate_CredentialExists + // *Predicate_And + // *Predicate_Or + // *Predicate_Not + Expr isPredicate_Expr `protobuf_oneof:"expr"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Predicate) Reset() { + *x = Predicate{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Predicate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Predicate) ProtoMessage() {} + +func (x *Predicate) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Predicate.ProtoReflect.Descriptor instead. +func (*Predicate) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{8} +} + +func (x *Predicate) GetExpr() isPredicate_Expr { + if x != nil { + return x.Expr + } + return nil +} + +func (x *Predicate) GetKeyExists() *KeyExistsPredicate { + if x != nil { + if x, ok := x.Expr.(*Predicate_KeyExists); ok { + return x.KeyExists + } + } + return nil +} + +func (x *Predicate) GetKeyState() *KeyStatePredicate { + if x != nil { + if x, ok := x.Expr.(*Predicate_KeyState); ok { + return x.KeyState + } + } + return nil +} + +func (x *Predicate) GetTenantActive() *TenantActivePredicate { + if x != nil { + if x, ok := x.Expr.(*Predicate_TenantActive); ok { + return x.TenantActive + } + } + return nil +} + +func (x *Predicate) GetCredentialExists() *CredentialExistsPredicate { + if x != nil { + if x, ok := x.Expr.(*Predicate_CredentialExists); ok { + return x.CredentialExists + } + } + return nil +} + +func (x *Predicate) GetAnd() *AndPredicate { + if x != nil { + if x, ok := x.Expr.(*Predicate_And); ok { + return x.And + } + } + return nil +} + +func (x *Predicate) GetOr() *OrPredicate { + if x != nil { + if x, ok := x.Expr.(*Predicate_Or); ok { + return x.Or + } + } + return nil +} + +func (x *Predicate) GetNot() *NotPredicate { + if x != nil { + if x, ok := x.Expr.(*Predicate_Not); ok { + return x.Not + } + } + return nil +} + +type isPredicate_Expr interface { + isPredicate_Expr() +} + +type Predicate_KeyExists struct { + KeyExists *KeyExistsPredicate `protobuf:"bytes,1,opt,name=key_exists,json=keyExists,proto3,oneof"` +} + +type Predicate_KeyState struct { + KeyState *KeyStatePredicate `protobuf:"bytes,2,opt,name=key_state,json=keyState,proto3,oneof"` +} + +type Predicate_TenantActive struct { + TenantActive *TenantActivePredicate `protobuf:"bytes,3,opt,name=tenant_active,json=tenantActive,proto3,oneof"` +} + +type Predicate_CredentialExists struct { + CredentialExists *CredentialExistsPredicate `protobuf:"bytes,4,opt,name=credential_exists,json=credentialExists,proto3,oneof"` +} + +type Predicate_And struct { + // Logical combinators + And *AndPredicate `protobuf:"bytes,10,opt,name=and,proto3,oneof"` +} + +type Predicate_Or struct { + Or *OrPredicate `protobuf:"bytes,11,opt,name=or,proto3,oneof"` +} + +type Predicate_Not struct { + Not *NotPredicate `protobuf:"bytes,12,opt,name=not,proto3,oneof"` +} + +func (*Predicate_KeyExists) isPredicate_Expr() {} + +func (*Predicate_KeyState) isPredicate_Expr() {} + +func (*Predicate_TenantActive) isPredicate_Expr() {} + +func (*Predicate_CredentialExists) isPredicate_Expr() {} + +func (*Predicate_And) isPredicate_Expr() {} + +func (*Predicate_Or) isPredicate_Expr() {} + +func (*Predicate_Not) isPredicate_Expr() {} + +type KeyExistsPredicate struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` + KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyExistsPredicate) Reset() { + *x = KeyExistsPredicate{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyExistsPredicate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyExistsPredicate) ProtoMessage() {} + +func (x *KeyExistsPredicate) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyExistsPredicate.ProtoReflect.Descriptor instead. +func (*KeyExistsPredicate) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{9} +} + +func (x *KeyExistsPredicate) GetTier() *ValueRef { + if x != nil { + return x.Tier + } + return nil +} + +func (x *KeyExistsPredicate) GetKeyName() *ValueRef { + if x != nil { + return x.KeyName + } + return nil +} + +type KeyStatePredicate struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` + KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` + // allowed_states is an OR list — matches if the key is in ANY of these states. + // Valid values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, COMPROMISED, + // + // PENDING_DESTROYING, DESTROYED. + AllowedStates []string `protobuf:"bytes,3,rep,name=allowed_states,json=allowedStates,proto3" json:"allowed_states,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyStatePredicate) Reset() { + *x = KeyStatePredicate{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyStatePredicate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyStatePredicate) ProtoMessage() {} + +func (x *KeyStatePredicate) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyStatePredicate.ProtoReflect.Descriptor instead. +func (*KeyStatePredicate) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{10} +} + +func (x *KeyStatePredicate) GetTier() *ValueRef { + if x != nil { + return x.Tier + } + return nil +} + +func (x *KeyStatePredicate) GetKeyName() *ValueRef { + if x != nil { + return x.KeyName + } + return nil +} + +func (x *KeyStatePredicate) GetAllowedStates() []string { + if x != nil { + return x.AllowedStates + } + return nil +} + +type TenantActivePredicate struct { + state protoimpl.MessageState `protogen:"open.v1"` + TenantId *ValueRef `protobuf:"bytes,1,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TenantActivePredicate) Reset() { + *x = TenantActivePredicate{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TenantActivePredicate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TenantActivePredicate) ProtoMessage() {} + +func (x *TenantActivePredicate) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TenantActivePredicate.ProtoReflect.Descriptor instead. +func (*TenantActivePredicate) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{11} +} + +func (x *TenantActivePredicate) GetTenantId() *ValueRef { + if x != nil { + return x.TenantId + } + return nil +} + +type CredentialExistsPredicate struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name *ValueRef `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CredentialExistsPredicate) Reset() { + *x = CredentialExistsPredicate{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CredentialExistsPredicate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CredentialExistsPredicate) ProtoMessage() {} + +func (x *CredentialExistsPredicate) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CredentialExistsPredicate.ProtoReflect.Descriptor instead. +func (*CredentialExistsPredicate) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{12} +} + +func (x *CredentialExistsPredicate) GetName() *ValueRef { + if x != nil { + return x.Name + } + return nil +} + +type AndPredicate struct { + state protoimpl.MessageState `protogen:"open.v1"` + Terms []*Predicate `protobuf:"bytes,1,rep,name=terms,proto3" json:"terms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AndPredicate) Reset() { + *x = AndPredicate{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AndPredicate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AndPredicate) ProtoMessage() {} + +func (x *AndPredicate) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AndPredicate.ProtoReflect.Descriptor instead. +func (*AndPredicate) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{13} +} + +func (x *AndPredicate) GetTerms() []*Predicate { + if x != nil { + return x.Terms + } + return nil +} + +type OrPredicate struct { + state protoimpl.MessageState `protogen:"open.v1"` + Terms []*Predicate `protobuf:"bytes,1,rep,name=terms,proto3" json:"terms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OrPredicate) Reset() { + *x = OrPredicate{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OrPredicate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OrPredicate) ProtoMessage() {} + +func (x *OrPredicate) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OrPredicate.ProtoReflect.Descriptor instead. +func (*OrPredicate) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{14} +} + +func (x *OrPredicate) GetTerms() []*Predicate { + if x != nil { + return x.Terms + } + return nil +} + +type NotPredicate struct { + state protoimpl.MessageState `protogen:"open.v1"` + Term *Predicate `protobuf:"bytes,1,opt,name=term,proto3" json:"term,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *NotPredicate) Reset() { + *x = NotPredicate{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *NotPredicate) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NotPredicate) ProtoMessage() {} + +func (x *NotPredicate) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NotPredicate.ProtoReflect.Descriptor instead. +func (*NotPredicate) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{15} +} + +func (x *NotPredicate) GetTerm() *Predicate { + if x != nil { + return x.Term + } + return nil +} + +// ValueRef resolves to a string at runtime. +// Use literal for constants known at plan time. +// Use var_ref to read a value set by a previous node's result_var or by +// ExecutionPlan.bindings. +type ValueRef struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Kind: + // + // *ValueRef_Literal + // *ValueRef_VarRef + Kind isValueRef_Kind `protobuf_oneof:"kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ValueRef) Reset() { + *x = ValueRef{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ValueRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ValueRef) ProtoMessage() {} + +func (x *ValueRef) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ValueRef.ProtoReflect.Descriptor instead. +func (*ValueRef) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{16} +} + +func (x *ValueRef) GetKind() isValueRef_Kind { + if x != nil { + return x.Kind + } + return nil +} + +func (x *ValueRef) GetLiteral() string { + if x != nil { + if x, ok := x.Kind.(*ValueRef_Literal); ok { + return x.Literal + } + } + return "" +} + +func (x *ValueRef) GetVarRef() string { + if x != nil { + if x, ok := x.Kind.(*ValueRef_VarRef); ok { + return x.VarRef + } + } + return "" +} + +type isValueRef_Kind interface { + isValueRef_Kind() +} + +type ValueRef_Literal struct { + Literal string `protobuf:"bytes,1,opt,name=literal,proto3,oneof"` +} + +type ValueRef_VarRef struct { + VarRef string `protobuf:"bytes,2,opt,name=var_ref,json=varRef,proto3,oneof"` +} + +func (*ValueRef_Literal) isValueRef_Kind() {} + +func (*ValueRef_VarRef) isValueRef_Kind() {} + +// KeySyncNode provisions a key at the given tier, or is a no-op if the key +// already exists (idempotent). Core wraps the key under parent_key using the +// configured tier hierarchy. On success, result_var receives the key ULID. +type KeySyncNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + // tier is the Krypton tier name as declared in key-hierarchy config, + // e.g. "l2-domain", "l3-service", "l4-data". + Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` + // key_name is the logical name scoped to the tenant. + KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` + // parent_key is the name of the wrapping key one tier above. + // Required for all tiers except L1 root keys. + ParentKey *ValueRef `protobuf:"bytes,3,opt,name=parent_key,json=parentKey,proto3" json:"parent_key,omitempty"` + // schedule, when set, is applied immediately after provisioning. + Schedule *KeyScheduleSpec `protobuf:"bytes,4,opt,name=schedule,proto3" json:"schedule,omitempty"` + // metadata is attached to the key record after successful provisioning. + Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeySyncNode) Reset() { + *x = KeySyncNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeySyncNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeySyncNode) ProtoMessage() {} + +func (x *KeySyncNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeySyncNode.ProtoReflect.Descriptor instead. +func (*KeySyncNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{17} +} + +func (x *KeySyncNode) GetTier() *ValueRef { + if x != nil { + return x.Tier + } + return nil +} + +func (x *KeySyncNode) GetKeyName() *ValueRef { + if x != nil { + return x.KeyName + } + return nil +} + +func (x *KeySyncNode) GetParentKey() *ValueRef { + if x != nil { + return x.ParentKey + } + return nil +} + +func (x *KeySyncNode) GetSchedule() *KeyScheduleSpec { + if x != nil { + return x.Schedule + } + return nil +} + +func (x *KeySyncNode) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +// KeyDeleteNode destroys key material and all version lineages. +// Core enforces that no child keys exist before allowing deletion. +type KeyDeleteNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` + KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyDeleteNode) Reset() { + *x = KeyDeleteNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyDeleteNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyDeleteNode) ProtoMessage() {} + +func (x *KeyDeleteNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyDeleteNode.ProtoReflect.Descriptor instead. +func (*KeyDeleteNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{18} +} + +func (x *KeyDeleteNode) GetTier() *ValueRef { + if x != nil { + return x.Tier + } + return nil +} + +func (x *KeyDeleteNode) GetKeyName() *ValueRef { + if x != nil { + return x.KeyName + } + return nil +} + +// KeyTransitionNode explicitly moves a key to a target lifecycle state. +// Valid target_state values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, +// +// COMPROMISED, PENDING_DESTROYING, DESTROYED. +type KeyTransitionNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` + KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` + TargetState string `protobuf:"bytes,3,opt,name=target_state,json=targetState,proto3" json:"target_state,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyTransitionNode) Reset() { + *x = KeyTransitionNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyTransitionNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyTransitionNode) ProtoMessage() {} + +func (x *KeyTransitionNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyTransitionNode.ProtoReflect.Descriptor instead. +func (*KeyTransitionNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{19} +} + +func (x *KeyTransitionNode) GetTier() *ValueRef { + if x != nil { + return x.Tier + } + return nil +} + +func (x *KeyTransitionNode) GetKeyName() *ValueRef { + if x != nil { + return x.KeyName + } + return nil +} + +func (x *KeyTransitionNode) GetTargetState() string { + if x != nil { + return x.TargetState + } + return "" +} + +// KeyRotateNode generates new key material under the same logical key name +// (forced rotation — bypasses the idempotency guard in ProvisionKey). +// On success, result_var receives the new key ULID. +type KeyRotateNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` + KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyRotateNode) Reset() { + *x = KeyRotateNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyRotateNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyRotateNode) ProtoMessage() {} + +func (x *KeyRotateNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyRotateNode.ProtoReflect.Descriptor instead. +func (*KeyRotateNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{20} +} + +func (x *KeyRotateNode) GetTier() *ValueRef { + if x != nil { + return x.Tier + } + return nil +} + +func (x *KeyRotateNode) GetKeyName() *ValueRef { + if x != nil { + return x.KeyName + } + return nil +} + +// KeyScheduleNode updates the scheduled lifecycle transition for an existing key. +type KeyScheduleNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` + KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` + Schedule *KeyScheduleSpec `protobuf:"bytes,3,opt,name=schedule,proto3" json:"schedule,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyScheduleNode) Reset() { + *x = KeyScheduleNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyScheduleNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyScheduleNode) ProtoMessage() {} + +func (x *KeyScheduleNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyScheduleNode.ProtoReflect.Descriptor instead. +func (*KeyScheduleNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{21} +} + +func (x *KeyScheduleNode) GetTier() *ValueRef { + if x != nil { + return x.Tier + } + return nil +} + +func (x *KeyScheduleNode) GetKeyName() *ValueRef { + if x != nil { + return x.KeyName + } + return nil +} + +func (x *KeyScheduleNode) GetSchedule() *KeyScheduleSpec { + if x != nil { + return x.Schedule + } + return nil +} + +// KeyScheduleSpec carries timing parameters for a scheduled state transition. +// All fields are optional — set only the ones you need. +type KeyScheduleSpec struct { + state protoimpl.MessageState `protogen:"open.v1"` + ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=expires_at,json=expiresAt,proto3,oneof" json:"expires_at,omitempty"` + ScheduledTransitionAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=scheduled_transition_at,json=scheduledTransitionAt,proto3,oneof" json:"scheduled_transition_at,omitempty"` + // transition_to is the target KeyState when scheduled_transition_at fires. + TransitionTo *string `protobuf:"bytes,3,opt,name=transition_to,json=transitionTo,proto3,oneof" json:"transition_to,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *KeyScheduleSpec) Reset() { + *x = KeyScheduleSpec{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *KeyScheduleSpec) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KeyScheduleSpec) ProtoMessage() {} + +func (x *KeyScheduleSpec) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use KeyScheduleSpec.ProtoReflect.Descriptor instead. +func (*KeyScheduleSpec) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{22} +} + +func (x *KeyScheduleSpec) GetExpiresAt() *timestamppb.Timestamp { + if x != nil { + return x.ExpiresAt + } + return nil +} + +func (x *KeyScheduleSpec) GetScheduledTransitionAt() *timestamppb.Timestamp { + if x != nil { + return x.ScheduledTransitionAt + } + return nil +} + +func (x *KeyScheduleSpec) GetTransitionTo() string { + if x != nil && x.TransitionTo != nil { + return *x.TransitionTo + } + return "" +} + +// CredentialSyncNode creates or updates a credential. +// spec is the full credential payload; core encrypts it using the tenant keyring. +type CredentialSyncNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name *ValueRef `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Type *ValueRef `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + Spec *structpb.Struct `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CredentialSyncNode) Reset() { + *x = CredentialSyncNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CredentialSyncNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CredentialSyncNode) ProtoMessage() {} + +func (x *CredentialSyncNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CredentialSyncNode.ProtoReflect.Descriptor instead. +func (*CredentialSyncNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{23} +} + +func (x *CredentialSyncNode) GetName() *ValueRef { + if x != nil { + return x.Name + } + return nil +} + +func (x *CredentialSyncNode) GetType() *ValueRef { + if x != nil { + return x.Type + } + return nil +} + +func (x *CredentialSyncNode) GetSpec() *structpb.Struct { + if x != nil { + return x.Spec + } + return nil +} + +// CredentialDeleteNode removes a credential record. +type CredentialDeleteNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name *ValueRef `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CredentialDeleteNode) Reset() { + *x = CredentialDeleteNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CredentialDeleteNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CredentialDeleteNode) ProtoMessage() {} + +func (x *CredentialDeleteNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CredentialDeleteNode.ProtoReflect.Descriptor instead. +func (*CredentialDeleteNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{24} +} + +func (x *CredentialDeleteNode) GetName() *ValueRef { + if x != nil { + return x.Name + } + return nil +} + +// BindNode sets a named variable in the execution state. +// Useful for deriving values from existing bindings before referencing them. +type BindNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + VarName string `protobuf:"bytes,1,opt,name=var_name,json=varName,proto3" json:"var_name,omitempty"` + Value *ValueRef `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BindNode) Reset() { + *x = BindNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BindNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BindNode) ProtoMessage() {} + +func (x *BindNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BindNode.ProtoReflect.Descriptor instead. +func (*BindNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{25} +} + +func (x *BindNode) GetVarName() string { + if x != nil { + return x.VarName + } + return "" +} + +func (x *BindNode) GetValue() *ValueRef { + if x != nil { + return x.Value + } + return nil +} + +// EmitNode writes a structured event to Krypton's audit trail. +type EmitNode struct { + state protoimpl.MessageState `protogen:"open.v1"` + EventType string `protobuf:"bytes,1,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` + Attributes map[string]string `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EmitNode) Reset() { + *x = EmitNode{} + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EmitNode) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EmitNode) ProtoMessage() {} + +func (x *EmitNode) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EmitNode.ProtoReflect.Descriptor instead. +func (*EmitNode) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{26} +} + +func (x *EmitNode) GetEventType() string { + if x != nil { + return x.EventType + } + return "" +} + +func (x *EmitNode) GetAttributes() map[string]string { + if x != nil { + return x.Attributes + } + return nil +} + +var File_plugin_reconciler_v1_ast_proto protoreflect.FileDescriptor + +const file_plugin_reconciler_v1_ast_proto_rawDesc = "" + + "\n" + + "\x1eplugin/reconciler/v1/ast.proto\x12\x15krypton.reconciler.v1\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xe9\x01\n" + + "\rExecutionPlan\x12\x17\n" + + "\aplan_id\x18\x01 \x01(\tR\x06planId\x122\n" + + "\x04root\x18\x02 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\x04root\x12N\n" + + "\bbindings\x18\x03 \x03(\v22.krypton.reconciler.v1.ExecutionPlan.BindingsEntryR\bbindings\x1a;\n" + + "\rBindingsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x8a\t\n" + + "\aASTNode\x12\x17\n" + + "\anode_id\x18\x01 \x01(\tR\x06nodeId\x12\x14\n" + + "\x05label\x18\x02 \x01(\tR\x05label\x12\x1d\n" + + "\n" + + "result_var\x18\x03 \x01(\tR\tresultVar\x12A\n" + + "\bsequence\x18\n" + + " \x01(\v2#.krypton.reconciler.v1.SequenceNodeH\x00R\bsequence\x12A\n" + + "\bparallel\x18\v \x01(\v2#.krypton.reconciler.v1.ParallelNodeH\x00R\bparallel\x12J\n" + + "\vconditional\x18\f \x01(\v2&.krypton.reconciler.v1.ConditionalNodeH\x00R\vconditional\x12B\n" + + "\ttry_catch\x18\r \x01(\v2#.krypton.reconciler.v1.TryCatchNodeH\x00R\btryCatch\x12G\n" + + "\n" + + "checkpoint\x18\x0e \x01(\v2%.krypton.reconciler.v1.CheckpointNodeH\x00R\n" + + "checkpoint\x12;\n" + + "\x06assert\x18\x14 \x01(\v2!.krypton.reconciler.v1.AssertNodeH\x00R\x06assert\x12?\n" + + "\bkey_sync\x18\x1e \x01(\v2\".krypton.reconciler.v1.KeySyncNodeH\x00R\akeySync\x12E\n" + + "\n" + + "key_delete\x18\x1f \x01(\v2$.krypton.reconciler.v1.KeyDeleteNodeH\x00R\tkeyDelete\x12Q\n" + + "\x0ekey_transition\x18 \x01(\v2(.krypton.reconciler.v1.KeyTransitionNodeH\x00R\rkeyTransition\x12E\n" + + "\n" + + "key_rotate\x18! \x01(\v2$.krypton.reconciler.v1.KeyRotateNodeH\x00R\tkeyRotate\x12K\n" + + "\fkey_schedule\x18\" \x01(\v2&.krypton.reconciler.v1.KeyScheduleNodeH\x00R\vkeySchedule\x12T\n" + + "\x0fcredential_sync\x18( \x01(\v2).krypton.reconciler.v1.CredentialSyncNodeH\x00R\x0ecredentialSync\x12Z\n" + + "\x11credential_delete\x18) \x01(\v2+.krypton.reconciler.v1.CredentialDeleteNodeH\x00R\x10credentialDelete\x125\n" + + "\x04bind\x18< \x01(\v2\x1f.krypton.reconciler.v1.BindNodeH\x00R\x04bind\x125\n" + + "\x04emit\x18= \x01(\v2\x1f.krypton.reconciler.v1.EmitNodeH\x00R\x04emitB\x06\n" + + "\x04node\"D\n" + + "\fSequenceNode\x124\n" + + "\x05steps\x18\x01 \x03(\v2\x1e.krypton.reconciler.v1.ASTNodeR\x05steps\"a\n" + + "\fParallelNode\x124\n" + + "\x05steps\x18\x01 \x03(\v2\x1e.krypton.reconciler.v1.ASTNodeR\x05steps\x12\x1b\n" + + "\tfail_fast\x18\x02 \x01(\bR\bfailFast\"\xcb\x01\n" + + "\x0fConditionalNode\x12>\n" + + "\tcondition\x18\x01 \x01(\v2 .krypton.reconciler.v1.PredicateR\tcondition\x12;\n" + + "\tthen_node\x18\x02 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\bthenNode\x12;\n" + + "\telse_node\x18\x03 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\belseNode\"\x88\x01\n" + + "\fTryCatchNode\x129\n" + + "\btry_node\x18\x01 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\atryNode\x12=\n" + + "\n" + + "catch_node\x18\x02 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\tcatchNode\"\x10\n" + + "\x0eCheckpointNode\"q\n" + + "\n" + + "AssertNode\x12>\n" + + "\tcondition\x18\x01 \x01(\v2 .krypton.reconciler.v1.PredicateR\tcondition\x12#\n" + + "\rerror_message\x18\x02 \x01(\tR\ferrorMessage\"\x86\x04\n" + + "\tPredicate\x12J\n" + + "\n" + + "key_exists\x18\x01 \x01(\v2).krypton.reconciler.v1.KeyExistsPredicateH\x00R\tkeyExists\x12G\n" + + "\tkey_state\x18\x02 \x01(\v2(.krypton.reconciler.v1.KeyStatePredicateH\x00R\bkeyState\x12S\n" + + "\rtenant_active\x18\x03 \x01(\v2,.krypton.reconciler.v1.TenantActivePredicateH\x00R\ftenantActive\x12_\n" + + "\x11credential_exists\x18\x04 \x01(\v20.krypton.reconciler.v1.CredentialExistsPredicateH\x00R\x10credentialExists\x127\n" + + "\x03and\x18\n" + + " \x01(\v2#.krypton.reconciler.v1.AndPredicateH\x00R\x03and\x124\n" + + "\x02or\x18\v \x01(\v2\".krypton.reconciler.v1.OrPredicateH\x00R\x02or\x127\n" + + "\x03not\x18\f \x01(\v2#.krypton.reconciler.v1.NotPredicateH\x00R\x03notB\x06\n" + + "\x04expr\"\x85\x01\n" + + "\x12KeyExistsPredicate\x123\n" + + "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + + "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\"\xab\x01\n" + + "\x11KeyStatePredicate\x123\n" + + "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + + "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\x12%\n" + + "\x0eallowed_states\x18\x03 \x03(\tR\rallowedStates\"U\n" + + "\x15TenantActivePredicate\x12<\n" + + "\ttenant_id\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\btenantId\"P\n" + + "\x19CredentialExistsPredicate\x123\n" + + "\x04name\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04name\"F\n" + + "\fAndPredicate\x126\n" + + "\x05terms\x18\x01 \x03(\v2 .krypton.reconciler.v1.PredicateR\x05terms\"E\n" + + "\vOrPredicate\x126\n" + + "\x05terms\x18\x01 \x03(\v2 .krypton.reconciler.v1.PredicateR\x05terms\"D\n" + + "\fNotPredicate\x124\n" + + "\x04term\x18\x01 \x01(\v2 .krypton.reconciler.v1.PredicateR\x04term\"I\n" + + "\bValueRef\x12\x1a\n" + + "\aliteral\x18\x01 \x01(\tH\x00R\aliteral\x12\x19\n" + + "\avar_ref\x18\x02 \x01(\tH\x00R\x06varRefB\x06\n" + + "\x04kind\"\x8d\x03\n" + + "\vKeySyncNode\x123\n" + + "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + + "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\x12>\n" + + "\n" + + "parent_key\x18\x03 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\tparentKey\x12B\n" + + "\bschedule\x18\x04 \x01(\v2&.krypton.reconciler.v1.KeyScheduleSpecR\bschedule\x12L\n" + + "\bmetadata\x18\x05 \x03(\v20.krypton.reconciler.v1.KeySyncNode.MetadataEntryR\bmetadata\x1a;\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x80\x01\n" + + "\rKeyDeleteNode\x123\n" + + "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + + "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\"\xa7\x01\n" + + "\x11KeyTransitionNode\x123\n" + + "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + + "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\x12!\n" + + "\ftarget_state\x18\x03 \x01(\tR\vtargetState\"\x80\x01\n" + + "\rKeyRotateNode\x123\n" + + "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + + "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\"\xc6\x01\n" + + "\x0fKeyScheduleNode\x123\n" + + "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + + "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\x12B\n" + + "\bschedule\x18\x03 \x01(\v2&.krypton.reconciler.v1.KeyScheduleSpecR\bschedule\"\x91\x02\n" + + "\x0fKeyScheduleSpec\x12>\n" + + "\n" + + "expires_at\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampH\x00R\texpiresAt\x88\x01\x01\x12W\n" + + "\x17scheduled_transition_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampH\x01R\x15scheduledTransitionAt\x88\x01\x01\x12(\n" + + "\rtransition_to\x18\x03 \x01(\tH\x02R\ftransitionTo\x88\x01\x01B\r\n" + + "\v_expires_atB\x1a\n" + + "\x18_scheduled_transition_atB\x10\n" + + "\x0e_transition_to\"\xab\x01\n" + + "\x12CredentialSyncNode\x123\n" + + "\x04name\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04name\x123\n" + + "\x04type\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04type\x12+\n" + + "\x04spec\x18\x03 \x01(\v2\x17.google.protobuf.StructR\x04spec\"K\n" + + "\x14CredentialDeleteNode\x123\n" + + "\x04name\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04name\"\\\n" + + "\bBindNode\x12\x19\n" + + "\bvar_name\x18\x01 \x01(\tR\avarName\x125\n" + + "\x05value\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x05value\"\xb9\x01\n" + + "\bEmitNode\x12\x1d\n" + + "\n" + + "event_type\x18\x01 \x01(\tR\teventType\x12O\n" + + "\n" + + "attributes\x18\x02 \x03(\v2/.krypton.reconciler.v1.EmitNode.AttributesEntryR\n" + + "attributes\x1a=\n" + + "\x0fAttributesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\xe2\x01\n" + + "\x19com.krypton.reconciler.v1B\bAstProtoP\x01ZEgithub.com/openkcm/plugin-sdk/proto/plugin/reconciler/v1;reconcilerv1\xa2\x02\x03KRX\xaa\x02\x15Krypton.Reconciler.V1\xca\x02\x15Krypton\\Reconciler\\V1\xe2\x02!Krypton\\Reconciler\\V1\\GPBMetadata\xea\x02\x17Krypton::Reconciler::V1b\x06proto3" + +var ( + file_plugin_reconciler_v1_ast_proto_rawDescOnce sync.Once + file_plugin_reconciler_v1_ast_proto_rawDescData []byte +) + +func file_plugin_reconciler_v1_ast_proto_rawDescGZIP() []byte { + file_plugin_reconciler_v1_ast_proto_rawDescOnce.Do(func() { + file_plugin_reconciler_v1_ast_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_reconciler_v1_ast_proto_rawDesc), len(file_plugin_reconciler_v1_ast_proto_rawDesc))) + }) + return file_plugin_reconciler_v1_ast_proto_rawDescData +} + +var file_plugin_reconciler_v1_ast_proto_msgTypes = make([]protoimpl.MessageInfo, 30) +var file_plugin_reconciler_v1_ast_proto_goTypes = []any{ + (*ExecutionPlan)(nil), // 0: krypton.reconciler.v1.ExecutionPlan + (*ASTNode)(nil), // 1: krypton.reconciler.v1.ASTNode + (*SequenceNode)(nil), // 2: krypton.reconciler.v1.SequenceNode + (*ParallelNode)(nil), // 3: krypton.reconciler.v1.ParallelNode + (*ConditionalNode)(nil), // 4: krypton.reconciler.v1.ConditionalNode + (*TryCatchNode)(nil), // 5: krypton.reconciler.v1.TryCatchNode + (*CheckpointNode)(nil), // 6: krypton.reconciler.v1.CheckpointNode + (*AssertNode)(nil), // 7: krypton.reconciler.v1.AssertNode + (*Predicate)(nil), // 8: krypton.reconciler.v1.Predicate + (*KeyExistsPredicate)(nil), // 9: krypton.reconciler.v1.KeyExistsPredicate + (*KeyStatePredicate)(nil), // 10: krypton.reconciler.v1.KeyStatePredicate + (*TenantActivePredicate)(nil), // 11: krypton.reconciler.v1.TenantActivePredicate + (*CredentialExistsPredicate)(nil), // 12: krypton.reconciler.v1.CredentialExistsPredicate + (*AndPredicate)(nil), // 13: krypton.reconciler.v1.AndPredicate + (*OrPredicate)(nil), // 14: krypton.reconciler.v1.OrPredicate + (*NotPredicate)(nil), // 15: krypton.reconciler.v1.NotPredicate + (*ValueRef)(nil), // 16: krypton.reconciler.v1.ValueRef + (*KeySyncNode)(nil), // 17: krypton.reconciler.v1.KeySyncNode + (*KeyDeleteNode)(nil), // 18: krypton.reconciler.v1.KeyDeleteNode + (*KeyTransitionNode)(nil), // 19: krypton.reconciler.v1.KeyTransitionNode + (*KeyRotateNode)(nil), // 20: krypton.reconciler.v1.KeyRotateNode + (*KeyScheduleNode)(nil), // 21: krypton.reconciler.v1.KeyScheduleNode + (*KeyScheduleSpec)(nil), // 22: krypton.reconciler.v1.KeyScheduleSpec + (*CredentialSyncNode)(nil), // 23: krypton.reconciler.v1.CredentialSyncNode + (*CredentialDeleteNode)(nil), // 24: krypton.reconciler.v1.CredentialDeleteNode + (*BindNode)(nil), // 25: krypton.reconciler.v1.BindNode + (*EmitNode)(nil), // 26: krypton.reconciler.v1.EmitNode + nil, // 27: krypton.reconciler.v1.ExecutionPlan.BindingsEntry + nil, // 28: krypton.reconciler.v1.KeySyncNode.MetadataEntry + nil, // 29: krypton.reconciler.v1.EmitNode.AttributesEntry + (*timestamppb.Timestamp)(nil), // 30: google.protobuf.Timestamp + (*structpb.Struct)(nil), // 31: google.protobuf.Struct +} +var file_plugin_reconciler_v1_ast_proto_depIdxs = []int32{ + 1, // 0: krypton.reconciler.v1.ExecutionPlan.root:type_name -> krypton.reconciler.v1.ASTNode + 27, // 1: krypton.reconciler.v1.ExecutionPlan.bindings:type_name -> krypton.reconciler.v1.ExecutionPlan.BindingsEntry + 2, // 2: krypton.reconciler.v1.ASTNode.sequence:type_name -> krypton.reconciler.v1.SequenceNode + 3, // 3: krypton.reconciler.v1.ASTNode.parallel:type_name -> krypton.reconciler.v1.ParallelNode + 4, // 4: krypton.reconciler.v1.ASTNode.conditional:type_name -> krypton.reconciler.v1.ConditionalNode + 5, // 5: krypton.reconciler.v1.ASTNode.try_catch:type_name -> krypton.reconciler.v1.TryCatchNode + 6, // 6: krypton.reconciler.v1.ASTNode.checkpoint:type_name -> krypton.reconciler.v1.CheckpointNode + 7, // 7: krypton.reconciler.v1.ASTNode.assert:type_name -> krypton.reconciler.v1.AssertNode + 17, // 8: krypton.reconciler.v1.ASTNode.key_sync:type_name -> krypton.reconciler.v1.KeySyncNode + 18, // 9: krypton.reconciler.v1.ASTNode.key_delete:type_name -> krypton.reconciler.v1.KeyDeleteNode + 19, // 10: krypton.reconciler.v1.ASTNode.key_transition:type_name -> krypton.reconciler.v1.KeyTransitionNode + 20, // 11: krypton.reconciler.v1.ASTNode.key_rotate:type_name -> krypton.reconciler.v1.KeyRotateNode + 21, // 12: krypton.reconciler.v1.ASTNode.key_schedule:type_name -> krypton.reconciler.v1.KeyScheduleNode + 23, // 13: krypton.reconciler.v1.ASTNode.credential_sync:type_name -> krypton.reconciler.v1.CredentialSyncNode + 24, // 14: krypton.reconciler.v1.ASTNode.credential_delete:type_name -> krypton.reconciler.v1.CredentialDeleteNode + 25, // 15: krypton.reconciler.v1.ASTNode.bind:type_name -> krypton.reconciler.v1.BindNode + 26, // 16: krypton.reconciler.v1.ASTNode.emit:type_name -> krypton.reconciler.v1.EmitNode + 1, // 17: krypton.reconciler.v1.SequenceNode.steps:type_name -> krypton.reconciler.v1.ASTNode + 1, // 18: krypton.reconciler.v1.ParallelNode.steps:type_name -> krypton.reconciler.v1.ASTNode + 8, // 19: krypton.reconciler.v1.ConditionalNode.condition:type_name -> krypton.reconciler.v1.Predicate + 1, // 20: krypton.reconciler.v1.ConditionalNode.then_node:type_name -> krypton.reconciler.v1.ASTNode + 1, // 21: krypton.reconciler.v1.ConditionalNode.else_node:type_name -> krypton.reconciler.v1.ASTNode + 1, // 22: krypton.reconciler.v1.TryCatchNode.try_node:type_name -> krypton.reconciler.v1.ASTNode + 1, // 23: krypton.reconciler.v1.TryCatchNode.catch_node:type_name -> krypton.reconciler.v1.ASTNode + 8, // 24: krypton.reconciler.v1.AssertNode.condition:type_name -> krypton.reconciler.v1.Predicate + 9, // 25: krypton.reconciler.v1.Predicate.key_exists:type_name -> krypton.reconciler.v1.KeyExistsPredicate + 10, // 26: krypton.reconciler.v1.Predicate.key_state:type_name -> krypton.reconciler.v1.KeyStatePredicate + 11, // 27: krypton.reconciler.v1.Predicate.tenant_active:type_name -> krypton.reconciler.v1.TenantActivePredicate + 12, // 28: krypton.reconciler.v1.Predicate.credential_exists:type_name -> krypton.reconciler.v1.CredentialExistsPredicate + 13, // 29: krypton.reconciler.v1.Predicate.and:type_name -> krypton.reconciler.v1.AndPredicate + 14, // 30: krypton.reconciler.v1.Predicate.or:type_name -> krypton.reconciler.v1.OrPredicate + 15, // 31: krypton.reconciler.v1.Predicate.not:type_name -> krypton.reconciler.v1.NotPredicate + 16, // 32: krypton.reconciler.v1.KeyExistsPredicate.tier:type_name -> krypton.reconciler.v1.ValueRef + 16, // 33: krypton.reconciler.v1.KeyExistsPredicate.key_name:type_name -> krypton.reconciler.v1.ValueRef + 16, // 34: krypton.reconciler.v1.KeyStatePredicate.tier:type_name -> krypton.reconciler.v1.ValueRef + 16, // 35: krypton.reconciler.v1.KeyStatePredicate.key_name:type_name -> krypton.reconciler.v1.ValueRef + 16, // 36: krypton.reconciler.v1.TenantActivePredicate.tenant_id:type_name -> krypton.reconciler.v1.ValueRef + 16, // 37: krypton.reconciler.v1.CredentialExistsPredicate.name:type_name -> krypton.reconciler.v1.ValueRef + 8, // 38: krypton.reconciler.v1.AndPredicate.terms:type_name -> krypton.reconciler.v1.Predicate + 8, // 39: krypton.reconciler.v1.OrPredicate.terms:type_name -> krypton.reconciler.v1.Predicate + 8, // 40: krypton.reconciler.v1.NotPredicate.term:type_name -> krypton.reconciler.v1.Predicate + 16, // 41: krypton.reconciler.v1.KeySyncNode.tier:type_name -> krypton.reconciler.v1.ValueRef + 16, // 42: krypton.reconciler.v1.KeySyncNode.key_name:type_name -> krypton.reconciler.v1.ValueRef + 16, // 43: krypton.reconciler.v1.KeySyncNode.parent_key:type_name -> krypton.reconciler.v1.ValueRef + 22, // 44: krypton.reconciler.v1.KeySyncNode.schedule:type_name -> krypton.reconciler.v1.KeyScheduleSpec + 28, // 45: krypton.reconciler.v1.KeySyncNode.metadata:type_name -> krypton.reconciler.v1.KeySyncNode.MetadataEntry + 16, // 46: krypton.reconciler.v1.KeyDeleteNode.tier:type_name -> krypton.reconciler.v1.ValueRef + 16, // 47: krypton.reconciler.v1.KeyDeleteNode.key_name:type_name -> krypton.reconciler.v1.ValueRef + 16, // 48: krypton.reconciler.v1.KeyTransitionNode.tier:type_name -> krypton.reconciler.v1.ValueRef + 16, // 49: krypton.reconciler.v1.KeyTransitionNode.key_name:type_name -> krypton.reconciler.v1.ValueRef + 16, // 50: krypton.reconciler.v1.KeyRotateNode.tier:type_name -> krypton.reconciler.v1.ValueRef + 16, // 51: krypton.reconciler.v1.KeyRotateNode.key_name:type_name -> krypton.reconciler.v1.ValueRef + 16, // 52: krypton.reconciler.v1.KeyScheduleNode.tier:type_name -> krypton.reconciler.v1.ValueRef + 16, // 53: krypton.reconciler.v1.KeyScheduleNode.key_name:type_name -> krypton.reconciler.v1.ValueRef + 22, // 54: krypton.reconciler.v1.KeyScheduleNode.schedule:type_name -> krypton.reconciler.v1.KeyScheduleSpec + 30, // 55: krypton.reconciler.v1.KeyScheduleSpec.expires_at:type_name -> google.protobuf.Timestamp + 30, // 56: krypton.reconciler.v1.KeyScheduleSpec.scheduled_transition_at:type_name -> google.protobuf.Timestamp + 16, // 57: krypton.reconciler.v1.CredentialSyncNode.name:type_name -> krypton.reconciler.v1.ValueRef + 16, // 58: krypton.reconciler.v1.CredentialSyncNode.type:type_name -> krypton.reconciler.v1.ValueRef + 31, // 59: krypton.reconciler.v1.CredentialSyncNode.spec:type_name -> google.protobuf.Struct + 16, // 60: krypton.reconciler.v1.CredentialDeleteNode.name:type_name -> krypton.reconciler.v1.ValueRef + 16, // 61: krypton.reconciler.v1.BindNode.value:type_name -> krypton.reconciler.v1.ValueRef + 29, // 62: krypton.reconciler.v1.EmitNode.attributes:type_name -> krypton.reconciler.v1.EmitNode.AttributesEntry + 63, // [63:63] is the sub-list for method output_type + 63, // [63:63] is the sub-list for method input_type + 63, // [63:63] is the sub-list for extension type_name + 63, // [63:63] is the sub-list for extension extendee + 0, // [0:63] is the sub-list for field type_name +} + +func init() { file_plugin_reconciler_v1_ast_proto_init() } +func file_plugin_reconciler_v1_ast_proto_init() { + if File_plugin_reconciler_v1_ast_proto != nil { + return + } + file_plugin_reconciler_v1_ast_proto_msgTypes[1].OneofWrappers = []any{ + (*ASTNode_Sequence)(nil), + (*ASTNode_Parallel)(nil), + (*ASTNode_Conditional)(nil), + (*ASTNode_TryCatch)(nil), + (*ASTNode_Checkpoint)(nil), + (*ASTNode_Assert)(nil), + (*ASTNode_KeySync)(nil), + (*ASTNode_KeyDelete)(nil), + (*ASTNode_KeyTransition)(nil), + (*ASTNode_KeyRotate)(nil), + (*ASTNode_KeySchedule)(nil), + (*ASTNode_CredentialSync)(nil), + (*ASTNode_CredentialDelete)(nil), + (*ASTNode_Bind)(nil), + (*ASTNode_Emit)(nil), + } + file_plugin_reconciler_v1_ast_proto_msgTypes[8].OneofWrappers = []any{ + (*Predicate_KeyExists)(nil), + (*Predicate_KeyState)(nil), + (*Predicate_TenantActive)(nil), + (*Predicate_CredentialExists)(nil), + (*Predicate_And)(nil), + (*Predicate_Or)(nil), + (*Predicate_Not)(nil), + } + file_plugin_reconciler_v1_ast_proto_msgTypes[16].OneofWrappers = []any{ + (*ValueRef_Literal)(nil), + (*ValueRef_VarRef)(nil), + } + file_plugin_reconciler_v1_ast_proto_msgTypes[22].OneofWrappers = []any{} + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_reconciler_v1_ast_proto_rawDesc), len(file_plugin_reconciler_v1_ast_proto_rawDesc)), + NumEnums: 0, + NumMessages: 30, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_plugin_reconciler_v1_ast_proto_goTypes, + DependencyIndexes: file_plugin_reconciler_v1_ast_proto_depIdxs, + MessageInfos: file_plugin_reconciler_v1_ast_proto_msgTypes, + }.Build() + File_plugin_reconciler_v1_ast_proto = out.File + file_plugin_reconciler_v1_ast_proto_goTypes = nil + file_plugin_reconciler_v1_ast_proto_depIdxs = nil +} diff --git a/proto/plugin/reconciler/v1/ast.pb.validate.go b/proto/plugin/reconciler/v1/ast.pb.validate.go new file mode 100644 index 0000000..ec0d8f9 --- /dev/null +++ b/proto/plugin/reconciler/v1/ast.pb.validate.go @@ -0,0 +1,4835 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: plugin/reconciler/v1/ast.proto + +package reconcilerv1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on ExecutionPlan with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ExecutionPlan) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ExecutionPlan with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ExecutionPlanMultiError, or +// nil if none found. +func (m *ExecutionPlan) ValidateAll() error { + return m.validate(true) +} + +func (m *ExecutionPlan) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for PlanId + + if all { + switch v := interface{}(m.GetRoot()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ExecutionPlanValidationError{ + field: "Root", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ExecutionPlanValidationError{ + field: "Root", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetRoot()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ExecutionPlanValidationError{ + field: "Root", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for Bindings + + if len(errors) > 0 { + return ExecutionPlanMultiError(errors) + } + + return nil +} + +// ExecutionPlanMultiError is an error wrapping multiple validation errors +// returned by ExecutionPlan.ValidateAll() if the designated constraints +// aren't met. +type ExecutionPlanMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ExecutionPlanMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ExecutionPlanMultiError) AllErrors() []error { return m } + +// ExecutionPlanValidationError is the validation error returned by +// ExecutionPlan.Validate if the designated constraints aren't met. +type ExecutionPlanValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ExecutionPlanValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ExecutionPlanValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ExecutionPlanValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ExecutionPlanValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ExecutionPlanValidationError) ErrorName() string { return "ExecutionPlanValidationError" } + +// Error satisfies the builtin error interface +func (e ExecutionPlanValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sExecutionPlan.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ExecutionPlanValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ExecutionPlanValidationError{} + +// Validate checks the field values on ASTNode with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ASTNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ASTNode with the rules defined in the +// proto definition for this message. If any rules are violated, the result is +// a list of violation errors wrapped in ASTNodeMultiError, or nil if none found. +func (m *ASTNode) ValidateAll() error { + return m.validate(true) +} + +func (m *ASTNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for NodeId + + // no validation rules for Label + + // no validation rules for ResultVar + + switch v := m.Node.(type) { + case *ASTNode_Sequence: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetSequence()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Sequence", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Sequence", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSequence()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "Sequence", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_Parallel: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetParallel()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Parallel", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Parallel", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetParallel()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "Parallel", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_Conditional: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetConditional()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Conditional", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Conditional", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetConditional()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "Conditional", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_TryCatch: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetTryCatch()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "TryCatch", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "TryCatch", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTryCatch()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "TryCatch", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_Checkpoint: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetCheckpoint()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Checkpoint", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Checkpoint", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCheckpoint()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "Checkpoint", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_Assert: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetAssert()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Assert", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Assert", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetAssert()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "Assert", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_KeySync: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetKeySync()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeySync", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeySync", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeySync()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "KeySync", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_KeyDelete: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetKeyDelete()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeyDelete", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeyDelete", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyDelete()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "KeyDelete", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_KeyTransition: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetKeyTransition()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeyTransition", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeyTransition", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyTransition()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "KeyTransition", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_KeyRotate: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetKeyRotate()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeyRotate", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeyRotate", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyRotate()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "KeyRotate", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_KeySchedule: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetKeySchedule()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeySchedule", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "KeySchedule", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeySchedule()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "KeySchedule", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_CredentialSync: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetCredentialSync()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "CredentialSync", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "CredentialSync", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCredentialSync()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "CredentialSync", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_CredentialDelete: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetCredentialDelete()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "CredentialDelete", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "CredentialDelete", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCredentialDelete()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "CredentialDelete", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_Bind: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetBind()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Bind", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Bind", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetBind()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "Bind", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *ASTNode_Emit: + if v == nil { + err := ASTNodeValidationError{ + field: "Node", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetEmit()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Emit", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ASTNodeValidationError{ + field: "Emit", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetEmit()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ASTNodeValidationError{ + field: "Emit", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + _ = v // ensures v is used + } + + if len(errors) > 0 { + return ASTNodeMultiError(errors) + } + + return nil +} + +// ASTNodeMultiError is an error wrapping multiple validation errors returned +// by ASTNode.ValidateAll() if the designated constraints aren't met. +type ASTNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ASTNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ASTNodeMultiError) AllErrors() []error { return m } + +// ASTNodeValidationError is the validation error returned by ASTNode.Validate +// if the designated constraints aren't met. +type ASTNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ASTNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ASTNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ASTNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ASTNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ASTNodeValidationError) ErrorName() string { return "ASTNodeValidationError" } + +// Error satisfies the builtin error interface +func (e ASTNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sASTNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ASTNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ASTNodeValidationError{} + +// Validate checks the field values on SequenceNode with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *SequenceNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on SequenceNode with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in SequenceNodeMultiError, or +// nil if none found. +func (m *SequenceNode) ValidateAll() error { + return m.validate(true) +} + +func (m *SequenceNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetSteps() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, SequenceNodeValidationError{ + field: fmt.Sprintf("Steps[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, SequenceNodeValidationError{ + field: fmt.Sprintf("Steps[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return SequenceNodeValidationError{ + field: fmt.Sprintf("Steps[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return SequenceNodeMultiError(errors) + } + + return nil +} + +// SequenceNodeMultiError is an error wrapping multiple validation errors +// returned by SequenceNode.ValidateAll() if the designated constraints aren't met. +type SequenceNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m SequenceNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m SequenceNodeMultiError) AllErrors() []error { return m } + +// SequenceNodeValidationError is the validation error returned by +// SequenceNode.Validate if the designated constraints aren't met. +type SequenceNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e SequenceNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e SequenceNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e SequenceNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e SequenceNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e SequenceNodeValidationError) ErrorName() string { return "SequenceNodeValidationError" } + +// Error satisfies the builtin error interface +func (e SequenceNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sSequenceNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = SequenceNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = SequenceNodeValidationError{} + +// Validate checks the field values on ParallelNode with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ParallelNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ParallelNode with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ParallelNodeMultiError, or +// nil if none found. +func (m *ParallelNode) ValidateAll() error { + return m.validate(true) +} + +func (m *ParallelNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetSteps() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ParallelNodeValidationError{ + field: fmt.Sprintf("Steps[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ParallelNodeValidationError{ + field: fmt.Sprintf("Steps[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ParallelNodeValidationError{ + field: fmt.Sprintf("Steps[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + // no validation rules for FailFast + + if len(errors) > 0 { + return ParallelNodeMultiError(errors) + } + + return nil +} + +// ParallelNodeMultiError is an error wrapping multiple validation errors +// returned by ParallelNode.ValidateAll() if the designated constraints aren't met. +type ParallelNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ParallelNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ParallelNodeMultiError) AllErrors() []error { return m } + +// ParallelNodeValidationError is the validation error returned by +// ParallelNode.Validate if the designated constraints aren't met. +type ParallelNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ParallelNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ParallelNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ParallelNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ParallelNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ParallelNodeValidationError) ErrorName() string { return "ParallelNodeValidationError" } + +// Error satisfies the builtin error interface +func (e ParallelNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sParallelNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ParallelNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ParallelNodeValidationError{} + +// Validate checks the field values on ConditionalNode with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ConditionalNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ConditionalNode with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ConditionalNodeMultiError, or nil if none found. +func (m *ConditionalNode) ValidateAll() error { + return m.validate(true) +} + +func (m *ConditionalNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetCondition()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ConditionalNodeValidationError{ + field: "Condition", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ConditionalNodeValidationError{ + field: "Condition", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCondition()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ConditionalNodeValidationError{ + field: "Condition", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetThenNode()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ConditionalNodeValidationError{ + field: "ThenNode", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ConditionalNodeValidationError{ + field: "ThenNode", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetThenNode()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ConditionalNodeValidationError{ + field: "ThenNode", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetElseNode()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ConditionalNodeValidationError{ + field: "ElseNode", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ConditionalNodeValidationError{ + field: "ElseNode", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetElseNode()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ConditionalNodeValidationError{ + field: "ElseNode", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return ConditionalNodeMultiError(errors) + } + + return nil +} + +// ConditionalNodeMultiError is an error wrapping multiple validation errors +// returned by ConditionalNode.ValidateAll() if the designated constraints +// aren't met. +type ConditionalNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ConditionalNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ConditionalNodeMultiError) AllErrors() []error { return m } + +// ConditionalNodeValidationError is the validation error returned by +// ConditionalNode.Validate if the designated constraints aren't met. +type ConditionalNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ConditionalNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ConditionalNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ConditionalNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ConditionalNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ConditionalNodeValidationError) ErrorName() string { return "ConditionalNodeValidationError" } + +// Error satisfies the builtin error interface +func (e ConditionalNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sConditionalNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ConditionalNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ConditionalNodeValidationError{} + +// Validate checks the field values on TryCatchNode with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *TryCatchNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on TryCatchNode with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in TryCatchNodeMultiError, or +// nil if none found. +func (m *TryCatchNode) ValidateAll() error { + return m.validate(true) +} + +func (m *TryCatchNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTryNode()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, TryCatchNodeValidationError{ + field: "TryNode", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, TryCatchNodeValidationError{ + field: "TryNode", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTryNode()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TryCatchNodeValidationError{ + field: "TryNode", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetCatchNode()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, TryCatchNodeValidationError{ + field: "CatchNode", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, TryCatchNodeValidationError{ + field: "CatchNode", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCatchNode()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TryCatchNodeValidationError{ + field: "CatchNode", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return TryCatchNodeMultiError(errors) + } + + return nil +} + +// TryCatchNodeMultiError is an error wrapping multiple validation errors +// returned by TryCatchNode.ValidateAll() if the designated constraints aren't met. +type TryCatchNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m TryCatchNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m TryCatchNodeMultiError) AllErrors() []error { return m } + +// TryCatchNodeValidationError is the validation error returned by +// TryCatchNode.Validate if the designated constraints aren't met. +type TryCatchNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e TryCatchNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e TryCatchNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e TryCatchNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e TryCatchNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e TryCatchNodeValidationError) ErrorName() string { return "TryCatchNodeValidationError" } + +// Error satisfies the builtin error interface +func (e TryCatchNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTryCatchNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = TryCatchNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = TryCatchNodeValidationError{} + +// Validate checks the field values on CheckpointNode with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *CheckpointNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CheckpointNode with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in CheckpointNodeMultiError, +// or nil if none found. +func (m *CheckpointNode) ValidateAll() error { + return m.validate(true) +} + +func (m *CheckpointNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if len(errors) > 0 { + return CheckpointNodeMultiError(errors) + } + + return nil +} + +// CheckpointNodeMultiError is an error wrapping multiple validation errors +// returned by CheckpointNode.ValidateAll() if the designated constraints +// aren't met. +type CheckpointNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CheckpointNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CheckpointNodeMultiError) AllErrors() []error { return m } + +// CheckpointNodeValidationError is the validation error returned by +// CheckpointNode.Validate if the designated constraints aren't met. +type CheckpointNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CheckpointNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CheckpointNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CheckpointNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CheckpointNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CheckpointNodeValidationError) ErrorName() string { return "CheckpointNodeValidationError" } + +// Error satisfies the builtin error interface +func (e CheckpointNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCheckpointNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CheckpointNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CheckpointNodeValidationError{} + +// Validate checks the field values on AssertNode with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *AssertNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on AssertNode with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in AssertNodeMultiError, or +// nil if none found. +func (m *AssertNode) ValidateAll() error { + return m.validate(true) +} + +func (m *AssertNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetCondition()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AssertNodeValidationError{ + field: "Condition", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AssertNodeValidationError{ + field: "Condition", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCondition()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AssertNodeValidationError{ + field: "Condition", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for ErrorMessage + + if len(errors) > 0 { + return AssertNodeMultiError(errors) + } + + return nil +} + +// AssertNodeMultiError is an error wrapping multiple validation errors +// returned by AssertNode.ValidateAll() if the designated constraints aren't met. +type AssertNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AssertNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m AssertNodeMultiError) AllErrors() []error { return m } + +// AssertNodeValidationError is the validation error returned by +// AssertNode.Validate if the designated constraints aren't met. +type AssertNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AssertNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AssertNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AssertNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AssertNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AssertNodeValidationError) ErrorName() string { return "AssertNodeValidationError" } + +// Error satisfies the builtin error interface +func (e AssertNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAssertNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AssertNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AssertNodeValidationError{} + +// Validate checks the field values on Predicate with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *Predicate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on Predicate with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in PredicateMultiError, or nil +// if none found. +func (m *Predicate) ValidateAll() error { + return m.validate(true) +} + +func (m *Predicate) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + switch v := m.Expr.(type) { + case *Predicate_KeyExists: + if v == nil { + err := PredicateValidationError{ + field: "Expr", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetKeyExists()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "KeyExists", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "KeyExists", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyExists()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PredicateValidationError{ + field: "KeyExists", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Predicate_KeyState: + if v == nil { + err := PredicateValidationError{ + field: "Expr", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetKeyState()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "KeyState", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "KeyState", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyState()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PredicateValidationError{ + field: "KeyState", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Predicate_TenantActive: + if v == nil { + err := PredicateValidationError{ + field: "Expr", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetTenantActive()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "TenantActive", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "TenantActive", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTenantActive()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PredicateValidationError{ + field: "TenantActive", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Predicate_CredentialExists: + if v == nil { + err := PredicateValidationError{ + field: "Expr", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetCredentialExists()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "CredentialExists", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "CredentialExists", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetCredentialExists()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PredicateValidationError{ + field: "CredentialExists", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Predicate_And: + if v == nil { + err := PredicateValidationError{ + field: "Expr", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetAnd()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "And", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "And", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetAnd()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PredicateValidationError{ + field: "And", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Predicate_Or: + if v == nil { + err := PredicateValidationError{ + field: "Expr", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetOr()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "Or", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "Or", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetOr()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PredicateValidationError{ + field: "Or", + reason: "embedded message failed validation", + cause: err, + } + } + } + + case *Predicate_Not: + if v == nil { + err := PredicateValidationError{ + field: "Expr", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + + if all { + switch v := interface{}(m.GetNot()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "Not", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, PredicateValidationError{ + field: "Not", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetNot()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return PredicateValidationError{ + field: "Not", + reason: "embedded message failed validation", + cause: err, + } + } + } + + default: + _ = v // ensures v is used + } + + if len(errors) > 0 { + return PredicateMultiError(errors) + } + + return nil +} + +// PredicateMultiError is an error wrapping multiple validation errors returned +// by Predicate.ValidateAll() if the designated constraints aren't met. +type PredicateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m PredicateMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m PredicateMultiError) AllErrors() []error { return m } + +// PredicateValidationError is the validation error returned by +// Predicate.Validate if the designated constraints aren't met. +type PredicateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e PredicateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e PredicateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e PredicateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e PredicateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e PredicateValidationError) ErrorName() string { return "PredicateValidationError" } + +// Error satisfies the builtin error interface +func (e PredicateValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sPredicate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = PredicateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = PredicateValidationError{} + +// Validate checks the field values on KeyExistsPredicate with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *KeyExistsPredicate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeyExistsPredicate with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// KeyExistsPredicateMultiError, or nil if none found. +func (m *KeyExistsPredicate) ValidateAll() error { + return m.validate(true) +} + +func (m *KeyExistsPredicate) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTier()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyExistsPredicateValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyExistsPredicateValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyExistsPredicateValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetKeyName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyExistsPredicateValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyExistsPredicateValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyExistsPredicateValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return KeyExistsPredicateMultiError(errors) + } + + return nil +} + +// KeyExistsPredicateMultiError is an error wrapping multiple validation errors +// returned by KeyExistsPredicate.ValidateAll() if the designated constraints +// aren't met. +type KeyExistsPredicateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyExistsPredicateMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyExistsPredicateMultiError) AllErrors() []error { return m } + +// KeyExistsPredicateValidationError is the validation error returned by +// KeyExistsPredicate.Validate if the designated constraints aren't met. +type KeyExistsPredicateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyExistsPredicateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyExistsPredicateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyExistsPredicateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyExistsPredicateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyExistsPredicateValidationError) ErrorName() string { + return "KeyExistsPredicateValidationError" +} + +// Error satisfies the builtin error interface +func (e KeyExistsPredicateValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyExistsPredicate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyExistsPredicateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyExistsPredicateValidationError{} + +// Validate checks the field values on KeyStatePredicate with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *KeyStatePredicate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeyStatePredicate with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// KeyStatePredicateMultiError, or nil if none found. +func (m *KeyStatePredicate) ValidateAll() error { + return m.validate(true) +} + +func (m *KeyStatePredicate) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTier()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyStatePredicateValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyStatePredicateValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyStatePredicateValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetKeyName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyStatePredicateValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyStatePredicateValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyStatePredicateValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return KeyStatePredicateMultiError(errors) + } + + return nil +} + +// KeyStatePredicateMultiError is an error wrapping multiple validation errors +// returned by KeyStatePredicate.ValidateAll() if the designated constraints +// aren't met. +type KeyStatePredicateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyStatePredicateMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyStatePredicateMultiError) AllErrors() []error { return m } + +// KeyStatePredicateValidationError is the validation error returned by +// KeyStatePredicate.Validate if the designated constraints aren't met. +type KeyStatePredicateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyStatePredicateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyStatePredicateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyStatePredicateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyStatePredicateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyStatePredicateValidationError) ErrorName() string { + return "KeyStatePredicateValidationError" +} + +// Error satisfies the builtin error interface +func (e KeyStatePredicateValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyStatePredicate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyStatePredicateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyStatePredicateValidationError{} + +// Validate checks the field values on TenantActivePredicate with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *TenantActivePredicate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on TenantActivePredicate with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// TenantActivePredicateMultiError, or nil if none found. +func (m *TenantActivePredicate) ValidateAll() error { + return m.validate(true) +} + +func (m *TenantActivePredicate) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTenantId()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, TenantActivePredicateValidationError{ + field: "TenantId", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, TenantActivePredicateValidationError{ + field: "TenantId", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTenantId()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return TenantActivePredicateValidationError{ + field: "TenantId", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return TenantActivePredicateMultiError(errors) + } + + return nil +} + +// TenantActivePredicateMultiError is an error wrapping multiple validation +// errors returned by TenantActivePredicate.ValidateAll() if the designated +// constraints aren't met. +type TenantActivePredicateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m TenantActivePredicateMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m TenantActivePredicateMultiError) AllErrors() []error { return m } + +// TenantActivePredicateValidationError is the validation error returned by +// TenantActivePredicate.Validate if the designated constraints aren't met. +type TenantActivePredicateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e TenantActivePredicateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e TenantActivePredicateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e TenantActivePredicateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e TenantActivePredicateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e TenantActivePredicateValidationError) ErrorName() string { + return "TenantActivePredicateValidationError" +} + +// Error satisfies the builtin error interface +func (e TenantActivePredicateValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sTenantActivePredicate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = TenantActivePredicateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = TenantActivePredicateValidationError{} + +// Validate checks the field values on CredentialExistsPredicate with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *CredentialExistsPredicate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CredentialExistsPredicate with the +// rules defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CredentialExistsPredicateMultiError, or nil if none found. +func (m *CredentialExistsPredicate) ValidateAll() error { + return m.validate(true) +} + +func (m *CredentialExistsPredicate) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CredentialExistsPredicateValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CredentialExistsPredicateValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CredentialExistsPredicateValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return CredentialExistsPredicateMultiError(errors) + } + + return nil +} + +// CredentialExistsPredicateMultiError is an error wrapping multiple validation +// errors returned by CredentialExistsPredicate.ValidateAll() if the +// designated constraints aren't met. +type CredentialExistsPredicateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CredentialExistsPredicateMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CredentialExistsPredicateMultiError) AllErrors() []error { return m } + +// CredentialExistsPredicateValidationError is the validation error returned by +// CredentialExistsPredicate.Validate if the designated constraints aren't met. +type CredentialExistsPredicateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CredentialExistsPredicateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CredentialExistsPredicateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CredentialExistsPredicateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CredentialExistsPredicateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CredentialExistsPredicateValidationError) ErrorName() string { + return "CredentialExistsPredicateValidationError" +} + +// Error satisfies the builtin error interface +func (e CredentialExistsPredicateValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCredentialExistsPredicate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CredentialExistsPredicateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CredentialExistsPredicateValidationError{} + +// Validate checks the field values on AndPredicate with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *AndPredicate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on AndPredicate with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in AndPredicateMultiError, or +// nil if none found. +func (m *AndPredicate) ValidateAll() error { + return m.validate(true) +} + +func (m *AndPredicate) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetTerms() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, AndPredicateValidationError{ + field: fmt.Sprintf("Terms[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, AndPredicateValidationError{ + field: fmt.Sprintf("Terms[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return AndPredicateValidationError{ + field: fmt.Sprintf("Terms[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return AndPredicateMultiError(errors) + } + + return nil +} + +// AndPredicateMultiError is an error wrapping multiple validation errors +// returned by AndPredicate.ValidateAll() if the designated constraints aren't met. +type AndPredicateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m AndPredicateMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m AndPredicateMultiError) AllErrors() []error { return m } + +// AndPredicateValidationError is the validation error returned by +// AndPredicate.Validate if the designated constraints aren't met. +type AndPredicateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e AndPredicateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e AndPredicateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e AndPredicateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e AndPredicateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e AndPredicateValidationError) ErrorName() string { return "AndPredicateValidationError" } + +// Error satisfies the builtin error interface +func (e AndPredicateValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sAndPredicate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = AndPredicateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = AndPredicateValidationError{} + +// Validate checks the field values on OrPredicate with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *OrPredicate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on OrPredicate with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in OrPredicateMultiError, or +// nil if none found. +func (m *OrPredicate) ValidateAll() error { + return m.validate(true) +} + +func (m *OrPredicate) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetTerms() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, OrPredicateValidationError{ + field: fmt.Sprintf("Terms[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, OrPredicateValidationError{ + field: fmt.Sprintf("Terms[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return OrPredicateValidationError{ + field: fmt.Sprintf("Terms[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return OrPredicateMultiError(errors) + } + + return nil +} + +// OrPredicateMultiError is an error wrapping multiple validation errors +// returned by OrPredicate.ValidateAll() if the designated constraints aren't met. +type OrPredicateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m OrPredicateMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m OrPredicateMultiError) AllErrors() []error { return m } + +// OrPredicateValidationError is the validation error returned by +// OrPredicate.Validate if the designated constraints aren't met. +type OrPredicateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e OrPredicateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e OrPredicateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e OrPredicateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e OrPredicateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e OrPredicateValidationError) ErrorName() string { return "OrPredicateValidationError" } + +// Error satisfies the builtin error interface +func (e OrPredicateValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sOrPredicate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = OrPredicateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = OrPredicateValidationError{} + +// Validate checks the field values on NotPredicate with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *NotPredicate) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on NotPredicate with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in NotPredicateMultiError, or +// nil if none found. +func (m *NotPredicate) ValidateAll() error { + return m.validate(true) +} + +func (m *NotPredicate) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTerm()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, NotPredicateValidationError{ + field: "Term", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, NotPredicateValidationError{ + field: "Term", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTerm()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return NotPredicateValidationError{ + field: "Term", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return NotPredicateMultiError(errors) + } + + return nil +} + +// NotPredicateMultiError is an error wrapping multiple validation errors +// returned by NotPredicate.ValidateAll() if the designated constraints aren't met. +type NotPredicateMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m NotPredicateMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m NotPredicateMultiError) AllErrors() []error { return m } + +// NotPredicateValidationError is the validation error returned by +// NotPredicate.Validate if the designated constraints aren't met. +type NotPredicateValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e NotPredicateValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e NotPredicateValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e NotPredicateValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e NotPredicateValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e NotPredicateValidationError) ErrorName() string { return "NotPredicateValidationError" } + +// Error satisfies the builtin error interface +func (e NotPredicateValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sNotPredicate.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = NotPredicateValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = NotPredicateValidationError{} + +// Validate checks the field values on ValueRef with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *ValueRef) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ValueRef with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in ValueRefMultiError, or nil +// if none found. +func (m *ValueRef) ValidateAll() error { + return m.validate(true) +} + +func (m *ValueRef) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + switch v := m.Kind.(type) { + case *ValueRef_Literal: + if v == nil { + err := ValueRefValidationError{ + field: "Kind", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + // no validation rules for Literal + case *ValueRef_VarRef: + if v == nil { + err := ValueRefValidationError{ + field: "Kind", + reason: "oneof value cannot be a typed-nil", + } + if !all { + return err + } + errors = append(errors, err) + } + // no validation rules for VarRef + default: + _ = v // ensures v is used + } + + if len(errors) > 0 { + return ValueRefMultiError(errors) + } + + return nil +} + +// ValueRefMultiError is an error wrapping multiple validation errors returned +// by ValueRef.ValidateAll() if the designated constraints aren't met. +type ValueRefMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ValueRefMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ValueRefMultiError) AllErrors() []error { return m } + +// ValueRefValidationError is the validation error returned by +// ValueRef.Validate if the designated constraints aren't met. +type ValueRefValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ValueRefValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ValueRefValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ValueRefValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ValueRefValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ValueRefValidationError) ErrorName() string { return "ValueRefValidationError" } + +// Error satisfies the builtin error interface +func (e ValueRefValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sValueRef.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ValueRefValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ValueRefValidationError{} + +// Validate checks the field values on KeySyncNode with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *KeySyncNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeySyncNode with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in KeySyncNodeMultiError, or +// nil if none found. +func (m *KeySyncNode) ValidateAll() error { + return m.validate(true) +} + +func (m *KeySyncNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTier()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeySyncNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeySyncNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeySyncNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetKeyName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeySyncNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeySyncNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeySyncNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetParentKey()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeySyncNodeValidationError{ + field: "ParentKey", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeySyncNodeValidationError{ + field: "ParentKey", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetParentKey()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeySyncNodeValidationError{ + field: "ParentKey", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetSchedule()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeySyncNodeValidationError{ + field: "Schedule", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeySyncNodeValidationError{ + field: "Schedule", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSchedule()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeySyncNodeValidationError{ + field: "Schedule", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for Metadata + + if len(errors) > 0 { + return KeySyncNodeMultiError(errors) + } + + return nil +} + +// KeySyncNodeMultiError is an error wrapping multiple validation errors +// returned by KeySyncNode.ValidateAll() if the designated constraints aren't met. +type KeySyncNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeySyncNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeySyncNodeMultiError) AllErrors() []error { return m } + +// KeySyncNodeValidationError is the validation error returned by +// KeySyncNode.Validate if the designated constraints aren't met. +type KeySyncNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeySyncNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeySyncNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeySyncNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeySyncNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeySyncNodeValidationError) ErrorName() string { return "KeySyncNodeValidationError" } + +// Error satisfies the builtin error interface +func (e KeySyncNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeySyncNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeySyncNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeySyncNodeValidationError{} + +// Validate checks the field values on KeyDeleteNode with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *KeyDeleteNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeyDeleteNode with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in KeyDeleteNodeMultiError, or +// nil if none found. +func (m *KeyDeleteNode) ValidateAll() error { + return m.validate(true) +} + +func (m *KeyDeleteNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTier()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyDeleteNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyDeleteNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyDeleteNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetKeyName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyDeleteNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyDeleteNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyDeleteNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return KeyDeleteNodeMultiError(errors) + } + + return nil +} + +// KeyDeleteNodeMultiError is an error wrapping multiple validation errors +// returned by KeyDeleteNode.ValidateAll() if the designated constraints +// aren't met. +type KeyDeleteNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyDeleteNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyDeleteNodeMultiError) AllErrors() []error { return m } + +// KeyDeleteNodeValidationError is the validation error returned by +// KeyDeleteNode.Validate if the designated constraints aren't met. +type KeyDeleteNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyDeleteNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyDeleteNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyDeleteNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyDeleteNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyDeleteNodeValidationError) ErrorName() string { return "KeyDeleteNodeValidationError" } + +// Error satisfies the builtin error interface +func (e KeyDeleteNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyDeleteNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyDeleteNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyDeleteNodeValidationError{} + +// Validate checks the field values on KeyTransitionNode with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *KeyTransitionNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeyTransitionNode with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// KeyTransitionNodeMultiError, or nil if none found. +func (m *KeyTransitionNode) ValidateAll() error { + return m.validate(true) +} + +func (m *KeyTransitionNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTier()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyTransitionNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyTransitionNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyTransitionNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetKeyName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyTransitionNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyTransitionNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyTransitionNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + } + } + } + + // no validation rules for TargetState + + if len(errors) > 0 { + return KeyTransitionNodeMultiError(errors) + } + + return nil +} + +// KeyTransitionNodeMultiError is an error wrapping multiple validation errors +// returned by KeyTransitionNode.ValidateAll() if the designated constraints +// aren't met. +type KeyTransitionNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyTransitionNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyTransitionNodeMultiError) AllErrors() []error { return m } + +// KeyTransitionNodeValidationError is the validation error returned by +// KeyTransitionNode.Validate if the designated constraints aren't met. +type KeyTransitionNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyTransitionNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyTransitionNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyTransitionNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyTransitionNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyTransitionNodeValidationError) ErrorName() string { + return "KeyTransitionNodeValidationError" +} + +// Error satisfies the builtin error interface +func (e KeyTransitionNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyTransitionNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyTransitionNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyTransitionNodeValidationError{} + +// Validate checks the field values on KeyRotateNode with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *KeyRotateNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeyRotateNode with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in KeyRotateNodeMultiError, or +// nil if none found. +func (m *KeyRotateNode) ValidateAll() error { + return m.validate(true) +} + +func (m *KeyRotateNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTier()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyRotateNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyRotateNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyRotateNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetKeyName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyRotateNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyRotateNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyRotateNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return KeyRotateNodeMultiError(errors) + } + + return nil +} + +// KeyRotateNodeMultiError is an error wrapping multiple validation errors +// returned by KeyRotateNode.ValidateAll() if the designated constraints +// aren't met. +type KeyRotateNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyRotateNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyRotateNodeMultiError) AllErrors() []error { return m } + +// KeyRotateNodeValidationError is the validation error returned by +// KeyRotateNode.Validate if the designated constraints aren't met. +type KeyRotateNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyRotateNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyRotateNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyRotateNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyRotateNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyRotateNodeValidationError) ErrorName() string { return "KeyRotateNodeValidationError" } + +// Error satisfies the builtin error interface +func (e KeyRotateNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyRotateNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyRotateNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyRotateNodeValidationError{} + +// Validate checks the field values on KeyScheduleNode with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *KeyScheduleNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeyScheduleNode with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// KeyScheduleNodeMultiError, or nil if none found. +func (m *KeyScheduleNode) ValidateAll() error { + return m.validate(true) +} + +func (m *KeyScheduleNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetTier()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyScheduleNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyScheduleNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyScheduleNodeValidationError{ + field: "Tier", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetKeyName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyScheduleNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyScheduleNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyScheduleNodeValidationError{ + field: "KeyName", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetSchedule()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyScheduleNodeValidationError{ + field: "Schedule", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyScheduleNodeValidationError{ + field: "Schedule", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSchedule()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyScheduleNodeValidationError{ + field: "Schedule", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return KeyScheduleNodeMultiError(errors) + } + + return nil +} + +// KeyScheduleNodeMultiError is an error wrapping multiple validation errors +// returned by KeyScheduleNode.ValidateAll() if the designated constraints +// aren't met. +type KeyScheduleNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyScheduleNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyScheduleNodeMultiError) AllErrors() []error { return m } + +// KeyScheduleNodeValidationError is the validation error returned by +// KeyScheduleNode.Validate if the designated constraints aren't met. +type KeyScheduleNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyScheduleNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyScheduleNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyScheduleNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyScheduleNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyScheduleNodeValidationError) ErrorName() string { return "KeyScheduleNodeValidationError" } + +// Error satisfies the builtin error interface +func (e KeyScheduleNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyScheduleNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyScheduleNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyScheduleNodeValidationError{} + +// Validate checks the field values on KeyScheduleSpec with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *KeyScheduleSpec) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on KeyScheduleSpec with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// KeyScheduleSpecMultiError, or nil if none found. +func (m *KeyScheduleSpec) ValidateAll() error { + return m.validate(true) +} + +func (m *KeyScheduleSpec) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if m.ExpiresAt != nil { + + if all { + switch v := interface{}(m.GetExpiresAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyScheduleSpecValidationError{ + field: "ExpiresAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyScheduleSpecValidationError{ + field: "ExpiresAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetExpiresAt()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyScheduleSpecValidationError{ + field: "ExpiresAt", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if m.ScheduledTransitionAt != nil { + + if all { + switch v := interface{}(m.GetScheduledTransitionAt()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, KeyScheduleSpecValidationError{ + field: "ScheduledTransitionAt", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, KeyScheduleSpecValidationError{ + field: "ScheduledTransitionAt", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetScheduledTransitionAt()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return KeyScheduleSpecValidationError{ + field: "ScheduledTransitionAt", + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if m.TransitionTo != nil { + // no validation rules for TransitionTo + } + + if len(errors) > 0 { + return KeyScheduleSpecMultiError(errors) + } + + return nil +} + +// KeyScheduleSpecMultiError is an error wrapping multiple validation errors +// returned by KeyScheduleSpec.ValidateAll() if the designated constraints +// aren't met. +type KeyScheduleSpecMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m KeyScheduleSpecMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m KeyScheduleSpecMultiError) AllErrors() []error { return m } + +// KeyScheduleSpecValidationError is the validation error returned by +// KeyScheduleSpec.Validate if the designated constraints aren't met. +type KeyScheduleSpecValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e KeyScheduleSpecValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e KeyScheduleSpecValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e KeyScheduleSpecValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e KeyScheduleSpecValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e KeyScheduleSpecValidationError) ErrorName() string { return "KeyScheduleSpecValidationError" } + +// Error satisfies the builtin error interface +func (e KeyScheduleSpecValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sKeyScheduleSpec.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = KeyScheduleSpecValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = KeyScheduleSpecValidationError{} + +// Validate checks the field values on CredentialSyncNode with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *CredentialSyncNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CredentialSyncNode with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CredentialSyncNodeMultiError, or nil if none found. +func (m *CredentialSyncNode) ValidateAll() error { + return m.validate(true) +} + +func (m *CredentialSyncNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CredentialSyncNodeValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CredentialSyncNodeValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CredentialSyncNodeValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetType()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CredentialSyncNodeValidationError{ + field: "Type", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CredentialSyncNodeValidationError{ + field: "Type", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetType()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CredentialSyncNodeValidationError{ + field: "Type", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if all { + switch v := interface{}(m.GetSpec()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CredentialSyncNodeValidationError{ + field: "Spec", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CredentialSyncNodeValidationError{ + field: "Spec", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetSpec()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CredentialSyncNodeValidationError{ + field: "Spec", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return CredentialSyncNodeMultiError(errors) + } + + return nil +} + +// CredentialSyncNodeMultiError is an error wrapping multiple validation errors +// returned by CredentialSyncNode.ValidateAll() if the designated constraints +// aren't met. +type CredentialSyncNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CredentialSyncNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CredentialSyncNodeMultiError) AllErrors() []error { return m } + +// CredentialSyncNodeValidationError is the validation error returned by +// CredentialSyncNode.Validate if the designated constraints aren't met. +type CredentialSyncNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CredentialSyncNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CredentialSyncNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CredentialSyncNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CredentialSyncNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CredentialSyncNodeValidationError) ErrorName() string { + return "CredentialSyncNodeValidationError" +} + +// Error satisfies the builtin error interface +func (e CredentialSyncNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCredentialSyncNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CredentialSyncNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CredentialSyncNodeValidationError{} + +// Validate checks the field values on CredentialDeleteNode with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *CredentialDeleteNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on CredentialDeleteNode with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// CredentialDeleteNodeMultiError, or nil if none found. +func (m *CredentialDeleteNode) ValidateAll() error { + return m.validate(true) +} + +func (m *CredentialDeleteNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if all { + switch v := interface{}(m.GetName()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, CredentialDeleteNodeValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, CredentialDeleteNodeValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return CredentialDeleteNodeValidationError{ + field: "Name", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return CredentialDeleteNodeMultiError(errors) + } + + return nil +} + +// CredentialDeleteNodeMultiError is an error wrapping multiple validation +// errors returned by CredentialDeleteNode.ValidateAll() if the designated +// constraints aren't met. +type CredentialDeleteNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m CredentialDeleteNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m CredentialDeleteNodeMultiError) AllErrors() []error { return m } + +// CredentialDeleteNodeValidationError is the validation error returned by +// CredentialDeleteNode.Validate if the designated constraints aren't met. +type CredentialDeleteNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e CredentialDeleteNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e CredentialDeleteNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e CredentialDeleteNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e CredentialDeleteNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e CredentialDeleteNodeValidationError) ErrorName() string { + return "CredentialDeleteNodeValidationError" +} + +// Error satisfies the builtin error interface +func (e CredentialDeleteNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sCredentialDeleteNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = CredentialDeleteNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = CredentialDeleteNodeValidationError{} + +// Validate checks the field values on BindNode with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *BindNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on BindNode with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in BindNodeMultiError, or nil +// if none found. +func (m *BindNode) ValidateAll() error { + return m.validate(true) +} + +func (m *BindNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for VarName + + if all { + switch v := interface{}(m.GetValue()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, BindNodeValidationError{ + field: "Value", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, BindNodeValidationError{ + field: "Value", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return BindNodeValidationError{ + field: "Value", + reason: "embedded message failed validation", + cause: err, + } + } + } + + if len(errors) > 0 { + return BindNodeMultiError(errors) + } + + return nil +} + +// BindNodeMultiError is an error wrapping multiple validation errors returned +// by BindNode.ValidateAll() if the designated constraints aren't met. +type BindNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m BindNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m BindNodeMultiError) AllErrors() []error { return m } + +// BindNodeValidationError is the validation error returned by +// BindNode.Validate if the designated constraints aren't met. +type BindNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e BindNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e BindNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e BindNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e BindNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e BindNodeValidationError) ErrorName() string { return "BindNodeValidationError" } + +// Error satisfies the builtin error interface +func (e BindNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sBindNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = BindNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = BindNodeValidationError{} + +// Validate checks the field values on EmitNode with the rules defined in the +// proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *EmitNode) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EmitNode with the rules defined in +// the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in EmitNodeMultiError, or nil +// if none found. +func (m *EmitNode) ValidateAll() error { + return m.validate(true) +} + +func (m *EmitNode) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for EventType + + // no validation rules for Attributes + + if len(errors) > 0 { + return EmitNodeMultiError(errors) + } + + return nil +} + +// EmitNodeMultiError is an error wrapping multiple validation errors returned +// by EmitNode.ValidateAll() if the designated constraints aren't met. +type EmitNodeMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EmitNodeMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EmitNodeMultiError) AllErrors() []error { return m } + +// EmitNodeValidationError is the validation error returned by +// EmitNode.Validate if the designated constraints aren't met. +type EmitNodeValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EmitNodeValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EmitNodeValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EmitNodeValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EmitNodeValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EmitNodeValidationError) ErrorName() string { return "EmitNodeValidationError" } + +// Error satisfies the builtin error interface +func (e EmitNodeValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEmitNode.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EmitNodeValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EmitNodeValidationError{} diff --git a/proto/plugin/reconciler/v1/ast.proto b/proto/plugin/reconciler/v1/ast.proto new file mode 100644 index 0000000..03942a9 --- /dev/null +++ b/proto/plugin/reconciler/v1/ast.proto @@ -0,0 +1,273 @@ +syntax = "proto3"; + +package krypton.reconciler.v1; + +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "github.com/openkcm/krypton/proto/plugin/reconciler/v1;reconcilerv1"; + +// ExecutionPlan is the root of the AST returned by a plugin's Reconcile call. +// It describes every operation Krypton core must execute to drive the custom +// resource to its desired state. Core is the sole executor — the plugin never +// touches keys, state, or the database directly. +message ExecutionPlan { + // plan_id identifies this plan for tracing. Recommended: echo the operation ID. + string plan_id = 1; + + // root is the root node of the execution tree. + ASTNode root = 2; + + // bindings are pre-declared variables available to every node in the plan. + // Use them to pass tenant_id, api_group, external IDs, or any other values + // the plugin resolved during planning and wants to thread through execution. + map bindings = 3; +} + +// ───────────────────────────────────────────────────────────── +// Core node type — every element of the AST is an ASTNode. +// ───────────────────────────────────────────────────────────── + +message ASTNode { + // node_id is an optional stable identifier used for checkpoint persistence. + // When set, the executor stores progress so retries resume from here. + // Must be stable across retries (use a semantic name, not a random UUID). + string node_id = 1; + + // label is a human-readable description surfaced in logs and audit events. + string label = 2; + + // result_var, when non-empty, binds the primary string output of this node + // (typically a provisioned key ID) into the execution state so downstream + // nodes can reference it via ValueRef.var_ref. + string result_var = 3; + + oneof node { + // ── Control flow ────────────────────────────────────────── + SequenceNode sequence = 10; + ParallelNode parallel = 11; + ConditionalNode conditional = 12; + TryCatchNode try_catch = 13; + + // ── Checkpoint ──────────────────────────────────────────── + // Persists progress at this point; uses node_id as the checkpoint name. + CheckpointNode checkpoint = 14; + + // ── Assertions / pre-conditions ─────────────────────────── + // Fails the plan with error_message if the predicate is false. + AssertNode assert = 20; + + // ── Key lifecycle ───────────────────────────────────────── + KeySyncNode key_sync = 30; // create or idempotently update + KeyDeleteNode key_delete = 31; // destroy key material + KeyTransitionNode key_transition = 32; // explicit lifecycle state change + KeyRotateNode key_rotate = 33; // generate new key material (forced rotation) + KeyScheduleNode key_schedule = 34; // set expiry / scheduled transition + + // ── Credential lifecycle ─────────────────────────────────── + CredentialSyncNode credential_sync = 40; + CredentialDeleteNode credential_delete = 41; + + // ── Utility ─────────────────────────────────────────────── + BindNode bind = 60; // set a variable in execution state + EmitNode emit = 61; // write a custom audit event + } +} + +// ───────────────────────────────────────────────────────────── +// Control flow +// ───────────────────────────────────────────────────────────── + +// SequenceNode runs steps in order; the first error aborts the remainder +// and triggers rollback of already-executed steps (same as Pipeline). +message SequenceNode { + repeated ASTNode steps = 1; +} + +// ParallelNode fans steps out concurrently. +// When fail_fast = true a single error cancels the remaining goroutines. +message ParallelNode { + repeated ASTNode steps = 1; + bool fail_fast = 2; +} + +// ConditionalNode evaluates a runtime predicate and executes exactly one branch. +message ConditionalNode { + Predicate condition = 1; + ASTNode then_node = 2; + ASTNode else_node = 3; // optional — omit for pure guard +} + +// TryCatchNode executes try_node; on any error executes catch_node instead. +// Useful for compensating transactions and optional / best-effort steps. +message TryCatchNode { + ASTNode try_node = 1; + ASTNode catch_node = 2; +} + +// CheckpointNode persists the current execution position so retries skip +// completed steps. Uses the parent ASTNode.node_id as the checkpoint name. +message CheckpointNode {} + +// ───────────────────────────────────────────────────────────── +// Assertions +// ───────────────────────────────────────────────────────────── + +message AssertNode { + Predicate condition = 1; + string error_message = 2; +} + +// Predicate is a composable boolean expression resolved against live Krypton +// state at execution time. Core owns all state reads; the plugin only declares +// what must be true. +message Predicate { + oneof expr { + KeyExistsPredicate key_exists = 1; + KeyStatePredicate key_state = 2; + TenantActivePredicate tenant_active = 3; + CredentialExistsPredicate credential_exists = 4; + + // Logical combinators + AndPredicate and = 10; + OrPredicate or = 11; + NotPredicate not = 12; + } +} + +message KeyExistsPredicate { + ValueRef tier = 1; + ValueRef key_name = 2; +} + +message KeyStatePredicate { + ValueRef tier = 1; + ValueRef key_name = 2; + // allowed_states is an OR list — matches if the key is in ANY of these states. + // Valid values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, COMPROMISED, + // PENDING_DESTROYING, DESTROYED. + repeated string allowed_states = 3; +} + +message TenantActivePredicate { + ValueRef tenant_id = 1; +} + +message CredentialExistsPredicate { + ValueRef name = 1; +} + +message AndPredicate { repeated Predicate terms = 1; } +message OrPredicate { repeated Predicate terms = 1; } +message NotPredicate { Predicate term = 1; } + +// ───────────────────────────────────────────────────────────── +// Value references +// ───────────────────────────────────────────────────────────── + +// ValueRef resolves to a string at runtime. +// Use literal for constants known at plan time. +// Use var_ref to read a value set by a previous node's result_var or by +// ExecutionPlan.bindings. +message ValueRef { + oneof kind { + string literal = 1; + string var_ref = 2; + } +} + +// ───────────────────────────────────────────────────────────── +// Key lifecycle nodes +// ───────────────────────────────────────────────────────────── + +// KeySyncNode provisions a key at the given tier, or is a no-op if the key +// already exists (idempotent). Core wraps the key under parent_key using the +// configured tier hierarchy. On success, result_var receives the key ULID. +message KeySyncNode { + // tier is the Krypton tier name as declared in key-hierarchy config, + // e.g. "l2-domain", "l3-service", "l4-data". + ValueRef tier = 1; + // key_name is the logical name scoped to the tenant. + ValueRef key_name = 2; + // parent_key is the name of the wrapping key one tier above. + // Required for all tiers except L1 root keys. + ValueRef parent_key = 3; + // schedule, when set, is applied immediately after provisioning. + KeyScheduleSpec schedule = 4; + // metadata is attached to the key record after successful provisioning. + map metadata = 5; +} + +// KeyDeleteNode destroys key material and all version lineages. +// Core enforces that no child keys exist before allowing deletion. +message KeyDeleteNode { + ValueRef tier = 1; + ValueRef key_name = 2; +} + +// KeyTransitionNode explicitly moves a key to a target lifecycle state. +// Valid target_state values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, +// COMPROMISED, PENDING_DESTROYING, DESTROYED. +message KeyTransitionNode { + ValueRef tier = 1; + ValueRef key_name = 2; + string target_state = 3; +} + +// KeyRotateNode generates new key material under the same logical key name +// (forced rotation — bypasses the idempotency guard in ProvisionKey). +// On success, result_var receives the new key ULID. +message KeyRotateNode { + ValueRef tier = 1; + ValueRef key_name = 2; +} + +// KeyScheduleNode updates the scheduled lifecycle transition for an existing key. +message KeyScheduleNode { + ValueRef tier = 1; + ValueRef key_name = 2; + KeyScheduleSpec schedule = 3; +} + +// KeyScheduleSpec carries timing parameters for a scheduled state transition. +// All fields are optional — set only the ones you need. +message KeyScheduleSpec { + optional google.protobuf.Timestamp expires_at = 1; + optional google.protobuf.Timestamp scheduled_transition_at = 2; + // transition_to is the target KeyState when scheduled_transition_at fires. + optional string transition_to = 3; +} + +// ───────────────────────────────────────────────────────────── +// Credential lifecycle nodes +// ───────────────────────────────────────────────────────────── + +// CredentialSyncNode creates or updates a credential. +// spec is the full credential payload; core encrypts it using the tenant keyring. +message CredentialSyncNode { + ValueRef name = 1; + ValueRef type = 2; + google.protobuf.Struct spec = 3; +} + +// CredentialDeleteNode removes a credential record. +message CredentialDeleteNode { + ValueRef name = 1; +} + +// ───────────────────────────────────────────────────────────── +// Utility nodes +// ───────────────────────────────────────────────────────────── + +// BindNode sets a named variable in the execution state. +// Useful for deriving values from existing bindings before referencing them. +message BindNode { + string var_name = 1; + ValueRef value = 2; +} + +// EmitNode writes a structured event to Krypton's audit trail. +message EmitNode { + string event_type = 1; + map attributes = 2; +} diff --git a/proto/plugin/reconciler/v1/reconciler.pb.go b/proto/plugin/reconciler/v1/reconciler.pb.go new file mode 100644 index 0000000..0cb2ef3 --- /dev/null +++ b/proto/plugin/reconciler/v1/reconciler.pb.go @@ -0,0 +1,226 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc (unknown) +// source: plugin/reconciler/v1/reconciler.proto + +package reconcilerv1 + +import ( + reflect "reflect" + sync "sync" + unsafe "unsafe" + + _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// ReconcileRequest carries everything the plugin needs to plan operations for +// this resource. resource_payload is opaque to core and decoded only by the plugin. +type ReconcileRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // api_group identifies the resource type family, e.g. "mycompany.kms/v1". + ApiGroup string `protobuf:"bytes,2,opt,name=api_group,json=apiGroup,proto3" json:"api_group,omitempty"` + // resource_payload is the JSON-encoded extension_key Struct from the original + // SyncResourceRequest. Core passes it unchanged; the plugin owns the schema. + ResourcePayload []byte `protobuf:"bytes,3,opt,name=resource_payload,json=resourcePayload,proto3" json:"resource_payload,omitempty"` + // action is the operation requested: "SYNC" or "DELETE". + Action string `protobuf:"bytes,4,opt,name=action,proto3" json:"action,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReconcileRequest) Reset() { + *x = ReconcileRequest{} + mi := &file_plugin_reconciler_v1_reconciler_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReconcileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReconcileRequest) ProtoMessage() {} + +func (x *ReconcileRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_reconciler_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReconcileRequest.ProtoReflect.Descriptor instead. +func (*ReconcileRequest) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_reconciler_proto_rawDescGZIP(), []int{0} +} + +func (x *ReconcileRequest) GetApiGroup() string { + if x != nil { + return x.ApiGroup + } + return "" +} + +func (x *ReconcileRequest) GetResourcePayload() []byte { + if x != nil { + return x.ResourcePayload + } + return nil +} + +func (x *ReconcileRequest) GetAction() string { + if x != nil { + return x.Action + } + return "" +} + +// ReconcileResponse is returned by the plugin and contains the execution plan. +// Core decodes execution_plan as a JSON-encoded ast.ExecutionPlan and executes it. +type ReconcileResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // error_message non-empty means planning failed. + // transient_error = true → worker requeues up to max retries. + // transient_error = false → worker marks operation as terminally failed. + ErrorMessage string `protobuf:"bytes,1,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + TransientError bool `protobuf:"varint,2,opt,name=transient_error,json=transientError,proto3" json:"transient_error,omitempty"` + // execution_plan is a JSON-encoded ast.ExecutionPlan (see + // internal/modules/resource-reconciler/controller/ast). Empty means no-op. + ExecutionPlan []byte `protobuf:"bytes,3,opt,name=execution_plan,json=executionPlan,proto3" json:"execution_plan,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReconcileResponse) Reset() { + *x = ReconcileResponse{} + mi := &file_plugin_reconciler_v1_reconciler_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReconcileResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReconcileResponse) ProtoMessage() {} + +func (x *ReconcileResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_reconciler_v1_reconciler_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReconcileResponse.ProtoReflect.Descriptor instead. +func (*ReconcileResponse) Descriptor() ([]byte, []int) { + return file_plugin_reconciler_v1_reconciler_proto_rawDescGZIP(), []int{1} +} + +func (x *ReconcileResponse) GetErrorMessage() string { + if x != nil { + return x.ErrorMessage + } + return "" +} + +func (x *ReconcileResponse) GetTransientError() bool { + if x != nil { + return x.TransientError + } + return false +} + +func (x *ReconcileResponse) GetExecutionPlan() []byte { + if x != nil { + return x.ExecutionPlan + } + return nil +} + +var File_plugin_reconciler_v1_reconciler_proto protoreflect.FileDescriptor + +const file_plugin_reconciler_v1_reconciler_proto_rawDesc = "" + + "\n" + + "%plugin/reconciler/v1/reconciler.proto\x12\x15krypton.reconciler.v1\x1a\x1bbuf/validate/validate.proto\"\x90\x01\n" + + "\x10ReconcileRequest\x12#\n" + + "\tapi_group\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bapiGroup\x121\n" + + "\x10resource_payload\x18\x03 \x01(\fB\x06\xbaH\x03\xc8\x01\x01R\x0fresourcePayload\x12\x1e\n" + + "\x06action\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x06actionJ\x04\b\x01\x10\x02\"\x88\x01\n" + + "\x11ReconcileResponse\x12#\n" + + "\rerror_message\x18\x01 \x01(\tR\ferrorMessage\x12'\n" + + "\x0ftransient_error\x18\x02 \x01(\bR\x0etransientError\x12%\n" + + "\x0eexecution_plan\x18\x03 \x01(\fR\rexecutionPlan2l\n" + + "\n" + + "Reconciler\x12^\n" + + "\tReconcile\x12'.krypton.reconciler.v1.ReconcileRequest\x1a(.krypton.reconciler.v1.ReconcileResponseB\xe9\x01\n" + + "\x19com.krypton.reconciler.v1B\x0fReconcilerProtoP\x01ZEgithub.com/openkcm/plugin-sdk/proto/plugin/reconciler/v1;reconcilerv1\xa2\x02\x03KRX\xaa\x02\x15Krypton.Reconciler.V1\xca\x02\x15Krypton\\Reconciler\\V1\xe2\x02!Krypton\\Reconciler\\V1\\GPBMetadata\xea\x02\x17Krypton::Reconciler::V1b\x06proto3" + +var ( + file_plugin_reconciler_v1_reconciler_proto_rawDescOnce sync.Once + file_plugin_reconciler_v1_reconciler_proto_rawDescData []byte +) + +func file_plugin_reconciler_v1_reconciler_proto_rawDescGZIP() []byte { + file_plugin_reconciler_v1_reconciler_proto_rawDescOnce.Do(func() { + file_plugin_reconciler_v1_reconciler_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_reconciler_v1_reconciler_proto_rawDesc), len(file_plugin_reconciler_v1_reconciler_proto_rawDesc))) + }) + return file_plugin_reconciler_v1_reconciler_proto_rawDescData +} + +var file_plugin_reconciler_v1_reconciler_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_plugin_reconciler_v1_reconciler_proto_goTypes = []any{ + (*ReconcileRequest)(nil), // 0: krypton.reconciler.v1.ReconcileRequest + (*ReconcileResponse)(nil), // 1: krypton.reconciler.v1.ReconcileResponse +} +var file_plugin_reconciler_v1_reconciler_proto_depIdxs = []int32{ + 0, // 0: krypton.reconciler.v1.Reconciler.Reconcile:input_type -> krypton.reconciler.v1.ReconcileRequest + 1, // 1: krypton.reconciler.v1.Reconciler.Reconcile:output_type -> krypton.reconciler.v1.ReconcileResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_plugin_reconciler_v1_reconciler_proto_init() } +func file_plugin_reconciler_v1_reconciler_proto_init() { + if File_plugin_reconciler_v1_reconciler_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_reconciler_v1_reconciler_proto_rawDesc), len(file_plugin_reconciler_v1_reconciler_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_plugin_reconciler_v1_reconciler_proto_goTypes, + DependencyIndexes: file_plugin_reconciler_v1_reconciler_proto_depIdxs, + MessageInfos: file_plugin_reconciler_v1_reconciler_proto_msgTypes, + }.Build() + File_plugin_reconciler_v1_reconciler_proto = out.File + file_plugin_reconciler_v1_reconciler_proto_goTypes = nil + file_plugin_reconciler_v1_reconciler_proto_depIdxs = nil +} diff --git a/proto/plugin/reconciler/v1/reconciler.pb.validate.go b/proto/plugin/reconciler/v1/reconciler.pb.validate.go new file mode 100644 index 0000000..fac080e --- /dev/null +++ b/proto/plugin/reconciler/v1/reconciler.pb.validate.go @@ -0,0 +1,250 @@ +// Code generated by protoc-gen-validate. DO NOT EDIT. +// source: plugin/reconciler/v1/reconciler.proto + +package reconcilerv1 + +import ( + "bytes" + "errors" + "fmt" + "net" + "net/mail" + "net/url" + "regexp" + "sort" + "strings" + "time" + "unicode/utf8" + + "google.golang.org/protobuf/types/known/anypb" +) + +// ensure the imports are used +var ( + _ = bytes.MinRead + _ = errors.New("") + _ = fmt.Print + _ = utf8.UTFMax + _ = (*regexp.Regexp)(nil) + _ = (*strings.Reader)(nil) + _ = net.IPv4len + _ = time.Duration(0) + _ = (*url.URL)(nil) + _ = (*mail.Address)(nil) + _ = anypb.Any{} + _ = sort.Sort +) + +// Validate checks the field values on ReconcileRequest with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ReconcileRequest) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ReconcileRequest with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ReconcileRequestMultiError, or nil if none found. +func (m *ReconcileRequest) ValidateAll() error { + return m.validate(true) +} + +func (m *ReconcileRequest) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for ApiGroup + + // no validation rules for ResourcePayload + + // no validation rules for Action + + if len(errors) > 0 { + return ReconcileRequestMultiError(errors) + } + + return nil +} + +// ReconcileRequestMultiError is an error wrapping multiple validation errors +// returned by ReconcileRequest.ValidateAll() if the designated constraints +// aren't met. +type ReconcileRequestMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReconcileRequestMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ReconcileRequestMultiError) AllErrors() []error { return m } + +// ReconcileRequestValidationError is the validation error returned by +// ReconcileRequest.Validate if the designated constraints aren't met. +type ReconcileRequestValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ReconcileRequestValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ReconcileRequestValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ReconcileRequestValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ReconcileRequestValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ReconcileRequestValidationError) ErrorName() string { return "ReconcileRequestValidationError" } + +// Error satisfies the builtin error interface +func (e ReconcileRequestValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sReconcileRequest.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ReconcileRequestValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ReconcileRequestValidationError{} + +// Validate checks the field values on ReconcileResponse with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ReconcileResponse) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ReconcileResponse with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ReconcileResponseMultiError, or nil if none found. +func (m *ReconcileResponse) ValidateAll() error { + return m.validate(true) +} + +func (m *ReconcileResponse) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for ErrorMessage + + // no validation rules for TransientError + + // no validation rules for ExecutionPlan + + if len(errors) > 0 { + return ReconcileResponseMultiError(errors) + } + + return nil +} + +// ReconcileResponseMultiError is an error wrapping multiple validation errors +// returned by ReconcileResponse.ValidateAll() if the designated constraints +// aren't met. +type ReconcileResponseMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ReconcileResponseMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ReconcileResponseMultiError) AllErrors() []error { return m } + +// ReconcileResponseValidationError is the validation error returned by +// ReconcileResponse.Validate if the designated constraints aren't met. +type ReconcileResponseValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ReconcileResponseValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ReconcileResponseValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ReconcileResponseValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ReconcileResponseValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ReconcileResponseValidationError) ErrorName() string { + return "ReconcileResponseValidationError" +} + +// Error satisfies the builtin error interface +func (e ReconcileResponseValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sReconcileResponse.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ReconcileResponseValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ReconcileResponseValidationError{} diff --git a/proto/plugin/reconciler/v1/reconciler.proto b/proto/plugin/reconciler/v1/reconciler.proto new file mode 100644 index 0000000..1fab7f2 --- /dev/null +++ b/proto/plugin/reconciler/v1/reconciler.proto @@ -0,0 +1,49 @@ +syntax = "proto3"; + +package krypton.reconciler.v1; + +import "buf/validate/validate.proto"; + +option go_package = "github.com/openkcm/krypton/proto/plugin/reconciler/v1;reconcilerv1"; + +// Reconciler is the gRPC contract between Krypton core and an external +// reconciler plugin. Core is the client; the plugin binary is the server. +// +// The plugin receives the raw extension payload for a custom resource kind +// and returns an ExecutionPlan (AST) describing every key operation Krypton +// must perform. The plugin never touches keys or state directly — it only +// declares intent via the JSON-encoded AST. Core is the sole executor. +service Reconciler { + rpc Reconcile(ReconcileRequest) returns (ReconcileResponse); +} + +// ReconcileRequest carries everything the plugin needs to plan operations for +// this resource. resource_payload is opaque to core and decoded only by the plugin. +message ReconcileRequest { + reserved 1; + + // api_group identifies the resource type family, e.g. "mycompany.kms/v1". + string api_group = 2 [(buf.validate.field).required = true]; + + // resource_payload is the JSON-encoded extension_key Struct from the original + // SyncResourceRequest. Core passes it unchanged; the plugin owns the schema. + bytes resource_payload = 3 [(buf.validate.field).required = true]; + + // action is the operation requested: "SYNC" or "DELETE". + string action = 4 [(buf.validate.field).required = true]; +} + +// ReconcileResponse is returned by the plugin and contains the execution plan. +// Core decodes execution_plan as a JSON-encoded ast.ExecutionPlan and executes it. +message ReconcileResponse { + // error_message non-empty means planning failed. + // transient_error = true → worker requeues up to max retries. + // transient_error = false → worker marks operation as terminally failed. + string error_message = 1; + bool transient_error = 2; + + // execution_plan is a JSON-encoded ast.ExecutionPlan (see + // internal/modules/resource-reconciler/controller/ast). Empty means no-op. + bytes execution_plan = 3; +} + diff --git a/proto/plugin/reconciler/v1/reconciler_ext_plugin.pb.go b/proto/plugin/reconciler/v1/reconciler_ext_plugin.pb.go new file mode 100644 index 0000000..0156472 --- /dev/null +++ b/proto/plugin/reconciler/v1/reconciler_ext_plugin.pb.go @@ -0,0 +1,56 @@ +// Code generated by protoc-gen-go-extension. DO NOT EDIT. + +package reconcilerv1 + +import ( + grpc "google.golang.org/grpc" + + api "github.com/openkcm/plugin-sdk/api" +) + +const ( + Type = "Reconciler" + GRPCServiceFullName = "krypton.reconciler.v1.Reconciler" +) + +func ReconcilerPluginServer(server ReconcilerServer) api.PluginServer { + return reconcilerPluginServer{ReconcilerServer: server} +} + +type reconcilerPluginServer struct { + ReconcilerServer +} + +func (s reconcilerPluginServer) Type() string { + return Type +} + +func (s reconcilerPluginServer) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (s reconcilerPluginServer) RegisterServer(server *grpc.Server) any { + RegisterReconcilerServer(server, s.ReconcilerServer) + return s.ReconcilerServer +} + +type ReconcilerPluginClient struct { + ReconcilerClient +} + +func (s ReconcilerPluginClient) Type() string { + return Type +} + +func (c *ReconcilerPluginClient) IsInitialized() bool { + return c.ReconcilerClient != nil +} + +func (c *ReconcilerPluginClient) GRPCServiceName() string { + return GRPCServiceFullName +} + +func (c *ReconcilerPluginClient) InitClient(conn grpc.ClientConnInterface) any { + c.ReconcilerClient = NewReconcilerClient(conn) + return c.ReconcilerClient +} diff --git a/proto/plugin/reconciler/v1/reconciler_grpc.pb.go b/proto/plugin/reconciler/v1/reconciler_grpc.pb.go new file mode 100644 index 0000000..79018ae --- /dev/null +++ b/proto/plugin/reconciler/v1/reconciler_grpc.pb.go @@ -0,0 +1,138 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc (unknown) +// source: plugin/reconciler/v1/reconciler.proto + +package reconcilerv1 + +import ( + context "context" + + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Reconciler_Reconcile_FullMethodName = "/krypton.reconciler.v1.Reconciler/Reconcile" +) + +// ReconcilerClient is the client API for Reconciler service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Reconciler is the gRPC contract between Krypton core and an external +// reconciler plugin. Core is the client; the plugin binary is the server. +// +// The plugin receives the raw extension payload for a custom resource kind +// and returns an ExecutionPlan (AST) describing every key operation Krypton +// must perform. The plugin never touches keys or state directly — it only +// declares intent via the JSON-encoded AST. Core is the sole executor. +type ReconcilerClient interface { + Reconcile(ctx context.Context, in *ReconcileRequest, opts ...grpc.CallOption) (*ReconcileResponse, error) +} + +type reconcilerClient struct { + cc grpc.ClientConnInterface +} + +func NewReconcilerClient(cc grpc.ClientConnInterface) ReconcilerClient { + return &reconcilerClient{cc} +} + +func (c *reconcilerClient) Reconcile(ctx context.Context, in *ReconcileRequest, opts ...grpc.CallOption) (*ReconcileResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReconcileResponse) + err := c.cc.Invoke(ctx, Reconciler_Reconcile_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ReconcilerServer is the server API for Reconciler service. +// All implementations must embed UnimplementedReconcilerServer +// for forward compatibility. +// +// Reconciler is the gRPC contract between Krypton core and an external +// reconciler plugin. Core is the client; the plugin binary is the server. +// +// The plugin receives the raw extension payload for a custom resource kind +// and returns an ExecutionPlan (AST) describing every key operation Krypton +// must perform. The plugin never touches keys or state directly — it only +// declares intent via the JSON-encoded AST. Core is the sole executor. +type ReconcilerServer interface { + Reconcile(context.Context, *ReconcileRequest) (*ReconcileResponse, error) + mustEmbedUnimplementedReconcilerServer() +} + +// UnimplementedReconcilerServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedReconcilerServer struct{} + +func (UnimplementedReconcilerServer) Reconcile(context.Context, *ReconcileRequest) (*ReconcileResponse, error) { + return nil, status.Error(codes.Unimplemented, "method Reconcile not implemented") +} +func (UnimplementedReconcilerServer) mustEmbedUnimplementedReconcilerServer() {} +func (UnimplementedReconcilerServer) testEmbeddedByValue() {} + +// UnsafeReconcilerServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ReconcilerServer will +// result in compilation errors. +type UnsafeReconcilerServer interface { + mustEmbedUnimplementedReconcilerServer() +} + +func RegisterReconcilerServer(s grpc.ServiceRegistrar, srv ReconcilerServer) { + // If the following call panics, it indicates UnimplementedReconcilerServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&Reconciler_ServiceDesc, srv) +} + +func _Reconciler_Reconcile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReconcileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ReconcilerServer).Reconcile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Reconciler_Reconcile_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ReconcilerServer).Reconcile(ctx, req.(*ReconcileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// Reconciler_ServiceDesc is the grpc.ServiceDesc for Reconciler service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Reconciler_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "krypton.reconciler.v1.Reconciler", + HandlerType: (*ReconcilerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Reconcile", + Handler: _Reconciler_Reconcile_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "plugin/reconciler/v1/reconciler.proto", +} diff --git a/proto/plugin/systeminformation/v1/systeminformation_ext_plugin.pb.go b/proto/plugin/systeminformation/v1/systeminformation_ext_plugin.pb.go index b2cb7a4..ed262bd 100644 --- a/proto/plugin/systeminformation/v1/systeminformation_ext_plugin.pb.go +++ b/proto/plugin/systeminformation/v1/systeminformation_ext_plugin.pb.go @@ -9,7 +9,7 @@ import ( ) const ( - Type = "SystemInformationService" + Type = "SystemInformation" GRPCServiceFullName = "plugin.systeminformation.v1.SystemInformationService" ) diff --git a/proto/plugin/test/v1/test_ext_plugin.pb.go b/proto/plugin/test/v1/test_ext_plugin.pb.go index c51e1b9..bac0b2f 100644 --- a/proto/plugin/test/v1/test_ext_plugin.pb.go +++ b/proto/plugin/test/v1/test_ext_plugin.pb.go @@ -9,7 +9,7 @@ import ( ) const ( - Type = "TestService" + Type = "Test" GRPCServiceFullName = "plugin.test.v1.TestService" ) From 3c4a6be3704969157fb2b57574b7bc266860d191 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Wed, 20 May 2026 13:26:19 +0200 Subject: [PATCH 17/27] modify --- proto/plugin/reconciler/v1/reconciler.pb.go | 32 +++++++++++++++---- .../reconciler/v1/reconciler.pb.validate.go | 4 +++ proto/plugin/reconciler/v1/reconciler.proto | 12 ++++--- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/proto/plugin/reconciler/v1/reconciler.pb.go b/proto/plugin/reconciler/v1/reconciler.pb.go index 0cb2ef3..903b94a 100644 --- a/proto/plugin/reconciler/v1/reconciler.pb.go +++ b/proto/plugin/reconciler/v1/reconciler.pb.go @@ -28,12 +28,14 @@ const ( type ReconcileRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // api_group identifies the resource type family, e.g. "mycompany.kms/v1". - ApiGroup string `protobuf:"bytes,2,opt,name=api_group,json=apiGroup,proto3" json:"api_group,omitempty"` + ApiGroup string `protobuf:"bytes,1,opt,name=api_group,json=apiGroup,proto3" json:"api_group,omitempty"` + Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` // resource_payload is the JSON-encoded extension_key Struct from the original // SyncResourceRequest. Core passes it unchanged; the plugin owns the schema. - ResourcePayload []byte `protobuf:"bytes,3,opt,name=resource_payload,json=resourcePayload,proto3" json:"resource_payload,omitempty"` + ResourcePayload []byte `protobuf:"bytes,4,opt,name=resource_payload,json=resourcePayload,proto3" json:"resource_payload,omitempty"` // action is the operation requested: "SYNC" or "DELETE". - Action string `protobuf:"bytes,4,opt,name=action,proto3" json:"action,omitempty"` + Action string `protobuf:"bytes,5,opt,name=action,proto3" json:"action,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -75,6 +77,20 @@ func (x *ReconcileRequest) GetApiGroup() string { return "" } +func (x *ReconcileRequest) GetKind() string { + if x != nil { + return x.Kind + } + return "" +} + +func (x *ReconcileRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + func (x *ReconcileRequest) GetResourcePayload() []byte { if x != nil { return x.ResourcePayload @@ -160,11 +176,13 @@ var File_plugin_reconciler_v1_reconciler_proto protoreflect.FileDescriptor const file_plugin_reconciler_v1_reconciler_proto_rawDesc = "" + "\n" + - "%plugin/reconciler/v1/reconciler.proto\x12\x15krypton.reconciler.v1\x1a\x1bbuf/validate/validate.proto\"\x90\x01\n" + + "%plugin/reconciler/v1/reconciler.proto\x12\x15krypton.reconciler.v1\x1a\x1bbuf/validate/validate.proto\"\xc2\x01\n" + "\x10ReconcileRequest\x12#\n" + - "\tapi_group\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bapiGroup\x121\n" + - "\x10resource_payload\x18\x03 \x01(\fB\x06\xbaH\x03\xc8\x01\x01R\x0fresourcePayload\x12\x1e\n" + - "\x06action\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x06actionJ\x04\b\x01\x10\x02\"\x88\x01\n" + + "\tapi_group\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bapiGroup\x12\x1a\n" + + "\x04kind\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x04kind\x12\x1a\n" + + "\x04name\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x04name\x121\n" + + "\x10resource_payload\x18\x04 \x01(\fB\x06\xbaH\x03\xc8\x01\x01R\x0fresourcePayload\x12\x1e\n" + + "\x06action\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x06action\"\x88\x01\n" + "\x11ReconcileResponse\x12#\n" + "\rerror_message\x18\x01 \x01(\tR\ferrorMessage\x12'\n" + "\x0ftransient_error\x18\x02 \x01(\bR\x0etransientError\x12%\n" + diff --git a/proto/plugin/reconciler/v1/reconciler.pb.validate.go b/proto/plugin/reconciler/v1/reconciler.pb.validate.go index fac080e..17b68f1 100644 --- a/proto/plugin/reconciler/v1/reconciler.pb.validate.go +++ b/proto/plugin/reconciler/v1/reconciler.pb.validate.go @@ -59,6 +59,10 @@ func (m *ReconcileRequest) validate(all bool) error { // no validation rules for ApiGroup + // no validation rules for Kind + + // no validation rules for Name + // no validation rules for ResourcePayload // no validation rules for Action diff --git a/proto/plugin/reconciler/v1/reconciler.proto b/proto/plugin/reconciler/v1/reconciler.proto index 1fab7f2..1e10d1d 100644 --- a/proto/plugin/reconciler/v1/reconciler.proto +++ b/proto/plugin/reconciler/v1/reconciler.proto @@ -20,17 +20,19 @@ service Reconciler { // ReconcileRequest carries everything the plugin needs to plan operations for // this resource. resource_payload is opaque to core and decoded only by the plugin. message ReconcileRequest { - reserved 1; - // api_group identifies the resource type family, e.g. "mycompany.kms/v1". - string api_group = 2 [(buf.validate.field).required = true]; + string api_group = 1 [(buf.validate.field).required = true]; + + string kind = 2 [(buf.validate.field).required = true]; + + string name = 3 [(buf.validate.field).required = true]; // resource_payload is the JSON-encoded extension_key Struct from the original // SyncResourceRequest. Core passes it unchanged; the plugin owns the schema. - bytes resource_payload = 3 [(buf.validate.field).required = true]; + bytes resource_payload = 4 [(buf.validate.field).required = true]; // action is the operation requested: "SYNC" or "DELETE". - string action = 4 [(buf.validate.field).required = true]; + string action = 5 [(buf.validate.field).required = true]; } // ReconcileResponse is returned by the plugin and contains the execution plan. From ac8210d85bc28adc099b9b3c8a477f9445758077 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Wed, 20 May 2026 14:11:27 +0200 Subject: [PATCH 18/27] modify --- .../cipher_wrapper/v1/cipher_wrapper.pb.go | 70 +- .../cipher_wrapper/v1/cipher_wrapper.proto | 2 +- .../v1/cipher_wrapper_ext_plugin.pb.go | 2 +- .../v1/cipher_wrapper_grpc.pb.go | 6 +- .../v1/key_material_storage.pb.go | 114 ++-- .../v1/key_material_storage.proto | 2 +- .../v1/key_material_storage_ext_plugin.pb.go | 2 +- .../v1/key_material_storage_grpc.pb.go | 10 +- proto/plugin/llm/v1/llm.pb.go | 62 +- proto/plugin/llm/v1/llm.proto | 4 +- proto/plugin/llm/v1/llm_ext_plugin.pb.go | 2 +- proto/plugin/llm/v1/llm_grpc.pb.go | 6 +- .../{reconciler => resources}/v1/ast.pb.go | 605 +++++++++--------- .../v1/ast.pb.validate.go | 2 +- .../{reconciler => resources}/v1/ast.proto | 4 +- .../v1/reconciler.pb.go | 74 +-- .../v1/reconciler.pb.validate.go | 2 +- .../v1/reconciler.proto | 3 +- .../v1/reconciler_ext_plugin.pb.go | 2 +- .../v1/reconciler_grpc.pb.go | 8 +- 20 files changed, 489 insertions(+), 493 deletions(-) rename proto/plugin/{reconciler => resources}/v1/ast.pb.go (67%) rename proto/plugin/{reconciler => resources}/v1/ast.pb.validate.go (99%) rename proto/plugin/{reconciler => resources}/v1/ast.proto (98%) rename proto/plugin/{reconciler => resources}/v1/reconciler.pb.go (65%) rename proto/plugin/{reconciler => resources}/v1/reconciler.pb.validate.go (99%) rename proto/plugin/{reconciler => resources}/v1/reconciler.proto (94%) rename proto/plugin/{reconciler => resources}/v1/reconciler_ext_plugin.pb.go (94%) rename proto/plugin/{reconciler => resources}/v1/reconciler_grpc.pb.go (95%) diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go index 5381580..094f23d 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go @@ -369,25 +369,25 @@ var File_plugin_cipher_wrapper_v1_cipher_wrapper_proto protoreflect.FileDescript const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\n" + - "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12\x19krypton.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\xe8\x01\n" + + "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12 krypton.plugin.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\xef\x01\n" + "\fKeyReference\x12\x15\n" + "\x06key_id\x18\x01 \x01(\tR\x05keyId\x12\x1d\n" + - "\aversion\x18\x02 \x01(\tH\x00R\aversion\x88\x01\x01\x12W\n" + + "\aversion\x18\x02 \x01(\tH\x00R\aversion\x88\x01\x01\x12^\n" + "\n" + - "properties\x18\x03 \x03(\v27.krypton.cipher_wrapper.v1.KeyReference.PropertiesEntryR\n" + + "properties\x18\x03 \x03(\v2>.krypton.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntryR\n" + "properties\x1a=\n" + "\x0fPropertiesEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\n" + "\n" + - "\b_version\"\xde\x02\n" + - "\vWrapRequest\x12A\n" + - "\x03key\x18\x01 \x01(\v2'.krypton.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12(\n" + + "\b_version\"\xec\x02\n" + + "\vWrapRequest\x12H\n" + + "\x03key\x18\x01 \x01(\v2..krypton.plugin.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12(\n" + "\tplaintext\x18\x02 \x01(\fB\n" + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\tplaintext\x12\x15\n" + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12d\n" + - "\x0fdynamic_context\x18\x84\a \x03(\v2:.krypton.cipher_wrapper.v1.WrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + + "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12k\n" + + "\x0fdynamic_context\x18\x84\a \x03(\v2A.krypton.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + "\x13DynamicContextEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + @@ -400,27 +400,27 @@ const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\x0ekey_version_id\x18\x02 \x01(\tH\x00R\fkeyVersionId\x88\x01\x01\x12\x13\n" + "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01B\x11\n" + "\x0f_key_version_idB\x05\n" + - "\x03_iv\"\xe4\x02\n" + - "\rUnwrapRequest\x12A\n" + - "\x03key\x18\x01 \x01(\v2'.krypton.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12*\n" + + "\x03_iv\"\xf2\x02\n" + + "\rUnwrapRequest\x12H\n" + + "\x03key\x18\x01 \x01(\v2..krypton.plugin.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12*\n" + "\n" + "ciphertext\x18\x02 \x01(\fB\n" + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\n" + "ciphertext\x12\x15\n" + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12f\n" + - "\x0fdynamic_context\x18\x84\a \x03(\v2<.krypton.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + + "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12m\n" + + "\x0fdynamic_context\x18\x84\a \x03(\v2C.krypton.plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + "\x13DynamicContextEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + "\x04_aadB\x05\n" + "\x03_iv\".\n" + "\x0eUnwrapResponse\x12\x1c\n" + - "\tplaintext\x18\x01 \x01(\fR\tplaintext2\xc7\x01\n" + - "\rCipherWrapper\x12W\n" + - "\x04Wrap\x12&.krypton.cipher_wrapper.v1.WrapRequest\x1a'.krypton.cipher_wrapper.v1.WrapResponse\x12]\n" + - "\x06Unwrap\x12(.krypton.cipher_wrapper.v1.UnwrapRequest\x1a).krypton.cipher_wrapper.v1.UnwrapResponseB\x84\x02\n" + - "\x1dcom.krypton.cipher_wrapper.v1B\x12CipherWrapperProtoP\x01ZMgithub.com/openkcm/plugin-sdk/proto/plugin/cipher_wrapper/v1;cipher_wrapperv1\xa2\x02\x03KCX\xaa\x02\x18Krypton.CipherWrapper.V1\xca\x02\x18Krypton\\CipherWrapper\\V1\xe2\x02$Krypton\\CipherWrapper\\V1\\GPBMetadata\xea\x02\x1aKrypton::CipherWrapper::V1b\x06proto3" + "\tplaintext\x18\x01 \x01(\fR\tplaintext2\xe3\x01\n" + + "\rCipherWrapper\x12e\n" + + "\x04Wrap\x12-.krypton.plugin.cipher_wrapper.v1.WrapRequest\x1a..krypton.plugin.cipher_wrapper.v1.WrapResponse\x12k\n" + + "\x06Unwrap\x12/.krypton.plugin.cipher_wrapper.v1.UnwrapRequest\x1a0.krypton.plugin.cipher_wrapper.v1.UnwrapResponseB\xa8\x02\n" + + "$com.krypton.plugin.cipher_wrapper.v1B\x12CipherWrapperProtoP\x01ZMgithub.com/openkcm/plugin-sdk/proto/plugin/cipher_wrapper/v1;cipher_wrapperv1\xa2\x02\x03KPC\xaa\x02\x1fKrypton.Plugin.CipherWrapper.V1\xca\x02\x1fKrypton\\Plugin\\CipherWrapper\\V1\xe2\x02+Krypton\\Plugin\\CipherWrapper\\V1\\GPBMetadata\xea\x02\"Krypton::Plugin::CipherWrapper::V1b\x06proto3" var ( file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescOnce sync.Once @@ -436,25 +436,25 @@ func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP() []byte { var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_goTypes = []any{ - (*KeyReference)(nil), // 0: krypton.cipher_wrapper.v1.KeyReference - (*WrapRequest)(nil), // 1: krypton.cipher_wrapper.v1.WrapRequest - (*WrapResponse)(nil), // 2: krypton.cipher_wrapper.v1.WrapResponse - (*UnwrapRequest)(nil), // 3: krypton.cipher_wrapper.v1.UnwrapRequest - (*UnwrapResponse)(nil), // 4: krypton.cipher_wrapper.v1.UnwrapResponse - nil, // 5: krypton.cipher_wrapper.v1.KeyReference.PropertiesEntry - nil, // 6: krypton.cipher_wrapper.v1.WrapRequest.DynamicContextEntry - nil, // 7: krypton.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry + (*KeyReference)(nil), // 0: krypton.plugin.cipher_wrapper.v1.KeyReference + (*WrapRequest)(nil), // 1: krypton.plugin.cipher_wrapper.v1.WrapRequest + (*WrapResponse)(nil), // 2: krypton.plugin.cipher_wrapper.v1.WrapResponse + (*UnwrapRequest)(nil), // 3: krypton.plugin.cipher_wrapper.v1.UnwrapRequest + (*UnwrapResponse)(nil), // 4: krypton.plugin.cipher_wrapper.v1.UnwrapResponse + nil, // 5: krypton.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry + nil, // 6: krypton.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry + nil, // 7: krypton.plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry } var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_depIdxs = []int32{ - 5, // 0: krypton.cipher_wrapper.v1.KeyReference.properties:type_name -> krypton.cipher_wrapper.v1.KeyReference.PropertiesEntry - 0, // 1: krypton.cipher_wrapper.v1.WrapRequest.key:type_name -> krypton.cipher_wrapper.v1.KeyReference - 6, // 2: krypton.cipher_wrapper.v1.WrapRequest.dynamic_context:type_name -> krypton.cipher_wrapper.v1.WrapRequest.DynamicContextEntry - 0, // 3: krypton.cipher_wrapper.v1.UnwrapRequest.key:type_name -> krypton.cipher_wrapper.v1.KeyReference - 7, // 4: krypton.cipher_wrapper.v1.UnwrapRequest.dynamic_context:type_name -> krypton.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry - 1, // 5: krypton.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> krypton.cipher_wrapper.v1.WrapRequest - 3, // 6: krypton.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> krypton.cipher_wrapper.v1.UnwrapRequest - 2, // 7: krypton.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> krypton.cipher_wrapper.v1.WrapResponse - 4, // 8: krypton.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> krypton.cipher_wrapper.v1.UnwrapResponse + 5, // 0: krypton.plugin.cipher_wrapper.v1.KeyReference.properties:type_name -> krypton.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry + 0, // 1: krypton.plugin.cipher_wrapper.v1.WrapRequest.key:type_name -> krypton.plugin.cipher_wrapper.v1.KeyReference + 6, // 2: krypton.plugin.cipher_wrapper.v1.WrapRequest.dynamic_context:type_name -> krypton.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry + 0, // 3: krypton.plugin.cipher_wrapper.v1.UnwrapRequest.key:type_name -> krypton.plugin.cipher_wrapper.v1.KeyReference + 7, // 4: krypton.plugin.cipher_wrapper.v1.UnwrapRequest.dynamic_context:type_name -> krypton.plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry + 1, // 5: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> krypton.plugin.cipher_wrapper.v1.WrapRequest + 3, // 6: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> krypton.plugin.cipher_wrapper.v1.UnwrapRequest + 2, // 7: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> krypton.plugin.cipher_wrapper.v1.WrapResponse + 4, // 8: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> krypton.plugin.cipher_wrapper.v1.UnwrapResponse 7, // [7:9] is the sub-list for method output_type 5, // [5:7] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto index 2e7b9dc..cff1318 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package krypton.cipher_wrapper.v1; +package krypton.plugin.cipher_wrapper.v1; import "buf/validate/validate.proto"; diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go index ff7cecb..62dc7bc 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_ext_plugin.pb.go @@ -10,7 +10,7 @@ import ( const ( Type = "CipherWrapper" - GRPCServiceFullName = "krypton.cipher_wrapper.v1.CipherWrapper" + GRPCServiceFullName = "krypton.plugin.cipher_wrapper.v1.CipherWrapper" ) func CipherWrapperPluginServer(server CipherWrapperServer) api.PluginServer { diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go index 7f804a9..f805cd3 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper_grpc.pb.go @@ -20,8 +20,8 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - CipherWrapper_Wrap_FullMethodName = "/krypton.cipher_wrapper.v1.CipherWrapper/Wrap" - CipherWrapper_Unwrap_FullMethodName = "/krypton.cipher_wrapper.v1.CipherWrapper/Unwrap" + CipherWrapper_Wrap_FullMethodName = "/krypton.plugin.cipher_wrapper.v1.CipherWrapper/Wrap" + CipherWrapper_Unwrap_FullMethodName = "/krypton.plugin.cipher_wrapper.v1.CipherWrapper/Unwrap" ) // CipherWrapperClient is the client API for CipherWrapper service. @@ -159,7 +159,7 @@ func _CipherWrapper_Unwrap_Handler(srv interface{}, ctx context.Context, dec fun // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var CipherWrapper_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "krypton.cipher_wrapper.v1.CipherWrapper", + ServiceName: "krypton.plugin.cipher_wrapper.v1.CipherWrapper", HandlerType: (*CipherWrapperServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index efaf7ac..b7c0445 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -753,7 +753,7 @@ var File_plugin_key_material_storage_v1_key_material_storage_proto protoreflect. const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = "" + "\n" + - "9plugin/key_material_storage/v1/key_material_storage.proto\x12\x1fkrypton.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xa5\x03\n" + + "9plugin/key_material_storage/v1/key_material_storage.proto\x12&krypton.plugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xac\x03\n" + "\vKeyMaterial\x12\x17\n" + "\x02id\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\x12\x1b\n" + "\x04data\x18\x02 \x01(\fB\a\xbaH\x04z\x02\x10\x01R\x04data\x12%\n" + @@ -761,19 +761,19 @@ const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = " "\x13previous_version_id\x18\x04 \x01(\tH\x00R\x11previousVersionId\x88\x01\x01\x12\x1f\n" + "\bchecksum\x18\x05 \x01(\tH\x01R\bchecksum\x88\x01\x01\x129\n" + "\n" + - "created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x12J\n" + - "\x04tags\x18\a \x03(\v26.krypton.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + + "created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x12Q\n" + + "\x04tags\x18\a \x03(\v2=.krypton.plugin.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + "\tTagsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x16\n" + "\x14_previous_version_idB\v\n" + - "\t_checksum\"\xda\x04\n" + - "\x06Filter\x12H\n" + - "\x02id\x18\x01 \x01(\v23.krypton.key_material_storage.v1.Filter.StringMatchH\x00R\x02id\x88\x01\x01\x12!\n" + - "\talgorithm\x18\x02 \x01(\tH\x01R\talgorithm\x88\x01\x01\x12E\n" + - "\x04tags\x18\x03 \x03(\v21.krypton.key_material_storage.v1.Filter.TagsEntryR\x04tags\x12U\n" + + "\t_checksum\"\xef\x04\n" + + "\x06Filter\x12O\n" + + "\x02id\x18\x01 \x01(\v2:.krypton.plugin.key_material_storage.v1.Filter.StringMatchH\x00R\x02id\x88\x01\x01\x12!\n" + + "\talgorithm\x18\x02 \x01(\tH\x01R\talgorithm\x88\x01\x01\x12L\n" + + "\x04tags\x18\x03 \x03(\v28.krypton.plugin.key_material_storage.v1.Filter.TagsEntryR\x04tags\x12\\\n" + "\n" + - "created_at\x18\x04 \x01(\v21.krypton.key_material_storage.v1.Filter.TimeRangeH\x02R\tcreatedAt\x88\x01\x01\x1a\x7f\n" + + "created_at\x18\x04 \x01(\v28.krypton.plugin.key_material_storage.v1.Filter.TimeRangeH\x02R\tcreatedAt\x88\x01\x01\x1a\x7f\n" + "\vStringMatch\x12\x18\n" + "\x06prefix\x18\x01 \x01(\tH\x00R\x06prefix\x12\x18\n" + "\x06suffix\x18\x02 \x01(\tH\x00R\x06suffix\x12\x1c\n" + @@ -789,36 +789,36 @@ const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = " "\x03_idB\f\n" + "\n" + "_algorithmB\r\n" + - "\v_created_at\"\xc4\x01\n" + + "\v_created_at\"\xcb\x01\n" + "\x0eListIDsRequest\x12%\n" + - "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12D\n" + - "\x06filter\x18\x02 \x01(\v2'.krypton.key_material_storage.v1.FilterH\x00R\x06filter\x88\x01\x01\x12\x1b\n" + + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12K\n" + + "\x06filter\x18\x02 \x01(\v2..krypton.plugin.key_material_storage.v1.FilterH\x00R\x06filter\x88\x01\x01\x12\x1b\n" + "\tpage_size\x18\x03 \x01(\rR\bpageSize\x12\x1d\n" + "\n" + "page_token\x18\x04 \x01(\tR\tpageTokenB\t\n" + "\a_filter\"K\n" + "\x0fListIDsResponse\x12\x10\n" + "\x03ids\x18\x01 \x03(\tR\x03ids\x12&\n" + - "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x8e\x01\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\x95\x01\n" + "\fStoreRequest\x12%\n" + - "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12W\n" + - "\fkey_material\x18\x02 \x01(\v2,.krypton.key_material_storage.v1.KeyMaterialB\x06\xbaH\x03\xc8\x01\x01R\vkeyMaterial\"\x0f\n" + + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12^\n" + + "\fkey_material\x18\x02 \x01(\v23.krypton.plugin.key_material_storage.v1.KeyMaterialB\x06\xbaH\x03\xc8\x01\x01R\vkeyMaterial\"\x0f\n" + "\rStoreResponse\"M\n" + "\vLoadRequest\x12%\n" + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12\x17\n" + - "\x02id\x18\x02 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\"_\n" + - "\fLoadResponse\x12O\n" + - "\fkey_material\x18\x01 \x01(\v2,.krypton.key_material_storage.v1.KeyMaterialR\vkeyMaterial\"O\n" + + "\x02id\x18\x02 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\"f\n" + + "\fLoadResponse\x12V\n" + + "\fkey_material\x18\x01 \x01(\v23.krypton.plugin.key_material_storage.v1.KeyMaterialR\vkeyMaterial\"O\n" + "\rDeleteRequest\x12%\n" + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12\x17\n" + "\x02id\x18\x02 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\"\x10\n" + - "\x0eDeleteResponse2\xbc\x03\n" + - "\x12KeyMaterialStorage\x12f\n" + - "\x05Store\x12-.krypton.key_material_storage.v1.StoreRequest\x1a..krypton.key_material_storage.v1.StoreResponse\x12c\n" + - "\x04Load\x12,.krypton.key_material_storage.v1.LoadRequest\x1a-.krypton.key_material_storage.v1.LoadResponse\x12i\n" + - "\x06Delete\x12..krypton.key_material_storage.v1.DeleteRequest\x1a/.krypton.key_material_storage.v1.DeleteResponse\x12n\n" + - "\aListIDs\x12/.krypton.key_material_storage.v1.ListIDsRequest\x1a0.krypton.key_material_storage.v1.ListIDsResponse0\x01B\xaf\x02\n" + - "#com.krypton.key_material_storage.v1B\x17KeyMaterialStorageProtoP\x01ZYgithub.com/openkcm/plugin-sdk/proto/plugin/key_material_storage/v1;key_material_storagev1\xa2\x02\x03KKX\xaa\x02\x1dKrypton.KeyMaterialStorage.V1\xca\x02\x1dKrypton\\KeyMaterialStorage\\V1\xe2\x02)Krypton\\KeyMaterialStorage\\V1\\GPBMetadata\xea\x02\x1fKrypton::KeyMaterialStorage::V1b\x06proto3" + "\x0eDeleteResponse2\xf4\x03\n" + + "\x12KeyMaterialStorage\x12t\n" + + "\x05Store\x124.krypton.plugin.key_material_storage.v1.StoreRequest\x1a5.krypton.plugin.key_material_storage.v1.StoreResponse\x12q\n" + + "\x04Load\x123.krypton.plugin.key_material_storage.v1.LoadRequest\x1a4.krypton.plugin.key_material_storage.v1.LoadResponse\x12w\n" + + "\x06Delete\x125.krypton.plugin.key_material_storage.v1.DeleteRequest\x1a6.krypton.plugin.key_material_storage.v1.DeleteResponse\x12|\n" + + "\aListIDs\x126.krypton.plugin.key_material_storage.v1.ListIDsRequest\x1a7.krypton.plugin.key_material_storage.v1.ListIDsResponse0\x01B\xd3\x02\n" + + "*com.krypton.plugin.key_material_storage.v1B\x17KeyMaterialStorageProtoP\x01ZYgithub.com/openkcm/plugin-sdk/proto/plugin/key_material_storage/v1;key_material_storagev1\xa2\x02\x03KPK\xaa\x02$Krypton.Plugin.KeyMaterialStorage.V1\xca\x02$Krypton\\Plugin\\KeyMaterialStorage\\V1\xe2\x020Krypton\\Plugin\\KeyMaterialStorage\\V1\\GPBMetadata\xea\x02'Krypton::Plugin::KeyMaterialStorage::V1b\x06proto3" var ( file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescOnce sync.Once @@ -834,41 +834,41 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_rawDescGZIP( var file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_plugin_key_material_storage_v1_key_material_storage_proto_goTypes = []any{ - (*KeyMaterial)(nil), // 0: krypton.key_material_storage.v1.KeyMaterial - (*Filter)(nil), // 1: krypton.key_material_storage.v1.Filter - (*ListIDsRequest)(nil), // 2: krypton.key_material_storage.v1.ListIDsRequest - (*ListIDsResponse)(nil), // 3: krypton.key_material_storage.v1.ListIDsResponse - (*StoreRequest)(nil), // 4: krypton.key_material_storage.v1.StoreRequest - (*StoreResponse)(nil), // 5: krypton.key_material_storage.v1.StoreResponse - (*LoadRequest)(nil), // 6: krypton.key_material_storage.v1.LoadRequest - (*LoadResponse)(nil), // 7: krypton.key_material_storage.v1.LoadResponse - (*DeleteRequest)(nil), // 8: krypton.key_material_storage.v1.DeleteRequest - (*DeleteResponse)(nil), // 9: krypton.key_material_storage.v1.DeleteResponse - nil, // 10: krypton.key_material_storage.v1.KeyMaterial.TagsEntry - (*Filter_StringMatch)(nil), // 11: krypton.key_material_storage.v1.Filter.StringMatch - nil, // 12: krypton.key_material_storage.v1.Filter.TagsEntry - (*Filter_TimeRange)(nil), // 13: krypton.key_material_storage.v1.Filter.TimeRange + (*KeyMaterial)(nil), // 0: krypton.plugin.key_material_storage.v1.KeyMaterial + (*Filter)(nil), // 1: krypton.plugin.key_material_storage.v1.Filter + (*ListIDsRequest)(nil), // 2: krypton.plugin.key_material_storage.v1.ListIDsRequest + (*ListIDsResponse)(nil), // 3: krypton.plugin.key_material_storage.v1.ListIDsResponse + (*StoreRequest)(nil), // 4: krypton.plugin.key_material_storage.v1.StoreRequest + (*StoreResponse)(nil), // 5: krypton.plugin.key_material_storage.v1.StoreResponse + (*LoadRequest)(nil), // 6: krypton.plugin.key_material_storage.v1.LoadRequest + (*LoadResponse)(nil), // 7: krypton.plugin.key_material_storage.v1.LoadResponse + (*DeleteRequest)(nil), // 8: krypton.plugin.key_material_storage.v1.DeleteRequest + (*DeleteResponse)(nil), // 9: krypton.plugin.key_material_storage.v1.DeleteResponse + nil, // 10: krypton.plugin.key_material_storage.v1.KeyMaterial.TagsEntry + (*Filter_StringMatch)(nil), // 11: krypton.plugin.key_material_storage.v1.Filter.StringMatch + nil, // 12: krypton.plugin.key_material_storage.v1.Filter.TagsEntry + (*Filter_TimeRange)(nil), // 13: krypton.plugin.key_material_storage.v1.Filter.TimeRange (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp } var file_plugin_key_material_storage_v1_key_material_storage_proto_depIdxs = []int32{ - 14, // 0: krypton.key_material_storage.v1.KeyMaterial.created_at:type_name -> google.protobuf.Timestamp - 10, // 1: krypton.key_material_storage.v1.KeyMaterial.tags:type_name -> krypton.key_material_storage.v1.KeyMaterial.TagsEntry - 11, // 2: krypton.key_material_storage.v1.Filter.id:type_name -> krypton.key_material_storage.v1.Filter.StringMatch - 12, // 3: krypton.key_material_storage.v1.Filter.tags:type_name -> krypton.key_material_storage.v1.Filter.TagsEntry - 13, // 4: krypton.key_material_storage.v1.Filter.created_at:type_name -> krypton.key_material_storage.v1.Filter.TimeRange - 1, // 5: krypton.key_material_storage.v1.ListIDsRequest.filter:type_name -> krypton.key_material_storage.v1.Filter - 0, // 6: krypton.key_material_storage.v1.StoreRequest.key_material:type_name -> krypton.key_material_storage.v1.KeyMaterial - 0, // 7: krypton.key_material_storage.v1.LoadResponse.key_material:type_name -> krypton.key_material_storage.v1.KeyMaterial - 14, // 8: krypton.key_material_storage.v1.Filter.TimeRange.from:type_name -> google.protobuf.Timestamp - 14, // 9: krypton.key_material_storage.v1.Filter.TimeRange.to:type_name -> google.protobuf.Timestamp - 4, // 10: krypton.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> krypton.key_material_storage.v1.StoreRequest - 6, // 11: krypton.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> krypton.key_material_storage.v1.LoadRequest - 8, // 12: krypton.key_material_storage.v1.KeyMaterialStorage.Delete:input_type -> krypton.key_material_storage.v1.DeleteRequest - 2, // 13: krypton.key_material_storage.v1.KeyMaterialStorage.ListIDs:input_type -> krypton.key_material_storage.v1.ListIDsRequest - 5, // 14: krypton.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> krypton.key_material_storage.v1.StoreResponse - 7, // 15: krypton.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> krypton.key_material_storage.v1.LoadResponse - 9, // 16: krypton.key_material_storage.v1.KeyMaterialStorage.Delete:output_type -> krypton.key_material_storage.v1.DeleteResponse - 3, // 17: krypton.key_material_storage.v1.KeyMaterialStorage.ListIDs:output_type -> krypton.key_material_storage.v1.ListIDsResponse + 14, // 0: krypton.plugin.key_material_storage.v1.KeyMaterial.created_at:type_name -> google.protobuf.Timestamp + 10, // 1: krypton.plugin.key_material_storage.v1.KeyMaterial.tags:type_name -> krypton.plugin.key_material_storage.v1.KeyMaterial.TagsEntry + 11, // 2: krypton.plugin.key_material_storage.v1.Filter.id:type_name -> krypton.plugin.key_material_storage.v1.Filter.StringMatch + 12, // 3: krypton.plugin.key_material_storage.v1.Filter.tags:type_name -> krypton.plugin.key_material_storage.v1.Filter.TagsEntry + 13, // 4: krypton.plugin.key_material_storage.v1.Filter.created_at:type_name -> krypton.plugin.key_material_storage.v1.Filter.TimeRange + 1, // 5: krypton.plugin.key_material_storage.v1.ListIDsRequest.filter:type_name -> krypton.plugin.key_material_storage.v1.Filter + 0, // 6: krypton.plugin.key_material_storage.v1.StoreRequest.key_material:type_name -> krypton.plugin.key_material_storage.v1.KeyMaterial + 0, // 7: krypton.plugin.key_material_storage.v1.LoadResponse.key_material:type_name -> krypton.plugin.key_material_storage.v1.KeyMaterial + 14, // 8: krypton.plugin.key_material_storage.v1.Filter.TimeRange.from:type_name -> google.protobuf.Timestamp + 14, // 9: krypton.plugin.key_material_storage.v1.Filter.TimeRange.to:type_name -> google.protobuf.Timestamp + 4, // 10: krypton.plugin.key_material_storage.v1.KeyMaterialStorage.Store:input_type -> krypton.plugin.key_material_storage.v1.StoreRequest + 6, // 11: krypton.plugin.key_material_storage.v1.KeyMaterialStorage.Load:input_type -> krypton.plugin.key_material_storage.v1.LoadRequest + 8, // 12: krypton.plugin.key_material_storage.v1.KeyMaterialStorage.Delete:input_type -> krypton.plugin.key_material_storage.v1.DeleteRequest + 2, // 13: krypton.plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:input_type -> krypton.plugin.key_material_storage.v1.ListIDsRequest + 5, // 14: krypton.plugin.key_material_storage.v1.KeyMaterialStorage.Store:output_type -> krypton.plugin.key_material_storage.v1.StoreResponse + 7, // 15: krypton.plugin.key_material_storage.v1.KeyMaterialStorage.Load:output_type -> krypton.plugin.key_material_storage.v1.LoadResponse + 9, // 16: krypton.plugin.key_material_storage.v1.KeyMaterialStorage.Delete:output_type -> krypton.plugin.key_material_storage.v1.DeleteResponse + 3, // 17: krypton.plugin.key_material_storage.v1.KeyMaterialStorage.ListIDs:output_type -> krypton.plugin.key_material_storage.v1.ListIDsResponse 14, // [14:18] is the sub-list for method output_type 10, // [10:14] is the sub-list for method input_type 10, // [10:10] is the sub-list for extension type_name diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index f91cd0f..786f0a7 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package krypton.key_material_storage.v1; +package krypton.plugin.key_material_storage.v1; import "buf/validate/validate.proto"; import "google/protobuf/timestamp.proto"; diff --git a/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go index b8aa587..fbb9f20 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage_ext_plugin.pb.go @@ -10,7 +10,7 @@ import ( const ( Type = "KeyMaterialStorage" - GRPCServiceFullName = "krypton.key_material_storage.v1.KeyMaterialStorage" + GRPCServiceFullName = "krypton.plugin.key_material_storage.v1.KeyMaterialStorage" ) func KeyMaterialStoragePluginServer(server KeyMaterialStorageServer) api.PluginServer { diff --git a/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go index ec594a0..064b571 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage_grpc.pb.go @@ -20,10 +20,10 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - KeyMaterialStorage_Store_FullMethodName = "/krypton.key_material_storage.v1.KeyMaterialStorage/Store" - KeyMaterialStorage_Load_FullMethodName = "/krypton.key_material_storage.v1.KeyMaterialStorage/Load" - KeyMaterialStorage_Delete_FullMethodName = "/krypton.key_material_storage.v1.KeyMaterialStorage/Delete" - KeyMaterialStorage_ListIDs_FullMethodName = "/krypton.key_material_storage.v1.KeyMaterialStorage/ListIDs" + KeyMaterialStorage_Store_FullMethodName = "/krypton.plugin.key_material_storage.v1.KeyMaterialStorage/Store" + KeyMaterialStorage_Load_FullMethodName = "/krypton.plugin.key_material_storage.v1.KeyMaterialStorage/Load" + KeyMaterialStorage_Delete_FullMethodName = "/krypton.plugin.key_material_storage.v1.KeyMaterialStorage/Delete" + KeyMaterialStorage_ListIDs_FullMethodName = "/krypton.plugin.key_material_storage.v1.KeyMaterialStorage/ListIDs" ) // KeyMaterialStorageClient is the client API for KeyMaterialStorage service. @@ -221,7 +221,7 @@ type KeyMaterialStorage_ListIDsServer = grpc.ServerStreamingServer[ListIDsRespon // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var KeyMaterialStorage_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "krypton.key_material_storage.v1.KeyMaterialStorage", + ServiceName: "krypton.plugin.key_material_storage.v1.KeyMaterialStorage", HandlerType: (*KeyMaterialStorageServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/proto/plugin/llm/v1/llm.pb.go b/proto/plugin/llm/v1/llm.pb.go index d067a63..084794d 100644 --- a/proto/plugin/llm/v1/llm.pb.go +++ b/proto/plugin/llm/v1/llm.pb.go @@ -344,35 +344,35 @@ var File_plugin_llm_v1_llm_proto protoreflect.FileDescriptor const file_plugin_llm_v1_llm_proto_rawDesc = "" + "\n" + - "\x17plugin/llm/v1/llm.proto\x12\x0ekrypton.llm.v1\"\xac\x02\n" + + "\x17plugin/llm/v1/llm.proto\x12\x15krypton.plugin.llm.v1\"\xb3\x02\n" + "\x0eFindingSummary\x12\x1a\n" + "\bcategory\x18\x01 \x01(\tR\bcategory\x12\x1a\n" + "\bseverity\x18\x02 \x01(\tR\bseverity\x12\x14\n" + "\x05title\x18\x03 \x01(\tR\x05title\x12 \n" + - "\vdescription\x18\x04 \x01(\tR\vdescription\x12d\n" + - "\x12aggregate_metadata\x18\x05 \x03(\v25.krypton.llm.v1.FindingSummary.AggregateMetadataEntryR\x11aggregateMetadata\x1aD\n" + + "\vdescription\x18\x04 \x01(\tR\vdescription\x12k\n" + + "\x12aggregate_metadata\x18\x05 \x03(\v2<.krypton.plugin.llm.v1.FindingSummary.AggregateMetadataEntryR\x11aggregateMetadata\x1aD\n" + "\x16AggregateMetadataEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"w\n" + "\x0fEnrichedFinding\x121\n" + "\x14enriched_description\x18\x01 \x01(\tR\x13enrichedDescription\x121\n" + - "\x14enriched_remediation\x18\x02 \x01(\tR\x13enrichedRemediation\"K\n" + - "\rEnrichRequest\x12:\n" + - "\bfindings\x18\x01 \x03(\v2\x1e.krypton.llm.v1.FindingSummaryR\bfindings\"M\n" + - "\x0eEnrichResponse\x12;\n" + - "\benriched\x18\x01 \x03(\v2\x1f.krypton.llm.v1.EnrichedFindingR\benriched\"\xca\x01\n" + + "\x14enriched_remediation\x18\x02 \x01(\tR\x13enrichedRemediation\"R\n" + + "\rEnrichRequest\x12A\n" + + "\bfindings\x18\x01 \x03(\v2%.krypton.plugin.llm.v1.FindingSummaryR\bfindings\"T\n" + + "\x0eEnrichResponse\x12B\n" + + "\benriched\x18\x01 \x03(\v2&.krypton.plugin.llm.v1.EnrichedFindingR\benriched\"\xd1\x01\n" + "\rAnswerRequest\x12\x1a\n" + - "\bquestion\x18\x01 \x01(\tR\bquestion\x12Z\n" + - "\x0fcontext_signals\x18\x02 \x03(\v21.krypton.llm.v1.AnswerRequest.ContextSignalsEntryR\x0econtextSignals\x1aA\n" + + "\bquestion\x18\x01 \x01(\tR\bquestion\x12a\n" + + "\x0fcontext_signals\x18\x02 \x03(\v28.krypton.plugin.llm.v1.AnswerRequest.ContextSignalsEntryR\x0econtextSignals\x1aA\n" + "\x13ContextSignalsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"(\n" + "\x0eAnswerResponse\x12\x16\n" + - "\x06answer\x18\x01 \x01(\tR\x06answer2\x97\x01\n" + - "\x03LLM\x12G\n" + - "\x06Enrich\x12\x1d.krypton.llm.v1.EnrichRequest\x1a\x1e.krypton.llm.v1.EnrichResponse\x12G\n" + - "\x06Answer\x12\x1d.krypton.llm.v1.AnswerRequest\x1a\x1e.krypton.llm.v1.AnswerResponseB\xb1\x01\n" + - "\x12com.krypton.llm.v1B\bLlmProtoP\x01Z7github.com/openkcm/plugin-sdk/proto/plugin/llm/v1;llmv1\xa2\x02\x03KLX\xaa\x02\x0eKrypton.Llm.V1\xca\x02\x0eKrypton\\Llm\\V1\xe2\x02\x1aKrypton\\Llm\\V1\\GPBMetadata\xea\x02\x10Krypton::Llm::V1b\x06proto3" + "\x06answer\x18\x01 \x01(\tR\x06answer2\xb3\x01\n" + + "\x03LLM\x12U\n" + + "\x06Enrich\x12$.krypton.plugin.llm.v1.EnrichRequest\x1a%.krypton.plugin.llm.v1.EnrichResponse\x12U\n" + + "\x06Answer\x12$.krypton.plugin.llm.v1.AnswerRequest\x1a%.krypton.plugin.llm.v1.AnswerResponseB\xd5\x01\n" + + "\x19com.krypton.plugin.llm.v1B\bLlmProtoP\x01Z7github.com/openkcm/plugin-sdk/proto/plugin/llm/v1;llmv1\xa2\x02\x03KPL\xaa\x02\x15Krypton.Plugin.Llm.V1\xca\x02\x15Krypton\\Plugin\\Llm\\V1\xe2\x02!Krypton\\Plugin\\Llm\\V1\\GPBMetadata\xea\x02\x18Krypton::Plugin::Llm::V1b\x06proto3" var ( file_plugin_llm_v1_llm_proto_rawDescOnce sync.Once @@ -388,24 +388,24 @@ func file_plugin_llm_v1_llm_proto_rawDescGZIP() []byte { var file_plugin_llm_v1_llm_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_plugin_llm_v1_llm_proto_goTypes = []any{ - (*FindingSummary)(nil), // 0: krypton.llm.v1.FindingSummary - (*EnrichedFinding)(nil), // 1: krypton.llm.v1.EnrichedFinding - (*EnrichRequest)(nil), // 2: krypton.llm.v1.EnrichRequest - (*EnrichResponse)(nil), // 3: krypton.llm.v1.EnrichResponse - (*AnswerRequest)(nil), // 4: krypton.llm.v1.AnswerRequest - (*AnswerResponse)(nil), // 5: krypton.llm.v1.AnswerResponse - nil, // 6: krypton.llm.v1.FindingSummary.AggregateMetadataEntry - nil, // 7: krypton.llm.v1.AnswerRequest.ContextSignalsEntry + (*FindingSummary)(nil), // 0: krypton.plugin.llm.v1.FindingSummary + (*EnrichedFinding)(nil), // 1: krypton.plugin.llm.v1.EnrichedFinding + (*EnrichRequest)(nil), // 2: krypton.plugin.llm.v1.EnrichRequest + (*EnrichResponse)(nil), // 3: krypton.plugin.llm.v1.EnrichResponse + (*AnswerRequest)(nil), // 4: krypton.plugin.llm.v1.AnswerRequest + (*AnswerResponse)(nil), // 5: krypton.plugin.llm.v1.AnswerResponse + nil, // 6: krypton.plugin.llm.v1.FindingSummary.AggregateMetadataEntry + nil, // 7: krypton.plugin.llm.v1.AnswerRequest.ContextSignalsEntry } var file_plugin_llm_v1_llm_proto_depIdxs = []int32{ - 6, // 0: krypton.llm.v1.FindingSummary.aggregate_metadata:type_name -> krypton.llm.v1.FindingSummary.AggregateMetadataEntry - 0, // 1: krypton.llm.v1.EnrichRequest.findings:type_name -> krypton.llm.v1.FindingSummary - 1, // 2: krypton.llm.v1.EnrichResponse.enriched:type_name -> krypton.llm.v1.EnrichedFinding - 7, // 3: krypton.llm.v1.AnswerRequest.context_signals:type_name -> krypton.llm.v1.AnswerRequest.ContextSignalsEntry - 2, // 4: krypton.llm.v1.LLM.Enrich:input_type -> krypton.llm.v1.EnrichRequest - 4, // 5: krypton.llm.v1.LLM.Answer:input_type -> krypton.llm.v1.AnswerRequest - 3, // 6: krypton.llm.v1.LLM.Enrich:output_type -> krypton.llm.v1.EnrichResponse - 5, // 7: krypton.llm.v1.LLM.Answer:output_type -> krypton.llm.v1.AnswerResponse + 6, // 0: krypton.plugin.llm.v1.FindingSummary.aggregate_metadata:type_name -> krypton.plugin.llm.v1.FindingSummary.AggregateMetadataEntry + 0, // 1: krypton.plugin.llm.v1.EnrichRequest.findings:type_name -> krypton.plugin.llm.v1.FindingSummary + 1, // 2: krypton.plugin.llm.v1.EnrichResponse.enriched:type_name -> krypton.plugin.llm.v1.EnrichedFinding + 7, // 3: krypton.plugin.llm.v1.AnswerRequest.context_signals:type_name -> krypton.plugin.llm.v1.AnswerRequest.ContextSignalsEntry + 2, // 4: krypton.plugin.llm.v1.LLM.Enrich:input_type -> krypton.plugin.llm.v1.EnrichRequest + 4, // 5: krypton.plugin.llm.v1.LLM.Answer:input_type -> krypton.plugin.llm.v1.AnswerRequest + 3, // 6: krypton.plugin.llm.v1.LLM.Enrich:output_type -> krypton.plugin.llm.v1.EnrichResponse + 5, // 7: krypton.plugin.llm.v1.LLM.Answer:output_type -> krypton.plugin.llm.v1.AnswerResponse 6, // [6:8] is the sub-list for method output_type 4, // [4:6] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name diff --git a/proto/plugin/llm/v1/llm.proto b/proto/plugin/llm/v1/llm.proto index d6eb963..2d8d46b 100644 --- a/proto/plugin/llm/v1/llm.proto +++ b/proto/plugin/llm/v1/llm.proto @@ -1,8 +1,6 @@ syntax = "proto3"; -package krypton.llm.v1; - -option go_package = "github.com/openkcm/krypton/proto/plugin/llm/v1;llmv1"; +package krypton.plugin.llm.v1; // LLM is the plugin interface for AI language-model backends used by the // Advisor module. Only aggregate, privacy-safe statistics are ever transmitted — diff --git a/proto/plugin/llm/v1/llm_ext_plugin.pb.go b/proto/plugin/llm/v1/llm_ext_plugin.pb.go index 82c06ed..45daed2 100644 --- a/proto/plugin/llm/v1/llm_ext_plugin.pb.go +++ b/proto/plugin/llm/v1/llm_ext_plugin.pb.go @@ -10,7 +10,7 @@ import ( const ( Type = "LLM" - GRPCServiceFullName = "krypton.llm.v1.LLM" + GRPCServiceFullName = "krypton.plugin.llm.v1.LLM" ) func LLMPluginServer(server LLMServer) api.PluginServer { diff --git a/proto/plugin/llm/v1/llm_grpc.pb.go b/proto/plugin/llm/v1/llm_grpc.pb.go index ca4467d..70ce9a4 100644 --- a/proto/plugin/llm/v1/llm_grpc.pb.go +++ b/proto/plugin/llm/v1/llm_grpc.pb.go @@ -20,8 +20,8 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - LLM_Enrich_FullMethodName = "/krypton.llm.v1.LLM/Enrich" - LLM_Answer_FullMethodName = "/krypton.llm.v1.LLM/Answer" + LLM_Enrich_FullMethodName = "/krypton.plugin.llm.v1.LLM/Enrich" + LLM_Answer_FullMethodName = "/krypton.plugin.llm.v1.LLM/Answer" ) // LLMClient is the client API for LLM service. @@ -159,7 +159,7 @@ func _LLM_Answer_Handler(srv interface{}, ctx context.Context, dec func(interfac // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var LLM_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "krypton.llm.v1.LLM", + ServiceName: "krypton.plugin.llm.v1.LLM", HandlerType: (*LLMServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/proto/plugin/reconciler/v1/ast.pb.go b/proto/plugin/resources/v1/ast.pb.go similarity index 67% rename from proto/plugin/reconciler/v1/ast.pb.go rename to proto/plugin/resources/v1/ast.pb.go index 92ade50..d3fb9a8 100644 --- a/proto/plugin/reconciler/v1/ast.pb.go +++ b/proto/plugin/resources/v1/ast.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.36.11 // protoc (unknown) -// source: plugin/reconciler/v1/ast.proto +// source: plugin/resources/v1/ast.proto package reconcilerv1 @@ -44,7 +44,7 @@ type ExecutionPlan struct { func (x *ExecutionPlan) Reset() { *x = ExecutionPlan{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[0] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -56,7 +56,7 @@ func (x *ExecutionPlan) String() string { func (*ExecutionPlan) ProtoMessage() {} func (x *ExecutionPlan) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[0] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -69,7 +69,7 @@ func (x *ExecutionPlan) ProtoReflect() protoreflect.Message { // Deprecated: Use ExecutionPlan.ProtoReflect.Descriptor instead. func (*ExecutionPlan) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{0} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{0} } func (x *ExecutionPlan) GetPlanId() string { @@ -129,7 +129,7 @@ type ASTNode struct { func (x *ASTNode) Reset() { *x = ASTNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[1] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -141,7 +141,7 @@ func (x *ASTNode) String() string { func (*ASTNode) ProtoMessage() {} func (x *ASTNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[1] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -154,7 +154,7 @@ func (x *ASTNode) ProtoReflect() protoreflect.Message { // Deprecated: Use ASTNode.ProtoReflect.Descriptor instead. func (*ASTNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{1} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{1} } func (x *ASTNode) GetNodeId() string { @@ -433,7 +433,7 @@ type SequenceNode struct { func (x *SequenceNode) Reset() { *x = SequenceNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[2] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -445,7 +445,7 @@ func (x *SequenceNode) String() string { func (*SequenceNode) ProtoMessage() {} func (x *SequenceNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[2] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -458,7 +458,7 @@ func (x *SequenceNode) ProtoReflect() protoreflect.Message { // Deprecated: Use SequenceNode.ProtoReflect.Descriptor instead. func (*SequenceNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{2} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{2} } func (x *SequenceNode) GetSteps() []*ASTNode { @@ -480,7 +480,7 @@ type ParallelNode struct { func (x *ParallelNode) Reset() { *x = ParallelNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[3] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -492,7 +492,7 @@ func (x *ParallelNode) String() string { func (*ParallelNode) ProtoMessage() {} func (x *ParallelNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[3] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -505,7 +505,7 @@ func (x *ParallelNode) ProtoReflect() protoreflect.Message { // Deprecated: Use ParallelNode.ProtoReflect.Descriptor instead. func (*ParallelNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{3} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{3} } func (x *ParallelNode) GetSteps() []*ASTNode { @@ -534,7 +534,7 @@ type ConditionalNode struct { func (x *ConditionalNode) Reset() { *x = ConditionalNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[4] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -546,7 +546,7 @@ func (x *ConditionalNode) String() string { func (*ConditionalNode) ProtoMessage() {} func (x *ConditionalNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[4] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -559,7 +559,7 @@ func (x *ConditionalNode) ProtoReflect() protoreflect.Message { // Deprecated: Use ConditionalNode.ProtoReflect.Descriptor instead. func (*ConditionalNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{4} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{4} } func (x *ConditionalNode) GetCondition() *Predicate { @@ -595,7 +595,7 @@ type TryCatchNode struct { func (x *TryCatchNode) Reset() { *x = TryCatchNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[5] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -607,7 +607,7 @@ func (x *TryCatchNode) String() string { func (*TryCatchNode) ProtoMessage() {} func (x *TryCatchNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[5] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -620,7 +620,7 @@ func (x *TryCatchNode) ProtoReflect() protoreflect.Message { // Deprecated: Use TryCatchNode.ProtoReflect.Descriptor instead. func (*TryCatchNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{5} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{5} } func (x *TryCatchNode) GetTryNode() *ASTNode { @@ -647,7 +647,7 @@ type CheckpointNode struct { func (x *CheckpointNode) Reset() { *x = CheckpointNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[6] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -659,7 +659,7 @@ func (x *CheckpointNode) String() string { func (*CheckpointNode) ProtoMessage() {} func (x *CheckpointNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[6] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -672,7 +672,7 @@ func (x *CheckpointNode) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckpointNode.ProtoReflect.Descriptor instead. func (*CheckpointNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{6} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{6} } type AssertNode struct { @@ -685,7 +685,7 @@ type AssertNode struct { func (x *AssertNode) Reset() { *x = AssertNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[7] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -697,7 +697,7 @@ func (x *AssertNode) String() string { func (*AssertNode) ProtoMessage() {} func (x *AssertNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[7] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -710,7 +710,7 @@ func (x *AssertNode) ProtoReflect() protoreflect.Message { // Deprecated: Use AssertNode.ProtoReflect.Descriptor instead. func (*AssertNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{7} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{7} } func (x *AssertNode) GetCondition() *Predicate { @@ -748,7 +748,7 @@ type Predicate struct { func (x *Predicate) Reset() { *x = Predicate{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[8] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -760,7 +760,7 @@ func (x *Predicate) String() string { func (*Predicate) ProtoMessage() {} func (x *Predicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[8] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -773,7 +773,7 @@ func (x *Predicate) ProtoReflect() protoreflect.Message { // Deprecated: Use Predicate.ProtoReflect.Descriptor instead. func (*Predicate) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{8} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{8} } func (x *Predicate) GetExpr() isPredicate_Expr { @@ -903,7 +903,7 @@ type KeyExistsPredicate struct { func (x *KeyExistsPredicate) Reset() { *x = KeyExistsPredicate{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[9] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -915,7 +915,7 @@ func (x *KeyExistsPredicate) String() string { func (*KeyExistsPredicate) ProtoMessage() {} func (x *KeyExistsPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[9] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -928,7 +928,7 @@ func (x *KeyExistsPredicate) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyExistsPredicate.ProtoReflect.Descriptor instead. func (*KeyExistsPredicate) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{9} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{9} } func (x *KeyExistsPredicate) GetTier() *ValueRef { @@ -960,7 +960,7 @@ type KeyStatePredicate struct { func (x *KeyStatePredicate) Reset() { *x = KeyStatePredicate{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[10] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -972,7 +972,7 @@ func (x *KeyStatePredicate) String() string { func (*KeyStatePredicate) ProtoMessage() {} func (x *KeyStatePredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[10] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -985,7 +985,7 @@ func (x *KeyStatePredicate) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyStatePredicate.ProtoReflect.Descriptor instead. func (*KeyStatePredicate) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{10} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{10} } func (x *KeyStatePredicate) GetTier() *ValueRef { @@ -1018,7 +1018,7 @@ type TenantActivePredicate struct { func (x *TenantActivePredicate) Reset() { *x = TenantActivePredicate{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[11] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1030,7 +1030,7 @@ func (x *TenantActivePredicate) String() string { func (*TenantActivePredicate) ProtoMessage() {} func (x *TenantActivePredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[11] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1043,7 +1043,7 @@ func (x *TenantActivePredicate) ProtoReflect() protoreflect.Message { // Deprecated: Use TenantActivePredicate.ProtoReflect.Descriptor instead. func (*TenantActivePredicate) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{11} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{11} } func (x *TenantActivePredicate) GetTenantId() *ValueRef { @@ -1062,7 +1062,7 @@ type CredentialExistsPredicate struct { func (x *CredentialExistsPredicate) Reset() { *x = CredentialExistsPredicate{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[12] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1074,7 +1074,7 @@ func (x *CredentialExistsPredicate) String() string { func (*CredentialExistsPredicate) ProtoMessage() {} func (x *CredentialExistsPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[12] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1087,7 +1087,7 @@ func (x *CredentialExistsPredicate) ProtoReflect() protoreflect.Message { // Deprecated: Use CredentialExistsPredicate.ProtoReflect.Descriptor instead. func (*CredentialExistsPredicate) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{12} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{12} } func (x *CredentialExistsPredicate) GetName() *ValueRef { @@ -1106,7 +1106,7 @@ type AndPredicate struct { func (x *AndPredicate) Reset() { *x = AndPredicate{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[13] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1118,7 +1118,7 @@ func (x *AndPredicate) String() string { func (*AndPredicate) ProtoMessage() {} func (x *AndPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[13] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1131,7 +1131,7 @@ func (x *AndPredicate) ProtoReflect() protoreflect.Message { // Deprecated: Use AndPredicate.ProtoReflect.Descriptor instead. func (*AndPredicate) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{13} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{13} } func (x *AndPredicate) GetTerms() []*Predicate { @@ -1150,7 +1150,7 @@ type OrPredicate struct { func (x *OrPredicate) Reset() { *x = OrPredicate{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[14] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1162,7 +1162,7 @@ func (x *OrPredicate) String() string { func (*OrPredicate) ProtoMessage() {} func (x *OrPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[14] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1175,7 +1175,7 @@ func (x *OrPredicate) ProtoReflect() protoreflect.Message { // Deprecated: Use OrPredicate.ProtoReflect.Descriptor instead. func (*OrPredicate) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{14} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{14} } func (x *OrPredicate) GetTerms() []*Predicate { @@ -1194,7 +1194,7 @@ type NotPredicate struct { func (x *NotPredicate) Reset() { *x = NotPredicate{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[15] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1206,7 +1206,7 @@ func (x *NotPredicate) String() string { func (*NotPredicate) ProtoMessage() {} func (x *NotPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[15] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1219,7 +1219,7 @@ func (x *NotPredicate) ProtoReflect() protoreflect.Message { // Deprecated: Use NotPredicate.ProtoReflect.Descriptor instead. func (*NotPredicate) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{15} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{15} } func (x *NotPredicate) GetTerm() *Predicate { @@ -1246,7 +1246,7 @@ type ValueRef struct { func (x *ValueRef) Reset() { *x = ValueRef{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[16] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1258,7 +1258,7 @@ func (x *ValueRef) String() string { func (*ValueRef) ProtoMessage() {} func (x *ValueRef) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[16] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1271,7 +1271,7 @@ func (x *ValueRef) ProtoReflect() protoreflect.Message { // Deprecated: Use ValueRef.ProtoReflect.Descriptor instead. func (*ValueRef) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{16} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{16} } func (x *ValueRef) GetKind() isValueRef_Kind { @@ -1338,7 +1338,7 @@ type KeySyncNode struct { func (x *KeySyncNode) Reset() { *x = KeySyncNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[17] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1350,7 +1350,7 @@ func (x *KeySyncNode) String() string { func (*KeySyncNode) ProtoMessage() {} func (x *KeySyncNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[17] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1363,7 +1363,7 @@ func (x *KeySyncNode) ProtoReflect() protoreflect.Message { // Deprecated: Use KeySyncNode.ProtoReflect.Descriptor instead. func (*KeySyncNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{17} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{17} } func (x *KeySyncNode) GetTier() *ValueRef { @@ -1413,7 +1413,7 @@ type KeyDeleteNode struct { func (x *KeyDeleteNode) Reset() { *x = KeyDeleteNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[18] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1425,7 +1425,7 @@ func (x *KeyDeleteNode) String() string { func (*KeyDeleteNode) ProtoMessage() {} func (x *KeyDeleteNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[18] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1438,7 +1438,7 @@ func (x *KeyDeleteNode) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyDeleteNode.ProtoReflect.Descriptor instead. func (*KeyDeleteNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{18} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{18} } func (x *KeyDeleteNode) GetTier() *ValueRef { @@ -1470,7 +1470,7 @@ type KeyTransitionNode struct { func (x *KeyTransitionNode) Reset() { *x = KeyTransitionNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[19] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1482,7 +1482,7 @@ func (x *KeyTransitionNode) String() string { func (*KeyTransitionNode) ProtoMessage() {} func (x *KeyTransitionNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[19] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1495,7 +1495,7 @@ func (x *KeyTransitionNode) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyTransitionNode.ProtoReflect.Descriptor instead. func (*KeyTransitionNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{19} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{19} } func (x *KeyTransitionNode) GetTier() *ValueRef { @@ -1532,7 +1532,7 @@ type KeyRotateNode struct { func (x *KeyRotateNode) Reset() { *x = KeyRotateNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[20] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1544,7 +1544,7 @@ func (x *KeyRotateNode) String() string { func (*KeyRotateNode) ProtoMessage() {} func (x *KeyRotateNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[20] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1557,7 +1557,7 @@ func (x *KeyRotateNode) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyRotateNode.ProtoReflect.Descriptor instead. func (*KeyRotateNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{20} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{20} } func (x *KeyRotateNode) GetTier() *ValueRef { @@ -1586,7 +1586,7 @@ type KeyScheduleNode struct { func (x *KeyScheduleNode) Reset() { *x = KeyScheduleNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[21] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1598,7 +1598,7 @@ func (x *KeyScheduleNode) String() string { func (*KeyScheduleNode) ProtoMessage() {} func (x *KeyScheduleNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[21] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1611,7 +1611,7 @@ func (x *KeyScheduleNode) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyScheduleNode.ProtoReflect.Descriptor instead. func (*KeyScheduleNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{21} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{21} } func (x *KeyScheduleNode) GetTier() *ValueRef { @@ -1649,7 +1649,7 @@ type KeyScheduleSpec struct { func (x *KeyScheduleSpec) Reset() { *x = KeyScheduleSpec{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[22] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1661,7 +1661,7 @@ func (x *KeyScheduleSpec) String() string { func (*KeyScheduleSpec) ProtoMessage() {} func (x *KeyScheduleSpec) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[22] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1674,7 +1674,7 @@ func (x *KeyScheduleSpec) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyScheduleSpec.ProtoReflect.Descriptor instead. func (*KeyScheduleSpec) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{22} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{22} } func (x *KeyScheduleSpec) GetExpiresAt() *timestamppb.Timestamp { @@ -1711,7 +1711,7 @@ type CredentialSyncNode struct { func (x *CredentialSyncNode) Reset() { *x = CredentialSyncNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[23] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1723,7 +1723,7 @@ func (x *CredentialSyncNode) String() string { func (*CredentialSyncNode) ProtoMessage() {} func (x *CredentialSyncNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[23] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1736,7 +1736,7 @@ func (x *CredentialSyncNode) ProtoReflect() protoreflect.Message { // Deprecated: Use CredentialSyncNode.ProtoReflect.Descriptor instead. func (*CredentialSyncNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{23} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{23} } func (x *CredentialSyncNode) GetName() *ValueRef { @@ -1770,7 +1770,7 @@ type CredentialDeleteNode struct { func (x *CredentialDeleteNode) Reset() { *x = CredentialDeleteNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[24] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1782,7 +1782,7 @@ func (x *CredentialDeleteNode) String() string { func (*CredentialDeleteNode) ProtoMessage() {} func (x *CredentialDeleteNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[24] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1795,7 +1795,7 @@ func (x *CredentialDeleteNode) ProtoReflect() protoreflect.Message { // Deprecated: Use CredentialDeleteNode.ProtoReflect.Descriptor instead. func (*CredentialDeleteNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{24} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{24} } func (x *CredentialDeleteNode) GetName() *ValueRef { @@ -1817,7 +1817,7 @@ type BindNode struct { func (x *BindNode) Reset() { *x = BindNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[25] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[25] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1829,7 +1829,7 @@ func (x *BindNode) String() string { func (*BindNode) ProtoMessage() {} func (x *BindNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[25] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[25] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1842,7 +1842,7 @@ func (x *BindNode) ProtoReflect() protoreflect.Message { // Deprecated: Use BindNode.ProtoReflect.Descriptor instead. func (*BindNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{25} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{25} } func (x *BindNode) GetVarName() string { @@ -1870,7 +1870,7 @@ type EmitNode struct { func (x *EmitNode) Reset() { *x = EmitNode{} - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[26] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[26] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1882,7 +1882,7 @@ func (x *EmitNode) String() string { func (*EmitNode) ProtoMessage() {} func (x *EmitNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_ast_proto_msgTypes[26] + mi := &file_plugin_resources_v1_ast_proto_msgTypes[26] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1895,7 +1895,7 @@ func (x *EmitNode) ProtoReflect() protoreflect.Message { // Deprecated: Use EmitNode.ProtoReflect.Descriptor instead. func (*EmitNode) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_ast_proto_rawDescGZIP(), []int{26} + return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{26} } func (x *EmitNode) GetEventType() string { @@ -1912,118 +1912,119 @@ func (x *EmitNode) GetAttributes() map[string]string { return nil } -var File_plugin_reconciler_v1_ast_proto protoreflect.FileDescriptor +var File_plugin_resources_v1_ast_proto protoreflect.FileDescriptor -const file_plugin_reconciler_v1_ast_proto_rawDesc = "" + +const file_plugin_resources_v1_ast_proto_rawDesc = "" + "\n" + - "\x1eplugin/reconciler/v1/ast.proto\x12\x15krypton.reconciler.v1\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xe9\x01\n" + + "\x1dplugin/resources/v1/ast.proto\x12\x1fkrypton.resources.reconciler.v1\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xfd\x01\n" + "\rExecutionPlan\x12\x17\n" + - "\aplan_id\x18\x01 \x01(\tR\x06planId\x122\n" + - "\x04root\x18\x02 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\x04root\x12N\n" + - "\bbindings\x18\x03 \x03(\v22.krypton.reconciler.v1.ExecutionPlan.BindingsEntryR\bbindings\x1a;\n" + + "\aplan_id\x18\x01 \x01(\tR\x06planId\x12<\n" + + "\x04root\x18\x02 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\x04root\x12X\n" + + "\bbindings\x18\x03 \x03(\v2<.krypton.resources.reconciler.v1.ExecutionPlan.BindingsEntryR\bbindings\x1a;\n" + "\rBindingsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x8a\t\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xa0\n" + + "\n" + "\aASTNode\x12\x17\n" + "\anode_id\x18\x01 \x01(\tR\x06nodeId\x12\x14\n" + "\x05label\x18\x02 \x01(\tR\x05label\x12\x1d\n" + "\n" + - "result_var\x18\x03 \x01(\tR\tresultVar\x12A\n" + + "result_var\x18\x03 \x01(\tR\tresultVar\x12K\n" + "\bsequence\x18\n" + - " \x01(\v2#.krypton.reconciler.v1.SequenceNodeH\x00R\bsequence\x12A\n" + - "\bparallel\x18\v \x01(\v2#.krypton.reconciler.v1.ParallelNodeH\x00R\bparallel\x12J\n" + - "\vconditional\x18\f \x01(\v2&.krypton.reconciler.v1.ConditionalNodeH\x00R\vconditional\x12B\n" + - "\ttry_catch\x18\r \x01(\v2#.krypton.reconciler.v1.TryCatchNodeH\x00R\btryCatch\x12G\n" + + " \x01(\v2-.krypton.resources.reconciler.v1.SequenceNodeH\x00R\bsequence\x12K\n" + + "\bparallel\x18\v \x01(\v2-.krypton.resources.reconciler.v1.ParallelNodeH\x00R\bparallel\x12T\n" + + "\vconditional\x18\f \x01(\v20.krypton.resources.reconciler.v1.ConditionalNodeH\x00R\vconditional\x12L\n" + + "\ttry_catch\x18\r \x01(\v2-.krypton.resources.reconciler.v1.TryCatchNodeH\x00R\btryCatch\x12Q\n" + "\n" + - "checkpoint\x18\x0e \x01(\v2%.krypton.reconciler.v1.CheckpointNodeH\x00R\n" + - "checkpoint\x12;\n" + - "\x06assert\x18\x14 \x01(\v2!.krypton.reconciler.v1.AssertNodeH\x00R\x06assert\x12?\n" + - "\bkey_sync\x18\x1e \x01(\v2\".krypton.reconciler.v1.KeySyncNodeH\x00R\akeySync\x12E\n" + + "checkpoint\x18\x0e \x01(\v2/.krypton.resources.reconciler.v1.CheckpointNodeH\x00R\n" + + "checkpoint\x12E\n" + + "\x06assert\x18\x14 \x01(\v2+.krypton.resources.reconciler.v1.AssertNodeH\x00R\x06assert\x12I\n" + + "\bkey_sync\x18\x1e \x01(\v2,.krypton.resources.reconciler.v1.KeySyncNodeH\x00R\akeySync\x12O\n" + "\n" + - "key_delete\x18\x1f \x01(\v2$.krypton.reconciler.v1.KeyDeleteNodeH\x00R\tkeyDelete\x12Q\n" + - "\x0ekey_transition\x18 \x01(\v2(.krypton.reconciler.v1.KeyTransitionNodeH\x00R\rkeyTransition\x12E\n" + + "key_delete\x18\x1f \x01(\v2..krypton.resources.reconciler.v1.KeyDeleteNodeH\x00R\tkeyDelete\x12[\n" + + "\x0ekey_transition\x18 \x01(\v22.krypton.resources.reconciler.v1.KeyTransitionNodeH\x00R\rkeyTransition\x12O\n" + "\n" + - "key_rotate\x18! \x01(\v2$.krypton.reconciler.v1.KeyRotateNodeH\x00R\tkeyRotate\x12K\n" + - "\fkey_schedule\x18\" \x01(\v2&.krypton.reconciler.v1.KeyScheduleNodeH\x00R\vkeySchedule\x12T\n" + - "\x0fcredential_sync\x18( \x01(\v2).krypton.reconciler.v1.CredentialSyncNodeH\x00R\x0ecredentialSync\x12Z\n" + - "\x11credential_delete\x18) \x01(\v2+.krypton.reconciler.v1.CredentialDeleteNodeH\x00R\x10credentialDelete\x125\n" + - "\x04bind\x18< \x01(\v2\x1f.krypton.reconciler.v1.BindNodeH\x00R\x04bind\x125\n" + - "\x04emit\x18= \x01(\v2\x1f.krypton.reconciler.v1.EmitNodeH\x00R\x04emitB\x06\n" + - "\x04node\"D\n" + - "\fSequenceNode\x124\n" + - "\x05steps\x18\x01 \x03(\v2\x1e.krypton.reconciler.v1.ASTNodeR\x05steps\"a\n" + - "\fParallelNode\x124\n" + - "\x05steps\x18\x01 \x03(\v2\x1e.krypton.reconciler.v1.ASTNodeR\x05steps\x12\x1b\n" + - "\tfail_fast\x18\x02 \x01(\bR\bfailFast\"\xcb\x01\n" + - "\x0fConditionalNode\x12>\n" + - "\tcondition\x18\x01 \x01(\v2 .krypton.reconciler.v1.PredicateR\tcondition\x12;\n" + - "\tthen_node\x18\x02 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\bthenNode\x12;\n" + - "\telse_node\x18\x03 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\belseNode\"\x88\x01\n" + - "\fTryCatchNode\x129\n" + - "\btry_node\x18\x01 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\atryNode\x12=\n" + + "key_rotate\x18! \x01(\v2..krypton.resources.reconciler.v1.KeyRotateNodeH\x00R\tkeyRotate\x12U\n" + + "\fkey_schedule\x18\" \x01(\v20.krypton.resources.reconciler.v1.KeyScheduleNodeH\x00R\vkeySchedule\x12^\n" + + "\x0fcredential_sync\x18( \x01(\v23.krypton.resources.reconciler.v1.CredentialSyncNodeH\x00R\x0ecredentialSync\x12d\n" + + "\x11credential_delete\x18) \x01(\v25.krypton.resources.reconciler.v1.CredentialDeleteNodeH\x00R\x10credentialDelete\x12?\n" + + "\x04bind\x18< \x01(\v2).krypton.resources.reconciler.v1.BindNodeH\x00R\x04bind\x12?\n" + + "\x04emit\x18= \x01(\v2).krypton.resources.reconciler.v1.EmitNodeH\x00R\x04emitB\x06\n" + + "\x04node\"N\n" + + "\fSequenceNode\x12>\n" + + "\x05steps\x18\x01 \x03(\v2(.krypton.resources.reconciler.v1.ASTNodeR\x05steps\"k\n" + + "\fParallelNode\x12>\n" + + "\x05steps\x18\x01 \x03(\v2(.krypton.resources.reconciler.v1.ASTNodeR\x05steps\x12\x1b\n" + + "\tfail_fast\x18\x02 \x01(\bR\bfailFast\"\xe9\x01\n" + + "\x0fConditionalNode\x12H\n" + + "\tcondition\x18\x01 \x01(\v2*.krypton.resources.reconciler.v1.PredicateR\tcondition\x12E\n" + + "\tthen_node\x18\x02 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\bthenNode\x12E\n" + + "\telse_node\x18\x03 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\belseNode\"\x9c\x01\n" + + "\fTryCatchNode\x12C\n" + + "\btry_node\x18\x01 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\atryNode\x12G\n" + "\n" + - "catch_node\x18\x02 \x01(\v2\x1e.krypton.reconciler.v1.ASTNodeR\tcatchNode\"\x10\n" + - "\x0eCheckpointNode\"q\n" + + "catch_node\x18\x02 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\tcatchNode\"\x10\n" + + "\x0eCheckpointNode\"{\n" + "\n" + - "AssertNode\x12>\n" + - "\tcondition\x18\x01 \x01(\v2 .krypton.reconciler.v1.PredicateR\tcondition\x12#\n" + - "\rerror_message\x18\x02 \x01(\tR\ferrorMessage\"\x86\x04\n" + - "\tPredicate\x12J\n" + + "AssertNode\x12H\n" + + "\tcondition\x18\x01 \x01(\v2*.krypton.resources.reconciler.v1.PredicateR\tcondition\x12#\n" + + "\rerror_message\x18\x02 \x01(\tR\ferrorMessage\"\xcc\x04\n" + + "\tPredicate\x12T\n" + "\n" + - "key_exists\x18\x01 \x01(\v2).krypton.reconciler.v1.KeyExistsPredicateH\x00R\tkeyExists\x12G\n" + - "\tkey_state\x18\x02 \x01(\v2(.krypton.reconciler.v1.KeyStatePredicateH\x00R\bkeyState\x12S\n" + - "\rtenant_active\x18\x03 \x01(\v2,.krypton.reconciler.v1.TenantActivePredicateH\x00R\ftenantActive\x12_\n" + - "\x11credential_exists\x18\x04 \x01(\v20.krypton.reconciler.v1.CredentialExistsPredicateH\x00R\x10credentialExists\x127\n" + + "key_exists\x18\x01 \x01(\v23.krypton.resources.reconciler.v1.KeyExistsPredicateH\x00R\tkeyExists\x12Q\n" + + "\tkey_state\x18\x02 \x01(\v22.krypton.resources.reconciler.v1.KeyStatePredicateH\x00R\bkeyState\x12]\n" + + "\rtenant_active\x18\x03 \x01(\v26.krypton.resources.reconciler.v1.TenantActivePredicateH\x00R\ftenantActive\x12i\n" + + "\x11credential_exists\x18\x04 \x01(\v2:.krypton.resources.reconciler.v1.CredentialExistsPredicateH\x00R\x10credentialExists\x12A\n" + "\x03and\x18\n" + - " \x01(\v2#.krypton.reconciler.v1.AndPredicateH\x00R\x03and\x124\n" + - "\x02or\x18\v \x01(\v2\".krypton.reconciler.v1.OrPredicateH\x00R\x02or\x127\n" + - "\x03not\x18\f \x01(\v2#.krypton.reconciler.v1.NotPredicateH\x00R\x03notB\x06\n" + - "\x04expr\"\x85\x01\n" + - "\x12KeyExistsPredicate\x123\n" + - "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + - "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\"\xab\x01\n" + - "\x11KeyStatePredicate\x123\n" + - "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + - "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\x12%\n" + - "\x0eallowed_states\x18\x03 \x03(\tR\rallowedStates\"U\n" + - "\x15TenantActivePredicate\x12<\n" + - "\ttenant_id\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\btenantId\"P\n" + - "\x19CredentialExistsPredicate\x123\n" + - "\x04name\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04name\"F\n" + - "\fAndPredicate\x126\n" + - "\x05terms\x18\x01 \x03(\v2 .krypton.reconciler.v1.PredicateR\x05terms\"E\n" + - "\vOrPredicate\x126\n" + - "\x05terms\x18\x01 \x03(\v2 .krypton.reconciler.v1.PredicateR\x05terms\"D\n" + - "\fNotPredicate\x124\n" + - "\x04term\x18\x01 \x01(\v2 .krypton.reconciler.v1.PredicateR\x04term\"I\n" + + " \x01(\v2-.krypton.resources.reconciler.v1.AndPredicateH\x00R\x03and\x12>\n" + + "\x02or\x18\v \x01(\v2,.krypton.resources.reconciler.v1.OrPredicateH\x00R\x02or\x12A\n" + + "\x03not\x18\f \x01(\v2-.krypton.resources.reconciler.v1.NotPredicateH\x00R\x03notB\x06\n" + + "\x04expr\"\x99\x01\n" + + "\x12KeyExistsPredicate\x12=\n" + + "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + + "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\"\xbf\x01\n" + + "\x11KeyStatePredicate\x12=\n" + + "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + + "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\x12%\n" + + "\x0eallowed_states\x18\x03 \x03(\tR\rallowedStates\"_\n" + + "\x15TenantActivePredicate\x12F\n" + + "\ttenant_id\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\btenantId\"Z\n" + + "\x19CredentialExistsPredicate\x12=\n" + + "\x04name\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04name\"P\n" + + "\fAndPredicate\x12@\n" + + "\x05terms\x18\x01 \x03(\v2*.krypton.resources.reconciler.v1.PredicateR\x05terms\"O\n" + + "\vOrPredicate\x12@\n" + + "\x05terms\x18\x01 \x03(\v2*.krypton.resources.reconciler.v1.PredicateR\x05terms\"N\n" + + "\fNotPredicate\x12>\n" + + "\x04term\x18\x01 \x01(\v2*.krypton.resources.reconciler.v1.PredicateR\x04term\"I\n" + "\bValueRef\x12\x1a\n" + "\aliteral\x18\x01 \x01(\tH\x00R\aliteral\x12\x19\n" + "\avar_ref\x18\x02 \x01(\tH\x00R\x06varRefB\x06\n" + - "\x04kind\"\x8d\x03\n" + - "\vKeySyncNode\x123\n" + - "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + - "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\x12>\n" + + "\x04kind\"\xbf\x03\n" + + "\vKeySyncNode\x12=\n" + + "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + + "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\x12H\n" + "\n" + - "parent_key\x18\x03 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\tparentKey\x12B\n" + - "\bschedule\x18\x04 \x01(\v2&.krypton.reconciler.v1.KeyScheduleSpecR\bschedule\x12L\n" + - "\bmetadata\x18\x05 \x03(\v20.krypton.reconciler.v1.KeySyncNode.MetadataEntryR\bmetadata\x1a;\n" + + "parent_key\x18\x03 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\tparentKey\x12L\n" + + "\bschedule\x18\x04 \x01(\v20.krypton.resources.reconciler.v1.KeyScheduleSpecR\bschedule\x12V\n" + + "\bmetadata\x18\x05 \x03(\v2:.krypton.resources.reconciler.v1.KeySyncNode.MetadataEntryR\bmetadata\x1a;\n" + "\rMetadataEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x80\x01\n" + - "\rKeyDeleteNode\x123\n" + - "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + - "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\"\xa7\x01\n" + - "\x11KeyTransitionNode\x123\n" + - "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + - "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\x12!\n" + - "\ftarget_state\x18\x03 \x01(\tR\vtargetState\"\x80\x01\n" + - "\rKeyRotateNode\x123\n" + - "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + - "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\"\xc6\x01\n" + - "\x0fKeyScheduleNode\x123\n" + - "\x04tier\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04tier\x12:\n" + - "\bkey_name\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\akeyName\x12B\n" + - "\bschedule\x18\x03 \x01(\v2&.krypton.reconciler.v1.KeyScheduleSpecR\bschedule\"\x91\x02\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x94\x01\n" + + "\rKeyDeleteNode\x12=\n" + + "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + + "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\"\xbb\x01\n" + + "\x11KeyTransitionNode\x12=\n" + + "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + + "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\x12!\n" + + "\ftarget_state\x18\x03 \x01(\tR\vtargetState\"\x94\x01\n" + + "\rKeyRotateNode\x12=\n" + + "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + + "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\"\xe4\x01\n" + + "\x0fKeyScheduleNode\x12=\n" + + "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + + "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\x12L\n" + + "\bschedule\x18\x03 \x01(\v20.krypton.resources.reconciler.v1.KeyScheduleSpecR\bschedule\"\x91\x02\n" + "\x0fKeyScheduleSpec\x12>\n" + "\n" + "expires_at\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampH\x00R\texpiresAt\x88\x01\x01\x12W\n" + @@ -2031,138 +2032,138 @@ const file_plugin_reconciler_v1_ast_proto_rawDesc = "" + "\rtransition_to\x18\x03 \x01(\tH\x02R\ftransitionTo\x88\x01\x01B\r\n" + "\v_expires_atB\x1a\n" + "\x18_scheduled_transition_atB\x10\n" + - "\x0e_transition_to\"\xab\x01\n" + - "\x12CredentialSyncNode\x123\n" + - "\x04name\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04name\x123\n" + - "\x04type\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04type\x12+\n" + - "\x04spec\x18\x03 \x01(\v2\x17.google.protobuf.StructR\x04spec\"K\n" + - "\x14CredentialDeleteNode\x123\n" + - "\x04name\x18\x01 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x04name\"\\\n" + + "\x0e_transition_to\"\xbf\x01\n" + + "\x12CredentialSyncNode\x12=\n" + + "\x04name\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04name\x12=\n" + + "\x04type\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04type\x12+\n" + + "\x04spec\x18\x03 \x01(\v2\x17.google.protobuf.StructR\x04spec\"U\n" + + "\x14CredentialDeleteNode\x12=\n" + + "\x04name\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04name\"f\n" + "\bBindNode\x12\x19\n" + - "\bvar_name\x18\x01 \x01(\tR\avarName\x125\n" + - "\x05value\x18\x02 \x01(\v2\x1f.krypton.reconciler.v1.ValueRefR\x05value\"\xb9\x01\n" + + "\bvar_name\x18\x01 \x01(\tR\avarName\x12?\n" + + "\x05value\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x05value\"\xc3\x01\n" + "\bEmitNode\x12\x1d\n" + "\n" + - "event_type\x18\x01 \x01(\tR\teventType\x12O\n" + + "event_type\x18\x01 \x01(\tR\teventType\x12Y\n" + "\n" + - "attributes\x18\x02 \x03(\v2/.krypton.reconciler.v1.EmitNode.AttributesEntryR\n" + + "attributes\x18\x02 \x03(\v29.krypton.resources.reconciler.v1.EmitNode.AttributesEntryR\n" + "attributes\x1a=\n" + "\x0fAttributesEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\xe2\x01\n" + - "\x19com.krypton.reconciler.v1B\bAstProtoP\x01ZEgithub.com/openkcm/plugin-sdk/proto/plugin/reconciler/v1;reconcilerv1\xa2\x02\x03KRX\xaa\x02\x15Krypton.Reconciler.V1\xca\x02\x15Krypton\\Reconciler\\V1\xe2\x02!Krypton\\Reconciler\\V1\\GPBMetadata\xea\x02\x17Krypton::Reconciler::V1b\x06proto3" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x94\x02\n" + + "#com.krypton.resources.reconciler.v1B\bAstProtoP\x01ZDgithub.com/openkcm/plugin-sdk/proto/plugin/resources/v1;reconcilerv1\xa2\x02\x03KRR\xaa\x02\x1fKrypton.Resources.Reconciler.V1\xca\x02\x1fKrypton\\Resources\\Reconciler\\V1\xe2\x02+Krypton\\Resources\\Reconciler\\V1\\GPBMetadata\xea\x02\"Krypton::Resources::Reconciler::V1b\x06proto3" var ( - file_plugin_reconciler_v1_ast_proto_rawDescOnce sync.Once - file_plugin_reconciler_v1_ast_proto_rawDescData []byte + file_plugin_resources_v1_ast_proto_rawDescOnce sync.Once + file_plugin_resources_v1_ast_proto_rawDescData []byte ) -func file_plugin_reconciler_v1_ast_proto_rawDescGZIP() []byte { - file_plugin_reconciler_v1_ast_proto_rawDescOnce.Do(func() { - file_plugin_reconciler_v1_ast_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_reconciler_v1_ast_proto_rawDesc), len(file_plugin_reconciler_v1_ast_proto_rawDesc))) +func file_plugin_resources_v1_ast_proto_rawDescGZIP() []byte { + file_plugin_resources_v1_ast_proto_rawDescOnce.Do(func() { + file_plugin_resources_v1_ast_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_resources_v1_ast_proto_rawDesc), len(file_plugin_resources_v1_ast_proto_rawDesc))) }) - return file_plugin_reconciler_v1_ast_proto_rawDescData -} - -var file_plugin_reconciler_v1_ast_proto_msgTypes = make([]protoimpl.MessageInfo, 30) -var file_plugin_reconciler_v1_ast_proto_goTypes = []any{ - (*ExecutionPlan)(nil), // 0: krypton.reconciler.v1.ExecutionPlan - (*ASTNode)(nil), // 1: krypton.reconciler.v1.ASTNode - (*SequenceNode)(nil), // 2: krypton.reconciler.v1.SequenceNode - (*ParallelNode)(nil), // 3: krypton.reconciler.v1.ParallelNode - (*ConditionalNode)(nil), // 4: krypton.reconciler.v1.ConditionalNode - (*TryCatchNode)(nil), // 5: krypton.reconciler.v1.TryCatchNode - (*CheckpointNode)(nil), // 6: krypton.reconciler.v1.CheckpointNode - (*AssertNode)(nil), // 7: krypton.reconciler.v1.AssertNode - (*Predicate)(nil), // 8: krypton.reconciler.v1.Predicate - (*KeyExistsPredicate)(nil), // 9: krypton.reconciler.v1.KeyExistsPredicate - (*KeyStatePredicate)(nil), // 10: krypton.reconciler.v1.KeyStatePredicate - (*TenantActivePredicate)(nil), // 11: krypton.reconciler.v1.TenantActivePredicate - (*CredentialExistsPredicate)(nil), // 12: krypton.reconciler.v1.CredentialExistsPredicate - (*AndPredicate)(nil), // 13: krypton.reconciler.v1.AndPredicate - (*OrPredicate)(nil), // 14: krypton.reconciler.v1.OrPredicate - (*NotPredicate)(nil), // 15: krypton.reconciler.v1.NotPredicate - (*ValueRef)(nil), // 16: krypton.reconciler.v1.ValueRef - (*KeySyncNode)(nil), // 17: krypton.reconciler.v1.KeySyncNode - (*KeyDeleteNode)(nil), // 18: krypton.reconciler.v1.KeyDeleteNode - (*KeyTransitionNode)(nil), // 19: krypton.reconciler.v1.KeyTransitionNode - (*KeyRotateNode)(nil), // 20: krypton.reconciler.v1.KeyRotateNode - (*KeyScheduleNode)(nil), // 21: krypton.reconciler.v1.KeyScheduleNode - (*KeyScheduleSpec)(nil), // 22: krypton.reconciler.v1.KeyScheduleSpec - (*CredentialSyncNode)(nil), // 23: krypton.reconciler.v1.CredentialSyncNode - (*CredentialDeleteNode)(nil), // 24: krypton.reconciler.v1.CredentialDeleteNode - (*BindNode)(nil), // 25: krypton.reconciler.v1.BindNode - (*EmitNode)(nil), // 26: krypton.reconciler.v1.EmitNode - nil, // 27: krypton.reconciler.v1.ExecutionPlan.BindingsEntry - nil, // 28: krypton.reconciler.v1.KeySyncNode.MetadataEntry - nil, // 29: krypton.reconciler.v1.EmitNode.AttributesEntry + return file_plugin_resources_v1_ast_proto_rawDescData +} + +var file_plugin_resources_v1_ast_proto_msgTypes = make([]protoimpl.MessageInfo, 30) +var file_plugin_resources_v1_ast_proto_goTypes = []any{ + (*ExecutionPlan)(nil), // 0: krypton.resources.reconciler.v1.ExecutionPlan + (*ASTNode)(nil), // 1: krypton.resources.reconciler.v1.ASTNode + (*SequenceNode)(nil), // 2: krypton.resources.reconciler.v1.SequenceNode + (*ParallelNode)(nil), // 3: krypton.resources.reconciler.v1.ParallelNode + (*ConditionalNode)(nil), // 4: krypton.resources.reconciler.v1.ConditionalNode + (*TryCatchNode)(nil), // 5: krypton.resources.reconciler.v1.TryCatchNode + (*CheckpointNode)(nil), // 6: krypton.resources.reconciler.v1.CheckpointNode + (*AssertNode)(nil), // 7: krypton.resources.reconciler.v1.AssertNode + (*Predicate)(nil), // 8: krypton.resources.reconciler.v1.Predicate + (*KeyExistsPredicate)(nil), // 9: krypton.resources.reconciler.v1.KeyExistsPredicate + (*KeyStatePredicate)(nil), // 10: krypton.resources.reconciler.v1.KeyStatePredicate + (*TenantActivePredicate)(nil), // 11: krypton.resources.reconciler.v1.TenantActivePredicate + (*CredentialExistsPredicate)(nil), // 12: krypton.resources.reconciler.v1.CredentialExistsPredicate + (*AndPredicate)(nil), // 13: krypton.resources.reconciler.v1.AndPredicate + (*OrPredicate)(nil), // 14: krypton.resources.reconciler.v1.OrPredicate + (*NotPredicate)(nil), // 15: krypton.resources.reconciler.v1.NotPredicate + (*ValueRef)(nil), // 16: krypton.resources.reconciler.v1.ValueRef + (*KeySyncNode)(nil), // 17: krypton.resources.reconciler.v1.KeySyncNode + (*KeyDeleteNode)(nil), // 18: krypton.resources.reconciler.v1.KeyDeleteNode + (*KeyTransitionNode)(nil), // 19: krypton.resources.reconciler.v1.KeyTransitionNode + (*KeyRotateNode)(nil), // 20: krypton.resources.reconciler.v1.KeyRotateNode + (*KeyScheduleNode)(nil), // 21: krypton.resources.reconciler.v1.KeyScheduleNode + (*KeyScheduleSpec)(nil), // 22: krypton.resources.reconciler.v1.KeyScheduleSpec + (*CredentialSyncNode)(nil), // 23: krypton.resources.reconciler.v1.CredentialSyncNode + (*CredentialDeleteNode)(nil), // 24: krypton.resources.reconciler.v1.CredentialDeleteNode + (*BindNode)(nil), // 25: krypton.resources.reconciler.v1.BindNode + (*EmitNode)(nil), // 26: krypton.resources.reconciler.v1.EmitNode + nil, // 27: krypton.resources.reconciler.v1.ExecutionPlan.BindingsEntry + nil, // 28: krypton.resources.reconciler.v1.KeySyncNode.MetadataEntry + nil, // 29: krypton.resources.reconciler.v1.EmitNode.AttributesEntry (*timestamppb.Timestamp)(nil), // 30: google.protobuf.Timestamp (*structpb.Struct)(nil), // 31: google.protobuf.Struct } -var file_plugin_reconciler_v1_ast_proto_depIdxs = []int32{ - 1, // 0: krypton.reconciler.v1.ExecutionPlan.root:type_name -> krypton.reconciler.v1.ASTNode - 27, // 1: krypton.reconciler.v1.ExecutionPlan.bindings:type_name -> krypton.reconciler.v1.ExecutionPlan.BindingsEntry - 2, // 2: krypton.reconciler.v1.ASTNode.sequence:type_name -> krypton.reconciler.v1.SequenceNode - 3, // 3: krypton.reconciler.v1.ASTNode.parallel:type_name -> krypton.reconciler.v1.ParallelNode - 4, // 4: krypton.reconciler.v1.ASTNode.conditional:type_name -> krypton.reconciler.v1.ConditionalNode - 5, // 5: krypton.reconciler.v1.ASTNode.try_catch:type_name -> krypton.reconciler.v1.TryCatchNode - 6, // 6: krypton.reconciler.v1.ASTNode.checkpoint:type_name -> krypton.reconciler.v1.CheckpointNode - 7, // 7: krypton.reconciler.v1.ASTNode.assert:type_name -> krypton.reconciler.v1.AssertNode - 17, // 8: krypton.reconciler.v1.ASTNode.key_sync:type_name -> krypton.reconciler.v1.KeySyncNode - 18, // 9: krypton.reconciler.v1.ASTNode.key_delete:type_name -> krypton.reconciler.v1.KeyDeleteNode - 19, // 10: krypton.reconciler.v1.ASTNode.key_transition:type_name -> krypton.reconciler.v1.KeyTransitionNode - 20, // 11: krypton.reconciler.v1.ASTNode.key_rotate:type_name -> krypton.reconciler.v1.KeyRotateNode - 21, // 12: krypton.reconciler.v1.ASTNode.key_schedule:type_name -> krypton.reconciler.v1.KeyScheduleNode - 23, // 13: krypton.reconciler.v1.ASTNode.credential_sync:type_name -> krypton.reconciler.v1.CredentialSyncNode - 24, // 14: krypton.reconciler.v1.ASTNode.credential_delete:type_name -> krypton.reconciler.v1.CredentialDeleteNode - 25, // 15: krypton.reconciler.v1.ASTNode.bind:type_name -> krypton.reconciler.v1.BindNode - 26, // 16: krypton.reconciler.v1.ASTNode.emit:type_name -> krypton.reconciler.v1.EmitNode - 1, // 17: krypton.reconciler.v1.SequenceNode.steps:type_name -> krypton.reconciler.v1.ASTNode - 1, // 18: krypton.reconciler.v1.ParallelNode.steps:type_name -> krypton.reconciler.v1.ASTNode - 8, // 19: krypton.reconciler.v1.ConditionalNode.condition:type_name -> krypton.reconciler.v1.Predicate - 1, // 20: krypton.reconciler.v1.ConditionalNode.then_node:type_name -> krypton.reconciler.v1.ASTNode - 1, // 21: krypton.reconciler.v1.ConditionalNode.else_node:type_name -> krypton.reconciler.v1.ASTNode - 1, // 22: krypton.reconciler.v1.TryCatchNode.try_node:type_name -> krypton.reconciler.v1.ASTNode - 1, // 23: krypton.reconciler.v1.TryCatchNode.catch_node:type_name -> krypton.reconciler.v1.ASTNode - 8, // 24: krypton.reconciler.v1.AssertNode.condition:type_name -> krypton.reconciler.v1.Predicate - 9, // 25: krypton.reconciler.v1.Predicate.key_exists:type_name -> krypton.reconciler.v1.KeyExistsPredicate - 10, // 26: krypton.reconciler.v1.Predicate.key_state:type_name -> krypton.reconciler.v1.KeyStatePredicate - 11, // 27: krypton.reconciler.v1.Predicate.tenant_active:type_name -> krypton.reconciler.v1.TenantActivePredicate - 12, // 28: krypton.reconciler.v1.Predicate.credential_exists:type_name -> krypton.reconciler.v1.CredentialExistsPredicate - 13, // 29: krypton.reconciler.v1.Predicate.and:type_name -> krypton.reconciler.v1.AndPredicate - 14, // 30: krypton.reconciler.v1.Predicate.or:type_name -> krypton.reconciler.v1.OrPredicate - 15, // 31: krypton.reconciler.v1.Predicate.not:type_name -> krypton.reconciler.v1.NotPredicate - 16, // 32: krypton.reconciler.v1.KeyExistsPredicate.tier:type_name -> krypton.reconciler.v1.ValueRef - 16, // 33: krypton.reconciler.v1.KeyExistsPredicate.key_name:type_name -> krypton.reconciler.v1.ValueRef - 16, // 34: krypton.reconciler.v1.KeyStatePredicate.tier:type_name -> krypton.reconciler.v1.ValueRef - 16, // 35: krypton.reconciler.v1.KeyStatePredicate.key_name:type_name -> krypton.reconciler.v1.ValueRef - 16, // 36: krypton.reconciler.v1.TenantActivePredicate.tenant_id:type_name -> krypton.reconciler.v1.ValueRef - 16, // 37: krypton.reconciler.v1.CredentialExistsPredicate.name:type_name -> krypton.reconciler.v1.ValueRef - 8, // 38: krypton.reconciler.v1.AndPredicate.terms:type_name -> krypton.reconciler.v1.Predicate - 8, // 39: krypton.reconciler.v1.OrPredicate.terms:type_name -> krypton.reconciler.v1.Predicate - 8, // 40: krypton.reconciler.v1.NotPredicate.term:type_name -> krypton.reconciler.v1.Predicate - 16, // 41: krypton.reconciler.v1.KeySyncNode.tier:type_name -> krypton.reconciler.v1.ValueRef - 16, // 42: krypton.reconciler.v1.KeySyncNode.key_name:type_name -> krypton.reconciler.v1.ValueRef - 16, // 43: krypton.reconciler.v1.KeySyncNode.parent_key:type_name -> krypton.reconciler.v1.ValueRef - 22, // 44: krypton.reconciler.v1.KeySyncNode.schedule:type_name -> krypton.reconciler.v1.KeyScheduleSpec - 28, // 45: krypton.reconciler.v1.KeySyncNode.metadata:type_name -> krypton.reconciler.v1.KeySyncNode.MetadataEntry - 16, // 46: krypton.reconciler.v1.KeyDeleteNode.tier:type_name -> krypton.reconciler.v1.ValueRef - 16, // 47: krypton.reconciler.v1.KeyDeleteNode.key_name:type_name -> krypton.reconciler.v1.ValueRef - 16, // 48: krypton.reconciler.v1.KeyTransitionNode.tier:type_name -> krypton.reconciler.v1.ValueRef - 16, // 49: krypton.reconciler.v1.KeyTransitionNode.key_name:type_name -> krypton.reconciler.v1.ValueRef - 16, // 50: krypton.reconciler.v1.KeyRotateNode.tier:type_name -> krypton.reconciler.v1.ValueRef - 16, // 51: krypton.reconciler.v1.KeyRotateNode.key_name:type_name -> krypton.reconciler.v1.ValueRef - 16, // 52: krypton.reconciler.v1.KeyScheduleNode.tier:type_name -> krypton.reconciler.v1.ValueRef - 16, // 53: krypton.reconciler.v1.KeyScheduleNode.key_name:type_name -> krypton.reconciler.v1.ValueRef - 22, // 54: krypton.reconciler.v1.KeyScheduleNode.schedule:type_name -> krypton.reconciler.v1.KeyScheduleSpec - 30, // 55: krypton.reconciler.v1.KeyScheduleSpec.expires_at:type_name -> google.protobuf.Timestamp - 30, // 56: krypton.reconciler.v1.KeyScheduleSpec.scheduled_transition_at:type_name -> google.protobuf.Timestamp - 16, // 57: krypton.reconciler.v1.CredentialSyncNode.name:type_name -> krypton.reconciler.v1.ValueRef - 16, // 58: krypton.reconciler.v1.CredentialSyncNode.type:type_name -> krypton.reconciler.v1.ValueRef - 31, // 59: krypton.reconciler.v1.CredentialSyncNode.spec:type_name -> google.protobuf.Struct - 16, // 60: krypton.reconciler.v1.CredentialDeleteNode.name:type_name -> krypton.reconciler.v1.ValueRef - 16, // 61: krypton.reconciler.v1.BindNode.value:type_name -> krypton.reconciler.v1.ValueRef - 29, // 62: krypton.reconciler.v1.EmitNode.attributes:type_name -> krypton.reconciler.v1.EmitNode.AttributesEntry +var file_plugin_resources_v1_ast_proto_depIdxs = []int32{ + 1, // 0: krypton.resources.reconciler.v1.ExecutionPlan.root:type_name -> krypton.resources.reconciler.v1.ASTNode + 27, // 1: krypton.resources.reconciler.v1.ExecutionPlan.bindings:type_name -> krypton.resources.reconciler.v1.ExecutionPlan.BindingsEntry + 2, // 2: krypton.resources.reconciler.v1.ASTNode.sequence:type_name -> krypton.resources.reconciler.v1.SequenceNode + 3, // 3: krypton.resources.reconciler.v1.ASTNode.parallel:type_name -> krypton.resources.reconciler.v1.ParallelNode + 4, // 4: krypton.resources.reconciler.v1.ASTNode.conditional:type_name -> krypton.resources.reconciler.v1.ConditionalNode + 5, // 5: krypton.resources.reconciler.v1.ASTNode.try_catch:type_name -> krypton.resources.reconciler.v1.TryCatchNode + 6, // 6: krypton.resources.reconciler.v1.ASTNode.checkpoint:type_name -> krypton.resources.reconciler.v1.CheckpointNode + 7, // 7: krypton.resources.reconciler.v1.ASTNode.assert:type_name -> krypton.resources.reconciler.v1.AssertNode + 17, // 8: krypton.resources.reconciler.v1.ASTNode.key_sync:type_name -> krypton.resources.reconciler.v1.KeySyncNode + 18, // 9: krypton.resources.reconciler.v1.ASTNode.key_delete:type_name -> krypton.resources.reconciler.v1.KeyDeleteNode + 19, // 10: krypton.resources.reconciler.v1.ASTNode.key_transition:type_name -> krypton.resources.reconciler.v1.KeyTransitionNode + 20, // 11: krypton.resources.reconciler.v1.ASTNode.key_rotate:type_name -> krypton.resources.reconciler.v1.KeyRotateNode + 21, // 12: krypton.resources.reconciler.v1.ASTNode.key_schedule:type_name -> krypton.resources.reconciler.v1.KeyScheduleNode + 23, // 13: krypton.resources.reconciler.v1.ASTNode.credential_sync:type_name -> krypton.resources.reconciler.v1.CredentialSyncNode + 24, // 14: krypton.resources.reconciler.v1.ASTNode.credential_delete:type_name -> krypton.resources.reconciler.v1.CredentialDeleteNode + 25, // 15: krypton.resources.reconciler.v1.ASTNode.bind:type_name -> krypton.resources.reconciler.v1.BindNode + 26, // 16: krypton.resources.reconciler.v1.ASTNode.emit:type_name -> krypton.resources.reconciler.v1.EmitNode + 1, // 17: krypton.resources.reconciler.v1.SequenceNode.steps:type_name -> krypton.resources.reconciler.v1.ASTNode + 1, // 18: krypton.resources.reconciler.v1.ParallelNode.steps:type_name -> krypton.resources.reconciler.v1.ASTNode + 8, // 19: krypton.resources.reconciler.v1.ConditionalNode.condition:type_name -> krypton.resources.reconciler.v1.Predicate + 1, // 20: krypton.resources.reconciler.v1.ConditionalNode.then_node:type_name -> krypton.resources.reconciler.v1.ASTNode + 1, // 21: krypton.resources.reconciler.v1.ConditionalNode.else_node:type_name -> krypton.resources.reconciler.v1.ASTNode + 1, // 22: krypton.resources.reconciler.v1.TryCatchNode.try_node:type_name -> krypton.resources.reconciler.v1.ASTNode + 1, // 23: krypton.resources.reconciler.v1.TryCatchNode.catch_node:type_name -> krypton.resources.reconciler.v1.ASTNode + 8, // 24: krypton.resources.reconciler.v1.AssertNode.condition:type_name -> krypton.resources.reconciler.v1.Predicate + 9, // 25: krypton.resources.reconciler.v1.Predicate.key_exists:type_name -> krypton.resources.reconciler.v1.KeyExistsPredicate + 10, // 26: krypton.resources.reconciler.v1.Predicate.key_state:type_name -> krypton.resources.reconciler.v1.KeyStatePredicate + 11, // 27: krypton.resources.reconciler.v1.Predicate.tenant_active:type_name -> krypton.resources.reconciler.v1.TenantActivePredicate + 12, // 28: krypton.resources.reconciler.v1.Predicate.credential_exists:type_name -> krypton.resources.reconciler.v1.CredentialExistsPredicate + 13, // 29: krypton.resources.reconciler.v1.Predicate.and:type_name -> krypton.resources.reconciler.v1.AndPredicate + 14, // 30: krypton.resources.reconciler.v1.Predicate.or:type_name -> krypton.resources.reconciler.v1.OrPredicate + 15, // 31: krypton.resources.reconciler.v1.Predicate.not:type_name -> krypton.resources.reconciler.v1.NotPredicate + 16, // 32: krypton.resources.reconciler.v1.KeyExistsPredicate.tier:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 33: krypton.resources.reconciler.v1.KeyExistsPredicate.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 34: krypton.resources.reconciler.v1.KeyStatePredicate.tier:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 35: krypton.resources.reconciler.v1.KeyStatePredicate.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 36: krypton.resources.reconciler.v1.TenantActivePredicate.tenant_id:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 37: krypton.resources.reconciler.v1.CredentialExistsPredicate.name:type_name -> krypton.resources.reconciler.v1.ValueRef + 8, // 38: krypton.resources.reconciler.v1.AndPredicate.terms:type_name -> krypton.resources.reconciler.v1.Predicate + 8, // 39: krypton.resources.reconciler.v1.OrPredicate.terms:type_name -> krypton.resources.reconciler.v1.Predicate + 8, // 40: krypton.resources.reconciler.v1.NotPredicate.term:type_name -> krypton.resources.reconciler.v1.Predicate + 16, // 41: krypton.resources.reconciler.v1.KeySyncNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 42: krypton.resources.reconciler.v1.KeySyncNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 43: krypton.resources.reconciler.v1.KeySyncNode.parent_key:type_name -> krypton.resources.reconciler.v1.ValueRef + 22, // 44: krypton.resources.reconciler.v1.KeySyncNode.schedule:type_name -> krypton.resources.reconciler.v1.KeyScheduleSpec + 28, // 45: krypton.resources.reconciler.v1.KeySyncNode.metadata:type_name -> krypton.resources.reconciler.v1.KeySyncNode.MetadataEntry + 16, // 46: krypton.resources.reconciler.v1.KeyDeleteNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 47: krypton.resources.reconciler.v1.KeyDeleteNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 48: krypton.resources.reconciler.v1.KeyTransitionNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 49: krypton.resources.reconciler.v1.KeyTransitionNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 50: krypton.resources.reconciler.v1.KeyRotateNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 51: krypton.resources.reconciler.v1.KeyRotateNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 52: krypton.resources.reconciler.v1.KeyScheduleNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 53: krypton.resources.reconciler.v1.KeyScheduleNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef + 22, // 54: krypton.resources.reconciler.v1.KeyScheduleNode.schedule:type_name -> krypton.resources.reconciler.v1.KeyScheduleSpec + 30, // 55: krypton.resources.reconciler.v1.KeyScheduleSpec.expires_at:type_name -> google.protobuf.Timestamp + 30, // 56: krypton.resources.reconciler.v1.KeyScheduleSpec.scheduled_transition_at:type_name -> google.protobuf.Timestamp + 16, // 57: krypton.resources.reconciler.v1.CredentialSyncNode.name:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 58: krypton.resources.reconciler.v1.CredentialSyncNode.type:type_name -> krypton.resources.reconciler.v1.ValueRef + 31, // 59: krypton.resources.reconciler.v1.CredentialSyncNode.spec:type_name -> google.protobuf.Struct + 16, // 60: krypton.resources.reconciler.v1.CredentialDeleteNode.name:type_name -> krypton.resources.reconciler.v1.ValueRef + 16, // 61: krypton.resources.reconciler.v1.BindNode.value:type_name -> krypton.resources.reconciler.v1.ValueRef + 29, // 62: krypton.resources.reconciler.v1.EmitNode.attributes:type_name -> krypton.resources.reconciler.v1.EmitNode.AttributesEntry 63, // [63:63] is the sub-list for method output_type 63, // [63:63] is the sub-list for method input_type 63, // [63:63] is the sub-list for extension type_name @@ -2170,12 +2171,12 @@ var file_plugin_reconciler_v1_ast_proto_depIdxs = []int32{ 0, // [0:63] is the sub-list for field type_name } -func init() { file_plugin_reconciler_v1_ast_proto_init() } -func file_plugin_reconciler_v1_ast_proto_init() { - if File_plugin_reconciler_v1_ast_proto != nil { +func init() { file_plugin_resources_v1_ast_proto_init() } +func file_plugin_resources_v1_ast_proto_init() { + if File_plugin_resources_v1_ast_proto != nil { return } - file_plugin_reconciler_v1_ast_proto_msgTypes[1].OneofWrappers = []any{ + file_plugin_resources_v1_ast_proto_msgTypes[1].OneofWrappers = []any{ (*ASTNode_Sequence)(nil), (*ASTNode_Parallel)(nil), (*ASTNode_Conditional)(nil), @@ -2192,7 +2193,7 @@ func file_plugin_reconciler_v1_ast_proto_init() { (*ASTNode_Bind)(nil), (*ASTNode_Emit)(nil), } - file_plugin_reconciler_v1_ast_proto_msgTypes[8].OneofWrappers = []any{ + file_plugin_resources_v1_ast_proto_msgTypes[8].OneofWrappers = []any{ (*Predicate_KeyExists)(nil), (*Predicate_KeyState)(nil), (*Predicate_TenantActive)(nil), @@ -2201,26 +2202,26 @@ func file_plugin_reconciler_v1_ast_proto_init() { (*Predicate_Or)(nil), (*Predicate_Not)(nil), } - file_plugin_reconciler_v1_ast_proto_msgTypes[16].OneofWrappers = []any{ + file_plugin_resources_v1_ast_proto_msgTypes[16].OneofWrappers = []any{ (*ValueRef_Literal)(nil), (*ValueRef_VarRef)(nil), } - file_plugin_reconciler_v1_ast_proto_msgTypes[22].OneofWrappers = []any{} + file_plugin_resources_v1_ast_proto_msgTypes[22].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_reconciler_v1_ast_proto_rawDesc), len(file_plugin_reconciler_v1_ast_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_resources_v1_ast_proto_rawDesc), len(file_plugin_resources_v1_ast_proto_rawDesc)), NumEnums: 0, NumMessages: 30, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_plugin_reconciler_v1_ast_proto_goTypes, - DependencyIndexes: file_plugin_reconciler_v1_ast_proto_depIdxs, - MessageInfos: file_plugin_reconciler_v1_ast_proto_msgTypes, + GoTypes: file_plugin_resources_v1_ast_proto_goTypes, + DependencyIndexes: file_plugin_resources_v1_ast_proto_depIdxs, + MessageInfos: file_plugin_resources_v1_ast_proto_msgTypes, }.Build() - File_plugin_reconciler_v1_ast_proto = out.File - file_plugin_reconciler_v1_ast_proto_goTypes = nil - file_plugin_reconciler_v1_ast_proto_depIdxs = nil + File_plugin_resources_v1_ast_proto = out.File + file_plugin_resources_v1_ast_proto_goTypes = nil + file_plugin_resources_v1_ast_proto_depIdxs = nil } diff --git a/proto/plugin/reconciler/v1/ast.pb.validate.go b/proto/plugin/resources/v1/ast.pb.validate.go similarity index 99% rename from proto/plugin/reconciler/v1/ast.pb.validate.go rename to proto/plugin/resources/v1/ast.pb.validate.go index ec0d8f9..7d873d4 100644 --- a/proto/plugin/reconciler/v1/ast.pb.validate.go +++ b/proto/plugin/resources/v1/ast.pb.validate.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/reconciler/v1/ast.proto +// source: plugin/resources/v1/ast.proto package reconcilerv1 diff --git a/proto/plugin/reconciler/v1/ast.proto b/proto/plugin/resources/v1/ast.proto similarity index 98% rename from proto/plugin/reconciler/v1/ast.proto rename to proto/plugin/resources/v1/ast.proto index 03942a9..876c7e5 100644 --- a/proto/plugin/reconciler/v1/ast.proto +++ b/proto/plugin/resources/v1/ast.proto @@ -1,12 +1,10 @@ syntax = "proto3"; -package krypton.reconciler.v1; +package krypton.resources.reconciler.v1; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; -option go_package = "github.com/openkcm/krypton/proto/plugin/reconciler/v1;reconcilerv1"; - // ExecutionPlan is the root of the AST returned by a plugin's Reconcile call. // It describes every operation Krypton core must execute to drive the custom // resource to its desired state. Core is the sole executor — the plugin never diff --git a/proto/plugin/reconciler/v1/reconciler.pb.go b/proto/plugin/resources/v1/reconciler.pb.go similarity index 65% rename from proto/plugin/reconciler/v1/reconciler.pb.go rename to proto/plugin/resources/v1/reconciler.pb.go index 903b94a..abac27b 100644 --- a/proto/plugin/reconciler/v1/reconciler.pb.go +++ b/proto/plugin/resources/v1/reconciler.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.36.11 // protoc (unknown) -// source: plugin/reconciler/v1/reconciler.proto +// source: plugin/resources/v1/reconciler.proto package reconcilerv1 @@ -42,7 +42,7 @@ type ReconcileRequest struct { func (x *ReconcileRequest) Reset() { *x = ReconcileRequest{} - mi := &file_plugin_reconciler_v1_reconciler_proto_msgTypes[0] + mi := &file_plugin_resources_v1_reconciler_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -54,7 +54,7 @@ func (x *ReconcileRequest) String() string { func (*ReconcileRequest) ProtoMessage() {} func (x *ReconcileRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_reconciler_proto_msgTypes[0] + mi := &file_plugin_resources_v1_reconciler_proto_msgTypes[0] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -67,7 +67,7 @@ func (x *ReconcileRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ReconcileRequest.ProtoReflect.Descriptor instead. func (*ReconcileRequest) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_reconciler_proto_rawDescGZIP(), []int{0} + return file_plugin_resources_v1_reconciler_proto_rawDescGZIP(), []int{0} } func (x *ReconcileRequest) GetApiGroup() string { @@ -123,7 +123,7 @@ type ReconcileResponse struct { func (x *ReconcileResponse) Reset() { *x = ReconcileResponse{} - mi := &file_plugin_reconciler_v1_reconciler_proto_msgTypes[1] + mi := &file_plugin_resources_v1_reconciler_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -135,7 +135,7 @@ func (x *ReconcileResponse) String() string { func (*ReconcileResponse) ProtoMessage() {} func (x *ReconcileResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_reconciler_v1_reconciler_proto_msgTypes[1] + mi := &file_plugin_resources_v1_reconciler_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -148,7 +148,7 @@ func (x *ReconcileResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ReconcileResponse.ProtoReflect.Descriptor instead. func (*ReconcileResponse) Descriptor() ([]byte, []int) { - return file_plugin_reconciler_v1_reconciler_proto_rawDescGZIP(), []int{1} + return file_plugin_resources_v1_reconciler_proto_rawDescGZIP(), []int{1} } func (x *ReconcileResponse) GetErrorMessage() string { @@ -172,11 +172,11 @@ func (x *ReconcileResponse) GetExecutionPlan() []byte { return nil } -var File_plugin_reconciler_v1_reconciler_proto protoreflect.FileDescriptor +var File_plugin_resources_v1_reconciler_proto protoreflect.FileDescriptor -const file_plugin_reconciler_v1_reconciler_proto_rawDesc = "" + +const file_plugin_resources_v1_reconciler_proto_rawDesc = "" + "\n" + - "%plugin/reconciler/v1/reconciler.proto\x12\x15krypton.reconciler.v1\x1a\x1bbuf/validate/validate.proto\"\xc2\x01\n" + + "$plugin/resources/v1/reconciler.proto\x12\x1fkrypton.resources.reconciler.v1\x1a\x1bbuf/validate/validate.proto\"\xc2\x01\n" + "\x10ReconcileRequest\x12#\n" + "\tapi_group\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bapiGroup\x12\x1a\n" + "\x04kind\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x04kind\x12\x1a\n" + @@ -186,32 +186,32 @@ const file_plugin_reconciler_v1_reconciler_proto_rawDesc = "" + "\x11ReconcileResponse\x12#\n" + "\rerror_message\x18\x01 \x01(\tR\ferrorMessage\x12'\n" + "\x0ftransient_error\x18\x02 \x01(\bR\x0etransientError\x12%\n" + - "\x0eexecution_plan\x18\x03 \x01(\fR\rexecutionPlan2l\n" + + "\x0eexecution_plan\x18\x03 \x01(\fR\rexecutionPlan2\x80\x01\n" + "\n" + - "Reconciler\x12^\n" + - "\tReconcile\x12'.krypton.reconciler.v1.ReconcileRequest\x1a(.krypton.reconciler.v1.ReconcileResponseB\xe9\x01\n" + - "\x19com.krypton.reconciler.v1B\x0fReconcilerProtoP\x01ZEgithub.com/openkcm/plugin-sdk/proto/plugin/reconciler/v1;reconcilerv1\xa2\x02\x03KRX\xaa\x02\x15Krypton.Reconciler.V1\xca\x02\x15Krypton\\Reconciler\\V1\xe2\x02!Krypton\\Reconciler\\V1\\GPBMetadata\xea\x02\x17Krypton::Reconciler::V1b\x06proto3" + "Reconciler\x12r\n" + + "\tReconcile\x121.krypton.resources.reconciler.v1.ReconcileRequest\x1a2.krypton.resources.reconciler.v1.ReconcileResponseB\x9b\x02\n" + + "#com.krypton.resources.reconciler.v1B\x0fReconcilerProtoP\x01ZDgithub.com/openkcm/plugin-sdk/proto/plugin/resources/v1;reconcilerv1\xa2\x02\x03KRR\xaa\x02\x1fKrypton.Resources.Reconciler.V1\xca\x02\x1fKrypton\\Resources\\Reconciler\\V1\xe2\x02+Krypton\\Resources\\Reconciler\\V1\\GPBMetadata\xea\x02\"Krypton::Resources::Reconciler::V1b\x06proto3" var ( - file_plugin_reconciler_v1_reconciler_proto_rawDescOnce sync.Once - file_plugin_reconciler_v1_reconciler_proto_rawDescData []byte + file_plugin_resources_v1_reconciler_proto_rawDescOnce sync.Once + file_plugin_resources_v1_reconciler_proto_rawDescData []byte ) -func file_plugin_reconciler_v1_reconciler_proto_rawDescGZIP() []byte { - file_plugin_reconciler_v1_reconciler_proto_rawDescOnce.Do(func() { - file_plugin_reconciler_v1_reconciler_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_reconciler_v1_reconciler_proto_rawDesc), len(file_plugin_reconciler_v1_reconciler_proto_rawDesc))) +func file_plugin_resources_v1_reconciler_proto_rawDescGZIP() []byte { + file_plugin_resources_v1_reconciler_proto_rawDescOnce.Do(func() { + file_plugin_resources_v1_reconciler_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_resources_v1_reconciler_proto_rawDesc), len(file_plugin_resources_v1_reconciler_proto_rawDesc))) }) - return file_plugin_reconciler_v1_reconciler_proto_rawDescData + return file_plugin_resources_v1_reconciler_proto_rawDescData } -var file_plugin_reconciler_v1_reconciler_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_plugin_reconciler_v1_reconciler_proto_goTypes = []any{ - (*ReconcileRequest)(nil), // 0: krypton.reconciler.v1.ReconcileRequest - (*ReconcileResponse)(nil), // 1: krypton.reconciler.v1.ReconcileResponse +var file_plugin_resources_v1_reconciler_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_plugin_resources_v1_reconciler_proto_goTypes = []any{ + (*ReconcileRequest)(nil), // 0: krypton.resources.reconciler.v1.ReconcileRequest + (*ReconcileResponse)(nil), // 1: krypton.resources.reconciler.v1.ReconcileResponse } -var file_plugin_reconciler_v1_reconciler_proto_depIdxs = []int32{ - 0, // 0: krypton.reconciler.v1.Reconciler.Reconcile:input_type -> krypton.reconciler.v1.ReconcileRequest - 1, // 1: krypton.reconciler.v1.Reconciler.Reconcile:output_type -> krypton.reconciler.v1.ReconcileResponse +var file_plugin_resources_v1_reconciler_proto_depIdxs = []int32{ + 0, // 0: krypton.resources.reconciler.v1.Reconciler.Reconcile:input_type -> krypton.resources.reconciler.v1.ReconcileRequest + 1, // 1: krypton.resources.reconciler.v1.Reconciler.Reconcile:output_type -> krypton.resources.reconciler.v1.ReconcileResponse 1, // [1:2] is the sub-list for method output_type 0, // [0:1] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -219,26 +219,26 @@ var file_plugin_reconciler_v1_reconciler_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_plugin_reconciler_v1_reconciler_proto_init() } -func file_plugin_reconciler_v1_reconciler_proto_init() { - if File_plugin_reconciler_v1_reconciler_proto != nil { +func init() { file_plugin_resources_v1_reconciler_proto_init() } +func file_plugin_resources_v1_reconciler_proto_init() { + if File_plugin_resources_v1_reconciler_proto != nil { return } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_reconciler_v1_reconciler_proto_rawDesc), len(file_plugin_reconciler_v1_reconciler_proto_rawDesc)), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_resources_v1_reconciler_proto_rawDesc), len(file_plugin_resources_v1_reconciler_proto_rawDesc)), NumEnums: 0, NumMessages: 2, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_plugin_reconciler_v1_reconciler_proto_goTypes, - DependencyIndexes: file_plugin_reconciler_v1_reconciler_proto_depIdxs, - MessageInfos: file_plugin_reconciler_v1_reconciler_proto_msgTypes, + GoTypes: file_plugin_resources_v1_reconciler_proto_goTypes, + DependencyIndexes: file_plugin_resources_v1_reconciler_proto_depIdxs, + MessageInfos: file_plugin_resources_v1_reconciler_proto_msgTypes, }.Build() - File_plugin_reconciler_v1_reconciler_proto = out.File - file_plugin_reconciler_v1_reconciler_proto_goTypes = nil - file_plugin_reconciler_v1_reconciler_proto_depIdxs = nil + File_plugin_resources_v1_reconciler_proto = out.File + file_plugin_resources_v1_reconciler_proto_goTypes = nil + file_plugin_resources_v1_reconciler_proto_depIdxs = nil } diff --git a/proto/plugin/reconciler/v1/reconciler.pb.validate.go b/proto/plugin/resources/v1/reconciler.pb.validate.go similarity index 99% rename from proto/plugin/reconciler/v1/reconciler.pb.validate.go rename to proto/plugin/resources/v1/reconciler.pb.validate.go index 17b68f1..882a210 100644 --- a/proto/plugin/reconciler/v1/reconciler.pb.validate.go +++ b/proto/plugin/resources/v1/reconciler.pb.validate.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/reconciler/v1/reconciler.proto +// source: plugin/resources/v1/reconciler.proto package reconcilerv1 diff --git a/proto/plugin/reconciler/v1/reconciler.proto b/proto/plugin/resources/v1/reconciler.proto similarity index 94% rename from proto/plugin/reconciler/v1/reconciler.proto rename to proto/plugin/resources/v1/reconciler.proto index 1e10d1d..636bdd4 100644 --- a/proto/plugin/reconciler/v1/reconciler.proto +++ b/proto/plugin/resources/v1/reconciler.proto @@ -1,10 +1,9 @@ syntax = "proto3"; -package krypton.reconciler.v1; +package krypton.resources.reconciler.v1; import "buf/validate/validate.proto"; -option go_package = "github.com/openkcm/krypton/proto/plugin/reconciler/v1;reconcilerv1"; // Reconciler is the gRPC contract between Krypton core and an external // reconciler plugin. Core is the client; the plugin binary is the server. diff --git a/proto/plugin/reconciler/v1/reconciler_ext_plugin.pb.go b/proto/plugin/resources/v1/reconciler_ext_plugin.pb.go similarity index 94% rename from proto/plugin/reconciler/v1/reconciler_ext_plugin.pb.go rename to proto/plugin/resources/v1/reconciler_ext_plugin.pb.go index 0156472..351d4ae 100644 --- a/proto/plugin/reconciler/v1/reconciler_ext_plugin.pb.go +++ b/proto/plugin/resources/v1/reconciler_ext_plugin.pb.go @@ -10,7 +10,7 @@ import ( const ( Type = "Reconciler" - GRPCServiceFullName = "krypton.reconciler.v1.Reconciler" + GRPCServiceFullName = "krypton.resources.reconciler.v1.Reconciler" ) func ReconcilerPluginServer(server ReconcilerServer) api.PluginServer { diff --git a/proto/plugin/reconciler/v1/reconciler_grpc.pb.go b/proto/plugin/resources/v1/reconciler_grpc.pb.go similarity index 95% rename from proto/plugin/reconciler/v1/reconciler_grpc.pb.go rename to proto/plugin/resources/v1/reconciler_grpc.pb.go index 79018ae..9a6c02e 100644 --- a/proto/plugin/reconciler/v1/reconciler_grpc.pb.go +++ b/proto/plugin/resources/v1/reconciler_grpc.pb.go @@ -2,7 +2,7 @@ // versions: // - protoc-gen-go-grpc v1.6.1 // - protoc (unknown) -// source: plugin/reconciler/v1/reconciler.proto +// source: plugin/resources/v1/reconciler.proto package reconcilerv1 @@ -20,7 +20,7 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( - Reconciler_Reconcile_FullMethodName = "/krypton.reconciler.v1.Reconciler/Reconcile" + Reconciler_Reconcile_FullMethodName = "/krypton.resources.reconciler.v1.Reconciler/Reconcile" ) // ReconcilerClient is the client API for Reconciler service. @@ -125,7 +125,7 @@ func _Reconciler_Reconcile_Handler(srv interface{}, ctx context.Context, dec fun // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Reconciler_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "krypton.reconciler.v1.Reconciler", + ServiceName: "krypton.resources.reconciler.v1.Reconciler", HandlerType: (*ReconcilerServer)(nil), Methods: []grpc.MethodDesc{ { @@ -134,5 +134,5 @@ var Reconciler_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "plugin/reconciler/v1/reconciler.proto", + Metadata: "plugin/resources/v1/reconciler.proto", } From d89500199dcd09fcd934dfa59df3b02c43c0c199 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Thu, 21 May 2026 17:15:55 +0200 Subject: [PATCH 19/27] modify --- .../cipher_wrapper/v1/cipher_wrapper.pb.go | 280 ++++++++++-------- .../v1/cipher_wrapper.pb.validate.go | 184 +++++++++++- .../cipher_wrapper/v1/cipher_wrapper.proto | 69 ++--- 3 files changed, 356 insertions(+), 177 deletions(-) diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go index 094f23d..864f0b0 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.go @@ -23,11 +23,22 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// KeyReference identifies a specific key within an external KMS provider and +// carries all routing config the plugin needs to reach it — address, engine path, +// namespace, region, project, etc. — so no out-of-band registration is required. type KeyReference struct { - state protoimpl.MessageState `protogen:"open.v1"` - KeyId string `protobuf:"bytes,1,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` - Version *string `protobuf:"bytes,2,opt,name=version,proto3,oneof" json:"version,omitempty"` - Properties map[string]string `protobuf:"bytes,3,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + state protoimpl.MessageState `protogen:"open.v1"` + // Primary external identifier: ARN, Vault transit path, Azure key URI, + // GCP resource name, PKCS#11 label. + KeyId string `protobuf:"bytes,1,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"` + // Logical Krypton name — for providers that distinguish path from logical name + // and for audit log correlation. + KeyName *string `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3,oneof" json:"key_name,omitempty"` + // Specific version (for versioned providers: AWS KMS, Azure Key Vault). + Version *string `protobuf:"bytes,3,opt,name=version,proto3,oneof" json:"version,omitempty"` + // Provider-specific routing: address, engine_path, namespace, region, project_id … + // Always flat key-value — KMS addressing never needs nested structure. + Properties map[string]string `protobuf:"bytes,4,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -69,6 +80,13 @@ func (x *KeyReference) GetKeyId() string { return "" } +func (x *KeyReference) GetKeyName() string { + if x != nil && x.KeyName != nil { + return *x.KeyName + } + return "" +} + func (x *KeyReference) GetVersion() string { if x != nil && x.Version != nil { return *x.Version @@ -83,7 +101,63 @@ func (x *KeyReference) GetProperties() map[string]string { return nil } -// WrapRequest contains the raw key material and the context needed to encrypt it. +// EncryptedData pairs the ciphertext with the IV used during encryption. +// Kept together so storage and retrieval are always atomic — a ciphertext +// without its IV is unrecoverable. +type EncryptedData struct { + state protoimpl.MessageState `protogen:"open.v1"` + Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` + // OPTIONAL: Initialization Vector (IV) or Nonce. + // Must be provided if it was returned in the WrapResponse. + Iv []byte `protobuf:"bytes,2,opt,name=iv,proto3,oneof" json:"iv,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EncryptedData) Reset() { + *x = EncryptedData{} + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EncryptedData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EncryptedData) ProtoMessage() {} + +func (x *EncryptedData) ProtoReflect() protoreflect.Message { + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EncryptedData.ProtoReflect.Descriptor instead. +func (*EncryptedData) Descriptor() ([]byte, []int) { + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{1} +} + +func (x *EncryptedData) GetCiphertext() []byte { + if x != nil { + return x.Ciphertext + } + return nil +} + +func (x *EncryptedData) GetIv() []byte { + if x != nil { + return x.Iv + } + return nil +} + type WrapRequest struct { state protoimpl.MessageState `protogen:"open.v1"` // OPTIONAL/REQUIRED: The structured definition of the key to use. @@ -93,19 +167,16 @@ type WrapRequest struct { // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. // Kept in proto because AAD often changes per request (e.g., binding to a specific Tenant ID). Aad []byte `protobuf:"bytes,3,opt,name=aad,proto3,oneof" json:"aad,omitempty"` - // OPTIONAL: Initialization Vector (IV) or Nonce. - // Cryptographically dynamic, must remain in proto. - Iv []byte `protobuf:"bytes,4,opt,name=iv,proto3,oneof" json:"iv,omitempty"` - // OPTIONAL: Per-request dynamic context (if needed). - // Kept as an escape hatch for truly dynamic per-request overrides. - DynamicContext map[string]string `protobuf:"bytes,900,rep,name=dynamic_context,json=dynamicContext,proto3" json:"dynamic_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // IV hint: only set when the CMK engine is dictating the IV to the HSM + // (deterministic-IV hardware modes). Left unset for all software KMS providers. + IvHint []byte `protobuf:"bytes,4,opt,name=iv_hint,json=ivHint,proto3,oneof" json:"iv_hint,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *WrapRequest) Reset() { *x = WrapRequest{} - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -117,7 +188,7 @@ func (x *WrapRequest) String() string { func (*WrapRequest) ProtoMessage() {} func (x *WrapRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -130,7 +201,7 @@ func (x *WrapRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use WrapRequest.ProtoReflect.Descriptor instead. func (*WrapRequest) Descriptor() ([]byte, []int) { - return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{1} + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{2} } func (x *WrapRequest) GetKey() *KeyReference { @@ -154,16 +225,9 @@ func (x *WrapRequest) GetAad() []byte { return nil } -func (x *WrapRequest) GetIv() []byte { +func (x *WrapRequest) GetIvHint() []byte { if x != nil { - return x.Iv - } - return nil -} - -func (x *WrapRequest) GetDynamicContext() map[string]string { - if x != nil { - return x.DynamicContext + return x.IvHint } return nil } @@ -172,20 +236,17 @@ func (x *WrapRequest) GetDynamicContext() map[string]string { type WrapResponse struct { state protoimpl.MessageState `protogen:"open.v1"` // REQUIRED: The opaque, vendor-specific ciphertext. - Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` + EncryptedData *EncryptedData `protobuf:"bytes,1,opt,name=encrypted_data,json=encryptedData,proto3" json:"encrypted_data,omitempty"` // OPTIONAL: The exact key version ID used during the operation. // Some providers (like HSMs) do not have a concept of version IDs. - KeyVersionId *string `protobuf:"bytes,2,opt,name=key_version_id,json=keyVersionId,proto3,oneof" json:"key_version_id,omitempty"` - // OPTIONAL: The Initialization Vector generated by the provider. - // Returned only if the provider generated it and CMK needs to store it. - Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3,oneof" json:"iv,omitempty"` + KeyVersionId *string `protobuf:"bytes,2,opt,name=key_version_id,json=keyVersionId,proto3,oneof" json:"key_version_id,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *WrapResponse) Reset() { *x = WrapResponse{} - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -197,7 +258,7 @@ func (x *WrapResponse) String() string { func (*WrapResponse) ProtoMessage() {} func (x *WrapResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -210,12 +271,12 @@ func (x *WrapResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use WrapResponse.ProtoReflect.Descriptor instead. func (*WrapResponse) Descriptor() ([]byte, []int) { - return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{2} + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{3} } -func (x *WrapResponse) GetCiphertext() []byte { +func (x *WrapResponse) GetEncryptedData() *EncryptedData { if x != nil { - return x.Ciphertext + return x.EncryptedData } return nil } @@ -227,36 +288,21 @@ func (x *WrapResponse) GetKeyVersionId() string { return "" } -func (x *WrapResponse) GetIv() []byte { - if x != nil { - return x.Iv - } - return nil -} - -// UnwrapRequest contains the opaque ciphertext and the exact parameters -// originally used during the Wrap operation. type UnwrapRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // OPTIONAL/REQUIRED: The structured definition of the key to use. + // REQUIRED: The structured definition of the key to use. Key *KeyReference `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. - Ciphertext []byte `protobuf:"bytes,2,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"` + EncryptedData *EncryptedData `protobuf:"bytes,2,opt,name=encrypted_data,json=encryptedData,proto3" json:"encrypted_data,omitempty"` // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. - Aad []byte `protobuf:"bytes,3,opt,name=aad,proto3,oneof" json:"aad,omitempty"` - // OPTIONAL: Initialization Vector (IV) or Nonce. - // Must be provided if it was returned in the WrapResponse. - Iv []byte `protobuf:"bytes,4,opt,name=iv,proto3,oneof" json:"iv,omitempty"` - // OPTIONAL: Per-request dynamic context (if needed). - // Kept as an escape hatch for truly dynamic per-request overrides. - DynamicContext map[string]string `protobuf:"bytes,900,rep,name=dynamic_context,json=dynamicContext,proto3" json:"dynamic_context,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + Aad []byte `protobuf:"bytes,3,opt,name=aad,proto3,oneof" json:"aad,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *UnwrapRequest) Reset() { *x = UnwrapRequest{} - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -268,7 +314,7 @@ func (x *UnwrapRequest) String() string { func (*UnwrapRequest) ProtoMessage() {} func (x *UnwrapRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -281,7 +327,7 @@ func (x *UnwrapRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UnwrapRequest.ProtoReflect.Descriptor instead. func (*UnwrapRequest) Descriptor() ([]byte, []int) { - return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{3} + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{4} } func (x *UnwrapRequest) GetKey() *KeyReference { @@ -291,9 +337,9 @@ func (x *UnwrapRequest) GetKey() *KeyReference { return nil } -func (x *UnwrapRequest) GetCiphertext() []byte { +func (x *UnwrapRequest) GetEncryptedData() *EncryptedData { if x != nil { - return x.Ciphertext + return x.EncryptedData } return nil } @@ -305,20 +351,6 @@ func (x *UnwrapRequest) GetAad() []byte { return nil } -func (x *UnwrapRequest) GetIv() []byte { - if x != nil { - return x.Iv - } - return nil -} - -func (x *UnwrapRequest) GetDynamicContext() map[string]string { - if x != nil { - return x.DynamicContext - } - return nil -} - // UnwrapResponse returns the recovered raw cryptographic material. type UnwrapResponse struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -330,7 +362,7 @@ type UnwrapResponse struct { func (x *UnwrapResponse) Reset() { *x = UnwrapResponse{} - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[4] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -342,7 +374,7 @@ func (x *UnwrapResponse) String() string { func (*UnwrapResponse) ProtoMessage() {} func (x *UnwrapResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[4] + mi := &file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -355,7 +387,7 @@ func (x *UnwrapResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use UnwrapResponse.ProtoReflect.Descriptor instead. func (*UnwrapResponse) Descriptor() ([]byte, []int) { - return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{4} + return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP(), []int{5} } func (x *UnwrapResponse) GetPlaintext() []byte { @@ -369,52 +401,44 @@ var File_plugin_cipher_wrapper_v1_cipher_wrapper_proto protoreflect.FileDescript const file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc = "" + "\n" + - "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12 krypton.plugin.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\xef\x01\n" + - "\fKeyReference\x12\x15\n" + - "\x06key_id\x18\x01 \x01(\tR\x05keyId\x12\x1d\n" + - "\aversion\x18\x02 \x01(\tH\x00R\aversion\x88\x01\x01\x12^\n" + + "-plugin/cipher_wrapper/v1/cipher_wrapper.proto\x12 krypton.plugin.cipher_wrapper.v1\x1a\x1bbuf/validate/validate.proto\"\xa5\x02\n" + + "\fKeyReference\x12\x1e\n" + + "\x06key_id\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x05keyId\x12\x1e\n" + + "\bkey_name\x18\x02 \x01(\tH\x00R\akeyName\x88\x01\x01\x12\x1d\n" + + "\aversion\x18\x03 \x01(\tH\x01R\aversion\x88\x01\x01\x12^\n" + "\n" + - "properties\x18\x03 \x03(\v2>.krypton.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntryR\n" + + "properties\x18\x04 \x03(\v2>.krypton.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntryR\n" + "properties\x1a=\n" + "\x0fPropertiesEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\v\n" + + "\t_key_nameB\n" + + "\n" + + "\b_version\"T\n" + + "\rEncryptedData\x12'\n" + "\n" + - "\b_version\"\xec\x02\n" + + "ciphertext\x18\x01 \x01(\fB\a\xbaH\x04z\x02\x10\x01R\n" + + "ciphertext\x12\x13\n" + + "\x02iv\x18\x02 \x01(\fH\x00R\x02iv\x88\x01\x01B\x05\n" + + "\x03_iv\"\xca\x01\n" + "\vWrapRequest\x12H\n" + "\x03key\x18\x01 \x01(\v2..krypton.plugin.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12(\n" + "\tplaintext\x18\x02 \x01(\fB\n" + "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\tplaintext\x12\x15\n" + - "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12k\n" + - "\x0fdynamic_context\x18\x84\a \x03(\v2A.krypton.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + - "\x13DynamicContextEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + - "\x04_aadB\x05\n" + - "\x03_iv\"\x88\x01\n" + - "\fWrapResponse\x12\x1e\n" + + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x1c\n" + + "\aiv_hint\x18\x04 \x01(\fH\x01R\x06ivHint\x88\x01\x01B\x06\n" + + "\x04_aadB\n" + "\n" + - "ciphertext\x18\x01 \x01(\fR\n" + - "ciphertext\x12)\n" + - "\x0ekey_version_id\x18\x02 \x01(\tH\x00R\fkeyVersionId\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x03 \x01(\fH\x01R\x02iv\x88\x01\x01B\x11\n" + - "\x0f_key_version_idB\x05\n" + - "\x03_iv\"\xf2\x02\n" + + "\b_iv_hint\"\xa4\x01\n" + + "\fWrapResponse\x12V\n" + + "\x0eencrypted_data\x18\x01 \x01(\v2/.krypton.plugin.cipher_wrapper.v1.EncryptedDataR\rencryptedData\x12)\n" + + "\x0ekey_version_id\x18\x02 \x01(\tH\x00R\fkeyVersionId\x88\x01\x01B\x11\n" + + "\x0f_key_version_id\"\xd8\x01\n" + "\rUnwrapRequest\x12H\n" + - "\x03key\x18\x01 \x01(\v2..krypton.plugin.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12*\n" + - "\n" + - "ciphertext\x18\x02 \x01(\fB\n" + - "\xbaH\a\xc8\x01\x01z\x02\x10\x01R\n" + - "ciphertext\x12\x15\n" + - "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01\x12\x13\n" + - "\x02iv\x18\x04 \x01(\fH\x01R\x02iv\x88\x01\x01\x12m\n" + - "\x0fdynamic_context\x18\x84\a \x03(\v2C.krypton.plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntryR\x0edynamicContext\x1aA\n" + - "\x13DynamicContextEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x06\n" + - "\x04_aadB\x05\n" + - "\x03_iv\".\n" + + "\x03key\x18\x01 \x01(\v2..krypton.plugin.cipher_wrapper.v1.KeyReferenceB\x06\xbaH\x03\xc8\x01\x01R\x03key\x12^\n" + + "\x0eencrypted_data\x18\x02 \x01(\v2/.krypton.plugin.cipher_wrapper.v1.EncryptedDataB\x06\xbaH\x03\xc8\x01\x01R\rencryptedData\x12\x15\n" + + "\x03aad\x18\x03 \x01(\fH\x00R\x03aad\x88\x01\x01B\x06\n" + + "\x04_aad\".\n" + "\x0eUnwrapResponse\x12\x1c\n" + "\tplaintext\x18\x01 \x01(\fR\tplaintext2\xe3\x01\n" + "\rCipherWrapper\x12e\n" + @@ -434,27 +458,26 @@ func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescGZIP() []byte { return file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDescData } -var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes = make([]protoimpl.MessageInfo, 7) var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_goTypes = []any{ (*KeyReference)(nil), // 0: krypton.plugin.cipher_wrapper.v1.KeyReference - (*WrapRequest)(nil), // 1: krypton.plugin.cipher_wrapper.v1.WrapRequest - (*WrapResponse)(nil), // 2: krypton.plugin.cipher_wrapper.v1.WrapResponse - (*UnwrapRequest)(nil), // 3: krypton.plugin.cipher_wrapper.v1.UnwrapRequest - (*UnwrapResponse)(nil), // 4: krypton.plugin.cipher_wrapper.v1.UnwrapResponse - nil, // 5: krypton.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry - nil, // 6: krypton.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry - nil, // 7: krypton.plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry + (*EncryptedData)(nil), // 1: krypton.plugin.cipher_wrapper.v1.EncryptedData + (*WrapRequest)(nil), // 2: krypton.plugin.cipher_wrapper.v1.WrapRequest + (*WrapResponse)(nil), // 3: krypton.plugin.cipher_wrapper.v1.WrapResponse + (*UnwrapRequest)(nil), // 4: krypton.plugin.cipher_wrapper.v1.UnwrapRequest + (*UnwrapResponse)(nil), // 5: krypton.plugin.cipher_wrapper.v1.UnwrapResponse + nil, // 6: krypton.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry } var file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_depIdxs = []int32{ - 5, // 0: krypton.plugin.cipher_wrapper.v1.KeyReference.properties:type_name -> krypton.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry + 6, // 0: krypton.plugin.cipher_wrapper.v1.KeyReference.properties:type_name -> krypton.plugin.cipher_wrapper.v1.KeyReference.PropertiesEntry 0, // 1: krypton.plugin.cipher_wrapper.v1.WrapRequest.key:type_name -> krypton.plugin.cipher_wrapper.v1.KeyReference - 6, // 2: krypton.plugin.cipher_wrapper.v1.WrapRequest.dynamic_context:type_name -> krypton.plugin.cipher_wrapper.v1.WrapRequest.DynamicContextEntry + 1, // 2: krypton.plugin.cipher_wrapper.v1.WrapResponse.encrypted_data:type_name -> krypton.plugin.cipher_wrapper.v1.EncryptedData 0, // 3: krypton.plugin.cipher_wrapper.v1.UnwrapRequest.key:type_name -> krypton.plugin.cipher_wrapper.v1.KeyReference - 7, // 4: krypton.plugin.cipher_wrapper.v1.UnwrapRequest.dynamic_context:type_name -> krypton.plugin.cipher_wrapper.v1.UnwrapRequest.DynamicContextEntry - 1, // 5: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> krypton.plugin.cipher_wrapper.v1.WrapRequest - 3, // 6: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> krypton.plugin.cipher_wrapper.v1.UnwrapRequest - 2, // 7: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> krypton.plugin.cipher_wrapper.v1.WrapResponse - 4, // 8: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> krypton.plugin.cipher_wrapper.v1.UnwrapResponse + 1, // 4: krypton.plugin.cipher_wrapper.v1.UnwrapRequest.encrypted_data:type_name -> krypton.plugin.cipher_wrapper.v1.EncryptedData + 2, // 5: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Wrap:input_type -> krypton.plugin.cipher_wrapper.v1.WrapRequest + 4, // 6: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:input_type -> krypton.plugin.cipher_wrapper.v1.UnwrapRequest + 3, // 7: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Wrap:output_type -> krypton.plugin.cipher_wrapper.v1.WrapResponse + 5, // 8: krypton.plugin.cipher_wrapper.v1.CipherWrapper.Unwrap:output_type -> krypton.plugin.cipher_wrapper.v1.UnwrapResponse 7, // [7:9] is the sub-list for method output_type 5, // [5:7] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name @@ -471,13 +494,14 @@ func file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_init() { file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[1].OneofWrappers = []any{} file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[2].OneofWrappers = []any{} file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[3].OneofWrappers = []any{} + file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_msgTypes[4].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc), len(file_plugin_cipher_wrapper_v1_cipher_wrapper_proto_rawDesc)), NumEnums: 0, - NumMessages: 8, + NumMessages: 7, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go index 88c88c1..740744c 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.pb.validate.go @@ -61,6 +61,10 @@ func (m *KeyReference) validate(all bool) error { // no validation rules for Properties + if m.KeyName != nil { + // no validation rules for KeyName + } + if m.Version != nil { // no validation rules for Version } @@ -142,6 +146,112 @@ var _ interface { ErrorName() string } = KeyReferenceValidationError{} +// Validate checks the field values on EncryptedData with the rules defined in +// the proto definition for this message. If any rules are violated, the first +// error encountered is returned, or nil if there are no violations. +func (m *EncryptedData) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on EncryptedData with the rules defined +// in the proto definition for this message. If any rules are violated, the +// result is a list of violation errors wrapped in EncryptedDataMultiError, or +// nil if none found. +func (m *EncryptedData) ValidateAll() error { + return m.validate(true) +} + +func (m *EncryptedData) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + // no validation rules for Ciphertext + + if m.Iv != nil { + // no validation rules for Iv + } + + if len(errors) > 0 { + return EncryptedDataMultiError(errors) + } + + return nil +} + +// EncryptedDataMultiError is an error wrapping multiple validation errors +// returned by EncryptedData.ValidateAll() if the designated constraints +// aren't met. +type EncryptedDataMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m EncryptedDataMultiError) Error() string { + msgs := make([]string, 0, len(m)) + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m EncryptedDataMultiError) AllErrors() []error { return m } + +// EncryptedDataValidationError is the validation error returned by +// EncryptedData.Validate if the designated constraints aren't met. +type EncryptedDataValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e EncryptedDataValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e EncryptedDataValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e EncryptedDataValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e EncryptedDataValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e EncryptedDataValidationError) ErrorName() string { return "EncryptedDataValidationError" } + +// Error satisfies the builtin error interface +func (e EncryptedDataValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sEncryptedData.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = EncryptedDataValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = EncryptedDataValidationError{} + // Validate checks the field values on WrapRequest with the rules defined in // the proto definition for this message. If any rules are violated, the first // error encountered is returned, or nil if there are no violations. @@ -195,14 +305,12 @@ func (m *WrapRequest) validate(all bool) error { // no validation rules for Plaintext - // no validation rules for DynamicContext - if m.Aad != nil { // no validation rules for Aad } - if m.Iv != nil { - // no validation rules for Iv + if m.IvHint != nil { + // no validation rules for IvHint } if len(errors) > 0 { @@ -304,16 +412,39 @@ func (m *WrapResponse) validate(all bool) error { var errors []error - // no validation rules for Ciphertext + if all { + switch v := interface{}(m.GetEncryptedData()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, WrapResponseValidationError{ + field: "EncryptedData", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, WrapResponseValidationError{ + field: "EncryptedData", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetEncryptedData()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return WrapResponseValidationError{ + field: "EncryptedData", + reason: "embedded message failed validation", + cause: err, + } + } + } if m.KeyVersionId != nil { // no validation rules for KeyVersionId } - if m.Iv != nil { - // no validation rules for Iv - } - if len(errors) > 0 { return WrapResponseMultiError(errors) } @@ -442,18 +573,39 @@ func (m *UnwrapRequest) validate(all bool) error { } } - // no validation rules for Ciphertext - - // no validation rules for DynamicContext + if all { + switch v := interface{}(m.GetEncryptedData()).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, UnwrapRequestValidationError{ + field: "EncryptedData", + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, UnwrapRequestValidationError{ + field: "EncryptedData", + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(m.GetEncryptedData()).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return UnwrapRequestValidationError{ + field: "EncryptedData", + reason: "embedded message failed validation", + cause: err, + } + } + } if m.Aad != nil { // no validation rules for Aad } - if m.Iv != nil { - // no validation rules for Iv - } - if len(errors) > 0 { return UnwrapRequestMultiError(errors) } diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto index cff1318..95a346a 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto @@ -17,13 +17,37 @@ service CipherWrapper { rpc Unwrap(UnwrapRequest) returns (UnwrapResponse); } +// KeyReference identifies a specific key within an external KMS provider and +// carries all routing config the plugin needs to reach it — address, engine path, +// namespace, region, project, etc. — so no out-of-band registration is required. message KeyReference { - string key_id = 1; - optional string version = 2; - map properties = 3; + // Primary external identifier: ARN, Vault transit path, Azure key URI, + // GCP resource name, PKCS#11 label. + string key_id = 1 [(buf.validate.field).string.min_len = 1]; + + // Logical Krypton name — for providers that distinguish path from logical name + // and for audit log correlation. + optional string key_name = 2; + + // Specific version (for versioned providers: AWS KMS, Azure Key Vault). + optional string version = 3; + + // Provider-specific routing: address, engine_path, namespace, region, project_id … + // Always flat key-value — KMS addressing never needs nested structure. + map properties = 4; +} + +// EncryptedData pairs the ciphertext with the IV used during encryption. +// Kept together so storage and retrieval are always atomic — a ciphertext +// without its IV is unrecoverable. +message EncryptedData { + bytes ciphertext = 1 [(buf.validate.field).bytes.min_len = 1]; + + // OPTIONAL: Initialization Vector (IV) or Nonce. + // Must be provided if it was returned in the WrapResponse. + optional bytes iv = 2; } -// WrapRequest contains the raw key material and the context needed to encrypt it. message WrapRequest { // OPTIONAL/REQUIRED: The structured definition of the key to use. KeyReference key = 1 [(buf.validate.field).required = true]; @@ -38,51 +62,30 @@ message WrapRequest { // Kept in proto because AAD often changes per request (e.g., binding to a specific Tenant ID). optional bytes aad = 3; - // OPTIONAL: Initialization Vector (IV) or Nonce. - // Cryptographically dynamic, must remain in proto. - optional bytes iv = 4; - - // OPTIONAL: Per-request dynamic context (if needed). - // Kept as an escape hatch for truly dynamic per-request overrides. - map dynamic_context = 900; + // IV hint: only set when the CMK engine is dictating the IV to the HSM + // (deterministic-IV hardware modes). Left unset for all software KMS providers. + optional bytes iv_hint = 4; } // WrapResponse returns the provider-specific ciphertext and metadata. message WrapResponse { // REQUIRED: The opaque, vendor-specific ciphertext. - bytes ciphertext = 1; + EncryptedData encrypted_data = 1; // OPTIONAL: The exact key version ID used during the operation. // Some providers (like HSMs) do not have a concept of version IDs. optional string key_version_id = 2; - - // OPTIONAL: The Initialization Vector generated by the provider. - // Returned only if the provider generated it and CMK needs to store it. - optional bytes iv = 3; } -// UnwrapRequest contains the opaque ciphertext and the exact parameters -// originally used during the Wrap operation. message UnwrapRequest { - // OPTIONAL/REQUIRED: The structured definition of the key to use. - KeyReference key = 1 [(buf.validate.field).required = true]; + // REQUIRED: The structured definition of the key to use. + KeyReference key = 1 [(buf.validate.field).required = true]; // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. - bytes ciphertext = 2 [ - (buf.validate.field).required = true, - (buf.validate.field).bytes.min_len = 1 - ]; + EncryptedData encrypted_data = 2 [(buf.validate.field).required = true]; // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. - optional bytes aad = 3; - - // OPTIONAL: Initialization Vector (IV) or Nonce. - // Must be provided if it was returned in the WrapResponse. - optional bytes iv = 4; - - // OPTIONAL: Per-request dynamic context (if needed). - // Kept as an escape hatch for truly dynamic per-request overrides. - map dynamic_context = 900; + optional bytes aad = 3; } // UnwrapResponse returns the recovered raw cryptographic material. From 1c288bbfc947ede5f0358a1dc1ddb6935d1aedfd Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Thu, 9 Jul 2026 15:36:22 +0200 Subject: [PATCH 20/27] modify --- .../cipher_wrapper/v1/cipher_wrapper.proto | 6 +- .../v1/key_material_storage.pb.go | 55 +++--------- .../v1/key_material_storage.pb.validate.go | 10 --- .../v1/key_material_storage.proto | 7 +- proto/plugin/resources/v1/ast.proto | 86 ++++++++++--------- proto/plugin/resources/v1/reconciler.proto | 6 +- 6 files changed, 66 insertions(+), 104 deletions(-) diff --git a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto index 95a346a..fe240ac 100644 --- a/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto +++ b/proto/plugin/cipher_wrapper/v1/cipher_wrapper.proto @@ -70,7 +70,7 @@ message WrapRequest { // WrapResponse returns the provider-specific ciphertext and metadata. message WrapResponse { // REQUIRED: The opaque, vendor-specific ciphertext. - EncryptedData encrypted_data = 1; + EncryptedData encrypted_data = 1; // OPTIONAL: The exact key version ID used during the operation. // Some providers (like HSMs) do not have a concept of version IDs. @@ -79,13 +79,13 @@ message WrapResponse { message UnwrapRequest { // REQUIRED: The structured definition of the key to use. - KeyReference key = 1 [(buf.validate.field).required = true]; + KeyReference key = 1 [(buf.validate.field).required = true]; // REQUIRED: The opaque ciphertext retrieved from the CMK persistent storage. EncryptedData encrypted_data = 2 [(buf.validate.field).required = true]; // OPTIONAL: Standard Additional Authenticated Data (AAD) byte buffer. - optional bytes aad = 3; + optional bytes aad = 3; } // UnwrapResponse returns the recovered raw cryptographic material. diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index b7c0445..19dc7e8 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -26,16 +26,13 @@ const ( // KeyMaterial represents a single unit of stored data. type KeyMaterial struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - Algorithm string `protobuf:"bytes,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"` - PreviousVersionId *string `protobuf:"bytes,4,opt,name=previous_version_id,json=previousVersionId,proto3,oneof" json:"previous_version_id,omitempty"` - Checksum *string `protobuf:"bytes,5,opt,name=checksum,proto3,oneof" json:"checksum,omitempty"` - CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` - Tags map[string]string `protobuf:"bytes,7,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Tags map[string]string `protobuf:"bytes,10,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *KeyMaterial) Reset() { @@ -82,27 +79,6 @@ func (x *KeyMaterial) GetData() []byte { return nil } -func (x *KeyMaterial) GetAlgorithm() string { - if x != nil { - return x.Algorithm - } - return "" -} - -func (x *KeyMaterial) GetPreviousVersionId() string { - if x != nil && x.PreviousVersionId != nil { - return *x.PreviousVersionId - } - return "" -} - -func (x *KeyMaterial) GetChecksum() string { - if x != nil && x.Checksum != nil { - return *x.Checksum - } - return "" -} - func (x *KeyMaterial) GetCreatedAt() *timestamppb.Timestamp { if x != nil { return x.CreatedAt @@ -753,21 +729,17 @@ var File_plugin_key_material_storage_v1_key_material_storage_proto protoreflect. const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = "" + "\n" + - "9plugin/key_material_storage/v1/key_material_storage.proto\x12&krypton.plugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xac\x03\n" + + "9plugin/key_material_storage/v1/key_material_storage.proto\x12&krypton.plugin.key_material_storage.v1\x1a\x1bbuf/validate/validate.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x8a\x02\n" + "\vKeyMaterial\x12\x17\n" + "\x02id\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\x02id\x12\x1b\n" + - "\x04data\x18\x02 \x01(\fB\a\xbaH\x04z\x02\x10\x01R\x04data\x12%\n" + - "\talgorithm\x18\x03 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\talgorithm\x123\n" + - "\x13previous_version_id\x18\x04 \x01(\tH\x00R\x11previousVersionId\x88\x01\x01\x12\x1f\n" + - "\bchecksum\x18\x05 \x01(\tH\x01R\bchecksum\x88\x01\x01\x129\n" + + "\x04data\x18\x02 \x01(\fB\a\xbaH\x04z\x02\x10\x01R\x04data\x129\n" + "\n" + - "created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x12Q\n" + - "\x04tags\x18\a \x03(\v2=.krypton.plugin.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + + "created_at\x18\t \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x12Q\n" + + "\x04tags\x18\n" + + " \x03(\v2=.krypton.plugin.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + "\tTagsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x16\n" + - "\x14_previous_version_idB\v\n" + - "\t_checksum\"\xef\x04\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xef\x04\n" + "\x06Filter\x12O\n" + "\x02id\x18\x01 \x01(\v2:.krypton.plugin.key_material_storage.v1.Filter.StringMatchH\x00R\x02id\x88\x01\x01\x12!\n" + "\talgorithm\x18\x02 \x01(\tH\x01R\talgorithm\x88\x01\x01\x12L\n" + @@ -881,7 +853,6 @@ func file_plugin_key_material_storage_v1_key_material_storage_proto_init() { if File_plugin_key_material_storage_v1_key_material_storage_proto != nil { return } - file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[0].OneofWrappers = []any{} file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[1].OneofWrappers = []any{} file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[2].OneofWrappers = []any{} file_plugin_key_material_storage_v1_key_material_storage_proto_msgTypes[11].OneofWrappers = []any{ diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go index 40394cd..6b3955a 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go @@ -61,8 +61,6 @@ func (m *KeyMaterial) validate(all bool) error { // no validation rules for Data - // no validation rules for Algorithm - if all { switch v := interface{}(m.GetCreatedAt()).(type) { case interface{ ValidateAll() error }: @@ -94,14 +92,6 @@ func (m *KeyMaterial) validate(all bool) error { // no validation rules for Tags - if m.PreviousVersionId != nil { - // no validation rules for PreviousVersionId - } - - if m.Checksum != nil { - // no validation rules for Checksum - } - if len(errors) > 0 { return KeyMaterialMultiError(errors) } diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index 786f0a7..8955b6b 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -20,12 +20,9 @@ service KeyMaterialStorage { message KeyMaterial { string id = 1 [(buf.validate.field).string.min_len = 1]; bytes data = 2 [(buf.validate.field).bytes.min_len = 1]; - string algorithm = 3 [(buf.validate.field).string.min_len = 1]; + google.protobuf.Timestamp created_at = 9; - optional string previous_version_id = 4; - optional string checksum = 5; - google.protobuf.Timestamp created_at = 6; - map tags = 7; + map tags = 10; } // --- Filter Refactor --- diff --git a/proto/plugin/resources/v1/ast.proto b/proto/plugin/resources/v1/ast.proto index 876c7e5..817b07d 100644 --- a/proto/plugin/resources/v1/ast.proto +++ b/proto/plugin/resources/v1/ast.proto @@ -42,10 +42,10 @@ message ASTNode { oneof node { // ── Control flow ────────────────────────────────────────── - SequenceNode sequence = 10; - ParallelNode parallel = 11; + SequenceNode sequence = 10; + ParallelNode parallel = 11; ConditionalNode conditional = 12; - TryCatchNode try_catch = 13; + TryCatchNode try_catch = 13; // ── Checkpoint ──────────────────────────────────────────── // Persists progress at this point; uses node_id as the checkpoint name. @@ -56,14 +56,14 @@ message ASTNode { AssertNode assert = 20; // ── Key lifecycle ───────────────────────────────────────── - KeySyncNode key_sync = 30; // create or idempotently update - KeyDeleteNode key_delete = 31; // destroy key material + KeySyncNode key_sync = 30; // create or idempotently update + KeyDeleteNode key_delete = 31; // destroy key material KeyTransitionNode key_transition = 32; // explicit lifecycle state change - KeyRotateNode key_rotate = 33; // generate new key material (forced rotation) - KeyScheduleNode key_schedule = 34; // set expiry / scheduled transition + KeyRotateNode key_rotate = 33; // generate new key material (forced rotation) + KeyScheduleNode key_schedule = 34; // set expiry / scheduled transition // ── Credential lifecycle ─────────────────────────────────── - CredentialSyncNode credential_sync = 40; + CredentialSyncNode credential_sync = 40; CredentialDeleteNode credential_delete = 41; // ── Utility ─────────────────────────────────────────────── @@ -85,21 +85,21 @@ message SequenceNode { // ParallelNode fans steps out concurrently. // When fail_fast = true a single error cancels the remaining goroutines. message ParallelNode { - repeated ASTNode steps = 1; - bool fail_fast = 2; + repeated ASTNode steps = 1; + bool fail_fast = 2; } // ConditionalNode evaluates a runtime predicate and executes exactly one branch. message ConditionalNode { Predicate condition = 1; - ASTNode then_node = 2; - ASTNode else_node = 3; // optional — omit for pure guard + ASTNode then_node = 2; + ASTNode else_node = 3; // optional — omit for pure guard } // TryCatchNode executes try_node; on any error executes catch_node instead. // Useful for compensating transactions and optional / best-effort steps. message TryCatchNode { - ASTNode try_node = 1; + ASTNode try_node = 1; ASTNode catch_node = 2; } @@ -112,8 +112,8 @@ message CheckpointNode {} // ───────────────────────────────────────────────────────────── message AssertNode { - Predicate condition = 1; - string error_message = 2; + Predicate condition = 1; + string error_message = 2; } // Predicate is a composable boolean expression resolved against live Krypton @@ -121,26 +121,26 @@ message AssertNode { // what must be true. message Predicate { oneof expr { - KeyExistsPredicate key_exists = 1; - KeyStatePredicate key_state = 2; - TenantActivePredicate tenant_active = 3; + KeyExistsPredicate key_exists = 1; + KeyStatePredicate key_state = 2; + TenantActivePredicate tenant_active = 3; CredentialExistsPredicate credential_exists = 4; // Logical combinators AndPredicate and = 10; - OrPredicate or = 11; + OrPredicate or = 11; NotPredicate not = 12; } } message KeyExistsPredicate { - ValueRef tier = 1; + ValueRef tier = 1; ValueRef key_name = 2; } message KeyStatePredicate { - ValueRef tier = 1; - ValueRef key_name = 2; + ValueRef tier = 1; + ValueRef key_name = 2; // allowed_states is an OR list — matches if the key is in ANY of these states. // Valid values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, COMPROMISED, // PENDING_DESTROYING, DESTROYED. @@ -155,9 +155,15 @@ message CredentialExistsPredicate { ValueRef name = 1; } -message AndPredicate { repeated Predicate terms = 1; } -message OrPredicate { repeated Predicate terms = 1; } -message NotPredicate { Predicate term = 1; } +message AndPredicate { + repeated Predicate terms = 1; +} +message OrPredicate { + repeated Predicate terms = 1; +} +message NotPredicate { + Predicate term = 1; +} // ───────────────────────────────────────────────────────────── // Value references @@ -184,9 +190,9 @@ message ValueRef { message KeySyncNode { // tier is the Krypton tier name as declared in key-hierarchy config, // e.g. "l2-domain", "l3-service", "l4-data". - ValueRef tier = 1; + ValueRef tier = 1; // key_name is the logical name scoped to the tenant. - ValueRef key_name = 2; + ValueRef key_name = 2; // parent_key is the name of the wrapping key one tier above. // Required for all tiers except L1 root keys. ValueRef parent_key = 3; @@ -199,7 +205,7 @@ message KeySyncNode { // KeyDeleteNode destroys key material and all version lineages. // Core enforces that no child keys exist before allowing deletion. message KeyDeleteNode { - ValueRef tier = 1; + ValueRef tier = 1; ValueRef key_name = 2; } @@ -207,22 +213,22 @@ message KeyDeleteNode { // Valid target_state values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, // COMPROMISED, PENDING_DESTROYING, DESTROYED. message KeyTransitionNode { - ValueRef tier = 1; - ValueRef key_name = 2; - string target_state = 3; + ValueRef tier = 1; + ValueRef key_name = 2; + string target_state = 3; } // KeyRotateNode generates new key material under the same logical key name // (forced rotation — bypasses the idempotency guard in ProvisionKey). // On success, result_var receives the new key ULID. message KeyRotateNode { - ValueRef tier = 1; + ValueRef tier = 1; ValueRef key_name = 2; } // KeyScheduleNode updates the scheduled lifecycle transition for an existing key. message KeyScheduleNode { - ValueRef tier = 1; + ValueRef tier = 1; ValueRef key_name = 2; KeyScheduleSpec schedule = 3; } @@ -230,10 +236,10 @@ message KeyScheduleNode { // KeyScheduleSpec carries timing parameters for a scheduled state transition. // All fields are optional — set only the ones you need. message KeyScheduleSpec { - optional google.protobuf.Timestamp expires_at = 1; + optional google.protobuf.Timestamp expires_at = 1; optional google.protobuf.Timestamp scheduled_transition_at = 2; // transition_to is the target KeyState when scheduled_transition_at fires. - optional string transition_to = 3; + optional string transition_to = 3; } // ───────────────────────────────────────────────────────────── @@ -243,8 +249,8 @@ message KeyScheduleSpec { // CredentialSyncNode creates or updates a credential. // spec is the full credential payload; core encrypts it using the tenant keyring. message CredentialSyncNode { - ValueRef name = 1; - ValueRef type = 2; + ValueRef name = 1; + ValueRef type = 2; google.protobuf.Struct spec = 3; } @@ -260,12 +266,12 @@ message CredentialDeleteNode { // BindNode sets a named variable in the execution state. // Useful for deriving values from existing bindings before referencing them. message BindNode { - string var_name = 1; - ValueRef value = 2; + string var_name = 1; + ValueRef value = 2; } // EmitNode writes a structured event to Krypton's audit trail. message EmitNode { - string event_type = 1; + string event_type = 1; map attributes = 2; } diff --git a/proto/plugin/resources/v1/reconciler.proto b/proto/plugin/resources/v1/reconciler.proto index 636bdd4..635e989 100644 --- a/proto/plugin/resources/v1/reconciler.proto +++ b/proto/plugin/resources/v1/reconciler.proto @@ -4,7 +4,6 @@ package krypton.resources.reconciler.v1; import "buf/validate/validate.proto"; - // Reconciler is the gRPC contract between Krypton core and an external // reconciler plugin. Core is the client; the plugin binary is the server. // @@ -40,11 +39,10 @@ message ReconcileResponse { // error_message non-empty means planning failed. // transient_error = true → worker requeues up to max retries. // transient_error = false → worker marks operation as terminally failed. - string error_message = 1; - bool transient_error = 2; + string error_message = 1; + bool transient_error = 2; // execution_plan is a JSON-encoded ast.ExecutionPlan (see // internal/modules/resource-reconciler/controller/ast). Empty means no-op. bytes execution_plan = 3; } - From 8224c630819658be36c830e1be30e90bb0e402ec Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Thu, 9 Jul 2026 15:47:43 +0200 Subject: [PATCH 21/27] modify --- .../v1/key_material_storage.pb.go | 24 +++++-------------- .../v1/key_material_storage.pb.validate.go | 4 ---- .../v1/key_material_storage.proto | 7 ++---- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go index 19dc7e8..3cf5438 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.go @@ -96,11 +96,9 @@ func (x *KeyMaterial) GetTags() map[string]string { type Filter struct { state protoimpl.MessageState `protogen:"open.v1"` Id *Filter_StringMatch `protobuf:"bytes,1,opt,name=id,proto3,oneof" json:"id,omitempty"` - // Filter by cryptographic algorithm (e.g., "AES-256-GCM"). - Algorithm *string `protobuf:"bytes,2,opt,name=algorithm,proto3,oneof" json:"algorithm,omitempty"` // Filter by metadata tags (e.g., {"env": "prod"}). // Match is typically performed as "contains all". - Tags map[string]string `protobuf:"bytes,3,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Tags map[string]string `protobuf:"bytes,2,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` CreatedAt *Filter_TimeRange `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3,oneof" json:"created_at,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -143,13 +141,6 @@ func (x *Filter) GetId() *Filter_StringMatch { return nil } -func (x *Filter) GetAlgorithm() string { - if x != nil && x.Algorithm != nil { - return *x.Algorithm - } - return "" -} - func (x *Filter) GetTags() map[string]string { if x != nil { return x.Tags @@ -739,13 +730,12 @@ const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = " " \x03(\v2=.krypton.plugin.key_material_storage.v1.KeyMaterial.TagsEntryR\x04tags\x1a7\n" + "\tTagsEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xef\x04\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xbe\x04\n" + "\x06Filter\x12O\n" + - "\x02id\x18\x01 \x01(\v2:.krypton.plugin.key_material_storage.v1.Filter.StringMatchH\x00R\x02id\x88\x01\x01\x12!\n" + - "\talgorithm\x18\x02 \x01(\tH\x01R\talgorithm\x88\x01\x01\x12L\n" + - "\x04tags\x18\x03 \x03(\v28.krypton.plugin.key_material_storage.v1.Filter.TagsEntryR\x04tags\x12\\\n" + + "\x02id\x18\x01 \x01(\v2:.krypton.plugin.key_material_storage.v1.Filter.StringMatchH\x00R\x02id\x88\x01\x01\x12L\n" + + "\x04tags\x18\x02 \x03(\v28.krypton.plugin.key_material_storage.v1.Filter.TagsEntryR\x04tags\x12\\\n" + "\n" + - "created_at\x18\x04 \x01(\v28.krypton.plugin.key_material_storage.v1.Filter.TimeRangeH\x02R\tcreatedAt\x88\x01\x01\x1a\x7f\n" + + "created_at\x18\x04 \x01(\v28.krypton.plugin.key_material_storage.v1.Filter.TimeRangeH\x01R\tcreatedAt\x88\x01\x01\x1a\x7f\n" + "\vStringMatch\x12\x18\n" + "\x06prefix\x18\x01 \x01(\tH\x00R\x06prefix\x12\x18\n" + "\x06suffix\x18\x02 \x01(\tH\x00R\x06suffix\x12\x1c\n" + @@ -758,9 +748,7 @@ const file_plugin_key_material_storage_v1_key_material_storage_proto_rawDesc = " "\tTimeRange\x12.\n" + "\x04from\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\x04from\x12*\n" + "\x02to\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x02toB\x05\n" + - "\x03_idB\f\n" + - "\n" + - "_algorithmB\r\n" + + "\x03_idB\r\n" + "\v_created_at\"\xcb\x01\n" + "\x0eListIDsRequest\x12%\n" + "\tnamespace\x18\x01 \x01(\tB\a\xbaH\x04r\x02\x10\x01R\tnamespace\x12K\n" + diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go index 6b3955a..ae5a989 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go +++ b/proto/plugin/key_material_storage/v1/key_material_storage.pb.validate.go @@ -225,10 +225,6 @@ func (m *Filter) validate(all bool) error { } - if m.Algorithm != nil { - // no validation rules for Algorithm - } - if m.CreatedAt != nil { if all { diff --git a/proto/plugin/key_material_storage/v1/key_material_storage.proto b/proto/plugin/key_material_storage/v1/key_material_storage.proto index 8955b6b..23d353d 100644 --- a/proto/plugin/key_material_storage/v1/key_material_storage.proto +++ b/proto/plugin/key_material_storage/v1/key_material_storage.proto @@ -20,8 +20,8 @@ service KeyMaterialStorage { message KeyMaterial { string id = 1 [(buf.validate.field).string.min_len = 1]; bytes data = 2 [(buf.validate.field).bytes.min_len = 1]; - google.protobuf.Timestamp created_at = 9; + google.protobuf.Timestamp created_at = 9; map tags = 10; } @@ -39,12 +39,9 @@ message Filter { } optional StringMatch id = 1; - // Filter by cryptographic algorithm (e.g., "AES-256-GCM"). - optional string algorithm = 2; - // Filter by metadata tags (e.g., {"env": "prod"}). // Match is typically performed as "contains all". - map tags = 3; + map tags = 2; // Filter by the time the key was created. message TimeRange { From 08699e0c4c6cb6da0825d7349b325ccf54bb689d Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Fri, 24 Jul 2026 12:05:24 +0200 Subject: [PATCH 22/27] modify --- proto/plugin/resources/v1/ast.pb.go | 2227 -------- proto/plugin/resources/v1/ast.pb.validate.go | 4835 ----------------- proto/plugin/resources/v1/ast.proto | 277 - proto/plugin/resources/v1/reconciler.pb.go | 244 - .../resources/v1/reconciler.pb.validate.go | 254 - proto/plugin/resources/v1/reconciler.proto | 48 - .../resources/v1/reconciler_ext_plugin.pb.go | 56 - .../plugin/resources/v1/reconciler_grpc.pb.go | 138 - 8 files changed, 8079 deletions(-) delete mode 100644 proto/plugin/resources/v1/ast.pb.go delete mode 100644 proto/plugin/resources/v1/ast.pb.validate.go delete mode 100644 proto/plugin/resources/v1/ast.proto delete mode 100644 proto/plugin/resources/v1/reconciler.pb.go delete mode 100644 proto/plugin/resources/v1/reconciler.pb.validate.go delete mode 100644 proto/plugin/resources/v1/reconciler.proto delete mode 100644 proto/plugin/resources/v1/reconciler_ext_plugin.pb.go delete mode 100644 proto/plugin/resources/v1/reconciler_grpc.pb.go diff --git a/proto/plugin/resources/v1/ast.pb.go b/proto/plugin/resources/v1/ast.pb.go deleted file mode 100644 index d3fb9a8..0000000 --- a/proto/plugin/resources/v1/ast.pb.go +++ /dev/null @@ -1,2227 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.11 -// protoc (unknown) -// source: plugin/resources/v1/ast.proto - -package reconcilerv1 - -import ( - reflect "reflect" - sync "sync" - unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - structpb "google.golang.org/protobuf/types/known/structpb" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// ExecutionPlan is the root of the AST returned by a plugin's Reconcile call. -// It describes every operation Krypton core must execute to drive the custom -// resource to its desired state. Core is the sole executor — the plugin never -// touches keys, state, or the database directly. -type ExecutionPlan struct { - state protoimpl.MessageState `protogen:"open.v1"` - // plan_id identifies this plan for tracing. Recommended: echo the operation ID. - PlanId string `protobuf:"bytes,1,opt,name=plan_id,json=planId,proto3" json:"plan_id,omitempty"` - // root is the root node of the execution tree. - Root *ASTNode `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"` - // bindings are pre-declared variables available to every node in the plan. - // Use them to pass tenant_id, api_group, external IDs, or any other values - // the plugin resolved during planning and wants to thread through execution. - Bindings map[string]string `protobuf:"bytes,3,rep,name=bindings,proto3" json:"bindings,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ExecutionPlan) Reset() { - *x = ExecutionPlan{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ExecutionPlan) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ExecutionPlan) ProtoMessage() {} - -func (x *ExecutionPlan) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ExecutionPlan.ProtoReflect.Descriptor instead. -func (*ExecutionPlan) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{0} -} - -func (x *ExecutionPlan) GetPlanId() string { - if x != nil { - return x.PlanId - } - return "" -} - -func (x *ExecutionPlan) GetRoot() *ASTNode { - if x != nil { - return x.Root - } - return nil -} - -func (x *ExecutionPlan) GetBindings() map[string]string { - if x != nil { - return x.Bindings - } - return nil -} - -type ASTNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - // node_id is an optional stable identifier used for checkpoint persistence. - // When set, the executor stores progress so retries resume from here. - // Must be stable across retries (use a semantic name, not a random UUID). - NodeId string `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - // label is a human-readable description surfaced in logs and audit events. - Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` - // result_var, when non-empty, binds the primary string output of this node - // (typically a provisioned key ID) into the execution state so downstream - // nodes can reference it via ValueRef.var_ref. - ResultVar string `protobuf:"bytes,3,opt,name=result_var,json=resultVar,proto3" json:"result_var,omitempty"` - // Types that are valid to be assigned to Node: - // - // *ASTNode_Sequence - // *ASTNode_Parallel - // *ASTNode_Conditional - // *ASTNode_TryCatch - // *ASTNode_Checkpoint - // *ASTNode_Assert - // *ASTNode_KeySync - // *ASTNode_KeyDelete - // *ASTNode_KeyTransition - // *ASTNode_KeyRotate - // *ASTNode_KeySchedule - // *ASTNode_CredentialSync - // *ASTNode_CredentialDelete - // *ASTNode_Bind - // *ASTNode_Emit - Node isASTNode_Node `protobuf_oneof:"node"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ASTNode) Reset() { - *x = ASTNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ASTNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ASTNode) ProtoMessage() {} - -func (x *ASTNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ASTNode.ProtoReflect.Descriptor instead. -func (*ASTNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{1} -} - -func (x *ASTNode) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *ASTNode) GetLabel() string { - if x != nil { - return x.Label - } - return "" -} - -func (x *ASTNode) GetResultVar() string { - if x != nil { - return x.ResultVar - } - return "" -} - -func (x *ASTNode) GetNode() isASTNode_Node { - if x != nil { - return x.Node - } - return nil -} - -func (x *ASTNode) GetSequence() *SequenceNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_Sequence); ok { - return x.Sequence - } - } - return nil -} - -func (x *ASTNode) GetParallel() *ParallelNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_Parallel); ok { - return x.Parallel - } - } - return nil -} - -func (x *ASTNode) GetConditional() *ConditionalNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_Conditional); ok { - return x.Conditional - } - } - return nil -} - -func (x *ASTNode) GetTryCatch() *TryCatchNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_TryCatch); ok { - return x.TryCatch - } - } - return nil -} - -func (x *ASTNode) GetCheckpoint() *CheckpointNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_Checkpoint); ok { - return x.Checkpoint - } - } - return nil -} - -func (x *ASTNode) GetAssert() *AssertNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_Assert); ok { - return x.Assert - } - } - return nil -} - -func (x *ASTNode) GetKeySync() *KeySyncNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_KeySync); ok { - return x.KeySync - } - } - return nil -} - -func (x *ASTNode) GetKeyDelete() *KeyDeleteNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_KeyDelete); ok { - return x.KeyDelete - } - } - return nil -} - -func (x *ASTNode) GetKeyTransition() *KeyTransitionNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_KeyTransition); ok { - return x.KeyTransition - } - } - return nil -} - -func (x *ASTNode) GetKeyRotate() *KeyRotateNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_KeyRotate); ok { - return x.KeyRotate - } - } - return nil -} - -func (x *ASTNode) GetKeySchedule() *KeyScheduleNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_KeySchedule); ok { - return x.KeySchedule - } - } - return nil -} - -func (x *ASTNode) GetCredentialSync() *CredentialSyncNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_CredentialSync); ok { - return x.CredentialSync - } - } - return nil -} - -func (x *ASTNode) GetCredentialDelete() *CredentialDeleteNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_CredentialDelete); ok { - return x.CredentialDelete - } - } - return nil -} - -func (x *ASTNode) GetBind() *BindNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_Bind); ok { - return x.Bind - } - } - return nil -} - -func (x *ASTNode) GetEmit() *EmitNode { - if x != nil { - if x, ok := x.Node.(*ASTNode_Emit); ok { - return x.Emit - } - } - return nil -} - -type isASTNode_Node interface { - isASTNode_Node() -} - -type ASTNode_Sequence struct { - // ── Control flow ────────────────────────────────────────── - Sequence *SequenceNode `protobuf:"bytes,10,opt,name=sequence,proto3,oneof"` -} - -type ASTNode_Parallel struct { - Parallel *ParallelNode `protobuf:"bytes,11,opt,name=parallel,proto3,oneof"` -} - -type ASTNode_Conditional struct { - Conditional *ConditionalNode `protobuf:"bytes,12,opt,name=conditional,proto3,oneof"` -} - -type ASTNode_TryCatch struct { - TryCatch *TryCatchNode `protobuf:"bytes,13,opt,name=try_catch,json=tryCatch,proto3,oneof"` -} - -type ASTNode_Checkpoint struct { - // ── Checkpoint ──────────────────────────────────────────── - // Persists progress at this point; uses node_id as the checkpoint name. - Checkpoint *CheckpointNode `protobuf:"bytes,14,opt,name=checkpoint,proto3,oneof"` -} - -type ASTNode_Assert struct { - // ── Assertions / pre-conditions ─────────────────────────── - // Fails the plan with error_message if the predicate is false. - Assert *AssertNode `protobuf:"bytes,20,opt,name=assert,proto3,oneof"` -} - -type ASTNode_KeySync struct { - // ── Key lifecycle ───────────────────────────────────────── - KeySync *KeySyncNode `protobuf:"bytes,30,opt,name=key_sync,json=keySync,proto3,oneof"` // create or idempotently update -} - -type ASTNode_KeyDelete struct { - KeyDelete *KeyDeleteNode `protobuf:"bytes,31,opt,name=key_delete,json=keyDelete,proto3,oneof"` // destroy key material -} - -type ASTNode_KeyTransition struct { - KeyTransition *KeyTransitionNode `protobuf:"bytes,32,opt,name=key_transition,json=keyTransition,proto3,oneof"` // explicit lifecycle state change -} - -type ASTNode_KeyRotate struct { - KeyRotate *KeyRotateNode `protobuf:"bytes,33,opt,name=key_rotate,json=keyRotate,proto3,oneof"` // generate new key material (forced rotation) -} - -type ASTNode_KeySchedule struct { - KeySchedule *KeyScheduleNode `protobuf:"bytes,34,opt,name=key_schedule,json=keySchedule,proto3,oneof"` // set expiry / scheduled transition -} - -type ASTNode_CredentialSync struct { - // ── Credential lifecycle ─────────────────────────────────── - CredentialSync *CredentialSyncNode `protobuf:"bytes,40,opt,name=credential_sync,json=credentialSync,proto3,oneof"` -} - -type ASTNode_CredentialDelete struct { - CredentialDelete *CredentialDeleteNode `protobuf:"bytes,41,opt,name=credential_delete,json=credentialDelete,proto3,oneof"` -} - -type ASTNode_Bind struct { - // ── Utility ─────────────────────────────────────────────── - Bind *BindNode `protobuf:"bytes,60,opt,name=bind,proto3,oneof"` // set a variable in execution state -} - -type ASTNode_Emit struct { - Emit *EmitNode `protobuf:"bytes,61,opt,name=emit,proto3,oneof"` // write a custom audit event -} - -func (*ASTNode_Sequence) isASTNode_Node() {} - -func (*ASTNode_Parallel) isASTNode_Node() {} - -func (*ASTNode_Conditional) isASTNode_Node() {} - -func (*ASTNode_TryCatch) isASTNode_Node() {} - -func (*ASTNode_Checkpoint) isASTNode_Node() {} - -func (*ASTNode_Assert) isASTNode_Node() {} - -func (*ASTNode_KeySync) isASTNode_Node() {} - -func (*ASTNode_KeyDelete) isASTNode_Node() {} - -func (*ASTNode_KeyTransition) isASTNode_Node() {} - -func (*ASTNode_KeyRotate) isASTNode_Node() {} - -func (*ASTNode_KeySchedule) isASTNode_Node() {} - -func (*ASTNode_CredentialSync) isASTNode_Node() {} - -func (*ASTNode_CredentialDelete) isASTNode_Node() {} - -func (*ASTNode_Bind) isASTNode_Node() {} - -func (*ASTNode_Emit) isASTNode_Node() {} - -// SequenceNode runs steps in order; the first error aborts the remainder -// and triggers rollback of already-executed steps (same as Pipeline). -type SequenceNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Steps []*ASTNode `protobuf:"bytes,1,rep,name=steps,proto3" json:"steps,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *SequenceNode) Reset() { - *x = SequenceNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *SequenceNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*SequenceNode) ProtoMessage() {} - -func (x *SequenceNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[2] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use SequenceNode.ProtoReflect.Descriptor instead. -func (*SequenceNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{2} -} - -func (x *SequenceNode) GetSteps() []*ASTNode { - if x != nil { - return x.Steps - } - return nil -} - -// ParallelNode fans steps out concurrently. -// When fail_fast = true a single error cancels the remaining goroutines. -type ParallelNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Steps []*ASTNode `protobuf:"bytes,1,rep,name=steps,proto3" json:"steps,omitempty"` - FailFast bool `protobuf:"varint,2,opt,name=fail_fast,json=failFast,proto3" json:"fail_fast,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ParallelNode) Reset() { - *x = ParallelNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ParallelNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParallelNode) ProtoMessage() {} - -func (x *ParallelNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[3] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ParallelNode.ProtoReflect.Descriptor instead. -func (*ParallelNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{3} -} - -func (x *ParallelNode) GetSteps() []*ASTNode { - if x != nil { - return x.Steps - } - return nil -} - -func (x *ParallelNode) GetFailFast() bool { - if x != nil { - return x.FailFast - } - return false -} - -// ConditionalNode evaluates a runtime predicate and executes exactly one branch. -type ConditionalNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Condition *Predicate `protobuf:"bytes,1,opt,name=condition,proto3" json:"condition,omitempty"` - ThenNode *ASTNode `protobuf:"bytes,2,opt,name=then_node,json=thenNode,proto3" json:"then_node,omitempty"` - ElseNode *ASTNode `protobuf:"bytes,3,opt,name=else_node,json=elseNode,proto3" json:"else_node,omitempty"` // optional — omit for pure guard - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ConditionalNode) Reset() { - *x = ConditionalNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ConditionalNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ConditionalNode) ProtoMessage() {} - -func (x *ConditionalNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[4] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ConditionalNode.ProtoReflect.Descriptor instead. -func (*ConditionalNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{4} -} - -func (x *ConditionalNode) GetCondition() *Predicate { - if x != nil { - return x.Condition - } - return nil -} - -func (x *ConditionalNode) GetThenNode() *ASTNode { - if x != nil { - return x.ThenNode - } - return nil -} - -func (x *ConditionalNode) GetElseNode() *ASTNode { - if x != nil { - return x.ElseNode - } - return nil -} - -// TryCatchNode executes try_node; on any error executes catch_node instead. -// Useful for compensating transactions and optional / best-effort steps. -type TryCatchNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - TryNode *ASTNode `protobuf:"bytes,1,opt,name=try_node,json=tryNode,proto3" json:"try_node,omitempty"` - CatchNode *ASTNode `protobuf:"bytes,2,opt,name=catch_node,json=catchNode,proto3" json:"catch_node,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *TryCatchNode) Reset() { - *x = TryCatchNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *TryCatchNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TryCatchNode) ProtoMessage() {} - -func (x *TryCatchNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[5] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TryCatchNode.ProtoReflect.Descriptor instead. -func (*TryCatchNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{5} -} - -func (x *TryCatchNode) GetTryNode() *ASTNode { - if x != nil { - return x.TryNode - } - return nil -} - -func (x *TryCatchNode) GetCatchNode() *ASTNode { - if x != nil { - return x.CatchNode - } - return nil -} - -// CheckpointNode persists the current execution position so retries skip -// completed steps. Uses the parent ASTNode.node_id as the checkpoint name. -type CheckpointNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CheckpointNode) Reset() { - *x = CheckpointNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CheckpointNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CheckpointNode) ProtoMessage() {} - -func (x *CheckpointNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[6] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CheckpointNode.ProtoReflect.Descriptor instead. -func (*CheckpointNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{6} -} - -type AssertNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Condition *Predicate `protobuf:"bytes,1,opt,name=condition,proto3" json:"condition,omitempty"` - ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AssertNode) Reset() { - *x = AssertNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AssertNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AssertNode) ProtoMessage() {} - -func (x *AssertNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[7] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AssertNode.ProtoReflect.Descriptor instead. -func (*AssertNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{7} -} - -func (x *AssertNode) GetCondition() *Predicate { - if x != nil { - return x.Condition - } - return nil -} - -func (x *AssertNode) GetErrorMessage() string { - if x != nil { - return x.ErrorMessage - } - return "" -} - -// Predicate is a composable boolean expression resolved against live Krypton -// state at execution time. Core owns all state reads; the plugin only declares -// what must be true. -type Predicate struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to Expr: - // - // *Predicate_KeyExists - // *Predicate_KeyState - // *Predicate_TenantActive - // *Predicate_CredentialExists - // *Predicate_And - // *Predicate_Or - // *Predicate_Not - Expr isPredicate_Expr `protobuf_oneof:"expr"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *Predicate) Reset() { - *x = Predicate{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *Predicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Predicate) ProtoMessage() {} - -func (x *Predicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[8] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Predicate.ProtoReflect.Descriptor instead. -func (*Predicate) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{8} -} - -func (x *Predicate) GetExpr() isPredicate_Expr { - if x != nil { - return x.Expr - } - return nil -} - -func (x *Predicate) GetKeyExists() *KeyExistsPredicate { - if x != nil { - if x, ok := x.Expr.(*Predicate_KeyExists); ok { - return x.KeyExists - } - } - return nil -} - -func (x *Predicate) GetKeyState() *KeyStatePredicate { - if x != nil { - if x, ok := x.Expr.(*Predicate_KeyState); ok { - return x.KeyState - } - } - return nil -} - -func (x *Predicate) GetTenantActive() *TenantActivePredicate { - if x != nil { - if x, ok := x.Expr.(*Predicate_TenantActive); ok { - return x.TenantActive - } - } - return nil -} - -func (x *Predicate) GetCredentialExists() *CredentialExistsPredicate { - if x != nil { - if x, ok := x.Expr.(*Predicate_CredentialExists); ok { - return x.CredentialExists - } - } - return nil -} - -func (x *Predicate) GetAnd() *AndPredicate { - if x != nil { - if x, ok := x.Expr.(*Predicate_And); ok { - return x.And - } - } - return nil -} - -func (x *Predicate) GetOr() *OrPredicate { - if x != nil { - if x, ok := x.Expr.(*Predicate_Or); ok { - return x.Or - } - } - return nil -} - -func (x *Predicate) GetNot() *NotPredicate { - if x != nil { - if x, ok := x.Expr.(*Predicate_Not); ok { - return x.Not - } - } - return nil -} - -type isPredicate_Expr interface { - isPredicate_Expr() -} - -type Predicate_KeyExists struct { - KeyExists *KeyExistsPredicate `protobuf:"bytes,1,opt,name=key_exists,json=keyExists,proto3,oneof"` -} - -type Predicate_KeyState struct { - KeyState *KeyStatePredicate `protobuf:"bytes,2,opt,name=key_state,json=keyState,proto3,oneof"` -} - -type Predicate_TenantActive struct { - TenantActive *TenantActivePredicate `protobuf:"bytes,3,opt,name=tenant_active,json=tenantActive,proto3,oneof"` -} - -type Predicate_CredentialExists struct { - CredentialExists *CredentialExistsPredicate `protobuf:"bytes,4,opt,name=credential_exists,json=credentialExists,proto3,oneof"` -} - -type Predicate_And struct { - // Logical combinators - And *AndPredicate `protobuf:"bytes,10,opt,name=and,proto3,oneof"` -} - -type Predicate_Or struct { - Or *OrPredicate `protobuf:"bytes,11,opt,name=or,proto3,oneof"` -} - -type Predicate_Not struct { - Not *NotPredicate `protobuf:"bytes,12,opt,name=not,proto3,oneof"` -} - -func (*Predicate_KeyExists) isPredicate_Expr() {} - -func (*Predicate_KeyState) isPredicate_Expr() {} - -func (*Predicate_TenantActive) isPredicate_Expr() {} - -func (*Predicate_CredentialExists) isPredicate_Expr() {} - -func (*Predicate_And) isPredicate_Expr() {} - -func (*Predicate_Or) isPredicate_Expr() {} - -func (*Predicate_Not) isPredicate_Expr() {} - -type KeyExistsPredicate struct { - state protoimpl.MessageState `protogen:"open.v1"` - Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` - KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeyExistsPredicate) Reset() { - *x = KeyExistsPredicate{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeyExistsPredicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyExistsPredicate) ProtoMessage() {} - -func (x *KeyExistsPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[9] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyExistsPredicate.ProtoReflect.Descriptor instead. -func (*KeyExistsPredicate) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{9} -} - -func (x *KeyExistsPredicate) GetTier() *ValueRef { - if x != nil { - return x.Tier - } - return nil -} - -func (x *KeyExistsPredicate) GetKeyName() *ValueRef { - if x != nil { - return x.KeyName - } - return nil -} - -type KeyStatePredicate struct { - state protoimpl.MessageState `protogen:"open.v1"` - Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` - KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` - // allowed_states is an OR list — matches if the key is in ANY of these states. - // Valid values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, COMPROMISED, - // - // PENDING_DESTROYING, DESTROYED. - AllowedStates []string `protobuf:"bytes,3,rep,name=allowed_states,json=allowedStates,proto3" json:"allowed_states,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeyStatePredicate) Reset() { - *x = KeyStatePredicate{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeyStatePredicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyStatePredicate) ProtoMessage() {} - -func (x *KeyStatePredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[10] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyStatePredicate.ProtoReflect.Descriptor instead. -func (*KeyStatePredicate) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{10} -} - -func (x *KeyStatePredicate) GetTier() *ValueRef { - if x != nil { - return x.Tier - } - return nil -} - -func (x *KeyStatePredicate) GetKeyName() *ValueRef { - if x != nil { - return x.KeyName - } - return nil -} - -func (x *KeyStatePredicate) GetAllowedStates() []string { - if x != nil { - return x.AllowedStates - } - return nil -} - -type TenantActivePredicate struct { - state protoimpl.MessageState `protogen:"open.v1"` - TenantId *ValueRef `protobuf:"bytes,1,opt,name=tenant_id,json=tenantId,proto3" json:"tenant_id,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *TenantActivePredicate) Reset() { - *x = TenantActivePredicate{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *TenantActivePredicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*TenantActivePredicate) ProtoMessage() {} - -func (x *TenantActivePredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[11] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use TenantActivePredicate.ProtoReflect.Descriptor instead. -func (*TenantActivePredicate) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{11} -} - -func (x *TenantActivePredicate) GetTenantId() *ValueRef { - if x != nil { - return x.TenantId - } - return nil -} - -type CredentialExistsPredicate struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *ValueRef `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CredentialExistsPredicate) Reset() { - *x = CredentialExistsPredicate{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CredentialExistsPredicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CredentialExistsPredicate) ProtoMessage() {} - -func (x *CredentialExistsPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[12] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CredentialExistsPredicate.ProtoReflect.Descriptor instead. -func (*CredentialExistsPredicate) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{12} -} - -func (x *CredentialExistsPredicate) GetName() *ValueRef { - if x != nil { - return x.Name - } - return nil -} - -type AndPredicate struct { - state protoimpl.MessageState `protogen:"open.v1"` - Terms []*Predicate `protobuf:"bytes,1,rep,name=terms,proto3" json:"terms,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *AndPredicate) Reset() { - *x = AndPredicate{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *AndPredicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AndPredicate) ProtoMessage() {} - -func (x *AndPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[13] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AndPredicate.ProtoReflect.Descriptor instead. -func (*AndPredicate) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{13} -} - -func (x *AndPredicate) GetTerms() []*Predicate { - if x != nil { - return x.Terms - } - return nil -} - -type OrPredicate struct { - state protoimpl.MessageState `protogen:"open.v1"` - Terms []*Predicate `protobuf:"bytes,1,rep,name=terms,proto3" json:"terms,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *OrPredicate) Reset() { - *x = OrPredicate{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *OrPredicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*OrPredicate) ProtoMessage() {} - -func (x *OrPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[14] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use OrPredicate.ProtoReflect.Descriptor instead. -func (*OrPredicate) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{14} -} - -func (x *OrPredicate) GetTerms() []*Predicate { - if x != nil { - return x.Terms - } - return nil -} - -type NotPredicate struct { - state protoimpl.MessageState `protogen:"open.v1"` - Term *Predicate `protobuf:"bytes,1,opt,name=term,proto3" json:"term,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *NotPredicate) Reset() { - *x = NotPredicate{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[15] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *NotPredicate) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NotPredicate) ProtoMessage() {} - -func (x *NotPredicate) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[15] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use NotPredicate.ProtoReflect.Descriptor instead. -func (*NotPredicate) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{15} -} - -func (x *NotPredicate) GetTerm() *Predicate { - if x != nil { - return x.Term - } - return nil -} - -// ValueRef resolves to a string at runtime. -// Use literal for constants known at plan time. -// Use var_ref to read a value set by a previous node's result_var or by -// ExecutionPlan.bindings. -type ValueRef struct { - state protoimpl.MessageState `protogen:"open.v1"` - // Types that are valid to be assigned to Kind: - // - // *ValueRef_Literal - // *ValueRef_VarRef - Kind isValueRef_Kind `protobuf_oneof:"kind"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ValueRef) Reset() { - *x = ValueRef{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[16] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ValueRef) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ValueRef) ProtoMessage() {} - -func (x *ValueRef) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[16] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ValueRef.ProtoReflect.Descriptor instead. -func (*ValueRef) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{16} -} - -func (x *ValueRef) GetKind() isValueRef_Kind { - if x != nil { - return x.Kind - } - return nil -} - -func (x *ValueRef) GetLiteral() string { - if x != nil { - if x, ok := x.Kind.(*ValueRef_Literal); ok { - return x.Literal - } - } - return "" -} - -func (x *ValueRef) GetVarRef() string { - if x != nil { - if x, ok := x.Kind.(*ValueRef_VarRef); ok { - return x.VarRef - } - } - return "" -} - -type isValueRef_Kind interface { - isValueRef_Kind() -} - -type ValueRef_Literal struct { - Literal string `protobuf:"bytes,1,opt,name=literal,proto3,oneof"` -} - -type ValueRef_VarRef struct { - VarRef string `protobuf:"bytes,2,opt,name=var_ref,json=varRef,proto3,oneof"` -} - -func (*ValueRef_Literal) isValueRef_Kind() {} - -func (*ValueRef_VarRef) isValueRef_Kind() {} - -// KeySyncNode provisions a key at the given tier, or is a no-op if the key -// already exists (idempotent). Core wraps the key under parent_key using the -// configured tier hierarchy. On success, result_var receives the key ULID. -type KeySyncNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - // tier is the Krypton tier name as declared in key-hierarchy config, - // e.g. "l2-domain", "l3-service", "l4-data". - Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` - // key_name is the logical name scoped to the tenant. - KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` - // parent_key is the name of the wrapping key one tier above. - // Required for all tiers except L1 root keys. - ParentKey *ValueRef `protobuf:"bytes,3,opt,name=parent_key,json=parentKey,proto3" json:"parent_key,omitempty"` - // schedule, when set, is applied immediately after provisioning. - Schedule *KeyScheduleSpec `protobuf:"bytes,4,opt,name=schedule,proto3" json:"schedule,omitempty"` - // metadata is attached to the key record after successful provisioning. - Metadata map[string]string `protobuf:"bytes,5,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeySyncNode) Reset() { - *x = KeySyncNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[17] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeySyncNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeySyncNode) ProtoMessage() {} - -func (x *KeySyncNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[17] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeySyncNode.ProtoReflect.Descriptor instead. -func (*KeySyncNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{17} -} - -func (x *KeySyncNode) GetTier() *ValueRef { - if x != nil { - return x.Tier - } - return nil -} - -func (x *KeySyncNode) GetKeyName() *ValueRef { - if x != nil { - return x.KeyName - } - return nil -} - -func (x *KeySyncNode) GetParentKey() *ValueRef { - if x != nil { - return x.ParentKey - } - return nil -} - -func (x *KeySyncNode) GetSchedule() *KeyScheduleSpec { - if x != nil { - return x.Schedule - } - return nil -} - -func (x *KeySyncNode) GetMetadata() map[string]string { - if x != nil { - return x.Metadata - } - return nil -} - -// KeyDeleteNode destroys key material and all version lineages. -// Core enforces that no child keys exist before allowing deletion. -type KeyDeleteNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` - KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeyDeleteNode) Reset() { - *x = KeyDeleteNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[18] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeyDeleteNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyDeleteNode) ProtoMessage() {} - -func (x *KeyDeleteNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[18] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyDeleteNode.ProtoReflect.Descriptor instead. -func (*KeyDeleteNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{18} -} - -func (x *KeyDeleteNode) GetTier() *ValueRef { - if x != nil { - return x.Tier - } - return nil -} - -func (x *KeyDeleteNode) GetKeyName() *ValueRef { - if x != nil { - return x.KeyName - } - return nil -} - -// KeyTransitionNode explicitly moves a key to a target lifecycle state. -// Valid target_state values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, -// -// COMPROMISED, PENDING_DESTROYING, DESTROYED. -type KeyTransitionNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` - KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` - TargetState string `protobuf:"bytes,3,opt,name=target_state,json=targetState,proto3" json:"target_state,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeyTransitionNode) Reset() { - *x = KeyTransitionNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[19] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeyTransitionNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyTransitionNode) ProtoMessage() {} - -func (x *KeyTransitionNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[19] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyTransitionNode.ProtoReflect.Descriptor instead. -func (*KeyTransitionNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{19} -} - -func (x *KeyTransitionNode) GetTier() *ValueRef { - if x != nil { - return x.Tier - } - return nil -} - -func (x *KeyTransitionNode) GetKeyName() *ValueRef { - if x != nil { - return x.KeyName - } - return nil -} - -func (x *KeyTransitionNode) GetTargetState() string { - if x != nil { - return x.TargetState - } - return "" -} - -// KeyRotateNode generates new key material under the same logical key name -// (forced rotation — bypasses the idempotency guard in ProvisionKey). -// On success, result_var receives the new key ULID. -type KeyRotateNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` - KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeyRotateNode) Reset() { - *x = KeyRotateNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[20] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeyRotateNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyRotateNode) ProtoMessage() {} - -func (x *KeyRotateNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[20] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyRotateNode.ProtoReflect.Descriptor instead. -func (*KeyRotateNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{20} -} - -func (x *KeyRotateNode) GetTier() *ValueRef { - if x != nil { - return x.Tier - } - return nil -} - -func (x *KeyRotateNode) GetKeyName() *ValueRef { - if x != nil { - return x.KeyName - } - return nil -} - -// KeyScheduleNode updates the scheduled lifecycle transition for an existing key. -type KeyScheduleNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Tier *ValueRef `protobuf:"bytes,1,opt,name=tier,proto3" json:"tier,omitempty"` - KeyName *ValueRef `protobuf:"bytes,2,opt,name=key_name,json=keyName,proto3" json:"key_name,omitempty"` - Schedule *KeyScheduleSpec `protobuf:"bytes,3,opt,name=schedule,proto3" json:"schedule,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeyScheduleNode) Reset() { - *x = KeyScheduleNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[21] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeyScheduleNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyScheduleNode) ProtoMessage() {} - -func (x *KeyScheduleNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[21] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyScheduleNode.ProtoReflect.Descriptor instead. -func (*KeyScheduleNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{21} -} - -func (x *KeyScheduleNode) GetTier() *ValueRef { - if x != nil { - return x.Tier - } - return nil -} - -func (x *KeyScheduleNode) GetKeyName() *ValueRef { - if x != nil { - return x.KeyName - } - return nil -} - -func (x *KeyScheduleNode) GetSchedule() *KeyScheduleSpec { - if x != nil { - return x.Schedule - } - return nil -} - -// KeyScheduleSpec carries timing parameters for a scheduled state transition. -// All fields are optional — set only the ones you need. -type KeyScheduleSpec struct { - state protoimpl.MessageState `protogen:"open.v1"` - ExpiresAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=expires_at,json=expiresAt,proto3,oneof" json:"expires_at,omitempty"` - ScheduledTransitionAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=scheduled_transition_at,json=scheduledTransitionAt,proto3,oneof" json:"scheduled_transition_at,omitempty"` - // transition_to is the target KeyState when scheduled_transition_at fires. - TransitionTo *string `protobuf:"bytes,3,opt,name=transition_to,json=transitionTo,proto3,oneof" json:"transition_to,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *KeyScheduleSpec) Reset() { - *x = KeyScheduleSpec{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[22] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *KeyScheduleSpec) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*KeyScheduleSpec) ProtoMessage() {} - -func (x *KeyScheduleSpec) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[22] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use KeyScheduleSpec.ProtoReflect.Descriptor instead. -func (*KeyScheduleSpec) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{22} -} - -func (x *KeyScheduleSpec) GetExpiresAt() *timestamppb.Timestamp { - if x != nil { - return x.ExpiresAt - } - return nil -} - -func (x *KeyScheduleSpec) GetScheduledTransitionAt() *timestamppb.Timestamp { - if x != nil { - return x.ScheduledTransitionAt - } - return nil -} - -func (x *KeyScheduleSpec) GetTransitionTo() string { - if x != nil && x.TransitionTo != nil { - return *x.TransitionTo - } - return "" -} - -// CredentialSyncNode creates or updates a credential. -// spec is the full credential payload; core encrypts it using the tenant keyring. -type CredentialSyncNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *ValueRef `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Type *ValueRef `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` - Spec *structpb.Struct `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CredentialSyncNode) Reset() { - *x = CredentialSyncNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[23] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CredentialSyncNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CredentialSyncNode) ProtoMessage() {} - -func (x *CredentialSyncNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[23] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CredentialSyncNode.ProtoReflect.Descriptor instead. -func (*CredentialSyncNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{23} -} - -func (x *CredentialSyncNode) GetName() *ValueRef { - if x != nil { - return x.Name - } - return nil -} - -func (x *CredentialSyncNode) GetType() *ValueRef { - if x != nil { - return x.Type - } - return nil -} - -func (x *CredentialSyncNode) GetSpec() *structpb.Struct { - if x != nil { - return x.Spec - } - return nil -} - -// CredentialDeleteNode removes a credential record. -type CredentialDeleteNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - Name *ValueRef `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *CredentialDeleteNode) Reset() { - *x = CredentialDeleteNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[24] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *CredentialDeleteNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CredentialDeleteNode) ProtoMessage() {} - -func (x *CredentialDeleteNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[24] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use CredentialDeleteNode.ProtoReflect.Descriptor instead. -func (*CredentialDeleteNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{24} -} - -func (x *CredentialDeleteNode) GetName() *ValueRef { - if x != nil { - return x.Name - } - return nil -} - -// BindNode sets a named variable in the execution state. -// Useful for deriving values from existing bindings before referencing them. -type BindNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - VarName string `protobuf:"bytes,1,opt,name=var_name,json=varName,proto3" json:"var_name,omitempty"` - Value *ValueRef `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *BindNode) Reset() { - *x = BindNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[25] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *BindNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*BindNode) ProtoMessage() {} - -func (x *BindNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[25] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use BindNode.ProtoReflect.Descriptor instead. -func (*BindNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{25} -} - -func (x *BindNode) GetVarName() string { - if x != nil { - return x.VarName - } - return "" -} - -func (x *BindNode) GetValue() *ValueRef { - if x != nil { - return x.Value - } - return nil -} - -// EmitNode writes a structured event to Krypton's audit trail. -type EmitNode struct { - state protoimpl.MessageState `protogen:"open.v1"` - EventType string `protobuf:"bytes,1,opt,name=event_type,json=eventType,proto3" json:"event_type,omitempty"` - Attributes map[string]string `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *EmitNode) Reset() { - *x = EmitNode{} - mi := &file_plugin_resources_v1_ast_proto_msgTypes[26] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *EmitNode) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*EmitNode) ProtoMessage() {} - -func (x *EmitNode) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_ast_proto_msgTypes[26] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use EmitNode.ProtoReflect.Descriptor instead. -func (*EmitNode) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_ast_proto_rawDescGZIP(), []int{26} -} - -func (x *EmitNode) GetEventType() string { - if x != nil { - return x.EventType - } - return "" -} - -func (x *EmitNode) GetAttributes() map[string]string { - if x != nil { - return x.Attributes - } - return nil -} - -var File_plugin_resources_v1_ast_proto protoreflect.FileDescriptor - -const file_plugin_resources_v1_ast_proto_rawDesc = "" + - "\n" + - "\x1dplugin/resources/v1/ast.proto\x12\x1fkrypton.resources.reconciler.v1\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xfd\x01\n" + - "\rExecutionPlan\x12\x17\n" + - "\aplan_id\x18\x01 \x01(\tR\x06planId\x12<\n" + - "\x04root\x18\x02 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\x04root\x12X\n" + - "\bbindings\x18\x03 \x03(\v2<.krypton.resources.reconciler.v1.ExecutionPlan.BindingsEntryR\bbindings\x1a;\n" + - "\rBindingsEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xa0\n" + - "\n" + - "\aASTNode\x12\x17\n" + - "\anode_id\x18\x01 \x01(\tR\x06nodeId\x12\x14\n" + - "\x05label\x18\x02 \x01(\tR\x05label\x12\x1d\n" + - "\n" + - "result_var\x18\x03 \x01(\tR\tresultVar\x12K\n" + - "\bsequence\x18\n" + - " \x01(\v2-.krypton.resources.reconciler.v1.SequenceNodeH\x00R\bsequence\x12K\n" + - "\bparallel\x18\v \x01(\v2-.krypton.resources.reconciler.v1.ParallelNodeH\x00R\bparallel\x12T\n" + - "\vconditional\x18\f \x01(\v20.krypton.resources.reconciler.v1.ConditionalNodeH\x00R\vconditional\x12L\n" + - "\ttry_catch\x18\r \x01(\v2-.krypton.resources.reconciler.v1.TryCatchNodeH\x00R\btryCatch\x12Q\n" + - "\n" + - "checkpoint\x18\x0e \x01(\v2/.krypton.resources.reconciler.v1.CheckpointNodeH\x00R\n" + - "checkpoint\x12E\n" + - "\x06assert\x18\x14 \x01(\v2+.krypton.resources.reconciler.v1.AssertNodeH\x00R\x06assert\x12I\n" + - "\bkey_sync\x18\x1e \x01(\v2,.krypton.resources.reconciler.v1.KeySyncNodeH\x00R\akeySync\x12O\n" + - "\n" + - "key_delete\x18\x1f \x01(\v2..krypton.resources.reconciler.v1.KeyDeleteNodeH\x00R\tkeyDelete\x12[\n" + - "\x0ekey_transition\x18 \x01(\v22.krypton.resources.reconciler.v1.KeyTransitionNodeH\x00R\rkeyTransition\x12O\n" + - "\n" + - "key_rotate\x18! \x01(\v2..krypton.resources.reconciler.v1.KeyRotateNodeH\x00R\tkeyRotate\x12U\n" + - "\fkey_schedule\x18\" \x01(\v20.krypton.resources.reconciler.v1.KeyScheduleNodeH\x00R\vkeySchedule\x12^\n" + - "\x0fcredential_sync\x18( \x01(\v23.krypton.resources.reconciler.v1.CredentialSyncNodeH\x00R\x0ecredentialSync\x12d\n" + - "\x11credential_delete\x18) \x01(\v25.krypton.resources.reconciler.v1.CredentialDeleteNodeH\x00R\x10credentialDelete\x12?\n" + - "\x04bind\x18< \x01(\v2).krypton.resources.reconciler.v1.BindNodeH\x00R\x04bind\x12?\n" + - "\x04emit\x18= \x01(\v2).krypton.resources.reconciler.v1.EmitNodeH\x00R\x04emitB\x06\n" + - "\x04node\"N\n" + - "\fSequenceNode\x12>\n" + - "\x05steps\x18\x01 \x03(\v2(.krypton.resources.reconciler.v1.ASTNodeR\x05steps\"k\n" + - "\fParallelNode\x12>\n" + - "\x05steps\x18\x01 \x03(\v2(.krypton.resources.reconciler.v1.ASTNodeR\x05steps\x12\x1b\n" + - "\tfail_fast\x18\x02 \x01(\bR\bfailFast\"\xe9\x01\n" + - "\x0fConditionalNode\x12H\n" + - "\tcondition\x18\x01 \x01(\v2*.krypton.resources.reconciler.v1.PredicateR\tcondition\x12E\n" + - "\tthen_node\x18\x02 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\bthenNode\x12E\n" + - "\telse_node\x18\x03 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\belseNode\"\x9c\x01\n" + - "\fTryCatchNode\x12C\n" + - "\btry_node\x18\x01 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\atryNode\x12G\n" + - "\n" + - "catch_node\x18\x02 \x01(\v2(.krypton.resources.reconciler.v1.ASTNodeR\tcatchNode\"\x10\n" + - "\x0eCheckpointNode\"{\n" + - "\n" + - "AssertNode\x12H\n" + - "\tcondition\x18\x01 \x01(\v2*.krypton.resources.reconciler.v1.PredicateR\tcondition\x12#\n" + - "\rerror_message\x18\x02 \x01(\tR\ferrorMessage\"\xcc\x04\n" + - "\tPredicate\x12T\n" + - "\n" + - "key_exists\x18\x01 \x01(\v23.krypton.resources.reconciler.v1.KeyExistsPredicateH\x00R\tkeyExists\x12Q\n" + - "\tkey_state\x18\x02 \x01(\v22.krypton.resources.reconciler.v1.KeyStatePredicateH\x00R\bkeyState\x12]\n" + - "\rtenant_active\x18\x03 \x01(\v26.krypton.resources.reconciler.v1.TenantActivePredicateH\x00R\ftenantActive\x12i\n" + - "\x11credential_exists\x18\x04 \x01(\v2:.krypton.resources.reconciler.v1.CredentialExistsPredicateH\x00R\x10credentialExists\x12A\n" + - "\x03and\x18\n" + - " \x01(\v2-.krypton.resources.reconciler.v1.AndPredicateH\x00R\x03and\x12>\n" + - "\x02or\x18\v \x01(\v2,.krypton.resources.reconciler.v1.OrPredicateH\x00R\x02or\x12A\n" + - "\x03not\x18\f \x01(\v2-.krypton.resources.reconciler.v1.NotPredicateH\x00R\x03notB\x06\n" + - "\x04expr\"\x99\x01\n" + - "\x12KeyExistsPredicate\x12=\n" + - "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + - "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\"\xbf\x01\n" + - "\x11KeyStatePredicate\x12=\n" + - "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + - "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\x12%\n" + - "\x0eallowed_states\x18\x03 \x03(\tR\rallowedStates\"_\n" + - "\x15TenantActivePredicate\x12F\n" + - "\ttenant_id\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\btenantId\"Z\n" + - "\x19CredentialExistsPredicate\x12=\n" + - "\x04name\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04name\"P\n" + - "\fAndPredicate\x12@\n" + - "\x05terms\x18\x01 \x03(\v2*.krypton.resources.reconciler.v1.PredicateR\x05terms\"O\n" + - "\vOrPredicate\x12@\n" + - "\x05terms\x18\x01 \x03(\v2*.krypton.resources.reconciler.v1.PredicateR\x05terms\"N\n" + - "\fNotPredicate\x12>\n" + - "\x04term\x18\x01 \x01(\v2*.krypton.resources.reconciler.v1.PredicateR\x04term\"I\n" + - "\bValueRef\x12\x1a\n" + - "\aliteral\x18\x01 \x01(\tH\x00R\aliteral\x12\x19\n" + - "\avar_ref\x18\x02 \x01(\tH\x00R\x06varRefB\x06\n" + - "\x04kind\"\xbf\x03\n" + - "\vKeySyncNode\x12=\n" + - "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + - "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\x12H\n" + - "\n" + - "parent_key\x18\x03 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\tparentKey\x12L\n" + - "\bschedule\x18\x04 \x01(\v20.krypton.resources.reconciler.v1.KeyScheduleSpecR\bschedule\x12V\n" + - "\bmetadata\x18\x05 \x03(\v2:.krypton.resources.reconciler.v1.KeySyncNode.MetadataEntryR\bmetadata\x1a;\n" + - "\rMetadataEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x94\x01\n" + - "\rKeyDeleteNode\x12=\n" + - "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + - "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\"\xbb\x01\n" + - "\x11KeyTransitionNode\x12=\n" + - "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + - "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\x12!\n" + - "\ftarget_state\x18\x03 \x01(\tR\vtargetState\"\x94\x01\n" + - "\rKeyRotateNode\x12=\n" + - "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + - "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\"\xe4\x01\n" + - "\x0fKeyScheduleNode\x12=\n" + - "\x04tier\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04tier\x12D\n" + - "\bkey_name\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\akeyName\x12L\n" + - "\bschedule\x18\x03 \x01(\v20.krypton.resources.reconciler.v1.KeyScheduleSpecR\bschedule\"\x91\x02\n" + - "\x0fKeyScheduleSpec\x12>\n" + - "\n" + - "expires_at\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampH\x00R\texpiresAt\x88\x01\x01\x12W\n" + - "\x17scheduled_transition_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampH\x01R\x15scheduledTransitionAt\x88\x01\x01\x12(\n" + - "\rtransition_to\x18\x03 \x01(\tH\x02R\ftransitionTo\x88\x01\x01B\r\n" + - "\v_expires_atB\x1a\n" + - "\x18_scheduled_transition_atB\x10\n" + - "\x0e_transition_to\"\xbf\x01\n" + - "\x12CredentialSyncNode\x12=\n" + - "\x04name\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04name\x12=\n" + - "\x04type\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04type\x12+\n" + - "\x04spec\x18\x03 \x01(\v2\x17.google.protobuf.StructR\x04spec\"U\n" + - "\x14CredentialDeleteNode\x12=\n" + - "\x04name\x18\x01 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x04name\"f\n" + - "\bBindNode\x12\x19\n" + - "\bvar_name\x18\x01 \x01(\tR\avarName\x12?\n" + - "\x05value\x18\x02 \x01(\v2).krypton.resources.reconciler.v1.ValueRefR\x05value\"\xc3\x01\n" + - "\bEmitNode\x12\x1d\n" + - "\n" + - "event_type\x18\x01 \x01(\tR\teventType\x12Y\n" + - "\n" + - "attributes\x18\x02 \x03(\v29.krypton.resources.reconciler.v1.EmitNode.AttributesEntryR\n" + - "attributes\x1a=\n" + - "\x0fAttributesEntry\x12\x10\n" + - "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x94\x02\n" + - "#com.krypton.resources.reconciler.v1B\bAstProtoP\x01ZDgithub.com/openkcm/plugin-sdk/proto/plugin/resources/v1;reconcilerv1\xa2\x02\x03KRR\xaa\x02\x1fKrypton.Resources.Reconciler.V1\xca\x02\x1fKrypton\\Resources\\Reconciler\\V1\xe2\x02+Krypton\\Resources\\Reconciler\\V1\\GPBMetadata\xea\x02\"Krypton::Resources::Reconciler::V1b\x06proto3" - -var ( - file_plugin_resources_v1_ast_proto_rawDescOnce sync.Once - file_plugin_resources_v1_ast_proto_rawDescData []byte -) - -func file_plugin_resources_v1_ast_proto_rawDescGZIP() []byte { - file_plugin_resources_v1_ast_proto_rawDescOnce.Do(func() { - file_plugin_resources_v1_ast_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_resources_v1_ast_proto_rawDesc), len(file_plugin_resources_v1_ast_proto_rawDesc))) - }) - return file_plugin_resources_v1_ast_proto_rawDescData -} - -var file_plugin_resources_v1_ast_proto_msgTypes = make([]protoimpl.MessageInfo, 30) -var file_plugin_resources_v1_ast_proto_goTypes = []any{ - (*ExecutionPlan)(nil), // 0: krypton.resources.reconciler.v1.ExecutionPlan - (*ASTNode)(nil), // 1: krypton.resources.reconciler.v1.ASTNode - (*SequenceNode)(nil), // 2: krypton.resources.reconciler.v1.SequenceNode - (*ParallelNode)(nil), // 3: krypton.resources.reconciler.v1.ParallelNode - (*ConditionalNode)(nil), // 4: krypton.resources.reconciler.v1.ConditionalNode - (*TryCatchNode)(nil), // 5: krypton.resources.reconciler.v1.TryCatchNode - (*CheckpointNode)(nil), // 6: krypton.resources.reconciler.v1.CheckpointNode - (*AssertNode)(nil), // 7: krypton.resources.reconciler.v1.AssertNode - (*Predicate)(nil), // 8: krypton.resources.reconciler.v1.Predicate - (*KeyExistsPredicate)(nil), // 9: krypton.resources.reconciler.v1.KeyExistsPredicate - (*KeyStatePredicate)(nil), // 10: krypton.resources.reconciler.v1.KeyStatePredicate - (*TenantActivePredicate)(nil), // 11: krypton.resources.reconciler.v1.TenantActivePredicate - (*CredentialExistsPredicate)(nil), // 12: krypton.resources.reconciler.v1.CredentialExistsPredicate - (*AndPredicate)(nil), // 13: krypton.resources.reconciler.v1.AndPredicate - (*OrPredicate)(nil), // 14: krypton.resources.reconciler.v1.OrPredicate - (*NotPredicate)(nil), // 15: krypton.resources.reconciler.v1.NotPredicate - (*ValueRef)(nil), // 16: krypton.resources.reconciler.v1.ValueRef - (*KeySyncNode)(nil), // 17: krypton.resources.reconciler.v1.KeySyncNode - (*KeyDeleteNode)(nil), // 18: krypton.resources.reconciler.v1.KeyDeleteNode - (*KeyTransitionNode)(nil), // 19: krypton.resources.reconciler.v1.KeyTransitionNode - (*KeyRotateNode)(nil), // 20: krypton.resources.reconciler.v1.KeyRotateNode - (*KeyScheduleNode)(nil), // 21: krypton.resources.reconciler.v1.KeyScheduleNode - (*KeyScheduleSpec)(nil), // 22: krypton.resources.reconciler.v1.KeyScheduleSpec - (*CredentialSyncNode)(nil), // 23: krypton.resources.reconciler.v1.CredentialSyncNode - (*CredentialDeleteNode)(nil), // 24: krypton.resources.reconciler.v1.CredentialDeleteNode - (*BindNode)(nil), // 25: krypton.resources.reconciler.v1.BindNode - (*EmitNode)(nil), // 26: krypton.resources.reconciler.v1.EmitNode - nil, // 27: krypton.resources.reconciler.v1.ExecutionPlan.BindingsEntry - nil, // 28: krypton.resources.reconciler.v1.KeySyncNode.MetadataEntry - nil, // 29: krypton.resources.reconciler.v1.EmitNode.AttributesEntry - (*timestamppb.Timestamp)(nil), // 30: google.protobuf.Timestamp - (*structpb.Struct)(nil), // 31: google.protobuf.Struct -} -var file_plugin_resources_v1_ast_proto_depIdxs = []int32{ - 1, // 0: krypton.resources.reconciler.v1.ExecutionPlan.root:type_name -> krypton.resources.reconciler.v1.ASTNode - 27, // 1: krypton.resources.reconciler.v1.ExecutionPlan.bindings:type_name -> krypton.resources.reconciler.v1.ExecutionPlan.BindingsEntry - 2, // 2: krypton.resources.reconciler.v1.ASTNode.sequence:type_name -> krypton.resources.reconciler.v1.SequenceNode - 3, // 3: krypton.resources.reconciler.v1.ASTNode.parallel:type_name -> krypton.resources.reconciler.v1.ParallelNode - 4, // 4: krypton.resources.reconciler.v1.ASTNode.conditional:type_name -> krypton.resources.reconciler.v1.ConditionalNode - 5, // 5: krypton.resources.reconciler.v1.ASTNode.try_catch:type_name -> krypton.resources.reconciler.v1.TryCatchNode - 6, // 6: krypton.resources.reconciler.v1.ASTNode.checkpoint:type_name -> krypton.resources.reconciler.v1.CheckpointNode - 7, // 7: krypton.resources.reconciler.v1.ASTNode.assert:type_name -> krypton.resources.reconciler.v1.AssertNode - 17, // 8: krypton.resources.reconciler.v1.ASTNode.key_sync:type_name -> krypton.resources.reconciler.v1.KeySyncNode - 18, // 9: krypton.resources.reconciler.v1.ASTNode.key_delete:type_name -> krypton.resources.reconciler.v1.KeyDeleteNode - 19, // 10: krypton.resources.reconciler.v1.ASTNode.key_transition:type_name -> krypton.resources.reconciler.v1.KeyTransitionNode - 20, // 11: krypton.resources.reconciler.v1.ASTNode.key_rotate:type_name -> krypton.resources.reconciler.v1.KeyRotateNode - 21, // 12: krypton.resources.reconciler.v1.ASTNode.key_schedule:type_name -> krypton.resources.reconciler.v1.KeyScheduleNode - 23, // 13: krypton.resources.reconciler.v1.ASTNode.credential_sync:type_name -> krypton.resources.reconciler.v1.CredentialSyncNode - 24, // 14: krypton.resources.reconciler.v1.ASTNode.credential_delete:type_name -> krypton.resources.reconciler.v1.CredentialDeleteNode - 25, // 15: krypton.resources.reconciler.v1.ASTNode.bind:type_name -> krypton.resources.reconciler.v1.BindNode - 26, // 16: krypton.resources.reconciler.v1.ASTNode.emit:type_name -> krypton.resources.reconciler.v1.EmitNode - 1, // 17: krypton.resources.reconciler.v1.SequenceNode.steps:type_name -> krypton.resources.reconciler.v1.ASTNode - 1, // 18: krypton.resources.reconciler.v1.ParallelNode.steps:type_name -> krypton.resources.reconciler.v1.ASTNode - 8, // 19: krypton.resources.reconciler.v1.ConditionalNode.condition:type_name -> krypton.resources.reconciler.v1.Predicate - 1, // 20: krypton.resources.reconciler.v1.ConditionalNode.then_node:type_name -> krypton.resources.reconciler.v1.ASTNode - 1, // 21: krypton.resources.reconciler.v1.ConditionalNode.else_node:type_name -> krypton.resources.reconciler.v1.ASTNode - 1, // 22: krypton.resources.reconciler.v1.TryCatchNode.try_node:type_name -> krypton.resources.reconciler.v1.ASTNode - 1, // 23: krypton.resources.reconciler.v1.TryCatchNode.catch_node:type_name -> krypton.resources.reconciler.v1.ASTNode - 8, // 24: krypton.resources.reconciler.v1.AssertNode.condition:type_name -> krypton.resources.reconciler.v1.Predicate - 9, // 25: krypton.resources.reconciler.v1.Predicate.key_exists:type_name -> krypton.resources.reconciler.v1.KeyExistsPredicate - 10, // 26: krypton.resources.reconciler.v1.Predicate.key_state:type_name -> krypton.resources.reconciler.v1.KeyStatePredicate - 11, // 27: krypton.resources.reconciler.v1.Predicate.tenant_active:type_name -> krypton.resources.reconciler.v1.TenantActivePredicate - 12, // 28: krypton.resources.reconciler.v1.Predicate.credential_exists:type_name -> krypton.resources.reconciler.v1.CredentialExistsPredicate - 13, // 29: krypton.resources.reconciler.v1.Predicate.and:type_name -> krypton.resources.reconciler.v1.AndPredicate - 14, // 30: krypton.resources.reconciler.v1.Predicate.or:type_name -> krypton.resources.reconciler.v1.OrPredicate - 15, // 31: krypton.resources.reconciler.v1.Predicate.not:type_name -> krypton.resources.reconciler.v1.NotPredicate - 16, // 32: krypton.resources.reconciler.v1.KeyExistsPredicate.tier:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 33: krypton.resources.reconciler.v1.KeyExistsPredicate.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 34: krypton.resources.reconciler.v1.KeyStatePredicate.tier:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 35: krypton.resources.reconciler.v1.KeyStatePredicate.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 36: krypton.resources.reconciler.v1.TenantActivePredicate.tenant_id:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 37: krypton.resources.reconciler.v1.CredentialExistsPredicate.name:type_name -> krypton.resources.reconciler.v1.ValueRef - 8, // 38: krypton.resources.reconciler.v1.AndPredicate.terms:type_name -> krypton.resources.reconciler.v1.Predicate - 8, // 39: krypton.resources.reconciler.v1.OrPredicate.terms:type_name -> krypton.resources.reconciler.v1.Predicate - 8, // 40: krypton.resources.reconciler.v1.NotPredicate.term:type_name -> krypton.resources.reconciler.v1.Predicate - 16, // 41: krypton.resources.reconciler.v1.KeySyncNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 42: krypton.resources.reconciler.v1.KeySyncNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 43: krypton.resources.reconciler.v1.KeySyncNode.parent_key:type_name -> krypton.resources.reconciler.v1.ValueRef - 22, // 44: krypton.resources.reconciler.v1.KeySyncNode.schedule:type_name -> krypton.resources.reconciler.v1.KeyScheduleSpec - 28, // 45: krypton.resources.reconciler.v1.KeySyncNode.metadata:type_name -> krypton.resources.reconciler.v1.KeySyncNode.MetadataEntry - 16, // 46: krypton.resources.reconciler.v1.KeyDeleteNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 47: krypton.resources.reconciler.v1.KeyDeleteNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 48: krypton.resources.reconciler.v1.KeyTransitionNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 49: krypton.resources.reconciler.v1.KeyTransitionNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 50: krypton.resources.reconciler.v1.KeyRotateNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 51: krypton.resources.reconciler.v1.KeyRotateNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 52: krypton.resources.reconciler.v1.KeyScheduleNode.tier:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 53: krypton.resources.reconciler.v1.KeyScheduleNode.key_name:type_name -> krypton.resources.reconciler.v1.ValueRef - 22, // 54: krypton.resources.reconciler.v1.KeyScheduleNode.schedule:type_name -> krypton.resources.reconciler.v1.KeyScheduleSpec - 30, // 55: krypton.resources.reconciler.v1.KeyScheduleSpec.expires_at:type_name -> google.protobuf.Timestamp - 30, // 56: krypton.resources.reconciler.v1.KeyScheduleSpec.scheduled_transition_at:type_name -> google.protobuf.Timestamp - 16, // 57: krypton.resources.reconciler.v1.CredentialSyncNode.name:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 58: krypton.resources.reconciler.v1.CredentialSyncNode.type:type_name -> krypton.resources.reconciler.v1.ValueRef - 31, // 59: krypton.resources.reconciler.v1.CredentialSyncNode.spec:type_name -> google.protobuf.Struct - 16, // 60: krypton.resources.reconciler.v1.CredentialDeleteNode.name:type_name -> krypton.resources.reconciler.v1.ValueRef - 16, // 61: krypton.resources.reconciler.v1.BindNode.value:type_name -> krypton.resources.reconciler.v1.ValueRef - 29, // 62: krypton.resources.reconciler.v1.EmitNode.attributes:type_name -> krypton.resources.reconciler.v1.EmitNode.AttributesEntry - 63, // [63:63] is the sub-list for method output_type - 63, // [63:63] is the sub-list for method input_type - 63, // [63:63] is the sub-list for extension type_name - 63, // [63:63] is the sub-list for extension extendee - 0, // [0:63] is the sub-list for field type_name -} - -func init() { file_plugin_resources_v1_ast_proto_init() } -func file_plugin_resources_v1_ast_proto_init() { - if File_plugin_resources_v1_ast_proto != nil { - return - } - file_plugin_resources_v1_ast_proto_msgTypes[1].OneofWrappers = []any{ - (*ASTNode_Sequence)(nil), - (*ASTNode_Parallel)(nil), - (*ASTNode_Conditional)(nil), - (*ASTNode_TryCatch)(nil), - (*ASTNode_Checkpoint)(nil), - (*ASTNode_Assert)(nil), - (*ASTNode_KeySync)(nil), - (*ASTNode_KeyDelete)(nil), - (*ASTNode_KeyTransition)(nil), - (*ASTNode_KeyRotate)(nil), - (*ASTNode_KeySchedule)(nil), - (*ASTNode_CredentialSync)(nil), - (*ASTNode_CredentialDelete)(nil), - (*ASTNode_Bind)(nil), - (*ASTNode_Emit)(nil), - } - file_plugin_resources_v1_ast_proto_msgTypes[8].OneofWrappers = []any{ - (*Predicate_KeyExists)(nil), - (*Predicate_KeyState)(nil), - (*Predicate_TenantActive)(nil), - (*Predicate_CredentialExists)(nil), - (*Predicate_And)(nil), - (*Predicate_Or)(nil), - (*Predicate_Not)(nil), - } - file_plugin_resources_v1_ast_proto_msgTypes[16].OneofWrappers = []any{ - (*ValueRef_Literal)(nil), - (*ValueRef_VarRef)(nil), - } - file_plugin_resources_v1_ast_proto_msgTypes[22].OneofWrappers = []any{} - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_resources_v1_ast_proto_rawDesc), len(file_plugin_resources_v1_ast_proto_rawDesc)), - NumEnums: 0, - NumMessages: 30, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_plugin_resources_v1_ast_proto_goTypes, - DependencyIndexes: file_plugin_resources_v1_ast_proto_depIdxs, - MessageInfos: file_plugin_resources_v1_ast_proto_msgTypes, - }.Build() - File_plugin_resources_v1_ast_proto = out.File - file_plugin_resources_v1_ast_proto_goTypes = nil - file_plugin_resources_v1_ast_proto_depIdxs = nil -} diff --git a/proto/plugin/resources/v1/ast.pb.validate.go b/proto/plugin/resources/v1/ast.pb.validate.go deleted file mode 100644 index 7d873d4..0000000 --- a/proto/plugin/resources/v1/ast.pb.validate.go +++ /dev/null @@ -1,4835 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/resources/v1/ast.proto - -package reconcilerv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ExecutionPlan with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ExecutionPlan) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ExecutionPlan with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ExecutionPlanMultiError, or -// nil if none found. -func (m *ExecutionPlan) ValidateAll() error { - return m.validate(true) -} - -func (m *ExecutionPlan) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for PlanId - - if all { - switch v := interface{}(m.GetRoot()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExecutionPlanValidationError{ - field: "Root", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExecutionPlanValidationError{ - field: "Root", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetRoot()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExecutionPlanValidationError{ - field: "Root", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Bindings - - if len(errors) > 0 { - return ExecutionPlanMultiError(errors) - } - - return nil -} - -// ExecutionPlanMultiError is an error wrapping multiple validation errors -// returned by ExecutionPlan.ValidateAll() if the designated constraints -// aren't met. -type ExecutionPlanMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExecutionPlanMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExecutionPlanMultiError) AllErrors() []error { return m } - -// ExecutionPlanValidationError is the validation error returned by -// ExecutionPlan.Validate if the designated constraints aren't met. -type ExecutionPlanValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExecutionPlanValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExecutionPlanValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExecutionPlanValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExecutionPlanValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExecutionPlanValidationError) ErrorName() string { return "ExecutionPlanValidationError" } - -// Error satisfies the builtin error interface -func (e ExecutionPlanValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExecutionPlan.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExecutionPlanValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExecutionPlanValidationError{} - -// Validate checks the field values on ASTNode with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ASTNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ASTNode with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in ASTNodeMultiError, or nil if none found. -func (m *ASTNode) ValidateAll() error { - return m.validate(true) -} - -func (m *ASTNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for NodeId - - // no validation rules for Label - - // no validation rules for ResultVar - - switch v := m.Node.(type) { - case *ASTNode_Sequence: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetSequence()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Sequence", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Sequence", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSequence()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "Sequence", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_Parallel: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetParallel()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Parallel", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Parallel", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetParallel()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "Parallel", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_Conditional: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetConditional()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Conditional", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Conditional", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConditional()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "Conditional", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_TryCatch: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetTryCatch()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "TryCatch", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "TryCatch", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTryCatch()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "TryCatch", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_Checkpoint: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetCheckpoint()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Checkpoint", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Checkpoint", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCheckpoint()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "Checkpoint", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_Assert: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetAssert()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Assert", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Assert", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAssert()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "Assert", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_KeySync: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKeySync()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeySync", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeySync", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeySync()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "KeySync", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_KeyDelete: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKeyDelete()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeyDelete", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeyDelete", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyDelete()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "KeyDelete", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_KeyTransition: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKeyTransition()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeyTransition", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeyTransition", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyTransition()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "KeyTransition", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_KeyRotate: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKeyRotate()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeyRotate", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeyRotate", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyRotate()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "KeyRotate", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_KeySchedule: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKeySchedule()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeySchedule", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "KeySchedule", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeySchedule()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "KeySchedule", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_CredentialSync: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetCredentialSync()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "CredentialSync", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "CredentialSync", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCredentialSync()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "CredentialSync", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_CredentialDelete: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetCredentialDelete()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "CredentialDelete", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "CredentialDelete", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCredentialDelete()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "CredentialDelete", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_Bind: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetBind()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Bind", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Bind", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetBind()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "Bind", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *ASTNode_Emit: - if v == nil { - err := ASTNodeValidationError{ - field: "Node", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetEmit()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Emit", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ASTNodeValidationError{ - field: "Emit", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetEmit()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ASTNodeValidationError{ - field: "Emit", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return ASTNodeMultiError(errors) - } - - return nil -} - -// ASTNodeMultiError is an error wrapping multiple validation errors returned -// by ASTNode.ValidateAll() if the designated constraints aren't met. -type ASTNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ASTNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ASTNodeMultiError) AllErrors() []error { return m } - -// ASTNodeValidationError is the validation error returned by ASTNode.Validate -// if the designated constraints aren't met. -type ASTNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ASTNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ASTNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ASTNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ASTNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ASTNodeValidationError) ErrorName() string { return "ASTNodeValidationError" } - -// Error satisfies the builtin error interface -func (e ASTNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sASTNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ASTNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ASTNodeValidationError{} - -// Validate checks the field values on SequenceNode with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *SequenceNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SequenceNode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in SequenceNodeMultiError, or -// nil if none found. -func (m *SequenceNode) ValidateAll() error { - return m.validate(true) -} - -func (m *SequenceNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetSteps() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, SequenceNodeValidationError{ - field: fmt.Sprintf("Steps[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, SequenceNodeValidationError{ - field: fmt.Sprintf("Steps[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return SequenceNodeValidationError{ - field: fmt.Sprintf("Steps[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return SequenceNodeMultiError(errors) - } - - return nil -} - -// SequenceNodeMultiError is an error wrapping multiple validation errors -// returned by SequenceNode.ValidateAll() if the designated constraints aren't met. -type SequenceNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SequenceNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SequenceNodeMultiError) AllErrors() []error { return m } - -// SequenceNodeValidationError is the validation error returned by -// SequenceNode.Validate if the designated constraints aren't met. -type SequenceNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SequenceNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SequenceNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SequenceNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SequenceNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SequenceNodeValidationError) ErrorName() string { return "SequenceNodeValidationError" } - -// Error satisfies the builtin error interface -func (e SequenceNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSequenceNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SequenceNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SequenceNodeValidationError{} - -// Validate checks the field values on ParallelNode with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ParallelNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ParallelNode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ParallelNodeMultiError, or -// nil if none found. -func (m *ParallelNode) ValidateAll() error { - return m.validate(true) -} - -func (m *ParallelNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetSteps() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ParallelNodeValidationError{ - field: fmt.Sprintf("Steps[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ParallelNodeValidationError{ - field: fmt.Sprintf("Steps[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ParallelNodeValidationError{ - field: fmt.Sprintf("Steps[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - // no validation rules for FailFast - - if len(errors) > 0 { - return ParallelNodeMultiError(errors) - } - - return nil -} - -// ParallelNodeMultiError is an error wrapping multiple validation errors -// returned by ParallelNode.ValidateAll() if the designated constraints aren't met. -type ParallelNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ParallelNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ParallelNodeMultiError) AllErrors() []error { return m } - -// ParallelNodeValidationError is the validation error returned by -// ParallelNode.Validate if the designated constraints aren't met. -type ParallelNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ParallelNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ParallelNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ParallelNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ParallelNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ParallelNodeValidationError) ErrorName() string { return "ParallelNodeValidationError" } - -// Error satisfies the builtin error interface -func (e ParallelNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sParallelNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ParallelNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ParallelNodeValidationError{} - -// Validate checks the field values on ConditionalNode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ConditionalNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ConditionalNode with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ConditionalNodeMultiError, or nil if none found. -func (m *ConditionalNode) ValidateAll() error { - return m.validate(true) -} - -func (m *ConditionalNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetCondition()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ConditionalNodeValidationError{ - field: "Condition", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ConditionalNodeValidationError{ - field: "Condition", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCondition()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ConditionalNodeValidationError{ - field: "Condition", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetThenNode()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ConditionalNodeValidationError{ - field: "ThenNode", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ConditionalNodeValidationError{ - field: "ThenNode", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetThenNode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ConditionalNodeValidationError{ - field: "ThenNode", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetElseNode()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ConditionalNodeValidationError{ - field: "ElseNode", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ConditionalNodeValidationError{ - field: "ElseNode", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetElseNode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ConditionalNodeValidationError{ - field: "ElseNode", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ConditionalNodeMultiError(errors) - } - - return nil -} - -// ConditionalNodeMultiError is an error wrapping multiple validation errors -// returned by ConditionalNode.ValidateAll() if the designated constraints -// aren't met. -type ConditionalNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ConditionalNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ConditionalNodeMultiError) AllErrors() []error { return m } - -// ConditionalNodeValidationError is the validation error returned by -// ConditionalNode.Validate if the designated constraints aren't met. -type ConditionalNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ConditionalNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ConditionalNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ConditionalNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ConditionalNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ConditionalNodeValidationError) ErrorName() string { return "ConditionalNodeValidationError" } - -// Error satisfies the builtin error interface -func (e ConditionalNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sConditionalNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ConditionalNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ConditionalNodeValidationError{} - -// Validate checks the field values on TryCatchNode with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *TryCatchNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TryCatchNode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in TryCatchNodeMultiError, or -// nil if none found. -func (m *TryCatchNode) ValidateAll() error { - return m.validate(true) -} - -func (m *TryCatchNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTryNode()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TryCatchNodeValidationError{ - field: "TryNode", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TryCatchNodeValidationError{ - field: "TryNode", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTryNode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TryCatchNodeValidationError{ - field: "TryNode", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetCatchNode()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TryCatchNodeValidationError{ - field: "CatchNode", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TryCatchNodeValidationError{ - field: "CatchNode", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCatchNode()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TryCatchNodeValidationError{ - field: "CatchNode", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return TryCatchNodeMultiError(errors) - } - - return nil -} - -// TryCatchNodeMultiError is an error wrapping multiple validation errors -// returned by TryCatchNode.ValidateAll() if the designated constraints aren't met. -type TryCatchNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TryCatchNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TryCatchNodeMultiError) AllErrors() []error { return m } - -// TryCatchNodeValidationError is the validation error returned by -// TryCatchNode.Validate if the designated constraints aren't met. -type TryCatchNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TryCatchNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TryCatchNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TryCatchNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TryCatchNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TryCatchNodeValidationError) ErrorName() string { return "TryCatchNodeValidationError" } - -// Error satisfies the builtin error interface -func (e TryCatchNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTryCatchNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TryCatchNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TryCatchNodeValidationError{} - -// Validate checks the field values on CheckpointNode with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *CheckpointNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CheckpointNode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in CheckpointNodeMultiError, -// or nil if none found. -func (m *CheckpointNode) ValidateAll() error { - return m.validate(true) -} - -func (m *CheckpointNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return CheckpointNodeMultiError(errors) - } - - return nil -} - -// CheckpointNodeMultiError is an error wrapping multiple validation errors -// returned by CheckpointNode.ValidateAll() if the designated constraints -// aren't met. -type CheckpointNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CheckpointNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CheckpointNodeMultiError) AllErrors() []error { return m } - -// CheckpointNodeValidationError is the validation error returned by -// CheckpointNode.Validate if the designated constraints aren't met. -type CheckpointNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CheckpointNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CheckpointNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CheckpointNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CheckpointNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CheckpointNodeValidationError) ErrorName() string { return "CheckpointNodeValidationError" } - -// Error satisfies the builtin error interface -func (e CheckpointNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCheckpointNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CheckpointNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CheckpointNodeValidationError{} - -// Validate checks the field values on AssertNode with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *AssertNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AssertNode with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AssertNodeMultiError, or -// nil if none found. -func (m *AssertNode) ValidateAll() error { - return m.validate(true) -} - -func (m *AssertNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetCondition()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AssertNodeValidationError{ - field: "Condition", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AssertNodeValidationError{ - field: "Condition", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCondition()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AssertNodeValidationError{ - field: "Condition", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for ErrorMessage - - if len(errors) > 0 { - return AssertNodeMultiError(errors) - } - - return nil -} - -// AssertNodeMultiError is an error wrapping multiple validation errors -// returned by AssertNode.ValidateAll() if the designated constraints aren't met. -type AssertNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AssertNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AssertNodeMultiError) AllErrors() []error { return m } - -// AssertNodeValidationError is the validation error returned by -// AssertNode.Validate if the designated constraints aren't met. -type AssertNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AssertNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AssertNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AssertNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AssertNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AssertNodeValidationError) ErrorName() string { return "AssertNodeValidationError" } - -// Error satisfies the builtin error interface -func (e AssertNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAssertNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AssertNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AssertNodeValidationError{} - -// Validate checks the field values on Predicate with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Predicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Predicate with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in PredicateMultiError, or nil -// if none found. -func (m *Predicate) ValidateAll() error { - return m.validate(true) -} - -func (m *Predicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch v := m.Expr.(type) { - case *Predicate_KeyExists: - if v == nil { - err := PredicateValidationError{ - field: "Expr", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKeyExists()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "KeyExists", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "KeyExists", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyExists()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PredicateValidationError{ - field: "KeyExists", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Predicate_KeyState: - if v == nil { - err := PredicateValidationError{ - field: "Expr", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetKeyState()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "KeyState", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "KeyState", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyState()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PredicateValidationError{ - field: "KeyState", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Predicate_TenantActive: - if v == nil { - err := PredicateValidationError{ - field: "Expr", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetTenantActive()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "TenantActive", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "TenantActive", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTenantActive()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PredicateValidationError{ - field: "TenantActive", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Predicate_CredentialExists: - if v == nil { - err := PredicateValidationError{ - field: "Expr", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetCredentialExists()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "CredentialExists", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "CredentialExists", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCredentialExists()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PredicateValidationError{ - field: "CredentialExists", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Predicate_And: - if v == nil { - err := PredicateValidationError{ - field: "Expr", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetAnd()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "And", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "And", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAnd()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PredicateValidationError{ - field: "And", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Predicate_Or: - if v == nil { - err := PredicateValidationError{ - field: "Expr", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetOr()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "Or", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "Or", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetOr()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PredicateValidationError{ - field: "Or", - reason: "embedded message failed validation", - cause: err, - } - } - } - - case *Predicate_Not: - if v == nil { - err := PredicateValidationError{ - field: "Expr", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - - if all { - switch v := interface{}(m.GetNot()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "Not", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, PredicateValidationError{ - field: "Not", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetNot()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return PredicateValidationError{ - field: "Not", - reason: "embedded message failed validation", - cause: err, - } - } - } - - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return PredicateMultiError(errors) - } - - return nil -} - -// PredicateMultiError is an error wrapping multiple validation errors returned -// by Predicate.ValidateAll() if the designated constraints aren't met. -type PredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PredicateMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PredicateMultiError) AllErrors() []error { return m } - -// PredicateValidationError is the validation error returned by -// Predicate.Validate if the designated constraints aren't met. -type PredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PredicateValidationError) ErrorName() string { return "PredicateValidationError" } - -// Error satisfies the builtin error interface -func (e PredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PredicateValidationError{} - -// Validate checks the field values on KeyExistsPredicate with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *KeyExistsPredicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyExistsPredicate with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KeyExistsPredicateMultiError, or nil if none found. -func (m *KeyExistsPredicate) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyExistsPredicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTier()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyExistsPredicateValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyExistsPredicateValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyExistsPredicateValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetKeyName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyExistsPredicateValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyExistsPredicateValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyExistsPredicateValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return KeyExistsPredicateMultiError(errors) - } - - return nil -} - -// KeyExistsPredicateMultiError is an error wrapping multiple validation errors -// returned by KeyExistsPredicate.ValidateAll() if the designated constraints -// aren't met. -type KeyExistsPredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyExistsPredicateMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyExistsPredicateMultiError) AllErrors() []error { return m } - -// KeyExistsPredicateValidationError is the validation error returned by -// KeyExistsPredicate.Validate if the designated constraints aren't met. -type KeyExistsPredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyExistsPredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyExistsPredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyExistsPredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyExistsPredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyExistsPredicateValidationError) ErrorName() string { - return "KeyExistsPredicateValidationError" -} - -// Error satisfies the builtin error interface -func (e KeyExistsPredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyExistsPredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyExistsPredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyExistsPredicateValidationError{} - -// Validate checks the field values on KeyStatePredicate with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *KeyStatePredicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyStatePredicate with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KeyStatePredicateMultiError, or nil if none found. -func (m *KeyStatePredicate) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyStatePredicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTier()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyStatePredicateValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyStatePredicateValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyStatePredicateValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetKeyName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyStatePredicateValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyStatePredicateValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyStatePredicateValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return KeyStatePredicateMultiError(errors) - } - - return nil -} - -// KeyStatePredicateMultiError is an error wrapping multiple validation errors -// returned by KeyStatePredicate.ValidateAll() if the designated constraints -// aren't met. -type KeyStatePredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyStatePredicateMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyStatePredicateMultiError) AllErrors() []error { return m } - -// KeyStatePredicateValidationError is the validation error returned by -// KeyStatePredicate.Validate if the designated constraints aren't met. -type KeyStatePredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyStatePredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyStatePredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyStatePredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyStatePredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyStatePredicateValidationError) ErrorName() string { - return "KeyStatePredicateValidationError" -} - -// Error satisfies the builtin error interface -func (e KeyStatePredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyStatePredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyStatePredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyStatePredicateValidationError{} - -// Validate checks the field values on TenantActivePredicate with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *TenantActivePredicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TenantActivePredicate with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// TenantActivePredicateMultiError, or nil if none found. -func (m *TenantActivePredicate) ValidateAll() error { - return m.validate(true) -} - -func (m *TenantActivePredicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTenantId()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, TenantActivePredicateValidationError{ - field: "TenantId", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, TenantActivePredicateValidationError{ - field: "TenantId", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTenantId()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return TenantActivePredicateValidationError{ - field: "TenantId", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return TenantActivePredicateMultiError(errors) - } - - return nil -} - -// TenantActivePredicateMultiError is an error wrapping multiple validation -// errors returned by TenantActivePredicate.ValidateAll() if the designated -// constraints aren't met. -type TenantActivePredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TenantActivePredicateMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TenantActivePredicateMultiError) AllErrors() []error { return m } - -// TenantActivePredicateValidationError is the validation error returned by -// TenantActivePredicate.Validate if the designated constraints aren't met. -type TenantActivePredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TenantActivePredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TenantActivePredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TenantActivePredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TenantActivePredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TenantActivePredicateValidationError) ErrorName() string { - return "TenantActivePredicateValidationError" -} - -// Error satisfies the builtin error interface -func (e TenantActivePredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTenantActivePredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TenantActivePredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TenantActivePredicateValidationError{} - -// Validate checks the field values on CredentialExistsPredicate with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CredentialExistsPredicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CredentialExistsPredicate with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CredentialExistsPredicateMultiError, or nil if none found. -func (m *CredentialExistsPredicate) ValidateAll() error { - return m.validate(true) -} - -func (m *CredentialExistsPredicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CredentialExistsPredicateValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CredentialExistsPredicateValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CredentialExistsPredicateValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return CredentialExistsPredicateMultiError(errors) - } - - return nil -} - -// CredentialExistsPredicateMultiError is an error wrapping multiple validation -// errors returned by CredentialExistsPredicate.ValidateAll() if the -// designated constraints aren't met. -type CredentialExistsPredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CredentialExistsPredicateMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CredentialExistsPredicateMultiError) AllErrors() []error { return m } - -// CredentialExistsPredicateValidationError is the validation error returned by -// CredentialExistsPredicate.Validate if the designated constraints aren't met. -type CredentialExistsPredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CredentialExistsPredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CredentialExistsPredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CredentialExistsPredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CredentialExistsPredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CredentialExistsPredicateValidationError) ErrorName() string { - return "CredentialExistsPredicateValidationError" -} - -// Error satisfies the builtin error interface -func (e CredentialExistsPredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCredentialExistsPredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CredentialExistsPredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CredentialExistsPredicateValidationError{} - -// Validate checks the field values on AndPredicate with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *AndPredicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AndPredicate with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AndPredicateMultiError, or -// nil if none found. -func (m *AndPredicate) ValidateAll() error { - return m.validate(true) -} - -func (m *AndPredicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetTerms() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, AndPredicateValidationError{ - field: fmt.Sprintf("Terms[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, AndPredicateValidationError{ - field: fmt.Sprintf("Terms[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return AndPredicateValidationError{ - field: fmt.Sprintf("Terms[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return AndPredicateMultiError(errors) - } - - return nil -} - -// AndPredicateMultiError is an error wrapping multiple validation errors -// returned by AndPredicate.ValidateAll() if the designated constraints aren't met. -type AndPredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AndPredicateMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AndPredicateMultiError) AllErrors() []error { return m } - -// AndPredicateValidationError is the validation error returned by -// AndPredicate.Validate if the designated constraints aren't met. -type AndPredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AndPredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AndPredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AndPredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AndPredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AndPredicateValidationError) ErrorName() string { return "AndPredicateValidationError" } - -// Error satisfies the builtin error interface -func (e AndPredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAndPredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AndPredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AndPredicateValidationError{} - -// Validate checks the field values on OrPredicate with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *OrPredicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on OrPredicate with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in OrPredicateMultiError, or -// nil if none found. -func (m *OrPredicate) ValidateAll() error { - return m.validate(true) -} - -func (m *OrPredicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetTerms() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, OrPredicateValidationError{ - field: fmt.Sprintf("Terms[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, OrPredicateValidationError{ - field: fmt.Sprintf("Terms[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return OrPredicateValidationError{ - field: fmt.Sprintf("Terms[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return OrPredicateMultiError(errors) - } - - return nil -} - -// OrPredicateMultiError is an error wrapping multiple validation errors -// returned by OrPredicate.ValidateAll() if the designated constraints aren't met. -type OrPredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m OrPredicateMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m OrPredicateMultiError) AllErrors() []error { return m } - -// OrPredicateValidationError is the validation error returned by -// OrPredicate.Validate if the designated constraints aren't met. -type OrPredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e OrPredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e OrPredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e OrPredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e OrPredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e OrPredicateValidationError) ErrorName() string { return "OrPredicateValidationError" } - -// Error satisfies the builtin error interface -func (e OrPredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sOrPredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = OrPredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = OrPredicateValidationError{} - -// Validate checks the field values on NotPredicate with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *NotPredicate) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on NotPredicate with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in NotPredicateMultiError, or -// nil if none found. -func (m *NotPredicate) ValidateAll() error { - return m.validate(true) -} - -func (m *NotPredicate) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTerm()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, NotPredicateValidationError{ - field: "Term", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, NotPredicateValidationError{ - field: "Term", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTerm()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return NotPredicateValidationError{ - field: "Term", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return NotPredicateMultiError(errors) - } - - return nil -} - -// NotPredicateMultiError is an error wrapping multiple validation errors -// returned by NotPredicate.ValidateAll() if the designated constraints aren't met. -type NotPredicateMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m NotPredicateMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m NotPredicateMultiError) AllErrors() []error { return m } - -// NotPredicateValidationError is the validation error returned by -// NotPredicate.Validate if the designated constraints aren't met. -type NotPredicateValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e NotPredicateValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e NotPredicateValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e NotPredicateValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e NotPredicateValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e NotPredicateValidationError) ErrorName() string { return "NotPredicateValidationError" } - -// Error satisfies the builtin error interface -func (e NotPredicateValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sNotPredicate.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = NotPredicateValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = NotPredicateValidationError{} - -// Validate checks the field values on ValueRef with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *ValueRef) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ValueRef with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in ValueRefMultiError, or nil -// if none found. -func (m *ValueRef) ValidateAll() error { - return m.validate(true) -} - -func (m *ValueRef) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - switch v := m.Kind.(type) { - case *ValueRef_Literal: - if v == nil { - err := ValueRefValidationError{ - field: "Kind", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for Literal - case *ValueRef_VarRef: - if v == nil { - err := ValueRefValidationError{ - field: "Kind", - reason: "oneof value cannot be a typed-nil", - } - if !all { - return err - } - errors = append(errors, err) - } - // no validation rules for VarRef - default: - _ = v // ensures v is used - } - - if len(errors) > 0 { - return ValueRefMultiError(errors) - } - - return nil -} - -// ValueRefMultiError is an error wrapping multiple validation errors returned -// by ValueRef.ValidateAll() if the designated constraints aren't met. -type ValueRefMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ValueRefMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ValueRefMultiError) AllErrors() []error { return m } - -// ValueRefValidationError is the validation error returned by -// ValueRef.Validate if the designated constraints aren't met. -type ValueRefValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ValueRefValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ValueRefValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ValueRefValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ValueRefValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ValueRefValidationError) ErrorName() string { return "ValueRefValidationError" } - -// Error satisfies the builtin error interface -func (e ValueRefValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sValueRef.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ValueRefValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ValueRefValidationError{} - -// Validate checks the field values on KeySyncNode with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *KeySyncNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeySyncNode with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in KeySyncNodeMultiError, or -// nil if none found. -func (m *KeySyncNode) ValidateAll() error { - return m.validate(true) -} - -func (m *KeySyncNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTier()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeySyncNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeySyncNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeySyncNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetKeyName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeySyncNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeySyncNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeySyncNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetParentKey()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeySyncNodeValidationError{ - field: "ParentKey", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeySyncNodeValidationError{ - field: "ParentKey", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetParentKey()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeySyncNodeValidationError{ - field: "ParentKey", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetSchedule()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeySyncNodeValidationError{ - field: "Schedule", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeySyncNodeValidationError{ - field: "Schedule", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSchedule()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeySyncNodeValidationError{ - field: "Schedule", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Metadata - - if len(errors) > 0 { - return KeySyncNodeMultiError(errors) - } - - return nil -} - -// KeySyncNodeMultiError is an error wrapping multiple validation errors -// returned by KeySyncNode.ValidateAll() if the designated constraints aren't met. -type KeySyncNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeySyncNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeySyncNodeMultiError) AllErrors() []error { return m } - -// KeySyncNodeValidationError is the validation error returned by -// KeySyncNode.Validate if the designated constraints aren't met. -type KeySyncNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeySyncNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeySyncNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeySyncNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeySyncNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeySyncNodeValidationError) ErrorName() string { return "KeySyncNodeValidationError" } - -// Error satisfies the builtin error interface -func (e KeySyncNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeySyncNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeySyncNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeySyncNodeValidationError{} - -// Validate checks the field values on KeyDeleteNode with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *KeyDeleteNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyDeleteNode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in KeyDeleteNodeMultiError, or -// nil if none found. -func (m *KeyDeleteNode) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyDeleteNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTier()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyDeleteNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyDeleteNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyDeleteNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetKeyName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyDeleteNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyDeleteNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyDeleteNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return KeyDeleteNodeMultiError(errors) - } - - return nil -} - -// KeyDeleteNodeMultiError is an error wrapping multiple validation errors -// returned by KeyDeleteNode.ValidateAll() if the designated constraints -// aren't met. -type KeyDeleteNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyDeleteNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyDeleteNodeMultiError) AllErrors() []error { return m } - -// KeyDeleteNodeValidationError is the validation error returned by -// KeyDeleteNode.Validate if the designated constraints aren't met. -type KeyDeleteNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyDeleteNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyDeleteNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyDeleteNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyDeleteNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyDeleteNodeValidationError) ErrorName() string { return "KeyDeleteNodeValidationError" } - -// Error satisfies the builtin error interface -func (e KeyDeleteNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyDeleteNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyDeleteNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyDeleteNodeValidationError{} - -// Validate checks the field values on KeyTransitionNode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *KeyTransitionNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyTransitionNode with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KeyTransitionNodeMultiError, or nil if none found. -func (m *KeyTransitionNode) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyTransitionNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTier()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyTransitionNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyTransitionNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyTransitionNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetKeyName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyTransitionNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyTransitionNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyTransitionNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for TargetState - - if len(errors) > 0 { - return KeyTransitionNodeMultiError(errors) - } - - return nil -} - -// KeyTransitionNodeMultiError is an error wrapping multiple validation errors -// returned by KeyTransitionNode.ValidateAll() if the designated constraints -// aren't met. -type KeyTransitionNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyTransitionNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyTransitionNodeMultiError) AllErrors() []error { return m } - -// KeyTransitionNodeValidationError is the validation error returned by -// KeyTransitionNode.Validate if the designated constraints aren't met. -type KeyTransitionNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyTransitionNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyTransitionNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyTransitionNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyTransitionNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyTransitionNodeValidationError) ErrorName() string { - return "KeyTransitionNodeValidationError" -} - -// Error satisfies the builtin error interface -func (e KeyTransitionNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyTransitionNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyTransitionNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyTransitionNodeValidationError{} - -// Validate checks the field values on KeyRotateNode with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *KeyRotateNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyRotateNode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in KeyRotateNodeMultiError, or -// nil if none found. -func (m *KeyRotateNode) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyRotateNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTier()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyRotateNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyRotateNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyRotateNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetKeyName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyRotateNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyRotateNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyRotateNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return KeyRotateNodeMultiError(errors) - } - - return nil -} - -// KeyRotateNodeMultiError is an error wrapping multiple validation errors -// returned by KeyRotateNode.ValidateAll() if the designated constraints -// aren't met. -type KeyRotateNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyRotateNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyRotateNodeMultiError) AllErrors() []error { return m } - -// KeyRotateNodeValidationError is the validation error returned by -// KeyRotateNode.Validate if the designated constraints aren't met. -type KeyRotateNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyRotateNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyRotateNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyRotateNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyRotateNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyRotateNodeValidationError) ErrorName() string { return "KeyRotateNodeValidationError" } - -// Error satisfies the builtin error interface -func (e KeyRotateNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyRotateNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyRotateNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyRotateNodeValidationError{} - -// Validate checks the field values on KeyScheduleNode with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *KeyScheduleNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyScheduleNode with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KeyScheduleNodeMultiError, or nil if none found. -func (m *KeyScheduleNode) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyScheduleNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetTier()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyScheduleNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyScheduleNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetTier()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyScheduleNodeValidationError{ - field: "Tier", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetKeyName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyScheduleNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyScheduleNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetKeyName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyScheduleNodeValidationError{ - field: "KeyName", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetSchedule()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyScheduleNodeValidationError{ - field: "Schedule", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyScheduleNodeValidationError{ - field: "Schedule", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSchedule()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyScheduleNodeValidationError{ - field: "Schedule", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return KeyScheduleNodeMultiError(errors) - } - - return nil -} - -// KeyScheduleNodeMultiError is an error wrapping multiple validation errors -// returned by KeyScheduleNode.ValidateAll() if the designated constraints -// aren't met. -type KeyScheduleNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyScheduleNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyScheduleNodeMultiError) AllErrors() []error { return m } - -// KeyScheduleNodeValidationError is the validation error returned by -// KeyScheduleNode.Validate if the designated constraints aren't met. -type KeyScheduleNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyScheduleNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyScheduleNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyScheduleNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyScheduleNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyScheduleNodeValidationError) ErrorName() string { return "KeyScheduleNodeValidationError" } - -// Error satisfies the builtin error interface -func (e KeyScheduleNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyScheduleNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyScheduleNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyScheduleNodeValidationError{} - -// Validate checks the field values on KeyScheduleSpec with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *KeyScheduleSpec) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeyScheduleSpec with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KeyScheduleSpecMultiError, or nil if none found. -func (m *KeyScheduleSpec) ValidateAll() error { - return m.validate(true) -} - -func (m *KeyScheduleSpec) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.ExpiresAt != nil { - - if all { - switch v := interface{}(m.GetExpiresAt()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyScheduleSpecValidationError{ - field: "ExpiresAt", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyScheduleSpecValidationError{ - field: "ExpiresAt", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetExpiresAt()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyScheduleSpecValidationError{ - field: "ExpiresAt", - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if m.ScheduledTransitionAt != nil { - - if all { - switch v := interface{}(m.GetScheduledTransitionAt()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeyScheduleSpecValidationError{ - field: "ScheduledTransitionAt", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeyScheduleSpecValidationError{ - field: "ScheduledTransitionAt", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetScheduledTransitionAt()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeyScheduleSpecValidationError{ - field: "ScheduledTransitionAt", - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if m.TransitionTo != nil { - // no validation rules for TransitionTo - } - - if len(errors) > 0 { - return KeyScheduleSpecMultiError(errors) - } - - return nil -} - -// KeyScheduleSpecMultiError is an error wrapping multiple validation errors -// returned by KeyScheduleSpec.ValidateAll() if the designated constraints -// aren't met. -type KeyScheduleSpecMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeyScheduleSpecMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeyScheduleSpecMultiError) AllErrors() []error { return m } - -// KeyScheduleSpecValidationError is the validation error returned by -// KeyScheduleSpec.Validate if the designated constraints aren't met. -type KeyScheduleSpecValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeyScheduleSpecValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeyScheduleSpecValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeyScheduleSpecValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeyScheduleSpecValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeyScheduleSpecValidationError) ErrorName() string { return "KeyScheduleSpecValidationError" } - -// Error satisfies the builtin error interface -func (e KeyScheduleSpecValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeyScheduleSpec.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeyScheduleSpecValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeyScheduleSpecValidationError{} - -// Validate checks the field values on CredentialSyncNode with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CredentialSyncNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CredentialSyncNode with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CredentialSyncNodeMultiError, or nil if none found. -func (m *CredentialSyncNode) ValidateAll() error { - return m.validate(true) -} - -func (m *CredentialSyncNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CredentialSyncNodeValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CredentialSyncNodeValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CredentialSyncNodeValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetType()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CredentialSyncNodeValidationError{ - field: "Type", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CredentialSyncNodeValidationError{ - field: "Type", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetType()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CredentialSyncNodeValidationError{ - field: "Type", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetSpec()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CredentialSyncNodeValidationError{ - field: "Spec", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CredentialSyncNodeValidationError{ - field: "Spec", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetSpec()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CredentialSyncNodeValidationError{ - field: "Spec", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return CredentialSyncNodeMultiError(errors) - } - - return nil -} - -// CredentialSyncNodeMultiError is an error wrapping multiple validation errors -// returned by CredentialSyncNode.ValidateAll() if the designated constraints -// aren't met. -type CredentialSyncNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CredentialSyncNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CredentialSyncNodeMultiError) AllErrors() []error { return m } - -// CredentialSyncNodeValidationError is the validation error returned by -// CredentialSyncNode.Validate if the designated constraints aren't met. -type CredentialSyncNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CredentialSyncNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CredentialSyncNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CredentialSyncNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CredentialSyncNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CredentialSyncNodeValidationError) ErrorName() string { - return "CredentialSyncNodeValidationError" -} - -// Error satisfies the builtin error interface -func (e CredentialSyncNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCredentialSyncNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CredentialSyncNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CredentialSyncNodeValidationError{} - -// Validate checks the field values on CredentialDeleteNode with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CredentialDeleteNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CredentialDeleteNode with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CredentialDeleteNodeMultiError, or nil if none found. -func (m *CredentialDeleteNode) ValidateAll() error { - return m.validate(true) -} - -func (m *CredentialDeleteNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetName()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CredentialDeleteNodeValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CredentialDeleteNodeValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CredentialDeleteNodeValidationError{ - field: "Name", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return CredentialDeleteNodeMultiError(errors) - } - - return nil -} - -// CredentialDeleteNodeMultiError is an error wrapping multiple validation -// errors returned by CredentialDeleteNode.ValidateAll() if the designated -// constraints aren't met. -type CredentialDeleteNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CredentialDeleteNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CredentialDeleteNodeMultiError) AllErrors() []error { return m } - -// CredentialDeleteNodeValidationError is the validation error returned by -// CredentialDeleteNode.Validate if the designated constraints aren't met. -type CredentialDeleteNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CredentialDeleteNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CredentialDeleteNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CredentialDeleteNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CredentialDeleteNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CredentialDeleteNodeValidationError) ErrorName() string { - return "CredentialDeleteNodeValidationError" -} - -// Error satisfies the builtin error interface -func (e CredentialDeleteNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCredentialDeleteNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CredentialDeleteNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CredentialDeleteNodeValidationError{} - -// Validate checks the field values on BindNode with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *BindNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on BindNode with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in BindNodeMultiError, or nil -// if none found. -func (m *BindNode) ValidateAll() error { - return m.validate(true) -} - -func (m *BindNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for VarName - - if all { - switch v := interface{}(m.GetValue()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, BindNodeValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, BindNodeValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return BindNodeValidationError{ - field: "Value", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return BindNodeMultiError(errors) - } - - return nil -} - -// BindNodeMultiError is an error wrapping multiple validation errors returned -// by BindNode.ValidateAll() if the designated constraints aren't met. -type BindNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m BindNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m BindNodeMultiError) AllErrors() []error { return m } - -// BindNodeValidationError is the validation error returned by -// BindNode.Validate if the designated constraints aren't met. -type BindNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e BindNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e BindNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e BindNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e BindNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e BindNodeValidationError) ErrorName() string { return "BindNodeValidationError" } - -// Error satisfies the builtin error interface -func (e BindNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sBindNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = BindNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = BindNodeValidationError{} - -// Validate checks the field values on EmitNode with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *EmitNode) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on EmitNode with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in EmitNodeMultiError, or nil -// if none found. -func (m *EmitNode) ValidateAll() error { - return m.validate(true) -} - -func (m *EmitNode) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for EventType - - // no validation rules for Attributes - - if len(errors) > 0 { - return EmitNodeMultiError(errors) - } - - return nil -} - -// EmitNodeMultiError is an error wrapping multiple validation errors returned -// by EmitNode.ValidateAll() if the designated constraints aren't met. -type EmitNodeMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m EmitNodeMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m EmitNodeMultiError) AllErrors() []error { return m } - -// EmitNodeValidationError is the validation error returned by -// EmitNode.Validate if the designated constraints aren't met. -type EmitNodeValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e EmitNodeValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e EmitNodeValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e EmitNodeValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e EmitNodeValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e EmitNodeValidationError) ErrorName() string { return "EmitNodeValidationError" } - -// Error satisfies the builtin error interface -func (e EmitNodeValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sEmitNode.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = EmitNodeValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = EmitNodeValidationError{} diff --git a/proto/plugin/resources/v1/ast.proto b/proto/plugin/resources/v1/ast.proto deleted file mode 100644 index 817b07d..0000000 --- a/proto/plugin/resources/v1/ast.proto +++ /dev/null @@ -1,277 +0,0 @@ -syntax = "proto3"; - -package krypton.resources.reconciler.v1; - -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -// ExecutionPlan is the root of the AST returned by a plugin's Reconcile call. -// It describes every operation Krypton core must execute to drive the custom -// resource to its desired state. Core is the sole executor — the plugin never -// touches keys, state, or the database directly. -message ExecutionPlan { - // plan_id identifies this plan for tracing. Recommended: echo the operation ID. - string plan_id = 1; - - // root is the root node of the execution tree. - ASTNode root = 2; - - // bindings are pre-declared variables available to every node in the plan. - // Use them to pass tenant_id, api_group, external IDs, or any other values - // the plugin resolved during planning and wants to thread through execution. - map bindings = 3; -} - -// ───────────────────────────────────────────────────────────── -// Core node type — every element of the AST is an ASTNode. -// ───────────────────────────────────────────────────────────── - -message ASTNode { - // node_id is an optional stable identifier used for checkpoint persistence. - // When set, the executor stores progress so retries resume from here. - // Must be stable across retries (use a semantic name, not a random UUID). - string node_id = 1; - - // label is a human-readable description surfaced in logs and audit events. - string label = 2; - - // result_var, when non-empty, binds the primary string output of this node - // (typically a provisioned key ID) into the execution state so downstream - // nodes can reference it via ValueRef.var_ref. - string result_var = 3; - - oneof node { - // ── Control flow ────────────────────────────────────────── - SequenceNode sequence = 10; - ParallelNode parallel = 11; - ConditionalNode conditional = 12; - TryCatchNode try_catch = 13; - - // ── Checkpoint ──────────────────────────────────────────── - // Persists progress at this point; uses node_id as the checkpoint name. - CheckpointNode checkpoint = 14; - - // ── Assertions / pre-conditions ─────────────────────────── - // Fails the plan with error_message if the predicate is false. - AssertNode assert = 20; - - // ── Key lifecycle ───────────────────────────────────────── - KeySyncNode key_sync = 30; // create or idempotently update - KeyDeleteNode key_delete = 31; // destroy key material - KeyTransitionNode key_transition = 32; // explicit lifecycle state change - KeyRotateNode key_rotate = 33; // generate new key material (forced rotation) - KeyScheduleNode key_schedule = 34; // set expiry / scheduled transition - - // ── Credential lifecycle ─────────────────────────────────── - CredentialSyncNode credential_sync = 40; - CredentialDeleteNode credential_delete = 41; - - // ── Utility ─────────────────────────────────────────────── - BindNode bind = 60; // set a variable in execution state - EmitNode emit = 61; // write a custom audit event - } -} - -// ───────────────────────────────────────────────────────────── -// Control flow -// ───────────────────────────────────────────────────────────── - -// SequenceNode runs steps in order; the first error aborts the remainder -// and triggers rollback of already-executed steps (same as Pipeline). -message SequenceNode { - repeated ASTNode steps = 1; -} - -// ParallelNode fans steps out concurrently. -// When fail_fast = true a single error cancels the remaining goroutines. -message ParallelNode { - repeated ASTNode steps = 1; - bool fail_fast = 2; -} - -// ConditionalNode evaluates a runtime predicate and executes exactly one branch. -message ConditionalNode { - Predicate condition = 1; - ASTNode then_node = 2; - ASTNode else_node = 3; // optional — omit for pure guard -} - -// TryCatchNode executes try_node; on any error executes catch_node instead. -// Useful for compensating transactions and optional / best-effort steps. -message TryCatchNode { - ASTNode try_node = 1; - ASTNode catch_node = 2; -} - -// CheckpointNode persists the current execution position so retries skip -// completed steps. Uses the parent ASTNode.node_id as the checkpoint name. -message CheckpointNode {} - -// ───────────────────────────────────────────────────────────── -// Assertions -// ───────────────────────────────────────────────────────────── - -message AssertNode { - Predicate condition = 1; - string error_message = 2; -} - -// Predicate is a composable boolean expression resolved against live Krypton -// state at execution time. Core owns all state reads; the plugin only declares -// what must be true. -message Predicate { - oneof expr { - KeyExistsPredicate key_exists = 1; - KeyStatePredicate key_state = 2; - TenantActivePredicate tenant_active = 3; - CredentialExistsPredicate credential_exists = 4; - - // Logical combinators - AndPredicate and = 10; - OrPredicate or = 11; - NotPredicate not = 12; - } -} - -message KeyExistsPredicate { - ValueRef tier = 1; - ValueRef key_name = 2; -} - -message KeyStatePredicate { - ValueRef tier = 1; - ValueRef key_name = 2; - // allowed_states is an OR list — matches if the key is in ANY of these states. - // Valid values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, COMPROMISED, - // PENDING_DESTROYING, DESTROYED. - repeated string allowed_states = 3; -} - -message TenantActivePredicate { - ValueRef tenant_id = 1; -} - -message CredentialExistsPredicate { - ValueRef name = 1; -} - -message AndPredicate { - repeated Predicate terms = 1; -} -message OrPredicate { - repeated Predicate terms = 1; -} -message NotPredicate { - Predicate term = 1; -} - -// ───────────────────────────────────────────────────────────── -// Value references -// ───────────────────────────────────────────────────────────── - -// ValueRef resolves to a string at runtime. -// Use literal for constants known at plan time. -// Use var_ref to read a value set by a previous node's result_var or by -// ExecutionPlan.bindings. -message ValueRef { - oneof kind { - string literal = 1; - string var_ref = 2; - } -} - -// ───────────────────────────────────────────────────────────── -// Key lifecycle nodes -// ───────────────────────────────────────────────────────────── - -// KeySyncNode provisions a key at the given tier, or is a no-op if the key -// already exists (idempotent). Core wraps the key under parent_key using the -// configured tier hierarchy. On success, result_var receives the key ULID. -message KeySyncNode { - // tier is the Krypton tier name as declared in key-hierarchy config, - // e.g. "l2-domain", "l3-service", "l4-data". - ValueRef tier = 1; - // key_name is the logical name scoped to the tenant. - ValueRef key_name = 2; - // parent_key is the name of the wrapping key one tier above. - // Required for all tiers except L1 root keys. - ValueRef parent_key = 3; - // schedule, when set, is applied immediately after provisioning. - KeyScheduleSpec schedule = 4; - // metadata is attached to the key record after successful provisioning. - map metadata = 5; -} - -// KeyDeleteNode destroys key material and all version lineages. -// Core enforces that no child keys exist before allowing deletion. -message KeyDeleteNode { - ValueRef tier = 1; - ValueRef key_name = 2; -} - -// KeyTransitionNode explicitly moves a key to a target lifecycle state. -// Valid target_state values: PRE_ACTIVATION, ACTIVE, SUSPENDED, DEACTIVATED, -// COMPROMISED, PENDING_DESTROYING, DESTROYED. -message KeyTransitionNode { - ValueRef tier = 1; - ValueRef key_name = 2; - string target_state = 3; -} - -// KeyRotateNode generates new key material under the same logical key name -// (forced rotation — bypasses the idempotency guard in ProvisionKey). -// On success, result_var receives the new key ULID. -message KeyRotateNode { - ValueRef tier = 1; - ValueRef key_name = 2; -} - -// KeyScheduleNode updates the scheduled lifecycle transition for an existing key. -message KeyScheduleNode { - ValueRef tier = 1; - ValueRef key_name = 2; - KeyScheduleSpec schedule = 3; -} - -// KeyScheduleSpec carries timing parameters for a scheduled state transition. -// All fields are optional — set only the ones you need. -message KeyScheduleSpec { - optional google.protobuf.Timestamp expires_at = 1; - optional google.protobuf.Timestamp scheduled_transition_at = 2; - // transition_to is the target KeyState when scheduled_transition_at fires. - optional string transition_to = 3; -} - -// ───────────────────────────────────────────────────────────── -// Credential lifecycle nodes -// ───────────────────────────────────────────────────────────── - -// CredentialSyncNode creates or updates a credential. -// spec is the full credential payload; core encrypts it using the tenant keyring. -message CredentialSyncNode { - ValueRef name = 1; - ValueRef type = 2; - google.protobuf.Struct spec = 3; -} - -// CredentialDeleteNode removes a credential record. -message CredentialDeleteNode { - ValueRef name = 1; -} - -// ───────────────────────────────────────────────────────────── -// Utility nodes -// ───────────────────────────────────────────────────────────── - -// BindNode sets a named variable in the execution state. -// Useful for deriving values from existing bindings before referencing them. -message BindNode { - string var_name = 1; - ValueRef value = 2; -} - -// EmitNode writes a structured event to Krypton's audit trail. -message EmitNode { - string event_type = 1; - map attributes = 2; -} diff --git a/proto/plugin/resources/v1/reconciler.pb.go b/proto/plugin/resources/v1/reconciler.pb.go deleted file mode 100644 index abac27b..0000000 --- a/proto/plugin/resources/v1/reconciler.pb.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.36.11 -// protoc (unknown) -// source: plugin/resources/v1/reconciler.proto - -package reconcilerv1 - -import ( - reflect "reflect" - sync "sync" - unsafe "unsafe" - - _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// ReconcileRequest carries everything the plugin needs to plan operations for -// this resource. resource_payload is opaque to core and decoded only by the plugin. -type ReconcileRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // api_group identifies the resource type family, e.g. "mycompany.kms/v1". - ApiGroup string `protobuf:"bytes,1,opt,name=api_group,json=apiGroup,proto3" json:"api_group,omitempty"` - Kind string `protobuf:"bytes,2,opt,name=kind,proto3" json:"kind,omitempty"` - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - // resource_payload is the JSON-encoded extension_key Struct from the original - // SyncResourceRequest. Core passes it unchanged; the plugin owns the schema. - ResourcePayload []byte `protobuf:"bytes,4,opt,name=resource_payload,json=resourcePayload,proto3" json:"resource_payload,omitempty"` - // action is the operation requested: "SYNC" or "DELETE". - Action string `protobuf:"bytes,5,opt,name=action,proto3" json:"action,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ReconcileRequest) Reset() { - *x = ReconcileRequest{} - mi := &file_plugin_resources_v1_reconciler_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ReconcileRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReconcileRequest) ProtoMessage() {} - -func (x *ReconcileRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_reconciler_proto_msgTypes[0] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReconcileRequest.ProtoReflect.Descriptor instead. -func (*ReconcileRequest) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_reconciler_proto_rawDescGZIP(), []int{0} -} - -func (x *ReconcileRequest) GetApiGroup() string { - if x != nil { - return x.ApiGroup - } - return "" -} - -func (x *ReconcileRequest) GetKind() string { - if x != nil { - return x.Kind - } - return "" -} - -func (x *ReconcileRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ReconcileRequest) GetResourcePayload() []byte { - if x != nil { - return x.ResourcePayload - } - return nil -} - -func (x *ReconcileRequest) GetAction() string { - if x != nil { - return x.Action - } - return "" -} - -// ReconcileResponse is returned by the plugin and contains the execution plan. -// Core decodes execution_plan as a JSON-encoded ast.ExecutionPlan and executes it. -type ReconcileResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - // error_message non-empty means planning failed. - // transient_error = true → worker requeues up to max retries. - // transient_error = false → worker marks operation as terminally failed. - ErrorMessage string `protobuf:"bytes,1,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` - TransientError bool `protobuf:"varint,2,opt,name=transient_error,json=transientError,proto3" json:"transient_error,omitempty"` - // execution_plan is a JSON-encoded ast.ExecutionPlan (see - // internal/modules/resource-reconciler/controller/ast). Empty means no-op. - ExecutionPlan []byte `protobuf:"bytes,3,opt,name=execution_plan,json=executionPlan,proto3" json:"execution_plan,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache -} - -func (x *ReconcileResponse) Reset() { - *x = ReconcileResponse{} - mi := &file_plugin_resources_v1_reconciler_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) -} - -func (x *ReconcileResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ReconcileResponse) ProtoMessage() {} - -func (x *ReconcileResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_resources_v1_reconciler_proto_msgTypes[1] - if x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ReconcileResponse.ProtoReflect.Descriptor instead. -func (*ReconcileResponse) Descriptor() ([]byte, []int) { - return file_plugin_resources_v1_reconciler_proto_rawDescGZIP(), []int{1} -} - -func (x *ReconcileResponse) GetErrorMessage() string { - if x != nil { - return x.ErrorMessage - } - return "" -} - -func (x *ReconcileResponse) GetTransientError() bool { - if x != nil { - return x.TransientError - } - return false -} - -func (x *ReconcileResponse) GetExecutionPlan() []byte { - if x != nil { - return x.ExecutionPlan - } - return nil -} - -var File_plugin_resources_v1_reconciler_proto protoreflect.FileDescriptor - -const file_plugin_resources_v1_reconciler_proto_rawDesc = "" + - "\n" + - "$plugin/resources/v1/reconciler.proto\x12\x1fkrypton.resources.reconciler.v1\x1a\x1bbuf/validate/validate.proto\"\xc2\x01\n" + - "\x10ReconcileRequest\x12#\n" + - "\tapi_group\x18\x01 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bapiGroup\x12\x1a\n" + - "\x04kind\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x04kind\x12\x1a\n" + - "\x04name\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x04name\x121\n" + - "\x10resource_payload\x18\x04 \x01(\fB\x06\xbaH\x03\xc8\x01\x01R\x0fresourcePayload\x12\x1e\n" + - "\x06action\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x06action\"\x88\x01\n" + - "\x11ReconcileResponse\x12#\n" + - "\rerror_message\x18\x01 \x01(\tR\ferrorMessage\x12'\n" + - "\x0ftransient_error\x18\x02 \x01(\bR\x0etransientError\x12%\n" + - "\x0eexecution_plan\x18\x03 \x01(\fR\rexecutionPlan2\x80\x01\n" + - "\n" + - "Reconciler\x12r\n" + - "\tReconcile\x121.krypton.resources.reconciler.v1.ReconcileRequest\x1a2.krypton.resources.reconciler.v1.ReconcileResponseB\x9b\x02\n" + - "#com.krypton.resources.reconciler.v1B\x0fReconcilerProtoP\x01ZDgithub.com/openkcm/plugin-sdk/proto/plugin/resources/v1;reconcilerv1\xa2\x02\x03KRR\xaa\x02\x1fKrypton.Resources.Reconciler.V1\xca\x02\x1fKrypton\\Resources\\Reconciler\\V1\xe2\x02+Krypton\\Resources\\Reconciler\\V1\\GPBMetadata\xea\x02\"Krypton::Resources::Reconciler::V1b\x06proto3" - -var ( - file_plugin_resources_v1_reconciler_proto_rawDescOnce sync.Once - file_plugin_resources_v1_reconciler_proto_rawDescData []byte -) - -func file_plugin_resources_v1_reconciler_proto_rawDescGZIP() []byte { - file_plugin_resources_v1_reconciler_proto_rawDescOnce.Do(func() { - file_plugin_resources_v1_reconciler_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_plugin_resources_v1_reconciler_proto_rawDesc), len(file_plugin_resources_v1_reconciler_proto_rawDesc))) - }) - return file_plugin_resources_v1_reconciler_proto_rawDescData -} - -var file_plugin_resources_v1_reconciler_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_plugin_resources_v1_reconciler_proto_goTypes = []any{ - (*ReconcileRequest)(nil), // 0: krypton.resources.reconciler.v1.ReconcileRequest - (*ReconcileResponse)(nil), // 1: krypton.resources.reconciler.v1.ReconcileResponse -} -var file_plugin_resources_v1_reconciler_proto_depIdxs = []int32{ - 0, // 0: krypton.resources.reconciler.v1.Reconciler.Reconcile:input_type -> krypton.resources.reconciler.v1.ReconcileRequest - 1, // 1: krypton.resources.reconciler.v1.Reconciler.Reconcile:output_type -> krypton.resources.reconciler.v1.ReconcileResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_plugin_resources_v1_reconciler_proto_init() } -func file_plugin_resources_v1_reconciler_proto_init() { - if File_plugin_resources_v1_reconciler_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_resources_v1_reconciler_proto_rawDesc), len(file_plugin_resources_v1_reconciler_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_plugin_resources_v1_reconciler_proto_goTypes, - DependencyIndexes: file_plugin_resources_v1_reconciler_proto_depIdxs, - MessageInfos: file_plugin_resources_v1_reconciler_proto_msgTypes, - }.Build() - File_plugin_resources_v1_reconciler_proto = out.File - file_plugin_resources_v1_reconciler_proto_goTypes = nil - file_plugin_resources_v1_reconciler_proto_depIdxs = nil -} diff --git a/proto/plugin/resources/v1/reconciler.pb.validate.go b/proto/plugin/resources/v1/reconciler.pb.validate.go deleted file mode 100644 index 882a210..0000000 --- a/proto/plugin/resources/v1/reconciler.pb.validate.go +++ /dev/null @@ -1,254 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/resources/v1/reconciler.proto - -package reconcilerv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ReconcileRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ReconcileRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ReconcileRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ReconcileRequestMultiError, or nil if none found. -func (m *ReconcileRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ReconcileRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ApiGroup - - // no validation rules for Kind - - // no validation rules for Name - - // no validation rules for ResourcePayload - - // no validation rules for Action - - if len(errors) > 0 { - return ReconcileRequestMultiError(errors) - } - - return nil -} - -// ReconcileRequestMultiError is an error wrapping multiple validation errors -// returned by ReconcileRequest.ValidateAll() if the designated constraints -// aren't met. -type ReconcileRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ReconcileRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ReconcileRequestMultiError) AllErrors() []error { return m } - -// ReconcileRequestValidationError is the validation error returned by -// ReconcileRequest.Validate if the designated constraints aren't met. -type ReconcileRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ReconcileRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ReconcileRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ReconcileRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ReconcileRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ReconcileRequestValidationError) ErrorName() string { return "ReconcileRequestValidationError" } - -// Error satisfies the builtin error interface -func (e ReconcileRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sReconcileRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ReconcileRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ReconcileRequestValidationError{} - -// Validate checks the field values on ReconcileResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ReconcileResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ReconcileResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ReconcileResponseMultiError, or nil if none found. -func (m *ReconcileResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ReconcileResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for ErrorMessage - - // no validation rules for TransientError - - // no validation rules for ExecutionPlan - - if len(errors) > 0 { - return ReconcileResponseMultiError(errors) - } - - return nil -} - -// ReconcileResponseMultiError is an error wrapping multiple validation errors -// returned by ReconcileResponse.ValidateAll() if the designated constraints -// aren't met. -type ReconcileResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ReconcileResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ReconcileResponseMultiError) AllErrors() []error { return m } - -// ReconcileResponseValidationError is the validation error returned by -// ReconcileResponse.Validate if the designated constraints aren't met. -type ReconcileResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ReconcileResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ReconcileResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ReconcileResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ReconcileResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ReconcileResponseValidationError) ErrorName() string { - return "ReconcileResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ReconcileResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sReconcileResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ReconcileResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ReconcileResponseValidationError{} diff --git a/proto/plugin/resources/v1/reconciler.proto b/proto/plugin/resources/v1/reconciler.proto deleted file mode 100644 index 635e989..0000000 --- a/proto/plugin/resources/v1/reconciler.proto +++ /dev/null @@ -1,48 +0,0 @@ -syntax = "proto3"; - -package krypton.resources.reconciler.v1; - -import "buf/validate/validate.proto"; - -// Reconciler is the gRPC contract between Krypton core and an external -// reconciler plugin. Core is the client; the plugin binary is the server. -// -// The plugin receives the raw extension payload for a custom resource kind -// and returns an ExecutionPlan (AST) describing every key operation Krypton -// must perform. The plugin never touches keys or state directly — it only -// declares intent via the JSON-encoded AST. Core is the sole executor. -service Reconciler { - rpc Reconcile(ReconcileRequest) returns (ReconcileResponse); -} - -// ReconcileRequest carries everything the plugin needs to plan operations for -// this resource. resource_payload is opaque to core and decoded only by the plugin. -message ReconcileRequest { - // api_group identifies the resource type family, e.g. "mycompany.kms/v1". - string api_group = 1 [(buf.validate.field).required = true]; - - string kind = 2 [(buf.validate.field).required = true]; - - string name = 3 [(buf.validate.field).required = true]; - - // resource_payload is the JSON-encoded extension_key Struct from the original - // SyncResourceRequest. Core passes it unchanged; the plugin owns the schema. - bytes resource_payload = 4 [(buf.validate.field).required = true]; - - // action is the operation requested: "SYNC" or "DELETE". - string action = 5 [(buf.validate.field).required = true]; -} - -// ReconcileResponse is returned by the plugin and contains the execution plan. -// Core decodes execution_plan as a JSON-encoded ast.ExecutionPlan and executes it. -message ReconcileResponse { - // error_message non-empty means planning failed. - // transient_error = true → worker requeues up to max retries. - // transient_error = false → worker marks operation as terminally failed. - string error_message = 1; - bool transient_error = 2; - - // execution_plan is a JSON-encoded ast.ExecutionPlan (see - // internal/modules/resource-reconciler/controller/ast). Empty means no-op. - bytes execution_plan = 3; -} diff --git a/proto/plugin/resources/v1/reconciler_ext_plugin.pb.go b/proto/plugin/resources/v1/reconciler_ext_plugin.pb.go deleted file mode 100644 index 351d4ae..0000000 --- a/proto/plugin/resources/v1/reconciler_ext_plugin.pb.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by protoc-gen-go-extension. DO NOT EDIT. - -package reconcilerv1 - -import ( - grpc "google.golang.org/grpc" - - api "github.com/openkcm/plugin-sdk/api" -) - -const ( - Type = "Reconciler" - GRPCServiceFullName = "krypton.resources.reconciler.v1.Reconciler" -) - -func ReconcilerPluginServer(server ReconcilerServer) api.PluginServer { - return reconcilerPluginServer{ReconcilerServer: server} -} - -type reconcilerPluginServer struct { - ReconcilerServer -} - -func (s reconcilerPluginServer) Type() string { - return Type -} - -func (s reconcilerPluginServer) GRPCServiceName() string { - return GRPCServiceFullName -} - -func (s reconcilerPluginServer) RegisterServer(server *grpc.Server) any { - RegisterReconcilerServer(server, s.ReconcilerServer) - return s.ReconcilerServer -} - -type ReconcilerPluginClient struct { - ReconcilerClient -} - -func (s ReconcilerPluginClient) Type() string { - return Type -} - -func (c *ReconcilerPluginClient) IsInitialized() bool { - return c.ReconcilerClient != nil -} - -func (c *ReconcilerPluginClient) GRPCServiceName() string { - return GRPCServiceFullName -} - -func (c *ReconcilerPluginClient) InitClient(conn grpc.ClientConnInterface) any { - c.ReconcilerClient = NewReconcilerClient(conn) - return c.ReconcilerClient -} diff --git a/proto/plugin/resources/v1/reconciler_grpc.pb.go b/proto/plugin/resources/v1/reconciler_grpc.pb.go deleted file mode 100644 index 9a6c02e..0000000 --- a/proto/plugin/resources/v1/reconciler_grpc.pb.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) -// source: plugin/resources/v1/reconciler.proto - -package reconcilerv1 - -import ( - context "context" - - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.64.0 or later. -const _ = grpc.SupportPackageIsVersion9 - -const ( - Reconciler_Reconcile_FullMethodName = "/krypton.resources.reconciler.v1.Reconciler/Reconcile" -) - -// ReconcilerClient is the client API for Reconciler service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Reconciler is the gRPC contract between Krypton core and an external -// reconciler plugin. Core is the client; the plugin binary is the server. -// -// The plugin receives the raw extension payload for a custom resource kind -// and returns an ExecutionPlan (AST) describing every key operation Krypton -// must perform. The plugin never touches keys or state directly — it only -// declares intent via the JSON-encoded AST. Core is the sole executor. -type ReconcilerClient interface { - Reconcile(ctx context.Context, in *ReconcileRequest, opts ...grpc.CallOption) (*ReconcileResponse, error) -} - -type reconcilerClient struct { - cc grpc.ClientConnInterface -} - -func NewReconcilerClient(cc grpc.ClientConnInterface) ReconcilerClient { - return &reconcilerClient{cc} -} - -func (c *reconcilerClient) Reconcile(ctx context.Context, in *ReconcileRequest, opts ...grpc.CallOption) (*ReconcileResponse, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(ReconcileResponse) - err := c.cc.Invoke(ctx, Reconciler_Reconcile_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ReconcilerServer is the server API for Reconciler service. -// All implementations must embed UnimplementedReconcilerServer -// for forward compatibility. -// -// Reconciler is the gRPC contract between Krypton core and an external -// reconciler plugin. Core is the client; the plugin binary is the server. -// -// The plugin receives the raw extension payload for a custom resource kind -// and returns an ExecutionPlan (AST) describing every key operation Krypton -// must perform. The plugin never touches keys or state directly — it only -// declares intent via the JSON-encoded AST. Core is the sole executor. -type ReconcilerServer interface { - Reconcile(context.Context, *ReconcileRequest) (*ReconcileResponse, error) - mustEmbedUnimplementedReconcilerServer() -} - -// UnimplementedReconcilerServer must be embedded to have -// forward compatible implementations. -// -// NOTE: this should be embedded by value instead of pointer to avoid a nil -// pointer dereference when methods are called. -type UnimplementedReconcilerServer struct{} - -func (UnimplementedReconcilerServer) Reconcile(context.Context, *ReconcileRequest) (*ReconcileResponse, error) { - return nil, status.Error(codes.Unimplemented, "method Reconcile not implemented") -} -func (UnimplementedReconcilerServer) mustEmbedUnimplementedReconcilerServer() {} -func (UnimplementedReconcilerServer) testEmbeddedByValue() {} - -// UnsafeReconcilerServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ReconcilerServer will -// result in compilation errors. -type UnsafeReconcilerServer interface { - mustEmbedUnimplementedReconcilerServer() -} - -func RegisterReconcilerServer(s grpc.ServiceRegistrar, srv ReconcilerServer) { - // If the following call panics, it indicates UnimplementedReconcilerServer was - // embedded by pointer and is nil. This will cause panics if an - // unimplemented method is ever invoked, so we test this at initialization - // time to prevent it from happening at runtime later due to I/O. - if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { - t.testEmbeddedByValue() - } - s.RegisterService(&Reconciler_ServiceDesc, srv) -} - -func _Reconciler_Reconcile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ReconcileRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ReconcilerServer).Reconcile(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Reconciler_Reconcile_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ReconcilerServer).Reconcile(ctx, req.(*ReconcileRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Reconciler_ServiceDesc is the grpc.ServiceDesc for Reconciler service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Reconciler_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "krypton.resources.reconciler.v1.Reconciler", - HandlerType: (*ReconcilerServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Reconcile", - Handler: _Reconciler_Reconcile_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "plugin/resources/v1/reconciler.proto", -} From ca6a03304ec4044f88a6b0a8563810e5938fbdb7 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Sat, 25 Jul 2026 17:48:58 +0200 Subject: [PATCH 23/27] modify --- go.mod | 20 +++++++++--------- go.sum | 64 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/go.mod b/go.mod index 8f87269..0689450 100644 --- a/go.mod +++ b/go.mod @@ -3,15 +3,15 @@ module github.com/openkcm/plugin-sdk go 1.25.4 require ( - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260209202127-80ab13bee0bf.1 - buf.build/go/protovalidate v1.1.3 + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1 + buf.build/go/protovalidate v1.2.0 github.com/hashicorp/go-hclog v1.6.3 - github.com/hashicorp/go-plugin v1.7.0 + github.com/hashicorp/go-plugin v1.8.0 github.com/stretchr/testify v1.11.1 github.com/zeebo/errs/v2 v2.0.5 - golang.org/x/sys v0.41.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 - google.golang.org/grpc v1.79.1 + golang.org/x/sys v0.47.0 + google.golang.org/genproto/googleapis/rpc v0.0.0-20260724162435-b2f20204f0df + google.golang.org/grpc v1.82.1 google.golang.org/protobuf v1.36.11 ) @@ -21,15 +21,15 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/fatih/color v1.18.0 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/cel-go v0.27.0 // indirect + github.com/google/cel-go v0.28.0 // indirect github.com/hashicorp/yamux v0.1.2 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/oklog/run v1.1.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 // indirect - golang.org/x/net v0.48.0 // indirect - golang.org/x/text v0.32.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect + golang.org/x/net v0.53.0 // indirect + golang.org/x/text v0.36.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 7291ec6..4368900 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260209202127-80ab13bee0bf.1 h1:PMmTMyvHScV9Mn8wc6ASge9uRcHy0jtqPd+fM35LmsQ= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260209202127-80ab13bee0bf.1/go.mod h1:tvtbpgaVXZX4g6Pn+AnzFycuRK3MOz5HJfEGeEllXYM= -buf.build/go/protovalidate v1.1.3 h1:m2GVEgQWd7rk+vIoAZ+f0ygGjvQTuqPQapBBdcpWVPE= -buf.build/go/protovalidate v1.1.3/go.mod h1:9XIuohWz+kj+9JVn3WQneHA5LZP50mjvneZMnbLkiIE= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1 h1:fXh8CsdNpjRr8R5vFdqtIxPt/Lno2IIJlYOdZBIZn0w= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1/go.mod h1:tvtbpgaVXZX4g6Pn+AnzFycuRK3MOz5HJfEGeEllXYM= +buf.build/go/protovalidate v1.2.0 h1:DQVrUWkmGTBij+kOYv/x2LLxwcLaGKMdzShj1/6/3H0= +buf.build/go/protovalidate v1.2.0/go.mod h1:7rYiQEhqvAipoazpVNBBH2S2f8bjG4huMVy1V2Yofn4= cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= @@ -24,16 +24,16 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/cel-go v0.27.0 h1:e7ih85+4qVrBuqQWTW4FKSqZYokVuc3HnhH5keboFTo= -github.com/google/cel-go v0.27.0/go.mod h1:tTJ11FWqnhw5KKpnWpvW9CJC3Y9GK4EIS0WXnBbebzw= +github.com/google/cel-go v0.28.0 h1:KjSWstCpz/MN5t4a8gnGJNIYUsJRpdi/r97xWDphIQc= +github.com/google/cel-go v0.28.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= -github.com/hashicorp/go-plugin v1.7.0 h1:YghfQH/0QmPNc/AZMTFE3ac8fipZyZECHdDPshfk+mA= -github.com/hashicorp/go-plugin v1.7.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8= +github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/FORs= +github.com/hashicorp/go-plugin v1.8.0/go.mod h1:BExt6KEaIYx804z8k4gRzRLEvxKVb+kn0NMcihqOqb8= github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8= github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= @@ -66,40 +66,40 @@ github.com/zeebo/errs/v2 v2.0.5 h1:edtyFoQq9OBBsNPcu0b0wHtRvA8haukAHrGyOfWQGNI= github.com/zeebo/errs/v2 v2.0.5/go.mod h1:OKmvVZt4UqpyJrYFykDKm168ZquJ55pbbIVUICNmLN0= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48= -go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8= -go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0= -go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs= -go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18= -go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE= -go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8= -go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew= -go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI= -go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA= +go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= +go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= +go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= +go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= +go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= +go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= +go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= +go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= +go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= +go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 h1:SbTAbRFnd5kjQXbczszQ0hdk3ctwYf3qBNH9jIsGclE= golang.org/x/exp v0.0.0-20250813145105-42675adae3e6/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4= -golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= -golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= +golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= -golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= -golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= -gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= -gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= -google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= -google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY= -google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= +golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= +gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= +google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 h1:yQugLulqltosq0B/f8l4w9VryjV+N/5gcW0jQ3N8Qec= +google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478/go.mod h1:C6ADNqOxbgdUUeRTU+LCHDPB9ttAMCTff6auwCVa4uc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260724162435-b2f20204f0df h1:O3ig1i5WDDzsVzRp+cCdgelT9vXnlnOFdlEeFtL4HCc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260724162435-b2f20204f0df/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE= +google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 73e14f7aede73d1c4b7e46b4993ab7fdde2d7ed1 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Sat, 25 Jul 2026 17:59:28 +0200 Subject: [PATCH 24/27] modify --- pkg/catalog/builtin.go | 20 +++++++------------- pkg/catalog/host.go | 6 +++++- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/pkg/catalog/builtin.go b/pkg/catalog/builtin.go index bd1014b..f359b1c 100644 --- a/pkg/catalog/builtin.go +++ b/pkg/catalog/builtin.go @@ -139,7 +139,7 @@ func (d *builtinDialer) DialHost(context.Context) (grpc.ClientConnInterface, err if d.conn != nil { return d.conn, nil } - server := newHostServer(d.log, d.pluginName) + server := newHostServer(d.log, d.pluginName, d.hostServices) conn, err := startPipeServer(server, d.log) if err != nil { return nil, err @@ -160,30 +160,24 @@ type pipeConn struct { io.Closer } -func startPipeServer(server *grpc.Server, log *slog.Logger) (*pipeConn, error) { +func startPipeServer(server *grpc.Server, log *slog.Logger) (_ *pipeConn, err error) { + var closers closerGroup + pipeNet := newPipeNet() + closers = append(closers, pipeNet) var wg sync.WaitGroup - - var closers closerGroup closers = append(closers, closerFunc(wg.Wait), closerFunc(func() { if !gracefulStopWithTimeout(server, time.Minute) { log.Warn("Forced timed-out plugin server to stop") } - }), closerFunc(func() { - err := pipeNet.Close() - if err != nil { - return - } })) - wg.Add(1) - go func() { - defer wg.Done() + wg.Go(func() { if err := server.Serve(pipeNet); err != nil && !errors.Is(err, grpc.ErrServerStopped) { log.Error("Pipe server unexpectedly failed to serve", "error", err) } - }() + }) // Dial the server conn, err := grpc.NewClient( diff --git a/pkg/catalog/host.go b/pkg/catalog/host.go index dcc7e04..44ae4ec 100644 --- a/pkg/catalog/host.go +++ b/pkg/catalog/host.go @@ -6,12 +6,13 @@ import ( "log/slog" "runtime/debug" + "github.com/openkcm/plugin-sdk/api" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) -func newHostServer(log *slog.Logger, pluginName string) *grpc.Server { +func newHostServer(log *slog.Logger, pluginName string, hostServices []api.ServiceServer) *grpc.Server { s := grpc.NewServer( grpc.ChainStreamInterceptor( streamPanicInterceptor(log), @@ -22,6 +23,9 @@ func newHostServer(log *slog.Logger, pluginName string) *grpc.Server { unaryPluginInterceptor(pluginName), ), ) + for _, hostService := range hostServices { + hostService.RegisterServer(s) + } return s } From 66d8abe526ed7cdb1e34dcb59e55af388caf8237 Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Mon, 24 Aug 2026 13:17:47 +0200 Subject: [PATCH 25/27] modify --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 0689450..58d0113 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/openkcm/plugin-sdk -go 1.25.4 +go 1.27 require ( buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1 From 83550c520f0e2a62e3edf41a979aabe84ca161bf Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Mon, 24 Aug 2026 13:19:06 +0200 Subject: [PATCH 26/27] modify --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 58d0113..0689450 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/openkcm/plugin-sdk -go 1.27 +go 1.25.4 require ( buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1 From 3e945e343f7f63aff2503de45b483facf387225e Mon Sep 17 00:00:00 2001 From: Nicolae Nicora Date: Mon, 24 Aug 2026 13:23:53 +0200 Subject: [PATCH 27/27] merge all changes from main --- .github/workflows/buf-ci.yaml | 2 +- .release-please-manifest.json | 2 +- CHANGELOG.md | 82 + Makefile | 108 +- README.md | 63 + Taskfile.yaml | 2 +- buf.gen.yaml | 43 - buf.lock | 6 - buf.yaml | 5 +- go.mod | 40 +- go.sum | 91 +- internal-buf.gen.yaml | 34 - internal/bootstrap/serve_test.go | 186 + internal/proto/service/init/v1/init.pb.go | 84 +- .../proto/service/init/v1/init.pb.validate.go | 434 -- internal/proto/service/init/v1/init.proto | 2 + .../proto/service/init/v1/init_grpc.pb.go | 51 +- pkg/plugin/keystore/errors/errors.go | 2 + .../v1/certificate_issuer.pb.go | 10 +- .../v1/certificate_issuer.pb.validate.go | 509 -- .../v1/certificate_issuer.proto | 2 + .../v1/certificate_issuer_ext_plugin.pb.go | 3 +- .../v1/certificate_issuer_grpc.pb.go | 5 +- .../v1/identity_management.pb.go | 254 +- .../v1/identity_management.pb.validate.go | 1408 ----- .../v1/identity_management.proto | 12 + .../v1/identity_management_ext_plugin.pb.go | 3 +- .../v1/identity_management_grpc.pb.go | 43 +- proto/plugin/keystore/common/v1/common.pb.go | 12 +- .../keystore/common/v1/common.pb.validate.go | 167 - proto/plugin/keystore/common/v1/common.proto | 2 + .../keystore/management/v1/management.pb.go | 564 +- .../management/v1/management.pb.validate.go | 531 -- .../keystore/management/v1/management.proto | 71 +- .../management/v1/management_ext_plugin.pb.go | 3 +- .../management/v1/management_grpc.pb.go | 89 +- .../keystore/operations/v1/operations.pb.go | 458 +- .../operations/v1/operations.pb.validate.go | 2853 ---------- .../keystore/operations/v1/operations.proto | 18 + .../operations/v1/operations_ext_plugin.pb.go | 3 +- .../operations/v1/operations_grpc.pb.go | 45 +- .../plugin/notification/v1/notification.pb.go | 10 +- .../v1/notification.pb.validate.go | 250 - .../plugin/notification/v1/notification.proto | 2 + .../v1/notification_ext_plugin.pb.go | 3 +- .../notification/v1/notification_grpc.pb.go | 5 +- .../v1/systeminformation.pb.go | 12 +- .../v1/systeminformation.pb.validate.go | 240 - .../v1/systeminformation.proto | 2 + .../v1/systeminformation_ext_plugin.pb.go | 3 +- .../v1/systeminformation_grpc.pb.go | 5 +- .../v1/systeminformation_test.go | 14 - proto/plugin/test/v1/test.pb.go | 10 +- proto/plugin/test/v1/test.pb.validate.go | 238 - proto/plugin/test/v1/test.proto | 2 + proto/plugin/test/v1/test_ext_plugin.pb.go | 3 +- proto/plugin/test/v1/test_grpc.pb.go | 5 +- proto/service/common/config/v1/config.pb.go | 10 +- .../common/config/v1/config.pb.validate.go | 244 - proto/service/common/config/v1/config.proto | 2 + .../common/config/v1/config_ext_service.pb.go | 3 +- .../common/config/v1/config_grpc.pb.go | 5 +- protofetch.lock | 7 + protofetch.toml | 8 + vendor-proto/buf/validate/validate.proto | 5057 +++++++++++++++++ 65 files changed, 6974 insertions(+), 7468 deletions(-) delete mode 100755 buf.gen.yaml delete mode 100644 buf.lock delete mode 100755 internal-buf.gen.yaml create mode 100644 internal/bootstrap/serve_test.go delete mode 100644 internal/proto/service/init/v1/init.pb.validate.go delete mode 100644 proto/plugin/certificate_issuer/v1/certificate_issuer.pb.validate.go delete mode 100644 proto/plugin/identity_management/v1/identity_management.pb.validate.go delete mode 100644 proto/plugin/keystore/common/v1/common.pb.validate.go delete mode 100644 proto/plugin/keystore/management/v1/management.pb.validate.go delete mode 100644 proto/plugin/keystore/operations/v1/operations.pb.validate.go delete mode 100644 proto/plugin/notification/v1/notification.pb.validate.go delete mode 100644 proto/plugin/systeminformation/v1/systeminformation.pb.validate.go delete mode 100644 proto/plugin/systeminformation/v1/systeminformation_test.go delete mode 100644 proto/plugin/test/v1/test.pb.validate.go delete mode 100644 proto/service/common/config/v1/config.pb.validate.go create mode 100644 protofetch.lock create mode 100644 protofetch.toml create mode 100644 vendor-proto/buf/validate/validate.proto diff --git a/.github/workflows/buf-ci.yaml b/.github/workflows/buf-ci.yaml index 400071e..11ad119 100644 --- a/.github/workflows/buf-ci.yaml +++ b/.github/workflows/buf-ci.yaml @@ -13,5 +13,5 @@ jobs: buf: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - uses: bufbuild/buf-action@v1 diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 7d9b009..f87262a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.10.0" + ".": "0.15.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 12882ca..63758e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,87 @@ # Changelog +## [0.15.0](https://github.com/openkcm/plugin-sdk/compare/v0.14.0...v0.15.0) (2026-08-18) + + +### Features + +* add get key versions to keystore proto ([#172](https://github.com/openkcm/plugin-sdk/issues/172)) ([7f45e03](https://github.com/openkcm/plugin-sdk/commit/7f45e031d5a62bbfdb6ac89a3da504f015a9f6ef)) + + +### Bug Fixes + +* **deps:** bump buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go from 1.36.11-20260415201107-50325440f8f2.1 to 1.36.11-20260709200747-435963d16310.1 ([#169](https://github.com/openkcm/plugin-sdk/issues/169)) ([315b18c](https://github.com/openkcm/plugin-sdk/commit/315b18c71cc1b303d44e32561256dae6ca6e6f84)) +* **deps:** bump github.com/google/cel-go from 0.28.0 to 0.29.0 ([#170](https://github.com/openkcm/plugin-sdk/issues/170)) ([9a6cdc2](https://github.com/openkcm/plugin-sdk/commit/9a6cdc2227b6dce6a85bf65fccd88517959514ca)) +* **deps:** bump golang.org/x/net from 0.53.0 to 0.55.0 ([#166](https://github.com/openkcm/plugin-sdk/issues/166)) ([32bb58e](https://github.com/openkcm/plugin-sdk/commit/32bb58e9980cc7d8b130e50b4b27ba5fe54d6232)) +* **deps:** bump google.golang.org/grpc from 1.82.0 to 1.82.1 in the gomod-group group ([#168](https://github.com/openkcm/plugin-sdk/issues/168)) ([78856d9](https://github.com/openkcm/plugin-sdk/commit/78856d9edf71b65d3cb54d0db53e0238e76d23c3)) +* **deps:** bump the gomod-group group across 1 directory with 2 updates ([#167](https://github.com/openkcm/plugin-sdk/issues/167)) ([ea06ed6](https://github.com/openkcm/plugin-sdk/commit/ea06ed64c60d8f9e2a9a515d4240cb60ff34d46a)) +* **deps:** bump the gomod-group group across 1 directory with 4 updates ([#173](https://github.com/openkcm/plugin-sdk/issues/173)) ([45e950e](https://github.com/openkcm/plugin-sdk/commit/45e950e0d93ee237733563d80bfb73c1b6c07f3e)) + +## [0.14.0](https://github.com/openkcm/plugin-sdk/compare/v0.13.0...v0.14.0) (2026-07-02) + + +### Features + +* update keystore role ([#163](https://github.com/openkcm/plugin-sdk/issues/163)) ([48b567f](https://github.com/openkcm/plugin-sdk/commit/48b567f2056129749e4fba32432adea5b40d651b)) + + +### Bug Fixes + +* **deps:** bump actions/checkout from 6 to 7 ([#161](https://github.com/openkcm/plugin-sdk/issues/161)) ([8df5e9c](https://github.com/openkcm/plugin-sdk/commit/8df5e9c9fa635d0eb1982a6bd8295eb87a36add8)) +* **deps:** bump golang.org/x/sys from 0.45.0 to 0.46.0 in the gomod-group group ([#160](https://github.com/openkcm/plugin-sdk/issues/160)) ([e182aa6](https://github.com/openkcm/plugin-sdk/commit/e182aa69a7e08d6e7570bd03595b798a5026014e)) + +## [0.13.0](https://github.com/openkcm/plugin-sdk/compare/v0.12.0...v0.13.0) (2026-06-09) + + +### Features + +* add grant/remove trust for keystore management plugin ([#157](https://github.com/openkcm/plugin-sdk/issues/157)) ([24dc562](https://github.com/openkcm/plugin-sdk/commit/24dc562a8d7dbed36112992ad5d367a7a91e1ff2)) + + +### Bug Fixes + +* **deps:** bump the gomod-group group across 1 directory with 2 updates ([#156](https://github.com/openkcm/plugin-sdk/issues/156)) ([dc441bb](https://github.com/openkcm/plugin-sdk/commit/dc441bba13b1debdaf518c67c05cb32be6fffae1)) + +## [0.12.0](https://github.com/openkcm/plugin-sdk/compare/v0.11.1...v0.12.0) (2026-05-22) + + +### Features + +* generic key error ([#154](https://github.com/openkcm/plugin-sdk/issues/154)) ([63acb38](https://github.com/openkcm/plugin-sdk/commit/63acb3819240ea0c132ade82f670fd32fb70c8cf)) + + +### Bug Fixes + +* **deps:** bump the gomod-group group across 1 directory with 3 updates ([#152](https://github.com/openkcm/plugin-sdk/issues/152)) ([acdcf18](https://github.com/openkcm/plugin-sdk/commit/acdcf189790ef2f895f05f27f312c6f035e6a6e0)) + +## [0.11.1](https://github.com/openkcm/plugin-sdk/compare/v0.11.0...v0.11.1) (2026-05-14) + + +### Bug Fixes + +* **deps:** bump the gomod-group group across 1 directory with 2 updates ([#146](https://github.com/openkcm/plugin-sdk/issues/146)) ([db2696d](https://github.com/openkcm/plugin-sdk/commit/db2696db14dd763a999e3ef7c652ccbcebc88219)) + +## [0.11.0](https://github.com/openkcm/plugin-sdk/compare/v0.10.2...v0.11.0) (2026-04-15) + + +### Features + +* get user details on identity manager ([#144](https://github.com/openkcm/plugin-sdk/issues/144)) ([60a8a80](https://github.com/openkcm/plugin-sdk/commit/60a8a8097cf61645c782b9c77ba520f0b5db77c3)) + +## [0.10.2](https://github.com/openkcm/plugin-sdk/compare/v0.10.1...v0.10.2) (2026-03-24) + + +### Bug Fixes + +* revert managed keys ([#142](https://github.com/openkcm/plugin-sdk/issues/142)) ([5052979](https://github.com/openkcm/plugin-sdk/commit/5052979fa14ecfb4baaf2e499801ee9c98bb14ce)) + +## [0.10.1](https://github.com/openkcm/plugin-sdk/compare/v0.10.0...v0.10.1) (2026-03-18) + + +### Bug Fixes + +* **deps:** bump the gomod-group group with 2 updates ([#134](https://github.com/openkcm/plugin-sdk/issues/134)) ([d2a4eb9](https://github.com/openkcm/plugin-sdk/commit/d2a4eb9329ecf59d73df6414596be6ecf3027f00)) + ## [0.10.0](https://github.com/openkcm/plugin-sdk/compare/v0.9.9...v0.10.0) (2026-03-12) diff --git a/Makefile b/Makefile index e58ff57..7f82b3f 100644 --- a/Makefile +++ b/Makefile @@ -1,35 +1,107 @@ .PHONY: generate +generate: fetch-protos format-proto go-gen internal-go-gen -generate: patch-swagger-doc format - go mod tidy - go mod vendor +.PHONY: clean-proto +clean-proto: + @find ./proto -type f -name '*.go' -exec rm {} + -patch-swagger-doc: buf-gen internal-buf-gen - #./scripts/update_swagger.sh docs/openapiv2/apidocs.swagger.json +.PHONY: clean-proto-internal +clean-proto-internal: + @find ./internal/proto -type f -name '*.go' -exec rm {} + -init-git-hooks: - git config --local core.hooksPath .githooks/ +.PHONY: fetch-protos +fetch-protos: + @protofetch -o vendor-proto fetch -buf-gen: init-git-hooks - buf dep update - ./buf.gen.yaml - find . -name \*.go -not -path '.git/*' -exec goimports -local github.com/openkcm/plugin-sdk -w {} \; +.PHONY: go-gen +go-gen: clean-proto + @find ./proto -type f -iname '*.proto' -exec \ + protoc -I./proto -I./vendor-proto \ + --go_out=./proto \ + --go_opt=paths=import \ + --go_opt=module=github.com/openkcm/plugin-sdk/proto \ + --go-grpc_out=./proto \ + --go-grpc_opt=paths=import \ + --go-grpc_opt=module=github.com/openkcm/plugin-sdk/proto \ + --go-extension_out=./proto \ + --go-extension_opt=module=github.com/openkcm/plugin-sdk/proto \ + --go-extension_opt=submodule=github.com/openkcm/plugin-sdk/proto/service/common \ + --go-extension_opt=kind=service \ + --grpc-gateway_out=./proto \ + --grpc-gateway_opt=paths=import \ + --grpc-gateway_opt=module=github.com/openkcm/plugin-sdk/proto \ + --grpc-gateway_opt=logtostderr=true \ + {} + -internal-buf-gen: - buf dep update - ./internal-buf.gen.yaml + @find ./proto -type f -iname '*.proto' -exec \ + protoc -I./proto -I./vendor-proto \ + --go-extension_out=./proto \ + --go-extension_opt=module=github.com/openkcm/plugin-sdk/proto \ + --go-extension_opt=submodule=github.com/openkcm/plugin-sdk/proto/plugin \ + --go-extension_opt=kind=plugin \ + {} + -format: buf-gen - buf format -w +.PHONY: internal-go-gen +internal-go-gen: clean-proto-internal + @find ./internal/proto -type f -iname '*.proto' -exec \ + protoc -I./internal/proto -I./proto -I./vendor-proto \ + --go_out=./internal/proto \ + --go_opt=paths=import \ + --go_opt=module=github.com/openkcm/plugin-sdk/internal/proto \ + --go-grpc_out=./internal/proto \ + --go-grpc_opt=paths=import \ + --go-grpc_opt=module=github.com/openkcm/plugin-sdk/internal/proto \ + --go-extension_out=./internal/proto \ + --go-extension_opt=module=github.com/openkcm/plugin-sdk/internal/proto \ + --go-extension_opt=submodule=github.com/openkcm/plugin-sdk/internal/proto/service \ + --go-extension_opt=kind=service \ + --grpc-gateway_out=./internal/proto \ + --grpc-gateway_opt=paths=import \ + --grpc-gateway_opt=module=github.com/openkcm/plugin-sdk/internal/proto \ + --grpc-gateway_opt=logtostderr=true \ + {} + +.PHONY: format-proto +format-proto: + @buf format -w + +.PHONY: format +format: format-proto + +.PHONY: validate-proto +validate-proto: format-proto lint-proto breaking + +.PHONY: lint-proto +lint-proto: + @buf lint + +.PHONY: breaking +breaking: + @buf breaking --against https://github.com/openkcm/plugin-sdk.git#branch=main + +.PHONY: install-proto-tools +install-proto-tools: + brew install protobuf + go install \ + google.golang.org/protobuf/cmd/protoc-gen-go@latest \ + google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest \ + github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest \ + github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest \ + ./cmd/protoc-gen-go-extension + brew install bufbuild/buf/buf + npm install -g @coralogix/protofetch + +.PHONY: lint-install lint-install: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest -lint: +.PHONY: lint +lint: lint-proto golangci-lint run -v --fix +.PHONY: goimports goimports: - find . -name \*.go -not -path '.git/*' -exec goimports -local github.com/openkcm/plugin-sdk -w {} \; + find ./ -name \*.go -not -path '.git/*' -exec goimports -local github.com/openkcm/plugin-sdk -w {} + .PHONY: test test: diff --git a/README.md b/README.md index 5331fd7..c042882 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,67 @@ External plugins are separate processes and use KMS communicates with plugins over gRPC. As such, the various interfaces are defined via gRPC service definitions. +## Pre-requisites + +Several tools are required to generate the code: + +1. **`protoc compiler`**: see the instruction on the official [web site](https://protobuf.dev/installation) or install using homebrew `brew install protobuf`. +2. **`protoc-gen-go`**: install via `go install google.golang.org/protobuf/cmd/protoc-gen-go@latest`. +3. **`protoc-gen-go-grpc`**: install via `go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest`. +4. **`protoc-gen-grpc-gateway`**: install via `go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway`. +5. **`protoc-gen-openapiv2`**: install via `go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2`. +6. **`protofetch`**: download from the [releases page](https://github.com/coralogix/protofetch/releases/latest) of [the GitHub repository](https://github.com/coralogix/protofetch) or install via `cargo install protofetch` or `npm install -g @coralogix/protofetch`, or using any similar tool compatible with the npm registry. + +## Optional tools + +Optionally, the [`buf` CLI](https://github.com/bufbuild/buf) tool can be used to validate, detect breaking changes, and format `.proto` files: + +- **`buf breaking --against https://github.com/openkcm/api-sdk.git#branch=main`**: detect breaking changes against the main branch of the remote repository. +- **`buf format -w`**: format `.proto` files. +- **`buf lint`**: lint `.proto` files. + +## Makefile + +There are several `make` targets defined in the `Makefile`: + +- **`fetch-protos`**: download `.proto` dependencies using `protofetch`. +- **`generate`**: fetches `.proto` dependencies, formats `.proto` files, and generates Go code. +- **`install-proto-tools`**: installs the tools (including optional) from the following sources: Homebrew, Go registry (via `go install`), NPM registry (via `npm install -g`). See the target definition for the details. +- **`validate-proto`**: formats and lints `.proto` files, detects breaking changes. + +For the rest `make` targets see `Makefile`. + +## Dependencies + +`.proto` dependencies are managed with the [`protofetch`](https://github.com/coralogix/protofetch) tool. This tool downloads `.proto` files from a specified location of a git repository and places them into the `vendor-proto` directory. The dependencies are specified in the `protofetch.toml` file. + +For instance, a dependency on the [`protovalidate`](https://github.com/bufbuild/protovalidate) proto definitions can be specified as follow: + +``` toml +name = "github.com/openkcm/plugin-sdk" +description = "Plugins SDK of the OpenKCM project" + +[protovalidate] +url = "github.com/bufbuild/protovalidate" +revision = "v1.1.1" +content_roots = ["/proto/protovalidate"] +allow_policies = ["buf/validate/*"] +``` + +In order to fetch dependencies, execute: + +``` sh +$ protofetch -o vendor-proto fetch +``` + +## Generate Go code from the .proto definitions + +The code can be generated with executing the following Make target + +```sh +$ make generate +``` + ## Support, Feedback, Contributing This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/openkcm/plugin-sdk/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md). @@ -27,3 +88,5 @@ We as members, contributors, and leaders pledge to make participation in our com ## Licensing Copyright 2025 SAP SE or an SAP affiliate company and OpenKCM contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/openkcm/plugin-sdk). + +

Bundesministerium für Wirtschaft und Klimaschutz (BMWK)-EU funding logo

diff --git a/Taskfile.yaml b/Taskfile.yaml index ec102e2..d2e1149 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -5,5 +5,5 @@ includes: taskfile: hack/common/Taskfile_library.yaml flatten: true vars: - CODE_DIRS: '{{.ROOT_DIR}}/pkg/... {{.ROOT_DIR}}/proto/... {{.ROOT_DIR}}/internal/bootstrap/... {{.ROOT_DIR}}/internal/consts/... {{.ROOT_DIR}}/internal/slog2hclog/... {{.ROOT_DIR}}/api/...' + CODE_DIRS: '{{.ROOT_DIR}}/pkg/... {{.ROOT_DIR}}/internal/bootstrap/... {{.ROOT_DIR}}/internal/consts/... {{.ROOT_DIR}}/internal/slog2hclog/... {{.ROOT_DIR}}/api/...' GENERATE_DOCS_INDEX: "false" diff --git a/buf.gen.yaml b/buf.gen.yaml deleted file mode 100755 index 3fef379..0000000 --- a/buf.gen.yaml +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env -S buf generate --template ---- -version: v2 -managed: - enabled: true - disable: - - file_option: go_package - module: buf.build/bufbuild/protovalidate - override: - - file_option: go_package_prefix - value: github.com/openkcm/plugin-sdk/proto -plugins: - - local: [ "go", "run", "github.com/openkcm/plugin-sdk/cmd/protoc-gen-go-extension" ] - out: proto - opt: - - module=github.com/openkcm/plugin-sdk/proto - - submodule=github.com/openkcm/plugin-sdk/proto/service/common - - kind=service - - local: [ "go", "run", "github.com/openkcm/plugin-sdk/cmd/protoc-gen-go-extension" ] - out: proto - opt: - - module=github.com/openkcm/plugin-sdk/proto - - submodule=github.com/openkcm/plugin-sdk/proto/plugin - - kind=plugin - - remote: buf.build/protocolbuffers/go:v1.36.11 - out: proto - opt: - - paths=source_relative - - remote: buf.build/grpc/go:v1.6.1 - out: proto - opt: - - paths=source_relative - - remote: buf.build/bufbuild/validate-go:v1.3.0 - out: proto - opt: - - paths=source_relative - - remote: buf.build/grpc-ecosystem/gateway:v2.27.7 - out: proto - opt: - - paths=source_relative - - logtostderr=true -inputs: - - directory: proto diff --git a/buf.lock b/buf.lock deleted file mode 100644 index 709ae02..0000000 --- a/buf.lock +++ /dev/null @@ -1,6 +0,0 @@ -# Generated by buf. DO NOT EDIT. -version: v2 -deps: - - name: buf.build/bufbuild/protovalidate - commit: 50325440f8f24053b047484a6bf60b76 - digest: b5:74cb6f5c0853c3c10aafc701614194bbd63326bdb8ef4068214454b8894b03ba4113e04b3a33a8321cdf05336e37db4dc14a5e2495db8462566914f36086ba31 diff --git a/buf.yaml b/buf.yaml index 5cb8d78..4ee27ef 100644 --- a/buf.yaml +++ b/buf.yaml @@ -1,14 +1,15 @@ version: v2 -deps: - - buf.build/bufbuild/protovalidate modules: - path: proto - path: internal/proto + - path: vendor-proto lint: use: - STANDARD except: - SERVICE_SUFFIX + ignore: + - vendor-proto breaking: use: - FILE diff --git a/go.mod b/go.mod index 0689450..17b6a45 100644 --- a/go.mod +++ b/go.mod @@ -2,34 +2,46 @@ module github.com/openkcm/plugin-sdk go 1.25.4 +tool ( + github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway + github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 + github.com/openkcm/plugin-sdk/cmd/protoc-gen-go-extension + google.golang.org/grpc/cmd/protoc-gen-go-grpc + google.golang.org/protobuf/cmd/protoc-gen-go +) + require ( - buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1 - buf.build/go/protovalidate v1.2.0 + buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.12-20260709200747-435963d16310.1 + buf.build/go/protovalidate v1.3.0 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-plugin v1.8.0 github.com/stretchr/testify v1.11.1 github.com/zeebo/errs/v2 v2.0.5 golang.org/x/sys v0.47.0 - google.golang.org/genproto/googleapis/rpc v0.0.0-20260724162435-b2f20204f0df - google.golang.org/grpc v1.82.1 - google.golang.org/protobuf v1.36.11 + google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa + google.golang.org/grpc v1.83.0 + google.golang.org/protobuf v1.36.12 ) require ( - cel.dev/expr v0.25.1 // indirect + cel.dev/expr v0.25.2 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/fatih/color v1.18.0 // indirect + github.com/fatih/color v1.19.0 // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/cel-go v0.28.0 // indirect + github.com/google/cel-go v0.30.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect github.com/hashicorp/yamux v0.1.2 // indirect github.com/mattn/go-colorable v0.1.14 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/oklog/run v1.1.0 // indirect + github.com/mattn/go-isatty v0.0.21 // indirect + github.com/oklog/run v1.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 // indirect - golang.org/x/net v0.53.0 // indirect - golang.org/x/text v0.36.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 // indirect + github.com/rogpeppe/go-internal v1.14.1 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f // indirect + golang.org/x/net v0.55.0 // indirect + golang.org/x/text v0.37.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 4368900..999914c 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,9 @@ -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1 h1:fXh8CsdNpjRr8R5vFdqtIxPt/Lno2IIJlYOdZBIZn0w= -buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20260709200747-435963d16310.1/go.mod h1:tvtbpgaVXZX4g6Pn+AnzFycuRK3MOz5HJfEGeEllXYM= -buf.build/go/protovalidate v1.2.0 h1:DQVrUWkmGTBij+kOYv/x2LLxwcLaGKMdzShj1/6/3H0= -buf.build/go/protovalidate v1.2.0/go.mod h1:7rYiQEhqvAipoazpVNBBH2S2f8bjG4huMVy1V2Yofn4= -cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= -cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.12-20260709200747-435963d16310.1 h1:6nlcxMOui23ZRVAfJM451duu79P1npA5JRdZqMilrrQ= +buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.12-20260709200747-435963d16310.1/go.mod h1:TCt1lluMFnctISJXvkIQ4x3ABrPuUKCWKyjKdkJNBpw= +buf.build/go/protovalidate v1.3.0 h1:8ITcnZGkAHx6TyhZvro+iET/AyqU8gEWQJK2WsT62ms= +buf.build/go/protovalidate v1.3.0/go.mod h1:82s5g+rFRj1CZPiLv6OTA31jBu2fpq7mLXHwa9mZfEs= +cel.dev/expr v0.25.2 h1:K6j46C81hXtZQfuX60cVWQFBJahKSE2gfRbNuvr5bFs= +cel.dev/expr v0.25.2/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/brianvoe/gofakeit/v6 v6.28.0 h1:Xib46XXuQfmlLS2EXRuJpqcw8St6qSZz75OUo0tgAW4= @@ -16,20 +16,22 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= -github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= +github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= +github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/cel-go v0.28.0 h1:KjSWstCpz/MN5t4a8gnGJNIYUsJRpdi/r97xWDphIQc= -github.com/google/cel-go v0.28.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= +github.com/google/cel-go v0.30.0 h1:ll54AkzKunWkBn9wSoiUXbFZXYZTkdJGNXTBXUoolGo= +github.com/google/cel-go v0.30.0/go.mod h1:X0bD6iVNR8pkROSOoHVdgTkzmRcosof7WQqCD6wcMc8= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 h1:HWRh5R2+9EifMyIHV7ZV+MIZqgz+PMpZ14Jynv3O2Zs= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0/go.mod h1:JfhWUomR1baixubs02l85lZYYOm7LV6om4ceouMv45c= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/FORs= @@ -38,8 +40,8 @@ github.com/hashicorp/yamux v0.1.2 h1:XtB8kyFOyHXYVFnwT5C3+Bdo8gArse7j2AQ0DA0Uey8 github.com/hashicorp/yamux v0.1.2/go.mod h1:C+zze2n6e/7wshOZep2A70/aQU6QBRWJO/G6FT1wIns= github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -48,14 +50,16 @@ github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHP github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= -github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= +github.com/mattn/go-isatty v0.0.21 h1:xYae+lCNBP7QuW4PUnNG61ffM4hVIfm+zUzDuSzYLGs= +github.com/mattn/go-isatty v0.0.21/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= +github.com/oklog/run v1.2.0 h1:O8x3yXwah4A73hJdlrwo/2X6J62gE5qTMusH0dvz60E= +github.com/oklog/run v1.2.0/go.mod h1:mgDbKRSwPhJfesJ4PntqFUbKQRZ50NgmZTSPlFA0YFk= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rodaine/protogofakeit v0.1.1 h1:ZKouljuRM3A+TArppfBqnH8tGZHOwM/pjvtXe9DaXH8= github.com/rodaine/protogofakeit v0.1.1/go.mod h1:pXn/AstBYMaSfc1/RqH3N82pBuxtWgejz1AlYpY1mI0= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= @@ -66,44 +70,45 @@ github.com/zeebo/errs/v2 v2.0.5 h1:edtyFoQq9OBBsNPcu0b0wHtRvA8haukAHrGyOfWQGNI= github.com/zeebo/errs/v2 v2.0.5/go.mod h1:OKmvVZt4UqpyJrYFykDKm168ZquJ55pbbIVUICNmLN0= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= -go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= -go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= -go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= -go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg= -go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg= -go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw= -go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A= -go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= -go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= +go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc= +go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc= +go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo= +go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58= +go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0= +go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI= +go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA= +go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk= +go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= -golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 h1:SbTAbRFnd5kjQXbczszQ0hdk3ctwYf3qBNH9jIsGclE= -golang.org/x/exp v0.0.0-20250813145105-42675adae3e6/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4= -golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= -golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= +golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM= +golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80= +golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= +golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= -google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478 h1:yQugLulqltosq0B/f8l4w9VryjV+N/5gcW0jQ3N8Qec= -google.golang.org/genproto/googleapis/api v0.0.0-20260414002931-afd174a4e478/go.mod h1:C6ADNqOxbgdUUeRTU+LCHDPB9ttAMCTff6auwCVa4uc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260724162435-b2f20204f0df h1:O3ig1i5WDDzsVzRp+cCdgelT9vXnlnOFdlEeFtL4HCc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260724162435-b2f20204f0df/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE= -google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA= -google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= -google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa h1:Kjn0N0tCrDgiAFW+lGO4JZ3ck44CehvJQMAwj9QF0G8= +google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:q4lMZS6kskjT5HvCPrnnypcDPVJqT/f4nfxmkE7gryY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= +google.golang.org/grpc v1.83.0 h1:JeNZEKJFbQxArAMl+hiytHauacDNqJUllNfmIMmpqnQ= +google.golang.org/grpc v1.83.0/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.1 h1:/WILD1UcXj/ujCxgoL/DvRgt2CP3txG8+FwkUbb9110= +google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.1/go.mod h1:YNKnb2OAApgYn2oYY47Rn7alMr1zWjb2U8Q0aoGWiNc= +google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= +google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal-buf.gen.yaml b/internal-buf.gen.yaml deleted file mode 100755 index 108fed9..0000000 --- a/internal-buf.gen.yaml +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env -S buf generate --template ---- -version: v2 -managed: - enabled: true - override: - - file_option: go_package_prefix - value: github.com/openkcm/plugin-sdk/internal/proto -plugins: - - local: [ "go", "run", "github.com/openkcm/plugin-sdk/cmd/protoc-gen-go-extension" ] - out: internal/proto - opt: - - module=github.com/openkcm/plugin-sdk/internal/proto - - submodule=github.com/openkcm/plugin-sdk/internal/proto/service - - kind=service - - remote: buf.build/protocolbuffers/go:v1.35.2 - out: internal/proto - opt: - - paths=source_relative - - remote: buf.build/grpc/go:v1.3.0 - out: internal/proto - opt: - - paths=source_relative - - remote: buf.build/bufbuild/validate-go:v1.1.0 - out: internal/proto - opt: - - paths=source_relative - - remote: buf.build/grpc-ecosystem/gateway:v2.23.0 - out: internal/proto - opt: - - paths=source_relative - - logtostderr=true -inputs: - - directory: internal/proto diff --git a/internal/bootstrap/serve_test.go b/internal/bootstrap/serve_test.go new file mode 100644 index 0000000..d5838b7 --- /dev/null +++ b/internal/bootstrap/serve_test.go @@ -0,0 +1,186 @@ +package bootstrap + +import ( + "context" + "errors" + "testing" + + "buf.build/go/protovalidate" + "github.com/hashicorp/go-hclog" + "github.com/stretchr/testify/assert" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + + goplugin "github.com/hashicorp/go-plugin" + + pluginerrors "github.com/openkcm/plugin-sdk/api/plugin-errors" + pluginoption "github.com/openkcm/plugin-sdk/api/plugin-option" + initv1 "github.com/openkcm/plugin-sdk/internal/proto/service/init/v1" +) + +type mockValidator struct { + err error +} + +func (v *mockValidator) Validate(_ proto.Message, _ ...protovalidate.ValidationOption) error { + return v.err +} + +func cancelledTestConfig() *goplugin.ServeTestConfig { + // Create a context that is already cancelled to prevent the server from actually starting during tests. + ctx, cancel := context.WithCancel(context.Background()) + cancel() + return &goplugin.ServeTestConfig{Context: ctx} +} + +func TestServe_NoPluginServer(t *testing.T) { + err := Serve() + assert.ErrorIs(t, err, pluginerrors.ErrServerRequired) +} + +func TestServe_WithValidationEnabled(t *testing.T) { + mock := &pluginMock{typ: "test"} + + err := Serve( + pluginoption.WithPluginServer(mock), + pluginoption.EnableInputValidation(), + pluginoption.WithTestConfig(cancelledTestConfig()), + ) + assert.NoError(t, err) + + err = Serve( + pluginoption.WithPluginServer(mock), + pluginoption.EnableOutputValidation(), + pluginoption.WithTestConfig(cancelledTestConfig()), + ) + assert.NoError(t, err) +} + +func TestServe_WithValidationAndExistingServerOptions(t *testing.T) { + mock := &pluginMock{typ: "test"} + err := Serve( + pluginoption.WithPluginServer(mock), + pluginoption.SetServerOption(grpc.MaxRecvMsgSize(1024)), + pluginoption.EnableInputValidation(), + pluginoption.WithTestConfig(cancelledTestConfig()), + ) + assert.NoError(t, err) +} + +func TestHCServer_GRPCServer(t *testing.T) { + mock := &pluginMock{typ: "test"} + p := newHCPlugin(hclog.Default(), mock, nil) + srv := grpc.NewServer() + defer srv.Stop() + + err := p.GRPCServer(nil, srv) + assert.NoError(t, err) +} + +func TestCustomGRPCServer(t *testing.T) { + factory := customGRPCServer([]grpc.ServerOption{}) + srv := factory([]grpc.ServerOption{}) + assert.NotNil(t, srv) + srv.Stop() +} + +func TestNewHCPlugin(t *testing.T) { + mock := &pluginMock{typ: "test"} + p := newHCPlugin(hclog.Default(), mock, nil) + assert.NotNil(t, p) + assert.Len(t, p.servers, 1) +} + +func TestHCServer_GRPCClient(t *testing.T) { + p := &hcServer{} + result, err := p.GRPCClient(context.Background(), nil, nil) + assert.Nil(t, result) + assert.Error(t, err) +} + +func TestHCDialer_DialHost_CachedConn(t *testing.T) { + mock := &mockClientConn{} + d := &hcDialer{conn: mock} + + conn, err := d.DialHost(context.Background()) + assert.NoError(t, err) + assert.Equal(t, mock, conn) +} + +type mockClientConn struct { + grpc.ClientConnInterface +} + +func TestValidationUnaryInterceptor_SkipsNonProtoRequest(t *testing.T) { + v := &mockValidator{err: errors.New("should not be called")} + interceptor := ValidationUnaryInterceptor(v, true, false) + + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return "ok", nil + } + + // Non-proto value: validation is skipped, handler is called. + resp, err := interceptor(context.Background(), "not-a-proto", nil, handler) + assert.NoError(t, err) + assert.Equal(t, "ok", resp) +} + +func TestValidationUnaryInterceptor_HandlerError(t *testing.T) { + v := &mockValidator{} + interceptor := ValidationUnaryInterceptor(v, false, false) + + handlerErr := errors.New("handler failed") + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return nil, handlerErr + } + + _, err := interceptor(context.Background(), "req", nil, handler) + assert.ErrorIs(t, err, handlerErr) +} + +func TestValidationUnaryInterceptor_NoValidation(t *testing.T) { + v := &mockValidator{} + interceptor := ValidationUnaryInterceptor(v, false, false) + + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return "response", nil + } + + resp, err := interceptor(context.Background(), "req", nil, handler) + assert.NoError(t, err) + assert.Equal(t, "response", resp) +} + +func TestValidationUnaryInterceptor_RequestValidationFails(t *testing.T) { + v := &mockValidator{err: errors.New("bad request")} + interceptor := ValidationUnaryInterceptor(v, true, false) + + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return "ok", nil + } + + _, err := interceptor(context.Background(), &initv1.InitRequest{}, nil, handler) + assert.Error(t, err) + + st, ok := status.FromError(err) + assert.True(t, ok, "expected gRPC status error") + assert.Equal(t, codes.InvalidArgument, st.Code()) +} + +func TestValidationUnaryInterceptor_ResponseValidationFails(t *testing.T) { + v := &mockValidator{err: errors.New("bad response")} + interceptor := ValidationUnaryInterceptor(v, false, true) + + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return &initv1.InitRequest{}, nil + } + + _, err := interceptor(context.Background(), "req", nil, handler) + assert.Error(t, err) + + st, ok := status.FromError(err) + assert.True(t, ok, "expected gRPC status error") + assert.Equal(t, codes.Internal, st.Code()) +} diff --git a/internal/proto/service/init/v1/init.pb.go b/internal/proto/service/init/v1/init.pb.go index a0fe002..170c733 100644 --- a/internal/proto/service/init/v1/init.pb.go +++ b/internal/proto/service/init/v1/init.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.35.2 -// protoc (unknown) +// protoc-gen-go v1.36.11 +// protoc v7.35.1 // source: service/init/v1/init.proto package initv1 @@ -11,6 +11,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -22,13 +23,12 @@ const ( // Init request parameters type InitRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // List of all the names of gRPC services implemented by the host. // These names are the fully qualified gRPC service name. HostServiceNames []string `protobuf:"bytes,1,rep,name=host_service_names,json=hostServiceNames,proto3" json:"host_service_names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *InitRequest) Reset() { @@ -70,13 +70,12 @@ func (x *InitRequest) GetHostServiceNames() []string { // Init response parameters type InitResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` // List of all the names of gRPC services implemented by the service. These // names are the fully qualified gRPC service name. PluginServiceNames []string `protobuf:"bytes,1,rep,name=plugin_service_names,json=pluginServiceNames,proto3" json:"plugin_service_names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *InitResponse) Reset() { @@ -118,9 +117,9 @@ func (x *InitResponse) GetPluginServiceNames() []string { // Deinit request parameters type DeinitRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeinitRequest) Reset() { @@ -155,9 +154,9 @@ func (*DeinitRequest) Descriptor() ([]byte, []int) { // Deinit response parameters type DeinitResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *DeinitResponse) Reset() { @@ -192,53 +191,27 @@ func (*DeinitResponse) Descriptor() ([]byte, []int) { var File_service_init_v1_init_proto protoreflect.FileDescriptor -var file_service_init_v1_init_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x2f, 0x76, - 0x31, 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x22, 0x3b, 0x0a, - 0x0b, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x12, - 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x68, 0x6f, 0x73, 0x74, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x40, 0x0a, 0x0c, 0x49, 0x6e, - 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x0f, 0x0a, 0x0d, - 0x44, 0x65, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x10, 0x0a, - 0x0e, 0x44, 0x65, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, - 0x9b, 0x01, 0x0a, 0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x12, 0x43, 0x0a, - 0x04, 0x49, 0x6e, 0x69, 0x74, 0x12, 0x1c, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, - 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x69, 0x6e, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x44, 0x65, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x1e, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, - 0x65, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x73, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x69, 0x6e, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, - 0x65, 0x69, 0x6e, 0x69, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xc3, 0x01, - 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x69, 0x6e, - 0x69, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x09, 0x49, 0x6e, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, - 0x70, 0x65, 0x6e, 0x6b, 0x63, 0x6d, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2d, 0x73, 0x64, - 0x6b, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2f, 0x69, 0x6e, 0x69, 0x74, 0x2f, 0x76, 0x31, - 0x3b, 0x69, 0x6e, 0x69, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x49, 0x58, 0xaa, 0x02, 0x0f, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x49, 0x6e, 0x69, 0x74, 0x2e, 0x56, 0x31, 0xca, - 0x02, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x49, 0x6e, 0x69, 0x74, 0x5c, 0x56, - 0x31, 0xe2, 0x02, 0x1b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5c, 0x49, 0x6e, 0x69, 0x74, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x11, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x3a, 0x49, 0x6e, 0x69, 0x74, 0x3a, - 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +const file_service_init_v1_init_proto_rawDesc = "" + + "\n" + + "\x1aservice/init/v1/init.proto\x12\x0fservice.init.v1\";\n" + + "\vInitRequest\x12,\n" + + "\x12host_service_names\x18\x01 \x03(\tR\x10hostServiceNames\"@\n" + + "\fInitResponse\x120\n" + + "\x14plugin_service_names\x18\x01 \x03(\tR\x12pluginServiceNames\"\x0f\n" + + "\rDeinitRequest\"\x10\n" + + "\x0eDeinitResponse2\x9b\x01\n" + + "\tBootstrap\x12C\n" + + "\x04Init\x12\x1c.service.init.v1.InitRequest\x1a\x1d.service.init.v1.InitResponse\x12I\n" + + "\x06Deinit\x12\x1e.service.init.v1.DeinitRequest\x1a\x1f.service.init.v1.DeinitResponseBEZCgithub.com/openkcm/plugin-sdk/internal/proto/service/init/v1;initv1b\x06proto3" var ( file_service_init_v1_init_proto_rawDescOnce sync.Once - file_service_init_v1_init_proto_rawDescData = file_service_init_v1_init_proto_rawDesc + file_service_init_v1_init_proto_rawDescData []byte ) func file_service_init_v1_init_proto_rawDescGZIP() []byte { file_service_init_v1_init_proto_rawDescOnce.Do(func() { - file_service_init_v1_init_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_init_v1_init_proto_rawDescData) + file_service_init_v1_init_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_service_init_v1_init_proto_rawDesc), len(file_service_init_v1_init_proto_rawDesc))) }) return file_service_init_v1_init_proto_rawDescData } @@ -271,7 +244,7 @@ func file_service_init_v1_init_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_service_init_v1_init_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_service_init_v1_init_proto_rawDesc), len(file_service_init_v1_init_proto_rawDesc)), NumEnums: 0, NumMessages: 4, NumExtensions: 0, @@ -282,7 +255,6 @@ func file_service_init_v1_init_proto_init() { MessageInfos: file_service_init_v1_init_proto_msgTypes, }.Build() File_service_init_v1_init_proto = out.File - file_service_init_v1_init_proto_rawDesc = nil file_service_init_v1_init_proto_goTypes = nil file_service_init_v1_init_proto_depIdxs = nil } diff --git a/internal/proto/service/init/v1/init.pb.validate.go b/internal/proto/service/init/v1/init.pb.validate.go deleted file mode 100644 index c748e43..0000000 --- a/internal/proto/service/init/v1/init.pb.validate.go +++ /dev/null @@ -1,434 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: service/init/v1/init.proto - -package initv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on InitRequest with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *InitRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on InitRequest with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in InitRequestMultiError, or -// nil if none found. -func (m *InitRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *InitRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return InitRequestMultiError(errors) - } - - return nil -} - -// InitRequestMultiError is an error wrapping multiple validation errors -// returned by InitRequest.ValidateAll() if the designated constraints aren't met. -type InitRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m InitRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m InitRequestMultiError) AllErrors() []error { return m } - -// InitRequestValidationError is the validation error returned by -// InitRequest.Validate if the designated constraints aren't met. -type InitRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e InitRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e InitRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e InitRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e InitRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e InitRequestValidationError) ErrorName() string { return "InitRequestValidationError" } - -// Error satisfies the builtin error interface -func (e InitRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInitRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = InitRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = InitRequestValidationError{} - -// Validate checks the field values on InitResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *InitResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on InitResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in InitResponseMultiError, or -// nil if none found. -func (m *InitResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *InitResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return InitResponseMultiError(errors) - } - - return nil -} - -// InitResponseMultiError is an error wrapping multiple validation errors -// returned by InitResponse.ValidateAll() if the designated constraints aren't met. -type InitResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m InitResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m InitResponseMultiError) AllErrors() []error { return m } - -// InitResponseValidationError is the validation error returned by -// InitResponse.Validate if the designated constraints aren't met. -type InitResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e InitResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e InitResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e InitResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e InitResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e InitResponseValidationError) ErrorName() string { return "InitResponseValidationError" } - -// Error satisfies the builtin error interface -func (e InitResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sInitResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = InitResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = InitResponseValidationError{} - -// Validate checks the field values on DeinitRequest with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *DeinitRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeinitRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in DeinitRequestMultiError, or -// nil if none found. -func (m *DeinitRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DeinitRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return DeinitRequestMultiError(errors) - } - - return nil -} - -// DeinitRequestMultiError is an error wrapping multiple validation errors -// returned by DeinitRequest.ValidateAll() if the designated constraints -// aren't met. -type DeinitRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeinitRequestMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeinitRequestMultiError) AllErrors() []error { return m } - -// DeinitRequestValidationError is the validation error returned by -// DeinitRequest.Validate if the designated constraints aren't met. -type DeinitRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeinitRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeinitRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeinitRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeinitRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeinitRequestValidationError) ErrorName() string { return "DeinitRequestValidationError" } - -// Error satisfies the builtin error interface -func (e DeinitRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeinitRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeinitRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeinitRequestValidationError{} - -// Validate checks the field values on DeinitResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *DeinitResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeinitResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in DeinitResponseMultiError, -// or nil if none found. -func (m *DeinitResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *DeinitResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return DeinitResponseMultiError(errors) - } - - return nil -} - -// DeinitResponseMultiError is an error wrapping multiple validation errors -// returned by DeinitResponse.ValidateAll() if the designated constraints -// aren't met. -type DeinitResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeinitResponseMultiError) Error() string { - var msgs []string - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeinitResponseMultiError) AllErrors() []error { return m } - -// DeinitResponseValidationError is the validation error returned by -// DeinitResponse.Validate if the designated constraints aren't met. -type DeinitResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeinitResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeinitResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeinitResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeinitResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeinitResponseValidationError) ErrorName() string { return "DeinitResponseValidationError" } - -// Error satisfies the builtin error interface -func (e DeinitResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeinitResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeinitResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeinitResponseValidationError{} diff --git a/internal/proto/service/init/v1/init.proto b/internal/proto/service/init/v1/init.proto index e3de9ff..ab50128 100644 --- a/internal/proto/service/init/v1/init.proto +++ b/internal/proto/service/init/v1/init.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package service.init.v1; +option go_package = "github.com/openkcm/plugin-sdk/internal/proto/service/init/v1;initv1"; + // Init is an internal service that the plugin framework uses to initialize // a plugin after it has been loaded. Initialization takes place when the // plugin client connects, since the client is responsible for hosting the diff --git a/internal/proto/service/init/v1/init_grpc.pb.go b/internal/proto/service/init/v1/init_grpc.pb.go index 7fd786d..8b3f379 100644 --- a/internal/proto/service/init/v1/init_grpc.pb.go +++ b/internal/proto/service/init/v1/init_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.35.1 // source: service/init/v1/init.proto package initv1 @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Bootstrap_Init_FullMethodName = "/service.init.v1.Bootstrap/Init" @@ -26,6 +26,13 @@ const ( // BootstrapClient is the client API for Bootstrap service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +// +// Init is an internal service that the plugin framework uses to initialize +// a plugin after it has been loaded. Initialization takes place when the +// plugin client connects, since the client is responsible for hosting the +// broker that is used to provide host services. If we initialize before that, +// there would be no broker available to connect to host services with. +// The service is also used for graceful cleanup when the plugin is unloaded. type BootstrapClient interface { Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*InitResponse, error) Deinit(ctx context.Context, in *DeinitRequest, opts ...grpc.CallOption) (*DeinitResponse, error) @@ -40,8 +47,9 @@ func NewBootstrapClient(cc grpc.ClientConnInterface) BootstrapClient { } func (c *bootstrapClient) Init(ctx context.Context, in *InitRequest, opts ...grpc.CallOption) (*InitResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(InitResponse) - err := c.cc.Invoke(ctx, Bootstrap_Init_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Bootstrap_Init_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -49,8 +57,9 @@ func (c *bootstrapClient) Init(ctx context.Context, in *InitRequest, opts ...grp } func (c *bootstrapClient) Deinit(ctx context.Context, in *DeinitRequest, opts ...grpc.CallOption) (*DeinitResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(DeinitResponse) - err := c.cc.Invoke(ctx, Bootstrap_Deinit_FullMethodName, in, out, opts...) + err := c.cc.Invoke(ctx, Bootstrap_Deinit_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -59,24 +68,35 @@ func (c *bootstrapClient) Deinit(ctx context.Context, in *DeinitRequest, opts .. // BootstrapServer is the server API for Bootstrap service. // All implementations must embed UnimplementedBootstrapServer -// for forward compatibility +// for forward compatibility. +// +// Init is an internal service that the plugin framework uses to initialize +// a plugin after it has been loaded. Initialization takes place when the +// plugin client connects, since the client is responsible for hosting the +// broker that is used to provide host services. If we initialize before that, +// there would be no broker available to connect to host services with. +// The service is also used for graceful cleanup when the plugin is unloaded. type BootstrapServer interface { Init(context.Context, *InitRequest) (*InitResponse, error) Deinit(context.Context, *DeinitRequest) (*DeinitResponse, error) mustEmbedUnimplementedBootstrapServer() } -// UnimplementedBootstrapServer must be embedded to have forward compatible implementations. -type UnimplementedBootstrapServer struct { -} +// UnimplementedBootstrapServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedBootstrapServer struct{} func (UnimplementedBootstrapServer) Init(context.Context, *InitRequest) (*InitResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Init not implemented") + return nil, status.Error(codes.Unimplemented, "method Init not implemented") } func (UnimplementedBootstrapServer) Deinit(context.Context, *DeinitRequest) (*DeinitResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deinit not implemented") + return nil, status.Error(codes.Unimplemented, "method Deinit not implemented") } func (UnimplementedBootstrapServer) mustEmbedUnimplementedBootstrapServer() {} +func (UnimplementedBootstrapServer) testEmbeddedByValue() {} // UnsafeBootstrapServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to BootstrapServer will @@ -86,6 +106,13 @@ type UnsafeBootstrapServer interface { } func RegisterBootstrapServer(s grpc.ServiceRegistrar, srv BootstrapServer) { + // If the following call panics, it indicates UnimplementedBootstrapServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Bootstrap_ServiceDesc, srv) } diff --git a/pkg/plugin/keystore/errors/errors.go b/pkg/plugin/keystore/errors/errors.go index 9e65afc..875a4f5 100644 --- a/pkg/plugin/keystore/errors/errors.go +++ b/pkg/plugin/keystore/errors/errors.go @@ -36,6 +36,8 @@ var ( // StatusKeyNotFound indicates that the specified key was not found in the keystore provider. StatusKeyNotFound = status.New( codes.NotFound, "key not found in the keystore provider") + + StatusKeyGenericErr = status.New(codes.Unknown, "failed to get key") ) // NewGrpcErrorWithDetails creates a gRPC error with the given status and metadata mapping. diff --git a/proto/plugin/certificate_issuer/v1/certificate_issuer.pb.go b/proto/plugin/certificate_issuer/v1/certificate_issuer.pb.go index 56fd24d..745b2cc 100644 --- a/proto/plugin/certificate_issuer/v1/certificate_issuer.pb.go +++ b/proto/plugin/certificate_issuer/v1/certificate_issuer.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.35.1 // source: plugin/certificate_issuer/v1/certificate_issuer.proto package certificate_issuerv1 import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( @@ -308,8 +307,7 @@ const file_plugin_certificate_issuer_v1_certificate_issuer_proto_rawDesc = "" + "\x14VALIDITY_TYPE_MONTHS\x10\x02\x12\x17\n" + "\x13VALIDITY_TYPE_YEARS\x10\x032\x97\x01\n" + "\x18CertificateIssuerService\x12{\n" + - "\x0eGetCertificate\x123.plugin.certificate_issuer.v1.GetCertificateRequest\x1a4.plugin.certificate_issuer.v1.GetCertificateResponseB\x9f\x02\n" + - " com.plugin.certificate_issuer.v1B\x16CertificateIssuerProtoP\x01ZUgithub.com/openkcm/plugin-sdk/proto/plugin/certificate_issuer/v1;certificate_issuerv1\xa2\x02\x03PCX\xaa\x02\x1bPlugin.CertificateIssuer.V1\xca\x02\x1bPlugin\\CertificateIssuer\\V1\xe2\x02'Plugin\\CertificateIssuer\\V1\\GPBMetadata\xea\x02\x1dPlugin::CertificateIssuer::V1b\x06proto3" + "\x0eGetCertificate\x123.plugin.certificate_issuer.v1.GetCertificateRequest\x1a4.plugin.certificate_issuer.v1.GetCertificateResponseBWZUgithub.com/openkcm/plugin-sdk/proto/plugin/certificate_issuer/v1;certificate_issuerv1b\x06proto3" var ( file_plugin_certificate_issuer_v1_certificate_issuer_proto_rawDescOnce sync.Once diff --git a/proto/plugin/certificate_issuer/v1/certificate_issuer.pb.validate.go b/proto/plugin/certificate_issuer/v1/certificate_issuer.pb.validate.go deleted file mode 100644 index 12c10a0..0000000 --- a/proto/plugin/certificate_issuer/v1/certificate_issuer.pb.validate.go +++ /dev/null @@ -1,509 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/certificate_issuer/v1/certificate_issuer.proto - -package certificate_issuerv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on GetCertificateRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetCertificateRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetCertificateRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetCertificateRequestMultiError, or nil if none found. -func (m *GetCertificateRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetCertificateRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for CommonName - - if all { - switch v := interface{}(m.GetValidity()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetCertificateRequestValidationError{ - field: "Validity", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetCertificateRequestValidationError{ - field: "Validity", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValidity()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetCertificateRequestValidationError{ - field: "Validity", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetPrivateKey()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetCertificateRequestValidationError{ - field: "PrivateKey", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetCertificateRequestValidationError{ - field: "PrivateKey", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetPrivateKey()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetCertificateRequestValidationError{ - field: "PrivateKey", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetCertificateRequestMultiError(errors) - } - - return nil -} - -// GetCertificateRequestMultiError is an error wrapping multiple validation -// errors returned by GetCertificateRequest.ValidateAll() if the designated -// constraints aren't met. -type GetCertificateRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetCertificateRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetCertificateRequestMultiError) AllErrors() []error { return m } - -// GetCertificateRequestValidationError is the validation error returned by -// GetCertificateRequest.Validate if the designated constraints aren't met. -type GetCertificateRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetCertificateRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetCertificateRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetCertificateRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetCertificateRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetCertificateRequestValidationError) ErrorName() string { - return "GetCertificateRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e GetCertificateRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetCertificateRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetCertificateRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetCertificateRequestValidationError{} - -// Validate checks the field values on GetCertificateValidity with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetCertificateValidity) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetCertificateValidity with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetCertificateValidityMultiError, or nil if none found. -func (m *GetCertificateValidity) ValidateAll() error { - return m.validate(true) -} - -func (m *GetCertificateValidity) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Value - - // no validation rules for Type - - if len(errors) > 0 { - return GetCertificateValidityMultiError(errors) - } - - return nil -} - -// GetCertificateValidityMultiError is an error wrapping multiple validation -// errors returned by GetCertificateValidity.ValidateAll() if the designated -// constraints aren't met. -type GetCertificateValidityMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetCertificateValidityMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetCertificateValidityMultiError) AllErrors() []error { return m } - -// GetCertificateValidityValidationError is the validation error returned by -// GetCertificateValidity.Validate if the designated constraints aren't met. -type GetCertificateValidityValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetCertificateValidityValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetCertificateValidityValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetCertificateValidityValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetCertificateValidityValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetCertificateValidityValidationError) ErrorName() string { - return "GetCertificateValidityValidationError" -} - -// Error satisfies the builtin error interface -func (e GetCertificateValidityValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetCertificateValidity.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetCertificateValidityValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetCertificateValidityValidationError{} - -// Validate checks the field values on PrivateKey with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *PrivateKey) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on PrivateKey with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in PrivateKeyMultiError, or -// nil if none found. -func (m *PrivateKey) ValidateAll() error { - return m.validate(true) -} - -func (m *PrivateKey) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Data - - if len(errors) > 0 { - return PrivateKeyMultiError(errors) - } - - return nil -} - -// PrivateKeyMultiError is an error wrapping multiple validation errors -// returned by PrivateKey.ValidateAll() if the designated constraints aren't met. -type PrivateKeyMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m PrivateKeyMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m PrivateKeyMultiError) AllErrors() []error { return m } - -// PrivateKeyValidationError is the validation error returned by -// PrivateKey.Validate if the designated constraints aren't met. -type PrivateKeyValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e PrivateKeyValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e PrivateKeyValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e PrivateKeyValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e PrivateKeyValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e PrivateKeyValidationError) ErrorName() string { return "PrivateKeyValidationError" } - -// Error satisfies the builtin error interface -func (e PrivateKeyValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sPrivateKey.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = PrivateKeyValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = PrivateKeyValidationError{} - -// Validate checks the field values on GetCertificateResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetCertificateResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetCertificateResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetCertificateResponseMultiError, or nil if none found. -func (m *GetCertificateResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetCertificateResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for CertificateChain - - if len(errors) > 0 { - return GetCertificateResponseMultiError(errors) - } - - return nil -} - -// GetCertificateResponseMultiError is an error wrapping multiple validation -// errors returned by GetCertificateResponse.ValidateAll() if the designated -// constraints aren't met. -type GetCertificateResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetCertificateResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetCertificateResponseMultiError) AllErrors() []error { return m } - -// GetCertificateResponseValidationError is the validation error returned by -// GetCertificateResponse.Validate if the designated constraints aren't met. -type GetCertificateResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetCertificateResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetCertificateResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetCertificateResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetCertificateResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetCertificateResponseValidationError) ErrorName() string { - return "GetCertificateResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetCertificateResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetCertificateResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetCertificateResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetCertificateResponseValidationError{} diff --git a/proto/plugin/certificate_issuer/v1/certificate_issuer.proto b/proto/plugin/certificate_issuer/v1/certificate_issuer.proto index 00448ee..563fde9 100644 --- a/proto/plugin/certificate_issuer/v1/certificate_issuer.proto +++ b/proto/plugin/certificate_issuer/v1/certificate_issuer.proto @@ -1,6 +1,8 @@ syntax = "proto3"; package plugin.certificate_issuer.v1; +option go_package = "github.com/openkcm/plugin-sdk/proto/plugin/certificate_issuer/v1;certificate_issuerv1"; + service CertificateIssuerService { rpc GetCertificate(GetCertificateRequest) returns (GetCertificateResponse); } diff --git a/proto/plugin/certificate_issuer/v1/certificate_issuer_ext_plugin.pb.go b/proto/plugin/certificate_issuer/v1/certificate_issuer_ext_plugin.pb.go index 7d0d285..f91b30e 100644 --- a/proto/plugin/certificate_issuer/v1/certificate_issuer_ext_plugin.pb.go +++ b/proto/plugin/certificate_issuer/v1/certificate_issuer_ext_plugin.pb.go @@ -3,9 +3,8 @@ package certificate_issuerv1 import ( - grpc "google.golang.org/grpc" - api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" ) const ( diff --git a/proto/plugin/certificate_issuer/v1/certificate_issuer_grpc.pb.go b/proto/plugin/certificate_issuer/v1/certificate_issuer_grpc.pb.go index 21e8e15..636d3e9 100644 --- a/proto/plugin/certificate_issuer/v1/certificate_issuer_grpc.pb.go +++ b/proto/plugin/certificate_issuer/v1/certificate_issuer_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.35.1 // source: plugin/certificate_issuer/v1/certificate_issuer.proto package certificate_issuerv1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/proto/plugin/identity_management/v1/identity_management.pb.go b/proto/plugin/identity_management/v1/identity_management.pb.go index caf3355..c8f3619 100644 --- a/proto/plugin/identity_management/v1/identity_management.pb.go +++ b/proto/plugin/identity_management/v1/identity_management.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.35.1 // source: plugin/identity_management/v1/identity_management.proto package identity_managementv1 import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( @@ -66,6 +65,102 @@ func (x *AuthContext) GetData() map[string]string { return nil } +type GetUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + AuthContext *AuthContext `protobuf:"bytes,99,opt,name=auth_context,json=authContext,proto3" json:"auth_context,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserRequest) Reset() { + *x = GetUserRequest{} + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserRequest) ProtoMessage() {} + +func (x *GetUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserRequest.ProtoReflect.Descriptor instead. +func (*GetUserRequest) Descriptor() ([]byte, []int) { + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{1} +} + +func (x *GetUserRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *GetUserRequest) GetAuthContext() *AuthContext { + if x != nil { + return x.AuthContext + } + return nil +} + +type GetUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + User *User `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserResponse) Reset() { + *x = GetUserResponse{} + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserResponse) ProtoMessage() {} + +func (x *GetUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserResponse.ProtoReflect.Descriptor instead. +func (*GetUserResponse) Descriptor() ([]byte, []int) { + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{2} +} + +func (x *GetUserResponse) GetUser() *User { + if x != nil { + return x.User + } + return nil +} + type GetGroupRequest struct { state protoimpl.MessageState `protogen:"open.v1"` GroupName string `protobuf:"bytes,1,opt,name=group_name,json=groupName,proto3" json:"group_name,omitempty"` @@ -76,7 +171,7 @@ type GetGroupRequest struct { func (x *GetGroupRequest) Reset() { *x = GetGroupRequest{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[1] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -88,7 +183,7 @@ func (x *GetGroupRequest) String() string { func (*GetGroupRequest) ProtoMessage() {} func (x *GetGroupRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[1] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -101,7 +196,7 @@ func (x *GetGroupRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetGroupRequest.ProtoReflect.Descriptor instead. func (*GetGroupRequest) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{1} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{3} } func (x *GetGroupRequest) GetGroupName() string { @@ -127,7 +222,7 @@ type GetGroupResponse struct { func (x *GetGroupResponse) Reset() { *x = GetGroupResponse{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[2] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -139,7 +234,7 @@ func (x *GetGroupResponse) String() string { func (*GetGroupResponse) ProtoMessage() {} func (x *GetGroupResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[2] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -152,7 +247,7 @@ func (x *GetGroupResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetGroupResponse.ProtoReflect.Descriptor instead. func (*GetGroupResponse) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{2} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{4} } func (x *GetGroupResponse) GetGroup() *Group { @@ -171,7 +266,7 @@ type GetAllGroupsRequest struct { func (x *GetAllGroupsRequest) Reset() { *x = GetAllGroupsRequest{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[3] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -183,7 +278,7 @@ func (x *GetAllGroupsRequest) String() string { func (*GetAllGroupsRequest) ProtoMessage() {} func (x *GetAllGroupsRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[3] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -196,7 +291,7 @@ func (x *GetAllGroupsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAllGroupsRequest.ProtoReflect.Descriptor instead. func (*GetAllGroupsRequest) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{3} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{5} } func (x *GetAllGroupsRequest) GetAuthContext() *AuthContext { @@ -215,7 +310,7 @@ type GetAllGroupsResponse struct { func (x *GetAllGroupsResponse) Reset() { *x = GetAllGroupsResponse{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[4] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -227,7 +322,7 @@ func (x *GetAllGroupsResponse) String() string { func (*GetAllGroupsResponse) ProtoMessage() {} func (x *GetAllGroupsResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[4] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -240,7 +335,7 @@ func (x *GetAllGroupsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetAllGroupsResponse.ProtoReflect.Descriptor instead. func (*GetAllGroupsResponse) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{4} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{6} } func (x *GetAllGroupsResponse) GetGroups() []*Group { @@ -260,7 +355,7 @@ type GetUsersForGroupRequest struct { func (x *GetUsersForGroupRequest) Reset() { *x = GetUsersForGroupRequest{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[5] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -272,7 +367,7 @@ func (x *GetUsersForGroupRequest) String() string { func (*GetUsersForGroupRequest) ProtoMessage() {} func (x *GetUsersForGroupRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[5] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -285,7 +380,7 @@ func (x *GetUsersForGroupRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetUsersForGroupRequest.ProtoReflect.Descriptor instead. func (*GetUsersForGroupRequest) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{5} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{7} } func (x *GetUsersForGroupRequest) GetGroupId() string { @@ -311,7 +406,7 @@ type GetUsersForGroupResponse struct { func (x *GetUsersForGroupResponse) Reset() { *x = GetUsersForGroupResponse{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[6] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -323,7 +418,7 @@ func (x *GetUsersForGroupResponse) String() string { func (*GetUsersForGroupResponse) ProtoMessage() {} func (x *GetUsersForGroupResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[6] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -336,7 +431,7 @@ func (x *GetUsersForGroupResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetUsersForGroupResponse.ProtoReflect.Descriptor instead. func (*GetUsersForGroupResponse) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{6} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{8} } func (x *GetUsersForGroupResponse) GetUsers() []*User { @@ -357,7 +452,7 @@ type User struct { func (x *User) Reset() { *x = User{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[7] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -369,7 +464,7 @@ func (x *User) String() string { func (*User) ProtoMessage() {} func (x *User) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[7] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -382,7 +477,7 @@ func (x *User) ProtoReflect() protoreflect.Message { // Deprecated: Use User.ProtoReflect.Descriptor instead. func (*User) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{7} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{9} } func (x *User) GetId() string { @@ -416,7 +511,7 @@ type GetGroupsForUserRequest struct { func (x *GetGroupsForUserRequest) Reset() { *x = GetGroupsForUserRequest{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[8] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -428,7 +523,7 @@ func (x *GetGroupsForUserRequest) String() string { func (*GetGroupsForUserRequest) ProtoMessage() {} func (x *GetGroupsForUserRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[8] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -441,7 +536,7 @@ func (x *GetGroupsForUserRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetGroupsForUserRequest.ProtoReflect.Descriptor instead. func (*GetGroupsForUserRequest) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{8} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{10} } func (x *GetGroupsForUserRequest) GetUserId() string { @@ -467,7 +562,7 @@ type GetGroupsForUserResponse struct { func (x *GetGroupsForUserResponse) Reset() { *x = GetGroupsForUserResponse{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[9] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -479,7 +574,7 @@ func (x *GetGroupsForUserResponse) String() string { func (*GetGroupsForUserResponse) ProtoMessage() {} func (x *GetGroupsForUserResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[9] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -492,7 +587,7 @@ func (x *GetGroupsForUserResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetGroupsForUserResponse.ProtoReflect.Descriptor instead. func (*GetGroupsForUserResponse) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{9} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{11} } func (x *GetGroupsForUserResponse) GetGroups() []*Group { @@ -512,7 +607,7 @@ type Group struct { func (x *Group) Reset() { *x = Group{} - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[10] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -524,7 +619,7 @@ func (x *Group) String() string { func (*Group) ProtoMessage() {} func (x *Group) ProtoReflect() protoreflect.Message { - mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[10] + mi := &file_plugin_identity_management_v1_identity_management_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -537,7 +632,7 @@ func (x *Group) ProtoReflect() protoreflect.Message { // Deprecated: Use Group.ProtoReflect.Descriptor instead. func (*Group) Descriptor() ([]byte, []int) { - return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{10} + return file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP(), []int{12} } func (x *Group) GetId() string { @@ -563,7 +658,12 @@ const file_plugin_identity_management_v1_identity_management_proto_rawDesc = "" "\x04data\x18\x01 \x03(\v24.plugin.identity_management.v1.AuthContext.DataEntryR\x04data\x1a7\n" + "\tDataEntry\x12\x10\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + - "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x7f\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"x\n" + + "\x0eGetUserRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12M\n" + + "\fauth_context\x18c \x01(\v2*.plugin.identity_management.v1.AuthContextR\vauthContext\"J\n" + + "\x0fGetUserResponse\x127\n" + + "\x04user\x18\x01 \x01(\v2#.plugin.identity_management.v1.UserR\x04user\"\x7f\n" + "\x0fGetGroupRequest\x12\x1d\n" + "\n" + "group_name\x18\x01 \x01(\tR\tgroupName\x12M\n" + @@ -590,13 +690,13 @@ const file_plugin_identity_management_v1_identity_management_proto_rawDesc = "" "\x06groups\x18\x01 \x03(\v2$.plugin.identity_management.v1.GroupR\x06groups\"+\n" + "\x05Group\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + - "\x04name\x18\x02 \x01(\tR\x04name2\x8d\x04\n" + - "\x19IdentityManagementService\x12k\n" + + "\x04name\x18\x02 \x01(\tR\x04name2\xf7\x04\n" + + "\x19IdentityManagementService\x12h\n" + + "\aGetUser\x12-.plugin.identity_management.v1.GetUserRequest\x1a..plugin.identity_management.v1.GetUserResponse\x12k\n" + "\bGetGroup\x12..plugin.identity_management.v1.GetGroupRequest\x1a/.plugin.identity_management.v1.GetGroupResponse\x12w\n" + "\fGetAllGroups\x122.plugin.identity_management.v1.GetAllGroupsRequest\x1a3.plugin.identity_management.v1.GetAllGroupsResponse\x12\x83\x01\n" + "\x10GetUsersForGroup\x126.plugin.identity_management.v1.GetUsersForGroupRequest\x1a7.plugin.identity_management.v1.GetUsersForGroupResponse\x12\x83\x01\n" + - "\x10GetGroupsForUser\x126.plugin.identity_management.v1.GetGroupsForUserRequest\x1a7.plugin.identity_management.v1.GetGroupsForUserResponseB\xa7\x02\n" + - "!com.plugin.identity_management.v1B\x17IdentityManagementProtoP\x01ZWgithub.com/openkcm/plugin-sdk/proto/plugin/identity_management/v1;identity_managementv1\xa2\x02\x03PIX\xaa\x02\x1cPlugin.IdentityManagement.V1\xca\x02\x1cPlugin\\IdentityManagement\\V1\xe2\x02(Plugin\\IdentityManagement\\V1\\GPBMetadata\xea\x02\x1ePlugin::IdentityManagement::V1b\x06proto3" + "\x10GetGroupsForUser\x126.plugin.identity_management.v1.GetGroupsForUserRequest\x1a7.plugin.identity_management.v1.GetGroupsForUserResponseBYZWgithub.com/openkcm/plugin-sdk/proto/plugin/identity_management/v1;identity_managementv1b\x06proto3" var ( file_plugin_identity_management_v1_identity_management_proto_rawDescOnce sync.Once @@ -610,44 +710,50 @@ func file_plugin_identity_management_v1_identity_management_proto_rawDescGZIP() return file_plugin_identity_management_v1_identity_management_proto_rawDescData } -var file_plugin_identity_management_v1_identity_management_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_plugin_identity_management_v1_identity_management_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_plugin_identity_management_v1_identity_management_proto_goTypes = []any{ (*AuthContext)(nil), // 0: plugin.identity_management.v1.AuthContext - (*GetGroupRequest)(nil), // 1: plugin.identity_management.v1.GetGroupRequest - (*GetGroupResponse)(nil), // 2: plugin.identity_management.v1.GetGroupResponse - (*GetAllGroupsRequest)(nil), // 3: plugin.identity_management.v1.GetAllGroupsRequest - (*GetAllGroupsResponse)(nil), // 4: plugin.identity_management.v1.GetAllGroupsResponse - (*GetUsersForGroupRequest)(nil), // 5: plugin.identity_management.v1.GetUsersForGroupRequest - (*GetUsersForGroupResponse)(nil), // 6: plugin.identity_management.v1.GetUsersForGroupResponse - (*User)(nil), // 7: plugin.identity_management.v1.User - (*GetGroupsForUserRequest)(nil), // 8: plugin.identity_management.v1.GetGroupsForUserRequest - (*GetGroupsForUserResponse)(nil), // 9: plugin.identity_management.v1.GetGroupsForUserResponse - (*Group)(nil), // 10: plugin.identity_management.v1.Group - nil, // 11: plugin.identity_management.v1.AuthContext.DataEntry + (*GetUserRequest)(nil), // 1: plugin.identity_management.v1.GetUserRequest + (*GetUserResponse)(nil), // 2: plugin.identity_management.v1.GetUserResponse + (*GetGroupRequest)(nil), // 3: plugin.identity_management.v1.GetGroupRequest + (*GetGroupResponse)(nil), // 4: plugin.identity_management.v1.GetGroupResponse + (*GetAllGroupsRequest)(nil), // 5: plugin.identity_management.v1.GetAllGroupsRequest + (*GetAllGroupsResponse)(nil), // 6: plugin.identity_management.v1.GetAllGroupsResponse + (*GetUsersForGroupRequest)(nil), // 7: plugin.identity_management.v1.GetUsersForGroupRequest + (*GetUsersForGroupResponse)(nil), // 8: plugin.identity_management.v1.GetUsersForGroupResponse + (*User)(nil), // 9: plugin.identity_management.v1.User + (*GetGroupsForUserRequest)(nil), // 10: plugin.identity_management.v1.GetGroupsForUserRequest + (*GetGroupsForUserResponse)(nil), // 11: plugin.identity_management.v1.GetGroupsForUserResponse + (*Group)(nil), // 12: plugin.identity_management.v1.Group + nil, // 13: plugin.identity_management.v1.AuthContext.DataEntry } var file_plugin_identity_management_v1_identity_management_proto_depIdxs = []int32{ - 11, // 0: plugin.identity_management.v1.AuthContext.data:type_name -> plugin.identity_management.v1.AuthContext.DataEntry - 0, // 1: plugin.identity_management.v1.GetGroupRequest.auth_context:type_name -> plugin.identity_management.v1.AuthContext - 10, // 2: plugin.identity_management.v1.GetGroupResponse.group:type_name -> plugin.identity_management.v1.Group - 0, // 3: plugin.identity_management.v1.GetAllGroupsRequest.auth_context:type_name -> plugin.identity_management.v1.AuthContext - 10, // 4: plugin.identity_management.v1.GetAllGroupsResponse.groups:type_name -> plugin.identity_management.v1.Group - 0, // 5: plugin.identity_management.v1.GetUsersForGroupRequest.auth_context:type_name -> plugin.identity_management.v1.AuthContext - 7, // 6: plugin.identity_management.v1.GetUsersForGroupResponse.users:type_name -> plugin.identity_management.v1.User - 0, // 7: plugin.identity_management.v1.GetGroupsForUserRequest.auth_context:type_name -> plugin.identity_management.v1.AuthContext - 10, // 8: plugin.identity_management.v1.GetGroupsForUserResponse.groups:type_name -> plugin.identity_management.v1.Group - 1, // 9: plugin.identity_management.v1.IdentityManagementService.GetGroup:input_type -> plugin.identity_management.v1.GetGroupRequest - 3, // 10: plugin.identity_management.v1.IdentityManagementService.GetAllGroups:input_type -> plugin.identity_management.v1.GetAllGroupsRequest - 5, // 11: plugin.identity_management.v1.IdentityManagementService.GetUsersForGroup:input_type -> plugin.identity_management.v1.GetUsersForGroupRequest - 8, // 12: plugin.identity_management.v1.IdentityManagementService.GetGroupsForUser:input_type -> plugin.identity_management.v1.GetGroupsForUserRequest - 2, // 13: plugin.identity_management.v1.IdentityManagementService.GetGroup:output_type -> plugin.identity_management.v1.GetGroupResponse - 4, // 14: plugin.identity_management.v1.IdentityManagementService.GetAllGroups:output_type -> plugin.identity_management.v1.GetAllGroupsResponse - 6, // 15: plugin.identity_management.v1.IdentityManagementService.GetUsersForGroup:output_type -> plugin.identity_management.v1.GetUsersForGroupResponse - 9, // 16: plugin.identity_management.v1.IdentityManagementService.GetGroupsForUser:output_type -> plugin.identity_management.v1.GetGroupsForUserResponse - 13, // [13:17] is the sub-list for method output_type - 9, // [9:13] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name + 13, // 0: plugin.identity_management.v1.AuthContext.data:type_name -> plugin.identity_management.v1.AuthContext.DataEntry + 0, // 1: plugin.identity_management.v1.GetUserRequest.auth_context:type_name -> plugin.identity_management.v1.AuthContext + 9, // 2: plugin.identity_management.v1.GetUserResponse.user:type_name -> plugin.identity_management.v1.User + 0, // 3: plugin.identity_management.v1.GetGroupRequest.auth_context:type_name -> plugin.identity_management.v1.AuthContext + 12, // 4: plugin.identity_management.v1.GetGroupResponse.group:type_name -> plugin.identity_management.v1.Group + 0, // 5: plugin.identity_management.v1.GetAllGroupsRequest.auth_context:type_name -> plugin.identity_management.v1.AuthContext + 12, // 6: plugin.identity_management.v1.GetAllGroupsResponse.groups:type_name -> plugin.identity_management.v1.Group + 0, // 7: plugin.identity_management.v1.GetUsersForGroupRequest.auth_context:type_name -> plugin.identity_management.v1.AuthContext + 9, // 8: plugin.identity_management.v1.GetUsersForGroupResponse.users:type_name -> plugin.identity_management.v1.User + 0, // 9: plugin.identity_management.v1.GetGroupsForUserRequest.auth_context:type_name -> plugin.identity_management.v1.AuthContext + 12, // 10: plugin.identity_management.v1.GetGroupsForUserResponse.groups:type_name -> plugin.identity_management.v1.Group + 1, // 11: plugin.identity_management.v1.IdentityManagementService.GetUser:input_type -> plugin.identity_management.v1.GetUserRequest + 3, // 12: plugin.identity_management.v1.IdentityManagementService.GetGroup:input_type -> plugin.identity_management.v1.GetGroupRequest + 5, // 13: plugin.identity_management.v1.IdentityManagementService.GetAllGroups:input_type -> plugin.identity_management.v1.GetAllGroupsRequest + 7, // 14: plugin.identity_management.v1.IdentityManagementService.GetUsersForGroup:input_type -> plugin.identity_management.v1.GetUsersForGroupRequest + 10, // 15: plugin.identity_management.v1.IdentityManagementService.GetGroupsForUser:input_type -> plugin.identity_management.v1.GetGroupsForUserRequest + 2, // 16: plugin.identity_management.v1.IdentityManagementService.GetUser:output_type -> plugin.identity_management.v1.GetUserResponse + 4, // 17: plugin.identity_management.v1.IdentityManagementService.GetGroup:output_type -> plugin.identity_management.v1.GetGroupResponse + 6, // 18: plugin.identity_management.v1.IdentityManagementService.GetAllGroups:output_type -> plugin.identity_management.v1.GetAllGroupsResponse + 8, // 19: plugin.identity_management.v1.IdentityManagementService.GetUsersForGroup:output_type -> plugin.identity_management.v1.GetUsersForGroupResponse + 11, // 20: plugin.identity_management.v1.IdentityManagementService.GetGroupsForUser:output_type -> plugin.identity_management.v1.GetGroupsForUserResponse + 16, // [16:21] is the sub-list for method output_type + 11, // [11:16] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_plugin_identity_management_v1_identity_management_proto_init() } @@ -661,7 +767,7 @@ func file_plugin_identity_management_v1_identity_management_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_identity_management_v1_identity_management_proto_rawDesc), len(file_plugin_identity_management_v1_identity_management_proto_rawDesc)), NumEnums: 0, - NumMessages: 12, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/plugin/identity_management/v1/identity_management.pb.validate.go b/proto/plugin/identity_management/v1/identity_management.pb.validate.go deleted file mode 100644 index c72e3ef..0000000 --- a/proto/plugin/identity_management/v1/identity_management.pb.validate.go +++ /dev/null @@ -1,1408 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/identity_management/v1/identity_management.proto - -package identity_managementv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on AuthContext with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *AuthContext) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on AuthContext with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in AuthContextMultiError, or -// nil if none found. -func (m *AuthContext) ValidateAll() error { - return m.validate(true) -} - -func (m *AuthContext) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Data - - if len(errors) > 0 { - return AuthContextMultiError(errors) - } - - return nil -} - -// AuthContextMultiError is an error wrapping multiple validation errors -// returned by AuthContext.ValidateAll() if the designated constraints aren't met. -type AuthContextMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m AuthContextMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m AuthContextMultiError) AllErrors() []error { return m } - -// AuthContextValidationError is the validation error returned by -// AuthContext.Validate if the designated constraints aren't met. -type AuthContextValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e AuthContextValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e AuthContextValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e AuthContextValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e AuthContextValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e AuthContextValidationError) ErrorName() string { return "AuthContextValidationError" } - -// Error satisfies the builtin error interface -func (e AuthContextValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sAuthContext.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = AuthContextValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = AuthContextValidationError{} - -// Validate checks the field values on GetGroupRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *GetGroupRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetGroupRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetGroupRequestMultiError, or nil if none found. -func (m *GetGroupRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetGroupRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for GroupName - - if all { - switch v := interface{}(m.GetAuthContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetGroupRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetGroupRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAuthContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetGroupRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetGroupRequestMultiError(errors) - } - - return nil -} - -// GetGroupRequestMultiError is an error wrapping multiple validation errors -// returned by GetGroupRequest.ValidateAll() if the designated constraints -// aren't met. -type GetGroupRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetGroupRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetGroupRequestMultiError) AllErrors() []error { return m } - -// GetGroupRequestValidationError is the validation error returned by -// GetGroupRequest.Validate if the designated constraints aren't met. -type GetGroupRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetGroupRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetGroupRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetGroupRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetGroupRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetGroupRequestValidationError) ErrorName() string { return "GetGroupRequestValidationError" } - -// Error satisfies the builtin error interface -func (e GetGroupRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetGroupRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetGroupRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetGroupRequestValidationError{} - -// Validate checks the field values on GetGroupResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *GetGroupResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetGroupResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetGroupResponseMultiError, or nil if none found. -func (m *GetGroupResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetGroupResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetGroup()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetGroupResponseValidationError{ - field: "Group", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetGroupResponseValidationError{ - field: "Group", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetGroup()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetGroupResponseValidationError{ - field: "Group", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetGroupResponseMultiError(errors) - } - - return nil -} - -// GetGroupResponseMultiError is an error wrapping multiple validation errors -// returned by GetGroupResponse.ValidateAll() if the designated constraints -// aren't met. -type GetGroupResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetGroupResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetGroupResponseMultiError) AllErrors() []error { return m } - -// GetGroupResponseValidationError is the validation error returned by -// GetGroupResponse.Validate if the designated constraints aren't met. -type GetGroupResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetGroupResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetGroupResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetGroupResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetGroupResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetGroupResponseValidationError) ErrorName() string { return "GetGroupResponseValidationError" } - -// Error satisfies the builtin error interface -func (e GetGroupResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetGroupResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetGroupResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetGroupResponseValidationError{} - -// Validate checks the field values on GetAllGroupsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetAllGroupsRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetAllGroupsRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetAllGroupsRequestMultiError, or nil if none found. -func (m *GetAllGroupsRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetAllGroupsRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetAuthContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetAllGroupsRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetAllGroupsRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAuthContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetAllGroupsRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetAllGroupsRequestMultiError(errors) - } - - return nil -} - -// GetAllGroupsRequestMultiError is an error wrapping multiple validation -// errors returned by GetAllGroupsRequest.ValidateAll() if the designated -// constraints aren't met. -type GetAllGroupsRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetAllGroupsRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetAllGroupsRequestMultiError) AllErrors() []error { return m } - -// GetAllGroupsRequestValidationError is the validation error returned by -// GetAllGroupsRequest.Validate if the designated constraints aren't met. -type GetAllGroupsRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetAllGroupsRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetAllGroupsRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetAllGroupsRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetAllGroupsRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetAllGroupsRequestValidationError) ErrorName() string { - return "GetAllGroupsRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e GetAllGroupsRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetAllGroupsRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetAllGroupsRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetAllGroupsRequestValidationError{} - -// Validate checks the field values on GetAllGroupsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetAllGroupsResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetAllGroupsResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetAllGroupsResponseMultiError, or nil if none found. -func (m *GetAllGroupsResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetAllGroupsResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetGroups() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetAllGroupsResponseValidationError{ - field: fmt.Sprintf("Groups[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetAllGroupsResponseValidationError{ - field: fmt.Sprintf("Groups[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetAllGroupsResponseValidationError{ - field: fmt.Sprintf("Groups[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return GetAllGroupsResponseMultiError(errors) - } - - return nil -} - -// GetAllGroupsResponseMultiError is an error wrapping multiple validation -// errors returned by GetAllGroupsResponse.ValidateAll() if the designated -// constraints aren't met. -type GetAllGroupsResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetAllGroupsResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetAllGroupsResponseMultiError) AllErrors() []error { return m } - -// GetAllGroupsResponseValidationError is the validation error returned by -// GetAllGroupsResponse.Validate if the designated constraints aren't met. -type GetAllGroupsResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetAllGroupsResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetAllGroupsResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetAllGroupsResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetAllGroupsResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetAllGroupsResponseValidationError) ErrorName() string { - return "GetAllGroupsResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetAllGroupsResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetAllGroupsResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetAllGroupsResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetAllGroupsResponseValidationError{} - -// Validate checks the field values on GetUsersForGroupRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetUsersForGroupRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetUsersForGroupRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetUsersForGroupRequestMultiError, or nil if none found. -func (m *GetUsersForGroupRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetUsersForGroupRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for GroupId - - if all { - switch v := interface{}(m.GetAuthContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetUsersForGroupRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetUsersForGroupRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAuthContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetUsersForGroupRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetUsersForGroupRequestMultiError(errors) - } - - return nil -} - -// GetUsersForGroupRequestMultiError is an error wrapping multiple validation -// errors returned by GetUsersForGroupRequest.ValidateAll() if the designated -// constraints aren't met. -type GetUsersForGroupRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetUsersForGroupRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetUsersForGroupRequestMultiError) AllErrors() []error { return m } - -// GetUsersForGroupRequestValidationError is the validation error returned by -// GetUsersForGroupRequest.Validate if the designated constraints aren't met. -type GetUsersForGroupRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetUsersForGroupRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetUsersForGroupRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetUsersForGroupRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetUsersForGroupRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetUsersForGroupRequestValidationError) ErrorName() string { - return "GetUsersForGroupRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e GetUsersForGroupRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetUsersForGroupRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetUsersForGroupRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetUsersForGroupRequestValidationError{} - -// Validate checks the field values on GetUsersForGroupResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetUsersForGroupResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetUsersForGroupResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetUsersForGroupResponseMultiError, or nil if none found. -func (m *GetUsersForGroupResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetUsersForGroupResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetUsers() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetUsersForGroupResponseValidationError{ - field: fmt.Sprintf("Users[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetUsersForGroupResponseValidationError{ - field: fmt.Sprintf("Users[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetUsersForGroupResponseValidationError{ - field: fmt.Sprintf("Users[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return GetUsersForGroupResponseMultiError(errors) - } - - return nil -} - -// GetUsersForGroupResponseMultiError is an error wrapping multiple validation -// errors returned by GetUsersForGroupResponse.ValidateAll() if the designated -// constraints aren't met. -type GetUsersForGroupResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetUsersForGroupResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetUsersForGroupResponseMultiError) AllErrors() []error { return m } - -// GetUsersForGroupResponseValidationError is the validation error returned by -// GetUsersForGroupResponse.Validate if the designated constraints aren't met. -type GetUsersForGroupResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetUsersForGroupResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetUsersForGroupResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetUsersForGroupResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetUsersForGroupResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetUsersForGroupResponseValidationError) ErrorName() string { - return "GetUsersForGroupResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetUsersForGroupResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetUsersForGroupResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetUsersForGroupResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetUsersForGroupResponseValidationError{} - -// Validate checks the field values on User with the rules defined in the proto -// definition for this message. If any rules are violated, the first error -// encountered is returned, or nil if there are no violations. -func (m *User) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on User with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in UserMultiError, or nil if none found. -func (m *User) ValidateAll() error { - return m.validate(true) -} - -func (m *User) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Name - - // no validation rules for Email - - if len(errors) > 0 { - return UserMultiError(errors) - } - - return nil -} - -// UserMultiError is an error wrapping multiple validation errors returned by -// User.ValidateAll() if the designated constraints aren't met. -type UserMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m UserMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m UserMultiError) AllErrors() []error { return m } - -// UserValidationError is the validation error returned by User.Validate if the -// designated constraints aren't met. -type UserValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e UserValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e UserValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e UserValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e UserValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e UserValidationError) ErrorName() string { return "UserValidationError" } - -// Error satisfies the builtin error interface -func (e UserValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sUser.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = UserValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = UserValidationError{} - -// Validate checks the field values on GetGroupsForUserRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetGroupsForUserRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetGroupsForUserRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetGroupsForUserRequestMultiError, or nil if none found. -func (m *GetGroupsForUserRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetGroupsForUserRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for UserId - - if all { - switch v := interface{}(m.GetAuthContext()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetGroupsForUserRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetGroupsForUserRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetAuthContext()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetGroupsForUserRequestValidationError{ - field: "AuthContext", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetGroupsForUserRequestMultiError(errors) - } - - return nil -} - -// GetGroupsForUserRequestMultiError is an error wrapping multiple validation -// errors returned by GetGroupsForUserRequest.ValidateAll() if the designated -// constraints aren't met. -type GetGroupsForUserRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetGroupsForUserRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetGroupsForUserRequestMultiError) AllErrors() []error { return m } - -// GetGroupsForUserRequestValidationError is the validation error returned by -// GetGroupsForUserRequest.Validate if the designated constraints aren't met. -type GetGroupsForUserRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetGroupsForUserRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetGroupsForUserRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetGroupsForUserRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetGroupsForUserRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetGroupsForUserRequestValidationError) ErrorName() string { - return "GetGroupsForUserRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e GetGroupsForUserRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetGroupsForUserRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetGroupsForUserRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetGroupsForUserRequestValidationError{} - -// Validate checks the field values on GetGroupsForUserResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetGroupsForUserResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetGroupsForUserResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetGroupsForUserResponseMultiError, or nil if none found. -func (m *GetGroupsForUserResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetGroupsForUserResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - for idx, item := range m.GetGroups() { - _, _ = idx, item - - if all { - switch v := interface{}(item).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetGroupsForUserResponseValidationError{ - field: fmt.Sprintf("Groups[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetGroupsForUserResponseValidationError{ - field: fmt.Sprintf("Groups[%v]", idx), - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetGroupsForUserResponseValidationError{ - field: fmt.Sprintf("Groups[%v]", idx), - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return GetGroupsForUserResponseMultiError(errors) - } - - return nil -} - -// GetGroupsForUserResponseMultiError is an error wrapping multiple validation -// errors returned by GetGroupsForUserResponse.ValidateAll() if the designated -// constraints aren't met. -type GetGroupsForUserResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetGroupsForUserResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetGroupsForUserResponseMultiError) AllErrors() []error { return m } - -// GetGroupsForUserResponseValidationError is the validation error returned by -// GetGroupsForUserResponse.Validate if the designated constraints aren't met. -type GetGroupsForUserResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetGroupsForUserResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetGroupsForUserResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetGroupsForUserResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetGroupsForUserResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetGroupsForUserResponseValidationError) ErrorName() string { - return "GetGroupsForUserResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetGroupsForUserResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetGroupsForUserResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetGroupsForUserResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetGroupsForUserResponseValidationError{} - -// Validate checks the field values on Group with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *Group) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on Group with the rules defined in the -// proto definition for this message. If any rules are violated, the result is -// a list of violation errors wrapped in GroupMultiError, or nil if none found. -func (m *Group) ValidateAll() error { - return m.validate(true) -} - -func (m *Group) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Name - - if len(errors) > 0 { - return GroupMultiError(errors) - } - - return nil -} - -// GroupMultiError is an error wrapping multiple validation errors returned by -// Group.ValidateAll() if the designated constraints aren't met. -type GroupMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GroupMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GroupMultiError) AllErrors() []error { return m } - -// GroupValidationError is the validation error returned by Group.Validate if -// the designated constraints aren't met. -type GroupValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GroupValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GroupValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GroupValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GroupValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GroupValidationError) ErrorName() string { return "GroupValidationError" } - -// Error satisfies the builtin error interface -func (e GroupValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGroup.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GroupValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GroupValidationError{} diff --git a/proto/plugin/identity_management/v1/identity_management.proto b/proto/plugin/identity_management/v1/identity_management.proto index 1140035..81fd545 100644 --- a/proto/plugin/identity_management/v1/identity_management.proto +++ b/proto/plugin/identity_management/v1/identity_management.proto @@ -1,7 +1,10 @@ syntax = "proto3"; package plugin.identity_management.v1; +option go_package = "github.com/openkcm/plugin-sdk/proto/plugin/identity_management/v1;identity_managementv1"; + service IdentityManagementService { + rpc GetUser(GetUserRequest) returns (GetUserResponse); rpc GetGroup(GetGroupRequest) returns (GetGroupResponse); rpc GetAllGroups(GetAllGroupsRequest) returns (GetAllGroupsResponse); rpc GetUsersForGroup(GetUsersForGroupRequest) returns (GetUsersForGroupResponse); @@ -12,6 +15,15 @@ message AuthContext { map data = 1; } +message GetUserRequest { + string user_id = 1; + AuthContext auth_context = 99; +} + +message GetUserResponse { + User user = 1; +} + message GetGroupRequest { string group_name = 1; AuthContext auth_context = 99; diff --git a/proto/plugin/identity_management/v1/identity_management_ext_plugin.pb.go b/proto/plugin/identity_management/v1/identity_management_ext_plugin.pb.go index ecd0fc7..f52395c 100644 --- a/proto/plugin/identity_management/v1/identity_management_ext_plugin.pb.go +++ b/proto/plugin/identity_management/v1/identity_management_ext_plugin.pb.go @@ -3,9 +3,8 @@ package identity_managementv1 import ( - grpc "google.golang.org/grpc" - api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" ) const ( diff --git a/proto/plugin/identity_management/v1/identity_management_grpc.pb.go b/proto/plugin/identity_management/v1/identity_management_grpc.pb.go index 9adc1f9..f6da6c3 100644 --- a/proto/plugin/identity_management/v1/identity_management_grpc.pb.go +++ b/proto/plugin/identity_management/v1/identity_management_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.35.1 // source: plugin/identity_management/v1/identity_management.proto package identity_managementv1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -20,6 +19,7 @@ import ( const _ = grpc.SupportPackageIsVersion9 const ( + IdentityManagementService_GetUser_FullMethodName = "/plugin.identity_management.v1.IdentityManagementService/GetUser" IdentityManagementService_GetGroup_FullMethodName = "/plugin.identity_management.v1.IdentityManagementService/GetGroup" IdentityManagementService_GetAllGroups_FullMethodName = "/plugin.identity_management.v1.IdentityManagementService/GetAllGroups" IdentityManagementService_GetUsersForGroup_FullMethodName = "/plugin.identity_management.v1.IdentityManagementService/GetUsersForGroup" @@ -30,6 +30,7 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type IdentityManagementServiceClient interface { + GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*GetGroupResponse, error) GetAllGroups(ctx context.Context, in *GetAllGroupsRequest, opts ...grpc.CallOption) (*GetAllGroupsResponse, error) GetUsersForGroup(ctx context.Context, in *GetUsersForGroupRequest, opts ...grpc.CallOption) (*GetUsersForGroupResponse, error) @@ -44,6 +45,16 @@ func NewIdentityManagementServiceClient(cc grpc.ClientConnInterface) IdentityMan return &identityManagementServiceClient{cc} } +func (c *identityManagementServiceClient) GetUser(ctx context.Context, in *GetUserRequest, opts ...grpc.CallOption) (*GetUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserResponse) + err := c.cc.Invoke(ctx, IdentityManagementService_GetUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *identityManagementServiceClient) GetGroup(ctx context.Context, in *GetGroupRequest, opts ...grpc.CallOption) (*GetGroupResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetGroupResponse) @@ -88,6 +99,7 @@ func (c *identityManagementServiceClient) GetGroupsForUser(ctx context.Context, // All implementations must embed UnimplementedIdentityManagementServiceServer // for forward compatibility. type IdentityManagementServiceServer interface { + GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) GetGroup(context.Context, *GetGroupRequest) (*GetGroupResponse, error) GetAllGroups(context.Context, *GetAllGroupsRequest) (*GetAllGroupsResponse, error) GetUsersForGroup(context.Context, *GetUsersForGroupRequest) (*GetUsersForGroupResponse, error) @@ -102,6 +114,9 @@ type IdentityManagementServiceServer interface { // pointer dereference when methods are called. type UnimplementedIdentityManagementServiceServer struct{} +func (UnimplementedIdentityManagementServiceServer) GetUser(context.Context, *GetUserRequest) (*GetUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetUser not implemented") +} func (UnimplementedIdentityManagementServiceServer) GetGroup(context.Context, *GetGroupRequest) (*GetGroupResponse, error) { return nil, status.Error(codes.Unimplemented, "method GetGroup not implemented") } @@ -136,6 +151,24 @@ func RegisterIdentityManagementServiceServer(s grpc.ServiceRegistrar, srv Identi s.RegisterService(&IdentityManagementService_ServiceDesc, srv) } +func _IdentityManagementService_GetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IdentityManagementServiceServer).GetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: IdentityManagementService_GetUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IdentityManagementServiceServer).GetUser(ctx, req.(*GetUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _IdentityManagementService_GetGroup_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetGroupRequest) if err := dec(in); err != nil { @@ -215,6 +248,10 @@ var IdentityManagementService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "plugin.identity_management.v1.IdentityManagementService", HandlerType: (*IdentityManagementServiceServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "GetUser", + Handler: _IdentityManagementService_GetUser_Handler, + }, { MethodName: "GetGroup", Handler: _IdentityManagementService_GetGroup_Handler, diff --git a/proto/plugin/keystore/common/v1/common.pb.go b/proto/plugin/keystore/common/v1/common.pb.go index 5012e42..4386c2a 100644 --- a/proto/plugin/keystore/common/v1/common.pb.go +++ b/proto/plugin/keystore/common/v1/common.pb.go @@ -1,19 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.35.1 // source: plugin/keystore/common/v1/common.proto package commonv1 import ( - reflect "reflect" - sync "sync" - unsafe "unsafe" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" structpb "google.golang.org/protobuf/types/known/structpb" + reflect "reflect" + sync "sync" + unsafe "unsafe" ) const ( @@ -75,8 +74,7 @@ const file_plugin_keystore_common_v1_common_proto_rawDesc = "" + "\n" + "&plugin/keystore/common/v1/common.proto\x12\x19plugin.keystore.common.v1\x1a\x1cgoogle/protobuf/struct.proto\"I\n" + "\x16KeystoreInstanceConfig\x12/\n" + - "\x06values\x18\x01 \x01(\v2\x17.google.protobuf.StructR\x06valuesB\xfb\x01\n" + - "\x1dcom.plugin.keystore.common.v1B\vCommonProtoP\x01ZFgithub.com/openkcm/plugin-sdk/proto/plugin/keystore/common/v1;commonv1\xa2\x02\x03PKC\xaa\x02\x19Plugin.Keystore.Common.V1\xca\x02\x19Plugin\\Keystore\\Common\\V1\xe2\x02%Plugin\\Keystore\\Common\\V1\\GPBMetadata\xea\x02\x1cPlugin::Keystore::Common::V1b\x06proto3" + "\x06values\x18\x01 \x01(\v2\x17.google.protobuf.StructR\x06valuesBHZFgithub.com/openkcm/plugin-sdk/proto/plugin/keystore/common/v1;commonv1b\x06proto3" var ( file_plugin_keystore_common_v1_common_proto_rawDescOnce sync.Once diff --git a/proto/plugin/keystore/common/v1/common.pb.validate.go b/proto/plugin/keystore/common/v1/common.pb.validate.go deleted file mode 100644 index 738dab4..0000000 --- a/proto/plugin/keystore/common/v1/common.pb.validate.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/keystore/common/v1/common.proto - -package commonv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on KeystoreInstanceConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *KeystoreInstanceConfig) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on KeystoreInstanceConfig with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// KeystoreInstanceConfigMultiError, or nil if none found. -func (m *KeystoreInstanceConfig) ValidateAll() error { - return m.validate(true) -} - -func (m *KeystoreInstanceConfig) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetValues()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, KeystoreInstanceConfigValidationError{ - field: "Values", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, KeystoreInstanceConfigValidationError{ - field: "Values", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValues()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return KeystoreInstanceConfigValidationError{ - field: "Values", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return KeystoreInstanceConfigMultiError(errors) - } - - return nil -} - -// KeystoreInstanceConfigMultiError is an error wrapping multiple validation -// errors returned by KeystoreInstanceConfig.ValidateAll() if the designated -// constraints aren't met. -type KeystoreInstanceConfigMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m KeystoreInstanceConfigMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m KeystoreInstanceConfigMultiError) AllErrors() []error { return m } - -// KeystoreInstanceConfigValidationError is the validation error returned by -// KeystoreInstanceConfig.Validate if the designated constraints aren't met. -type KeystoreInstanceConfigValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e KeystoreInstanceConfigValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e KeystoreInstanceConfigValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e KeystoreInstanceConfigValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e KeystoreInstanceConfigValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e KeystoreInstanceConfigValidationError) ErrorName() string { - return "KeystoreInstanceConfigValidationError" -} - -// Error satisfies the builtin error interface -func (e KeystoreInstanceConfigValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sKeystoreInstanceConfig.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = KeystoreInstanceConfigValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = KeystoreInstanceConfigValidationError{} diff --git a/proto/plugin/keystore/common/v1/common.proto b/proto/plugin/keystore/common/v1/common.proto index d0171f1..eb1926a 100644 --- a/proto/plugin/keystore/common/v1/common.proto +++ b/proto/plugin/keystore/common/v1/common.proto @@ -3,6 +3,8 @@ package plugin.keystore.common.v1; import "google/protobuf/struct.proto"; +option go_package = "github.com/openkcm/plugin-sdk/proto/plugin/keystore/common/v1;commonv1"; + // KeystoreInstanceConfig represents the configuration for a key store instance // This is shared between management and operations plugins message KeystoreInstanceConfig { diff --git a/proto/plugin/keystore/management/v1/management.pb.go b/proto/plugin/keystore/management/v1/management.pb.go index 4c2ff7d..8de0533 100644 --- a/proto/plugin/keystore/management/v1/management.pb.go +++ b/proto/plugin/keystore/management/v1/management.pb.go @@ -1,21 +1,19 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.35.1 // source: plugin/keystore/management/v1/management.proto package managementv1 import ( - reflect "reflect" - sync "sync" - unsafe "unsafe" - + v1 "github.com/openkcm/plugin-sdk/proto/plugin/keystore/common/v1" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" structpb "google.golang.org/protobuf/types/known/structpb" - - v1 "github.com/openkcm/plugin-sdk/proto/plugin/keystore/common/v1" + reflect "reflect" + sync "sync" + unsafe "unsafe" ) const ( @@ -25,6 +23,173 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// TrustType specifies whether a management or crypto role should be created. +type TrustType int32 + +const ( + TrustType_TRUST_TYPE_UNSPECIFIED TrustType = 0 + TrustType_TRUST_TYPE_MANAGEMENT TrustType = 1 + TrustType_TRUST_TYPE_CRYPTO TrustType = 2 +) + +// Enum value maps for TrustType. +var ( + TrustType_name = map[int32]string{ + 0: "TRUST_TYPE_UNSPECIFIED", + 1: "TRUST_TYPE_MANAGEMENT", + 2: "TRUST_TYPE_CRYPTO", + } + TrustType_value = map[string]int32{ + "TRUST_TYPE_UNSPECIFIED": 0, + "TRUST_TYPE_MANAGEMENT": 1, + "TRUST_TYPE_CRYPTO": 2, + } +) + +func (x TrustType) Enum() *TrustType { + p := new(TrustType) + *p = x + return p +} + +func (x TrustType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TrustType) Descriptor() protoreflect.EnumDescriptor { + return file_plugin_keystore_management_v1_management_proto_enumTypes[0].Descriptor() +} + +func (TrustType) Type() protoreflect.EnumType { + return &file_plugin_keystore_management_v1_management_proto_enumTypes[0] +} + +func (x TrustType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TrustType.Descriptor instead. +func (TrustType) EnumDescriptor() ([]byte, []int) { + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{0} +} + +// SupportedRegion represents a region where the keystore can be created or accessed. +type SupportedRegion struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + TechnicalName string `protobuf:"bytes,2,opt,name=technical_name,json=technicalName,proto3" json:"technical_name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SupportedRegion) Reset() { + *x = SupportedRegion{} + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SupportedRegion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupportedRegion) ProtoMessage() {} + +func (x *SupportedRegion) ProtoReflect() protoreflect.Message { + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SupportedRegion.ProtoReflect.Descriptor instead. +func (*SupportedRegion) Descriptor() ([]byte, []int) { + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{0} +} + +func (x *SupportedRegion) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *SupportedRegion) GetTechnicalName() string { + if x != nil { + return x.TechnicalName + } + return "" +} + +// ManagementConfig represents the configuration details for the management role of a keystore instance. +type ManagementConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + LocalityId string `protobuf:"bytes,1,opt,name=locality_id,json=localityId,proto3" json:"locality_id,omitempty"` + CommonName string `protobuf:"bytes,2,opt,name=common_name,json=commonName,proto3" json:"common_name,omitempty"` + AccessData *v1.KeystoreInstanceConfig `protobuf:"bytes,3,opt,name=access_data,json=accessData,proto3" json:"access_data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ManagementConfig) Reset() { + *x = ManagementConfig{} + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ManagementConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ManagementConfig) ProtoMessage() {} + +func (x *ManagementConfig) ProtoReflect() protoreflect.Message { + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ManagementConfig.ProtoReflect.Descriptor instead. +func (*ManagementConfig) Descriptor() ([]byte, []int) { + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{1} +} + +func (x *ManagementConfig) GetLocalityId() string { + if x != nil { + return x.LocalityId + } + return "" +} + +func (x *ManagementConfig) GetCommonName() string { + if x != nil { + return x.CommonName + } + return "" +} + +func (x *ManagementConfig) GetAccessData() *v1.KeystoreInstanceConfig { + if x != nil { + return x.AccessData + } + return nil +} + +// CreateKeystoreRequest represents the request to create a new keystore instance. +// The values field contains the necessary parameters for creating the keystore, +// which can vary depending on the implementation and requirements of the keystore provider. type CreateKeystoreRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Values *structpb.Struct `protobuf:"bytes,1,opt,name=values,proto3" json:"values,omitempty"` @@ -34,7 +199,7 @@ type CreateKeystoreRequest struct { func (x *CreateKeystoreRequest) Reset() { *x = CreateKeystoreRequest{} - mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[0] + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -46,7 +211,7 @@ func (x *CreateKeystoreRequest) String() string { func (*CreateKeystoreRequest) ProtoMessage() {} func (x *CreateKeystoreRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[0] + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -59,7 +224,7 @@ func (x *CreateKeystoreRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateKeystoreRequest.ProtoReflect.Descriptor instead. func (*CreateKeystoreRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{0} + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{2} } func (x *CreateKeystoreRequest) GetValues() *structpb.Struct { @@ -69,16 +234,23 @@ func (x *CreateKeystoreRequest) GetValues() *structpb.Struct { return nil } +// CreateKeystoreResponse represents the response after creating a new keystore instance. +// - The config field (deprecated) contains the configuration details of the created keystore instance, +// including fields: locality_id, common_name, management_access_data, and supported_regions. type CreateKeystoreResponse struct { - state protoimpl.MessageState `protogen:"open.v1"` - Config *v1.KeystoreInstanceConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + // Deprecated: Marked as deprecated in plugin/keystore/management/v1/management.proto. + Config *v1.KeystoreInstanceConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + RoleManagementConfig *ManagementConfig `protobuf:"bytes,2,opt,name=role_management_config,json=roleManagementConfig,proto3" json:"role_management_config,omitempty"` + KeyManagementConfig *ManagementConfig `protobuf:"bytes,3,opt,name=key_management_config,json=keyManagementConfig,proto3" json:"key_management_config,omitempty"` + SupportedRegions []*SupportedRegion `protobuf:"bytes,4,rep,name=supported_regions,json=supportedRegions,proto3" json:"supported_regions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *CreateKeystoreResponse) Reset() { *x = CreateKeystoreResponse{} - mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[1] + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -90,7 +262,7 @@ func (x *CreateKeystoreResponse) String() string { func (*CreateKeystoreResponse) ProtoMessage() {} func (x *CreateKeystoreResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[1] + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -103,9 +275,10 @@ func (x *CreateKeystoreResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateKeystoreResponse.ProtoReflect.Descriptor instead. func (*CreateKeystoreResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{1} + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{3} } +// Deprecated: Marked as deprecated in plugin/keystore/management/v1/management.proto. func (x *CreateKeystoreResponse) GetConfig() *v1.KeystoreInstanceConfig { if x != nil { return x.Config @@ -113,6 +286,27 @@ func (x *CreateKeystoreResponse) GetConfig() *v1.KeystoreInstanceConfig { return nil } +func (x *CreateKeystoreResponse) GetRoleManagementConfig() *ManagementConfig { + if x != nil { + return x.RoleManagementConfig + } + return nil +} + +func (x *CreateKeystoreResponse) GetKeyManagementConfig() *ManagementConfig { + if x != nil { + return x.KeyManagementConfig + } + return nil +} + +func (x *CreateKeystoreResponse) GetSupportedRegions() []*SupportedRegion { + if x != nil { + return x.SupportedRegions + } + return nil +} + type DeleteKeystoreRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Config *v1.KeystoreInstanceConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` @@ -122,7 +316,7 @@ type DeleteKeystoreRequest struct { func (x *DeleteKeystoreRequest) Reset() { *x = DeleteKeystoreRequest{} - mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[2] + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -134,7 +328,7 @@ func (x *DeleteKeystoreRequest) String() string { func (*DeleteKeystoreRequest) ProtoMessage() {} func (x *DeleteKeystoreRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[2] + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -147,7 +341,7 @@ func (x *DeleteKeystoreRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteKeystoreRequest.ProtoReflect.Descriptor instead. func (*DeleteKeystoreRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{2} + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{4} } func (x *DeleteKeystoreRequest) GetConfig() *v1.KeystoreInstanceConfig { @@ -165,7 +359,7 @@ type DeleteKeystoreResponse struct { func (x *DeleteKeystoreResponse) Reset() { *x = DeleteKeystoreResponse{} - mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[3] + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -177,7 +371,7 @@ func (x *DeleteKeystoreResponse) String() string { func (*DeleteKeystoreResponse) ProtoMessage() {} func (x *DeleteKeystoreResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[3] + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -190,25 +384,271 @@ func (x *DeleteKeystoreResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteKeystoreResponse.ProtoReflect.Descriptor instead. func (*DeleteKeystoreResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{3} + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{5} +} + +// GrantTrustRequest represents the request to grant trust to a client certificate subject pattern +// for accessing a keystore instance from the crypto layer. +// - The config field contains the authentication configuration of the role management role for the keystore instance, +// which is used to authenticate the request to grant trust. +// - The subject field contains the client certificate subject to grant trust to +// - The region field specifies the logical region for which the trust is being granted +// - The type field specifies whether to create a management or crypto role +type GrantTrustRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Config *v1.KeystoreInstanceConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + Subject string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"` + Region string `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"` + Type TrustType `protobuf:"varint,4,opt,name=type,proto3,enum=plugin.keystore.management.v1.TrustType" json:"type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrantTrustRequest) Reset() { + *x = GrantTrustRequest{} + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrantTrustRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrantTrustRequest) ProtoMessage() {} + +func (x *GrantTrustRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrantTrustRequest.ProtoReflect.Descriptor instead. +func (*GrantTrustRequest) Descriptor() ([]byte, []int) { + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{6} +} + +func (x *GrantTrustRequest) GetConfig() *v1.KeystoreInstanceConfig { + if x != nil { + return x.Config + } + return nil +} + +func (x *GrantTrustRequest) GetSubject() string { + if x != nil { + return x.Subject + } + return "" +} + +func (x *GrantTrustRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *GrantTrustRequest) GetType() TrustType { + if x != nil { + return x.Type + } + return TrustType_TRUST_TYPE_UNSPECIFIED +} + +// GrantTrustResponse represents the response after granting trust to a client certificate subject pattern +// for accessing a keystore instance. Returns the access data of the configured trust +type GrantTrustResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + AccessData *structpb.Struct `protobuf:"bytes,1,opt,name=access_data,json=accessData,proto3" json:"access_data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GrantTrustResponse) Reset() { + *x = GrantTrustResponse{} + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GrantTrustResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GrantTrustResponse) ProtoMessage() {} + +func (x *GrantTrustResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GrantTrustResponse.ProtoReflect.Descriptor instead. +func (*GrantTrustResponse) Descriptor() ([]byte, []int) { + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{7} +} + +func (x *GrantTrustResponse) GetAccessData() *structpb.Struct { + if x != nil { + return x.AccessData + } + return nil +} + +// RemoveTrustRequest represents the request to remove trust for a client certificate subject pattern +// to revoke access to a keystore instance. +// - The config field contains the authentication configuration of the role management role for the keystore instance, +// which is used to authenticate the request to remove trust. +// - The access_data field contains the access data of the trust to be removed +type RemoveTrustRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Config *v1.KeystoreInstanceConfig `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` + AccessData *structpb.Struct `protobuf:"bytes,2,opt,name=access_data,json=accessData,proto3" json:"access_data,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveTrustRequest) Reset() { + *x = RemoveTrustRequest{} + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveTrustRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveTrustRequest) ProtoMessage() {} + +func (x *RemoveTrustRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveTrustRequest.ProtoReflect.Descriptor instead. +func (*RemoveTrustRequest) Descriptor() ([]byte, []int) { + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{8} +} + +func (x *RemoveTrustRequest) GetConfig() *v1.KeystoreInstanceConfig { + if x != nil { + return x.Config + } + return nil +} + +func (x *RemoveTrustRequest) GetAccessData() *structpb.Struct { + if x != nil { + return x.AccessData + } + return nil +} + +type RemoveTrustResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveTrustResponse) Reset() { + *x = RemoveTrustResponse{} + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveTrustResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveTrustResponse) ProtoMessage() {} + +func (x *RemoveTrustResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_keystore_management_v1_management_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveTrustResponse.ProtoReflect.Descriptor instead. +func (*RemoveTrustResponse) Descriptor() ([]byte, []int) { + return file_plugin_keystore_management_v1_management_proto_rawDescGZIP(), []int{9} } var File_plugin_keystore_management_v1_management_proto protoreflect.FileDescriptor const file_plugin_keystore_management_v1_management_proto_rawDesc = "" + "\n" + - ".plugin/keystore/management/v1/management.proto\x12\x1dplugin.keystore.management.v1\x1a\x1cgoogle/protobuf/struct.proto\x1a&plugin/keystore/common/v1/common.proto\"H\n" + + ".plugin/keystore/management/v1/management.proto\x12\x1dplugin.keystore.management.v1\x1a\x1cgoogle/protobuf/struct.proto\x1a&plugin/keystore/common/v1/common.proto\"L\n" + + "\x0fSupportedRegion\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12%\n" + + "\x0etechnical_name\x18\x02 \x01(\tR\rtechnicalName\"\xa8\x01\n" + + "\x10ManagementConfig\x12\x1f\n" + + "\vlocality_id\x18\x01 \x01(\tR\n" + + "localityId\x12\x1f\n" + + "\vcommon_name\x18\x02 \x01(\tR\n" + + "commonName\x12R\n" + + "\vaccess_data\x18\x03 \x01(\v21.plugin.keystore.common.v1.KeystoreInstanceConfigR\n" + + "accessData\"H\n" + "\x15CreateKeystoreRequest\x12/\n" + - "\x06values\x18\x01 \x01(\v2\x17.google.protobuf.StructR\x06values\"c\n" + - "\x16CreateKeystoreResponse\x12I\n" + - "\x06config\x18\x01 \x01(\v21.plugin.keystore.common.v1.KeystoreInstanceConfigR\x06config\"b\n" + + "\x06values\x18\x01 \x01(\v2\x17.google.protobuf.StructR\x06values\"\x90\x03\n" + + "\x16CreateKeystoreResponse\x12M\n" + + "\x06config\x18\x01 \x01(\v21.plugin.keystore.common.v1.KeystoreInstanceConfigB\x02\x18\x01R\x06config\x12e\n" + + "\x16role_management_config\x18\x02 \x01(\v2/.plugin.keystore.management.v1.ManagementConfigR\x14roleManagementConfig\x12c\n" + + "\x15key_management_config\x18\x03 \x01(\v2/.plugin.keystore.management.v1.ManagementConfigR\x13keyManagementConfig\x12[\n" + + "\x11supported_regions\x18\x04 \x03(\v2..plugin.keystore.management.v1.SupportedRegionR\x10supportedRegions\"b\n" + "\x15DeleteKeystoreRequest\x12I\n" + "\x06config\x18\x01 \x01(\v21.plugin.keystore.common.v1.KeystoreInstanceConfigR\x06config\"\x18\n" + - "\x16DeleteKeystoreResponse2\x90\x02\n" + + "\x16DeleteKeystoreResponse\"\xce\x01\n" + + "\x11GrantTrustRequest\x12I\n" + + "\x06config\x18\x01 \x01(\v21.plugin.keystore.common.v1.KeystoreInstanceConfigR\x06config\x12\x18\n" + + "\asubject\x18\x02 \x01(\tR\asubject\x12\x16\n" + + "\x06region\x18\x03 \x01(\tR\x06region\x12<\n" + + "\x04type\x18\x04 \x01(\x0e2(.plugin.keystore.management.v1.TrustTypeR\x04type\"N\n" + + "\x12GrantTrustResponse\x128\n" + + "\vaccess_data\x18\x01 \x01(\v2\x17.google.protobuf.StructR\n" + + "accessData\"\x99\x01\n" + + "\x12RemoveTrustRequest\x12I\n" + + "\x06config\x18\x01 \x01(\v21.plugin.keystore.common.v1.KeystoreInstanceConfigR\x06config\x128\n" + + "\vaccess_data\x18\x02 \x01(\v2\x17.google.protobuf.StructR\n" + + "accessData\"\x15\n" + + "\x13RemoveTrustResponse*Y\n" + + "\tTrustType\x12\x1a\n" + + "\x16TRUST_TYPE_UNSPECIFIED\x10\x00\x12\x19\n" + + "\x15TRUST_TYPE_MANAGEMENT\x10\x01\x12\x15\n" + + "\x11TRUST_TYPE_CRYPTO\x10\x022\xf9\x03\n" + "\x10KeystoreProvider\x12}\n" + "\x0eCreateKeystore\x124.plugin.keystore.management.v1.CreateKeystoreRequest\x1a5.plugin.keystore.management.v1.CreateKeystoreResponse\x12}\n" + - "\x0eDeleteKeystore\x124.plugin.keystore.management.v1.DeleteKeystoreRequest\x1a5.plugin.keystore.management.v1.DeleteKeystoreResponseB\x9b\x02\n" + - "!com.plugin.keystore.management.v1B\x0fManagementProtoP\x01ZNgithub.com/openkcm/plugin-sdk/proto/plugin/keystore/management/v1;managementv1\xa2\x02\x03PKM\xaa\x02\x1dPlugin.Keystore.Management.V1\xca\x02\x1dPlugin\\Keystore\\Management\\V1\xe2\x02)Plugin\\Keystore\\Management\\V1\\GPBMetadata\xea\x02 Plugin::Keystore::Management::V1b\x06proto3" + "\x0eDeleteKeystore\x124.plugin.keystore.management.v1.DeleteKeystoreRequest\x1a5.plugin.keystore.management.v1.DeleteKeystoreResponse\x12q\n" + + "\n" + + "GrantTrust\x120.plugin.keystore.management.v1.GrantTrustRequest\x1a1.plugin.keystore.management.v1.GrantTrustResponse\x12t\n" + + "\vRemoveTrust\x121.plugin.keystore.management.v1.RemoveTrustRequest\x1a2.plugin.keystore.management.v1.RemoveTrustResponseBPZNgithub.com/openkcm/plugin-sdk/proto/plugin/keystore/management/v1;managementv1b\x06proto3" var ( file_plugin_keystore_management_v1_management_proto_rawDescOnce sync.Once @@ -222,28 +662,49 @@ func file_plugin_keystore_management_v1_management_proto_rawDescGZIP() []byte { return file_plugin_keystore_management_v1_management_proto_rawDescData } -var file_plugin_keystore_management_v1_management_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_plugin_keystore_management_v1_management_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_plugin_keystore_management_v1_management_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_plugin_keystore_management_v1_management_proto_goTypes = []any{ - (*CreateKeystoreRequest)(nil), // 0: plugin.keystore.management.v1.CreateKeystoreRequest - (*CreateKeystoreResponse)(nil), // 1: plugin.keystore.management.v1.CreateKeystoreResponse - (*DeleteKeystoreRequest)(nil), // 2: plugin.keystore.management.v1.DeleteKeystoreRequest - (*DeleteKeystoreResponse)(nil), // 3: plugin.keystore.management.v1.DeleteKeystoreResponse - (*structpb.Struct)(nil), // 4: google.protobuf.Struct - (*v1.KeystoreInstanceConfig)(nil), // 5: plugin.keystore.common.v1.KeystoreInstanceConfig + (TrustType)(0), // 0: plugin.keystore.management.v1.TrustType + (*SupportedRegion)(nil), // 1: plugin.keystore.management.v1.SupportedRegion + (*ManagementConfig)(nil), // 2: plugin.keystore.management.v1.ManagementConfig + (*CreateKeystoreRequest)(nil), // 3: plugin.keystore.management.v1.CreateKeystoreRequest + (*CreateKeystoreResponse)(nil), // 4: plugin.keystore.management.v1.CreateKeystoreResponse + (*DeleteKeystoreRequest)(nil), // 5: plugin.keystore.management.v1.DeleteKeystoreRequest + (*DeleteKeystoreResponse)(nil), // 6: plugin.keystore.management.v1.DeleteKeystoreResponse + (*GrantTrustRequest)(nil), // 7: plugin.keystore.management.v1.GrantTrustRequest + (*GrantTrustResponse)(nil), // 8: plugin.keystore.management.v1.GrantTrustResponse + (*RemoveTrustRequest)(nil), // 9: plugin.keystore.management.v1.RemoveTrustRequest + (*RemoveTrustResponse)(nil), // 10: plugin.keystore.management.v1.RemoveTrustResponse + (*v1.KeystoreInstanceConfig)(nil), // 11: plugin.keystore.common.v1.KeystoreInstanceConfig + (*structpb.Struct)(nil), // 12: google.protobuf.Struct } var file_plugin_keystore_management_v1_management_proto_depIdxs = []int32{ - 4, // 0: plugin.keystore.management.v1.CreateKeystoreRequest.values:type_name -> google.protobuf.Struct - 5, // 1: plugin.keystore.management.v1.CreateKeystoreResponse.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig - 5, // 2: plugin.keystore.management.v1.DeleteKeystoreRequest.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig - 0, // 3: plugin.keystore.management.v1.KeystoreProvider.CreateKeystore:input_type -> plugin.keystore.management.v1.CreateKeystoreRequest - 2, // 4: plugin.keystore.management.v1.KeystoreProvider.DeleteKeystore:input_type -> plugin.keystore.management.v1.DeleteKeystoreRequest - 1, // 5: plugin.keystore.management.v1.KeystoreProvider.CreateKeystore:output_type -> plugin.keystore.management.v1.CreateKeystoreResponse - 3, // 6: plugin.keystore.management.v1.KeystoreProvider.DeleteKeystore:output_type -> plugin.keystore.management.v1.DeleteKeystoreResponse - 5, // [5:7] is the sub-list for method output_type - 3, // [3:5] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 11, // 0: plugin.keystore.management.v1.ManagementConfig.access_data:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig + 12, // 1: plugin.keystore.management.v1.CreateKeystoreRequest.values:type_name -> google.protobuf.Struct + 11, // 2: plugin.keystore.management.v1.CreateKeystoreResponse.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig + 2, // 3: plugin.keystore.management.v1.CreateKeystoreResponse.role_management_config:type_name -> plugin.keystore.management.v1.ManagementConfig + 2, // 4: plugin.keystore.management.v1.CreateKeystoreResponse.key_management_config:type_name -> plugin.keystore.management.v1.ManagementConfig + 1, // 5: plugin.keystore.management.v1.CreateKeystoreResponse.supported_regions:type_name -> plugin.keystore.management.v1.SupportedRegion + 11, // 6: plugin.keystore.management.v1.DeleteKeystoreRequest.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig + 11, // 7: plugin.keystore.management.v1.GrantTrustRequest.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig + 0, // 8: plugin.keystore.management.v1.GrantTrustRequest.type:type_name -> plugin.keystore.management.v1.TrustType + 12, // 9: plugin.keystore.management.v1.GrantTrustResponse.access_data:type_name -> google.protobuf.Struct + 11, // 10: plugin.keystore.management.v1.RemoveTrustRequest.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig + 12, // 11: plugin.keystore.management.v1.RemoveTrustRequest.access_data:type_name -> google.protobuf.Struct + 3, // 12: plugin.keystore.management.v1.KeystoreProvider.CreateKeystore:input_type -> plugin.keystore.management.v1.CreateKeystoreRequest + 5, // 13: plugin.keystore.management.v1.KeystoreProvider.DeleteKeystore:input_type -> plugin.keystore.management.v1.DeleteKeystoreRequest + 7, // 14: plugin.keystore.management.v1.KeystoreProvider.GrantTrust:input_type -> plugin.keystore.management.v1.GrantTrustRequest + 9, // 15: plugin.keystore.management.v1.KeystoreProvider.RemoveTrust:input_type -> plugin.keystore.management.v1.RemoveTrustRequest + 4, // 16: plugin.keystore.management.v1.KeystoreProvider.CreateKeystore:output_type -> plugin.keystore.management.v1.CreateKeystoreResponse + 6, // 17: plugin.keystore.management.v1.KeystoreProvider.DeleteKeystore:output_type -> plugin.keystore.management.v1.DeleteKeystoreResponse + 8, // 18: plugin.keystore.management.v1.KeystoreProvider.GrantTrust:output_type -> plugin.keystore.management.v1.GrantTrustResponse + 10, // 19: plugin.keystore.management.v1.KeystoreProvider.RemoveTrust:output_type -> plugin.keystore.management.v1.RemoveTrustResponse + 16, // [16:20] is the sub-list for method output_type + 12, // [12:16] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_plugin_keystore_management_v1_management_proto_init() } @@ -256,13 +717,14 @@ func file_plugin_keystore_management_v1_management_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_keystore_management_v1_management_proto_rawDesc), len(file_plugin_keystore_management_v1_management_proto_rawDesc)), - NumEnums: 0, - NumMessages: 4, + NumEnums: 1, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, GoTypes: file_plugin_keystore_management_v1_management_proto_goTypes, DependencyIndexes: file_plugin_keystore_management_v1_management_proto_depIdxs, + EnumInfos: file_plugin_keystore_management_v1_management_proto_enumTypes, MessageInfos: file_plugin_keystore_management_v1_management_proto_msgTypes, }.Build() File_plugin_keystore_management_v1_management_proto = out.File diff --git a/proto/plugin/keystore/management/v1/management.pb.validate.go b/proto/plugin/keystore/management/v1/management.pb.validate.go deleted file mode 100644 index 1610df6..0000000 --- a/proto/plugin/keystore/management/v1/management.pb.validate.go +++ /dev/null @@ -1,531 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/keystore/management/v1/management.proto - -package managementv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on CreateKeystoreRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CreateKeystoreRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CreateKeystoreRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CreateKeystoreRequestMultiError, or nil if none found. -func (m *CreateKeystoreRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *CreateKeystoreRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetValues()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CreateKeystoreRequestValidationError{ - field: "Values", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CreateKeystoreRequestValidationError{ - field: "Values", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetValues()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CreateKeystoreRequestValidationError{ - field: "Values", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return CreateKeystoreRequestMultiError(errors) - } - - return nil -} - -// CreateKeystoreRequestMultiError is an error wrapping multiple validation -// errors returned by CreateKeystoreRequest.ValidateAll() if the designated -// constraints aren't met. -type CreateKeystoreRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CreateKeystoreRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CreateKeystoreRequestMultiError) AllErrors() []error { return m } - -// CreateKeystoreRequestValidationError is the validation error returned by -// CreateKeystoreRequest.Validate if the designated constraints aren't met. -type CreateKeystoreRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CreateKeystoreRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CreateKeystoreRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CreateKeystoreRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CreateKeystoreRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CreateKeystoreRequestValidationError) ErrorName() string { - return "CreateKeystoreRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e CreateKeystoreRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCreateKeystoreRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CreateKeystoreRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CreateKeystoreRequestValidationError{} - -// Validate checks the field values on CreateKeystoreResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *CreateKeystoreResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CreateKeystoreResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CreateKeystoreResponseMultiError, or nil if none found. -func (m *CreateKeystoreResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *CreateKeystoreResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CreateKeystoreResponseValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CreateKeystoreResponseValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CreateKeystoreResponseValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return CreateKeystoreResponseMultiError(errors) - } - - return nil -} - -// CreateKeystoreResponseMultiError is an error wrapping multiple validation -// errors returned by CreateKeystoreResponse.ValidateAll() if the designated -// constraints aren't met. -type CreateKeystoreResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CreateKeystoreResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CreateKeystoreResponseMultiError) AllErrors() []error { return m } - -// CreateKeystoreResponseValidationError is the validation error returned by -// CreateKeystoreResponse.Validate if the designated constraints aren't met. -type CreateKeystoreResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CreateKeystoreResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CreateKeystoreResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CreateKeystoreResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CreateKeystoreResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CreateKeystoreResponseValidationError) ErrorName() string { - return "CreateKeystoreResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e CreateKeystoreResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCreateKeystoreResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CreateKeystoreResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CreateKeystoreResponseValidationError{} - -// Validate checks the field values on DeleteKeystoreRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeleteKeystoreRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteKeystoreRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteKeystoreRequestMultiError, or nil if none found. -func (m *DeleteKeystoreRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteKeystoreRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DeleteKeystoreRequestValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DeleteKeystoreRequestValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeleteKeystoreRequestValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DeleteKeystoreRequestMultiError(errors) - } - - return nil -} - -// DeleteKeystoreRequestMultiError is an error wrapping multiple validation -// errors returned by DeleteKeystoreRequest.ValidateAll() if the designated -// constraints aren't met. -type DeleteKeystoreRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteKeystoreRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteKeystoreRequestMultiError) AllErrors() []error { return m } - -// DeleteKeystoreRequestValidationError is the validation error returned by -// DeleteKeystoreRequest.Validate if the designated constraints aren't met. -type DeleteKeystoreRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteKeystoreRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteKeystoreRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteKeystoreRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteKeystoreRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteKeystoreRequestValidationError) ErrorName() string { - return "DeleteKeystoreRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteKeystoreRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteKeystoreRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteKeystoreRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteKeystoreRequestValidationError{} - -// Validate checks the field values on DeleteKeystoreResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DeleteKeystoreResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteKeystoreResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteKeystoreResponseMultiError, or nil if none found. -func (m *DeleteKeystoreResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteKeystoreResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return DeleteKeystoreResponseMultiError(errors) - } - - return nil -} - -// DeleteKeystoreResponseMultiError is an error wrapping multiple validation -// errors returned by DeleteKeystoreResponse.ValidateAll() if the designated -// constraints aren't met. -type DeleteKeystoreResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteKeystoreResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteKeystoreResponseMultiError) AllErrors() []error { return m } - -// DeleteKeystoreResponseValidationError is the validation error returned by -// DeleteKeystoreResponse.Validate if the designated constraints aren't met. -type DeleteKeystoreResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteKeystoreResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteKeystoreResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteKeystoreResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteKeystoreResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteKeystoreResponseValidationError) ErrorName() string { - return "DeleteKeystoreResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteKeystoreResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteKeystoreResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteKeystoreResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteKeystoreResponseValidationError{} diff --git a/proto/plugin/keystore/management/v1/management.proto b/proto/plugin/keystore/management/v1/management.proto index 22d90e0..93e5bfd 100644 --- a/proto/plugin/keystore/management/v1/management.proto +++ b/proto/plugin/keystore/management/v1/management.proto @@ -4,17 +4,47 @@ package plugin.keystore.management.v1; import "google/protobuf/struct.proto"; import "plugin/keystore/common/v1/common.proto"; +option go_package = "github.com/openkcm/plugin-sdk/proto/plugin/keystore/management/v1;managementv1"; + service KeystoreProvider { + // Create a new keystore instance rpc CreateKeystore(CreateKeystoreRequest) returns (CreateKeystoreResponse); + // Delete an existing keystore instance rpc DeleteKeystore(DeleteKeystoreRequest) returns (DeleteKeystoreResponse); + // Grant trust to a client certificate subject pattern for accessing the keystore instance + rpc GrantTrust(GrantTrustRequest) returns (GrantTrustResponse); + // Remove trust for a client certificate subject pattern to revoke access to the keystore instance + rpc RemoveTrust(RemoveTrustRequest) returns (RemoveTrustResponse); +} + +// SupportedRegion represents a region where the keystore can be created or accessed. +message SupportedRegion { + string name = 1; + string technical_name = 2; +} + +// ManagementConfig represents the configuration details for the management role of a keystore instance. +message ManagementConfig { + string locality_id = 1; + string common_name = 2; + plugin.keystore.common.v1.KeystoreInstanceConfig access_data = 3; } +// CreateKeystoreRequest represents the request to create a new keystore instance. +// The values field contains the necessary parameters for creating the keystore, +// which can vary depending on the implementation and requirements of the keystore provider. message CreateKeystoreRequest { google.protobuf.Struct values = 1; } +// CreateKeystoreResponse represents the response after creating a new keystore instance. +// - The config field (deprecated) contains the configuration details of the created keystore instance, +// including fields: locality_id, common_name, management_access_data, and supported_regions. message CreateKeystoreResponse { - plugin.keystore.common.v1.KeystoreInstanceConfig config = 1; + plugin.keystore.common.v1.KeystoreInstanceConfig config = 1 [deprecated = true]; + ManagementConfig role_management_config = 2; + ManagementConfig key_management_config = 3; + repeated SupportedRegion supported_regions = 4; } message DeleteKeystoreRequest { @@ -22,3 +52,42 @@ message DeleteKeystoreRequest { } message DeleteKeystoreResponse {} + +// TrustType specifies whether a management or crypto role should be created. +enum TrustType { + TRUST_TYPE_UNSPECIFIED = 0; + TRUST_TYPE_MANAGEMENT = 1; + TRUST_TYPE_CRYPTO = 2; +} + +// GrantTrustRequest represents the request to grant trust to a client certificate subject pattern +// for accessing a keystore instance from the crypto layer. +// - The config field contains the authentication configuration of the role management role for the keystore instance, +// which is used to authenticate the request to grant trust. +// - The subject field contains the client certificate subject to grant trust to +// - The region field specifies the logical region for which the trust is being granted +// - The type field specifies whether to create a management or crypto role +message GrantTrustRequest { + plugin.keystore.common.v1.KeystoreInstanceConfig config = 1; + string subject = 2; + string region = 3; + TrustType type = 4; +} + +// GrantTrustResponse represents the response after granting trust to a client certificate subject pattern +// for accessing a keystore instance. Returns the access data of the configured trust +message GrantTrustResponse { + google.protobuf.Struct access_data = 1; +} + +// RemoveTrustRequest represents the request to remove trust for a client certificate subject pattern +// to revoke access to a keystore instance. +// - The config field contains the authentication configuration of the role management role for the keystore instance, +// which is used to authenticate the request to remove trust. +// - The access_data field contains the access data of the trust to be removed +message RemoveTrustRequest { + plugin.keystore.common.v1.KeystoreInstanceConfig config = 1; + google.protobuf.Struct access_data = 2; +} + +message RemoveTrustResponse {} diff --git a/proto/plugin/keystore/management/v1/management_ext_plugin.pb.go b/proto/plugin/keystore/management/v1/management_ext_plugin.pb.go index 8241336..76ce1ab 100644 --- a/proto/plugin/keystore/management/v1/management_ext_plugin.pb.go +++ b/proto/plugin/keystore/management/v1/management_ext_plugin.pb.go @@ -3,9 +3,8 @@ package managementv1 import ( - grpc "google.golang.org/grpc" - api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" ) const ( diff --git a/proto/plugin/keystore/management/v1/management_grpc.pb.go b/proto/plugin/keystore/management/v1/management_grpc.pb.go index 0f12e10..ec9b6a6 100644 --- a/proto/plugin/keystore/management/v1/management_grpc.pb.go +++ b/proto/plugin/keystore/management/v1/management_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.35.1 // source: plugin/keystore/management/v1/management.proto package managementv1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -22,14 +21,22 @@ const _ = grpc.SupportPackageIsVersion9 const ( KeystoreProvider_CreateKeystore_FullMethodName = "/plugin.keystore.management.v1.KeystoreProvider/CreateKeystore" KeystoreProvider_DeleteKeystore_FullMethodName = "/plugin.keystore.management.v1.KeystoreProvider/DeleteKeystore" + KeystoreProvider_GrantTrust_FullMethodName = "/plugin.keystore.management.v1.KeystoreProvider/GrantTrust" + KeystoreProvider_RemoveTrust_FullMethodName = "/plugin.keystore.management.v1.KeystoreProvider/RemoveTrust" ) // KeystoreProviderClient is the client API for KeystoreProvider service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type KeystoreProviderClient interface { + // Create a new keystore instance CreateKeystore(ctx context.Context, in *CreateKeystoreRequest, opts ...grpc.CallOption) (*CreateKeystoreResponse, error) + // Delete an existing keystore instance DeleteKeystore(ctx context.Context, in *DeleteKeystoreRequest, opts ...grpc.CallOption) (*DeleteKeystoreResponse, error) + // Grant trust to a client certificate subject pattern for accessing the keystore instance + GrantTrust(ctx context.Context, in *GrantTrustRequest, opts ...grpc.CallOption) (*GrantTrustResponse, error) + // Remove trust for a client certificate subject pattern to revoke access to the keystore instance + RemoveTrust(ctx context.Context, in *RemoveTrustRequest, opts ...grpc.CallOption) (*RemoveTrustResponse, error) } type keystoreProviderClient struct { @@ -60,12 +67,38 @@ func (c *keystoreProviderClient) DeleteKeystore(ctx context.Context, in *DeleteK return out, nil } +func (c *keystoreProviderClient) GrantTrust(ctx context.Context, in *GrantTrustRequest, opts ...grpc.CallOption) (*GrantTrustResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GrantTrustResponse) + err := c.cc.Invoke(ctx, KeystoreProvider_GrantTrust_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *keystoreProviderClient) RemoveTrust(ctx context.Context, in *RemoveTrustRequest, opts ...grpc.CallOption) (*RemoveTrustResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RemoveTrustResponse) + err := c.cc.Invoke(ctx, KeystoreProvider_RemoveTrust_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // KeystoreProviderServer is the server API for KeystoreProvider service. // All implementations must embed UnimplementedKeystoreProviderServer // for forward compatibility. type KeystoreProviderServer interface { + // Create a new keystore instance CreateKeystore(context.Context, *CreateKeystoreRequest) (*CreateKeystoreResponse, error) + // Delete an existing keystore instance DeleteKeystore(context.Context, *DeleteKeystoreRequest) (*DeleteKeystoreResponse, error) + // Grant trust to a client certificate subject pattern for accessing the keystore instance + GrantTrust(context.Context, *GrantTrustRequest) (*GrantTrustResponse, error) + // Remove trust for a client certificate subject pattern to revoke access to the keystore instance + RemoveTrust(context.Context, *RemoveTrustRequest) (*RemoveTrustResponse, error) mustEmbedUnimplementedKeystoreProviderServer() } @@ -82,6 +115,12 @@ func (UnimplementedKeystoreProviderServer) CreateKeystore(context.Context, *Crea func (UnimplementedKeystoreProviderServer) DeleteKeystore(context.Context, *DeleteKeystoreRequest) (*DeleteKeystoreResponse, error) { return nil, status.Error(codes.Unimplemented, "method DeleteKeystore not implemented") } +func (UnimplementedKeystoreProviderServer) GrantTrust(context.Context, *GrantTrustRequest) (*GrantTrustResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GrantTrust not implemented") +} +func (UnimplementedKeystoreProviderServer) RemoveTrust(context.Context, *RemoveTrustRequest) (*RemoveTrustResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RemoveTrust not implemented") +} func (UnimplementedKeystoreProviderServer) mustEmbedUnimplementedKeystoreProviderServer() {} func (UnimplementedKeystoreProviderServer) testEmbeddedByValue() {} @@ -139,6 +178,42 @@ func _KeystoreProvider_DeleteKeystore_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _KeystoreProvider_GrantTrust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GrantTrustRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeystoreProviderServer).GrantTrust(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KeystoreProvider_GrantTrust_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeystoreProviderServer).GrantTrust(ctx, req.(*GrantTrustRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KeystoreProvider_RemoveTrust_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveTrustRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeystoreProviderServer).RemoveTrust(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KeystoreProvider_RemoveTrust_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeystoreProviderServer).RemoveTrust(ctx, req.(*RemoveTrustRequest)) + } + return interceptor(ctx, in, info, handler) +} + // KeystoreProvider_ServiceDesc is the grpc.ServiceDesc for KeystoreProvider service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -154,6 +229,14 @@ var KeystoreProvider_ServiceDesc = grpc.ServiceDesc{ MethodName: "DeleteKeystore", Handler: _KeystoreProvider_DeleteKeystore_Handler, }, + { + MethodName: "GrantTrust", + Handler: _KeystoreProvider_GrantTrust_Handler, + }, + { + MethodName: "RemoveTrust", + Handler: _KeystoreProvider_RemoveTrust_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "plugin/keystore/management/v1/management.proto", diff --git a/proto/plugin/keystore/operations/v1/operations.pb.go b/proto/plugin/keystore/operations/v1/operations.pb.go index f067d4a..7c0ac53 100644 --- a/proto/plugin/keystore/operations/v1/operations.pb.go +++ b/proto/plugin/keystore/operations/v1/operations.pb.go @@ -1,22 +1,20 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.35.1 // source: plugin/keystore/operations/v1/operations.proto package operationsv1 import ( - reflect "reflect" - sync "sync" - unsafe "unsafe" - + v1 "github.com/openkcm/plugin-sdk/proto/plugin/keystore/common/v1" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" structpb "google.golang.org/protobuf/types/known/structpb" timestamppb "google.golang.org/protobuf/types/known/timestamppb" - - v1 "github.com/openkcm/plugin-sdk/proto/plugin/keystore/common/v1" + reflect "reflect" + sync "sync" + unsafe "unsafe" ) const ( @@ -313,6 +311,94 @@ func (x *GetKeyResponse) GetLatestRotationTime() *timestamppb.Timestamp { return nil } +type GetKeyVersionsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Parameters *RequestParameters `protobuf:"bytes,1,opt,name=parameters,proto3" json:"parameters,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetKeyVersionsRequest) Reset() { + *x = GetKeyVersionsRequest{} + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetKeyVersionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetKeyVersionsRequest) ProtoMessage() {} + +func (x *GetKeyVersionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetKeyVersionsRequest.ProtoReflect.Descriptor instead. +func (*GetKeyVersionsRequest) Descriptor() ([]byte, []int) { + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{3} +} + +func (x *GetKeyVersionsRequest) GetParameters() *RequestParameters { + if x != nil { + return x.Parameters + } + return nil +} + +type GetKeyVersionsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Versions []*GetKeyVersionsResponse_KeyVersion `protobuf:"bytes,1,rep,name=versions,proto3" json:"versions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetKeyVersionsResponse) Reset() { + *x = GetKeyVersionsResponse{} + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetKeyVersionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetKeyVersionsResponse) ProtoMessage() {} + +func (x *GetKeyVersionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetKeyVersionsResponse.ProtoReflect.Descriptor instead. +func (*GetKeyVersionsResponse) Descriptor() ([]byte, []int) { + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{4} +} + +func (x *GetKeyVersionsResponse) GetVersions() []*GetKeyVersionsResponse_KeyVersion { + if x != nil { + return x.Versions + } + return nil +} + // CreateKeyRequest contains parameters for key creation type CreateKeyRequest struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -327,7 +413,7 @@ type CreateKeyRequest struct { func (x *CreateKeyRequest) Reset() { *x = CreateKeyRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[3] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -339,7 +425,7 @@ func (x *CreateKeyRequest) String() string { func (*CreateKeyRequest) ProtoMessage() {} func (x *CreateKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[3] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -352,7 +438,7 @@ func (x *CreateKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateKeyRequest.ProtoReflect.Descriptor instead. func (*CreateKeyRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{3} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{5} } func (x *CreateKeyRequest) GetConfig() *v1.KeystoreInstanceConfig { @@ -400,7 +486,7 @@ type CreateKeyResponse struct { func (x *CreateKeyResponse) Reset() { *x = CreateKeyResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[4] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -412,7 +498,7 @@ func (x *CreateKeyResponse) String() string { func (*CreateKeyResponse) ProtoMessage() {} func (x *CreateKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[4] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -425,7 +511,7 @@ func (x *CreateKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateKeyResponse.ProtoReflect.Descriptor instead. func (*CreateKeyResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{4} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{6} } func (x *CreateKeyResponse) GetKeyId() string { @@ -453,7 +539,7 @@ type DeleteKeyRequest struct { func (x *DeleteKeyRequest) Reset() { *x = DeleteKeyRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[5] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -465,7 +551,7 @@ func (x *DeleteKeyRequest) String() string { func (*DeleteKeyRequest) ProtoMessage() {} func (x *DeleteKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[5] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -478,7 +564,7 @@ func (x *DeleteKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteKeyRequest.ProtoReflect.Descriptor instead. func (*DeleteKeyRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{5} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{7} } func (x *DeleteKeyRequest) GetParameters() *RequestParameters { @@ -503,7 +589,7 @@ type DeleteKeyResponse struct { func (x *DeleteKeyResponse) Reset() { *x = DeleteKeyResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[6] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -515,7 +601,7 @@ func (x *DeleteKeyResponse) String() string { func (*DeleteKeyResponse) ProtoMessage() {} func (x *DeleteKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[6] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -528,7 +614,7 @@ func (x *DeleteKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteKeyResponse.ProtoReflect.Descriptor instead. func (*DeleteKeyResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{6} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{8} } // EnableKeyRequest contains parameters for key enablement @@ -541,7 +627,7 @@ type EnableKeyRequest struct { func (x *EnableKeyRequest) Reset() { *x = EnableKeyRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[7] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -553,7 +639,7 @@ func (x *EnableKeyRequest) String() string { func (*EnableKeyRequest) ProtoMessage() {} func (x *EnableKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[7] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -566,7 +652,7 @@ func (x *EnableKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use EnableKeyRequest.ProtoReflect.Descriptor instead. func (*EnableKeyRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{7} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{9} } func (x *EnableKeyRequest) GetParameters() *RequestParameters { @@ -584,7 +670,7 @@ type EnableKeyResponse struct { func (x *EnableKeyResponse) Reset() { *x = EnableKeyResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[8] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -596,7 +682,7 @@ func (x *EnableKeyResponse) String() string { func (*EnableKeyResponse) ProtoMessage() {} func (x *EnableKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[8] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -609,7 +695,7 @@ func (x *EnableKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use EnableKeyResponse.ProtoReflect.Descriptor instead. func (*EnableKeyResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{8} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{10} } // DisableKeyRequest contains parameters for key disablement @@ -622,7 +708,7 @@ type DisableKeyRequest struct { func (x *DisableKeyRequest) Reset() { *x = DisableKeyRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[9] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -634,7 +720,7 @@ func (x *DisableKeyRequest) String() string { func (*DisableKeyRequest) ProtoMessage() {} func (x *DisableKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[9] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -647,7 +733,7 @@ func (x *DisableKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DisableKeyRequest.ProtoReflect.Descriptor instead. func (*DisableKeyRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{9} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{11} } func (x *DisableKeyRequest) GetParameters() *RequestParameters { @@ -665,7 +751,7 @@ type DisableKeyResponse struct { func (x *DisableKeyResponse) Reset() { *x = DisableKeyResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[10] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -677,7 +763,7 @@ func (x *DisableKeyResponse) String() string { func (*DisableKeyResponse) ProtoMessage() {} func (x *DisableKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[10] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -690,7 +776,7 @@ func (x *DisableKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DisableKeyResponse.ProtoReflect.Descriptor instead. func (*DisableKeyResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{10} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{12} } // GetImportParametersRequest contains parameters for retrieving import parameters @@ -704,7 +790,7 @@ type GetImportParametersRequest struct { func (x *GetImportParametersRequest) Reset() { *x = GetImportParametersRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[11] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -716,7 +802,7 @@ func (x *GetImportParametersRequest) String() string { func (*GetImportParametersRequest) ProtoMessage() {} func (x *GetImportParametersRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[11] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -729,7 +815,7 @@ func (x *GetImportParametersRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetImportParametersRequest.ProtoReflect.Descriptor instead. func (*GetImportParametersRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{11} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{13} } func (x *GetImportParametersRequest) GetParameters() *RequestParameters { @@ -757,7 +843,7 @@ type GetImportParametersResponse struct { func (x *GetImportParametersResponse) Reset() { *x = GetImportParametersResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[12] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -769,7 +855,7 @@ func (x *GetImportParametersResponse) String() string { func (*GetImportParametersResponse) ProtoMessage() {} func (x *GetImportParametersResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[12] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -782,7 +868,7 @@ func (x *GetImportParametersResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetImportParametersResponse.ProtoReflect.Descriptor instead. func (*GetImportParametersResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{12} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{14} } func (x *GetImportParametersResponse) GetKeyId() string { @@ -811,7 +897,7 @@ type ImportKeyMaterialRequest struct { func (x *ImportKeyMaterialRequest) Reset() { *x = ImportKeyMaterialRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[13] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -823,7 +909,7 @@ func (x *ImportKeyMaterialRequest) String() string { func (*ImportKeyMaterialRequest) ProtoMessage() {} func (x *ImportKeyMaterialRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[13] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -836,7 +922,7 @@ func (x *ImportKeyMaterialRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ImportKeyMaterialRequest.ProtoReflect.Descriptor instead. func (*ImportKeyMaterialRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{13} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{15} } func (x *ImportKeyMaterialRequest) GetParameters() *RequestParameters { @@ -869,7 +955,7 @@ type ImportKeyMaterialResponse struct { func (x *ImportKeyMaterialResponse) Reset() { *x = ImportKeyMaterialResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[14] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -881,7 +967,7 @@ func (x *ImportKeyMaterialResponse) String() string { func (*ImportKeyMaterialResponse) ProtoMessage() {} func (x *ImportKeyMaterialResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[14] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -894,7 +980,7 @@ func (x *ImportKeyMaterialResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ImportKeyMaterialResponse.ProtoReflect.Descriptor instead. func (*ImportKeyMaterialResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{14} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{16} } // ValidateKeyRequest contains parameters for validating key attributes @@ -910,7 +996,7 @@ type ValidateKeyRequest struct { func (x *ValidateKeyRequest) Reset() { *x = ValidateKeyRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[15] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -922,7 +1008,7 @@ func (x *ValidateKeyRequest) String() string { func (*ValidateKeyRequest) ProtoMessage() {} func (x *ValidateKeyRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[15] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -935,7 +1021,7 @@ func (x *ValidateKeyRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateKeyRequest.ProtoReflect.Descriptor instead. func (*ValidateKeyRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{15} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{17} } func (x *ValidateKeyRequest) GetKeyType() KeyType { @@ -977,7 +1063,7 @@ type ValidateKeyResponse struct { func (x *ValidateKeyResponse) Reset() { *x = ValidateKeyResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[16] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -989,7 +1075,7 @@ func (x *ValidateKeyResponse) String() string { func (*ValidateKeyResponse) ProtoMessage() {} func (x *ValidateKeyResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[16] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1002,7 +1088,7 @@ func (x *ValidateKeyResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateKeyResponse.ProtoReflect.Descriptor instead. func (*ValidateKeyResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{16} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{18} } func (x *ValidateKeyResponse) GetIsValid() bool { @@ -1030,7 +1116,7 @@ type ValidateKeyAccessDataRequest struct { func (x *ValidateKeyAccessDataRequest) Reset() { *x = ValidateKeyAccessDataRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[17] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1042,7 +1128,7 @@ func (x *ValidateKeyAccessDataRequest) String() string { func (*ValidateKeyAccessDataRequest) ProtoMessage() {} func (x *ValidateKeyAccessDataRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[17] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1055,7 +1141,7 @@ func (x *ValidateKeyAccessDataRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateKeyAccessDataRequest.ProtoReflect.Descriptor instead. func (*ValidateKeyAccessDataRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{17} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{19} } func (x *ValidateKeyAccessDataRequest) GetManagement() *structpb.Struct { @@ -1083,7 +1169,7 @@ type ValidateKeyAccessDataResponse struct { func (x *ValidateKeyAccessDataResponse) Reset() { *x = ValidateKeyAccessDataResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[18] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1095,7 +1181,7 @@ func (x *ValidateKeyAccessDataResponse) String() string { func (*ValidateKeyAccessDataResponse) ProtoMessage() {} func (x *ValidateKeyAccessDataResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[18] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1108,7 +1194,7 @@ func (x *ValidateKeyAccessDataResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ValidateKeyAccessDataResponse.ProtoReflect.Descriptor instead. func (*ValidateKeyAccessDataResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{18} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{20} } func (x *ValidateKeyAccessDataResponse) GetIsValid() bool { @@ -1136,7 +1222,7 @@ type TransformCryptoAccessDataRequest struct { func (x *TransformCryptoAccessDataRequest) Reset() { *x = TransformCryptoAccessDataRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[19] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1148,7 +1234,7 @@ func (x *TransformCryptoAccessDataRequest) String() string { func (*TransformCryptoAccessDataRequest) ProtoMessage() {} func (x *TransformCryptoAccessDataRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[19] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1161,7 +1247,7 @@ func (x *TransformCryptoAccessDataRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use TransformCryptoAccessDataRequest.ProtoReflect.Descriptor instead. func (*TransformCryptoAccessDataRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{19} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{21} } func (x *TransformCryptoAccessDataRequest) GetNativeKeyId() string { @@ -1188,7 +1274,7 @@ type TransformCryptoAccessDataResponse struct { func (x *TransformCryptoAccessDataResponse) Reset() { *x = TransformCryptoAccessDataResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[20] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1200,7 +1286,7 @@ func (x *TransformCryptoAccessDataResponse) String() string { func (*TransformCryptoAccessDataResponse) ProtoMessage() {} func (x *TransformCryptoAccessDataResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[20] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1213,7 +1299,7 @@ func (x *TransformCryptoAccessDataResponse) ProtoReflect() protoreflect.Message // Deprecated: Use TransformCryptoAccessDataResponse.ProtoReflect.Descriptor instead. func (*TransformCryptoAccessDataResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{20} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{22} } func (x *TransformCryptoAccessDataResponse) GetTransformedAccessData() map[string][]byte { @@ -1234,7 +1320,7 @@ type ExtractKeyRegionRequest struct { func (x *ExtractKeyRegionRequest) Reset() { *x = ExtractKeyRegionRequest{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[21] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1246,7 +1332,7 @@ func (x *ExtractKeyRegionRequest) String() string { func (*ExtractKeyRegionRequest) ProtoMessage() {} func (x *ExtractKeyRegionRequest) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[21] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1259,7 +1345,7 @@ func (x *ExtractKeyRegionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ExtractKeyRegionRequest.ProtoReflect.Descriptor instead. func (*ExtractKeyRegionRequest) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{21} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{23} } func (x *ExtractKeyRegionRequest) GetNativeKeyId() string { @@ -1286,7 +1372,7 @@ type ExtractKeyRegionResponse struct { func (x *ExtractKeyRegionResponse) Reset() { *x = ExtractKeyRegionResponse{} - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[22] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1298,7 +1384,7 @@ func (x *ExtractKeyRegionResponse) String() string { func (*ExtractKeyRegionResponse) ProtoMessage() {} func (x *ExtractKeyRegionResponse) ProtoReflect() protoreflect.Message { - mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[22] + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1311,7 +1397,7 @@ func (x *ExtractKeyRegionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ExtractKeyRegionResponse.ProtoReflect.Descriptor instead. func (*ExtractKeyRegionResponse) Descriptor() ([]byte, []int) { - return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{22} + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{24} } func (x *ExtractKeyRegionResponse) GetRegion() string { @@ -1321,6 +1407,66 @@ func (x *ExtractKeyRegionResponse) GetRegion() string { return "" } +type GetKeyVersionsResponse_KeyVersion struct { + state protoimpl.MessageState `protogen:"open.v1"` + VersionId string `protobuf:"bytes,1,opt,name=version_id,json=versionId,proto3" json:"version_id,omitempty"` + CreationTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"` + Status *string `protobuf:"bytes,3,opt,name=status,proto3,oneof" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetKeyVersionsResponse_KeyVersion) Reset() { + *x = GetKeyVersionsResponse_KeyVersion{} + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetKeyVersionsResponse_KeyVersion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetKeyVersionsResponse_KeyVersion) ProtoMessage() {} + +func (x *GetKeyVersionsResponse_KeyVersion) ProtoReflect() protoreflect.Message { + mi := &file_plugin_keystore_operations_v1_operations_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetKeyVersionsResponse_KeyVersion.ProtoReflect.Descriptor instead. +func (*GetKeyVersionsResponse_KeyVersion) Descriptor() ([]byte, []int) { + return file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP(), []int{4, 0} +} + +func (x *GetKeyVersionsResponse_KeyVersion) GetVersionId() string { + if x != nil { + return x.VersionId + } + return "" +} + +func (x *GetKeyVersionsResponse_KeyVersion) GetCreationTime() *timestamppb.Timestamp { + if x != nil { + return x.CreationTime + } + return nil +} + +func (x *GetKeyVersionsResponse_KeyVersion) GetStatus() string { + if x != nil && x.Status != nil { + return *x.Status + } + return "" +} + var File_plugin_keystore_operations_v1_operations_proto protoreflect.FileDescriptor const file_plugin_keystore_operations_v1_operations_proto_rawDesc = "" + @@ -1340,7 +1486,20 @@ const file_plugin_keystore_operations_v1_operations_proto_rawDesc = "" + "\x05usage\x18\x04 \x01(\tR\x05usage\x121\n" + "\x15latest_key_version_id\x18\x05 \x01(\tR\x12latestKeyVersionId\x12Q\n" + "\x14latest_rotation_time\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampH\x00R\x12latestRotationTime\x88\x01\x01B\x17\n" + - "\x15_latest_rotation_time\"\x9f\x02\n" + + "\x15_latest_rotation_time\"i\n" + + "\x15GetKeyVersionsRequest\x12P\n" + + "\n" + + "parameters\x18\x01 \x01(\v20.plugin.keystore.operations.v1.RequestParametersR\n" + + "parameters\"\x8d\x02\n" + + "\x16GetKeyVersionsResponse\x12\\\n" + + "\bversions\x18\x01 \x03(\v2@.plugin.keystore.operations.v1.GetKeyVersionsResponse.KeyVersionR\bversions\x1a\x94\x01\n" + + "\n" + + "KeyVersion\x12\x1d\n" + + "\n" + + "version_id\x18\x01 \x01(\tR\tversionId\x12?\n" + + "\rcreation_time\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\fcreationTime\x12\x1b\n" + + "\x06status\x18\x03 \x01(\tH\x00R\x06status\x88\x01\x01B\t\n" + + "\a_status\"\x9f\x02\n" + "\x10CreateKeyRequest\x12I\n" + "\x06config\x18\x01 \x01(\v21.plugin.keystore.common.v1.KeystoreInstanceConfigR\x06config\x12I\n" + "\talgorithm\x18\x02 \x01(\x0e2+.plugin.keystore.operations.v1.KeyAlgorithmR\talgorithm\x12\x13\n" + @@ -1422,9 +1581,10 @@ const file_plugin_keystore_operations_v1_operations_proto_rawDesc = "" + "\x14KEY_TYPE_UNSPECIFIED\x10\x00\x12\x1b\n" + "\x17KEY_TYPE_SYSTEM_MANAGED\x10\x01\x12\x11\n" + "\rKEY_TYPE_BYOK\x10\x02\x12\x11\n" + - "\rKEY_TYPE_HYOK\x10\x032\x92\v\n" + + "\rKEY_TYPE_HYOK\x10\x032\x91\f\n" + "\x1cKeystoreInstanceKeyOperation\x12e\n" + - "\x06GetKey\x12,.plugin.keystore.operations.v1.GetKeyRequest\x1a-.plugin.keystore.operations.v1.GetKeyResponse\x12n\n" + + "\x06GetKey\x12,.plugin.keystore.operations.v1.GetKeyRequest\x1a-.plugin.keystore.operations.v1.GetKeyResponse\x12}\n" + + "\x0eGetKeyVersions\x124.plugin.keystore.operations.v1.GetKeyVersionsRequest\x1a5.plugin.keystore.operations.v1.GetKeyVersionsResponse\x12n\n" + "\tCreateKey\x12/.plugin.keystore.operations.v1.CreateKeyRequest\x1a0.plugin.keystore.operations.v1.CreateKeyResponse\x12n\n" + "\tDeleteKey\x12/.plugin.keystore.operations.v1.DeleteKeyRequest\x1a0.plugin.keystore.operations.v1.DeleteKeyResponse\x12n\n" + "\tEnableKey\x12/.plugin.keystore.operations.v1.EnableKeyRequest\x1a0.plugin.keystore.operations.v1.EnableKeyResponse\x12q\n" + @@ -1435,8 +1595,7 @@ const file_plugin_keystore_operations_v1_operations_proto_rawDesc = "" + "\vValidateKey\x121.plugin.keystore.operations.v1.ValidateKeyRequest\x1a2.plugin.keystore.operations.v1.ValidateKeyResponse\x12\x92\x01\n" + "\x15ValidateKeyAccessData\x12;.plugin.keystore.operations.v1.ValidateKeyAccessDataRequest\x1a<.plugin.keystore.operations.v1.ValidateKeyAccessDataResponse\x12\x9e\x01\n" + "\x19TransformCryptoAccessData\x12?.plugin.keystore.operations.v1.TransformCryptoAccessDataRequest\x1a@.plugin.keystore.operations.v1.TransformCryptoAccessDataResponse\x12\x83\x01\n" + - "\x10ExtractKeyRegion\x126.plugin.keystore.operations.v1.ExtractKeyRegionRequest\x1a7.plugin.keystore.operations.v1.ExtractKeyRegionResponseB\x9b\x02\n" + - "!com.plugin.keystore.operations.v1B\x0fOperationsProtoP\x01ZNgithub.com/openkcm/plugin-sdk/proto/plugin/keystore/operations/v1;operationsv1\xa2\x02\x03PKO\xaa\x02\x1dPlugin.Keystore.Operations.V1\xca\x02\x1dPlugin\\Keystore\\Operations\\V1\xe2\x02)Plugin\\Keystore\\Operations\\V1\\GPBMetadata\xea\x02 Plugin::Keystore::Operations::V1b\x06proto3" + "\x10ExtractKeyRegion\x126.plugin.keystore.operations.v1.ExtractKeyRegionRequest\x1a7.plugin.keystore.operations.v1.ExtractKeyRegionResponseBPZNgithub.com/openkcm/plugin-sdk/proto/plugin/keystore/operations/v1;operationsv1b\x06proto3" var ( file_plugin_keystore_operations_v1_operations_proto_rawDescOnce sync.Once @@ -1451,87 +1610,95 @@ func file_plugin_keystore_operations_v1_operations_proto_rawDescGZIP() []byte { } var file_plugin_keystore_operations_v1_operations_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_plugin_keystore_operations_v1_operations_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_plugin_keystore_operations_v1_operations_proto_msgTypes = make([]protoimpl.MessageInfo, 27) var file_plugin_keystore_operations_v1_operations_proto_goTypes = []any{ (KeyAlgorithm)(0), // 0: plugin.keystore.operations.v1.KeyAlgorithm (KeyType)(0), // 1: plugin.keystore.operations.v1.KeyType (*RequestParameters)(nil), // 2: plugin.keystore.operations.v1.RequestParameters (*GetKeyRequest)(nil), // 3: plugin.keystore.operations.v1.GetKeyRequest (*GetKeyResponse)(nil), // 4: plugin.keystore.operations.v1.GetKeyResponse - (*CreateKeyRequest)(nil), // 5: plugin.keystore.operations.v1.CreateKeyRequest - (*CreateKeyResponse)(nil), // 6: plugin.keystore.operations.v1.CreateKeyResponse - (*DeleteKeyRequest)(nil), // 7: plugin.keystore.operations.v1.DeleteKeyRequest - (*DeleteKeyResponse)(nil), // 8: plugin.keystore.operations.v1.DeleteKeyResponse - (*EnableKeyRequest)(nil), // 9: plugin.keystore.operations.v1.EnableKeyRequest - (*EnableKeyResponse)(nil), // 10: plugin.keystore.operations.v1.EnableKeyResponse - (*DisableKeyRequest)(nil), // 11: plugin.keystore.operations.v1.DisableKeyRequest - (*DisableKeyResponse)(nil), // 12: plugin.keystore.operations.v1.DisableKeyResponse - (*GetImportParametersRequest)(nil), // 13: plugin.keystore.operations.v1.GetImportParametersRequest - (*GetImportParametersResponse)(nil), // 14: plugin.keystore.operations.v1.GetImportParametersResponse - (*ImportKeyMaterialRequest)(nil), // 15: plugin.keystore.operations.v1.ImportKeyMaterialRequest - (*ImportKeyMaterialResponse)(nil), // 16: plugin.keystore.operations.v1.ImportKeyMaterialResponse - (*ValidateKeyRequest)(nil), // 17: plugin.keystore.operations.v1.ValidateKeyRequest - (*ValidateKeyResponse)(nil), // 18: plugin.keystore.operations.v1.ValidateKeyResponse - (*ValidateKeyAccessDataRequest)(nil), // 19: plugin.keystore.operations.v1.ValidateKeyAccessDataRequest - (*ValidateKeyAccessDataResponse)(nil), // 20: plugin.keystore.operations.v1.ValidateKeyAccessDataResponse - (*TransformCryptoAccessDataRequest)(nil), // 21: plugin.keystore.operations.v1.TransformCryptoAccessDataRequest - (*TransformCryptoAccessDataResponse)(nil), // 22: plugin.keystore.operations.v1.TransformCryptoAccessDataResponse - (*ExtractKeyRegionRequest)(nil), // 23: plugin.keystore.operations.v1.ExtractKeyRegionRequest - (*ExtractKeyRegionResponse)(nil), // 24: plugin.keystore.operations.v1.ExtractKeyRegionResponse - nil, // 25: plugin.keystore.operations.v1.TransformCryptoAccessDataResponse.TransformedAccessDataEntry - (*v1.KeystoreInstanceConfig)(nil), // 26: plugin.keystore.common.v1.KeystoreInstanceConfig - (*timestamppb.Timestamp)(nil), // 27: google.protobuf.Timestamp - (*structpb.Struct)(nil), // 28: google.protobuf.Struct + (*GetKeyVersionsRequest)(nil), // 5: plugin.keystore.operations.v1.GetKeyVersionsRequest + (*GetKeyVersionsResponse)(nil), // 6: plugin.keystore.operations.v1.GetKeyVersionsResponse + (*CreateKeyRequest)(nil), // 7: plugin.keystore.operations.v1.CreateKeyRequest + (*CreateKeyResponse)(nil), // 8: plugin.keystore.operations.v1.CreateKeyResponse + (*DeleteKeyRequest)(nil), // 9: plugin.keystore.operations.v1.DeleteKeyRequest + (*DeleteKeyResponse)(nil), // 10: plugin.keystore.operations.v1.DeleteKeyResponse + (*EnableKeyRequest)(nil), // 11: plugin.keystore.operations.v1.EnableKeyRequest + (*EnableKeyResponse)(nil), // 12: plugin.keystore.operations.v1.EnableKeyResponse + (*DisableKeyRequest)(nil), // 13: plugin.keystore.operations.v1.DisableKeyRequest + (*DisableKeyResponse)(nil), // 14: plugin.keystore.operations.v1.DisableKeyResponse + (*GetImportParametersRequest)(nil), // 15: plugin.keystore.operations.v1.GetImportParametersRequest + (*GetImportParametersResponse)(nil), // 16: plugin.keystore.operations.v1.GetImportParametersResponse + (*ImportKeyMaterialRequest)(nil), // 17: plugin.keystore.operations.v1.ImportKeyMaterialRequest + (*ImportKeyMaterialResponse)(nil), // 18: plugin.keystore.operations.v1.ImportKeyMaterialResponse + (*ValidateKeyRequest)(nil), // 19: plugin.keystore.operations.v1.ValidateKeyRequest + (*ValidateKeyResponse)(nil), // 20: plugin.keystore.operations.v1.ValidateKeyResponse + (*ValidateKeyAccessDataRequest)(nil), // 21: plugin.keystore.operations.v1.ValidateKeyAccessDataRequest + (*ValidateKeyAccessDataResponse)(nil), // 22: plugin.keystore.operations.v1.ValidateKeyAccessDataResponse + (*TransformCryptoAccessDataRequest)(nil), // 23: plugin.keystore.operations.v1.TransformCryptoAccessDataRequest + (*TransformCryptoAccessDataResponse)(nil), // 24: plugin.keystore.operations.v1.TransformCryptoAccessDataResponse + (*ExtractKeyRegionRequest)(nil), // 25: plugin.keystore.operations.v1.ExtractKeyRegionRequest + (*ExtractKeyRegionResponse)(nil), // 26: plugin.keystore.operations.v1.ExtractKeyRegionResponse + (*GetKeyVersionsResponse_KeyVersion)(nil), // 27: plugin.keystore.operations.v1.GetKeyVersionsResponse.KeyVersion + nil, // 28: plugin.keystore.operations.v1.TransformCryptoAccessDataResponse.TransformedAccessDataEntry + (*v1.KeystoreInstanceConfig)(nil), // 29: plugin.keystore.common.v1.KeystoreInstanceConfig + (*timestamppb.Timestamp)(nil), // 30: google.protobuf.Timestamp + (*structpb.Struct)(nil), // 31: google.protobuf.Struct } var file_plugin_keystore_operations_v1_operations_proto_depIdxs = []int32{ - 26, // 0: plugin.keystore.operations.v1.RequestParameters.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig + 29, // 0: plugin.keystore.operations.v1.RequestParameters.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig 2, // 1: plugin.keystore.operations.v1.GetKeyRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters 0, // 2: plugin.keystore.operations.v1.GetKeyResponse.algorithm:type_name -> plugin.keystore.operations.v1.KeyAlgorithm - 27, // 3: plugin.keystore.operations.v1.GetKeyResponse.latest_rotation_time:type_name -> google.protobuf.Timestamp - 26, // 4: plugin.keystore.operations.v1.CreateKeyRequest.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig - 0, // 5: plugin.keystore.operations.v1.CreateKeyRequest.algorithm:type_name -> plugin.keystore.operations.v1.KeyAlgorithm - 1, // 6: plugin.keystore.operations.v1.CreateKeyRequest.key_type:type_name -> plugin.keystore.operations.v1.KeyType - 2, // 7: plugin.keystore.operations.v1.DeleteKeyRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters - 2, // 8: plugin.keystore.operations.v1.EnableKeyRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters - 2, // 9: plugin.keystore.operations.v1.DisableKeyRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters - 2, // 10: plugin.keystore.operations.v1.GetImportParametersRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters - 0, // 11: plugin.keystore.operations.v1.GetImportParametersRequest.algorithm:type_name -> plugin.keystore.operations.v1.KeyAlgorithm - 28, // 12: plugin.keystore.operations.v1.GetImportParametersResponse.import_parameters:type_name -> google.protobuf.Struct - 2, // 13: plugin.keystore.operations.v1.ImportKeyMaterialRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters - 28, // 14: plugin.keystore.operations.v1.ImportKeyMaterialRequest.import_parameters:type_name -> google.protobuf.Struct - 1, // 15: plugin.keystore.operations.v1.ValidateKeyRequest.key_type:type_name -> plugin.keystore.operations.v1.KeyType - 0, // 16: plugin.keystore.operations.v1.ValidateKeyRequest.algorithm:type_name -> plugin.keystore.operations.v1.KeyAlgorithm - 28, // 17: plugin.keystore.operations.v1.ValidateKeyAccessDataRequest.management:type_name -> google.protobuf.Struct - 28, // 18: plugin.keystore.operations.v1.ValidateKeyAccessDataRequest.crypto:type_name -> google.protobuf.Struct - 25, // 19: plugin.keystore.operations.v1.TransformCryptoAccessDataResponse.transformed_access_data:type_name -> plugin.keystore.operations.v1.TransformCryptoAccessDataResponse.TransformedAccessDataEntry - 28, // 20: plugin.keystore.operations.v1.ExtractKeyRegionRequest.management_access_data:type_name -> google.protobuf.Struct - 3, // 21: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetKey:input_type -> plugin.keystore.operations.v1.GetKeyRequest - 5, // 22: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.CreateKey:input_type -> plugin.keystore.operations.v1.CreateKeyRequest - 7, // 23: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.DeleteKey:input_type -> plugin.keystore.operations.v1.DeleteKeyRequest - 9, // 24: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.EnableKey:input_type -> plugin.keystore.operations.v1.EnableKeyRequest - 11, // 25: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.DisableKey:input_type -> plugin.keystore.operations.v1.DisableKeyRequest - 13, // 26: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetImportParameters:input_type -> plugin.keystore.operations.v1.GetImportParametersRequest - 15, // 27: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ImportKeyMaterial:input_type -> plugin.keystore.operations.v1.ImportKeyMaterialRequest - 17, // 28: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ValidateKey:input_type -> plugin.keystore.operations.v1.ValidateKeyRequest - 19, // 29: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ValidateKeyAccessData:input_type -> plugin.keystore.operations.v1.ValidateKeyAccessDataRequest - 21, // 30: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.TransformCryptoAccessData:input_type -> plugin.keystore.operations.v1.TransformCryptoAccessDataRequest - 23, // 31: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ExtractKeyRegion:input_type -> plugin.keystore.operations.v1.ExtractKeyRegionRequest - 4, // 32: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetKey:output_type -> plugin.keystore.operations.v1.GetKeyResponse - 6, // 33: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.CreateKey:output_type -> plugin.keystore.operations.v1.CreateKeyResponse - 8, // 34: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.DeleteKey:output_type -> plugin.keystore.operations.v1.DeleteKeyResponse - 10, // 35: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.EnableKey:output_type -> plugin.keystore.operations.v1.EnableKeyResponse - 12, // 36: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.DisableKey:output_type -> plugin.keystore.operations.v1.DisableKeyResponse - 14, // 37: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetImportParameters:output_type -> plugin.keystore.operations.v1.GetImportParametersResponse - 16, // 38: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ImportKeyMaterial:output_type -> plugin.keystore.operations.v1.ImportKeyMaterialResponse - 18, // 39: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ValidateKey:output_type -> plugin.keystore.operations.v1.ValidateKeyResponse - 20, // 40: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ValidateKeyAccessData:output_type -> plugin.keystore.operations.v1.ValidateKeyAccessDataResponse - 22, // 41: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.TransformCryptoAccessData:output_type -> plugin.keystore.operations.v1.TransformCryptoAccessDataResponse - 24, // 42: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ExtractKeyRegion:output_type -> plugin.keystore.operations.v1.ExtractKeyRegionResponse - 32, // [32:43] is the sub-list for method output_type - 21, // [21:32] is the sub-list for method input_type - 21, // [21:21] is the sub-list for extension type_name - 21, // [21:21] is the sub-list for extension extendee - 0, // [0:21] is the sub-list for field type_name + 30, // 3: plugin.keystore.operations.v1.GetKeyResponse.latest_rotation_time:type_name -> google.protobuf.Timestamp + 2, // 4: plugin.keystore.operations.v1.GetKeyVersionsRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters + 27, // 5: plugin.keystore.operations.v1.GetKeyVersionsResponse.versions:type_name -> plugin.keystore.operations.v1.GetKeyVersionsResponse.KeyVersion + 29, // 6: plugin.keystore.operations.v1.CreateKeyRequest.config:type_name -> plugin.keystore.common.v1.KeystoreInstanceConfig + 0, // 7: plugin.keystore.operations.v1.CreateKeyRequest.algorithm:type_name -> plugin.keystore.operations.v1.KeyAlgorithm + 1, // 8: plugin.keystore.operations.v1.CreateKeyRequest.key_type:type_name -> plugin.keystore.operations.v1.KeyType + 2, // 9: plugin.keystore.operations.v1.DeleteKeyRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters + 2, // 10: plugin.keystore.operations.v1.EnableKeyRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters + 2, // 11: plugin.keystore.operations.v1.DisableKeyRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters + 2, // 12: plugin.keystore.operations.v1.GetImportParametersRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters + 0, // 13: plugin.keystore.operations.v1.GetImportParametersRequest.algorithm:type_name -> plugin.keystore.operations.v1.KeyAlgorithm + 31, // 14: plugin.keystore.operations.v1.GetImportParametersResponse.import_parameters:type_name -> google.protobuf.Struct + 2, // 15: plugin.keystore.operations.v1.ImportKeyMaterialRequest.parameters:type_name -> plugin.keystore.operations.v1.RequestParameters + 31, // 16: plugin.keystore.operations.v1.ImportKeyMaterialRequest.import_parameters:type_name -> google.protobuf.Struct + 1, // 17: plugin.keystore.operations.v1.ValidateKeyRequest.key_type:type_name -> plugin.keystore.operations.v1.KeyType + 0, // 18: plugin.keystore.operations.v1.ValidateKeyRequest.algorithm:type_name -> plugin.keystore.operations.v1.KeyAlgorithm + 31, // 19: plugin.keystore.operations.v1.ValidateKeyAccessDataRequest.management:type_name -> google.protobuf.Struct + 31, // 20: plugin.keystore.operations.v1.ValidateKeyAccessDataRequest.crypto:type_name -> google.protobuf.Struct + 28, // 21: plugin.keystore.operations.v1.TransformCryptoAccessDataResponse.transformed_access_data:type_name -> plugin.keystore.operations.v1.TransformCryptoAccessDataResponse.TransformedAccessDataEntry + 31, // 22: plugin.keystore.operations.v1.ExtractKeyRegionRequest.management_access_data:type_name -> google.protobuf.Struct + 30, // 23: plugin.keystore.operations.v1.GetKeyVersionsResponse.KeyVersion.creation_time:type_name -> google.protobuf.Timestamp + 3, // 24: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetKey:input_type -> plugin.keystore.operations.v1.GetKeyRequest + 5, // 25: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetKeyVersions:input_type -> plugin.keystore.operations.v1.GetKeyVersionsRequest + 7, // 26: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.CreateKey:input_type -> plugin.keystore.operations.v1.CreateKeyRequest + 9, // 27: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.DeleteKey:input_type -> plugin.keystore.operations.v1.DeleteKeyRequest + 11, // 28: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.EnableKey:input_type -> plugin.keystore.operations.v1.EnableKeyRequest + 13, // 29: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.DisableKey:input_type -> plugin.keystore.operations.v1.DisableKeyRequest + 15, // 30: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetImportParameters:input_type -> plugin.keystore.operations.v1.GetImportParametersRequest + 17, // 31: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ImportKeyMaterial:input_type -> plugin.keystore.operations.v1.ImportKeyMaterialRequest + 19, // 32: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ValidateKey:input_type -> plugin.keystore.operations.v1.ValidateKeyRequest + 21, // 33: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ValidateKeyAccessData:input_type -> plugin.keystore.operations.v1.ValidateKeyAccessDataRequest + 23, // 34: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.TransformCryptoAccessData:input_type -> plugin.keystore.operations.v1.TransformCryptoAccessDataRequest + 25, // 35: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ExtractKeyRegion:input_type -> plugin.keystore.operations.v1.ExtractKeyRegionRequest + 4, // 36: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetKey:output_type -> plugin.keystore.operations.v1.GetKeyResponse + 6, // 37: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetKeyVersions:output_type -> plugin.keystore.operations.v1.GetKeyVersionsResponse + 8, // 38: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.CreateKey:output_type -> plugin.keystore.operations.v1.CreateKeyResponse + 10, // 39: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.DeleteKey:output_type -> plugin.keystore.operations.v1.DeleteKeyResponse + 12, // 40: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.EnableKey:output_type -> plugin.keystore.operations.v1.EnableKeyResponse + 14, // 41: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.DisableKey:output_type -> plugin.keystore.operations.v1.DisableKeyResponse + 16, // 42: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.GetImportParameters:output_type -> plugin.keystore.operations.v1.GetImportParametersResponse + 18, // 43: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ImportKeyMaterial:output_type -> plugin.keystore.operations.v1.ImportKeyMaterialResponse + 20, // 44: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ValidateKey:output_type -> plugin.keystore.operations.v1.ValidateKeyResponse + 22, // 45: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ValidateKeyAccessData:output_type -> plugin.keystore.operations.v1.ValidateKeyAccessDataResponse + 24, // 46: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.TransformCryptoAccessData:output_type -> plugin.keystore.operations.v1.TransformCryptoAccessDataResponse + 26, // 47: plugin.keystore.operations.v1.KeystoreInstanceKeyOperation.ExtractKeyRegion:output_type -> plugin.keystore.operations.v1.ExtractKeyRegionResponse + 36, // [36:48] is the sub-list for method output_type + 24, // [24:36] is the sub-list for method input_type + 24, // [24:24] is the sub-list for extension type_name + 24, // [24:24] is the sub-list for extension extendee + 0, // [0:24] is the sub-list for field type_name } func init() { file_plugin_keystore_operations_v1_operations_proto_init() } @@ -1540,15 +1707,16 @@ func file_plugin_keystore_operations_v1_operations_proto_init() { return } file_plugin_keystore_operations_v1_operations_proto_msgTypes[2].OneofWrappers = []any{} - file_plugin_keystore_operations_v1_operations_proto_msgTypes[3].OneofWrappers = []any{} file_plugin_keystore_operations_v1_operations_proto_msgTypes[5].OneofWrappers = []any{} + file_plugin_keystore_operations_v1_operations_proto_msgTypes[7].OneofWrappers = []any{} + file_plugin_keystore_operations_v1_operations_proto_msgTypes[25].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_plugin_keystore_operations_v1_operations_proto_rawDesc), len(file_plugin_keystore_operations_v1_operations_proto_rawDesc)), NumEnums: 2, - NumMessages: 24, + NumMessages: 27, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/plugin/keystore/operations/v1/operations.pb.validate.go b/proto/plugin/keystore/operations/v1/operations.pb.validate.go deleted file mode 100644 index 1733174..0000000 --- a/proto/plugin/keystore/operations/v1/operations.pb.validate.go +++ /dev/null @@ -1,2853 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/keystore/operations/v1/operations.proto - -package operationsv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on RequestParameters with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *RequestParameters) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on RequestParameters with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// RequestParametersMultiError, or nil if none found. -func (m *RequestParameters) ValidateAll() error { - return m.validate(true) -} - -func (m *RequestParameters) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, RequestParametersValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, RequestParametersValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return RequestParametersValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for KeyId - - if len(errors) > 0 { - return RequestParametersMultiError(errors) - } - - return nil -} - -// RequestParametersMultiError is an error wrapping multiple validation errors -// returned by RequestParameters.ValidateAll() if the designated constraints -// aren't met. -type RequestParametersMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m RequestParametersMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m RequestParametersMultiError) AllErrors() []error { return m } - -// RequestParametersValidationError is the validation error returned by -// RequestParameters.Validate if the designated constraints aren't met. -type RequestParametersValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e RequestParametersValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e RequestParametersValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e RequestParametersValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e RequestParametersValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e RequestParametersValidationError) ErrorName() string { - return "RequestParametersValidationError" -} - -// Error satisfies the builtin error interface -func (e RequestParametersValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sRequestParameters.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = RequestParametersValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = RequestParametersValidationError{} - -// Validate checks the field values on GetKeyRequest with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GetKeyRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetKeyRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetKeyRequestMultiError, or -// nil if none found. -func (m *GetKeyRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetKeyRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetParameters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetParameters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetKeyRequestMultiError(errors) - } - - return nil -} - -// GetKeyRequestMultiError is an error wrapping multiple validation errors -// returned by GetKeyRequest.ValidateAll() if the designated constraints -// aren't met. -type GetKeyRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetKeyRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetKeyRequestMultiError) AllErrors() []error { return m } - -// GetKeyRequestValidationError is the validation error returned by -// GetKeyRequest.Validate if the designated constraints aren't met. -type GetKeyRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetKeyRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetKeyRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetKeyRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetKeyRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetKeyRequestValidationError) ErrorName() string { return "GetKeyRequestValidationError" } - -// Error satisfies the builtin error interface -func (e GetKeyRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetKeyRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetKeyRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetKeyRequestValidationError{} - -// Validate checks the field values on GetKeyResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GetKeyResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetKeyResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetKeyResponseMultiError, -// or nil if none found. -func (m *GetKeyResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetKeyResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for KeyId - - // no validation rules for Algorithm - - // no validation rules for Status - - // no validation rules for Usage - - // no validation rules for LatestKeyVersionId - - if m.LatestRotationTime != nil { - - if all { - switch v := interface{}(m.GetLatestRotationTime()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetKeyResponseValidationError{ - field: "LatestRotationTime", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetKeyResponseValidationError{ - field: "LatestRotationTime", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetLatestRotationTime()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetKeyResponseValidationError{ - field: "LatestRotationTime", - reason: "embedded message failed validation", - cause: err, - } - } - } - - } - - if len(errors) > 0 { - return GetKeyResponseMultiError(errors) - } - - return nil -} - -// GetKeyResponseMultiError is an error wrapping multiple validation errors -// returned by GetKeyResponse.ValidateAll() if the designated constraints -// aren't met. -type GetKeyResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetKeyResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetKeyResponseMultiError) AllErrors() []error { return m } - -// GetKeyResponseValidationError is the validation error returned by -// GetKeyResponse.Validate if the designated constraints aren't met. -type GetKeyResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetKeyResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetKeyResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetKeyResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetKeyResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetKeyResponseValidationError) ErrorName() string { return "GetKeyResponseValidationError" } - -// Error satisfies the builtin error interface -func (e GetKeyResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetKeyResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetKeyResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetKeyResponseValidationError{} - -// Validate checks the field values on CreateKeyRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *CreateKeyRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CreateKeyRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CreateKeyRequestMultiError, or nil if none found. -func (m *CreateKeyRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *CreateKeyRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetConfig()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, CreateKeyRequestValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, CreateKeyRequestValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return CreateKeyRequestValidationError{ - field: "Config", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Algorithm - - // no validation rules for Region - - // no validation rules for KeyType - - if m.Id != nil { - // no validation rules for Id - } - - if len(errors) > 0 { - return CreateKeyRequestMultiError(errors) - } - - return nil -} - -// CreateKeyRequestMultiError is an error wrapping multiple validation errors -// returned by CreateKeyRequest.ValidateAll() if the designated constraints -// aren't met. -type CreateKeyRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CreateKeyRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CreateKeyRequestMultiError) AllErrors() []error { return m } - -// CreateKeyRequestValidationError is the validation error returned by -// CreateKeyRequest.Validate if the designated constraints aren't met. -type CreateKeyRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CreateKeyRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CreateKeyRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CreateKeyRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CreateKeyRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CreateKeyRequestValidationError) ErrorName() string { return "CreateKeyRequestValidationError" } - -// Error satisfies the builtin error interface -func (e CreateKeyRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCreateKeyRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CreateKeyRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CreateKeyRequestValidationError{} - -// Validate checks the field values on CreateKeyResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *CreateKeyResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on CreateKeyResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// CreateKeyResponseMultiError, or nil if none found. -func (m *CreateKeyResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *CreateKeyResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for KeyId - - // no validation rules for Status - - if len(errors) > 0 { - return CreateKeyResponseMultiError(errors) - } - - return nil -} - -// CreateKeyResponseMultiError is an error wrapping multiple validation errors -// returned by CreateKeyResponse.ValidateAll() if the designated constraints -// aren't met. -type CreateKeyResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m CreateKeyResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m CreateKeyResponseMultiError) AllErrors() []error { return m } - -// CreateKeyResponseValidationError is the validation error returned by -// CreateKeyResponse.Validate if the designated constraints aren't met. -type CreateKeyResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e CreateKeyResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e CreateKeyResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e CreateKeyResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e CreateKeyResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e CreateKeyResponseValidationError) ErrorName() string { - return "CreateKeyResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e CreateKeyResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sCreateKeyResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = CreateKeyResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = CreateKeyResponseValidationError{} - -// Validate checks the field values on DeleteKeyRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *DeleteKeyRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteKeyRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteKeyRequestMultiError, or nil if none found. -func (m *DeleteKeyRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteKeyRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetParameters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DeleteKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DeleteKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetParameters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DeleteKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if m.Window != nil { - // no validation rules for Window - } - - if len(errors) > 0 { - return DeleteKeyRequestMultiError(errors) - } - - return nil -} - -// DeleteKeyRequestMultiError is an error wrapping multiple validation errors -// returned by DeleteKeyRequest.ValidateAll() if the designated constraints -// aren't met. -type DeleteKeyRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteKeyRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteKeyRequestMultiError) AllErrors() []error { return m } - -// DeleteKeyRequestValidationError is the validation error returned by -// DeleteKeyRequest.Validate if the designated constraints aren't met. -type DeleteKeyRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteKeyRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteKeyRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteKeyRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteKeyRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteKeyRequestValidationError) ErrorName() string { return "DeleteKeyRequestValidationError" } - -// Error satisfies the builtin error interface -func (e DeleteKeyRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteKeyRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteKeyRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteKeyRequestValidationError{} - -// Validate checks the field values on DeleteKeyResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *DeleteKeyResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DeleteKeyResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DeleteKeyResponseMultiError, or nil if none found. -func (m *DeleteKeyResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *DeleteKeyResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return DeleteKeyResponseMultiError(errors) - } - - return nil -} - -// DeleteKeyResponseMultiError is an error wrapping multiple validation errors -// returned by DeleteKeyResponse.ValidateAll() if the designated constraints -// aren't met. -type DeleteKeyResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DeleteKeyResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DeleteKeyResponseMultiError) AllErrors() []error { return m } - -// DeleteKeyResponseValidationError is the validation error returned by -// DeleteKeyResponse.Validate if the designated constraints aren't met. -type DeleteKeyResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DeleteKeyResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DeleteKeyResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DeleteKeyResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DeleteKeyResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DeleteKeyResponseValidationError) ErrorName() string { - return "DeleteKeyResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e DeleteKeyResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDeleteKeyResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DeleteKeyResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DeleteKeyResponseValidationError{} - -// Validate checks the field values on EnableKeyRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *EnableKeyRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on EnableKeyRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// EnableKeyRequestMultiError, or nil if none found. -func (m *EnableKeyRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *EnableKeyRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetParameters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, EnableKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, EnableKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetParameters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return EnableKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return EnableKeyRequestMultiError(errors) - } - - return nil -} - -// EnableKeyRequestMultiError is an error wrapping multiple validation errors -// returned by EnableKeyRequest.ValidateAll() if the designated constraints -// aren't met. -type EnableKeyRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m EnableKeyRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m EnableKeyRequestMultiError) AllErrors() []error { return m } - -// EnableKeyRequestValidationError is the validation error returned by -// EnableKeyRequest.Validate if the designated constraints aren't met. -type EnableKeyRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e EnableKeyRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e EnableKeyRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e EnableKeyRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e EnableKeyRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e EnableKeyRequestValidationError) ErrorName() string { return "EnableKeyRequestValidationError" } - -// Error satisfies the builtin error interface -func (e EnableKeyRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sEnableKeyRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = EnableKeyRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = EnableKeyRequestValidationError{} - -// Validate checks the field values on EnableKeyResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *EnableKeyResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on EnableKeyResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// EnableKeyResponseMultiError, or nil if none found. -func (m *EnableKeyResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *EnableKeyResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return EnableKeyResponseMultiError(errors) - } - - return nil -} - -// EnableKeyResponseMultiError is an error wrapping multiple validation errors -// returned by EnableKeyResponse.ValidateAll() if the designated constraints -// aren't met. -type EnableKeyResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m EnableKeyResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m EnableKeyResponseMultiError) AllErrors() []error { return m } - -// EnableKeyResponseValidationError is the validation error returned by -// EnableKeyResponse.Validate if the designated constraints aren't met. -type EnableKeyResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e EnableKeyResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e EnableKeyResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e EnableKeyResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e EnableKeyResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e EnableKeyResponseValidationError) ErrorName() string { - return "EnableKeyResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e EnableKeyResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sEnableKeyResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = EnableKeyResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = EnableKeyResponseValidationError{} - -// Validate checks the field values on DisableKeyRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *DisableKeyRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DisableKeyRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DisableKeyRequestMultiError, or nil if none found. -func (m *DisableKeyRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *DisableKeyRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetParameters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, DisableKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, DisableKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetParameters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return DisableKeyRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return DisableKeyRequestMultiError(errors) - } - - return nil -} - -// DisableKeyRequestMultiError is an error wrapping multiple validation errors -// returned by DisableKeyRequest.ValidateAll() if the designated constraints -// aren't met. -type DisableKeyRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DisableKeyRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DisableKeyRequestMultiError) AllErrors() []error { return m } - -// DisableKeyRequestValidationError is the validation error returned by -// DisableKeyRequest.Validate if the designated constraints aren't met. -type DisableKeyRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DisableKeyRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DisableKeyRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DisableKeyRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DisableKeyRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DisableKeyRequestValidationError) ErrorName() string { - return "DisableKeyRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e DisableKeyRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDisableKeyRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DisableKeyRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DisableKeyRequestValidationError{} - -// Validate checks the field values on DisableKeyResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *DisableKeyResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on DisableKeyResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// DisableKeyResponseMultiError, or nil if none found. -func (m *DisableKeyResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *DisableKeyResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return DisableKeyResponseMultiError(errors) - } - - return nil -} - -// DisableKeyResponseMultiError is an error wrapping multiple validation errors -// returned by DisableKeyResponse.ValidateAll() if the designated constraints -// aren't met. -type DisableKeyResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m DisableKeyResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m DisableKeyResponseMultiError) AllErrors() []error { return m } - -// DisableKeyResponseValidationError is the validation error returned by -// DisableKeyResponse.Validate if the designated constraints aren't met. -type DisableKeyResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e DisableKeyResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e DisableKeyResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e DisableKeyResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e DisableKeyResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e DisableKeyResponseValidationError) ErrorName() string { - return "DisableKeyResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e DisableKeyResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sDisableKeyResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = DisableKeyResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = DisableKeyResponseValidationError{} - -// Validate checks the field values on GetImportParametersRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetImportParametersRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetImportParametersRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetImportParametersRequestMultiError, or nil if none found. -func (m *GetImportParametersRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetImportParametersRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetParameters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetImportParametersRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetImportParametersRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetParameters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetImportParametersRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for Algorithm - - if len(errors) > 0 { - return GetImportParametersRequestMultiError(errors) - } - - return nil -} - -// GetImportParametersRequestMultiError is an error wrapping multiple -// validation errors returned by GetImportParametersRequest.ValidateAll() if -// the designated constraints aren't met. -type GetImportParametersRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetImportParametersRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetImportParametersRequestMultiError) AllErrors() []error { return m } - -// GetImportParametersRequestValidationError is the validation error returned -// by GetImportParametersRequest.Validate if the designated constraints aren't met. -type GetImportParametersRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetImportParametersRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetImportParametersRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetImportParametersRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetImportParametersRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetImportParametersRequestValidationError) ErrorName() string { - return "GetImportParametersRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e GetImportParametersRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetImportParametersRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetImportParametersRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetImportParametersRequestValidationError{} - -// Validate checks the field values on GetImportParametersResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *GetImportParametersResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetImportParametersResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// GetImportParametersResponseMultiError, or nil if none found. -func (m *GetImportParametersResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetImportParametersResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for KeyId - - if all { - switch v := interface{}(m.GetImportParameters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, GetImportParametersResponseValidationError{ - field: "ImportParameters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, GetImportParametersResponseValidationError{ - field: "ImportParameters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetImportParameters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return GetImportParametersResponseValidationError{ - field: "ImportParameters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return GetImportParametersResponseMultiError(errors) - } - - return nil -} - -// GetImportParametersResponseMultiError is an error wrapping multiple -// validation errors returned by GetImportParametersResponse.ValidateAll() if -// the designated constraints aren't met. -type GetImportParametersResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetImportParametersResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetImportParametersResponseMultiError) AllErrors() []error { return m } - -// GetImportParametersResponseValidationError is the validation error returned -// by GetImportParametersResponse.Validate if the designated constraints -// aren't met. -type GetImportParametersResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetImportParametersResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetImportParametersResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetImportParametersResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetImportParametersResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetImportParametersResponseValidationError) ErrorName() string { - return "GetImportParametersResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e GetImportParametersResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetImportParametersResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetImportParametersResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetImportParametersResponseValidationError{} - -// Validate checks the field values on ImportKeyMaterialRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ImportKeyMaterialRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ImportKeyMaterialRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ImportKeyMaterialRequestMultiError, or nil if none found. -func (m *ImportKeyMaterialRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ImportKeyMaterialRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetParameters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ImportKeyMaterialRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ImportKeyMaterialRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetParameters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ImportKeyMaterialRequestValidationError{ - field: "Parameters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetImportParameters()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ImportKeyMaterialRequestValidationError{ - field: "ImportParameters", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ImportKeyMaterialRequestValidationError{ - field: "ImportParameters", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetImportParameters()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ImportKeyMaterialRequestValidationError{ - field: "ImportParameters", - reason: "embedded message failed validation", - cause: err, - } - } - } - - // no validation rules for EncryptedKeyMaterial - - if len(errors) > 0 { - return ImportKeyMaterialRequestMultiError(errors) - } - - return nil -} - -// ImportKeyMaterialRequestMultiError is an error wrapping multiple validation -// errors returned by ImportKeyMaterialRequest.ValidateAll() if the designated -// constraints aren't met. -type ImportKeyMaterialRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ImportKeyMaterialRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ImportKeyMaterialRequestMultiError) AllErrors() []error { return m } - -// ImportKeyMaterialRequestValidationError is the validation error returned by -// ImportKeyMaterialRequest.Validate if the designated constraints aren't met. -type ImportKeyMaterialRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ImportKeyMaterialRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ImportKeyMaterialRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ImportKeyMaterialRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ImportKeyMaterialRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ImportKeyMaterialRequestValidationError) ErrorName() string { - return "ImportKeyMaterialRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ImportKeyMaterialRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sImportKeyMaterialRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ImportKeyMaterialRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ImportKeyMaterialRequestValidationError{} - -// Validate checks the field values on ImportKeyMaterialResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ImportKeyMaterialResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ImportKeyMaterialResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ImportKeyMaterialResponseMultiError, or nil if none found. -func (m *ImportKeyMaterialResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ImportKeyMaterialResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if len(errors) > 0 { - return ImportKeyMaterialResponseMultiError(errors) - } - - return nil -} - -// ImportKeyMaterialResponseMultiError is an error wrapping multiple validation -// errors returned by ImportKeyMaterialResponse.ValidateAll() if the -// designated constraints aren't met. -type ImportKeyMaterialResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ImportKeyMaterialResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ImportKeyMaterialResponseMultiError) AllErrors() []error { return m } - -// ImportKeyMaterialResponseValidationError is the validation error returned by -// ImportKeyMaterialResponse.Validate if the designated constraints aren't met. -type ImportKeyMaterialResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ImportKeyMaterialResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ImportKeyMaterialResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ImportKeyMaterialResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ImportKeyMaterialResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ImportKeyMaterialResponseValidationError) ErrorName() string { - return "ImportKeyMaterialResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ImportKeyMaterialResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sImportKeyMaterialResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ImportKeyMaterialResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ImportKeyMaterialResponseValidationError{} - -// Validate checks the field values on ValidateKeyRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ValidateKeyRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ValidateKeyRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ValidateKeyRequestMultiError, or nil if none found. -func (m *ValidateKeyRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ValidateKeyRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for KeyType - - // no validation rules for Algorithm - - // no validation rules for Region - - // no validation rules for NativeKeyId - - if len(errors) > 0 { - return ValidateKeyRequestMultiError(errors) - } - - return nil -} - -// ValidateKeyRequestMultiError is an error wrapping multiple validation errors -// returned by ValidateKeyRequest.ValidateAll() if the designated constraints -// aren't met. -type ValidateKeyRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ValidateKeyRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ValidateKeyRequestMultiError) AllErrors() []error { return m } - -// ValidateKeyRequestValidationError is the validation error returned by -// ValidateKeyRequest.Validate if the designated constraints aren't met. -type ValidateKeyRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ValidateKeyRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ValidateKeyRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ValidateKeyRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ValidateKeyRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ValidateKeyRequestValidationError) ErrorName() string { - return "ValidateKeyRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ValidateKeyRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sValidateKeyRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ValidateKeyRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ValidateKeyRequestValidationError{} - -// Validate checks the field values on ValidateKeyResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ValidateKeyResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ValidateKeyResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ValidateKeyResponseMultiError, or nil if none found. -func (m *ValidateKeyResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ValidateKeyResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for IsValid - - // no validation rules for Message - - if len(errors) > 0 { - return ValidateKeyResponseMultiError(errors) - } - - return nil -} - -// ValidateKeyResponseMultiError is an error wrapping multiple validation -// errors returned by ValidateKeyResponse.ValidateAll() if the designated -// constraints aren't met. -type ValidateKeyResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ValidateKeyResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ValidateKeyResponseMultiError) AllErrors() []error { return m } - -// ValidateKeyResponseValidationError is the validation error returned by -// ValidateKeyResponse.Validate if the designated constraints aren't met. -type ValidateKeyResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ValidateKeyResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ValidateKeyResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ValidateKeyResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ValidateKeyResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ValidateKeyResponseValidationError) ErrorName() string { - return "ValidateKeyResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ValidateKeyResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sValidateKeyResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ValidateKeyResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ValidateKeyResponseValidationError{} - -// Validate checks the field values on ValidateKeyAccessDataRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ValidateKeyAccessDataRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ValidateKeyAccessDataRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ValidateKeyAccessDataRequestMultiError, or nil if none found. -func (m *ValidateKeyAccessDataRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ValidateKeyAccessDataRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if all { - switch v := interface{}(m.GetManagement()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ValidateKeyAccessDataRequestValidationError{ - field: "Management", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ValidateKeyAccessDataRequestValidationError{ - field: "Management", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetManagement()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ValidateKeyAccessDataRequestValidationError{ - field: "Management", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if all { - switch v := interface{}(m.GetCrypto()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ValidateKeyAccessDataRequestValidationError{ - field: "Crypto", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ValidateKeyAccessDataRequestValidationError{ - field: "Crypto", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetCrypto()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ValidateKeyAccessDataRequestValidationError{ - field: "Crypto", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ValidateKeyAccessDataRequestMultiError(errors) - } - - return nil -} - -// ValidateKeyAccessDataRequestMultiError is an error wrapping multiple -// validation errors returned by ValidateKeyAccessDataRequest.ValidateAll() if -// the designated constraints aren't met. -type ValidateKeyAccessDataRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ValidateKeyAccessDataRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ValidateKeyAccessDataRequestMultiError) AllErrors() []error { return m } - -// ValidateKeyAccessDataRequestValidationError is the validation error returned -// by ValidateKeyAccessDataRequest.Validate if the designated constraints -// aren't met. -type ValidateKeyAccessDataRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ValidateKeyAccessDataRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ValidateKeyAccessDataRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ValidateKeyAccessDataRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ValidateKeyAccessDataRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ValidateKeyAccessDataRequestValidationError) ErrorName() string { - return "ValidateKeyAccessDataRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ValidateKeyAccessDataRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sValidateKeyAccessDataRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ValidateKeyAccessDataRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ValidateKeyAccessDataRequestValidationError{} - -// Validate checks the field values on ValidateKeyAccessDataResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ValidateKeyAccessDataResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ValidateKeyAccessDataResponse with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// ValidateKeyAccessDataResponseMultiError, or nil if none found. -func (m *ValidateKeyAccessDataResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ValidateKeyAccessDataResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for IsValid - - // no validation rules for Message - - if len(errors) > 0 { - return ValidateKeyAccessDataResponseMultiError(errors) - } - - return nil -} - -// ValidateKeyAccessDataResponseMultiError is an error wrapping multiple -// validation errors returned by ValidateKeyAccessDataResponse.ValidateAll() -// if the designated constraints aren't met. -type ValidateKeyAccessDataResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ValidateKeyAccessDataResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ValidateKeyAccessDataResponseMultiError) AllErrors() []error { return m } - -// ValidateKeyAccessDataResponseValidationError is the validation error -// returned by ValidateKeyAccessDataResponse.Validate if the designated -// constraints aren't met. -type ValidateKeyAccessDataResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ValidateKeyAccessDataResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ValidateKeyAccessDataResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ValidateKeyAccessDataResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ValidateKeyAccessDataResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ValidateKeyAccessDataResponseValidationError) ErrorName() string { - return "ValidateKeyAccessDataResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ValidateKeyAccessDataResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sValidateKeyAccessDataResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ValidateKeyAccessDataResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ValidateKeyAccessDataResponseValidationError{} - -// Validate checks the field values on TransformCryptoAccessDataRequest with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *TransformCryptoAccessDataRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TransformCryptoAccessDataRequest with -// the rules defined in the proto definition for this message. If any rules -// are violated, the result is a list of violation errors wrapped in -// TransformCryptoAccessDataRequestMultiError, or nil if none found. -func (m *TransformCryptoAccessDataRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *TransformCryptoAccessDataRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for NativeKeyId - - // no validation rules for AccessData - - if len(errors) > 0 { - return TransformCryptoAccessDataRequestMultiError(errors) - } - - return nil -} - -// TransformCryptoAccessDataRequestMultiError is an error wrapping multiple -// validation errors returned by -// TransformCryptoAccessDataRequest.ValidateAll() if the designated -// constraints aren't met. -type TransformCryptoAccessDataRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TransformCryptoAccessDataRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TransformCryptoAccessDataRequestMultiError) AllErrors() []error { return m } - -// TransformCryptoAccessDataRequestValidationError is the validation error -// returned by TransformCryptoAccessDataRequest.Validate if the designated -// constraints aren't met. -type TransformCryptoAccessDataRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TransformCryptoAccessDataRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TransformCryptoAccessDataRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TransformCryptoAccessDataRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TransformCryptoAccessDataRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TransformCryptoAccessDataRequestValidationError) ErrorName() string { - return "TransformCryptoAccessDataRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e TransformCryptoAccessDataRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTransformCryptoAccessDataRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TransformCryptoAccessDataRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TransformCryptoAccessDataRequestValidationError{} - -// Validate checks the field values on TransformCryptoAccessDataResponse with -// the rules defined in the proto definition for this message. If any rules -// are violated, the first error encountered is returned, or nil if there are -// no violations. -func (m *TransformCryptoAccessDataResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TransformCryptoAccessDataResponse -// with the rules defined in the proto definition for this message. If any -// rules are violated, the result is a list of violation errors wrapped in -// TransformCryptoAccessDataResponseMultiError, or nil if none found. -func (m *TransformCryptoAccessDataResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *TransformCryptoAccessDataResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for TransformedAccessData - - if len(errors) > 0 { - return TransformCryptoAccessDataResponseMultiError(errors) - } - - return nil -} - -// TransformCryptoAccessDataResponseMultiError is an error wrapping multiple -// validation errors returned by -// TransformCryptoAccessDataResponse.ValidateAll() if the designated -// constraints aren't met. -type TransformCryptoAccessDataResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TransformCryptoAccessDataResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TransformCryptoAccessDataResponseMultiError) AllErrors() []error { return m } - -// TransformCryptoAccessDataResponseValidationError is the validation error -// returned by TransformCryptoAccessDataResponse.Validate if the designated -// constraints aren't met. -type TransformCryptoAccessDataResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TransformCryptoAccessDataResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TransformCryptoAccessDataResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TransformCryptoAccessDataResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TransformCryptoAccessDataResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TransformCryptoAccessDataResponseValidationError) ErrorName() string { - return "TransformCryptoAccessDataResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e TransformCryptoAccessDataResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTransformCryptoAccessDataResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TransformCryptoAccessDataResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TransformCryptoAccessDataResponseValidationError{} - -// Validate checks the field values on ExtractKeyRegionRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ExtractKeyRegionRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ExtractKeyRegionRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ExtractKeyRegionRequestMultiError, or nil if none found. -func (m *ExtractKeyRegionRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ExtractKeyRegionRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for NativeKeyId - - if all { - switch v := interface{}(m.GetManagementAccessData()).(type) { - case interface{ ValidateAll() error }: - if err := v.ValidateAll(); err != nil { - errors = append(errors, ExtractKeyRegionRequestValidationError{ - field: "ManagementAccessData", - reason: "embedded message failed validation", - cause: err, - }) - } - case interface{ Validate() error }: - if err := v.Validate(); err != nil { - errors = append(errors, ExtractKeyRegionRequestValidationError{ - field: "ManagementAccessData", - reason: "embedded message failed validation", - cause: err, - }) - } - } - } else if v, ok := interface{}(m.GetManagementAccessData()).(interface{ Validate() error }); ok { - if err := v.Validate(); err != nil { - return ExtractKeyRegionRequestValidationError{ - field: "ManagementAccessData", - reason: "embedded message failed validation", - cause: err, - } - } - } - - if len(errors) > 0 { - return ExtractKeyRegionRequestMultiError(errors) - } - - return nil -} - -// ExtractKeyRegionRequestMultiError is an error wrapping multiple validation -// errors returned by ExtractKeyRegionRequest.ValidateAll() if the designated -// constraints aren't met. -type ExtractKeyRegionRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExtractKeyRegionRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExtractKeyRegionRequestMultiError) AllErrors() []error { return m } - -// ExtractKeyRegionRequestValidationError is the validation error returned by -// ExtractKeyRegionRequest.Validate if the designated constraints aren't met. -type ExtractKeyRegionRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExtractKeyRegionRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExtractKeyRegionRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExtractKeyRegionRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExtractKeyRegionRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExtractKeyRegionRequestValidationError) ErrorName() string { - return "ExtractKeyRegionRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e ExtractKeyRegionRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExtractKeyRegionRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExtractKeyRegionRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExtractKeyRegionRequestValidationError{} - -// Validate checks the field values on ExtractKeyRegionResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *ExtractKeyRegionResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ExtractKeyRegionResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ExtractKeyRegionResponseMultiError, or nil if none found. -func (m *ExtractKeyRegionResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ExtractKeyRegionResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Region - - if len(errors) > 0 { - return ExtractKeyRegionResponseMultiError(errors) - } - - return nil -} - -// ExtractKeyRegionResponseMultiError is an error wrapping multiple validation -// errors returned by ExtractKeyRegionResponse.ValidateAll() if the designated -// constraints aren't met. -type ExtractKeyRegionResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ExtractKeyRegionResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ExtractKeyRegionResponseMultiError) AllErrors() []error { return m } - -// ExtractKeyRegionResponseValidationError is the validation error returned by -// ExtractKeyRegionResponse.Validate if the designated constraints aren't met. -type ExtractKeyRegionResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ExtractKeyRegionResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ExtractKeyRegionResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ExtractKeyRegionResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ExtractKeyRegionResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ExtractKeyRegionResponseValidationError) ErrorName() string { - return "ExtractKeyRegionResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ExtractKeyRegionResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sExtractKeyRegionResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ExtractKeyRegionResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ExtractKeyRegionResponseValidationError{} diff --git a/proto/plugin/keystore/operations/v1/operations.proto b/proto/plugin/keystore/operations/v1/operations.proto index cb5eeba..5bb8ef3 100644 --- a/proto/plugin/keystore/operations/v1/operations.proto +++ b/proto/plugin/keystore/operations/v1/operations.proto @@ -5,6 +5,8 @@ import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; import "plugin/keystore/common/v1/common.proto"; +option go_package = "github.com/openkcm/plugin-sdk/proto/plugin/keystore/operations/v1;operationsv1"; + // KeystoreInstanceKeyOperation service defines the operations available for key management service KeystoreInstanceKeyOperation { // GetKey retrieves the details of a key by its ID @@ -14,6 +16,9 @@ service KeystoreInstanceKeyOperation { // if the key does not exist rpc GetKey(GetKeyRequest) returns (GetKeyResponse); + // GetKeyVersions retrieves all versions for a key + rpc GetKeyVersions(GetKeyVersionsRequest) returns (GetKeyVersionsResponse); + // CreateKey generates a new key with the specified algorithm rpc CreateKey(CreateKeyRequest) returns (CreateKeyResponse); @@ -80,6 +85,19 @@ message GetKeyResponse { optional google.protobuf.Timestamp latest_rotation_time = 6; // The timestamp of the latest key rotation } +message GetKeyVersionsRequest { + RequestParameters parameters = 1; +} + +message GetKeyVersionsResponse { + message KeyVersion { + string version_id = 1; + google.protobuf.Timestamp creation_time = 2; + optional string status = 3; + } + repeated KeyVersion versions = 1; +} + // CreateKeyRequest contains parameters for key creation message CreateKeyRequest { plugin.keystore.common.v1.KeystoreInstanceConfig config = 1; diff --git a/proto/plugin/keystore/operations/v1/operations_ext_plugin.pb.go b/proto/plugin/keystore/operations/v1/operations_ext_plugin.pb.go index f7629b0..df24523 100644 --- a/proto/plugin/keystore/operations/v1/operations_ext_plugin.pb.go +++ b/proto/plugin/keystore/operations/v1/operations_ext_plugin.pb.go @@ -3,9 +3,8 @@ package operationsv1 import ( - grpc "google.golang.org/grpc" - api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" ) const ( diff --git a/proto/plugin/keystore/operations/v1/operations_grpc.pb.go b/proto/plugin/keystore/operations/v1/operations_grpc.pb.go index eef81c3..5e722a2 100644 --- a/proto/plugin/keystore/operations/v1/operations_grpc.pb.go +++ b/proto/plugin/keystore/operations/v1/operations_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.35.1 // source: plugin/keystore/operations/v1/operations.proto package operationsv1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -21,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion9 const ( KeystoreInstanceKeyOperation_GetKey_FullMethodName = "/plugin.keystore.operations.v1.KeystoreInstanceKeyOperation/GetKey" + KeystoreInstanceKeyOperation_GetKeyVersions_FullMethodName = "/plugin.keystore.operations.v1.KeystoreInstanceKeyOperation/GetKeyVersions" KeystoreInstanceKeyOperation_CreateKey_FullMethodName = "/plugin.keystore.operations.v1.KeystoreInstanceKeyOperation/CreateKey" KeystoreInstanceKeyOperation_DeleteKey_FullMethodName = "/plugin.keystore.operations.v1.KeystoreInstanceKeyOperation/DeleteKey" KeystoreInstanceKeyOperation_EnableKey_FullMethodName = "/plugin.keystore.operations.v1.KeystoreInstanceKeyOperation/EnableKey" @@ -45,6 +45,8 @@ type KeystoreInstanceKeyOperationClient interface { // * Returns error "code = NotFound desc = key not found in the keystore provider" // if the key does not exist GetKey(ctx context.Context, in *GetKeyRequest, opts ...grpc.CallOption) (*GetKeyResponse, error) + // GetKeyVersions retrieves all versions for a key + GetKeyVersions(ctx context.Context, in *GetKeyVersionsRequest, opts ...grpc.CallOption) (*GetKeyVersionsResponse, error) // CreateKey generates a new key with the specified algorithm CreateKey(ctx context.Context, in *CreateKeyRequest, opts ...grpc.CallOption) (*CreateKeyResponse, error) // DeleteKey removes a key, optionally with a deletion window @@ -85,6 +87,16 @@ func (c *keystoreInstanceKeyOperationClient) GetKey(ctx context.Context, in *Get return out, nil } +func (c *keystoreInstanceKeyOperationClient) GetKeyVersions(ctx context.Context, in *GetKeyVersionsRequest, opts ...grpc.CallOption) (*GetKeyVersionsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetKeyVersionsResponse) + err := c.cc.Invoke(ctx, KeystoreInstanceKeyOperation_GetKeyVersions_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *keystoreInstanceKeyOperationClient) CreateKey(ctx context.Context, in *CreateKeyRequest, opts ...grpc.CallOption) (*CreateKeyResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(CreateKeyResponse) @@ -197,6 +209,8 @@ type KeystoreInstanceKeyOperationServer interface { // * Returns error "code = NotFound desc = key not found in the keystore provider" // if the key does not exist GetKey(context.Context, *GetKeyRequest) (*GetKeyResponse, error) + // GetKeyVersions retrieves all versions for a key + GetKeyVersions(context.Context, *GetKeyVersionsRequest) (*GetKeyVersionsResponse, error) // CreateKey generates a new key with the specified algorithm CreateKey(context.Context, *CreateKeyRequest) (*CreateKeyResponse, error) // DeleteKey removes a key, optionally with a deletion window @@ -230,6 +244,9 @@ type UnimplementedKeystoreInstanceKeyOperationServer struct{} func (UnimplementedKeystoreInstanceKeyOperationServer) GetKey(context.Context, *GetKeyRequest) (*GetKeyResponse, error) { return nil, status.Error(codes.Unimplemented, "method GetKey not implemented") } +func (UnimplementedKeystoreInstanceKeyOperationServer) GetKeyVersions(context.Context, *GetKeyVersionsRequest) (*GetKeyVersionsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetKeyVersions not implemented") +} func (UnimplementedKeystoreInstanceKeyOperationServer) CreateKey(context.Context, *CreateKeyRequest) (*CreateKeyResponse, error) { return nil, status.Error(codes.Unimplemented, "method CreateKey not implemented") } @@ -300,6 +317,24 @@ func _KeystoreInstanceKeyOperation_GetKey_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } +func _KeystoreInstanceKeyOperation_GetKeyVersions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetKeyVersionsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeystoreInstanceKeyOperationServer).GetKeyVersions(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KeystoreInstanceKeyOperation_GetKeyVersions_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeystoreInstanceKeyOperationServer).GetKeyVersions(ctx, req.(*GetKeyVersionsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _KeystoreInstanceKeyOperation_CreateKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CreateKeyRequest) if err := dec(in); err != nil { @@ -491,6 +526,10 @@ var KeystoreInstanceKeyOperation_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetKey", Handler: _KeystoreInstanceKeyOperation_GetKey_Handler, }, + { + MethodName: "GetKeyVersions", + Handler: _KeystoreInstanceKeyOperation_GetKeyVersions_Handler, + }, { MethodName: "CreateKey", Handler: _KeystoreInstanceKeyOperation_CreateKey_Handler, diff --git a/proto/plugin/notification/v1/notification.pb.go b/proto/plugin/notification/v1/notification.pb.go index 91e7f74..a3b3f1a 100644 --- a/proto/plugin/notification/v1/notification.pb.go +++ b/proto/plugin/notification/v1/notification.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.35.1 // source: plugin/notification/v1/notification.proto package notificationv1 import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( @@ -215,8 +214,7 @@ const file_plugin_notification_v1_notification_proto_rawDesc = "" + "\x16NOTIFICATION_TYPE_TEXT\x10\x02\x12\x19\n" + "\x15NOTIFICATION_TYPE_WEB\x10\x032\x8c\x01\n" + "\x13NotificationService\x12u\n" + - "\x10SendNotification\x12/.plugin.notification.v1.SendNotificationRequest\x1a0.plugin.notification.v1.SendNotificationResponseB\xf4\x01\n" + - "\x1acom.plugin.notification.v1B\x11NotificationProtoP\x01ZIgithub.com/openkcm/plugin-sdk/proto/plugin/notification/v1;notificationv1\xa2\x02\x03PNX\xaa\x02\x16Plugin.Notification.V1\xca\x02\x16Plugin\\Notification\\V1\xe2\x02\"Plugin\\Notification\\V1\\GPBMetadata\xea\x02\x18Plugin::Notification::V1b\x06proto3" + "\x10SendNotification\x12/.plugin.notification.v1.SendNotificationRequest\x1a0.plugin.notification.v1.SendNotificationResponseBKZIgithub.com/openkcm/plugin-sdk/proto/plugin/notification/v1;notificationv1b\x06proto3" var ( file_plugin_notification_v1_notification_proto_rawDescOnce sync.Once diff --git a/proto/plugin/notification/v1/notification.pb.validate.go b/proto/plugin/notification/v1/notification.pb.validate.go deleted file mode 100644 index 4143db3..0000000 --- a/proto/plugin/notification/v1/notification.pb.validate.go +++ /dev/null @@ -1,250 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/notification/v1/notification.proto - -package notificationv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on SendNotificationRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SendNotificationRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SendNotificationRequest with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SendNotificationRequestMultiError, or nil if none found. -func (m *SendNotificationRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *SendNotificationRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for NotificationType - - // no validation rules for Subject - - // no validation rules for Body - - if len(errors) > 0 { - return SendNotificationRequestMultiError(errors) - } - - return nil -} - -// SendNotificationRequestMultiError is an error wrapping multiple validation -// errors returned by SendNotificationRequest.ValidateAll() if the designated -// constraints aren't met. -type SendNotificationRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SendNotificationRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SendNotificationRequestMultiError) AllErrors() []error { return m } - -// SendNotificationRequestValidationError is the validation error returned by -// SendNotificationRequest.Validate if the designated constraints aren't met. -type SendNotificationRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SendNotificationRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SendNotificationRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SendNotificationRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SendNotificationRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SendNotificationRequestValidationError) ErrorName() string { - return "SendNotificationRequestValidationError" -} - -// Error satisfies the builtin error interface -func (e SendNotificationRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSendNotificationRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SendNotificationRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SendNotificationRequestValidationError{} - -// Validate checks the field values on SendNotificationResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the first error encountered is returned, or nil if there are no violations. -func (m *SendNotificationResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on SendNotificationResponse with the -// rules defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// SendNotificationResponseMultiError, or nil if none found. -func (m *SendNotificationResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *SendNotificationResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Success - - // no validation rules for Message - - if len(errors) > 0 { - return SendNotificationResponseMultiError(errors) - } - - return nil -} - -// SendNotificationResponseMultiError is an error wrapping multiple validation -// errors returned by SendNotificationResponse.ValidateAll() if the designated -// constraints aren't met. -type SendNotificationResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m SendNotificationResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m SendNotificationResponseMultiError) AllErrors() []error { return m } - -// SendNotificationResponseValidationError is the validation error returned by -// SendNotificationResponse.Validate if the designated constraints aren't met. -type SendNotificationResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e SendNotificationResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e SendNotificationResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e SendNotificationResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e SendNotificationResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e SendNotificationResponseValidationError) ErrorName() string { - return "SendNotificationResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e SendNotificationResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sSendNotificationResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = SendNotificationResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = SendNotificationResponseValidationError{} diff --git a/proto/plugin/notification/v1/notification.proto b/proto/plugin/notification/v1/notification.proto index 169284a..8e2d711 100644 --- a/proto/plugin/notification/v1/notification.proto +++ b/proto/plugin/notification/v1/notification.proto @@ -1,6 +1,8 @@ syntax = "proto3"; package plugin.notification.v1; +option go_package = "github.com/openkcm/plugin-sdk/proto/plugin/notification/v1;notificationv1"; + service NotificationService { // SendNotification sends a notification to the specified recipients rpc SendNotification(SendNotificationRequest) returns (SendNotificationResponse); diff --git a/proto/plugin/notification/v1/notification_ext_plugin.pb.go b/proto/plugin/notification/v1/notification_ext_plugin.pb.go index 5e56ebd..7554136 100644 --- a/proto/plugin/notification/v1/notification_ext_plugin.pb.go +++ b/proto/plugin/notification/v1/notification_ext_plugin.pb.go @@ -3,9 +3,8 @@ package notificationv1 import ( - grpc "google.golang.org/grpc" - api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" ) const ( diff --git a/proto/plugin/notification/v1/notification_grpc.pb.go b/proto/plugin/notification/v1/notification_grpc.pb.go index 52d6536..adffff5 100644 --- a/proto/plugin/notification/v1/notification_grpc.pb.go +++ b/proto/plugin/notification/v1/notification_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.35.1 // source: plugin/notification/v1/notification.proto package notificationv1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/proto/plugin/systeminformation/v1/systeminformation.pb.go b/proto/plugin/systeminformation/v1/systeminformation.pb.go index 298f3e0..3d0d27d 100644 --- a/proto/plugin/systeminformation/v1/systeminformation.pb.go +++ b/proto/plugin/systeminformation/v1/systeminformation.pb.go @@ -1,19 +1,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.35.1 // source: plugin/systeminformation/v1/systeminformation.proto package systeminformationv1 import ( - reflect "reflect" - sync "sync" - unsafe "unsafe" - _ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" ) const ( @@ -136,8 +135,7 @@ const file_plugin_systeminformation_v1_systeminformation_proto_rawDesc = "" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x012t\n" + "\x18SystemInformationService\x12X\n" + - "\x03Get\x12'.plugin.systeminformation.v1.GetRequest\x1a(.plugin.systeminformation.v1.GetResponseB\x9c\x02\n" + - "\x1fcom.plugin.systeminformation.v1B\x16SysteminformationProtoP\x01ZSgithub.com/openkcm/plugin-sdk/proto/plugin/systeminformation/v1;systeminformationv1\xa2\x02\x03PSX\xaa\x02\x1bPlugin.Systeminformation.V1\xca\x02\x1bPlugin\\Systeminformation\\V1\xe2\x02'Plugin\\Systeminformation\\V1\\GPBMetadata\xea\x02\x1dPlugin::Systeminformation::V1b\x06proto3" + "\x03Get\x12'.plugin.systeminformation.v1.GetRequest\x1a(.plugin.systeminformation.v1.GetResponseBUZSgithub.com/openkcm/plugin-sdk/proto/plugin/systeminformation/v1;systeminformationv1b\x06proto3" var ( file_plugin_systeminformation_v1_systeminformation_proto_rawDescOnce sync.Once diff --git a/proto/plugin/systeminformation/v1/systeminformation.pb.validate.go b/proto/plugin/systeminformation/v1/systeminformation.pb.validate.go deleted file mode 100644 index 699461c..0000000 --- a/proto/plugin/systeminformation/v1/systeminformation.pb.validate.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/systeminformation/v1/systeminformation.proto - -package systeminformationv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on GetRequest with the rules defined in the -// proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GetRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetRequest with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetRequestMultiError, or -// nil if none found. -func (m *GetRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *GetRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Id - - // no validation rules for Type - - if len(errors) > 0 { - return GetRequestMultiError(errors) - } - - return nil -} - -// GetRequestMultiError is an error wrapping multiple validation errors -// returned by GetRequest.ValidateAll() if the designated constraints aren't met. -type GetRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetRequestMultiError) AllErrors() []error { return m } - -// GetRequestValidationError is the validation error returned by -// GetRequest.Validate if the designated constraints aren't met. -type GetRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetRequestValidationError) ErrorName() string { return "GetRequestValidationError" } - -// Error satisfies the builtin error interface -func (e GetRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetRequestValidationError{} - -// Validate checks the field values on GetResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *GetResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on GetResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in GetResponseMultiError, or -// nil if none found. -func (m *GetResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *GetResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Metadata - - if len(errors) > 0 { - return GetResponseMultiError(errors) - } - - return nil -} - -// GetResponseMultiError is an error wrapping multiple validation errors -// returned by GetResponse.ValidateAll() if the designated constraints aren't met. -type GetResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m GetResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m GetResponseMultiError) AllErrors() []error { return m } - -// GetResponseValidationError is the validation error returned by -// GetResponse.Validate if the designated constraints aren't met. -type GetResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e GetResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e GetResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e GetResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e GetResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e GetResponseValidationError) ErrorName() string { return "GetResponseValidationError" } - -// Error satisfies the builtin error interface -func (e GetResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sGetResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = GetResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = GetResponseValidationError{} diff --git a/proto/plugin/systeminformation/v1/systeminformation.proto b/proto/plugin/systeminformation/v1/systeminformation.proto index d103627..80ffea8 100644 --- a/proto/plugin/systeminformation/v1/systeminformation.proto +++ b/proto/plugin/systeminformation/v1/systeminformation.proto @@ -3,6 +3,8 @@ package plugin.systeminformation.v1; import "buf/validate/validate.proto"; +option go_package = "github.com/openkcm/plugin-sdk/proto/plugin/systeminformation/v1;systeminformationv1"; + service SystemInformationService { rpc Get(GetRequest) returns (GetResponse); } diff --git a/proto/plugin/systeminformation/v1/systeminformation_ext_plugin.pb.go b/proto/plugin/systeminformation/v1/systeminformation_ext_plugin.pb.go index ed262bd..a01305b 100644 --- a/proto/plugin/systeminformation/v1/systeminformation_ext_plugin.pb.go +++ b/proto/plugin/systeminformation/v1/systeminformation_ext_plugin.pb.go @@ -3,9 +3,8 @@ package systeminformationv1 import ( - grpc "google.golang.org/grpc" - api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" ) const ( diff --git a/proto/plugin/systeminformation/v1/systeminformation_grpc.pb.go b/proto/plugin/systeminformation/v1/systeminformation_grpc.pb.go index bf05e12..dcc330c 100644 --- a/proto/plugin/systeminformation/v1/systeminformation_grpc.pb.go +++ b/proto/plugin/systeminformation/v1/systeminformation_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.35.1 // source: plugin/systeminformation/v1/systeminformation.proto package systeminformationv1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/proto/plugin/systeminformation/v1/systeminformation_test.go b/proto/plugin/systeminformation/v1/systeminformation_test.go deleted file mode 100644 index db6a7cf..0000000 --- a/proto/plugin/systeminformation/v1/systeminformation_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package systeminformationv1 - -import "testing" - -func TestGetRequestTypeString(t *testing.T) { - req := &GetRequest{ - Id: "id-1", - Type: "SYSTEM", - } - - if got := req.GetType(); got != "SYSTEM" { - t.Fatalf("expected type SYSTEM, got %q", got) - } -} diff --git a/proto/plugin/test/v1/test.pb.go b/proto/plugin/test/v1/test.pb.go index 35982d9..6399f1c 100644 --- a/proto/plugin/test/v1/test.pb.go +++ b/proto/plugin/test/v1/test.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.35.1 // source: plugin/test/v1/test.proto package testv1 import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( @@ -120,8 +119,7 @@ const file_plugin_test_v1_test_proto_rawDesc = "" + "\fTestResponse\x12\x1a\n" + "\bresponse\x18\x01 \x01(\tR\bresponse2P\n" + "\vTestService\x12A\n" + - "\x04Test\x12\x1b.plugin.test.v1.TestRequest\x1a\x1c.plugin.test.v1.TestResponseB\xb4\x01\n" + - "\x12com.plugin.test.v1B\tTestProtoP\x01Z9github.com/openkcm/plugin-sdk/proto/plugin/test/v1;testv1\xa2\x02\x03PTX\xaa\x02\x0ePlugin.Test.V1\xca\x02\x0ePlugin\\Test\\V1\xe2\x02\x1aPlugin\\Test\\V1\\GPBMetadata\xea\x02\x10Plugin::Test::V1b\x06proto3" + "\x04Test\x12\x1b.plugin.test.v1.TestRequest\x1a\x1c.plugin.test.v1.TestResponseB;Z9github.com/openkcm/plugin-sdk/proto/plugin/test/v1;testv1b\x06proto3" var ( file_plugin_test_v1_test_proto_rawDescOnce sync.Once diff --git a/proto/plugin/test/v1/test.pb.validate.go b/proto/plugin/test/v1/test.pb.validate.go deleted file mode 100644 index c2dc489..0000000 --- a/proto/plugin/test/v1/test.pb.validate.go +++ /dev/null @@ -1,238 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: plugin/test/v1/test.proto - -package testv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on TestRequest with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *TestRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TestRequest with the rules defined in -// the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in TestRequestMultiError, or -// nil if none found. -func (m *TestRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *TestRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Request - - if len(errors) > 0 { - return TestRequestMultiError(errors) - } - - return nil -} - -// TestRequestMultiError is an error wrapping multiple validation errors -// returned by TestRequest.ValidateAll() if the designated constraints aren't met. -type TestRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TestRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TestRequestMultiError) AllErrors() []error { return m } - -// TestRequestValidationError is the validation error returned by -// TestRequest.Validate if the designated constraints aren't met. -type TestRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TestRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TestRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TestRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TestRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TestRequestValidationError) ErrorName() string { return "TestRequestValidationError" } - -// Error satisfies the builtin error interface -func (e TestRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTestRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TestRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TestRequestValidationError{} - -// Validate checks the field values on TestResponse with the rules defined in -// the proto definition for this message. If any rules are violated, the first -// error encountered is returned, or nil if there are no violations. -func (m *TestResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on TestResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// result is a list of violation errors wrapped in TestResponseMultiError, or -// nil if none found. -func (m *TestResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *TestResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for Response - - if len(errors) > 0 { - return TestResponseMultiError(errors) - } - - return nil -} - -// TestResponseMultiError is an error wrapping multiple validation errors -// returned by TestResponse.ValidateAll() if the designated constraints aren't met. -type TestResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m TestResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m TestResponseMultiError) AllErrors() []error { return m } - -// TestResponseValidationError is the validation error returned by -// TestResponse.Validate if the designated constraints aren't met. -type TestResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e TestResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e TestResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e TestResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e TestResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e TestResponseValidationError) ErrorName() string { return "TestResponseValidationError" } - -// Error satisfies the builtin error interface -func (e TestResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sTestResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = TestResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = TestResponseValidationError{} diff --git a/proto/plugin/test/v1/test.proto b/proto/plugin/test/v1/test.proto index b1be06f..59c3ad0 100644 --- a/proto/plugin/test/v1/test.proto +++ b/proto/plugin/test/v1/test.proto @@ -1,6 +1,8 @@ syntax = "proto3"; package plugin.test.v1; +option go_package = "github.com/openkcm/plugin-sdk/proto/plugin/test/v1;testv1"; + service TestService { rpc Test(TestRequest) returns (TestResponse); } diff --git a/proto/plugin/test/v1/test_ext_plugin.pb.go b/proto/plugin/test/v1/test_ext_plugin.pb.go index bac0b2f..7078613 100644 --- a/proto/plugin/test/v1/test_ext_plugin.pb.go +++ b/proto/plugin/test/v1/test_ext_plugin.pb.go @@ -3,9 +3,8 @@ package testv1 import ( - grpc "google.golang.org/grpc" - api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" ) const ( diff --git a/proto/plugin/test/v1/test_grpc.pb.go b/proto/plugin/test/v1/test_grpc.pb.go index 9d03b08..a4a0fe2 100644 --- a/proto/plugin/test/v1/test_grpc.pb.go +++ b/proto/plugin/test/v1/test_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.35.1 // source: plugin/test/v1/test.proto package testv1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/proto/service/common/config/v1/config.pb.go b/proto/service/common/config/v1/config.pb.go index accea24..4a1552b 100644 --- a/proto/service/common/config/v1/config.pb.go +++ b/proto/service/common/config/v1/config.pb.go @@ -1,18 +1,17 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc (unknown) +// protoc v7.35.1 // source: service/common/config/v1/config.proto package configv1 import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" unsafe "unsafe" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" ) const ( @@ -123,8 +122,7 @@ const file_service_common_config_v1_config_proto_rawDesc = "" + "build_info\x18\x01 \x01(\tH\x00R\tbuildInfo\x88\x01\x01B\r\n" + "\v_build_info2n\n" + "\x06Config\x12d\n" + - "\tConfigure\x12*.service.common.config.v1.ConfigureRequest\x1a+.service.common.config.v1.ConfigureResponseB\xf5\x01\n" + - "\x1ccom.service.common.config.v1B\vConfigProtoP\x01ZEgithub.com/openkcm/plugin-sdk/proto/service/common/config/v1;configv1\xa2\x02\x03SCC\xaa\x02\x18Service.Common.Config.V1\xca\x02\x18Service\\Common\\Config\\V1\xe2\x02$Service\\Common\\Config\\V1\\GPBMetadata\xea\x02\x1bService::Common::Config::V1b\x06proto3" + "\tConfigure\x12*.service.common.config.v1.ConfigureRequest\x1a+.service.common.config.v1.ConfigureResponseBGZEgithub.com/openkcm/plugin-sdk/proto/service/common/config/v1;configv1b\x06proto3" var ( file_service_common_config_v1_config_proto_rawDescOnce sync.Once diff --git a/proto/service/common/config/v1/config.pb.validate.go b/proto/service/common/config/v1/config.pb.validate.go deleted file mode 100644 index bcd9b9d..0000000 --- a/proto/service/common/config/v1/config.pb.validate.go +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by protoc-gen-validate. DO NOT EDIT. -// source: service/common/config/v1/config.proto - -package configv1 - -import ( - "bytes" - "errors" - "fmt" - "net" - "net/mail" - "net/url" - "regexp" - "sort" - "strings" - "time" - "unicode/utf8" - - "google.golang.org/protobuf/types/known/anypb" -) - -// ensure the imports are used -var ( - _ = bytes.MinRead - _ = errors.New("") - _ = fmt.Print - _ = utf8.UTFMax - _ = (*regexp.Regexp)(nil) - _ = (*strings.Reader)(nil) - _ = net.IPv4len - _ = time.Duration(0) - _ = (*url.URL)(nil) - _ = (*mail.Address)(nil) - _ = anypb.Any{} - _ = sort.Sort -) - -// Validate checks the field values on ConfigureRequest with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ConfigureRequest) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ConfigureRequest with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ConfigureRequestMultiError, or nil if none found. -func (m *ConfigureRequest) ValidateAll() error { - return m.validate(true) -} - -func (m *ConfigureRequest) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - // no validation rules for YamlConfiguration - - if len(errors) > 0 { - return ConfigureRequestMultiError(errors) - } - - return nil -} - -// ConfigureRequestMultiError is an error wrapping multiple validation errors -// returned by ConfigureRequest.ValidateAll() if the designated constraints -// aren't met. -type ConfigureRequestMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ConfigureRequestMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ConfigureRequestMultiError) AllErrors() []error { return m } - -// ConfigureRequestValidationError is the validation error returned by -// ConfigureRequest.Validate if the designated constraints aren't met. -type ConfigureRequestValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ConfigureRequestValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ConfigureRequestValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ConfigureRequestValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ConfigureRequestValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ConfigureRequestValidationError) ErrorName() string { return "ConfigureRequestValidationError" } - -// Error satisfies the builtin error interface -func (e ConfigureRequestValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sConfigureRequest.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ConfigureRequestValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ConfigureRequestValidationError{} - -// Validate checks the field values on ConfigureResponse with the rules defined -// in the proto definition for this message. If any rules are violated, the -// first error encountered is returned, or nil if there are no violations. -func (m *ConfigureResponse) Validate() error { - return m.validate(false) -} - -// ValidateAll checks the field values on ConfigureResponse with the rules -// defined in the proto definition for this message. If any rules are -// violated, the result is a list of violation errors wrapped in -// ConfigureResponseMultiError, or nil if none found. -func (m *ConfigureResponse) ValidateAll() error { - return m.validate(true) -} - -func (m *ConfigureResponse) validate(all bool) error { - if m == nil { - return nil - } - - var errors []error - - if m.BuildInfo != nil { - // no validation rules for BuildInfo - } - - if len(errors) > 0 { - return ConfigureResponseMultiError(errors) - } - - return nil -} - -// ConfigureResponseMultiError is an error wrapping multiple validation errors -// returned by ConfigureResponse.ValidateAll() if the designated constraints -// aren't met. -type ConfigureResponseMultiError []error - -// Error returns a concatenation of all the error messages it wraps. -func (m ConfigureResponseMultiError) Error() string { - msgs := make([]string, 0, len(m)) - for _, err := range m { - msgs = append(msgs, err.Error()) - } - return strings.Join(msgs, "; ") -} - -// AllErrors returns a list of validation violation errors. -func (m ConfigureResponseMultiError) AllErrors() []error { return m } - -// ConfigureResponseValidationError is the validation error returned by -// ConfigureResponse.Validate if the designated constraints aren't met. -type ConfigureResponseValidationError struct { - field string - reason string - cause error - key bool -} - -// Field function returns field value. -func (e ConfigureResponseValidationError) Field() string { return e.field } - -// Reason function returns reason value. -func (e ConfigureResponseValidationError) Reason() string { return e.reason } - -// Cause function returns cause value. -func (e ConfigureResponseValidationError) Cause() error { return e.cause } - -// Key function returns key value. -func (e ConfigureResponseValidationError) Key() bool { return e.key } - -// ErrorName returns error name. -func (e ConfigureResponseValidationError) ErrorName() string { - return "ConfigureResponseValidationError" -} - -// Error satisfies the builtin error interface -func (e ConfigureResponseValidationError) Error() string { - cause := "" - if e.cause != nil { - cause = fmt.Sprintf(" | caused by: %v", e.cause) - } - - key := "" - if e.key { - key = "key for " - } - - return fmt.Sprintf( - "invalid %sConfigureResponse.%s: %s%s", - key, - e.field, - e.reason, - cause) -} - -var _ error = ConfigureResponseValidationError{} - -var _ interface { - Field() string - Reason() string - Key() bool - Cause() error - ErrorName() string -} = ConfigureResponseValidationError{} diff --git a/proto/service/common/config/v1/config.proto b/proto/service/common/config/v1/config.proto index 7846455..6b3a73d 100644 --- a/proto/service/common/config/v1/config.proto +++ b/proto/service/common/config/v1/config.proto @@ -1,6 +1,8 @@ syntax = "proto3"; package service.common.config.v1; +option go_package = "github.com/openkcm/plugin-sdk/proto/service/common/config/v1;configv1"; + service Config { // Configure the plugin with the plugin specific configuration data and a set the core configuration. It is // currently called when the plugin is first loaded after it has been initialized. At a future point, it may diff --git a/proto/service/common/config/v1/config_ext_service.pb.go b/proto/service/common/config/v1/config_ext_service.pb.go index 67e9075..7ba1c52 100644 --- a/proto/service/common/config/v1/config_ext_service.pb.go +++ b/proto/service/common/config/v1/config_ext_service.pb.go @@ -3,9 +3,8 @@ package configv1 import ( - grpc "google.golang.org/grpc" - api "github.com/openkcm/plugin-sdk/api" + grpc "google.golang.org/grpc" ) const ( diff --git a/proto/service/common/config/v1/config_grpc.pb.go b/proto/service/common/config/v1/config_grpc.pb.go index 5c1ab1c..effd324 100644 --- a/proto/service/common/config/v1/config_grpc.pb.go +++ b/proto/service/common/config/v1/config_grpc.pb.go @@ -1,14 +1,13 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.1 -// - protoc (unknown) +// - protoc-gen-go-grpc v1.6.2 +// - protoc v7.35.1 // source: service/common/config/v1/config.proto package configv1 import ( context "context" - grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/protofetch.lock b/protofetch.lock new file mode 100644 index 0000000..64a61e7 --- /dev/null +++ b/protofetch.lock @@ -0,0 +1,7 @@ +version = 2 + +[[dependencies]] +name = "protovalidate" +url = "github.com/bufbuild/protovalidate" +revision = "v1.1.1" +commit_hash = "b304b85d7f2f072190ca4315ded920fe2310251f" diff --git a/protofetch.toml b/protofetch.toml new file mode 100644 index 0000000..198240a --- /dev/null +++ b/protofetch.toml @@ -0,0 +1,8 @@ +name = "github.com/openkcm/plugin-sdk" +description = "Plugins SDK of the OpenKCM project" + +[protovalidate] +url = "github.com/bufbuild/protovalidate" +revision = "v1.1.1" +content_roots = ["/proto/protovalidate"] +allow_policies = ["buf/validate/*"] diff --git a/vendor-proto/buf/validate/validate.proto b/vendor-proto/buf/validate/validate.proto new file mode 100644 index 0000000..f0371d3 --- /dev/null +++ b/vendor-proto/buf/validate/validate.proto @@ -0,0 +1,5057 @@ +// Copyright 2023-2026 Buf Technologies, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto2"; + +// [Protovalidate](https://protovalidate.com/) is the semantic validation library for Protobuf. +// It provides standard annotations to validate common rules on messages and fields, as well as the ability to use [CEL](https://cel.dev) to write custom rules. +// It's the next generation of [protoc-gen-validate](https://github.com/bufbuild/protoc-gen-validate). +// +// This package provides the options, messages, and enums that power Protovalidate. +// Apply its options to messages, fields, and oneofs in your Protobuf schemas to add validation rules: +// +// ```proto +// message User { +// string id = 1 [(buf.validate.field).string.uuid = true]; +// string first_name = 2 [(buf.validate.field).string.max_len = 64]; +// string last_name = 3 [(buf.validate.field).string.max_len = 64]; +// +// option (buf.validate.message).cel = { +// id: "first_name_requires_last_name" +// message: "last_name must be present if first_name is present" +// expression: "!has(this.first_name) || has(this.last_name)" +// }; +// } +// ``` +// +// These rules are enforced at runtime by language-specific libraries. +// See the [developer quickstart](https://protovalidate.com/quickstart/) to get started, or go directly to the runtime library for your language: +// [Go](https://github.com/bufbuild/protovalidate-go) +// [JavaScript/TypeScript](https://github.com/bufbuild/protovalidate-es), +// [Java](https://github.com/bufbuild/protovalidate-java), +// [Python](https://github.com/bufbuild/protovalidate-python), +// or [C++](https://github.com/bufbuild/protovalidate-cc). +package buf.validate; + +import "google/protobuf/descriptor.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"; +option java_multiple_files = true; +option java_outer_classname = "ValidateProto"; +option java_package = "build.buf.validate"; + +// MessageOptions is an extension to google.protobuf.MessageOptions. It allows +// the addition of validation rules at the message level. These rules can be +// applied to incoming messages to ensure they meet certain criteria before +// being processed. +extend google.protobuf.MessageOptions { + // Rules specify the validations to be performed on this message. By default, + // no validation is performed against a message. + optional MessageRules message = 1159; +} + +// OneofOptions is an extension to google.protobuf.OneofOptions. It allows +// the addition of validation rules on a oneof. These rules can be +// applied to incoming messages to ensure they meet certain criteria before +// being processed. +extend google.protobuf.OneofOptions { + // Rules specify the validations to be performed on this oneof. By default, + // no validation is performed against a oneof. + optional OneofRules oneof = 1159; +} + +// FieldOptions is an extension to google.protobuf.FieldOptions. It allows +// the addition of validation rules at the field level. These rules can be +// applied to incoming messages to ensure they meet certain criteria before +// being processed. +extend google.protobuf.FieldOptions { + // Rules specify the validations to be performed on this field. By default, + // no validation is performed against a field. + optional FieldRules field = 1159; + + // Specifies predefined rules. When extending a standard rule message, + // this adds additional CEL expressions that apply when the extension is used. + // + // ```proto + // extend buf.validate.Int32Rules { + // bool is_zero [(buf.validate.predefined).cel = { + // id: "int32.is_zero", + // message: "value must be zero", + // expression: "!rule || this == 0", + // }]; + // } + // + // message Foo { + // int32 reserved = 1 [(buf.validate.field).int32.(is_zero) = true]; + // } + // ``` + optional PredefinedRules predefined = 1160; +} + +// `Rule` represents a validation rule written in the Common Expression +// Language (CEL) syntax. Each Rule includes a unique identifier, an +// optional error message, and the CEL expression to evaluate. For more +// information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). +// +// ```proto +// message Foo { +// option (buf.validate.message).cel = { +// id: "foo.bar" +// message: "bar must be greater than 0" +// expression: "this.bar > 0" +// }; +// int32 bar = 1; +// } +// ``` +message Rule { + // `id` is a string that serves as a machine-readable name for this Rule. + // It should be unique within its scope, which could be either a message or a field. + optional string id = 1; + + // `message` is an optional field that provides a human-readable error message + // for this Rule when the CEL expression evaluates to false. If a + // non-empty message is provided, any strings resulting from the CEL + // expression evaluation are ignored. + optional string message = 2; + + // `expression` is the actual CEL expression that will be evaluated for + // validation. This string must resolve to either a boolean or a string + // value. If the expression evaluates to false or a non-empty string, the + // validation is considered failed, and the message is rejected. + optional string expression = 3; +} + +// MessageRules represents validation rules that are applied to the entire message. +// It includes disabling options and a list of Rule messages representing Common Expression Language (CEL) validation rules. +message MessageRules { + // `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation + // rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax. + // + // This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for + // simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will + // be same as the `expression`. + // + // For more information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + // + // ```proto + // message MyMessage { + // // The field `foo` must be greater than 42. + // option (buf.validate.message).cel_expression = "this.foo > 42"; + // // The field `foo` must be less than 84. + // option (buf.validate.message).cel_expression = "this.foo < 84"; + // optional int32 foo = 1; + // } + // ``` + repeated string cel_expression = 5; + // `cel` is a repeated field of type Rule. Each Rule specifies a validation rule to be applied to this message. + // These rules are written in Common Expression Language (CEL) syntax. For more information, + // [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + // + // + // ```proto + // message MyMessage { + // // The field `foo` must be greater than 42. + // option (buf.validate.message).cel = { + // id: "my_message.value", + // message: "value must be greater than 42", + // expression: "this.foo > 42", + // }; + // optional int32 foo = 1; + // } + // ``` + repeated Rule cel = 3; + + // `oneof` is a repeated field of type MessageOneofRule that specifies a list of fields + // of which at most one can be present. If `required` is also specified, then exactly one + // of the specified fields _must_ be present. + // + // This will enforce oneof-like constraints with a few features not provided by + // actual Protobuf oneof declarations: + // 1. Repeated and map fields are allowed in this validation. In a Protobuf oneof, + // only scalar fields are allowed. + // 2. Fields with implicit presence are allowed. In a Protobuf oneof, all member + // fields have explicit presence. This means that, for the purpose of determining + // how many fields are set, explicitly setting such a field to its zero value is + // effectively the same as not setting it at all. + // 3. This will always generate validation errors for a message unmarshalled from + // serialized data that sets more than one field. With a Protobuf oneof, when + // multiple fields are present in the serialized form, earlier values are usually + // silently ignored when unmarshalling, with only the last field being set when + // unmarshalling completes. + // + // Note that adding a field to a `oneof` will also set the IGNORE_IF_ZERO_VALUE on the fields. This means + // only the field that is set will be validated and the unset fields are not validated according to the field rules. + // This behavior can be overridden by setting `ignore` against a field. + // + // ```proto + // message MyMessage { + // // Only one of `field1` or `field2` _can_ be present in this message. + // option (buf.validate.message).oneof = { fields: ["field1", "field2"] }; + // // Exactly one of `field3` or `field4` _must_ be present in this message. + // option (buf.validate.message).oneof = { fields: ["field3", "field4"], required: true }; + // string field1 = 1; + // bytes field2 = 2; + // bool field3 = 3; + // int32 field4 = 4; + // } + // ``` + repeated MessageOneofRule oneof = 4; + + reserved 1; + reserved "disabled"; +} + +message MessageOneofRule { + // A list of field names to include in the oneof. All field names must be + // defined in the message. At least one field must be specified, and + // duplicates are not permitted. + repeated string fields = 1; + // If true, one of the fields specified _must_ be set. + optional bool required = 2; +} + +// The `OneofRules` message type enables you to manage rules for +// oneof fields in your protobuf messages. +message OneofRules { + // If `required` is true, exactly one field of the oneof must be set. A + // validation error is returned if no fields in the oneof are set. Further rules + // should be placed on the fields themselves to ensure they are valid values, + // such as `min_len` or `gt`. + // + // ```proto + // message MyMessage { + // oneof value { + // // Either `a` or `b` must be set. If `a` is set, it must also be + // // non-empty; whereas if `b` is set, it can still be an empty string. + // option (buf.validate.oneof).required = true; + // string a = 1 [(buf.validate.field).string.min_len = 1]; + // string b = 2; + // } + // } + // ``` + optional bool required = 1; +} + +// FieldRules encapsulates the rules for each type of field. Depending on +// the field, the correct set should be used to ensure proper validations. +message FieldRules { + // `cel_expression` is a repeated field CEL expressions. Each expression specifies a validation + // rule to be applied to this message. These rules are written in Common Expression Language (CEL) syntax. + // + // This is a simplified form of the `cel` Rule field, where only `expression` is set. This allows for + // simpler syntax when defining CEL Rules where `id` and `message` derived from the `expression`. `id` will + // be same as the `expression`. + // + // For more information, [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + // + // ```proto + // message MyMessage { + // // The field `value` must be greater than 42. + // optional int32 value = 1 [(buf.validate.field).cel_expression = "this > 42"]; + // } + // ``` + repeated string cel_expression = 29; + // `cel` is a repeated field used to represent a textual expression + // in the Common Expression Language (CEL) syntax. For more information, + // [see our documentation](https://buf.build/docs/protovalidate/schemas/custom-rules/). + // + // ```proto + // message MyMessage { + // // The field `value` must be greater than 42. + // optional int32 value = 1 [(buf.validate.field).cel = { + // id: "my_message.value", + // message: "value must be greater than 42", + // expression: "this > 42", + // }]; + // } + // ``` + repeated Rule cel = 23; + // If `required` is true, the field must be set. A validation error is returned + // if the field is not set. + // + // ```proto + // syntax="proto3"; + // + // message FieldsWithPresence { + // // Requires any string to be set, including the empty string. + // optional string link = 1 [ + // (buf.validate.field).required = true + // ]; + // // Requires true or false to be set. + // optional bool disabled = 2 [ + // (buf.validate.field).required = true + // ]; + // // Requires a message to be set, including the empty message. + // SomeMessage msg = 4 [ + // (buf.validate.field).required = true + // ]; + // } + // ``` + // + // All fields in the example above track presence. By default, Protovalidate + // ignores rules on those fields if no value is set. `required` ensures that + // the fields are set and valid. + // + // Fields that don't track presence are always validated by Protovalidate, + // whether they are set or not. It is not necessary to add `required`. It + // can be added to indicate that the field cannot be the zero value. + // + // ```proto + // syntax="proto3"; + // + // message FieldsWithoutPresence { + // // `string.email` always applies, even to an empty string. + // string link = 1 [ + // (buf.validate.field).string.email = true + // ]; + // // `repeated.min_items` always applies, even to an empty list. + // repeated string labels = 2 [ + // (buf.validate.field).repeated.min_items = 1 + // ]; + // // `required`, for fields that don't track presence, indicates + // // the value of the field can't be the zero value. + // int32 zero_value_not_allowed = 3 [ + // (buf.validate.field).required = true + // ]; + // } + // ``` + // + // To learn which fields track presence, see the + // [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat). + // + // Note: While field rules can be applied to repeated items, map keys, and map + // values, the elements are always considered to be set. Consequently, + // specifying `repeated.items.required` is redundant. + optional bool required = 25; + // Ignore validation rules on the field if its value matches the specified + // criteria. See the `Ignore` enum for details. + // + // ```proto + // message UpdateRequest { + // // The uri rule only applies if the field is not an empty string. + // string url = 1 [ + // (buf.validate.field).ignore = IGNORE_IF_ZERO_VALUE, + // (buf.validate.field).string.uri = true + // ]; + // } + // ``` + optional Ignore ignore = 27; + + oneof type { + // Scalar Field Types + FloatRules float = 1; + DoubleRules double = 2; + Int32Rules int32 = 3; + Int64Rules int64 = 4; + UInt32Rules uint32 = 5; + UInt64Rules uint64 = 6; + SInt32Rules sint32 = 7; + SInt64Rules sint64 = 8; + Fixed32Rules fixed32 = 9; + Fixed64Rules fixed64 = 10; + SFixed32Rules sfixed32 = 11; + SFixed64Rules sfixed64 = 12; + BoolRules bool = 13; + StringRules string = 14; + BytesRules bytes = 15; + + // Complex Field Types + EnumRules enum = 16; + RepeatedRules repeated = 18; + MapRules map = 19; + + // Well-Known Field Types + AnyRules any = 20; + DurationRules duration = 21; + FieldMaskRules field_mask = 28; + TimestampRules timestamp = 22; + } + + reserved 24, 26; + reserved "skipped", "ignore_empty"; +} + +// PredefinedRules are custom rules that can be re-used with +// multiple fields. +message PredefinedRules { + // `cel` is a repeated field used to represent a textual expression + // in the Common Expression Language (CEL) syntax. For more information, + // [see our documentation](https://buf.build/docs/protovalidate/schemas/predefined-rules/). + // + // ```proto + // message MyMessage { + // // The field `value` must be greater than 42. + // optional int32 value = 1 [(buf.validate.predefined).cel = { + // id: "my_message.value", + // message: "value must be greater than 42", + // expression: "this > 42", + // }]; + // } + // ``` + repeated Rule cel = 1; + + reserved 24, 26; + reserved "skipped", "ignore_empty"; +} + +// Specifies how `FieldRules.ignore` behaves, depending on the field's value, and +// whether the field tracks presence. +enum Ignore { + // Ignore rules if the field tracks presence and is unset. This is the default + // behavior. + // + // In proto3, only message fields, members of a Protobuf `oneof`, and fields + // with the `optional` label track presence. Consequently, the following fields + // are always validated, whether a value is set or not: + // + // ```proto + // syntax="proto3"; + // + // message RulesApply { + // string email = 1 [ + // (buf.validate.field).string.email = true + // ]; + // int32 age = 2 [ + // (buf.validate.field).int32.gt = 0 + // ]; + // repeated string labels = 3 [ + // (buf.validate.field).repeated.min_items = 1 + // ]; + // } + // ``` + // + // In contrast, the following fields track presence, and are only validated if + // a value is set: + // + // ```proto + // syntax="proto3"; + // + // message RulesApplyIfSet { + // optional string email = 1 [ + // (buf.validate.field).string.email = true + // ]; + // oneof ref { + // string reference = 2 [ + // (buf.validate.field).string.uuid = true + // ]; + // string name = 3 [ + // (buf.validate.field).string.min_len = 4 + // ]; + // } + // SomeMessage msg = 4 [ + // (buf.validate.field).cel = {/* ... */} + // ]; + // } + // ``` + // + // To ensure that such a field is set, add the `required` rule. + // + // To learn which fields track presence, see the + // [Field Presence cheat sheet](https://protobuf.dev/programming-guides/field_presence/#cheat). + IGNORE_UNSPECIFIED = 0; + + // Ignore rules if the field is unset, or set to the zero value. + // + // The zero value depends on the field type: + // - For strings, the zero value is the empty string. + // - For bytes, the zero value is empty bytes. + // - For bool, the zero value is false. + // - For numeric types, the zero value is zero. + // - For enums, the zero value is the first defined enum value. + // - For repeated fields, the zero is an empty list. + // - For map fields, the zero is an empty map. + // - For message fields, absence of the message (typically a null-value) is considered zero value. + // + // For fields that track presence (e.g. adding the `optional` label in proto3), + // this a no-op and behavior is the same as the default `IGNORE_UNSPECIFIED`. + IGNORE_IF_ZERO_VALUE = 1; + + // Always ignore rules, including the `required` rule. + // + // This is useful for ignoring the rules of a referenced message, or to + // temporarily ignore rules during development. + // + // ```proto + // message MyMessage { + // // The field's rules will always be ignored, including any validations + // // on value's fields. + // MyOtherMessage value = 1 [ + // (buf.validate.field).ignore = IGNORE_ALWAYS + // ]; + // } + // ``` + IGNORE_ALWAYS = 3; + + reserved 2; + reserved "IGNORE_EMPTY", "IGNORE_DEFAULT", "IGNORE_IF_DEFAULT_VALUE", "IGNORE_IF_UNPOPULATED"; +} + +// FloatRules describes the rules applied to `float` values. These +// rules may also be applied to the `google.protobuf.FloatValue` Well-Known-Type. +message FloatRules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyFloat { + // // value must equal 42.0 + // float value = 1 [(buf.validate.field).float.const = 42.0]; + // } + // ``` + optional float const = 1 [(predefined).cel = { + id: "float.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyFloat { + // // value must be less than 10.0 + // float value = 1 [(buf.validate.field).float.lt = 10.0]; + // } + // ``` + float lt = 2 [(predefined).cel = { + id: "float.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this >= rules.lt)" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyFloat { + // // value must be less than or equal to 10.0 + // float value = 1 [(buf.validate.field).float.lte = 10.0]; + // } + // ``` + float lte = 3 [(predefined).cel = { + id: "float.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this > rules.lte)" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFloat { + // // value must be greater than 5.0 [float.gt] + // float value = 1 [(buf.validate.field).float.gt = 5.0]; + // + // // value must be greater than 5 and less than 10.0 [float.gt_lt] + // float other_value = 2 [(buf.validate.field).float = { gt: 5.0, lt: 10.0 }]; + // + // // value must be greater than 10 or less than 5.0 [float.gt_lt_exclusive] + // float another_value = 3 [(buf.validate.field).float = { gt: 10.0, lt: 5.0 }]; + // } + // ``` + float gt = 4 [ + (predefined).cel = { + id: "float.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this <= rules.gt)" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "float.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this.isNan() || this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "float.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (this.isNan() || (rules.lt <= this && this <= rules.gt))" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "float.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this.isNan() || this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "float.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (this.isNan() || (rules.lte < this && this <= rules.gt))" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFloat { + // // value must be greater than or equal to 5.0 [float.gte] + // float value = 1 [(buf.validate.field).float.gte = 5.0]; + // + // // value must be greater than or equal to 5.0 and less than 10.0 [float.gte_lt] + // float other_value = 2 [(buf.validate.field).float = { gte: 5.0, lt: 10.0 }]; + // + // // value must be greater than or equal to 10.0 or less than 5.0 [float.gte_lt_exclusive] + // float another_value = 3 [(buf.validate.field).float = { gte: 10.0, lt: 5.0 }]; + // } + // ``` + float gte = 5 [ + (predefined).cel = { + id: "float.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this < rules.gte)" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "float.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this.isNan() || this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "float.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (this.isNan() || (rules.lt <= this && this < rules.gte))" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "float.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this.isNan() || this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "float.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (this.isNan() || (rules.lte < this && this < rules.gte))" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message + // is generated. + // + // ```proto + // message MyFloat { + // // value must be in list [1.0, 2.0, 3.0] + // float value = 1 [(buf.validate.field).float = { in: [1.0, 2.0, 3.0] }]; + // } + // ``` + repeated float in = 6 [(predefined).cel = { + id: "float.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyFloat { + // // value must not be in list [1.0, 2.0, 3.0] + // float value = 1 [(buf.validate.field).float = { not_in: [1.0, 2.0, 3.0] }]; + // } + // ``` + repeated float not_in = 7 [(predefined).cel = { + id: "float.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `finite` requires the field value to be finite. If the field value is + // infinite or NaN, an error message is generated. + optional bool finite = 8 [(predefined).cel = { + id: "float.finite" + expression: "rules.finite ? (this.isNan() || this.isInf() ? 'value must be finite' : '') : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyFloat { + // float value = 1 [ + // (buf.validate.field).float.example = 1.0, + // (buf.validate.field).float.example = inf + // ]; + // } + // ``` + repeated float example = 9 [(predefined).cel = { + id: "float.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// DoubleRules describes the rules applied to `double` values. These +// rules may also be applied to the `google.protobuf.DoubleValue` Well-Known-Type. +message DoubleRules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyDouble { + // // value must equal 42.0 + // double value = 1 [(buf.validate.field).double.const = 42.0]; + // } + // ``` + optional double const = 1 [(predefined).cel = { + id: "double.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyDouble { + // // value must be less than 10.0 + // double value = 1 [(buf.validate.field).double.lt = 10.0]; + // } + // ``` + double lt = 2 [(predefined).cel = { + id: "double.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this >= rules.lt)" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified value + // (field <= value). If the field value is greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyDouble { + // // value must be less than or equal to 10.0 + // double value = 1 [(buf.validate.field).double.lte = 10.0]; + // } + // ``` + double lte = 3 [(predefined).cel = { + id: "double.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && (this.isNan() || this > rules.lte)" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or `lte`, + // the range is reversed, and the field value must be outside the specified + // range. If the field value doesn't meet the required conditions, an error + // message is generated. + // + // ```proto + // message MyDouble { + // // value must be greater than 5.0 [double.gt] + // double value = 1 [(buf.validate.field).double.gt = 5.0]; + // + // // value must be greater than 5 and less than 10.0 [double.gt_lt] + // double other_value = 2 [(buf.validate.field).double = { gt: 5.0, lt: 10.0 }]; + // + // // value must be greater than 10 or less than 5.0 [double.gt_lt_exclusive] + // double another_value = 3 [(buf.validate.field).double = { gt: 10.0, lt: 5.0 }]; + // } + // ``` + double gt = 4 [ + (predefined).cel = { + id: "double.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this <= rules.gt)" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "double.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this.isNan() || this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "double.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (this.isNan() || (rules.lt <= this && this <= rules.gt))" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "double.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this.isNan() || this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "double.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (this.isNan() || (rules.lte < this && this <= rules.gt))" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyDouble { + // // value must be greater than or equal to 5.0 [double.gte] + // double value = 1 [(buf.validate.field).double.gte = 5.0]; + // + // // value must be greater than or equal to 5.0 and less than 10.0 [double.gte_lt] + // double other_value = 2 [(buf.validate.field).double = { gte: 5.0, lt: 10.0 }]; + // + // // value must be greater than or equal to 10.0 or less than 5.0 [double.gte_lt_exclusive] + // double another_value = 3 [(buf.validate.field).double = { gte: 10.0, lt: 5.0 }]; + // } + // ``` + double gte = 5 [ + (predefined).cel = { + id: "double.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && (this.isNan() || this < rules.gte)" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "double.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this.isNan() || this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "double.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (this.isNan() || (rules.lt <= this && this < rules.gte))" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "double.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this.isNan() || this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "double.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (this.isNan() || (rules.lte < this && this < rules.gte))" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyDouble { + // // value must be in list [1.0, 2.0, 3.0] + // double value = 1 [(buf.validate.field).double = { in: [1.0, 2.0, 3.0] }]; + // } + // ``` + repeated double in = 6 [(predefined).cel = { + id: "double.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyDouble { + // // value must not be in list [1.0, 2.0, 3.0] + // double value = 1 [(buf.validate.field).double = { not_in: [1.0, 2.0, 3.0] }]; + // } + // ``` + repeated double not_in = 7 [(predefined).cel = { + id: "double.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `finite` requires the field value to be finite. If the field value is + // infinite or NaN, an error message is generated. + optional bool finite = 8 [(predefined).cel = { + id: "double.finite" + expression: "rules.finite ? (this.isNan() || this.isInf() ? 'value must be finite' : '') : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyDouble { + // double value = 1 [ + // (buf.validate.field).double.example = 1.0, + // (buf.validate.field).double.example = inf + // ]; + // } + // ``` + repeated double example = 9 [(predefined).cel = { + id: "double.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// Int32Rules describes the rules applied to `int32` values. These +// rules may also be applied to the `google.protobuf.Int32Value` Well-Known-Type. +message Int32Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must equal 42 + // int32 value = 1 [(buf.validate.field).int32.const = 42]; + // } + // ``` + optional int32 const = 1 [(predefined).cel = { + id: "int32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field + // < value). If the field value is equal to or greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must be less than 10 + // int32 value = 1 [(buf.validate.field).int32.lt = 10]; + // } + // ``` + int32 lt = 2 [(predefined).cel = { + id: "int32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must be less than or equal to 10 + // int32 value = 1 [(buf.validate.field).int32.lte = 10]; + // } + // ``` + int32 lte = 3 [(predefined).cel = { + id: "int32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must be greater than 5 [int32.gt] + // int32 value = 1 [(buf.validate.field).int32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [int32.gt_lt] + // int32 other_value = 2 [(buf.validate.field).int32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [int32.gt_lt_exclusive] + // int32 another_value = 3 [(buf.validate.field).int32 = { gt: 10, lt: 5 }]; + // } + // ``` + int32 gt = 4 [ + (predefined).cel = { + id: "int32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "int32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "int32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified value + // (exclusive). If the value of `gte` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyInt32 { + // // value must be greater than or equal to 5 [int32.gte] + // int32 value = 1 [(buf.validate.field).int32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [int32.gte_lt] + // int32 other_value = 2 [(buf.validate.field).int32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [int32.gte_lt_exclusive] + // int32 another_value = 3 [(buf.validate.field).int32 = { gte: 10, lt: 5 }]; + // } + // ``` + int32 gte = 5 [ + (predefined).cel = { + id: "int32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "int32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "int32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyInt32 { + // // value must be in list [1, 2, 3] + // int32 value = 1 [(buf.validate.field).int32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated int32 in = 6 [(predefined).cel = { + id: "int32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error message + // is generated. + // + // ```proto + // message MyInt32 { + // // value must not be in list [1, 2, 3] + // int32 value = 1 [(buf.validate.field).int32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated int32 not_in = 7 [(predefined).cel = { + id: "int32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyInt32 { + // int32 value = 1 [ + // (buf.validate.field).int32.example = 1, + // (buf.validate.field).int32.example = -10 + // ]; + // } + // ``` + repeated int32 example = 8 [(predefined).cel = { + id: "int32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// Int64Rules describes the rules applied to `int64` values. These +// rules may also be applied to the `google.protobuf.Int64Value` Well-Known-Type. +message Int64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must equal 42 + // int64 value = 1 [(buf.validate.field).int64.const = 42]; + // } + // ``` + optional int64 const = 1 [(predefined).cel = { + id: "int64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must be less than 10 + // int64 value = 1 [(buf.validate.field).int64.lt = 10]; + // } + // ``` + int64 lt = 2 [(predefined).cel = { + id: "int64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must be less than or equal to 10 + // int64 value = 1 [(buf.validate.field).int64.lte = 10]; + // } + // ``` + int64 lte = 3 [(predefined).cel = { + id: "int64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must be greater than 5 [int64.gt] + // int64 value = 1 [(buf.validate.field).int64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [int64.gt_lt] + // int64 other_value = 2 [(buf.validate.field).int64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [int64.gt_lt_exclusive] + // int64 another_value = 3 [(buf.validate.field).int64 = { gt: 10, lt: 5 }]; + // } + // ``` + int64 gt = 4 [ + (predefined).cel = { + id: "int64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "int64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "int64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyInt64 { + // // value must be greater than or equal to 5 [int64.gte] + // int64 value = 1 [(buf.validate.field).int64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [int64.gte_lt] + // int64 other_value = 2 [(buf.validate.field).int64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [int64.gte_lt_exclusive] + // int64 another_value = 3 [(buf.validate.field).int64 = { gte: 10, lt: 5 }]; + // } + // ``` + int64 gte = 5 [ + (predefined).cel = { + id: "int64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "int64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "int64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "int64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyInt64 { + // // value must be in list [1, 2, 3] + // int64 value = 1 [(buf.validate.field).int64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated int64 in = 6 [(predefined).cel = { + id: "int64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyInt64 { + // // value must not be in list [1, 2, 3] + // int64 value = 1 [(buf.validate.field).int64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated int64 not_in = 7 [(predefined).cel = { + id: "int64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyInt64 { + // int64 value = 1 [ + // (buf.validate.field).int64.example = 1, + // (buf.validate.field).int64.example = -10 + // ]; + // } + // ``` + repeated int64 example = 9 [(predefined).cel = { + id: "int64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// UInt32Rules describes the rules applied to `uint32` values. These +// rules may also be applied to the `google.protobuf.UInt32Value` Well-Known-Type. +message UInt32Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must equal 42 + // uint32 value = 1 [(buf.validate.field).uint32.const = 42]; + // } + // ``` + optional uint32 const = 1 [(predefined).cel = { + id: "uint32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must be less than 10 + // uint32 value = 1 [(buf.validate.field).uint32.lt = 10]; + // } + // ``` + uint32 lt = 2 [(predefined).cel = { + id: "uint32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must be less than or equal to 10 + // uint32 value = 1 [(buf.validate.field).uint32.lte = 10]; + // } + // ``` + uint32 lte = 3 [(predefined).cel = { + id: "uint32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must be greater than 5 [uint32.gt] + // uint32 value = 1 [(buf.validate.field).uint32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [uint32.gt_lt] + // uint32 other_value = 2 [(buf.validate.field).uint32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [uint32.gt_lt_exclusive] + // uint32 another_value = 3 [(buf.validate.field).uint32 = { gt: 10, lt: 5 }]; + // } + // ``` + uint32 gt = 4 [ + (predefined).cel = { + id: "uint32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "uint32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "uint32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyUInt32 { + // // value must be greater than or equal to 5 [uint32.gte] + // uint32 value = 1 [(buf.validate.field).uint32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [uint32.gte_lt] + // uint32 other_value = 2 [(buf.validate.field).uint32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [uint32.gte_lt_exclusive] + // uint32 another_value = 3 [(buf.validate.field).uint32 = { gte: 10, lt: 5 }]; + // } + // ``` + uint32 gte = 5 [ + (predefined).cel = { + id: "uint32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "uint32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "uint32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyUInt32 { + // // value must be in list [1, 2, 3] + // uint32 value = 1 [(buf.validate.field).uint32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated uint32 in = 6 [(predefined).cel = { + id: "uint32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyUInt32 { + // // value must not be in list [1, 2, 3] + // uint32 value = 1 [(buf.validate.field).uint32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated uint32 not_in = 7 [(predefined).cel = { + id: "uint32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyUInt32 { + // uint32 value = 1 [ + // (buf.validate.field).uint32.example = 1, + // (buf.validate.field).uint32.example = 10 + // ]; + // } + // ``` + repeated uint32 example = 8 [(predefined).cel = { + id: "uint32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// UInt64Rules describes the rules applied to `uint64` values. These +// rules may also be applied to the `google.protobuf.UInt64Value` Well-Known-Type. +message UInt64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must equal 42 + // uint64 value = 1 [(buf.validate.field).uint64.const = 42]; + // } + // ``` + optional uint64 const = 1 [(predefined).cel = { + id: "uint64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must be less than 10 + // uint64 value = 1 [(buf.validate.field).uint64.lt = 10]; + // } + // ``` + uint64 lt = 2 [(predefined).cel = { + id: "uint64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must be less than or equal to 10 + // uint64 value = 1 [(buf.validate.field).uint64.lte = 10]; + // } + // ``` + uint64 lte = 3 [(predefined).cel = { + id: "uint64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must be greater than 5 [uint64.gt] + // uint64 value = 1 [(buf.validate.field).uint64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [uint64.gt_lt] + // uint64 other_value = 2 [(buf.validate.field).uint64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [uint64.gt_lt_exclusive] + // uint64 another_value = 3 [(buf.validate.field).uint64 = { gt: 10, lt: 5 }]; + // } + // ``` + uint64 gt = 4 [ + (predefined).cel = { + id: "uint64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "uint64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "uint64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyUInt64 { + // // value must be greater than or equal to 5 [uint64.gte] + // uint64 value = 1 [(buf.validate.field).uint64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [uint64.gte_lt] + // uint64 other_value = 2 [(buf.validate.field).uint64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [uint64.gte_lt_exclusive] + // uint64 another_value = 3 [(buf.validate.field).uint64 = { gte: 10, lt: 5 }]; + // } + // ``` + uint64 gte = 5 [ + (predefined).cel = { + id: "uint64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "uint64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "uint64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "uint64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyUInt64 { + // // value must be in list [1, 2, 3] + // uint64 value = 1 [(buf.validate.field).uint64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated uint64 in = 6 [(predefined).cel = { + id: "uint64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyUInt64 { + // // value must not be in list [1, 2, 3] + // uint64 value = 1 [(buf.validate.field).uint64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated uint64 not_in = 7 [(predefined).cel = { + id: "uint64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyUInt64 { + // uint64 value = 1 [ + // (buf.validate.field).uint64.example = 1, + // (buf.validate.field).uint64.example = -10 + // ]; + // } + // ``` + repeated uint64 example = 8 [(predefined).cel = { + id: "uint64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// SInt32Rules describes the rules applied to `sint32` values. +message SInt32Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must equal 42 + // sint32 value = 1 [(buf.validate.field).sint32.const = 42]; + // } + // ``` + optional sint32 const = 1 [(predefined).cel = { + id: "sint32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field + // < value). If the field value is equal to or greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must be less than 10 + // sint32 value = 1 [(buf.validate.field).sint32.lt = 10]; + // } + // ``` + sint32 lt = 2 [(predefined).cel = { + id: "sint32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must be less than or equal to 10 + // sint32 value = 1 [(buf.validate.field).sint32.lte = 10]; + // } + // ``` + sint32 lte = 3 [(predefined).cel = { + id: "sint32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must be greater than 5 [sint32.gt] + // sint32 value = 1 [(buf.validate.field).sint32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [sint32.gt_lt] + // sint32 other_value = 2 [(buf.validate.field).sint32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [sint32.gt_lt_exclusive] + // sint32 another_value = 3 [(buf.validate.field).sint32 = { gt: 10, lt: 5 }]; + // } + // ``` + sint32 gt = 4 [ + (predefined).cel = { + id: "sint32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "sint32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sint32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySInt32 { + // // value must be greater than or equal to 5 [sint32.gte] + // sint32 value = 1 [(buf.validate.field).sint32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [sint32.gte_lt] + // sint32 other_value = 2 [(buf.validate.field).sint32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [sint32.gte_lt_exclusive] + // sint32 another_value = 3 [(buf.validate.field).sint32 = { gte: 10, lt: 5 }]; + // } + // ``` + sint32 gte = 5 [ + (predefined).cel = { + id: "sint32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "sint32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sint32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MySInt32 { + // // value must be in list [1, 2, 3] + // sint32 value = 1 [(buf.validate.field).sint32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated sint32 in = 6 [(predefined).cel = { + id: "sint32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MySInt32 { + // // value must not be in list [1, 2, 3] + // sint32 value = 1 [(buf.validate.field).sint32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated sint32 not_in = 7 [(predefined).cel = { + id: "sint32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MySInt32 { + // sint32 value = 1 [ + // (buf.validate.field).sint32.example = 1, + // (buf.validate.field).sint32.example = -10 + // ]; + // } + // ``` + repeated sint32 example = 8 [(predefined).cel = { + id: "sint32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// SInt64Rules describes the rules applied to `sint64` values. +message SInt64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must equal 42 + // sint64 value = 1 [(buf.validate.field).sint64.const = 42]; + // } + // ``` + optional sint64 const = 1 [(predefined).cel = { + id: "sint64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field + // < value). If the field value is equal to or greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must be less than 10 + // sint64 value = 1 [(buf.validate.field).sint64.lt = 10]; + // } + // ``` + sint64 lt = 2 [(predefined).cel = { + id: "sint64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must be less than or equal to 10 + // sint64 value = 1 [(buf.validate.field).sint64.lte = 10]; + // } + // ``` + sint64 lte = 3 [(predefined).cel = { + id: "sint64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must be greater than 5 [sint64.gt] + // sint64 value = 1 [(buf.validate.field).sint64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [sint64.gt_lt] + // sint64 other_value = 2 [(buf.validate.field).sint64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [sint64.gt_lt_exclusive] + // sint64 another_value = 3 [(buf.validate.field).sint64 = { gt: 10, lt: 5 }]; + // } + // ``` + sint64 gt = 4 [ + (predefined).cel = { + id: "sint64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "sint64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sint64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySInt64 { + // // value must be greater than or equal to 5 [sint64.gte] + // sint64 value = 1 [(buf.validate.field).sint64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [sint64.gte_lt] + // sint64 other_value = 2 [(buf.validate.field).sint64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [sint64.gte_lt_exclusive] + // sint64 another_value = 3 [(buf.validate.field).sint64 = { gte: 10, lt: 5 }]; + // } + // ``` + sint64 gte = 5 [ + (predefined).cel = { + id: "sint64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "sint64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sint64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sint64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message + // is generated. + // + // ```proto + // message MySInt64 { + // // value must be in list [1, 2, 3] + // sint64 value = 1 [(buf.validate.field).sint64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated sint64 in = 6 [(predefined).cel = { + id: "sint64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MySInt64 { + // // value must not be in list [1, 2, 3] + // sint64 value = 1 [(buf.validate.field).sint64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated sint64 not_in = 7 [(predefined).cel = { + id: "sint64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MySInt64 { + // sint64 value = 1 [ + // (buf.validate.field).sint64.example = 1, + // (buf.validate.field).sint64.example = -10 + // ]; + // } + // ``` + repeated sint64 example = 8 [(predefined).cel = { + id: "sint64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// Fixed32Rules describes the rules applied to `fixed32` values. +message Fixed32Rules { + // `const` requires the field value to exactly match the specified value. + // If the field value doesn't match, an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must equal 42 + // fixed32 value = 1 [(buf.validate.field).fixed32.const = 42]; + // } + // ``` + optional fixed32 const = 1 [(predefined).cel = { + id: "fixed32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must be less than 10 + // fixed32 value = 1 [(buf.validate.field).fixed32.lt = 10]; + // } + // ``` + fixed32 lt = 2 [(predefined).cel = { + id: "fixed32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must be less than or equal to 10 + // fixed32 value = 1 [(buf.validate.field).fixed32.lte = 10]; + // } + // ``` + fixed32 lte = 3 [(predefined).cel = { + id: "fixed32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must be greater than 5 [fixed32.gt] + // fixed32 value = 1 [(buf.validate.field).fixed32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [fixed32.gt_lt] + // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [fixed32.gt_lt_exclusive] + // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gt: 10, lt: 5 }]; + // } + // ``` + fixed32 gt = 4 [ + (predefined).cel = { + id: "fixed32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "fixed32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFixed32 { + // // value must be greater than or equal to 5 [fixed32.gte] + // fixed32 value = 1 [(buf.validate.field).fixed32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [fixed32.gte_lt] + // fixed32 other_value = 2 [(buf.validate.field).fixed32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [fixed32.gte_lt_exclusive] + // fixed32 another_value = 3 [(buf.validate.field).fixed32 = { gte: 10, lt: 5 }]; + // } + // ``` + fixed32 gte = 5 [ + (predefined).cel = { + id: "fixed32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "fixed32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "fixed32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message + // is generated. + // + // ```proto + // message MyFixed32 { + // // value must be in list [1, 2, 3] + // fixed32 value = 1 [(buf.validate.field).fixed32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated fixed32 in = 6 [(predefined).cel = { + id: "fixed32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyFixed32 { + // // value must not be in list [1, 2, 3] + // fixed32 value = 1 [(buf.validate.field).fixed32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated fixed32 not_in = 7 [(predefined).cel = { + id: "fixed32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyFixed32 { + // fixed32 value = 1 [ + // (buf.validate.field).fixed32.example = 1, + // (buf.validate.field).fixed32.example = 2 + // ]; + // } + // ``` + repeated fixed32 example = 8 [(predefined).cel = { + id: "fixed32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// Fixed64Rules describes the rules applied to `fixed64` values. +message Fixed64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must equal 42 + // fixed64 value = 1 [(buf.validate.field).fixed64.const = 42]; + // } + // ``` + optional fixed64 const = 1 [(predefined).cel = { + id: "fixed64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must be less than 10 + // fixed64 value = 1 [(buf.validate.field).fixed64.lt = 10]; + // } + // ``` + fixed64 lt = 2 [(predefined).cel = { + id: "fixed64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must be less than or equal to 10 + // fixed64 value = 1 [(buf.validate.field).fixed64.lte = 10]; + // } + // ``` + fixed64 lte = 3 [(predefined).cel = { + id: "fixed64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must be greater than 5 [fixed64.gt] + // fixed64 value = 1 [(buf.validate.field).fixed64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [fixed64.gt_lt] + // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [fixed64.gt_lt_exclusive] + // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gt: 10, lt: 5 }]; + // } + // ``` + fixed64 gt = 4 [ + (predefined).cel = { + id: "fixed64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "fixed64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyFixed64 { + // // value must be greater than or equal to 5 [fixed64.gte] + // fixed64 value = 1 [(buf.validate.field).fixed64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [fixed64.gte_lt] + // fixed64 other_value = 2 [(buf.validate.field).fixed64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [fixed64.gte_lt_exclusive] + // fixed64 another_value = 3 [(buf.validate.field).fixed64 = { gte: 10, lt: 5 }]; + // } + // ``` + fixed64 gte = 5 [ + (predefined).cel = { + id: "fixed64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "fixed64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "fixed64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "fixed64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MyFixed64 { + // // value must be in list [1, 2, 3] + // fixed64 value = 1 [(buf.validate.field).fixed64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated fixed64 in = 6 [(predefined).cel = { + id: "fixed64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MyFixed64 { + // // value must not be in list [1, 2, 3] + // fixed64 value = 1 [(buf.validate.field).fixed64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated fixed64 not_in = 7 [(predefined).cel = { + id: "fixed64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyFixed64 { + // fixed64 value = 1 [ + // (buf.validate.field).fixed64.example = 1, + // (buf.validate.field).fixed64.example = 2 + // ]; + // } + // ``` + repeated fixed64 example = 8 [(predefined).cel = { + id: "fixed64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// SFixed32Rules describes the rules applied to `fixed32` values. +message SFixed32Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must equal 42 + // sfixed32 value = 1 [(buf.validate.field).sfixed32.const = 42]; + // } + // ``` + optional sfixed32 const = 1 [(predefined).cel = { + id: "sfixed32.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must be less than 10 + // sfixed32 value = 1 [(buf.validate.field).sfixed32.lt = 10]; + // } + // ``` + sfixed32 lt = 2 [(predefined).cel = { + id: "sfixed32.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must be less than or equal to 10 + // sfixed32 value = 1 [(buf.validate.field).sfixed32.lte = 10]; + // } + // ``` + sfixed32 lte = 3 [(predefined).cel = { + id: "sfixed32.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must be greater than 5 [sfixed32.gt] + // sfixed32 value = 1 [(buf.validate.field).sfixed32.gt = 5]; + // + // // value must be greater than 5 and less than 10 [sfixed32.gt_lt] + // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [sfixed32.gt_lt_exclusive] + // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gt: 10, lt: 5 }]; + // } + // ``` + sfixed32 gt = 4 [ + (predefined).cel = { + id: "sfixed32.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySFixed32 { + // // value must be greater than or equal to 5 [sfixed32.gte] + // sfixed32 value = 1 [(buf.validate.field).sfixed32.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [sfixed32.gte_lt] + // sfixed32 other_value = 2 [(buf.validate.field).sfixed32 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [sfixed32.gte_lt_exclusive] + // sfixed32 another_value = 3 [(buf.validate.field).sfixed32 = { gte: 10, lt: 5 }]; + // } + // ``` + sfixed32 gte = 5 [ + (predefined).cel = { + id: "sfixed32.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sfixed32.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MySFixed32 { + // // value must be in list [1, 2, 3] + // sfixed32 value = 1 [(buf.validate.field).sfixed32 = { in: [1, 2, 3] }]; + // } + // ``` + repeated sfixed32 in = 6 [(predefined).cel = { + id: "sfixed32.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MySFixed32 { + // // value must not be in list [1, 2, 3] + // sfixed32 value = 1 [(buf.validate.field).sfixed32 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated sfixed32 not_in = 7 [(predefined).cel = { + id: "sfixed32.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MySFixed32 { + // sfixed32 value = 1 [ + // (buf.validate.field).sfixed32.example = 1, + // (buf.validate.field).sfixed32.example = 2 + // ]; + // } + // ``` + repeated sfixed32 example = 8 [(predefined).cel = { + id: "sfixed32.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// SFixed64Rules describes the rules applied to `fixed64` values. +message SFixed64Rules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must equal 42 + // sfixed64 value = 1 [(buf.validate.field).sfixed64.const = 42]; + // } + // ``` + optional sfixed64 const = 1 [(predefined).cel = { + id: "sfixed64.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` requires the field value to be less than the specified value (field < + // value). If the field value is equal to or greater than the specified value, + // an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must be less than 10 + // sfixed64 value = 1 [(buf.validate.field).sfixed64.lt = 10]; + // } + // ``` + sfixed64 lt = 2 [(predefined).cel = { + id: "sfixed64.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` requires the field value to be less than or equal to the specified + // value (field <= value). If the field value is greater than the specified + // value, an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must be less than or equal to 10 + // sfixed64 value = 1 [(buf.validate.field).sfixed64.lte = 10]; + // } + // ``` + sfixed64 lte = 3 [(predefined).cel = { + id: "sfixed64.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the field value to be greater than the specified value + // (exclusive). If the value of `gt` is larger than a specified `lt` or + // `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must be greater than 5 [sfixed64.gt] + // sfixed64 value = 1 [(buf.validate.field).sfixed64.gt = 5]; + // + // // value must be greater than 5 and less than 10 [sfixed64.gt_lt] + // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gt: 5, lt: 10 }]; + // + // // value must be greater than 10 or less than 5 [sfixed64.gt_lt_exclusive] + // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gt: 10, lt: 5 }]; + // } + // ``` + sfixed64 gt = 4 [ + (predefined).cel = { + id: "sfixed64.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the field value to be greater than or equal to the specified + // value (exclusive). If the value of `gte` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MySFixed64 { + // // value must be greater than or equal to 5 [sfixed64.gte] + // sfixed64 value = 1 [(buf.validate.field).sfixed64.gte = 5]; + // + // // value must be greater than or equal to 5 and less than 10 [sfixed64.gte_lt] + // sfixed64 other_value = 2 [(buf.validate.field).sfixed64 = { gte: 5, lt: 10 }]; + // + // // value must be greater than or equal to 10 or less than 5 [sfixed64.gte_lt_exclusive] + // sfixed64 another_value = 3 [(buf.validate.field).sfixed64 = { gte: 10, lt: 5 }]; + // } + // ``` + sfixed64 gte = 5 [ + (predefined).cel = { + id: "sfixed64.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "sfixed64.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` requires the field value to be equal to one of the specified values. + // If the field value isn't one of the specified values, an error message is + // generated. + // + // ```proto + // message MySFixed64 { + // // value must be in list [1, 2, 3] + // sfixed64 value = 1 [(buf.validate.field).sfixed64 = { in: [1, 2, 3] }]; + // } + // ``` + repeated sfixed64 in = 6 [(predefined).cel = { + id: "sfixed64.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not be equal to any of the specified + // values. If the field value is one of the specified values, an error + // message is generated. + // + // ```proto + // message MySFixed64 { + // // value must not be in list [1, 2, 3] + // sfixed64 value = 1 [(buf.validate.field).sfixed64 = { not_in: [1, 2, 3] }]; + // } + // ``` + repeated sfixed64 not_in = 7 [(predefined).cel = { + id: "sfixed64.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MySFixed64 { + // sfixed64 value = 1 [ + // (buf.validate.field).sfixed64.example = 1, + // (buf.validate.field).sfixed64.example = 2 + // ]; + // } + // ``` + repeated sfixed64 example = 8 [(predefined).cel = { + id: "sfixed64.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// BoolRules describes the rules applied to `bool` values. These rules +// may also be applied to the `google.protobuf.BoolValue` Well-Known-Type. +message BoolRules { + // `const` requires the field value to exactly match the specified boolean value. + // If the field value doesn't match, an error message is generated. + // + // ```proto + // message MyBool { + // // value must equal true + // bool value = 1 [(buf.validate.field).bool.const = true]; + // } + // ``` + optional bool const = 1 [(predefined).cel = { + id: "bool.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyBool { + // bool value = 1 [ + // (buf.validate.field).bool.example = 1, + // (buf.validate.field).bool.example = 2 + // ]; + // } + // ``` + repeated bool example = 2 [(predefined).cel = { + id: "bool.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// StringRules describes the rules applied to `string` values These +// rules may also be applied to the `google.protobuf.StringValue` Well-Known-Type. +message StringRules { + // `const` requires the field value to exactly match the specified value. If + // the field value doesn't match, an error message is generated. + // + // ```proto + // message MyString { + // // value must equal `hello` + // string value = 1 [(buf.validate.field).string.const = "hello"]; + // } + // ``` + optional string const = 1 [(predefined).cel = { + id: "string.const" + expression: "this != getField(rules, 'const') ? 'value must equal `%s`'.format([getField(rules, 'const')]) : ''" + }]; + + // `len` dictates that the field value must have the specified + // number of characters (Unicode code points), which may differ from the number + // of bytes in the string. If the field value does not meet the specified + // length, an error message will be generated. + // + // ```proto + // message MyString { + // // value length must be 5 characters + // string value = 1 [(buf.validate.field).string.len = 5]; + // } + // ``` + optional uint64 len = 19 [(predefined).cel = { + id: "string.len" + expression: "uint(this.size()) != rules.len ? 'value length must be %s characters'.format([rules.len]) : ''" + }]; + + // `min_len` specifies that the field value must have at least the specified + // number of characters (Unicode code points), which may differ from the number + // of bytes in the string. If the field value contains fewer characters, an error + // message will be generated. + // + // ```proto + // message MyString { + // // value length must be at least 3 characters + // string value = 1 [(buf.validate.field).string.min_len = 3]; + // } + // ``` + optional uint64 min_len = 2 [(predefined).cel = { + id: "string.min_len" + expression: "uint(this.size()) < rules.min_len ? 'value length must be at least %s characters'.format([rules.min_len]) : ''" + }]; + + // `max_len` specifies that the field value must have no more than the specified + // number of characters (Unicode code points), which may differ from the + // number of bytes in the string. If the field value contains more characters, + // an error message will be generated. + // + // ```proto + // message MyString { + // // value length must be at most 10 characters + // string value = 1 [(buf.validate.field).string.max_len = 10]; + // } + // ``` + optional uint64 max_len = 3 [(predefined).cel = { + id: "string.max_len" + expression: "uint(this.size()) > rules.max_len ? 'value length must be at most %s characters'.format([rules.max_len]) : ''" + }]; + + // `len_bytes` dictates that the field value must have the specified number of + // bytes. If the field value does not match the specified length in bytes, + // an error message will be generated. + // + // ```proto + // message MyString { + // // value length must be 6 bytes + // string value = 1 [(buf.validate.field).string.len_bytes = 6]; + // } + // ``` + optional uint64 len_bytes = 20 [(predefined).cel = { + id: "string.len_bytes" + expression: "uint(bytes(this).size()) != rules.len_bytes ? 'value length must be %s bytes'.format([rules.len_bytes]) : ''" + }]; + + // `min_bytes` specifies that the field value must have at least the specified + // number of bytes. If the field value contains fewer bytes, an error message + // will be generated. + // + // ```proto + // message MyString { + // // value length must be at least 4 bytes + // string value = 1 [(buf.validate.field).string.min_bytes = 4]; + // } + // + // ``` + optional uint64 min_bytes = 4 [(predefined).cel = { + id: "string.min_bytes" + expression: "uint(bytes(this).size()) < rules.min_bytes ? 'value length must be at least %s bytes'.format([rules.min_bytes]) : ''" + }]; + + // `max_bytes` specifies that the field value must have no more than the + //specified number of bytes. If the field value contains more bytes, an + // error message will be generated. + // + // ```proto + // message MyString { + // // value length must be at most 8 bytes + // string value = 1 [(buf.validate.field).string.max_bytes = 8]; + // } + // ``` + optional uint64 max_bytes = 5 [(predefined).cel = { + id: "string.max_bytes" + expression: "uint(bytes(this).size()) > rules.max_bytes ? 'value length must be at most %s bytes'.format([rules.max_bytes]) : ''" + }]; + + // `pattern` specifies that the field value must match the specified + // regular expression (RE2 syntax), with the expression provided without any + // delimiters. If the field value doesn't match the regular expression, an + // error message will be generated. + // + // ```proto + // message MyString { + // // value does not match regex pattern `^[a-zA-Z]//$` + // string value = 1 [(buf.validate.field).string.pattern = "^[a-zA-Z]//$"]; + // } + // ``` + optional string pattern = 6 [(predefined).cel = { + id: "string.pattern" + expression: "!this.matches(rules.pattern) ? 'value does not match regex pattern `%s`'.format([rules.pattern]) : ''" + }]; + + // `prefix` specifies that the field value must have the + //specified substring at the beginning of the string. If the field value + // doesn't start with the specified prefix, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value does not have prefix `pre` + // string value = 1 [(buf.validate.field).string.prefix = "pre"]; + // } + // ``` + optional string prefix = 7 [(predefined).cel = { + id: "string.prefix" + expression: "!this.startsWith(rules.prefix) ? 'value does not have prefix `%s`'.format([rules.prefix]) : ''" + }]; + + // `suffix` specifies that the field value must have the + //specified substring at the end of the string. If the field value doesn't + // end with the specified suffix, an error message will be generated. + // + // ```proto + // message MyString { + // // value does not have suffix `post` + // string value = 1 [(buf.validate.field).string.suffix = "post"]; + // } + // ``` + optional string suffix = 8 [(predefined).cel = { + id: "string.suffix" + expression: "!this.endsWith(rules.suffix) ? 'value does not have suffix `%s`'.format([rules.suffix]) : ''" + }]; + + // `contains` specifies that the field value must have the + //specified substring anywhere in the string. If the field value doesn't + // contain the specified substring, an error message will be generated. + // + // ```proto + // message MyString { + // // value does not contain substring `inside`. + // string value = 1 [(buf.validate.field).string.contains = "inside"]; + // } + // ``` + optional string contains = 9 [(predefined).cel = { + id: "string.contains" + expression: "!this.contains(rules.contains) ? 'value does not contain substring `%s`'.format([rules.contains]) : ''" + }]; + + // `not_contains` specifies that the field value must not have the + //specified substring anywhere in the string. If the field value contains + // the specified substring, an error message will be generated. + // + // ```proto + // message MyString { + // // value contains substring `inside`. + // string value = 1 [(buf.validate.field).string.not_contains = "inside"]; + // } + // ``` + optional string not_contains = 23 [(predefined).cel = { + id: "string.not_contains" + expression: "this.contains(rules.not_contains) ? 'value contains substring `%s`'.format([rules.not_contains]) : ''" + }]; + + // `in` specifies that the field value must be equal to one of the specified + // values. If the field value isn't one of the specified values, an error + // message will be generated. + // + // ```proto + // message MyString { + // // value must be in list ["apple", "banana"] + // string value = 1 [(buf.validate.field).string.in = "apple", (buf.validate.field).string.in = "banana"]; + // } + // ``` + repeated string in = 10 [(predefined).cel = { + id: "string.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` specifies that the field value cannot be equal to any + // of the specified values. If the field value is one of the specified values, + // an error message will be generated. + // ```proto + // message MyString { + // // value must not be in list ["orange", "grape"] + // string value = 1 [(buf.validate.field).string.not_in = "orange", (buf.validate.field).string.not_in = "grape"]; + // } + // ``` + repeated string not_in = 11 [(predefined).cel = { + id: "string.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `WellKnown` rules provide advanced rules against common string + // patterns. + oneof well_known { + // `email` specifies that the field value must be a valid email address, for + // example "foo@example.com". + // + // Conforms to the definition for a valid email address from the [HTML standard](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address). + // Note that this standard willfully deviates from [RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322), + // which allows many unexpected forms of email addresses and will easily match + // a typographical error. + // + // If the field value isn't a valid email address, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid email address + // string value = 1 [(buf.validate.field).string.email = true]; + // } + // ``` + bool email = 12 [ + (predefined).cel = { + id: "string.email" + message: "value must be a valid email address" + expression: "!rules.email || this == '' || this.isEmail()" + }, + (predefined).cel = { + id: "string.email_empty" + message: "value is empty, which is not a valid email address" + expression: "!rules.email || this != ''" + } + ]; + + // `hostname` specifies that the field value must be a valid hostname, for + // example "foo.example.com". + // + // A valid hostname follows the rules below: + // - The name consists of one or more labels, separated by a dot ("."). + // - Each label can be 1 to 63 alphanumeric characters. + // - A label can contain hyphens ("-"), but must not start or end with a hyphen. + // - The right-most label must not be digits only. + // - The name can have a trailing dot—for example, "foo.example.com.". + // - The name can be 253 characters at most, excluding the optional trailing dot. + // + // If the field value isn't a valid hostname, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid hostname + // string value = 1 [(buf.validate.field).string.hostname = true]; + // } + // ``` + bool hostname = 13 [ + (predefined).cel = { + id: "string.hostname" + message: "value must be a valid hostname" + expression: "!rules.hostname || this == '' || this.isHostname()" + }, + (predefined).cel = { + id: "string.hostname_empty" + message: "value is empty, which is not a valid hostname" + expression: "!rules.hostname || this != ''" + } + ]; + + // `ip` specifies that the field value must be a valid IP (v4 or v6) address. + // + // IPv4 addresses are expected in the dotted decimal format—for example, "192.168.5.21". + // IPv6 addresses are expected in their text representation—for example, "::1", + // or "2001:0DB8:ABCD:0012::0". + // + // Both formats are well-defined in the internet standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). + // Zone identifiers for IPv6 addresses (for example, "fe80::a%en1") are supported. + // + // If the field value isn't a valid IP address, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value must be a valid IP address + // string value = 1 [(buf.validate.field).string.ip = true]; + // } + // ``` + bool ip = 14 [ + (predefined).cel = { + id: "string.ip" + message: "value must be a valid IP address" + expression: "!rules.ip || this == '' || this.isIp()" + }, + (predefined).cel = { + id: "string.ip_empty" + message: "value is empty, which is not a valid IP address" + expression: "!rules.ip || this != ''" + } + ]; + + // `ipv4` specifies that the field value must be a valid IPv4 address—for + // example "192.168.5.21". If the field value isn't a valid IPv4 address, an + // error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv4 address + // string value = 1 [(buf.validate.field).string.ipv4 = true]; + // } + // ``` + bool ipv4 = 15 [ + (predefined).cel = { + id: "string.ipv4" + message: "value must be a valid IPv4 address" + expression: "!rules.ipv4 || this == '' || this.isIp(4)" + }, + (predefined).cel = { + id: "string.ipv4_empty" + message: "value is empty, which is not a valid IPv4 address" + expression: "!rules.ipv4 || this != ''" + } + ]; + + // `ipv6` specifies that the field value must be a valid IPv6 address—for + // example "::1", or "d7a:115c:a1e0:ab12:4843:cd96:626b:430b". If the field + // value is not a valid IPv6 address, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv6 address + // string value = 1 [(buf.validate.field).string.ipv6 = true]; + // } + // ``` + bool ipv6 = 16 [ + (predefined).cel = { + id: "string.ipv6" + message: "value must be a valid IPv6 address" + expression: "!rules.ipv6 || this == '' || this.isIp(6)" + }, + (predefined).cel = { + id: "string.ipv6_empty" + message: "value is empty, which is not a valid IPv6 address" + expression: "!rules.ipv6 || this != ''" + } + ]; + + // `uri` specifies that the field value must be a valid URI, for example + // "https://example.com/foo/bar?baz=quux#frag". + // + // URI is defined in the internet standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). + // Zone Identifiers in IPv6 address literals are supported ([RFC 6874](https://datatracker.ietf.org/doc/html/rfc6874)). + // + // If the field value isn't a valid URI, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid URI + // string value = 1 [(buf.validate.field).string.uri = true]; + // } + // ``` + bool uri = 17 [ + (predefined).cel = { + id: "string.uri" + message: "value must be a valid URI" + expression: "!rules.uri || this == '' || this.isUri()" + }, + (predefined).cel = { + id: "string.uri_empty" + message: "value is empty, which is not a valid URI" + expression: "!rules.uri || this != ''" + } + ]; + + // `uri_ref` specifies that the field value must be a valid URI Reference—either + // a URI such as "https://example.com/foo/bar?baz=quux#frag", or a Relative + // Reference such as "./foo/bar?query". + // + // URI, URI Reference, and Relative Reference are defined in the internet + // standard [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986). Zone + // Identifiers in IPv6 address literals are supported ([RFC 6874](https://datatracker.ietf.org/doc/html/rfc6874)). + // + // If the field value isn't a valid URI Reference, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value must be a valid URI Reference + // string value = 1 [(buf.validate.field).string.uri_ref = true]; + // } + // ``` + bool uri_ref = 18 [(predefined).cel = { + id: "string.uri_ref" + message: "value must be a valid URI Reference" + expression: "!rules.uri_ref || this.isUriRef()" + }]; + + // `address` specifies that the field value must be either a valid hostname + // (for example, "example.com"), or a valid IP (v4 or v6) address (for example, + // "192.168.0.1", or "::1"). If the field value isn't a valid hostname or IP, + // an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid hostname, or ip address + // string value = 1 [(buf.validate.field).string.address = true]; + // } + // ``` + bool address = 21 [ + (predefined).cel = { + id: "string.address" + message: "value must be a valid hostname, or ip address" + expression: "!rules.address || this == '' || this.isHostname() || this.isIp()" + }, + (predefined).cel = { + id: "string.address_empty" + message: "value is empty, which is not a valid hostname, or ip address" + expression: "!rules.address || this != ''" + } + ]; + + // `uuid` specifies that the field value must be a valid UUID as defined by + // [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2). If the + // field value isn't a valid UUID, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid UUID + // string value = 1 [(buf.validate.field).string.uuid = true]; + // } + // ``` + bool uuid = 22 [ + (predefined).cel = { + id: "string.uuid" + message: "value must be a valid UUID" + expression: "!rules.uuid || this == '' || this.matches('^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$')" + }, + (predefined).cel = { + id: "string.uuid_empty" + message: "value is empty, which is not a valid UUID" + expression: "!rules.uuid || this != ''" + } + ]; + + // `tuuid` (trimmed UUID) specifies that the field value must be a valid UUID as + // defined by [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2) with all dashes + // omitted. If the field value isn't a valid UUID without dashes, an error message + // will be generated. + // + // ```proto + // message MyString { + // // value must be a valid trimmed UUID + // string value = 1 [(buf.validate.field).string.tuuid = true]; + // } + // ``` + bool tuuid = 33 [ + (predefined).cel = { + id: "string.tuuid" + message: "value must be a valid trimmed UUID" + expression: "!rules.tuuid || this == '' || this.matches('^[0-9a-fA-F]{32}$')" + }, + (predefined).cel = { + id: "string.tuuid_empty" + message: "value is empty, which is not a valid trimmed UUID" + expression: "!rules.tuuid || this != ''" + } + ]; + + // `ip_with_prefixlen` specifies that the field value must be a valid IP + // (v4 or v6) address with prefix length—for example, "192.168.5.21/16" or + // "2001:0DB8:ABCD:0012::F1/64". If the field value isn't a valid IP with + // prefix length, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IP with prefix length + // string value = 1 [(buf.validate.field).string.ip_with_prefixlen = true]; + // } + // ``` + bool ip_with_prefixlen = 26 [ + (predefined).cel = { + id: "string.ip_with_prefixlen" + message: "value must be a valid IP prefix" + expression: "!rules.ip_with_prefixlen || this == '' || this.isIpPrefix()" + }, + (predefined).cel = { + id: "string.ip_with_prefixlen_empty" + message: "value is empty, which is not a valid IP prefix" + expression: "!rules.ip_with_prefixlen || this != ''" + } + ]; + + // `ipv4_with_prefixlen` specifies that the field value must be a valid + // IPv4 address with prefix length—for example, "192.168.5.21/16". If the + // field value isn't a valid IPv4 address with prefix length, an error + // message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv4 address with prefix length + // string value = 1 [(buf.validate.field).string.ipv4_with_prefixlen = true]; + // } + // ``` + bool ipv4_with_prefixlen = 27 [ + (predefined).cel = { + id: "string.ipv4_with_prefixlen" + message: "value must be a valid IPv4 address with prefix length" + expression: "!rules.ipv4_with_prefixlen || this == '' || this.isIpPrefix(4)" + }, + (predefined).cel = { + id: "string.ipv4_with_prefixlen_empty" + message: "value is empty, which is not a valid IPv4 address with prefix length" + expression: "!rules.ipv4_with_prefixlen || this != ''" + } + ]; + + // `ipv6_with_prefixlen` specifies that the field value must be a valid + // IPv6 address with prefix length—for example, "2001:0DB8:ABCD:0012::F1/64". + // If the field value is not a valid IPv6 address with prefix length, + // an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv6 address prefix length + // string value = 1 [(buf.validate.field).string.ipv6_with_prefixlen = true]; + // } + // ``` + bool ipv6_with_prefixlen = 28 [ + (predefined).cel = { + id: "string.ipv6_with_prefixlen" + message: "value must be a valid IPv6 address with prefix length" + expression: "!rules.ipv6_with_prefixlen || this == '' || this.isIpPrefix(6)" + }, + (predefined).cel = { + id: "string.ipv6_with_prefixlen_empty" + message: "value is empty, which is not a valid IPv6 address with prefix length" + expression: "!rules.ipv6_with_prefixlen || this != ''" + } + ]; + + // `ip_prefix` specifies that the field value must be a valid IP (v4 or v6) + // prefix—for example, "192.168.0.0/16" or "2001:0DB8:ABCD:0012::0/64". + // + // The prefix must have all zeros for the unmasked bits. For example, + // "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the + // prefix, and the remaining 64 bits must be zero. + // + // If the field value isn't a valid IP prefix, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value must be a valid IP prefix + // string value = 1 [(buf.validate.field).string.ip_prefix = true]; + // } + // ``` + bool ip_prefix = 29 [ + (predefined).cel = { + id: "string.ip_prefix" + message: "value must be a valid IP prefix" + expression: "!rules.ip_prefix || this == '' || this.isIpPrefix(true)" + }, + (predefined).cel = { + id: "string.ip_prefix_empty" + message: "value is empty, which is not a valid IP prefix" + expression: "!rules.ip_prefix || this != ''" + } + ]; + + // `ipv4_prefix` specifies that the field value must be a valid IPv4 + // prefix, for example "192.168.0.0/16". + // + // The prefix must have all zeros for the unmasked bits. For example, + // "192.168.0.0/16" designates the left-most 16 bits for the prefix, + // and the remaining 16 bits must be zero. + // + // If the field value isn't a valid IPv4 prefix, an error message + // will be generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv4 prefix + // string value = 1 [(buf.validate.field).string.ipv4_prefix = true]; + // } + // ``` + bool ipv4_prefix = 30 [ + (predefined).cel = { + id: "string.ipv4_prefix" + message: "value must be a valid IPv4 prefix" + expression: "!rules.ipv4_prefix || this == '' || this.isIpPrefix(4, true)" + }, + (predefined).cel = { + id: "string.ipv4_prefix_empty" + message: "value is empty, which is not a valid IPv4 prefix" + expression: "!rules.ipv4_prefix || this != ''" + } + ]; + + // `ipv6_prefix` specifies that the field value must be a valid IPv6 prefix—for + // example, "2001:0DB8:ABCD:0012::0/64". + // + // The prefix must have all zeros for the unmasked bits. For example, + // "2001:0DB8:ABCD:0012::0/64" designates the left-most 64 bits for the + // prefix, and the remaining 64 bits must be zero. + // + // If the field value is not a valid IPv6 prefix, an error message will be + // generated. + // + // ```proto + // message MyString { + // // value must be a valid IPv6 prefix + // string value = 1 [(buf.validate.field).string.ipv6_prefix = true]; + // } + // ``` + bool ipv6_prefix = 31 [ + (predefined).cel = { + id: "string.ipv6_prefix" + message: "value must be a valid IPv6 prefix" + expression: "!rules.ipv6_prefix || this == '' || this.isIpPrefix(6, true)" + }, + (predefined).cel = { + id: "string.ipv6_prefix_empty" + message: "value is empty, which is not a valid IPv6 prefix" + expression: "!rules.ipv6_prefix || this != ''" + } + ]; + + // `host_and_port` specifies that the field value must be valid host/port + // pair—for example, "example.com:8080". + // + // The host can be one of: + //- An IPv4 address in dotted decimal format—for example, "192.168.5.21". + //- An IPv6 address enclosed in square brackets—for example, "[2001:0DB8:ABCD:0012::F1]". + //- A hostname—for example, "example.com". + // + // The port is separated by a colon. It must be non-empty, with a decimal number + // in the range of 0-65535, inclusive. + bool host_and_port = 32 [ + (predefined).cel = { + id: "string.host_and_port" + message: "value must be a valid host (hostname or IP address) and port pair" + expression: "!rules.host_and_port || this == '' || this.isHostAndPort(true)" + }, + (predefined).cel = { + id: "string.host_and_port_empty" + message: "value is empty, which is not a valid host and port pair" + expression: "!rules.host_and_port || this != ''" + } + ]; + + // `ulid` specifies that the field value must be a valid ULID (Universally Unique + // Lexicographically Sortable Identifier) as defined by the [ULID specification](https://github.com/ulid/spec). + // If the field value isn't a valid ULID, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid ULID + // string value = 1 [(buf.validate.field).string.ulid = true]; + // } + // ``` + bool ulid = 35 [ + (predefined).cel = { + id: "string.ulid" + message: "value must be a valid ULID" + expression: "!rules.ulid || this == '' || this.matches('^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$')" + }, + (predefined).cel = { + id: "string.ulid_empty" + message: "value is empty, which is not a valid ULID" + expression: "!rules.ulid || this != ''" + } + ]; + + // `well_known_regex` specifies a common well-known pattern + // defined as a regex. If the field value doesn't match the well-known + // regex, an error message will be generated. + // + // ```proto + // message MyString { + // // value must be a valid HTTP header value + // string value = 1 [(buf.validate.field).string.well_known_regex = KNOWN_REGEX_HTTP_HEADER_VALUE]; + // } + // ``` + // + // #### KnownRegex + // + // `well_known_regex` contains some well-known patterns. + // + // | Name | Number | Description | + // |-------------------------------|--------|-------------------------------------------| + // | KNOWN_REGEX_UNSPECIFIED | 0 | | + // | KNOWN_REGEX_HTTP_HEADER_NAME | 1 | HTTP header name as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2) | + // | KNOWN_REGEX_HTTP_HEADER_VALUE | 2 | HTTP header value as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4) | + KnownRegex well_known_regex = 24 [ + (predefined).cel = { + id: "string.well_known_regex.header_name" + message: "value must be a valid HTTP header name" + expression: + "rules.well_known_regex != 1 || this == '' || this.matches(!has(rules.strict) || rules.strict ?" + "'^:?[0-9a-zA-Z!#$%&\\'*+-.^_|~\\x60]+$' :" + "'^[^\\u0000\\u000A\\u000D]+$')" + }, + (predefined).cel = { + id: "string.well_known_regex.header_name_empty" + message: "value is empty, which is not a valid HTTP header name" + expression: "rules.well_known_regex != 1 || this != ''" + }, + (predefined).cel = { + id: "string.well_known_regex.header_value" + message: "value must be a valid HTTP header value" + expression: + "rules.well_known_regex != 2 || this.matches(!has(rules.strict) || rules.strict ?" + "'^[^\\u0000-\\u0008\\u000A-\\u001F\\u007F]*$' :" + "'^[^\\u0000\\u000A\\u000D]*$')" + } + ]; + } + + // This applies to regexes `HTTP_HEADER_NAME` and `HTTP_HEADER_VALUE` to + // enable strict header validation. By default, this is true, and HTTP header + // validations are [RFC-compliant](https://datatracker.ietf.org/doc/html/rfc7230#section-3). Setting to false will enable looser + // validations that only disallow `\r\n\0` characters, which can be used to + // bypass header matching rules. + // + // ```proto + // message MyString { + // // The field `value` must have be a valid HTTP headers, but not enforced with strict rules. + // string value = 1 [(buf.validate.field).string.strict = false]; + // } + // ``` + optional bool strict = 25; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyString { + // string value = 1 [ + // (buf.validate.field).string.example = "hello", + // (buf.validate.field).string.example = "world" + // ]; + // } + // ``` + repeated string example = 34 [(predefined).cel = { + id: "string.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// KnownRegex contains some well-known patterns. +enum KnownRegex { + KNOWN_REGEX_UNSPECIFIED = 0; + + // HTTP header name as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2). + KNOWN_REGEX_HTTP_HEADER_NAME = 1; + + // HTTP header value as defined by [RFC 7230](https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4). + KNOWN_REGEX_HTTP_HEADER_VALUE = 2; +} + +// BytesRules describe the rules applied to `bytes` values. These rules +// may also be applied to the `google.protobuf.BytesValue` Well-Known-Type. +message BytesRules { + // `const` requires the field value to exactly match the specified bytes + // value. If the field value doesn't match, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must be "\x01\x02\x03\x04" + // bytes value = 1 [(buf.validate.field).bytes.const = "\x01\x02\x03\x04"]; + // } + // ``` + optional bytes const = 1 [(predefined).cel = { + id: "bytes.const" + expression: "this != getField(rules, 'const') ? 'value must be %x'.format([getField(rules, 'const')]) : ''" + }]; + + // `len` requires the field value to have the specified length in bytes. + // If the field value doesn't match, an error message is generated. + // + // ```proto + // message MyBytes { + // // value length must be 4 bytes. + // optional bytes value = 1 [(buf.validate.field).bytes.len = 4]; + // } + // ``` + optional uint64 len = 13 [(predefined).cel = { + id: "bytes.len" + expression: "uint(this.size()) != rules.len ? 'value length must be %s bytes'.format([rules.len]) : ''" + }]; + + // `min_len` requires the field value to have at least the specified minimum + // length in bytes. + // If the field value doesn't meet the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value length must be at least 2 bytes. + // optional bytes value = 1 [(buf.validate.field).bytes.min_len = 2]; + // } + // ``` + optional uint64 min_len = 2 [(predefined).cel = { + id: "bytes.min_len" + expression: "uint(this.size()) < rules.min_len ? 'value length must be at least %s bytes'.format([rules.min_len]) : ''" + }]; + + // `max_len` requires the field value to have at most the specified maximum + // length in bytes. + // If the field value exceeds the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must be at most 6 bytes. + // optional bytes value = 1 [(buf.validate.field).bytes.max_len = 6]; + // } + // ``` + optional uint64 max_len = 3 [(predefined).cel = { + id: "bytes.max_len" + expression: "uint(this.size()) > rules.max_len ? 'value must be at most %s bytes'.format([rules.max_len]) : ''" + }]; + + // `pattern` requires the field value to match the specified regular + // expression ([RE2 syntax](https://github.com/google/re2/wiki/Syntax)). + // The value of the field must be valid UTF-8 or validation will fail with a + // runtime error. + // If the field value doesn't match the pattern, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must match regex pattern "^[a-zA-Z0-9]+$". + // optional bytes value = 1 [(buf.validate.field).bytes.pattern = "^[a-zA-Z0-9]+$"]; + // } + // ``` + optional string pattern = 4 [(predefined).cel = { + id: "bytes.pattern" + expression: "!string(this).matches(rules.pattern) ? 'value must match regex pattern `%s`'.format([rules.pattern]) : ''" + }]; + + // `prefix` requires the field value to have the specified bytes at the + // beginning of the string. + // If the field value doesn't meet the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value does not have prefix \x01\x02 + // optional bytes value = 1 [(buf.validate.field).bytes.prefix = "\x01\x02"]; + // } + // ``` + optional bytes prefix = 5 [(predefined).cel = { + id: "bytes.prefix" + expression: "!this.startsWith(rules.prefix) ? 'value does not have prefix %x'.format([rules.prefix]) : ''" + }]; + + // `suffix` requires the field value to have the specified bytes at the end + // of the string. + // If the field value doesn't meet the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value does not have suffix \x03\x04 + // optional bytes value = 1 [(buf.validate.field).bytes.suffix = "\x03\x04"]; + // } + // ``` + optional bytes suffix = 6 [(predefined).cel = { + id: "bytes.suffix" + expression: "!this.endsWith(rules.suffix) ? 'value does not have suffix %x'.format([rules.suffix]) : ''" + }]; + + // `contains` requires the field value to have the specified bytes anywhere in + // the string. + // If the field value doesn't meet the requirement, an error message is generated. + // + // ```proto + // message MyBytes { + // // value does not contain \x02\x03 + // optional bytes value = 1 [(buf.validate.field).bytes.contains = "\x02\x03"]; + // } + // ``` + optional bytes contains = 7 [(predefined).cel = { + id: "bytes.contains" + expression: "!this.contains(rules.contains) ? 'value does not contain %x'.format([rules.contains]) : ''" + }]; + + // `in` requires the field value to be equal to one of the specified + // values. If the field value doesn't match any of the specified values, an + // error message is generated. + // + // ```proto + // message MyBytes { + // // value must in ["\x01\x02", "\x02\x03", "\x03\x04"] + // optional bytes value = 1 [(buf.validate.field).bytes.in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; + // } + // ``` + repeated bytes in = 8 [(predefined).cel = { + id: "bytes.in" + expression: "getField(rules, 'in').size() > 0 && !(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to be not equal to any of the specified + // values. + // If the field value matches any of the specified values, an error message is + // generated. + // + // ```proto + // message MyBytes { + // // value must not in ["\x01\x02", "\x02\x03", "\x03\x04"] + // optional bytes value = 1 [(buf.validate.field).bytes.not_in = {"\x01\x02", "\x02\x03", "\x03\x04"}]; + // } + // ``` + repeated bytes not_in = 9 [(predefined).cel = { + id: "bytes.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // WellKnown rules provide advanced rules against common byte + // patterns + oneof well_known { + // `ip` ensures that the field `value` is a valid IP address (v4 or v6) in byte format. + // If the field value doesn't meet this rule, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must be a valid IP address + // optional bytes value = 1 [(buf.validate.field).bytes.ip = true]; + // } + // ``` + bool ip = 10 [ + (predefined).cel = { + id: "bytes.ip" + message: "value must be a valid IP address" + expression: "!rules.ip || this.size() == 0 || this.size() == 4 || this.size() == 16" + }, + (predefined).cel = { + id: "bytes.ip_empty" + message: "value is empty, which is not a valid IP address" + expression: "!rules.ip || this.size() != 0" + } + ]; + + // `ipv4` ensures that the field `value` is a valid IPv4 address in byte format. + // If the field value doesn't meet this rule, an error message is generated. + // + // ```proto + // message MyBytes { + // // value must be a valid IPv4 address + // optional bytes value = 1 [(buf.validate.field).bytes.ipv4 = true]; + // } + // ``` + bool ipv4 = 11 [ + (predefined).cel = { + id: "bytes.ipv4" + message: "value must be a valid IPv4 address" + expression: "!rules.ipv4 || this.size() == 0 || this.size() == 4" + }, + (predefined).cel = { + id: "bytes.ipv4_empty" + message: "value is empty, which is not a valid IPv4 address" + expression: "!rules.ipv4 || this.size() != 0" + } + ]; + + // `ipv6` ensures that the field `value` is a valid IPv6 address in byte format. + // If the field value doesn't meet this rule, an error message is generated. + // ```proto + // message MyBytes { + // // value must be a valid IPv6 address + // optional bytes value = 1 [(buf.validate.field).bytes.ipv6 = true]; + // } + // ``` + bool ipv6 = 12 [ + (predefined).cel = { + id: "bytes.ipv6" + message: "value must be a valid IPv6 address" + expression: "!rules.ipv6 || this.size() == 0 || this.size() == 16" + }, + (predefined).cel = { + id: "bytes.ipv6_empty" + message: "value is empty, which is not a valid IPv6 address" + expression: "!rules.ipv6 || this.size() != 0" + } + ]; + + // `uuid` ensures that the field `value` encodes the 128-bit UUID data as + // defined by [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122#section-4.1.2). + // The field must contain exactly 16 bytes + // representing the UUID. If the field value isn't a valid UUID, an error + // message will be generated. + // + // ```proto + // message MyBytes { + // // value must be a valid UUID + // optional bytes value = 1 [(buf.validate.field).bytes.uuid = true]; + // } + // ``` + bool uuid = 15 [ + (predefined).cel = { + id: "bytes.uuid" + message: "value must be a valid UUID" + expression: "!rules.uuid || this.size() == 0 || this.size() == 16" + }, + (predefined).cel = { + id: "bytes.uuid_empty" + message: "value is empty, which is not a valid UUID" + expression: "!rules.uuid || this.size() != 0" + } + ]; + } + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyBytes { + // bytes value = 1 [ + // (buf.validate.field).bytes.example = "\x01\x02", + // (buf.validate.field).bytes.example = "\x02\x03" + // ]; + // } + // ``` + repeated bytes example = 14 [(predefined).cel = { + id: "bytes.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// EnumRules describe the rules applied to `enum` values. +message EnumRules { + // `const` requires the field value to exactly match the specified enum value. + // If the field value doesn't match, an error message is generated. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // // The field `value` must be exactly MY_ENUM_VALUE1. + // MyEnum value = 1 [(buf.validate.field).enum.const = 1]; + // } + // ``` + optional int32 const = 1 [(predefined).cel = { + id: "enum.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + + // `defined_only` requires the field value to be one of the defined values for + // this enum, failing on any undefined value. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // // The field `value` must be a defined value of MyEnum. + // MyEnum value = 1 [(buf.validate.field).enum.defined_only = true]; + // } + // ``` + optional bool defined_only = 2; + + // `in` requires the field value to be equal to one of the + //specified enum values. If the field value doesn't match any of the + //specified values, an error message is generated. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // // The field `value` must be equal to one of the specified values. + // MyEnum value = 1 [(buf.validate.field).enum = { in: [1, 2]}]; + // } + // ``` + repeated int32 in = 3 [(predefined).cel = { + id: "enum.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to be not equal to any of the + //specified enum values. If the field value matches one of the specified + // values, an error message is generated. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // // The field `value` must not be equal to any of the specified values. + // MyEnum value = 1 [(buf.validate.field).enum = { not_in: [1, 2]}]; + // } + // ``` + repeated int32 not_in = 4 [(predefined).cel = { + id: "enum.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // enum MyEnum { + // MY_ENUM_UNSPECIFIED = 0; + // MY_ENUM_VALUE1 = 1; + // MY_ENUM_VALUE2 = 2; + // } + // + // message MyMessage { + // (buf.validate.field).enum.example = 1, + // (buf.validate.field).enum.example = 2 + // } + // ``` + repeated int32 example = 5 [(predefined).cel = { + id: "enum.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// RepeatedRules describe the rules applied to `repeated` values. +message RepeatedRules { + // `min_items` requires that this field must contain at least the specified + // minimum number of items. + // + // Note that `min_items = 1` is equivalent to setting a field as `required`. + // + // ```proto + // message MyRepeated { + // // value must contain at least 2 items + // repeated string value = 1 [(buf.validate.field).repeated.min_items = 2]; + // } + // ``` + optional uint64 min_items = 1 [(predefined).cel = { + id: "repeated.min_items" + expression: "uint(this.size()) < rules.min_items ? 'value must contain at least %d item(s)'.format([rules.min_items]) : ''" + }]; + + // `max_items` denotes that this field must not exceed a + // certain number of items as the upper limit. If the field contains more + // items than specified, an error message will be generated, requiring the + // field to maintain no more than the specified number of items. + // + // ```proto + // message MyRepeated { + // // value must contain no more than 3 item(s) + // repeated string value = 1 [(buf.validate.field).repeated.max_items = 3]; + // } + // ``` + optional uint64 max_items = 2 [(predefined).cel = { + id: "repeated.max_items" + expression: "uint(this.size()) > rules.max_items ? 'value must contain no more than %s item(s)'.format([rules.max_items]) : ''" + }]; + + // `unique` indicates that all elements in this field must + // be unique. This rule is strictly applicable to scalar and enum + // types, with message types not being supported. + // + // ```proto + // message MyRepeated { + // // repeated value must contain unique items + // repeated string value = 1 [(buf.validate.field).repeated.unique = true]; + // } + // ``` + optional bool unique = 3 [(predefined).cel = { + id: "repeated.unique" + message: "repeated value must contain unique items" + expression: "!rules.unique || this.unique()" + }]; + + // `items` details the rules to be applied to each item + // in the field. Even for repeated message fields, validation is executed + // against each item unless `ignore` is specified. + // + // ```proto + // message MyRepeated { + // // The items in the field `value` must follow the specified rules. + // repeated string value = 1 [(buf.validate.field).repeated.items = { + // string: { + // min_len: 3 + // max_len: 10 + // } + // }]; + // } + // ``` + // + // Note that the `required` rule does not apply. Repeated items + // cannot be unset. + optional FieldRules items = 4; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// MapRules describe the rules applied to `map` values. +message MapRules { + // Specifies the minimum number of key-value pairs allowed. If the field has + // fewer key-value pairs than specified, an error message is generated. + // + // ```proto + // message MyMap { + // // The field `value` must have at least 2 key-value pairs. + // map value = 1 [(buf.validate.field).map.min_pairs = 2]; + // } + // ``` + optional uint64 min_pairs = 1 [(predefined).cel = { + id: "map.min_pairs" + expression: "uint(this.size()) < rules.min_pairs ? 'map must be at least %d entries'.format([rules.min_pairs]) : ''" + }]; + + // Specifies the maximum number of key-value pairs allowed. If the field has + // more key-value pairs than specified, an error message is generated. + // + // ```proto + // message MyMap { + // // The field `value` must have at most 3 key-value pairs. + // map value = 1 [(buf.validate.field).map.max_pairs = 3]; + // } + // ``` + optional uint64 max_pairs = 2 [(predefined).cel = { + id: "map.max_pairs" + expression: "uint(this.size()) > rules.max_pairs ? 'map must be at most %d entries'.format([rules.max_pairs]) : ''" + }]; + + // Specifies the rules to be applied to each key in the field. + // + // ```proto + // message MyMap { + // // The keys in the field `value` must follow the specified rules. + // map value = 1 [(buf.validate.field).map.keys = { + // string: { + // min_len: 3 + // max_len: 10 + // } + // }]; + // } + // ``` + // + // Note that the `required` rule does not apply. Map keys cannot be unset. + optional FieldRules keys = 4; + + // Specifies the rules to be applied to the value of each key in the + // field. Message values will still have their validations evaluated unless + // `ignore` is specified. + // + // ```proto + // message MyMap { + // // The values in the field `value` must follow the specified rules. + // map value = 1 [(buf.validate.field).map.values = { + // string: { + // min_len: 5 + // max_len: 20 + // } + // }]; + // } + // ``` + // Note that the `required` rule does not apply. Map values cannot be unset. + optional FieldRules values = 5; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// AnyRules describe rules applied exclusively to the `google.protobuf.Any` well-known type. +message AnyRules { + // `in` requires the field's `type_url` to be equal to one of the + //specified values. If it doesn't match any of the specified values, an error + // message is generated. + // + // ```proto + // message MyAny { + // // The `value` field must have a `type_url` equal to one of the specified values. + // google.protobuf.Any value = 1 [(buf.validate.field).any = { + // in: ["type.googleapis.com/MyType1", "type.googleapis.com/MyType2"] + // }]; + // } + // ``` + repeated string in = 2; + + // requires the field's type_url to be not equal to any of the specified values. If it matches any of the specified values, an error message is generated. + // + // ```proto + // message MyAny { + // // The `value` field must not have a `type_url` equal to any of the specified values. + // google.protobuf.Any value = 1 [(buf.validate.field).any = { + // not_in: ["type.googleapis.com/ForbiddenType1", "type.googleapis.com/ForbiddenType2"] + // }]; + // } + // ``` + repeated string not_in = 3; +} + +// DurationRules describe the rules applied exclusively to the `google.protobuf.Duration` well-known type. +message DurationRules { + // `const` dictates that the field must match the specified value of the `google.protobuf.Duration` type exactly. + // If the field's value deviates from the specified value, an error message + // will be generated. + // + // ```proto + // message MyDuration { + // // value must equal 5s + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.const = "5s"]; + // } + // ``` + optional google.protobuf.Duration const = 2 [(predefined).cel = { + id: "duration.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // `lt` stipulates that the field must be less than the specified value of the `google.protobuf.Duration` type, + // exclusive. If the field's value is greater than or equal to the specified + // value, an error message will be generated. + // + // ```proto + // message MyDuration { + // // value must be less than 5s + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = "5s"]; + // } + // ``` + google.protobuf.Duration lt = 3 [(predefined).cel = { + id: "duration.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // `lte` indicates that the field must be less than or equal to the specified + // value of the `google.protobuf.Duration` type, inclusive. If the field's value is greater than the specified value, + // an error message will be generated. + // + // ```proto + // message MyDuration { + // // value must be less than or equal to 10s + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lte = "10s"]; + // } + // ``` + google.protobuf.Duration lte = 4 [(predefined).cel = { + id: "duration.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + } + oneof greater_than { + // `gt` requires the duration field value to be greater than the specified + // value (exclusive). If the value of `gt` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyDuration { + // // duration must be greater than 5s [duration.gt] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.gt = { seconds: 5 }]; + // + // // duration must be greater than 5s and less than 10s [duration.gt_lt] + // google.protobuf.Duration another_value = 2 [(buf.validate.field).duration = { gt: { seconds: 5 }, lt: { seconds: 10 } }]; + // + // // duration must be greater than 10s or less than 5s [duration.gt_lt_exclusive] + // google.protobuf.Duration other_value = 3 [(buf.validate.field).duration = { gt: { seconds: 10 }, lt: { seconds: 5 } }]; + // } + // ``` + google.protobuf.Duration gt = 5 [ + (predefined).cel = { + id: "duration.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "duration.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "duration.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "duration.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "duration.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the duration field value to be greater than or equal to the + // specified value (exclusive). If the value of `gte` is larger than a + // specified `lt` or `lte`, the range is reversed, and the field value must + // be outside the specified range. If the field value doesn't meet the + // required conditions, an error message is generated. + // + // ```proto + // message MyDuration { + // // duration must be greater than or equal to 5s [duration.gte] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.gte = { seconds: 5 }]; + // + // // duration must be greater than or equal to 5s and less than 10s [duration.gte_lt] + // google.protobuf.Duration another_value = 2 [(buf.validate.field).duration = { gte: { seconds: 5 }, lt: { seconds: 10 } }]; + // + // // duration must be greater than or equal to 10s or less than 5s [duration.gte_lt_exclusive] + // google.protobuf.Duration other_value = 3 [(buf.validate.field).duration = { gte: { seconds: 10 }, lt: { seconds: 5 } }]; + // } + // ``` + google.protobuf.Duration gte = 6 [ + (predefined).cel = { + id: "duration.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "duration.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "duration.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "duration.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "duration.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + } + + // `in` asserts that the field must be equal to one of the specified values of the `google.protobuf.Duration` type. + // If the field's value doesn't correspond to any of the specified values, + // an error message will be generated. + // + // ```proto + // message MyDuration { + // // value must be in list [1s, 2s, 3s] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.in = ["1s", "2s", "3s"]]; + // } + // ``` + repeated google.protobuf.Duration in = 7 [(predefined).cel = { + id: "duration.in" + expression: "!(this in getField(rules, 'in')) ? 'value must be in list %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` denotes that the field must not be equal to + // any of the specified values of the `google.protobuf.Duration` type. + // If the field's value matches any of these values, an error message will be + // generated. + // + // ```proto + // message MyDuration { + // // value must not be in list [1s, 2s, 3s] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.not_in = ["1s", "2s", "3s"]]; + // } + // ``` + repeated google.protobuf.Duration not_in = 8 [(predefined).cel = { + id: "duration.not_in" + expression: "this in rules.not_in ? 'value must not be in list %s'.format([rules.not_in]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyDuration { + // google.protobuf.Duration value = 1 [ + // (buf.validate.field).duration.example = { seconds: 1 }, + // (buf.validate.field).duration.example = { seconds: 2 }, + // ]; + // } + // ``` + repeated google.protobuf.Duration example = 9 [(predefined).cel = { + id: "duration.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// FieldMaskRules describe rules applied exclusively to the `google.protobuf.FieldMask` well-known type. +message FieldMaskRules { + // `const` dictates that the field must match the specified value of the `google.protobuf.FieldMask` type exactly. + // If the field's value deviates from the specified value, an error message + // will be generated. + // + // ```proto + // message MyFieldMask { + // // value must equal ["a"] + // google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask.const = { + // paths: ["a"] + // }]; + // } + // ``` + optional google.protobuf.FieldMask const = 1 [(predefined).cel = { + id: "field_mask.const" + expression: "this.paths != getField(rules, 'const').paths ? 'value must equal paths %s'.format([getField(rules, 'const').paths]) : ''" + }]; + + // `in` requires the field value to only contain paths matching specified + // values or their subpaths. + // If any of the field value's paths doesn't match the rule, + // an error message is generated. + // See: https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask + // + // ```proto + // message MyFieldMask { + // // The `value` FieldMask must only contain paths listed in `in`. + // google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = { + // in: ["a", "b", "c.a"] + // }]; + // } + // ``` + repeated string in = 2 [(predefined).cel = { + id: "field_mask.in" + expression: "!this.paths.all(p, p in getField(rules, 'in') || getField(rules, 'in').exists(f, p.startsWith(f+'.'))) ? 'value must only contain paths in %s'.format([getField(rules, 'in')]) : ''" + }]; + + // `not_in` requires the field value to not contain paths matching specified + // values or their subpaths. + // If any of the field value's paths matches the rule, + // an error message is generated. + // See: https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask + // + // ```proto + // message MyFieldMask { + // // The `value` FieldMask shall not contain paths listed in `not_in`. + // google.protobuf.FieldMask value = 1 [(buf.validate.field).field_mask = { + // not_in: ["forbidden", "immutable", "c.a"] + // }]; + // } + // ``` + repeated string not_in = 3 [(predefined).cel = { + id: "field_mask.not_in" + expression: "!this.paths.all(p, !(p in getField(rules, 'not_in') || getField(rules, 'not_in').exists(f, p.startsWith(f+'.')))) ? 'value must not contain any paths in %s'.format([getField(rules, 'not_in')]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyFieldMask { + // google.protobuf.FieldMask value = 1 [ + // (buf.validate.field).field_mask.example = { paths: ["a", "b"] }, + // (buf.validate.field).field_mask.example = { paths: ["c.a", "d"] }, + // ]; + // } + // ``` + repeated google.protobuf.FieldMask example = 4 [(predefined).cel = { + id: "field_mask.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// TimestampRules describe the rules applied exclusively to the `google.protobuf.Timestamp` well-known type. +message TimestampRules { + // `const` dictates that this field, of the `google.protobuf.Timestamp` type, must exactly match the specified value. If the field value doesn't correspond to the specified timestamp, an error message will be generated. + // + // ```proto + // message MyTimestamp { + // // value must equal 2023-05-03T10:00:00Z + // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.const = {seconds: 1727998800}]; + // } + // ``` + optional google.protobuf.Timestamp const = 2 [(predefined).cel = { + id: "timestamp.const" + expression: "this != getField(rules, 'const') ? 'value must equal %s'.format([getField(rules, 'const')]) : ''" + }]; + oneof less_than { + // requires the duration field value to be less than the specified value (field < value). If the field value doesn't meet the required conditions, an error message is generated. + // + // ```proto + // message MyDuration { + // // duration must be less than 'P3D' [duration.lt] + // google.protobuf.Duration value = 1 [(buf.validate.field).duration.lt = { seconds: 259200 }]; + // } + // ``` + google.protobuf.Timestamp lt = 3 [(predefined).cel = { + id: "timestamp.lt" + expression: + "!has(rules.gte) && !has(rules.gt) && this >= rules.lt" + "? 'value must be less than %s'.format([rules.lt]) : ''" + }]; + + // requires the timestamp field value to be less than or equal to the specified value (field <= value). If the field value doesn't meet the required conditions, an error message is generated. + // + // ```proto + // message MyTimestamp { + // // timestamp must be less than or equal to '2023-05-14T00:00:00Z' [timestamp.lte] + // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.lte = { seconds: 1678867200 }]; + // } + // ``` + google.protobuf.Timestamp lte = 4 [(predefined).cel = { + id: "timestamp.lte" + expression: + "!has(rules.gte) && !has(rules.gt) && this > rules.lte" + "? 'value must be less than or equal to %s'.format([rules.lte]) : ''" + }]; + + // `lt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be less than the current time. `lt_now` can only be used with the `within` rule. + // + // ```proto + // message MyTimestamp { + // // value must be less than now + // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.lt_now = true]; + // } + // ``` + bool lt_now = 7 [(predefined).cel = { + id: "timestamp.lt_now" + expression: "(rules.lt_now && this > now) ? 'value must be less than now' : ''" + }]; + } + oneof greater_than { + // `gt` requires the timestamp field value to be greater than the specified + // value (exclusive). If the value of `gt` is larger than a specified `lt` + // or `lte`, the range is reversed, and the field value must be outside the + // specified range. If the field value doesn't meet the required conditions, + // an error message is generated. + // + // ```proto + // message MyTimestamp { + // // timestamp must be greater than '2023-01-01T00:00:00Z' [timestamp.gt] + // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.gt = { seconds: 1672444800 }]; + // + // // timestamp must be greater than '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' [timestamp.gt_lt] + // google.protobuf.Timestamp another_value = 2 [(buf.validate.field).timestamp = { gt: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }]; + // + // // timestamp must be greater than '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' [timestamp.gt_lt_exclusive] + // google.protobuf.Timestamp other_value = 3 [(buf.validate.field).timestamp = { gt: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }]; + // } + // ``` + google.protobuf.Timestamp gt = 5 [ + (predefined).cel = { + id: "timestamp.gt" + expression: + "!has(rules.lt) && !has(rules.lte) && this <= rules.gt" + "? 'value must be greater than %s'.format([rules.gt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gt_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gt && (this >= rules.lt || this <= rules.gt)" + "? 'value must be greater than %s and less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gt_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gt && (rules.lt <= this && this <= rules.gt)" + "? 'value must be greater than %s or less than %s'.format([rules.gt, rules.lt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gt_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gt && (this > rules.lte || this <= rules.gt)" + "? 'value must be greater than %s and less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + }, + (predefined).cel = { + id: "timestamp.gt_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gt && (rules.lte < this && this <= rules.gt)" + "? 'value must be greater than %s or less than or equal to %s'.format([rules.gt, rules.lte]) : ''" + } + ]; + + // `gte` requires the timestamp field value to be greater than or equal to the + // specified value (exclusive). If the value of `gte` is larger than a + // specified `lt` or `lte`, the range is reversed, and the field value + // must be outside the specified range. If the field value doesn't meet + // the required conditions, an error message is generated. + // + // ```proto + // message MyTimestamp { + // // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' [timestamp.gte] + // google.protobuf.Timestamp value = 1 [(buf.validate.field).timestamp.gte = { seconds: 1672444800 }]; + // + // // timestamp must be greater than or equal to '2023-01-01T00:00:00Z' and less than '2023-01-02T00:00:00Z' [timestamp.gte_lt] + // google.protobuf.Timestamp another_value = 2 [(buf.validate.field).timestamp = { gte: { seconds: 1672444800 }, lt: { seconds: 1672531200 } }]; + // + // // timestamp must be greater than or equal to '2023-01-02T00:00:00Z' or less than '2023-01-01T00:00:00Z' [timestamp.gte_lt_exclusive] + // google.protobuf.Timestamp other_value = 3 [(buf.validate.field).timestamp = { gte: { seconds: 1672531200 }, lt: { seconds: 1672444800 } }]; + // } + // ``` + google.protobuf.Timestamp gte = 6 [ + (predefined).cel = { + id: "timestamp.gte" + expression: + "!has(rules.lt) && !has(rules.lte) && this < rules.gte" + "? 'value must be greater than or equal to %s'.format([rules.gte]) : ''" + }, + (predefined).cel = { + id: "timestamp.gte_lt" + expression: + "has(rules.lt) && rules.lt >= rules.gte && (this >= rules.lt || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gte_lt_exclusive" + expression: + "has(rules.lt) && rules.lt < rules.gte && (rules.lt <= this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than %s'.format([rules.gte, rules.lt]) : ''" + }, + (predefined).cel = { + id: "timestamp.gte_lte" + expression: + "has(rules.lte) && rules.lte >= rules.gte && (this > rules.lte || this < rules.gte)" + "? 'value must be greater than or equal to %s and less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + }, + (predefined).cel = { + id: "timestamp.gte_lte_exclusive" + expression: + "has(rules.lte) && rules.lte < rules.gte && (rules.lte < this && this < rules.gte)" + "? 'value must be greater than or equal to %s or less than or equal to %s'.format([rules.gte, rules.lte]) : ''" + } + ]; + + // `gt_now` specifies that this field, of the `google.protobuf.Timestamp` type, must be greater than the current time. `gt_now` can only be used with the `within` rule. + // + // ```proto + // message MyTimestamp { + // // value must be greater than now + // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.gt_now = true]; + // } + // ``` + bool gt_now = 8 [(predefined).cel = { + id: "timestamp.gt_now" + expression: "(rules.gt_now && this < now) ? 'value must be greater than now' : ''" + }]; + } + + // `within` specifies that this field, of the `google.protobuf.Timestamp` type, must be within the specified duration of the current time. If the field value isn't within the duration, an error message is generated. + // + // ```proto + // message MyTimestamp { + // // value must be within 1 hour of now + // google.protobuf.Timestamp created_at = 1 [(buf.validate.field).timestamp.within = {seconds: 3600}]; + // } + // ``` + optional google.protobuf.Duration within = 9 [(predefined).cel = { + id: "timestamp.within" + expression: "this < now-rules.within || this > now+rules.within ? 'value must be within %s of now'.format([rules.within]) : ''" + }]; + + // `example` specifies values that the field may have. These values SHOULD + // conform to other rules. `example` values will not impact validation + // but may be used as helpful guidance on how to populate the given field. + // + // ```proto + // message MyTimestamp { + // google.protobuf.Timestamp value = 1 [ + // (buf.validate.field).timestamp.example = { seconds: 1672444800 }, + // (buf.validate.field).timestamp.example = { seconds: 1672531200 }, + // ]; + // } + // ``` + repeated google.protobuf.Timestamp example = 10 [(predefined).cel = { + id: "timestamp.example" + expression: "true" + }]; + + // Extension fields that have the (buf.validate.predefined) option set + // will be treated as predefined field rules. + // See https://protovalidate.com/schemas/predefined-rules/ + extensions 1000 to max; +} + +// `Violations` is a collection of `Violation` messages. This message type is returned by +// Protovalidate when a proto message fails to meet the requirements set by the `Rule` validation rules. +// Each individual violation is represented by a `Violation` message. +message Violations { + // `violations` is a repeated field that contains all the `Violation` messages corresponding to the violations detected. + repeated Violation violations = 1; +} + +// `Violation` represents a single instance where a validation rule, expressed +// as a `Rule`, was not met. It provides information about the field that +// caused the violation, the specific rule that wasn't fulfilled, and a +// human-readable error message. +// +// For example, consider the following message: +// +// ```proto +// message User { +// int32 age = 1 [(buf.validate.field).cel = { +// id: "user.age", +// expression: "this < 18 ? 'User must be at least 18 years old' : ''", +// }]; +// } +// ``` +// +// It could produce the following violation: +// +// ```json +// { +// "ruleId": "user.age", +// "message": "User must be at least 18 years old", +// "field": { +// "elements": [ +// { +// "fieldNumber": 1, +// "fieldName": "age", +// "fieldType": "TYPE_INT32" +// } +// ] +// }, +// "rule": { +// "elements": [ +// { +// "fieldNumber": 23, +// "fieldName": "cel", +// "fieldType": "TYPE_MESSAGE", +// "index": "0" +// } +// ] +// } +// } +// ``` +message Violation { + // `field` is a machine-readable path to the field that failed validation. + // This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation. + // + // For example, consider the following message: + // + // ```proto + // message Message { + // bool a = 1 [(buf.validate.field).required = true]; + // } + // ``` + // + // It could produce the following violation: + // + // ```textproto + // violation { + // field { element { field_number: 1, field_name: "a", field_type: 8 } } + // ... + // } + // ``` + optional FieldPath field = 5; + + // `rule` is a machine-readable path that points to the specific rule that failed validation. + // This will be a nested field starting from the FieldRules of the field that failed validation. + // For custom rules, this will provide the path of the rule, e.g. `cel[0]`. + // + // For example, consider the following message: + // + // ```proto + // message Message { + // bool a = 1 [(buf.validate.field).required = true]; + // bool b = 2 [(buf.validate.field).cel = { + // id: "custom_rule", + // expression: "!this ? 'b must be true': ''" + // }] + // } + // ``` + // + // It could produce the following violations: + // + // ```textproto + // violation { + // rule { element { field_number: 25, field_name: "required", field_type: 8 } } + // ... + // } + // violation { + // rule { element { field_number: 23, field_name: "cel", field_type: 11, index: 0 } } + // ... + // } + // ``` + optional FieldPath rule = 6; + + // `rule_id` is the unique identifier of the `Rule` that was not fulfilled. + // This is the same `id` that was specified in the `Rule` message, allowing easy tracing of which rule was violated. + optional string rule_id = 2; + + // `message` is a human-readable error message that describes the nature of the violation. + // This can be the default error message from the violated `Rule`, or it can be a custom message that gives more context about the violation. + optional string message = 3; + + // `for_key` indicates whether the violation was caused by a map key, rather than a value. + optional bool for_key = 4; + + reserved 1; + reserved "field_path"; +} + +// `FieldPath` provides a path to a nested protobuf field. +// +// This message provides enough information to render a dotted field path even without protobuf descriptors. +// It also provides enough information to resolve a nested field through unknown wire data. +message FieldPath { + // `elements` contains each element of the path, starting from the root and recursing downward. + repeated FieldPathElement elements = 1; +} + +// `FieldPathElement` provides enough information to nest through a single protobuf field. +// +// If the selected field is a map or repeated field, the `subscript` value selects a specific element from it. +// A path that refers to a value nested under a map key or repeated field index will have a `subscript` value. +// The `field_type` field allows unambiguous resolution of a field even if descriptors are not available. +message FieldPathElement { + // `field_number` is the field number this path element refers to. + optional int32 field_number = 1; + + // `field_name` contains the field name this path element refers to. + // This can be used to display a human-readable path even if the field number is unknown. + optional string field_name = 2; + + // `field_type` specifies the type of this field. When using reflection, this value is not needed. + // + // This value is provided to make it possible to traverse unknown fields through wire data. + // When traversing wire data, be mindful of both packed[1] and delimited[2] encoding schemes. + // + // [1]: https://protobuf.dev/programming-guides/encoding/#packed + // [2]: https://protobuf.dev/programming-guides/encoding/#groups + // + // N.B.: Although groups are deprecated, the corresponding delimited encoding scheme is not, and + // can be explicitly used in Protocol Buffers 2023 Edition. + optional google.protobuf.FieldDescriptorProto.Type field_type = 3; + + // `key_type` specifies the map key type of this field. This value is useful when traversing + // unknown fields through wire data: specifically, it allows handling the differences between + // different integer encodings. + optional google.protobuf.FieldDescriptorProto.Type key_type = 4; + + // `value_type` specifies map value type of this field. This is useful if you want to display a + // value inside unknown fields through wire data. + optional google.protobuf.FieldDescriptorProto.Type value_type = 5; + + // `subscript` contains a repeated index or map key, if this path element nests into a repeated or map field. + oneof subscript { + // `index` specifies a 0-based index into a repeated field. + uint64 index = 6; + + // `bool_key` specifies a map key of type bool. + bool bool_key = 7; + + // `int_key` specifies a map key of type int32, int64, sint32, sint64, sfixed32 or sfixed64. + int64 int_key = 8; + + // `uint_key` specifies a map key of type uint32, uint64, fixed32 or fixed64. + uint64 uint_key = 9; + + // `string_key` specifies a map key of type string. + string string_key = 10; + } +}