diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8e1be9b..c264db0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,10 +7,10 @@ on: branches: - main paths-ignore: - - 'docs/**' - - 'LICENSES/**' - - '.releases/**' - - '.github/**' + - "docs/**" + - "LICENSES/**" + - ".releases/**" + - ".github/**" pull_request: permissions: @@ -19,5 +19,5 @@ permissions: jobs: check: - uses: openkcm/build/.github/workflows/ci.lib.api.yaml@main + uses: openkcm/build/.github/workflows/ci.lib.yaml@main secrets: inherit diff --git a/.golangci.yaml b/.golangci.yaml index aaab6de..368f65d 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -9,9 +9,10 @@ linters: - err113 - exhaustive - exhaustruct + - exhaustruct_v5 - forbidigo - - funlen - funcorder + - funlen - ginkgolinter - gochecknoglobals - gochecknoinits @@ -19,6 +20,7 @@ linters: - gocritic - godot - godox + - gomodguard # Replaced by gomodguard_v2, enabled with default: all - gosec - ireturn - lll diff --git a/.sonarcloud.properties b/.sonarcloud.properties new file mode 100644 index 0000000..aa60c77 --- /dev/null +++ b/.sonarcloud.properties @@ -0,0 +1,2 @@ +sonar.exclusions=proto/**,**/*_test.go +sonar.cpd.exclusions=proto/**,**/*_test.go diff --git a/Makefile b/Makefile index bb12076..b3b0e43 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,8 @@ fetch-protos: .PHONY: go-gen go-gen: clean + @go install ./cmd/protoc-gen-go-eventbuilders + @go install ./cmd/protoc-gen-go-otlpconverters @find ./proto -type f -iname '*.proto' -exec \ protoc -I./proto -I./vendor-proto \ --go_out=./proto \ @@ -20,6 +22,16 @@ go-gen: clean --go-grpc_opt=paths=import \ --go-grpc_opt=module=github.com/openkcm/api-sdk/proto \ {} + + @protoc -I./proto -I./vendor-proto \ + --go-eventbuilders_out=./proto \ + --go-eventbuilders_opt=paths=import \ + --go-eventbuilders_opt=module=github.com/openkcm/api-sdk/proto \ + ./proto/kms/api/cmk/auditlog/events/v1/events.proto + @protoc -I./proto -I./vendor-proto \ + --go-otlpconverters_out=./proto \ + --go-otlpconverters_opt=paths=import \ + --go-otlpconverters_opt=module=github.com/openkcm/api-sdk/proto \ + ./proto/kms/api/cmk/auditlog/events/v1/events.proto @go mod tidy .PHONY: install-tools @@ -28,9 +40,15 @@ install-tools: go install \ google.golang.org/protobuf/cmd/protoc-gen-go@latest \ google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest + go install ./cmd/protoc-gen-go-eventbuilders + go install ./cmd/protoc-gen-go-otlpconverters brew install bufbuild/buf/buf npm install -g @coralogix/protofetch +.PHONY: test +test: + go test -count=1 -race -coverprofile cover.out ./... + .PHONY: validate validate: format lint breaking diff --git a/Taskfile.yaml b/Taskfile.yaml index 8d1e2fc..f0a8df2 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -5,5 +5,5 @@ includes: taskfile: hack/common/Taskfile_library.yaml flatten: true vars: - CODE_DIRS: '' + CODE_DIRS: "{{.ROOT_DIR}}/cmd/..." GENERATE_DOCS_INDEX: "false" diff --git a/cmd/protoc-gen-go-eventbuilders/main.go b/cmd/protoc-gen-go-eventbuilders/main.go new file mode 100644 index 0000000..fc955b5 --- /dev/null +++ b/cmd/protoc-gen-go-eventbuilders/main.go @@ -0,0 +1,353 @@ +// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and OpenKCM contributors +// SPDX-License-Identifier: Apache-2.0 + +// protoc-gen-go-eventbuilders generates New*Event builder functions +// for proto messages that have a "common" field of type Common. +// Generated builders accept Common plus all other required fields as parameters. +package main + +import ( + "strings" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" +) + +func main() { + (protogen.Options{}).Run(func(gen *protogen.Plugin) error { //nolint:exhaustruct_v5 // protogen.Options zero value is intentional + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + return nil + }) +} + +func generateFile(gen *protogen.Plugin, file *protogen.File) { + // Find the Common message type in this file + var commonMsg *protogen.Message + + for _, msg := range file.Messages { + if msg.GoIdent.GoName == "Common" { + commonMsg = msg + break + } + } + + if commonMsg == nil { + return // No Common message in this file + } + + // Collect messages that have a "common" field of type Common + type eventInfo struct { + Msg *protogen.Message + RequiredFields []*protogen.Field + } + + var events []eventInfo + + for _, msg := range file.Messages { + if msg == commonMsg { + continue + } + + var ( + hasCommon bool + requiredFields []*protogen.Field + ) + + for _, field := range msg.Fields { + if field.GoName == "Common" && field.Message == commonMsg { + hasCommon = true + continue + } + // Check if field has buf.validate.field.required = true + if isRequiredField(field) { + requiredFields = append(requiredFields, field) + } + } + + if hasCommon { + events = append(events, eventInfo{Msg: msg, RequiredFields: requiredFields}) + } + } + + if len(events) == 0 { + return + } + + // Generate output file + filename := file.GeneratedFilenamePrefix + "_eventbuilders.pb.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + + g.P("// Code generated by protoc-gen-go-eventbuilders. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + + // Generate builder for each event message + for _, evt := range events { + generateEventBuilder(g, evt.Msg, evt.RequiredFields) + } +} + +// isRequiredField checks if field has buf.validate.field.required = true +// by examining the raw proto options for the buf.validate.field extension (number 1159). +func isRequiredField(field *protogen.Field) bool { + opts := field.Desc.Options() + if opts == nil { + return false + } + + // Get the raw options as a proto message + optsProto, ok := opts.(*descriptorpb.FieldOptions) + if !ok { + return false + } + + // buf.validate.field extension number is 1159 + // We need to check the unknown fields or use proto reflection + // to find if required = true is set + + // Use proto reflection to check for the extension + optsReflect := optsProto.ProtoReflect() + + // Iterate over unknown fields looking for field 1159 (buf.validate.field) + // The extension is defined as: + // extend google.protobuf.FieldOptions { + // optional buf.validate.FieldConstraints field = 1159; + // } + // Within FieldConstraints, required is field 25. + + unknownFields := optsReflect.GetUnknown() + if len(unknownFields) == 0 { + return false + } + + // Parse the unknown fields to find field 1159 + // Wire format: varint tag (field_number << 3 | wire_type), then value + // For an embedded message, wire_type = 2 (length-delimited) + return parseUnknownForRequired(unknownFields, 1159, 25) +} + +// parseUnknownForRequired parses unknown fields looking for a specific extension field +// containing a required=true boolean. +func parseUnknownForRequired(data []byte, extFieldNum, requiredFieldNum int) bool { + for len(data) > 0 { + // Read tag (varint) + tag, n := consumeVarint(data) + if n <= 0 { + return false + } + + data = data[n:] + + fieldNum := int(tag >> 3) + wireType := int(tag & 0x7) + + if fieldNum == extFieldNum && wireType == 2 { + // Length-delimited (embedded message) + length, n := consumeVarint(data) + if n <= 0 { + return false + } + + data = data[n:] + + if int(length) > len(data) { + return false + } + + // Parse the embedded message for required field + embedded := data[:length] + if parseEmbeddedForRequired(embedded, requiredFieldNum) { + return true + } + + data = data[length:] + } else { + // Skip this field + data = skipField(data, wireType) + if data == nil { + return false + } + } + } + + return false +} + +// parseEmbeddedForRequired looks for a bool field with the given number set to true. +func parseEmbeddedForRequired(data []byte, fieldNum int) bool { + for len(data) > 0 { + tag, n := consumeVarint(data) + if n <= 0 { + return false + } + + data = data[n:] + + fNum := int(tag >> 3) + wireType := int(tag & 0x7) + + if fNum == fieldNum && wireType == 0 { + // Varint (bool) + val, n := consumeVarint(data) + if n <= 0 { + return false + } + + return val != 0 + } + + // Skip this field + data = skipField(data, wireType) + if data == nil { + return false + } + } + + return false +} + +func consumeVarint(data []byte) (uint64, int) { + var val uint64 + + for i := 0; i < len(data) && i < 10; i++ { + b := data[i] + + val |= uint64(b&0x7F) << (7 * i) + if b < 0x80 { + return val, i + 1 + } + } + + return 0, -1 +} + +func skipField(data []byte, wireType int) []byte { + switch wireType { + case 0: // Varint + for i := range data { + if data[i] < 0x80 { + return data[i+1:] + } + } + + return nil + case 1: // 64-bit + if len(data) < 8 { + return nil + } + + return data[8:] + case 2: // Length-delimited + length, n := consumeVarint(data) + if n <= 0 { + return nil + } + + data = data[n:] + if int(length) > len(data) { + return nil + } + + return data[length:] + case 5: // 32-bit + if len(data) < 4 { + return nil + } + + return data[4:] + default: + return nil + } +} + +func generateEventBuilder(g *protogen.GeneratedFile, msg *protogen.Message, requiredFields []*protogen.Field) { + // Build parameter list: common *Common, then each required field + params := make([]string, 0, 1+len(requiredFields)) + + params = append(params, "common *Common") + for _, f := range requiredFields { + params = append(params, toParamName(f.GoName)+" "+goType(f)) + } + + // Build using setter methods (compatible with opaque API in editions) + g.P("// New", msg.GoIdent.GoName, "Event creates a ", msg.GoIdent.GoName, " with required fields populated.") + g.P("func New", msg.GoIdent.GoName, "Event(") + + for _, p := range params { + g.P("\t", p, ",") + } + + g.P(") *", msg.GoIdent.GoName, " {") + g.P("\tm := &", msg.GoIdent.GoName, "{}") + g.P("\tm.SetCommon(common)") + + for _, f := range requiredFields { + g.P("\tm.Set", f.GoName, "(", toParamName(f.GoName), ")") + } + + g.P("\treturn m") + g.P("}") + g.P() +} + +func toParamName(goName string) string { + // Convert GoName to camelCase parameter: DataSubjectType -> dataSubjectType + if len(goName) == 0 { + return goName + } + + return strings.ToLower(goName[:1]) + goName[1:] +} + +func goType(field *protogen.Field) string { + // Handle message and enum types that need field-specific info + switch field.Desc.Kind() { + case protoreflect.MessageKind: + return "*" + field.Message.GoIdent.GoName + case protoreflect.EnumKind: + return field.Enum.GoIdent.GoName + default: + return goTypeFromKind(field.Desc.Kind()) + } +} + +// goTypeFromKind returns the Go type for scalar protobuf kinds. +func goTypeFromKind(kind protoreflect.Kind) string { + switch kind { + case protoreflect.StringKind: + return "string" + case protoreflect.BoolKind: + return "bool" + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + return "int32" + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + return "int64" + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + return "uint32" + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + return "uint64" + case protoreflect.FloatKind: + return "float32" + case protoreflect.DoubleKind: + return "float64" + case protoreflect.BytesKind: + return "[]byte" + default: + return "interface{}" + } +} diff --git a/cmd/protoc-gen-go-eventbuilders/main_test.go b/cmd/protoc-gen-go-eventbuilders/main_test.go new file mode 100644 index 0000000..595c733 --- /dev/null +++ b/cmd/protoc-gen-go-eventbuilders/main_test.go @@ -0,0 +1,1181 @@ +// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and OpenKCM contributors +// SPDX-License-Identifier: Apache-2.0 + +package main + +import ( + "bytes" + "strings" + "testing" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" +) + +func TestConsumeVarint(t *testing.T) { + tests := []struct { + name string + data []byte + wantVal uint64 + wantN int + wantFail bool + }{ + { + name: "single byte zero", + data: []byte{0x00}, + wantVal: 0, + wantN: 1, + }, + { + name: "single byte value", + data: []byte{0x01}, + wantVal: 1, + wantN: 1, + }, + { + name: "single byte max", + data: []byte{0x7F}, + wantVal: 127, + wantN: 1, + }, + { + name: "two byte value 128", + data: []byte{0x80, 0x01}, + wantVal: 128, + wantN: 2, + }, + { + name: "two byte value 300", + data: []byte{0xAC, 0x02}, + wantVal: 300, + wantN: 2, + }, + { + name: "larger varint", + data: []byte{0x96, 0x01}, // 150 + wantVal: 150, + wantN: 2, + }, + { + name: "five byte value", + data: []byte{0xFF, 0xFF, 0xFF, 0xFF, 0x0F}, + wantVal: 0xFFFFFFFF, + wantN: 5, + }, + { + name: "empty data", + data: []byte{}, + wantVal: 0, + wantN: -1, + wantFail: true, + }, + { + name: "incomplete varint (all continuation bits)", + data: []byte{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}, + wantVal: 0, + wantN: -1, + wantFail: true, + }, + { + name: "data with trailing bytes", + data: []byte{0x05, 0xFF, 0xFF}, + wantVal: 5, + wantN: 1, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gotVal, gotN := consumeVarint(tt.data) + if tt.wantFail { + if gotN >= 0 { + t.Errorf("consumeVarint() expected failure, got n=%d", gotN) + } + + return + } + + if gotVal != tt.wantVal { + t.Errorf("consumeVarint() val = %d, want %d", gotVal, tt.wantVal) + } + + if gotN != tt.wantN { + t.Errorf("consumeVarint() n = %d, want %d", gotN, tt.wantN) + } + }) + } +} + +func TestSkipField(t *testing.T) { + tests := []struct { + name string + data []byte + wireType int + wantLen int // length of remaining data, -1 for nil + }{ + // Wire type 0: Varint + { + name: "varint single byte", + data: []byte{0x05, 0xAA, 0xBB}, + wireType: 0, + wantLen: 2, + }, + { + name: "varint two bytes", + data: []byte{0x80, 0x01, 0xAA}, + wireType: 0, + wantLen: 1, + }, + { + name: "varint incomplete", + data: []byte{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}, + wireType: 0, + wantLen: -1, + }, + // Wire type 1: 64-bit + { + name: "64-bit fixed", + data: []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xAA}, + wireType: 1, + wantLen: 1, + }, + { + name: "64-bit insufficient data", + data: []byte{0x01, 0x02, 0x03}, + wireType: 1, + wantLen: -1, + }, + // Wire type 2: Length-delimited + { + name: "length-delimited", + data: []byte{0x03, 0xAA, 0xBB, 0xCC, 0xDD}, + wireType: 2, + wantLen: 1, + }, + { + name: "length-delimited empty", + data: []byte{0x00, 0xAA}, + wireType: 2, + wantLen: 1, + }, + { + name: "length-delimited insufficient", + data: []byte{0x05, 0xAA, 0xBB}, + wireType: 2, + wantLen: -1, + }, + { + name: "length-delimited bad length varint", + data: []byte{}, + wireType: 2, + wantLen: -1, + }, + // Wire type 5: 32-bit + { + name: "32-bit fixed", + data: []byte{0x01, 0x02, 0x03, 0x04, 0xAA}, + wireType: 5, + wantLen: 1, + }, + { + name: "32-bit insufficient data", + data: []byte{0x01, 0x02}, + wireType: 5, + wantLen: -1, + }, + // Unknown wire type + { + name: "unknown wire type 3", + data: []byte{0x01, 0x02, 0x03}, + wireType: 3, + wantLen: -1, + }, + { + name: "unknown wire type 4", + data: []byte{0x01, 0x02, 0x03}, + wireType: 4, + wantLen: -1, + }, + { + name: "unknown wire type 6", + data: []byte{0x01, 0x02, 0x03}, + wireType: 6, + wantLen: -1, + }, + { + name: "unknown wire type 7", + data: []byte{0x01, 0x02, 0x03}, + wireType: 7, + wantLen: -1, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := skipField(tt.data, tt.wireType) + if tt.wantLen == -1 { + if got != nil { + t.Errorf("skipField() = %v, want nil", got) + } + + return + } + + if got == nil { + t.Errorf("skipField() = nil, want len=%d", tt.wantLen) + return + } + + if len(got) != tt.wantLen { + t.Errorf("skipField() remaining len = %d, want %d", len(got), tt.wantLen) + } + }) + } +} + +func TestToParamName(t *testing.T) { + tests := []struct { + input string + want string + }{ + {"", ""}, + {"A", "a"}, + {"DataSubjectType", "dataSubjectType"}, + {"ID", "iD"}, + {"UserId", "userId"}, + {"XMLParser", "xMLParser"}, + {"simpleCase", "simpleCase"}, + {"X", "x"}, + {"ABC", "aBC"}, + } + + for _, tt := range tests { + t.Run(tt.input, func(t *testing.T) { + got := toParamName(tt.input) + if got != tt.want { + t.Errorf("toParamName(%q) = %q, want %q", tt.input, got, tt.want) + } + }) + } +} + +func TestParseEmbeddedForRequired(t *testing.T) { + tests := []struct { + name string + data []byte + fieldNum int + want bool + }{ + { + name: "empty data", + data: []byte{}, + fieldNum: 25, + want: false, + }, + { + name: "field 25 set to true", + // tag = 25 << 3 | 0 = 200 = 0xC8, value = 1 + data: []byte{0xC8, 0x01, 0x01}, + fieldNum: 25, + want: true, + }, + { + name: "field 25 set to false", + // tag = 25 << 3 | 0 = 200 = 0xC8, value = 0 + data: []byte{0xC8, 0x01, 0x00}, + fieldNum: 25, + want: false, + }, + { + name: "different field number", + // tag = 10 << 3 | 0 = 80 = 0x50, value = 1 + data: []byte{0x50, 0x01}, + fieldNum: 25, + want: false, + }, + { + name: "incomplete tag", + data: []byte{0x80, 0x80}, // incomplete varint + fieldNum: 25, + want: false, + }, + { + name: "wrong wire type for field 25", + // tag = 25 << 3 | 2 = 202 = 0xCA (length-delimited instead of varint) + data: []byte{0xCA, 0x01, 0x03, 0xAA, 0xBB, 0xCC}, + fieldNum: 25, + want: false, + }, + { + name: "field found but value varint incomplete", + // tag = 25 << 3 | 0 = 200, but no value follows + data: []byte{0xC8, 0x01}, + fieldNum: 25, + want: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := parseEmbeddedForRequired(tt.data, tt.fieldNum) + if got != tt.want { + t.Errorf("parseEmbeddedForRequired() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestParseUnknownForRequired(t *testing.T) { + tests := []struct { + name string + data []byte + extFieldNum int + requiredFieldNum int + want bool + }{ + { + name: "empty data", + data: []byte{}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: false, + }, + { + name: "extension field with required=true", + // tag = 1159 << 3 | 2 = 9274 (length-delimited) + // 9274 in varint = 0xBA 0x48 + // length = 3, embedded = [0xC8, 0x01, 0x01] (field 25 = true) + data: []byte{0xBA, 0x48, 0x03, 0xC8, 0x01, 0x01}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: true, + }, + { + name: "extension field with required=false", + // same but value = 0 + data: []byte{0xBA, 0x48, 0x03, 0xC8, 0x01, 0x00}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: false, + }, + { + name: "different extension field", + // tag = 1000 << 3 | 2 = 8002 (length-delimited) + // 8002 in varint = 0xD2 0x3E + data: []byte{0xD2, 0x3E, 0x03, 0xC8, 0x01, 0x01}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: false, + }, + { + name: "wrong wire type for extension", + // tag = 1159 << 3 | 0 = 9272 (varint instead of length-delimited) + // 9272 in varint = 0xB8 0x48 + data: []byte{0xB8, 0x48, 0x01}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: false, + }, + { + name: "incomplete tag", + data: []byte{0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: false, + }, + { + name: "length exceeds data", + // tag = 1159 << 3 | 2 = 9274, length = 100 but only 3 bytes follow + data: []byte{0xBA, 0x48, 0x64, 0x01, 0x02, 0x03}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: false, + }, + { + name: "skip varint field then find extension", + // First: tag=1 wire=0 (varint), value=5 + // Then: extension field with required=true + data: []byte{0x08, 0x05, 0xBA, 0x48, 0x03, 0xC8, 0x01, 0x01}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: true, + }, + { + name: "skip 64-bit field then find extension", + // First: tag=1 wire=1 (64-bit) + // Then: extension field with required=true + data: []byte{0x09, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xBA, 0x48, 0x03, 0xC8, 0x01, 0x01}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: true, + }, + { + name: "skip 32-bit field then find extension", + // First: tag=1 wire=5 (32-bit) + // Then: extension field with required=true + data: []byte{0x0D, 0x01, 0x02, 0x03, 0x04, 0xBA, 0x48, 0x03, 0xC8, 0x01, 0x01}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: true, + }, + { + name: "skip length-delimited field then find extension", + // First: tag=1 wire=2 (length-delimited), length=2, data + // Then: extension field with required=true + data: []byte{0x0A, 0x02, 0xAA, 0xBB, 0xBA, 0x48, 0x03, 0xC8, 0x01, 0x01}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: true, + }, + { + name: "unable to skip unknown wire type", + // tag=1 wire=3 (start group - deprecated/unsupported) + data: []byte{0x0B, 0x01, 0x02}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: false, + }, + { + name: "incomplete length varint in extension", + // tag = 1159 << 3 | 2, then incomplete varint for length + data: []byte{0xBA, 0x48, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80}, + extFieldNum: 1159, + requiredFieldNum: 25, + want: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := parseUnknownForRequired(tt.data, tt.extFieldNum, tt.requiredFieldNum) + if got != tt.want { + t.Errorf("parseUnknownForRequired() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestGoTypeFromKind(t *testing.T) { + tests := []struct { + kind protoreflect.Kind + want string + }{ + {protoreflect.StringKind, "string"}, + {protoreflect.BoolKind, "bool"}, + {protoreflect.Int32Kind, "int32"}, + {protoreflect.Sint32Kind, "int32"}, + {protoreflect.Sfixed32Kind, "int32"}, + {protoreflect.Int64Kind, "int64"}, + {protoreflect.Sint64Kind, "int64"}, + {protoreflect.Sfixed64Kind, "int64"}, + {protoreflect.Uint32Kind, "uint32"}, + {protoreflect.Fixed32Kind, "uint32"}, + {protoreflect.Uint64Kind, "uint64"}, + {protoreflect.Fixed64Kind, "uint64"}, + {protoreflect.FloatKind, "float32"}, + {protoreflect.DoubleKind, "float64"}, + {protoreflect.BytesKind, "[]byte"}, + // Message and Enum are handled by goType, not goTypeFromKind + {protoreflect.MessageKind, "interface{}"}, + {protoreflect.EnumKind, "interface{}"}, + // Unknown kinds + {protoreflect.GroupKind, "interface{}"}, + } + + for _, tt := range tests { + t.Run(tt.kind.String(), func(t *testing.T) { + got := goTypeFromKind(tt.kind) + if got != tt.want { + t.Errorf("goTypeFromKind(%v) = %q, want %q", tt.kind, got, tt.want) + } + }) + } +} + +// createTestRequest creates a CodeGeneratorRequest for testing the plugin. +func createTestRequest(files []*descriptorpb.FileDescriptorProto, filesToGenerate []string) *pluginpb.CodeGeneratorRequest { + return &pluginpb.CodeGeneratorRequest{ + FileToGenerate: filesToGenerate, + ProtoFile: files, + } +} + +func TestGenerateFile_NoCommonMessage(t *testing.T) { + // Create a file without a Common message - should produce no output + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("test.proto"), + Package: new("test"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/test;test"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("SomeMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("id"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"test.proto"}) + + // Marshal request to simulate stdin + reqBytes, err := proto.Marshal(req) + if err != nil { + t.Fatalf("failed to marshal request: %v", err) + } + + // Use Options.New to create plugin from request bytes + var outputBuf bytes.Buffer + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + respBytes, err := proto.Marshal(resp) + if err != nil { + t.Fatalf("failed to marshal response: %v", err) + } + + outputBuf.Write(respBytes) + + // Verify no files were generated (no Common message) + if len(resp.GetFile()) != 0 { + t.Errorf("expected no files generated for proto without Common, got %d", len(resp.GetFile())) + } + + // Verify reqBytes is used + _ = reqBytes +} + +func TestGenerateFile_WithCommonAndEvents(t *testing.T) { + // Create a file with Common message and event messages + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("events.proto"), + Package: new("events"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/events;events"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("SimpleEvent"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".events.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventWithFields"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".events.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("user_id"), + Number: proto.Int32(2), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"events.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + // Verify at least one file was generated + if len(resp.GetFile()) == 0 { + t.Fatal("expected at least one file to be generated") + } + + // Check the generated content + var foundContent bool + + for _, f := range resp.GetFile() { + if f.Content != nil { + content := f.GetContent() + foundContent = true + + // Verify the generated content contains expected patterns + if !strings.Contains(content, "package events") { + t.Error("generated content should contain 'package events'") + } + + if !strings.Contains(content, "NewSimpleEventEvent") { + t.Error("generated content should contain 'NewSimpleEventEvent'") + } + + if !strings.Contains(content, "NewEventWithFieldsEvent") { + t.Error("generated content should contain 'NewEventWithFieldsEvent'") + } + + if !strings.Contains(content, "SetCommon") { + t.Error("generated content should contain 'SetCommon'") + } + + if !strings.Contains(content, "Code generated by protoc-gen-go-eventbuilders") { + t.Error("generated content should contain generator comment") + } + } + } + + if !foundContent { + t.Error("no content was generated") + } +} + +func TestGenerateFile_NoEventsWithCommon(t *testing.T) { + // Create a file with Common message but no messages that use it + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("noevents.proto"), + Package: new("noevents"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/noevents;noevents"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("OtherMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("id"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"noevents.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + // Verify no files were generated (no events with Common field) + if len(resp.GetFile()) != 0 { + t.Errorf("expected no files generated for proto without events, got %d", len(resp.GetFile())) + } +} + +func TestIsRequiredField_NilOptions(t *testing.T) { + // Test isRequiredField with nil options by creating a minimal field descriptor + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("test.proto"), + Package: new("test"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/test;test"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("TestMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("field_without_options"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + // No options set + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"test.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + // Find the field and test isRequiredField + for _, f := range gen.Files { + for _, msg := range f.Messages { + for _, field := range msg.Fields { + // Should return false for field without options + if isRequiredField(field) { + t.Errorf("isRequiredField should return false for field without options") + } + } + } + } +} + +func TestIsRequiredField_EmptyUnknownFields(t *testing.T) { + // Test with empty field options (no unknown fields) + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("test.proto"), + Package: new("test"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/test;test"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("TestMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("field_with_empty_options"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + Options: &descriptorpb.FieldOptions{}, // Empty options + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"test.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + for _, f := range gen.Files { + for _, msg := range f.Messages { + for _, field := range msg.Fields { + if isRequiredField(field) { + t.Errorf("isRequiredField should return false for field with empty options") + } + } + } + } +} + +func TestGenerateFile_WithEnumField(t *testing.T) { + // Create a file with an enum field to test goType for enums + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("enum_test.proto"), + Package: new("enumtest"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/enumtest;enumtest"), + }, + EnumType: []*descriptorpb.EnumDescriptorProto{ + { + Name: new("Status"), + Value: []*descriptorpb.EnumValueDescriptorProto{ + {Name: new("STATUS_UNSPECIFIED"), Number: proto.Int32(0)}, + {Name: new("STATUS_ACTIVE"), Number: proto.Int32(1)}, + }, + }, + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventWithEnum"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".enumtest.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("status"), + Number: proto.Int32(2), + Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), + TypeName: new(".enumtest.Status"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"enum_test.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + // Verify at least one file was generated + if len(resp.GetFile()) == 0 { + t.Fatal("expected at least one file to be generated") + } + + // Check the generated content contains the event builder + for _, f := range resp.GetFile() { + if f.Content != nil { + content := f.GetContent() + if !strings.Contains(content, "NewEventWithEnumEvent") { + t.Error("generated content should contain 'NewEventWithEnumEvent'") + } + } + } +} + +func TestGenerateFile_WithAllScalarTypes(t *testing.T) { + // Create a file with all scalar types to test goType coverage + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("scalars.proto"), + Package: new("scalars"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/scalars;scalars"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventWithScalars"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".scalars.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("string_field"), + Number: proto.Int32(2), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("bool_field"), + Number: proto.Int32(3), + Type: descriptorpb.FieldDescriptorProto_TYPE_BOOL.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("int32_field"), + Number: proto.Int32(4), + Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("int64_field"), + Number: proto.Int32(5), + Type: descriptorpb.FieldDescriptorProto_TYPE_INT64.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("uint32_field"), + Number: proto.Int32(6), + Type: descriptorpb.FieldDescriptorProto_TYPE_UINT32.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("uint64_field"), + Number: proto.Int32(7), + Type: descriptorpb.FieldDescriptorProto_TYPE_UINT64.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("float_field"), + Number: proto.Int32(8), + Type: descriptorpb.FieldDescriptorProto_TYPE_FLOAT.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("double_field"), + Number: proto.Int32(9), + Type: descriptorpb.FieldDescriptorProto_TYPE_DOUBLE.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("bytes_field"), + Number: proto.Int32(10), + Type: descriptorpb.FieldDescriptorProto_TYPE_BYTES.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"scalars.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + if len(resp.GetFile()) == 0 { + t.Fatal("expected at least one file to be generated") + } + + for _, f := range resp.GetFile() { + if f.Content != nil { + content := f.GetContent() + if !strings.Contains(content, "NewEventWithScalarsEvent") { + t.Error("generated content should contain 'NewEventWithScalarsEvent'") + } + } + } +} + +func TestGoType_WithMessageAndEnumFields(t *testing.T) { + // Create a file with message and enum fields to test goType coverage + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("goType_test.proto"), + Package: new("gotypetest"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/gotypetest;gotypetest"), + }, + EnumType: []*descriptorpb.EnumDescriptorProto{ + { + Name: new("MyEnum"), + Value: []*descriptorpb.EnumValueDescriptorProto{ + {Name: new("MY_ENUM_UNSPECIFIED"), Number: proto.Int32(0)}, + {Name: new("MY_ENUM_VALUE"), Number: proto.Int32(1)}, + }, + }, + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("NestedMsg"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("value"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventWithMessageAndEnum"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".gotypetest.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("nested"), + Number: proto.Int32(2), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".gotypetest.NestedMsg"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("my_enum"), + Number: proto.Int32(3), + Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), + TypeName: new(".gotypetest.MyEnum"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"goType_test.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + // Directly test goType by finding fields + for _, f := range gen.Files { + for _, msg := range f.Messages { + if msg.GoIdent.GoName == "EventWithMessageAndEnum" { + for _, field := range msg.Fields { + switch field.GoName { + case "Nested": + // Message type + typ := goType(field) + if typ != "*NestedMsg" { + t.Errorf("goType for message field = %q, want %q", typ, "*NestedMsg") + } + case "MyEnum": + // Enum type + typ := goType(field) + if typ != "MyEnum" { + t.Errorf("goType for enum field = %q, want %q", typ, "MyEnum") + } + } + } + } + } + } +} diff --git a/cmd/protoc-gen-go-otlpconverters/main.go b/cmd/protoc-gen-go-otlpconverters/main.go new file mode 100644 index 0000000..bd779c3 --- /dev/null +++ b/cmd/protoc-gen-go-otlpconverters/main.go @@ -0,0 +1,430 @@ +// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and OpenKCM contributors +// SPDX-License-Identifier: Apache-2.0 + +// protoc-gen-go-otlpconverters generates ToLogRecord() and FromLogRecord() methods +// for proto messages that have a "common" field of type Common. +// Generated methods convert the event to/from an OTLP plog.LogRecord. +package main + +import ( + "strings" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" +) + +// Severity levels for different event types +var warnEvents = map[string]bool{ + "LoginFailed": true, + "CMKUnavailable": true, + "CMKDisabled": true, + "UnauthenticatedRequest": true, + "UnauthorizedRequest": true, +} + +func main() { + (protogen.Options{}).Run(func(gen *protogen.Plugin) error { //nolint:exhaustruct_v5 // protogen.Options zero value is intentional + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + return nil + }) +} + +// eventInfo holds information about an event message and its fields +type eventInfo struct { + Msg *protogen.Message + Fields []*protogen.Field // All fields except Common +} + +func generateFile(gen *protogen.Plugin, file *protogen.File) { + // Find the Common message type in this file + var commonMsg *protogen.Message + + for _, msg := range file.Messages { + if msg.GoIdent.GoName == "Common" { + commonMsg = msg + break + } + } + + if commonMsg == nil { + return // No Common message in this file + } + + // Collect messages that have a "common" field of type Common + var events []eventInfo + + for _, msg := range file.Messages { + if msg == commonMsg { + continue + } + + var ( + hasCommon bool + fields []*protogen.Field + ) + + for _, field := range msg.Fields { + if field.GoName == "Common" && field.Message == commonMsg { + hasCommon = true + continue + } + + fields = append(fields, field) + } + + if hasCommon { + events = append(events, eventInfo{Msg: msg, Fields: fields}) + } + } + + if len(events) == 0 { + return + } + + // Collect all enum types used by event fields for generating parsers + enumTypes := collectEnumTypes(events) + + // Generate output file + filename := file.GeneratedFilenamePrefix + "_otlpconverters.pb.go" + g := gen.NewGeneratedFile(filename, file.GoImportPath) + + g.P("// Code generated by protoc-gen-go-otlpconverters. DO NOT EDIT.") + g.P() + g.P("package ", file.GoPackageName) + g.P() + + // Generate imports + g.P("import (") + g.P(` "encoding/hex"`) + g.P(` "fmt"`) + g.P(` "strings"`) + g.P() + g.P(` "go.opentelemetry.io/collector/pdata/pcommon"`) + g.P(` "go.opentelemetry.io/collector/pdata/plog"`) + g.P(` "google.golang.org/protobuf/types/known/timestamppb"`) + g.P(")") + g.P() + + // Generate AuditEvent interface + g.P("// AuditEvent is implemented by all audit log event types.") + g.P("type AuditEvent interface {") + g.P(" GetCommon() *Common") + g.P(" ToLogRecord() plog.LogRecord") + g.P(" FromLogRecord(lr plog.LogRecord) error") + g.P("}") + g.P() + + // Generate ParseAuditEvent dispatcher + generateParseAuditEvent(g, events) + + // Generate ToLogRecord and FromLogRecord for each event message + for _, evt := range events { + generateToLogRecord(g, evt.Msg, evt.Fields) + generateFromLogRecord(g, evt.Msg, evt.Fields) + } + + // Generate helper functions + generateHelperFunctions(g) + + // Generate enum parsers + generateEnumParsers(g, enumTypes) +} + +// collectEnumTypes returns all unique enum types used by event fields +func collectEnumTypes(events []eventInfo) []*protogen.Enum { + seen := make(map[protogen.GoIdent]bool) + + var enums []*protogen.Enum + + for _, evt := range events { + for _, field := range evt.Fields { + if field.Desc.Kind() == protoreflect.EnumKind { + ident := field.Enum.GoIdent + if !seen[ident] { + seen[ident] = true + + enums = append(enums, field.Enum) + } + } + } + } + + return enums +} + +func generateParseAuditEvent(g *protogen.GeneratedFile, events []eventInfo) { + g.P("// ParseAuditEvent parses an OTLP LogRecord into the appropriate AuditEvent type.") + g.P("// It reads the event type from the LogRecord body and dispatches to the correct FromLogRecord method.") + g.P("func ParseAuditEvent(lr plog.LogRecord) (AuditEvent, error) {") + g.P(" eventType := lr.Body().Str()") + g.P(" switch eventType {") + + for _, evt := range events { + msgName := evt.Msg.GoIdent.GoName + g.P(` case "`, msgName, `":`) + g.P(" e := &", msgName, "{}") + g.P(" if err := e.FromLogRecord(lr); err != nil {") + g.P(" return nil, err") + g.P(" }") + g.P(" return e, nil") + } + + g.P(" default:") + g.P(` return nil, fmt.Errorf("unknown audit event type: %s", eventType)`) + g.P(" }") + g.P("}") + g.P() +} + +func generateToLogRecord(g *protogen.GeneratedFile, msg *protogen.Message, fields []*protogen.Field) { + msgName := msg.GoIdent.GoName + severity := "Info" + severityText := "INFO" + + if warnEvents[msgName] { + severity = "Warn" + severityText = "WARN" + } + + g.P("// ToLogRecord converts ", msgName, " to an OTLP plog.LogRecord.") + g.P("func (x *", msgName, ") ToLogRecord() plog.LogRecord {") + g.P(" lr := plog.NewLogRecord()") + g.P() + g.P(" if c := x.GetCommon(); c != nil {") + g.P(" if ts := c.GetTimestamp(); ts != nil {") + g.P(" lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano()))") + g.P(" }") + g.P(" if c.HasTraceId() {") + g.P(" if tid, err := parseTraceID(c.GetTraceId()); err == nil {") + g.P(" lr.SetTraceID(tid)") + g.P(" }") + g.P(" }") + g.P(" if c.HasSpanId() {") + g.P(" if sid, err := parseSpanID(c.GetSpanId()); err == nil {") + g.P(" lr.SetSpanID(sid)") + g.P(" }") + g.P(" }") + g.P(" for k, v := range c.GetProperties() {") + g.P(` lr.Attributes().PutStr("common.properties."+k, v)`) + g.P(" }") + g.P(" }") + g.P() + g.P(` lr.Body().SetStr("`, msgName, `")`) + g.P(" lr.SetSeverityNumber(plog.SeverityNumber", severity, ")") + g.P(` lr.SetSeverityText("`, severityText, `")`) + g.P() + + // Add event-specific attributes + for _, field := range fields { + attrName := toSnakeCase(field.GoName) + switch field.Desc.Kind() { + case protoreflect.StringKind: + g.P(` lr.Attributes().PutStr("`, attrName, `", x.Get`, field.GoName, `())`) + case protoreflect.BoolKind: + g.P(` lr.Attributes().PutBool("`, attrName, `", x.Get`, field.GoName, `())`) + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind, + protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + g.P(` lr.Attributes().PutInt("`, attrName, `", int64(x.Get`, field.GoName, `()))`) + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind, + protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + g.P(` lr.Attributes().PutInt("`, attrName, `", int64(x.Get`, field.GoName, `()))`) + case protoreflect.FloatKind, protoreflect.DoubleKind: + g.P(` lr.Attributes().PutDouble("`, attrName, `", float64(x.Get`, field.GoName, `()))`) + case protoreflect.EnumKind: + g.P(` lr.Attributes().PutStr("`, attrName, `", x.Get`, field.GoName, `().String())`) + case protoreflect.BytesKind: + g.P(` lr.Attributes().PutStr("`, attrName, `", hex.EncodeToString(x.Get`, field.GoName, `()))`) + case protoreflect.MessageKind: + // Skip nested messages for now - could be extended to handle specific types + g.P(` // TODO: handle nested message field `, field.GoName) + default: + g.P(` // Unsupported field type for `, field.GoName) + } + } + + g.P() + g.P(" return lr") + g.P("}") + g.P() +} + +func generateFromLogRecord(g *protogen.GeneratedFile, msg *protogen.Message, fields []*protogen.Field) { + msgName := msg.GoIdent.GoName + + g.P("// FromLogRecord populates ", msgName, " from an OTLP plog.LogRecord.") + g.P("func (x *", msgName, ") FromLogRecord(lr plog.LogRecord) error {") + g.P(" // Parse common fields") + g.P(" c := &Common{}") + g.P(" c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime()))") + g.P(" if !lr.TraceID().IsEmpty() {") + g.P(" c.SetTraceId(formatTraceID(lr.TraceID()))") + g.P(" }") + g.P(" if !lr.SpanID().IsEmpty() {") + g.P(" c.SetSpanId(formatSpanID(lr.SpanID()))") + g.P(" }") + g.P() + g.P(" // Parse properties from attributes with common.properties. prefix") + g.P(" props := make(map[string]string)") + g.P(" lr.Attributes().Range(func(k string, v pcommon.Value) bool {") + g.P(` if propKey, ok := strings.CutPrefix(k, "common.properties."); ok {`) + g.P(" props[propKey] = v.Str()") + g.P(" }") + g.P(" return true") + g.P(" })") + g.P(" if len(props) > 0 {") + g.P(" c.SetProperties(props)") + g.P(" }") + g.P(" x.SetCommon(c)") + g.P() + + // Parse event-specific fields + g.P(" // Parse event-specific fields") + + for _, field := range fields { + attrName := toSnakeCase(field.GoName) + switch field.Desc.Kind() { + case protoreflect.StringKind: + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" x.Set", field.GoName, "(v.Str())") + g.P(" }") + case protoreflect.BoolKind: + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" x.Set", field.GoName, "(v.Bool())") + g.P(" }") + case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind: + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" x.Set", field.GoName, "(int32(v.Int()))") + g.P(" }") + case protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind: + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" x.Set", field.GoName, "(v.Int())") + g.P(" }") + case protoreflect.Uint32Kind, protoreflect.Fixed32Kind: + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" x.Set", field.GoName, "(uint32(v.Int()))") + g.P(" }") + case protoreflect.Uint64Kind, protoreflect.Fixed64Kind: + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" x.Set", field.GoName, "(uint64(v.Int()))") + g.P(" }") + case protoreflect.FloatKind: + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" x.Set", field.GoName, "(float32(v.Double()))") + g.P(" }") + case protoreflect.DoubleKind: + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" x.Set", field.GoName, "(v.Double())") + g.P(" }") + case protoreflect.EnumKind: + enumName := field.Enum.GoIdent.GoName + + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" x.Set", field.GoName, "(parse", enumName, "(v.Str()))") + g.P(" }") + case protoreflect.BytesKind: + g.P(` if v, ok := lr.Attributes().Get("`, attrName, `"); ok {`) + g.P(" if b, err := hex.DecodeString(v.Str()); err == nil {") + g.P(" x.Set", field.GoName, "(b)") + g.P(" }") + g.P(" }") + case protoreflect.MessageKind: + // Skip nested messages for now + g.P(` // TODO: handle nested message field `, field.GoName) + default: + g.P(` // Unsupported field type for `, field.GoName) + } + } + + g.P() + g.P(" return nil") + g.P("}") + g.P() +} + +func generateHelperFunctions(g *protogen.GeneratedFile) { + g.P("// parseTraceID converts a 32-character hex string to a pcommon.TraceID.") + g.P("func parseTraceID(s string) (pcommon.TraceID, error) {") + g.P(" var tid pcommon.TraceID") + g.P(" b, err := hex.DecodeString(s)") + g.P(" if err != nil {") + g.P(" return tid, err") + g.P(" }") + g.P(" if len(b) != 16 {") + g.P(" return tid, hex.ErrLength") + g.P(" }") + g.P(" copy(tid[:], b)") + g.P(" return tid, nil") + g.P("}") + g.P() + g.P("// parseSpanID converts a 16-character hex string to a pcommon.SpanID.") + g.P("func parseSpanID(s string) (pcommon.SpanID, error) {") + g.P(" var sid pcommon.SpanID") + g.P(" b, err := hex.DecodeString(s)") + g.P(" if err != nil {") + g.P(" return sid, err") + g.P(" }") + g.P(" if len(b) != 8 {") + g.P(" return sid, hex.ErrLength") + g.P(" }") + g.P(" copy(sid[:], b)") + g.P(" return sid, nil") + g.P("}") + g.P() + g.P("// formatTraceID converts a pcommon.TraceID to a 32-character hex string.") + g.P("func formatTraceID(tid pcommon.TraceID) string {") + g.P(" return hex.EncodeToString(tid[:])") + g.P("}") + g.P() + g.P("// formatSpanID converts a pcommon.SpanID to a 16-character hex string.") + g.P("func formatSpanID(sid pcommon.SpanID) string {") + g.P(" return hex.EncodeToString(sid[:])") + g.P("}") +} + +func generateEnumParsers(g *protogen.GeneratedFile, enums []*protogen.Enum) { + for _, enum := range enums { + enumName := enum.GoIdent.GoName + + g.P() + g.P("// parse", enumName, " converts a string to ", enumName, ".") + g.P("func parse", enumName, "(s string) ", enumName, " {") + g.P(" if v, ok := ", enumName, "_value[s]; ok {") + g.P(" return ", enumName, "(v)") + g.P(" }") + g.P(" return 0") + g.P("}") + } +} + +// toSnakeCase converts GoName to snake_case for attribute names +func toSnakeCase(s string) string { + var result strings.Builder + + for i, r := range s { + if i > 0 && r >= 'A' && r <= 'Z' { + result.WriteByte('_') + } + + if r >= 'A' && r <= 'Z' { + result.WriteByte(byte(r - 'A' + 'a')) + } else { + result.WriteRune(r) + } + } + + return result.String() +} diff --git a/cmd/protoc-gen-go-otlpconverters/main_test.go b/cmd/protoc-gen-go-otlpconverters/main_test.go new file mode 100644 index 0000000..bb023b3 --- /dev/null +++ b/cmd/protoc-gen-go-otlpconverters/main_test.go @@ -0,0 +1,906 @@ +// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and OpenKCM contributors +// SPDX-License-Identifier: Apache-2.0 + +package main + +import ( + "strings" + "testing" + + "google.golang.org/protobuf/compiler/protogen" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/descriptorpb" + "google.golang.org/protobuf/types/pluginpb" +) + +func TestToSnakeCase(t *testing.T) { + tests := []struct { + input string + want string + }{ + {"", ""}, + {"a", "a"}, + {"A", "a"}, + {"DataSubjectType", "data_subject_type"}, + {"ID", "i_d"}, + {"UserId", "user_id"}, + {"XMLParser", "x_m_l_parser"}, + {"simpleCase", "simple_case"}, + {"simple", "simple"}, + {"ALLCAPS", "a_l_l_c_a_p_s"}, + {"TenantID", "tenant_i_d"}, + {"CMKId", "c_m_k_id"}, + {"firstName", "first_name"}, + {"FirstName", "first_name"}, + {"X", "x"}, + {"ABC", "a_b_c"}, + {"camelCase", "camel_case"}, + {"PascalCase", "pascal_case"}, + {"snake_case", "snake_case"}, + {"MixedCASE", "mixed_c_a_s_e"}, + } + + for _, tt := range tests { + t.Run(tt.input, func(t *testing.T) { + got := toSnakeCase(tt.input) + if got != tt.want { + t.Errorf("toSnakeCase(%q) = %q, want %q", tt.input, got, tt.want) + } + }) + } +} + +func TestWarnEvents(t *testing.T) { + // Verify warnEvents map contains expected entries + expectedWarnEvents := []string{ + "LoginFailed", + "CMKUnavailable", + "CMKDisabled", + "UnauthenticatedRequest", + "UnauthorizedRequest", + } + + for _, event := range expectedWarnEvents { + if !warnEvents[event] { + t.Errorf("warnEvents should contain %q", event) + } + } + + // Verify some events that should NOT be warnings + nonWarnEvents := []string{ + "LoginSucceeded", + "TenantCreated", + "CMKCreated", + "CMKEnabled", + "AccessGranted", + } + + for _, event := range nonWarnEvents { + if warnEvents[event] { + t.Errorf("warnEvents should NOT contain %q", event) + } + } +} + +func TestWarnEventsCount(t *testing.T) { + // Ensure we have exactly the expected number of warn events + expectedCount := 5 + if len(warnEvents) != expectedCount { + t.Errorf("warnEvents has %d entries, want %d", len(warnEvents), expectedCount) + } +} + +// createTestRequest creates a CodeGeneratorRequest for testing the plugin. +func createTestRequest(files []*descriptorpb.FileDescriptorProto, filesToGenerate []string) *pluginpb.CodeGeneratorRequest { + return &pluginpb.CodeGeneratorRequest{ + FileToGenerate: filesToGenerate, + ProtoFile: files, + } +} + +func TestGenerateFile_NoCommonMessage(t *testing.T) { + // Create a file without a Common message - should produce no output + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("test.proto"), + Package: new("test"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/test;test"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("SomeMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("id"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"test.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + // Verify no files were generated (no Common message) + if len(resp.GetFile()) != 0 { + t.Errorf("expected no files generated for proto without Common, got %d", len(resp.GetFile())) + } +} + +func TestGenerateFile_WithCommonAndEvents(t *testing.T) { + // Create a file with Common message and event messages + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("events.proto"), + Package: new("events"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/events;events"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("SimpleEvent"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".events.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("description"), + Number: proto.Int32(2), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"events.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + // Verify at least one file was generated + if len(resp.GetFile()) == 0 { + t.Fatal("expected at least one file to be generated") + } + + // Check the generated content + var foundContent bool + + for _, f := range resp.GetFile() { + if f.Content != nil { + content := f.GetContent() + foundContent = true + + // Verify the generated content contains expected patterns + if !strings.Contains(content, "package events") { + t.Error("generated content should contain 'package events'") + } + + if !strings.Contains(content, "ToLogRecord") { + t.Error("generated content should contain 'ToLogRecord'") + } + + if !strings.Contains(content, "FromLogRecord") { + t.Error("generated content should contain 'FromLogRecord'") + } + + if !strings.Contains(content, "ParseAuditEvent") { + t.Error("generated content should contain 'ParseAuditEvent'") + } + + if !strings.Contains(content, "AuditEvent") { + t.Error("generated content should contain 'AuditEvent'") + } + + if !strings.Contains(content, "parseTraceID") { + t.Error("generated content should contain 'parseTraceID'") + } + + if !strings.Contains(content, "parseSpanID") { + t.Error("generated content should contain 'parseSpanID'") + } + + if !strings.Contains(content, "formatTraceID") { + t.Error("generated content should contain 'formatTraceID'") + } + + if !strings.Contains(content, "formatSpanID") { + t.Error("generated content should contain 'formatSpanID'") + } + + if !strings.Contains(content, "Code generated by protoc-gen-go-otlpconverters") { + t.Error("generated content should contain generator comment") + } + + // Check imports + if !strings.Contains(content, `"encoding/hex"`) { + t.Error("generated content should contain hex import") + } + + if !strings.Contains(content, `"go.opentelemetry.io/collector/pdata/plog"`) { + t.Error("generated content should contain plog import") + } + } + } + + if !foundContent { + t.Error("no content was generated") + } +} + +func TestGenerateFile_WithWarnEvent(t *testing.T) { + // Create a file with an event that should have WARN severity + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("warn_events.proto"), + Package: new("warnevents"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/warnevents;warnevents"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("LoginFailed"), // Should be WARN + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".warnevents.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("user_id"), + Number: proto.Int32(2), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"warn_events.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + if len(resp.GetFile()) == 0 { + t.Fatal("expected at least one file to be generated") + } + + for _, f := range resp.GetFile() { + if f.Content != nil { + content := f.GetContent() + // Verify WARN severity is used for LoginFailed + if !strings.Contains(content, "SeverityNumberWarn") { + t.Error("generated content should contain 'SeverityNumberWarn' for LoginFailed event") + } + + if !strings.Contains(content, `"WARN"`) { + t.Error("generated content should contain 'WARN' severity text") + } + } + } +} + +func TestGenerateFile_NoEventsWithCommon(t *testing.T) { + // Create a file with Common message but no messages that use it + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("noevents.proto"), + Package: new("noevents"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/noevents;noevents"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("OtherMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("id"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"noevents.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + // Verify no files were generated (no events with Common field) + if len(resp.GetFile()) != 0 { + t.Errorf("expected no files generated for proto without events, got %d", len(resp.GetFile())) + } +} + +func TestGenerateFile_WithEnumField(t *testing.T) { + // Create a file with an enum field to test enum parsing generation + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("enum_test.proto"), + Package: new("enumtest"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/enumtest;enumtest"), + }, + EnumType: []*descriptorpb.EnumDescriptorProto{ + { + Name: new("Status"), + Value: []*descriptorpb.EnumValueDescriptorProto{ + {Name: new("STATUS_UNSPECIFIED"), Number: proto.Int32(0)}, + {Name: new("STATUS_ACTIVE"), Number: proto.Int32(1)}, + }, + }, + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventWithEnum"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".enumtest.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("status"), + Number: proto.Int32(2), + Type: descriptorpb.FieldDescriptorProto_TYPE_ENUM.Enum(), + TypeName: new(".enumtest.Status"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"enum_test.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + if len(resp.GetFile()) == 0 { + t.Fatal("expected at least one file to be generated") + } + + for _, f := range resp.GetFile() { + if f.Content != nil { + content := f.GetContent() + // Verify enum parser is generated + if !strings.Contains(content, "parseStatus") { + t.Error("generated content should contain 'parseStatus' for enum parsing") + } + + // Verify enum is used in ToLogRecord + if !strings.Contains(content, "String()") { + t.Error("generated content should contain '.String()' for enum conversion") + } + } + } +} + +func TestGenerateFile_WithAllScalarTypes(t *testing.T) { + // Create a file with all scalar types to test type handling + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("scalars.proto"), + Package: new("scalars"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/scalars;scalars"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventWithScalars"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".scalars.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("string_field"), + Number: proto.Int32(2), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("bool_field"), + Number: proto.Int32(3), + Type: descriptorpb.FieldDescriptorProto_TYPE_BOOL.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("int32_field"), + Number: proto.Int32(4), + Type: descriptorpb.FieldDescriptorProto_TYPE_INT32.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("int64_field"), + Number: proto.Int32(5), + Type: descriptorpb.FieldDescriptorProto_TYPE_INT64.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("uint32_field"), + Number: proto.Int32(6), + Type: descriptorpb.FieldDescriptorProto_TYPE_UINT32.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("uint64_field"), + Number: proto.Int32(7), + Type: descriptorpb.FieldDescriptorProto_TYPE_UINT64.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("float_field"), + Number: proto.Int32(8), + Type: descriptorpb.FieldDescriptorProto_TYPE_FLOAT.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("double_field"), + Number: proto.Int32(9), + Type: descriptorpb.FieldDescriptorProto_TYPE_DOUBLE.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("bytes_field"), + Number: proto.Int32(10), + Type: descriptorpb.FieldDescriptorProto_TYPE_BYTES.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"scalars.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + if len(resp.GetFile()) == 0 { + t.Fatal("expected at least one file to be generated") + } + + for _, f := range resp.GetFile() { + if f.Content != nil { + content := f.GetContent() + // Verify different attribute types are used + if !strings.Contains(content, "PutStr") { + t.Error("generated content should contain 'PutStr' for string fields") + } + + if !strings.Contains(content, "PutBool") { + t.Error("generated content should contain 'PutBool' for bool fields") + } + + if !strings.Contains(content, "PutInt") { + t.Error("generated content should contain 'PutInt' for int fields") + } + + if !strings.Contains(content, "PutDouble") { + t.Error("generated content should contain 'PutDouble' for float/double fields") + } + + if !strings.Contains(content, "hex.EncodeToString") { + t.Error("generated content should contain 'hex.EncodeToString' for bytes fields") + } + + // Verify FromLogRecord type conversions + if !strings.Contains(content, "v.Str()") { + t.Error("generated content should contain 'v.Str()' for string parsing") + } + + if !strings.Contains(content, "v.Bool()") { + t.Error("generated content should contain 'v.Bool()' for bool parsing") + } + + if !strings.Contains(content, "v.Int()") { + t.Error("generated content should contain 'v.Int()' for int parsing") + } + + if !strings.Contains(content, "v.Double()") { + t.Error("generated content should contain 'v.Double()' for float/double parsing") + } + + if !strings.Contains(content, "hex.DecodeString") { + t.Error("generated content should contain 'hex.DecodeString' for bytes parsing") + } + } + } +} + +func TestGenerateFile_WithNestedMessage(t *testing.T) { + // Create a file with a nested message field (should generate TODO comment) + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("nested.proto"), + Package: new("nested"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/nested;nested"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("NestedData"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("value"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventWithNestedMessage"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".nested.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + { + Name: new("nested_data"), + Number: proto.Int32(2), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".nested.NestedData"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"nested.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + if len(resp.GetFile()) == 0 { + t.Fatal("expected at least one file to be generated") + } + + for _, f := range resp.GetFile() { + if f.Content != nil { + content := f.GetContent() + // Verify TODO comment for nested message + if !strings.Contains(content, "TODO: handle nested message field") { + t.Error("generated content should contain TODO comment for nested message") + } + } + } +} + +func TestGenerateFile_MultipleEvents(t *testing.T) { + // Create a file with multiple events to test ParseAuditEvent switch + fileDesc := &descriptorpb.FileDescriptorProto{ + Name: new("multi.proto"), + Package: new("multi"), + Syntax: new("proto3"), + Options: &descriptorpb.FileOptions{ + GoPackage: new("example.com/multi;multi"), + }, + MessageType: []*descriptorpb.DescriptorProto{ + { + Name: new("Common"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("timestamp"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_STRING.Enum(), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventA"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".multi.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventB"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".multi.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + { + Name: new("EventC"), + Field: []*descriptorpb.FieldDescriptorProto{ + { + Name: new("common"), + Number: proto.Int32(1), + Type: descriptorpb.FieldDescriptorProto_TYPE_MESSAGE.Enum(), + TypeName: new(".multi.Common"), + Label: descriptorpb.FieldDescriptorProto_LABEL_OPTIONAL.Enum(), + }, + }, + }, + }, + } + + req := createTestRequest([]*descriptorpb.FileDescriptorProto{fileDesc}, []string{"multi.proto"}) + + opts := protogen.Options{} //nolint:exhaustruct_v5 + + gen, err := opts.New(req) + if err != nil { + t.Fatalf("failed to create plugin: %v", err) + } + + gen.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL) | + uint64(pluginpb.CodeGeneratorResponse_FEATURE_SUPPORTS_EDITIONS) + gen.SupportedEditionsMinimum = descriptorpb.Edition_EDITION_2023 + gen.SupportedEditionsMaximum = descriptorpb.Edition_EDITION_2024 + + for _, f := range gen.Files { + if !f.Generate { + continue + } + + generateFile(gen, f) + } + + resp := gen.Response() + + if len(resp.GetFile()) == 0 { + t.Fatal("expected at least one file to be generated") + } + + for _, f := range resp.GetFile() { + if f.Content != nil { + content := f.GetContent() + // Verify ParseAuditEvent switch contains all events + if !strings.Contains(content, `case "EventA":`) { + t.Error("generated content should contain 'case \"EventA\":' in switch") + } + + if !strings.Contains(content, `case "EventB":`) { + t.Error("generated content should contain 'case \"EventB\":' in switch") + } + + if !strings.Contains(content, `case "EventC":`) { + t.Error("generated content should contain 'case \"EventC\":' in switch") + } + + // Verify default case + if !strings.Contains(content, "unknown audit event type") { + t.Error("generated content should contain 'unknown audit event type' in default case") + } + } + } +} diff --git a/go.mod b/go.mod index 3446e29..9b5769c 100644 --- a/go.mod +++ b/go.mod @@ -3,17 +3,25 @@ module github.com/openkcm/api-sdk go 1.26.0 tool ( + github.com/openkcm/api-sdk/cmd/protoc-gen-go-eventbuilders + github.com/openkcm/api-sdk/cmd/protoc-gen-go-otlpconverters 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.12-20260825204119-511051f7f437.2 + go.opentelemetry.io/collector/pdata v1.27.0 google.golang.org/grpc v1.85.0 google.golang.org/protobuf v1.36.12 ) require ( + github.com/gogo/protobuf v1.3.2 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.60.0 // indirect golang.org/x/sys v0.48.0 // indirect golang.org/x/text v0.42.0 // indirect diff --git a/go.sum b/go.sum index bc07c02..043c5ba 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,69 @@ buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.12-20260825204119-511051f7f437.2 h1:NbnlmV26O7oZ1iM5tsCI+GEx+3ZSdrhvnKQ/eWSrLiY= buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.12-20260825204119-511051f7f437.2/go.mod h1:TCt1lluMFnctISJXvkIQ4x3ABrPuUKCWKyjKdkJNBpw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= 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/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +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/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector/pdata v1.27.0 h1:66yI7FYkUDia74h48Fd2/KG2Vk8DxZnGw54wRXykCEU= +go.opentelemetry.io/collector/pdata v1.27.0/go.mod h1:18e8/xDZsqyj00h/5HM5GLdJgBzzG9Ei8g9SpNoiMtI= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 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/rpc v0.0.0-20260817212433-ac3dfec99bb1 h1:utmqiUzZAEINbLmRyAt1QjVkMyLQ+lvIwCpLaB1rZfw= @@ -20,3 +74,5 @@ google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.1 h1:/WILD1UcXj/ujCxgoL/DvRgt 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/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/proto/kms/api/cmk/auditlog/events/v1/events.pb.go b/proto/kms/api/cmk/auditlog/events/v1/events.pb.go new file mode 100644 index 0000000..92c638b --- /dev/null +++ b/proto/kms/api/cmk/auditlog/events/v1/events.pb.go @@ -0,0 +1,5333 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.12 +// protoc v7.36.2 +// source: kms/api/cmk/auditlog/events/v1/events.proto + +package auditlogeventsv1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + unsafe "unsafe" +) + +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) +) + +// Login Methods +type LoginMethod int32 + +const ( + LoginMethod_LOGIN_METHOD_UNSPECIFIED LoginMethod = 0 + LoginMethod_LOGIN_METHOD_BEARER_TOKEN LoginMethod = 1 + LoginMethod_LOGIN_METHOD_OPEN_ID_CONNECT LoginMethod = 2 + LoginMethod_LOGIN_METHOD_X509_CERTIFICATE LoginMethod = 3 +) + +// Enum value maps for LoginMethod. +var ( + LoginMethod_name = map[int32]string{ + 0: "LOGIN_METHOD_UNSPECIFIED", + 1: "LOGIN_METHOD_BEARER_TOKEN", + 2: "LOGIN_METHOD_OPEN_ID_CONNECT", + 3: "LOGIN_METHOD_X509_CERTIFICATE", + } + LoginMethod_value = map[string]int32{ + "LOGIN_METHOD_UNSPECIFIED": 0, + "LOGIN_METHOD_BEARER_TOKEN": 1, + "LOGIN_METHOD_OPEN_ID_CONNECT": 2, + "LOGIN_METHOD_X509_CERTIFICATE": 3, + } +) + +func (x LoginMethod) Enum() *LoginMethod { + p := new(LoginMethod) + *p = x + return p +} + +func (x LoginMethod) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LoginMethod) Descriptor() protoreflect.EnumDescriptor { + return file_kms_api_cmk_auditlog_events_v1_events_proto_enumTypes[0].Descriptor() +} + +func (LoginMethod) Type() protoreflect.EnumType { + return &file_kms_api_cmk_auditlog_events_v1_events_proto_enumTypes[0] +} + +func (x LoginMethod) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Login Failures +type LoginFailure int32 + +const ( + LoginFailure_LOGIN_FAILURE_UNSPECIFIED LoginFailure = 0 + LoginFailure_LOGIN_FAILURE_INVALID_TOKEN LoginFailure = 1 + LoginFailure_LOGIN_FAILURE_INVALID_SESSION LoginFailure = 2 + LoginFailure_LOGIN_FAILURE_INVALID_CERTIFICATE LoginFailure = 3 +) + +// Enum value maps for LoginFailure. +var ( + LoginFailure_name = map[int32]string{ + 0: "LOGIN_FAILURE_UNSPECIFIED", + 1: "LOGIN_FAILURE_INVALID_TOKEN", + 2: "LOGIN_FAILURE_INVALID_SESSION", + 3: "LOGIN_FAILURE_INVALID_CERTIFICATE", + } + LoginFailure_value = map[string]int32{ + "LOGIN_FAILURE_UNSPECIFIED": 0, + "LOGIN_FAILURE_INVALID_TOKEN": 1, + "LOGIN_FAILURE_INVALID_SESSION": 2, + "LOGIN_FAILURE_INVALID_CERTIFICATE": 3, + } +) + +func (x LoginFailure) Enum() *LoginFailure { + p := new(LoginFailure) + *p = x + return p +} + +func (x LoginFailure) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (LoginFailure) Descriptor() protoreflect.EnumDescriptor { + return file_kms_api_cmk_auditlog_events_v1_events_proto_enumTypes[1].Descriptor() +} + +func (LoginFailure) Type() protoreflect.EnumType { + return &file_kms_api_cmk_auditlog_events_v1_events_proto_enumTypes[1] +} + +func (x LoginFailure) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Common fields for all messages +type Common struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp"` + xxx_hidden_Properties map[string]string `protobuf:"bytes,2,rep,name=properties" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + xxx_hidden_TraceId *string `protobuf:"bytes,3,opt,name=trace_id,json=traceId"` + xxx_hidden_SpanId *string `protobuf:"bytes,4,opt,name=span_id,json=spanId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Common) Reset() { + *x = Common{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Common) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Common) ProtoMessage() {} + +func (x *Common) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *Common) GetTimestamp() *timestamppb.Timestamp { + if x != nil { + return x.xxx_hidden_Timestamp + } + return nil +} + +func (x *Common) GetProperties() map[string]string { + if x != nil { + return x.xxx_hidden_Properties + } + return nil +} + +func (x *Common) GetTraceId() string { + if x != nil { + if x.xxx_hidden_TraceId != nil { + return *x.xxx_hidden_TraceId + } + return "" + } + return "" +} + +func (x *Common) GetSpanId() string { + if x != nil { + if x.xxx_hidden_SpanId != nil { + return *x.xxx_hidden_SpanId + } + return "" + } + return "" +} + +func (x *Common) SetTimestamp(v *timestamppb.Timestamp) { + x.xxx_hidden_Timestamp = v +} + +func (x *Common) SetProperties(v map[string]string) { + x.xxx_hidden_Properties = v +} + +func (x *Common) SetTraceId(v string) { + x.xxx_hidden_TraceId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *Common) SetSpanId(v string) { + x.xxx_hidden_SpanId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *Common) HasTimestamp() bool { + if x == nil { + return false + } + return x.xxx_hidden_Timestamp != nil +} + +func (x *Common) HasTraceId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *Common) HasSpanId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *Common) ClearTimestamp() { + x.xxx_hidden_Timestamp = nil +} + +func (x *Common) ClearTraceId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_TraceId = nil +} + +func (x *Common) ClearSpanId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_SpanId = nil +} + +type Common_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + // Timestamp of the event + Timestamp *timestamppb.Timestamp + // Properties map + Properties map[string]string + // The trace-id (32 lowercase hex characters, e.g., "4bf92f3577b34da6a3ce929d0e0e4736") + TraceId *string + // The span-id (16 lowercase hex characters, e.g., "00f067aa0ba902b7") + SpanId *string +} + +func (b0 Common_builder) Build() *Common { + m0 := &Common{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Timestamp = b.Timestamp + x.xxx_hidden_Properties = b.Properties + if b.TraceId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_TraceId = b.TraceId + } + if b.SpanId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_SpanId = b.SpanId + } + return m0 +} + +// Login succeeded +type LoginSucceeded struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_UserId *string `protobuf:"bytes,2,opt,name=user_id,json=userId"` + xxx_hidden_Method LoginMethod `protobuf:"varint,3,opt,name=method,enum=kms.api.cmk.auditlog.events.v1.LoginMethod"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoginSucceeded) Reset() { + *x = LoginSucceeded{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginSucceeded) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginSucceeded) ProtoMessage() {} + +func (x *LoginSucceeded) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *LoginSucceeded) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *LoginSucceeded) GetUserId() string { + if x != nil { + if x.xxx_hidden_UserId != nil { + return *x.xxx_hidden_UserId + } + return "" + } + return "" +} + +func (x *LoginSucceeded) GetMethod() LoginMethod { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 2) { + return x.xxx_hidden_Method + } + } + return LoginMethod_LOGIN_METHOD_UNSPECIFIED +} + +func (x *LoginSucceeded) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *LoginSucceeded) SetUserId(v string) { + x.xxx_hidden_UserId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *LoginSucceeded) SetMethod(v LoginMethod) { + x.xxx_hidden_Method = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *LoginSucceeded) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *LoginSucceeded) HasUserId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *LoginSucceeded) HasMethod() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *LoginSucceeded) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *LoginSucceeded) ClearUserId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_UserId = nil +} + +func (x *LoginSucceeded) ClearMethod() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Method = LoginMethod_LOGIN_METHOD_UNSPECIFIED +} + +type LoginSucceeded_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + UserId *string + Method *LoginMethod +} + +func (b0 LoginSucceeded_builder) Build() *LoginSucceeded { + m0 := &LoginSucceeded{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.UserId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_UserId = b.UserId + } + if b.Method != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_Method = *b.Method + } + return m0 +} + +// Login failed +type LoginFailed struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_UserId *string `protobuf:"bytes,2,opt,name=user_id,json=userId"` + xxx_hidden_Method LoginMethod `protobuf:"varint,3,opt,name=method,enum=kms.api.cmk.auditlog.events.v1.LoginMethod"` + xxx_hidden_Failure LoginFailure `protobuf:"varint,4,opt,name=failure,enum=kms.api.cmk.auditlog.events.v1.LoginFailure"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoginFailed) Reset() { + *x = LoginFailed{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoginFailed) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoginFailed) ProtoMessage() {} + +func (x *LoginFailed) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *LoginFailed) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *LoginFailed) GetUserId() string { + if x != nil { + if x.xxx_hidden_UserId != nil { + return *x.xxx_hidden_UserId + } + return "" + } + return "" +} + +func (x *LoginFailed) GetMethod() LoginMethod { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 2) { + return x.xxx_hidden_Method + } + } + return LoginMethod_LOGIN_METHOD_UNSPECIFIED +} + +func (x *LoginFailed) GetFailure() LoginFailure { + if x != nil { + if protoimpl.X.Present(&(x.XXX_presence[0]), 3) { + return x.xxx_hidden_Failure + } + } + return LoginFailure_LOGIN_FAILURE_UNSPECIFIED +} + +func (x *LoginFailed) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *LoginFailed) SetUserId(v string) { + x.xxx_hidden_UserId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *LoginFailed) SetMethod(v LoginMethod) { + x.xxx_hidden_Method = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *LoginFailed) SetFailure(v LoginFailure) { + x.xxx_hidden_Failure = v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *LoginFailed) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *LoginFailed) HasUserId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *LoginFailed) HasMethod() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *LoginFailed) HasFailure() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *LoginFailed) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *LoginFailed) ClearUserId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_UserId = nil +} + +func (x *LoginFailed) ClearMethod() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Method = LoginMethod_LOGIN_METHOD_UNSPECIFIED +} + +func (x *LoginFailed) ClearFailure() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_Failure = LoginFailure_LOGIN_FAILURE_UNSPECIFIED +} + +type LoginFailed_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + UserId *string + Method *LoginMethod + Failure *LoginFailure +} + +func (b0 LoginFailed_builder) Build() *LoginFailed { + m0 := &LoginFailed{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.UserId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_UserId = b.UserId + } + if b.Method != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_Method = *b.Method + } + if b.Failure != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_Failure = *b.Failure + } + return m0 +} + +// Unauthenticated request (HTTP 401) +type UnauthenticatedRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_UserId *string `protobuf:"bytes,2,opt,name=user_id,json=userId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnauthenticatedRequest) Reset() { + *x = UnauthenticatedRequest{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnauthenticatedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnauthenticatedRequest) ProtoMessage() {} + +func (x *UnauthenticatedRequest) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *UnauthenticatedRequest) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *UnauthenticatedRequest) GetUserId() string { + if x != nil { + if x.xxx_hidden_UserId != nil { + return *x.xxx_hidden_UserId + } + return "" + } + return "" +} + +func (x *UnauthenticatedRequest) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *UnauthenticatedRequest) SetUserId(v string) { + x.xxx_hidden_UserId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *UnauthenticatedRequest) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *UnauthenticatedRequest) HasUserId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *UnauthenticatedRequest) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *UnauthenticatedRequest) ClearUserId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_UserId = nil +} + +type UnauthenticatedRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + UserId *string +} + +func (b0 UnauthenticatedRequest_builder) Build() *UnauthenticatedRequest { + m0 := &UnauthenticatedRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.UserId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_UserId = b.UserId + } + return m0 +} + +// Unauthorized request (HTTP 403) +type UnauthorizedRequest struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_UserId *string `protobuf:"bytes,2,opt,name=user_id,json=userId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnauthorizedRequest) Reset() { + *x = UnauthorizedRequest{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnauthorizedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnauthorizedRequest) ProtoMessage() {} + +func (x *UnauthorizedRequest) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *UnauthorizedRequest) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *UnauthorizedRequest) GetUserId() string { + if x != nil { + if x.xxx_hidden_UserId != nil { + return *x.xxx_hidden_UserId + } + return "" + } + return "" +} + +func (x *UnauthorizedRequest) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *UnauthorizedRequest) SetUserId(v string) { + x.xxx_hidden_UserId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *UnauthorizedRequest) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *UnauthorizedRequest) HasUserId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *UnauthorizedRequest) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *UnauthorizedRequest) ClearUserId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_UserId = nil +} + +type UnauthorizedRequest_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + UserId *string +} + +func (b0 UnauthorizedRequest_builder) Build() *UnauthorizedRequest { + m0 := &UnauthorizedRequest{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.UserId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_UserId = b.UserId + } + return m0 +} + +// Access granted +type AccessGranted struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_Resource *string `protobuf:"bytes,2,opt,name=resource"` + xxx_hidden_Action *string `protobuf:"bytes,3,opt,name=action"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AccessGranted) Reset() { + *x = AccessGranted{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AccessGranted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AccessGranted) ProtoMessage() {} + +func (x *AccessGranted) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *AccessGranted) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *AccessGranted) GetResource() string { + if x != nil { + if x.xxx_hidden_Resource != nil { + return *x.xxx_hidden_Resource + } + return "" + } + return "" +} + +func (x *AccessGranted) GetAction() string { + if x != nil { + if x.xxx_hidden_Action != nil { + return *x.xxx_hidden_Action + } + return "" + } + return "" +} + +func (x *AccessGranted) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *AccessGranted) SetResource(v string) { + x.xxx_hidden_Resource = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *AccessGranted) SetAction(v string) { + x.xxx_hidden_Action = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *AccessGranted) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *AccessGranted) HasResource() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *AccessGranted) HasAction() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *AccessGranted) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *AccessGranted) ClearResource() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_Resource = nil +} + +func (x *AccessGranted) ClearAction() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_Action = nil +} + +type AccessGranted_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + Resource *string + Action *string +} + +func (b0 AccessGranted_builder) Build() *AccessGranted { + m0 := &AccessGranted{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.Resource != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_Resource = b.Resource + } + if b.Action != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_Action = b.Action + } + return m0 +} + +// Tenant created +type TenantCreated struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TenantCreated) Reset() { + *x = TenantCreated{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TenantCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TenantCreated) ProtoMessage() {} + +func (x *TenantCreated) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *TenantCreated) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *TenantCreated) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *TenantCreated) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *TenantCreated) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *TenantCreated) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *TenantCreated) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *TenantCreated) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *TenantCreated) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +type TenantCreated_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string +} + +func (b0 TenantCreated_builder) Build() *TenantCreated { + m0 := &TenantCreated{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_TenantId = b.TenantId + } + return m0 +} + +// Tenant updated +type TenantUpdated struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_PropertyName *string `protobuf:"bytes,3,opt,name=property_name,json=propertyName"` + xxx_hidden_OldValue *string `protobuf:"bytes,4,opt,name=old_value,json=oldValue"` + xxx_hidden_NewValue *string `protobuf:"bytes,5,opt,name=new_value,json=newValue"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TenantUpdated) Reset() { + *x = TenantUpdated{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TenantUpdated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TenantUpdated) ProtoMessage() {} + +func (x *TenantUpdated) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *TenantUpdated) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *TenantUpdated) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *TenantUpdated) GetPropertyName() string { + if x != nil { + if x.xxx_hidden_PropertyName != nil { + return *x.xxx_hidden_PropertyName + } + return "" + } + return "" +} + +func (x *TenantUpdated) GetOldValue() string { + if x != nil { + if x.xxx_hidden_OldValue != nil { + return *x.xxx_hidden_OldValue + } + return "" + } + return "" +} + +func (x *TenantUpdated) GetNewValue() string { + if x != nil { + if x.xxx_hidden_NewValue != nil { + return *x.xxx_hidden_NewValue + } + return "" + } + return "" +} + +func (x *TenantUpdated) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *TenantUpdated) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 5) +} + +func (x *TenantUpdated) SetPropertyName(v string) { + x.xxx_hidden_PropertyName = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 5) +} + +func (x *TenantUpdated) SetOldValue(v string) { + x.xxx_hidden_OldValue = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 5) +} + +func (x *TenantUpdated) SetNewValue(v string) { + x.xxx_hidden_NewValue = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 5) +} + +func (x *TenantUpdated) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *TenantUpdated) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *TenantUpdated) HasPropertyName() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *TenantUpdated) HasOldValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *TenantUpdated) HasNewValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *TenantUpdated) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *TenantUpdated) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *TenantUpdated) ClearPropertyName() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_PropertyName = nil +} + +func (x *TenantUpdated) ClearOldValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_OldValue = nil +} + +func (x *TenantUpdated) ClearNewValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_NewValue = nil +} + +type TenantUpdated_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + PropertyName *string + OldValue *string + NewValue *string +} + +func (b0 TenantUpdated_builder) Build() *TenantUpdated { + m0 := &TenantUpdated{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 5) + x.xxx_hidden_TenantId = b.TenantId + } + if b.PropertyName != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 5) + x.xxx_hidden_PropertyName = b.PropertyName + } + if b.OldValue != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 5) + x.xxx_hidden_OldValue = b.OldValue + } + if b.NewValue != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 5) + x.xxx_hidden_NewValue = b.NewValue + } + return m0 +} + +// Tenant deleted +type TenantDeleted struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TenantDeleted) Reset() { + *x = TenantDeleted{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TenantDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TenantDeleted) ProtoMessage() {} + +func (x *TenantDeleted) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *TenantDeleted) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *TenantDeleted) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *TenantDeleted) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *TenantDeleted) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 2) +} + +func (x *TenantDeleted) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *TenantDeleted) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *TenantDeleted) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *TenantDeleted) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +type TenantDeleted_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string +} + +func (b0 TenantDeleted_builder) Build() *TenantDeleted { + m0 := &TenantDeleted{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 2) + x.xxx_hidden_TenantId = b.TenantId + } + return m0 +} + +// CMK got created +type CMKCreated struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkId *string `protobuf:"bytes,3,opt,name=cmk_id,json=cmkId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CMKCreated) Reset() { + *x = CMKCreated{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CMKCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CMKCreated) ProtoMessage() {} + +func (x *CMKCreated) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *CMKCreated) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *CMKCreated) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *CMKCreated) GetCmkId() string { + if x != nil { + if x.xxx_hidden_CmkId != nil { + return *x.xxx_hidden_CmkId + } + return "" + } + return "" +} + +func (x *CMKCreated) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *CMKCreated) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *CMKCreated) SetCmkId(v string) { + x.xxx_hidden_CmkId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *CMKCreated) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *CMKCreated) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CMKCreated) HasCmkId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *CMKCreated) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *CMKCreated) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *CMKCreated) ClearCmkId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_CmkId = nil +} + +type CMKCreated_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + CmkId *string +} + +func (b0 CMKCreated_builder) Build() *CMKCreated { + m0 := &CMKCreated{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_CmkId = b.CmkId + } + return m0 +} + +// CMK got rotated +type CMKRotated struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkId *string `protobuf:"bytes,3,opt,name=cmk_id,json=cmkId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CMKRotated) Reset() { + *x = CMKRotated{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CMKRotated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CMKRotated) ProtoMessage() {} + +func (x *CMKRotated) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *CMKRotated) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *CMKRotated) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *CMKRotated) GetCmkId() string { + if x != nil { + if x.xxx_hidden_CmkId != nil { + return *x.xxx_hidden_CmkId + } + return "" + } + return "" +} + +func (x *CMKRotated) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *CMKRotated) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *CMKRotated) SetCmkId(v string) { + x.xxx_hidden_CmkId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *CMKRotated) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *CMKRotated) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CMKRotated) HasCmkId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *CMKRotated) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *CMKRotated) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *CMKRotated) ClearCmkId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_CmkId = nil +} + +type CMKRotated_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + CmkId *string +} + +func (b0 CMKRotated_builder) Build() *CMKRotated { + m0 := &CMKRotated{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_CmkId = b.CmkId + } + return m0 +} + +// CMK has become unavailable +type CMKUnavailable struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkId *string `protobuf:"bytes,3,opt,name=cmk_id,json=cmkId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CMKUnavailable) Reset() { + *x = CMKUnavailable{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CMKUnavailable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CMKUnavailable) ProtoMessage() {} + +func (x *CMKUnavailable) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *CMKUnavailable) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *CMKUnavailable) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *CMKUnavailable) GetCmkId() string { + if x != nil { + if x.xxx_hidden_CmkId != nil { + return *x.xxx_hidden_CmkId + } + return "" + } + return "" +} + +func (x *CMKUnavailable) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *CMKUnavailable) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *CMKUnavailable) SetCmkId(v string) { + x.xxx_hidden_CmkId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *CMKUnavailable) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *CMKUnavailable) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CMKUnavailable) HasCmkId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *CMKUnavailable) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *CMKUnavailable) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *CMKUnavailable) ClearCmkId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_CmkId = nil +} + +type CMKUnavailable_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + CmkId *string +} + +func (b0 CMKUnavailable_builder) Build() *CMKUnavailable { + m0 := &CMKUnavailable{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_CmkId = b.CmkId + } + return m0 +} + +// CMK has become available +type CMKAvailable struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkId *string `protobuf:"bytes,3,opt,name=cmk_id,json=cmkId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CMKAvailable) Reset() { + *x = CMKAvailable{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CMKAvailable) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CMKAvailable) ProtoMessage() {} + +func (x *CMKAvailable) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *CMKAvailable) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *CMKAvailable) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *CMKAvailable) GetCmkId() string { + if x != nil { + if x.xxx_hidden_CmkId != nil { + return *x.xxx_hidden_CmkId + } + return "" + } + return "" +} + +func (x *CMKAvailable) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *CMKAvailable) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *CMKAvailable) SetCmkId(v string) { + x.xxx_hidden_CmkId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *CMKAvailable) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *CMKAvailable) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CMKAvailable) HasCmkId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *CMKAvailable) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *CMKAvailable) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *CMKAvailable) ClearCmkId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_CmkId = nil +} + +type CMKAvailable_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + CmkId *string +} + +func (b0 CMKAvailable_builder) Build() *CMKAvailable { + m0 := &CMKAvailable{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_CmkId = b.CmkId + } + return m0 +} + +// CMK got disabled +type CMKDisabled struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkId *string `protobuf:"bytes,3,opt,name=cmk_id,json=cmkId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CMKDisabled) Reset() { + *x = CMKDisabled{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CMKDisabled) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CMKDisabled) ProtoMessage() {} + +func (x *CMKDisabled) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *CMKDisabled) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *CMKDisabled) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *CMKDisabled) GetCmkId() string { + if x != nil { + if x.xxx_hidden_CmkId != nil { + return *x.xxx_hidden_CmkId + } + return "" + } + return "" +} + +func (x *CMKDisabled) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *CMKDisabled) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *CMKDisabled) SetCmkId(v string) { + x.xxx_hidden_CmkId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *CMKDisabled) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *CMKDisabled) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CMKDisabled) HasCmkId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *CMKDisabled) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *CMKDisabled) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *CMKDisabled) ClearCmkId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_CmkId = nil +} + +type CMKDisabled_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + CmkId *string +} + +func (b0 CMKDisabled_builder) Build() *CMKDisabled { + m0 := &CMKDisabled{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_CmkId = b.CmkId + } + return m0 +} + +// CMK got enabled +type CMKEnabled struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkId *string `protobuf:"bytes,3,opt,name=cmk_id,json=cmkId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CMKEnabled) Reset() { + *x = CMKEnabled{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CMKEnabled) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CMKEnabled) ProtoMessage() {} + +func (x *CMKEnabled) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *CMKEnabled) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *CMKEnabled) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *CMKEnabled) GetCmkId() string { + if x != nil { + if x.xxx_hidden_CmkId != nil { + return *x.xxx_hidden_CmkId + } + return "" + } + return "" +} + +func (x *CMKEnabled) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *CMKEnabled) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *CMKEnabled) SetCmkId(v string) { + x.xxx_hidden_CmkId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *CMKEnabled) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *CMKEnabled) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CMKEnabled) HasCmkId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *CMKEnabled) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *CMKEnabled) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *CMKEnabled) ClearCmkId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_CmkId = nil +} + +type CMKEnabled_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + CmkId *string +} + +func (b0 CMKEnabled_builder) Build() *CMKEnabled { + m0 := &CMKEnabled{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_CmkId = b.CmkId + } + return m0 +} + +// CMK got deleted +type CMKDeleted struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkId *string `protobuf:"bytes,3,opt,name=cmk_id,json=cmkId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CMKDeleted) Reset() { + *x = CMKDeleted{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CMKDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CMKDeleted) ProtoMessage() {} + +func (x *CMKDeleted) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *CMKDeleted) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *CMKDeleted) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *CMKDeleted) GetCmkId() string { + if x != nil { + if x.xxx_hidden_CmkId != nil { + return *x.xxx_hidden_CmkId + } + return "" + } + return "" +} + +func (x *CMKDeleted) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *CMKDeleted) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 3) +} + +func (x *CMKDeleted) SetCmkId(v string) { + x.xxx_hidden_CmkId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 3) +} + +func (x *CMKDeleted) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *CMKDeleted) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *CMKDeleted) HasCmkId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *CMKDeleted) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *CMKDeleted) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *CMKDeleted) ClearCmkId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_CmkId = nil +} + +type CMKDeleted_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + CmkId *string +} + +func (b0 CMKDeleted_builder) Build() *CMKDeleted { + m0 := &CMKDeleted{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 3) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 3) + x.xxx_hidden_CmkId = b.CmkId + } + return m0 +} + +// System onboarded to CMK +type SystemOnboarded struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_SystemId *string `protobuf:"bytes,2,opt,name=system_id,json=systemId"` + xxx_hidden_TenantId *string `protobuf:"bytes,3,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkId *string `protobuf:"bytes,4,opt,name=cmk_id,json=cmkId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SystemOnboarded) Reset() { + *x = SystemOnboarded{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SystemOnboarded) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemOnboarded) ProtoMessage() {} + +func (x *SystemOnboarded) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *SystemOnboarded) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *SystemOnboarded) GetSystemId() string { + if x != nil { + if x.xxx_hidden_SystemId != nil { + return *x.xxx_hidden_SystemId + } + return "" + } + return "" +} + +func (x *SystemOnboarded) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *SystemOnboarded) GetCmkId() string { + if x != nil { + if x.xxx_hidden_CmkId != nil { + return *x.xxx_hidden_CmkId + } + return "" + } + return "" +} + +func (x *SystemOnboarded) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *SystemOnboarded) SetSystemId(v string) { + x.xxx_hidden_SystemId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *SystemOnboarded) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *SystemOnboarded) SetCmkId(v string) { + x.xxx_hidden_CmkId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *SystemOnboarded) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *SystemOnboarded) HasSystemId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *SystemOnboarded) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *SystemOnboarded) HasCmkId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *SystemOnboarded) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *SystemOnboarded) ClearSystemId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_SystemId = nil +} + +func (x *SystemOnboarded) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_TenantId = nil +} + +func (x *SystemOnboarded) ClearCmkId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_CmkId = nil +} + +type SystemOnboarded_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + SystemId *string + TenantId *string + CmkId *string +} + +func (b0 SystemOnboarded_builder) Build() *SystemOnboarded { + m0 := &SystemOnboarded{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.SystemId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_SystemId = b.SystemId + } + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_CmkId = b.CmkId + } + return m0 +} + +// System switched CMK +type SystemSwitched struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_SystemId *string `protobuf:"bytes,2,opt,name=system_id,json=systemId"` + xxx_hidden_TenantId *string `protobuf:"bytes,3,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkIdOld *string `protobuf:"bytes,4,opt,name=cmk_id_old,json=cmkIdOld"` + xxx_hidden_CmkIdNew *string `protobuf:"bytes,5,opt,name=cmk_id_new,json=cmkIdNew"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SystemSwitched) Reset() { + *x = SystemSwitched{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SystemSwitched) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemSwitched) ProtoMessage() {} + +func (x *SystemSwitched) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *SystemSwitched) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *SystemSwitched) GetSystemId() string { + if x != nil { + if x.xxx_hidden_SystemId != nil { + return *x.xxx_hidden_SystemId + } + return "" + } + return "" +} + +func (x *SystemSwitched) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *SystemSwitched) GetCmkIdOld() string { + if x != nil { + if x.xxx_hidden_CmkIdOld != nil { + return *x.xxx_hidden_CmkIdOld + } + return "" + } + return "" +} + +func (x *SystemSwitched) GetCmkIdNew() string { + if x != nil { + if x.xxx_hidden_CmkIdNew != nil { + return *x.xxx_hidden_CmkIdNew + } + return "" + } + return "" +} + +func (x *SystemSwitched) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *SystemSwitched) SetSystemId(v string) { + x.xxx_hidden_SystemId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 5) +} + +func (x *SystemSwitched) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 5) +} + +func (x *SystemSwitched) SetCmkIdOld(v string) { + x.xxx_hidden_CmkIdOld = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 5) +} + +func (x *SystemSwitched) SetCmkIdNew(v string) { + x.xxx_hidden_CmkIdNew = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 5) +} + +func (x *SystemSwitched) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *SystemSwitched) HasSystemId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *SystemSwitched) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *SystemSwitched) HasCmkIdOld() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *SystemSwitched) HasCmkIdNew() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *SystemSwitched) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *SystemSwitched) ClearSystemId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_SystemId = nil +} + +func (x *SystemSwitched) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_TenantId = nil +} + +func (x *SystemSwitched) ClearCmkIdOld() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_CmkIdOld = nil +} + +func (x *SystemSwitched) ClearCmkIdNew() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_CmkIdNew = nil +} + +type SystemSwitched_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + SystemId *string + TenantId *string + CmkIdOld *string + CmkIdNew *string +} + +func (b0 SystemSwitched_builder) Build() *SystemSwitched { + m0 := &SystemSwitched{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.SystemId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 5) + x.xxx_hidden_SystemId = b.SystemId + } + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 5) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkIdOld != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 5) + x.xxx_hidden_CmkIdOld = b.CmkIdOld + } + if b.CmkIdNew != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 5) + x.xxx_hidden_CmkIdNew = b.CmkIdNew + } + return m0 +} + +// System offboarded from CMK +type SystemOffboarded struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_SystemId *string `protobuf:"bytes,2,opt,name=system_id,json=systemId"` + xxx_hidden_TenantId *string `protobuf:"bytes,3,opt,name=tenant_id,json=tenantId"` + xxx_hidden_CmkId *string `protobuf:"bytes,4,opt,name=cmk_id,json=cmkId"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SystemOffboarded) Reset() { + *x = SystemOffboarded{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SystemOffboarded) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SystemOffboarded) ProtoMessage() {} + +func (x *SystemOffboarded) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *SystemOffboarded) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *SystemOffboarded) GetSystemId() string { + if x != nil { + if x.xxx_hidden_SystemId != nil { + return *x.xxx_hidden_SystemId + } + return "" + } + return "" +} + +func (x *SystemOffboarded) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *SystemOffboarded) GetCmkId() string { + if x != nil { + if x.xxx_hidden_CmkId != nil { + return *x.xxx_hidden_CmkId + } + return "" + } + return "" +} + +func (x *SystemOffboarded) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *SystemOffboarded) SetSystemId(v string) { + x.xxx_hidden_SystemId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 4) +} + +func (x *SystemOffboarded) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 4) +} + +func (x *SystemOffboarded) SetCmkId(v string) { + x.xxx_hidden_CmkId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 4) +} + +func (x *SystemOffboarded) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *SystemOffboarded) HasSystemId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *SystemOffboarded) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *SystemOffboarded) HasCmkId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *SystemOffboarded) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *SystemOffboarded) ClearSystemId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_SystemId = nil +} + +func (x *SystemOffboarded) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_TenantId = nil +} + +func (x *SystemOffboarded) ClearCmkId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_CmkId = nil +} + +type SystemOffboarded_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + SystemId *string + TenantId *string + CmkId *string +} + +func (b0 SystemOffboarded_builder) Build() *SystemOffboarded { + m0 := &SystemOffboarded{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.SystemId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 4) + x.xxx_hidden_SystemId = b.SystemId + } + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 4) + x.xxx_hidden_TenantId = b.TenantId + } + if b.CmkId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 4) + x.xxx_hidden_CmkId = b.CmkId + } + return m0 +} + +// Data created +type DataCreated struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_ObjectType *string `protobuf:"bytes,3,opt,name=object_type,json=objectType"` + xxx_hidden_ObjectId *string `protobuf:"bytes,4,opt,name=object_id,json=objectId"` + xxx_hidden_Attribute *string `protobuf:"bytes,5,opt,name=attribute"` + xxx_hidden_Value *string `protobuf:"bytes,6,opt,name=value"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DataCreated) Reset() { + *x = DataCreated{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataCreated) ProtoMessage() {} + +func (x *DataCreated) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *DataCreated) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *DataCreated) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *DataCreated) GetObjectType() string { + if x != nil { + if x.xxx_hidden_ObjectType != nil { + return *x.xxx_hidden_ObjectType + } + return "" + } + return "" +} + +func (x *DataCreated) GetObjectId() string { + if x != nil { + if x.xxx_hidden_ObjectId != nil { + return *x.xxx_hidden_ObjectId + } + return "" + } + return "" +} + +func (x *DataCreated) GetAttribute() string { + if x != nil { + if x.xxx_hidden_Attribute != nil { + return *x.xxx_hidden_Attribute + } + return "" + } + return "" +} + +func (x *DataCreated) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *DataCreated) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *DataCreated) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 6) +} + +func (x *DataCreated) SetObjectType(v string) { + x.xxx_hidden_ObjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 6) +} + +func (x *DataCreated) SetObjectId(v string) { + x.xxx_hidden_ObjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 6) +} + +func (x *DataCreated) SetAttribute(v string) { + x.xxx_hidden_Attribute = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 6) +} + +func (x *DataCreated) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 6) +} + +func (x *DataCreated) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *DataCreated) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *DataCreated) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *DataCreated) HasObjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *DataCreated) HasAttribute() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *DataCreated) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *DataCreated) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *DataCreated) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *DataCreated) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_ObjectType = nil +} + +func (x *DataCreated) ClearObjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_ObjectId = nil +} + +func (x *DataCreated) ClearAttribute() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Attribute = nil +} + +func (x *DataCreated) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_Value = nil +} + +type DataCreated_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + ObjectType *string + ObjectId *string + Attribute *string + Value *string +} + +func (b0 DataCreated_builder) Build() *DataCreated { + m0 := &DataCreated{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 6) + x.xxx_hidden_TenantId = b.TenantId + } + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 6) + x.xxx_hidden_ObjectType = b.ObjectType + } + if b.ObjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 6) + x.xxx_hidden_ObjectId = b.ObjectId + } + if b.Attribute != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 6) + x.xxx_hidden_Attribute = b.Attribute + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 6) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// Data read +type DataRead struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_ObjectType *string `protobuf:"bytes,3,opt,name=object_type,json=objectType"` + xxx_hidden_ObjectId *string `protobuf:"bytes,4,opt,name=object_id,json=objectId"` + xxx_hidden_Attribute *string `protobuf:"bytes,5,opt,name=attribute"` + xxx_hidden_Value *string `protobuf:"bytes,6,opt,name=value"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DataRead) Reset() { + *x = DataRead{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataRead) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataRead) ProtoMessage() {} + +func (x *DataRead) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *DataRead) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *DataRead) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *DataRead) GetObjectType() string { + if x != nil { + if x.xxx_hidden_ObjectType != nil { + return *x.xxx_hidden_ObjectType + } + return "" + } + return "" +} + +func (x *DataRead) GetObjectId() string { + if x != nil { + if x.xxx_hidden_ObjectId != nil { + return *x.xxx_hidden_ObjectId + } + return "" + } + return "" +} + +func (x *DataRead) GetAttribute() string { + if x != nil { + if x.xxx_hidden_Attribute != nil { + return *x.xxx_hidden_Attribute + } + return "" + } + return "" +} + +func (x *DataRead) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *DataRead) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *DataRead) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 6) +} + +func (x *DataRead) SetObjectType(v string) { + x.xxx_hidden_ObjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 6) +} + +func (x *DataRead) SetObjectId(v string) { + x.xxx_hidden_ObjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 6) +} + +func (x *DataRead) SetAttribute(v string) { + x.xxx_hidden_Attribute = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 6) +} + +func (x *DataRead) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 6) +} + +func (x *DataRead) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *DataRead) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *DataRead) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *DataRead) HasObjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *DataRead) HasAttribute() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *DataRead) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *DataRead) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *DataRead) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *DataRead) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_ObjectType = nil +} + +func (x *DataRead) ClearObjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_ObjectId = nil +} + +func (x *DataRead) ClearAttribute() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Attribute = nil +} + +func (x *DataRead) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_Value = nil +} + +type DataRead_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + ObjectType *string + ObjectId *string + Attribute *string + Value *string +} + +func (b0 DataRead_builder) Build() *DataRead { + m0 := &DataRead{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 6) + x.xxx_hidden_TenantId = b.TenantId + } + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 6) + x.xxx_hidden_ObjectType = b.ObjectType + } + if b.ObjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 6) + x.xxx_hidden_ObjectId = b.ObjectId + } + if b.Attribute != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 6) + x.xxx_hidden_Attribute = b.Attribute + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 6) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// Data updated +type DataUpdated struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_ObjectType *string `protobuf:"bytes,3,opt,name=object_type,json=objectType"` + xxx_hidden_ObjectId *string `protobuf:"bytes,4,opt,name=object_id,json=objectId"` + xxx_hidden_Attribute *string `protobuf:"bytes,5,opt,name=attribute"` + xxx_hidden_OldValue *string `protobuf:"bytes,6,opt,name=old_value,json=oldValue"` + xxx_hidden_NewValue *string `protobuf:"bytes,7,opt,name=new_value,json=newValue"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DataUpdated) Reset() { + *x = DataUpdated{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataUpdated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataUpdated) ProtoMessage() {} + +func (x *DataUpdated) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *DataUpdated) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *DataUpdated) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *DataUpdated) GetObjectType() string { + if x != nil { + if x.xxx_hidden_ObjectType != nil { + return *x.xxx_hidden_ObjectType + } + return "" + } + return "" +} + +func (x *DataUpdated) GetObjectId() string { + if x != nil { + if x.xxx_hidden_ObjectId != nil { + return *x.xxx_hidden_ObjectId + } + return "" + } + return "" +} + +func (x *DataUpdated) GetAttribute() string { + if x != nil { + if x.xxx_hidden_Attribute != nil { + return *x.xxx_hidden_Attribute + } + return "" + } + return "" +} + +func (x *DataUpdated) GetOldValue() string { + if x != nil { + if x.xxx_hidden_OldValue != nil { + return *x.xxx_hidden_OldValue + } + return "" + } + return "" +} + +func (x *DataUpdated) GetNewValue() string { + if x != nil { + if x.xxx_hidden_NewValue != nil { + return *x.xxx_hidden_NewValue + } + return "" + } + return "" +} + +func (x *DataUpdated) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *DataUpdated) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 7) +} + +func (x *DataUpdated) SetObjectType(v string) { + x.xxx_hidden_ObjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 7) +} + +func (x *DataUpdated) SetObjectId(v string) { + x.xxx_hidden_ObjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 7) +} + +func (x *DataUpdated) SetAttribute(v string) { + x.xxx_hidden_Attribute = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 7) +} + +func (x *DataUpdated) SetOldValue(v string) { + x.xxx_hidden_OldValue = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 7) +} + +func (x *DataUpdated) SetNewValue(v string) { + x.xxx_hidden_NewValue = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 6, 7) +} + +func (x *DataUpdated) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *DataUpdated) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *DataUpdated) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *DataUpdated) HasObjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *DataUpdated) HasAttribute() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *DataUpdated) HasOldValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *DataUpdated) HasNewValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 6) +} + +func (x *DataUpdated) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *DataUpdated) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *DataUpdated) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_ObjectType = nil +} + +func (x *DataUpdated) ClearObjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_ObjectId = nil +} + +func (x *DataUpdated) ClearAttribute() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Attribute = nil +} + +func (x *DataUpdated) ClearOldValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_OldValue = nil +} + +func (x *DataUpdated) ClearNewValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 6) + x.xxx_hidden_NewValue = nil +} + +type DataUpdated_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + ObjectType *string + ObjectId *string + Attribute *string + OldValue *string + NewValue *string +} + +func (b0 DataUpdated_builder) Build() *DataUpdated { + m0 := &DataUpdated{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 7) + x.xxx_hidden_TenantId = b.TenantId + } + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 7) + x.xxx_hidden_ObjectType = b.ObjectType + } + if b.ObjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 7) + x.xxx_hidden_ObjectId = b.ObjectId + } + if b.Attribute != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 7) + x.xxx_hidden_Attribute = b.Attribute + } + if b.OldValue != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 7) + x.xxx_hidden_OldValue = b.OldValue + } + if b.NewValue != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 6, 7) + x.xxx_hidden_NewValue = b.NewValue + } + return m0 +} + +// Data deleted +type DataDeleted struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_ObjectType *string `protobuf:"bytes,3,opt,name=object_type,json=objectType"` + xxx_hidden_ObjectId *string `protobuf:"bytes,4,opt,name=object_id,json=objectId"` + xxx_hidden_Attribute *string `protobuf:"bytes,5,opt,name=attribute"` + xxx_hidden_Value *string `protobuf:"bytes,6,opt,name=value"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DataDeleted) Reset() { + *x = DataDeleted{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataDeleted) ProtoMessage() {} + +func (x *DataDeleted) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *DataDeleted) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *DataDeleted) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *DataDeleted) GetObjectType() string { + if x != nil { + if x.xxx_hidden_ObjectType != nil { + return *x.xxx_hidden_ObjectType + } + return "" + } + return "" +} + +func (x *DataDeleted) GetObjectId() string { + if x != nil { + if x.xxx_hidden_ObjectId != nil { + return *x.xxx_hidden_ObjectId + } + return "" + } + return "" +} + +func (x *DataDeleted) GetAttribute() string { + if x != nil { + if x.xxx_hidden_Attribute != nil { + return *x.xxx_hidden_Attribute + } + return "" + } + return "" +} + +func (x *DataDeleted) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *DataDeleted) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *DataDeleted) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 6) +} + +func (x *DataDeleted) SetObjectType(v string) { + x.xxx_hidden_ObjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 6) +} + +func (x *DataDeleted) SetObjectId(v string) { + x.xxx_hidden_ObjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 6) +} + +func (x *DataDeleted) SetAttribute(v string) { + x.xxx_hidden_Attribute = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 6) +} + +func (x *DataDeleted) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 6) +} + +func (x *DataDeleted) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *DataDeleted) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *DataDeleted) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *DataDeleted) HasObjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *DataDeleted) HasAttribute() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *DataDeleted) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *DataDeleted) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *DataDeleted) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *DataDeleted) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_ObjectType = nil +} + +func (x *DataDeleted) ClearObjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_ObjectId = nil +} + +func (x *DataDeleted) ClearAttribute() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_Attribute = nil +} + +func (x *DataDeleted) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_Value = nil +} + +type DataDeleted_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + ObjectType *string + ObjectId *string + Attribute *string + Value *string +} + +func (b0 DataDeleted_builder) Build() *DataDeleted { + m0 := &DataDeleted{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 6) + x.xxx_hidden_TenantId = b.TenantId + } + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 6) + x.xxx_hidden_ObjectType = b.ObjectType + } + if b.ObjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 6) + x.xxx_hidden_ObjectId = b.ObjectId + } + if b.Attribute != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 6) + x.xxx_hidden_Attribute = b.Attribute + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 6) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// Personal data created +type PersonalDataCreated struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_DataSubjectType *string `protobuf:"bytes,3,opt,name=data_subject_type,json=dataSubjectType"` + xxx_hidden_DataSubjectId *string `protobuf:"bytes,4,opt,name=data_subject_id,json=dataSubjectId"` + xxx_hidden_ObjectType *string `protobuf:"bytes,5,opt,name=object_type,json=objectType"` + xxx_hidden_ObjectId *string `protobuf:"bytes,6,opt,name=object_id,json=objectId"` + xxx_hidden_Attribute *string `protobuf:"bytes,7,opt,name=attribute"` + xxx_hidden_Value *string `protobuf:"bytes,8,opt,name=value"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PersonalDataCreated) Reset() { + *x = PersonalDataCreated{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PersonalDataCreated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PersonalDataCreated) ProtoMessage() {} + +func (x *PersonalDataCreated) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *PersonalDataCreated) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *PersonalDataCreated) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *PersonalDataCreated) GetDataSubjectType() string { + if x != nil { + if x.xxx_hidden_DataSubjectType != nil { + return *x.xxx_hidden_DataSubjectType + } + return "" + } + return "" +} + +func (x *PersonalDataCreated) GetDataSubjectId() string { + if x != nil { + if x.xxx_hidden_DataSubjectId != nil { + return *x.xxx_hidden_DataSubjectId + } + return "" + } + return "" +} + +func (x *PersonalDataCreated) GetObjectType() string { + if x != nil { + if x.xxx_hidden_ObjectType != nil { + return *x.xxx_hidden_ObjectType + } + return "" + } + return "" +} + +func (x *PersonalDataCreated) GetObjectId() string { + if x != nil { + if x.xxx_hidden_ObjectId != nil { + return *x.xxx_hidden_ObjectId + } + return "" + } + return "" +} + +func (x *PersonalDataCreated) GetAttribute() string { + if x != nil { + if x.xxx_hidden_Attribute != nil { + return *x.xxx_hidden_Attribute + } + return "" + } + return "" +} + +func (x *PersonalDataCreated) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *PersonalDataCreated) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *PersonalDataCreated) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 8) +} + +func (x *PersonalDataCreated) SetDataSubjectType(v string) { + x.xxx_hidden_DataSubjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 8) +} + +func (x *PersonalDataCreated) SetDataSubjectId(v string) { + x.xxx_hidden_DataSubjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 8) +} + +func (x *PersonalDataCreated) SetObjectType(v string) { + x.xxx_hidden_ObjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 8) +} + +func (x *PersonalDataCreated) SetObjectId(v string) { + x.xxx_hidden_ObjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 8) +} + +func (x *PersonalDataCreated) SetAttribute(v string) { + x.xxx_hidden_Attribute = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 6, 8) +} + +func (x *PersonalDataCreated) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 7, 8) +} + +func (x *PersonalDataCreated) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *PersonalDataCreated) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *PersonalDataCreated) HasDataSubjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *PersonalDataCreated) HasDataSubjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *PersonalDataCreated) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *PersonalDataCreated) HasObjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *PersonalDataCreated) HasAttribute() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 6) +} + +func (x *PersonalDataCreated) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 7) +} + +func (x *PersonalDataCreated) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *PersonalDataCreated) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *PersonalDataCreated) ClearDataSubjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_DataSubjectType = nil +} + +func (x *PersonalDataCreated) ClearDataSubjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_DataSubjectId = nil +} + +func (x *PersonalDataCreated) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_ObjectType = nil +} + +func (x *PersonalDataCreated) ClearObjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_ObjectId = nil +} + +func (x *PersonalDataCreated) ClearAttribute() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 6) + x.xxx_hidden_Attribute = nil +} + +func (x *PersonalDataCreated) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 7) + x.xxx_hidden_Value = nil +} + +type PersonalDataCreated_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + DataSubjectType *string + DataSubjectId *string + ObjectType *string + ObjectId *string + Attribute *string + Value *string +} + +func (b0 PersonalDataCreated_builder) Build() *PersonalDataCreated { + m0 := &PersonalDataCreated{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 8) + x.xxx_hidden_TenantId = b.TenantId + } + if b.DataSubjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 8) + x.xxx_hidden_DataSubjectType = b.DataSubjectType + } + if b.DataSubjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 8) + x.xxx_hidden_DataSubjectId = b.DataSubjectId + } + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 8) + x.xxx_hidden_ObjectType = b.ObjectType + } + if b.ObjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 8) + x.xxx_hidden_ObjectId = b.ObjectId + } + if b.Attribute != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 6, 8) + x.xxx_hidden_Attribute = b.Attribute + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 7, 8) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// Personal data read +type PersonalDataRead struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_DataSubjectType *string `protobuf:"bytes,3,opt,name=data_subject_type,json=dataSubjectType"` + xxx_hidden_DataSubjectId *string `protobuf:"bytes,4,opt,name=data_subject_id,json=dataSubjectId"` + xxx_hidden_ObjectType *string `protobuf:"bytes,5,opt,name=object_type,json=objectType"` + xxx_hidden_ObjectId *string `protobuf:"bytes,6,opt,name=object_id,json=objectId"` + xxx_hidden_Attribute *string `protobuf:"bytes,7,opt,name=attribute"` + xxx_hidden_Value *string `protobuf:"bytes,8,opt,name=value"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PersonalDataRead) Reset() { + *x = PersonalDataRead{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PersonalDataRead) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PersonalDataRead) ProtoMessage() {} + +func (x *PersonalDataRead) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *PersonalDataRead) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *PersonalDataRead) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *PersonalDataRead) GetDataSubjectType() string { + if x != nil { + if x.xxx_hidden_DataSubjectType != nil { + return *x.xxx_hidden_DataSubjectType + } + return "" + } + return "" +} + +func (x *PersonalDataRead) GetDataSubjectId() string { + if x != nil { + if x.xxx_hidden_DataSubjectId != nil { + return *x.xxx_hidden_DataSubjectId + } + return "" + } + return "" +} + +func (x *PersonalDataRead) GetObjectType() string { + if x != nil { + if x.xxx_hidden_ObjectType != nil { + return *x.xxx_hidden_ObjectType + } + return "" + } + return "" +} + +func (x *PersonalDataRead) GetObjectId() string { + if x != nil { + if x.xxx_hidden_ObjectId != nil { + return *x.xxx_hidden_ObjectId + } + return "" + } + return "" +} + +func (x *PersonalDataRead) GetAttribute() string { + if x != nil { + if x.xxx_hidden_Attribute != nil { + return *x.xxx_hidden_Attribute + } + return "" + } + return "" +} + +func (x *PersonalDataRead) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *PersonalDataRead) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *PersonalDataRead) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 8) +} + +func (x *PersonalDataRead) SetDataSubjectType(v string) { + x.xxx_hidden_DataSubjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 8) +} + +func (x *PersonalDataRead) SetDataSubjectId(v string) { + x.xxx_hidden_DataSubjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 8) +} + +func (x *PersonalDataRead) SetObjectType(v string) { + x.xxx_hidden_ObjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 8) +} + +func (x *PersonalDataRead) SetObjectId(v string) { + x.xxx_hidden_ObjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 8) +} + +func (x *PersonalDataRead) SetAttribute(v string) { + x.xxx_hidden_Attribute = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 6, 8) +} + +func (x *PersonalDataRead) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 7, 8) +} + +func (x *PersonalDataRead) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *PersonalDataRead) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *PersonalDataRead) HasDataSubjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *PersonalDataRead) HasDataSubjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *PersonalDataRead) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *PersonalDataRead) HasObjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *PersonalDataRead) HasAttribute() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 6) +} + +func (x *PersonalDataRead) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 7) +} + +func (x *PersonalDataRead) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *PersonalDataRead) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *PersonalDataRead) ClearDataSubjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_DataSubjectType = nil +} + +func (x *PersonalDataRead) ClearDataSubjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_DataSubjectId = nil +} + +func (x *PersonalDataRead) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_ObjectType = nil +} + +func (x *PersonalDataRead) ClearObjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_ObjectId = nil +} + +func (x *PersonalDataRead) ClearAttribute() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 6) + x.xxx_hidden_Attribute = nil +} + +func (x *PersonalDataRead) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 7) + x.xxx_hidden_Value = nil +} + +type PersonalDataRead_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + DataSubjectType *string + DataSubjectId *string + ObjectType *string + ObjectId *string + Attribute *string + Value *string +} + +func (b0 PersonalDataRead_builder) Build() *PersonalDataRead { + m0 := &PersonalDataRead{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 8) + x.xxx_hidden_TenantId = b.TenantId + } + if b.DataSubjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 8) + x.xxx_hidden_DataSubjectType = b.DataSubjectType + } + if b.DataSubjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 8) + x.xxx_hidden_DataSubjectId = b.DataSubjectId + } + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 8) + x.xxx_hidden_ObjectType = b.ObjectType + } + if b.ObjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 8) + x.xxx_hidden_ObjectId = b.ObjectId + } + if b.Attribute != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 6, 8) + x.xxx_hidden_Attribute = b.Attribute + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 7, 8) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +// Personal data updated +type PersonalDataUpdated struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_DataSubjectType *string `protobuf:"bytes,3,opt,name=data_subject_type,json=dataSubjectType"` + xxx_hidden_DataSubjectId *string `protobuf:"bytes,4,opt,name=data_subject_id,json=dataSubjectId"` + xxx_hidden_ObjectType *string `protobuf:"bytes,5,opt,name=object_type,json=objectType"` + xxx_hidden_ObjectId *string `protobuf:"bytes,6,opt,name=object_id,json=objectId"` + xxx_hidden_Attribute *string `protobuf:"bytes,7,opt,name=attribute"` + xxx_hidden_OldValue *string `protobuf:"bytes,8,opt,name=old_value,json=oldValue"` + xxx_hidden_NewValue *string `protobuf:"bytes,9,opt,name=new_value,json=newValue"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PersonalDataUpdated) Reset() { + *x = PersonalDataUpdated{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PersonalDataUpdated) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PersonalDataUpdated) ProtoMessage() {} + +func (x *PersonalDataUpdated) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *PersonalDataUpdated) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *PersonalDataUpdated) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *PersonalDataUpdated) GetDataSubjectType() string { + if x != nil { + if x.xxx_hidden_DataSubjectType != nil { + return *x.xxx_hidden_DataSubjectType + } + return "" + } + return "" +} + +func (x *PersonalDataUpdated) GetDataSubjectId() string { + if x != nil { + if x.xxx_hidden_DataSubjectId != nil { + return *x.xxx_hidden_DataSubjectId + } + return "" + } + return "" +} + +func (x *PersonalDataUpdated) GetObjectType() string { + if x != nil { + if x.xxx_hidden_ObjectType != nil { + return *x.xxx_hidden_ObjectType + } + return "" + } + return "" +} + +func (x *PersonalDataUpdated) GetObjectId() string { + if x != nil { + if x.xxx_hidden_ObjectId != nil { + return *x.xxx_hidden_ObjectId + } + return "" + } + return "" +} + +func (x *PersonalDataUpdated) GetAttribute() string { + if x != nil { + if x.xxx_hidden_Attribute != nil { + return *x.xxx_hidden_Attribute + } + return "" + } + return "" +} + +func (x *PersonalDataUpdated) GetOldValue() string { + if x != nil { + if x.xxx_hidden_OldValue != nil { + return *x.xxx_hidden_OldValue + } + return "" + } + return "" +} + +func (x *PersonalDataUpdated) GetNewValue() string { + if x != nil { + if x.xxx_hidden_NewValue != nil { + return *x.xxx_hidden_NewValue + } + return "" + } + return "" +} + +func (x *PersonalDataUpdated) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *PersonalDataUpdated) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 9) +} + +func (x *PersonalDataUpdated) SetDataSubjectType(v string) { + x.xxx_hidden_DataSubjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 9) +} + +func (x *PersonalDataUpdated) SetDataSubjectId(v string) { + x.xxx_hidden_DataSubjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 9) +} + +func (x *PersonalDataUpdated) SetObjectType(v string) { + x.xxx_hidden_ObjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 9) +} + +func (x *PersonalDataUpdated) SetObjectId(v string) { + x.xxx_hidden_ObjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 9) +} + +func (x *PersonalDataUpdated) SetAttribute(v string) { + x.xxx_hidden_Attribute = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 6, 9) +} + +func (x *PersonalDataUpdated) SetOldValue(v string) { + x.xxx_hidden_OldValue = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 7, 9) +} + +func (x *PersonalDataUpdated) SetNewValue(v string) { + x.xxx_hidden_NewValue = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 8, 9) +} + +func (x *PersonalDataUpdated) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *PersonalDataUpdated) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *PersonalDataUpdated) HasDataSubjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *PersonalDataUpdated) HasDataSubjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *PersonalDataUpdated) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *PersonalDataUpdated) HasObjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *PersonalDataUpdated) HasAttribute() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 6) +} + +func (x *PersonalDataUpdated) HasOldValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 7) +} + +func (x *PersonalDataUpdated) HasNewValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 8) +} + +func (x *PersonalDataUpdated) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *PersonalDataUpdated) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *PersonalDataUpdated) ClearDataSubjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_DataSubjectType = nil +} + +func (x *PersonalDataUpdated) ClearDataSubjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_DataSubjectId = nil +} + +func (x *PersonalDataUpdated) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_ObjectType = nil +} + +func (x *PersonalDataUpdated) ClearObjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_ObjectId = nil +} + +func (x *PersonalDataUpdated) ClearAttribute() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 6) + x.xxx_hidden_Attribute = nil +} + +func (x *PersonalDataUpdated) ClearOldValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 7) + x.xxx_hidden_OldValue = nil +} + +func (x *PersonalDataUpdated) ClearNewValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 8) + x.xxx_hidden_NewValue = nil +} + +type PersonalDataUpdated_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + DataSubjectType *string + DataSubjectId *string + ObjectType *string + ObjectId *string + Attribute *string + OldValue *string + NewValue *string +} + +func (b0 PersonalDataUpdated_builder) Build() *PersonalDataUpdated { + m0 := &PersonalDataUpdated{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 9) + x.xxx_hidden_TenantId = b.TenantId + } + if b.DataSubjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 9) + x.xxx_hidden_DataSubjectType = b.DataSubjectType + } + if b.DataSubjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 9) + x.xxx_hidden_DataSubjectId = b.DataSubjectId + } + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 9) + x.xxx_hidden_ObjectType = b.ObjectType + } + if b.ObjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 9) + x.xxx_hidden_ObjectId = b.ObjectId + } + if b.Attribute != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 6, 9) + x.xxx_hidden_Attribute = b.Attribute + } + if b.OldValue != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 7, 9) + x.xxx_hidden_OldValue = b.OldValue + } + if b.NewValue != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 8, 9) + x.xxx_hidden_NewValue = b.NewValue + } + return m0 +} + +// Personal data deleted +type PersonalDataDeleted struct { + state protoimpl.MessageState `protogen:"opaque.v1"` + xxx_hidden_Common *Common `protobuf:"bytes,1,opt,name=common"` + xxx_hidden_TenantId *string `protobuf:"bytes,2,opt,name=tenant_id,json=tenantId"` + xxx_hidden_DataSubjectType *string `protobuf:"bytes,3,opt,name=data_subject_type,json=dataSubjectType"` + xxx_hidden_DataSubjectId *string `protobuf:"bytes,4,opt,name=data_subject_id,json=dataSubjectId"` + xxx_hidden_ObjectType *string `protobuf:"bytes,5,opt,name=object_type,json=objectType"` + xxx_hidden_ObjectId *string `protobuf:"bytes,6,opt,name=object_id,json=objectId"` + xxx_hidden_Attribute *string `protobuf:"bytes,7,opt,name=attribute"` + xxx_hidden_Value *string `protobuf:"bytes,8,opt,name=value"` + XXX_raceDetectHookData protoimpl.RaceDetectHookData + XXX_presence [1]uint32 + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *PersonalDataDeleted) Reset() { + *x = PersonalDataDeleted{} + mi := &file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *PersonalDataDeleted) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PersonalDataDeleted) ProtoMessage() {} + +func (x *PersonalDataDeleted) ProtoReflect() protoreflect.Message { + mi := &file_kms_api_cmk_auditlog_events_v1_events_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) +} + +func (x *PersonalDataDeleted) GetCommon() *Common { + if x != nil { + return x.xxx_hidden_Common + } + return nil +} + +func (x *PersonalDataDeleted) GetTenantId() string { + if x != nil { + if x.xxx_hidden_TenantId != nil { + return *x.xxx_hidden_TenantId + } + return "" + } + return "" +} + +func (x *PersonalDataDeleted) GetDataSubjectType() string { + if x != nil { + if x.xxx_hidden_DataSubjectType != nil { + return *x.xxx_hidden_DataSubjectType + } + return "" + } + return "" +} + +func (x *PersonalDataDeleted) GetDataSubjectId() string { + if x != nil { + if x.xxx_hidden_DataSubjectId != nil { + return *x.xxx_hidden_DataSubjectId + } + return "" + } + return "" +} + +func (x *PersonalDataDeleted) GetObjectType() string { + if x != nil { + if x.xxx_hidden_ObjectType != nil { + return *x.xxx_hidden_ObjectType + } + return "" + } + return "" +} + +func (x *PersonalDataDeleted) GetObjectId() string { + if x != nil { + if x.xxx_hidden_ObjectId != nil { + return *x.xxx_hidden_ObjectId + } + return "" + } + return "" +} + +func (x *PersonalDataDeleted) GetAttribute() string { + if x != nil { + if x.xxx_hidden_Attribute != nil { + return *x.xxx_hidden_Attribute + } + return "" + } + return "" +} + +func (x *PersonalDataDeleted) GetValue() string { + if x != nil { + if x.xxx_hidden_Value != nil { + return *x.xxx_hidden_Value + } + return "" + } + return "" +} + +func (x *PersonalDataDeleted) SetCommon(v *Common) { + x.xxx_hidden_Common = v +} + +func (x *PersonalDataDeleted) SetTenantId(v string) { + x.xxx_hidden_TenantId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 1, 8) +} + +func (x *PersonalDataDeleted) SetDataSubjectType(v string) { + x.xxx_hidden_DataSubjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 2, 8) +} + +func (x *PersonalDataDeleted) SetDataSubjectId(v string) { + x.xxx_hidden_DataSubjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 3, 8) +} + +func (x *PersonalDataDeleted) SetObjectType(v string) { + x.xxx_hidden_ObjectType = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 4, 8) +} + +func (x *PersonalDataDeleted) SetObjectId(v string) { + x.xxx_hidden_ObjectId = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 5, 8) +} + +func (x *PersonalDataDeleted) SetAttribute(v string) { + x.xxx_hidden_Attribute = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 6, 8) +} + +func (x *PersonalDataDeleted) SetValue(v string) { + x.xxx_hidden_Value = &v + protoimpl.X.SetPresent(&(x.XXX_presence[0]), 7, 8) +} + +func (x *PersonalDataDeleted) HasCommon() bool { + if x == nil { + return false + } + return x.xxx_hidden_Common != nil +} + +func (x *PersonalDataDeleted) HasTenantId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 1) +} + +func (x *PersonalDataDeleted) HasDataSubjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 2) +} + +func (x *PersonalDataDeleted) HasDataSubjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 3) +} + +func (x *PersonalDataDeleted) HasObjectType() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 4) +} + +func (x *PersonalDataDeleted) HasObjectId() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 5) +} + +func (x *PersonalDataDeleted) HasAttribute() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 6) +} + +func (x *PersonalDataDeleted) HasValue() bool { + if x == nil { + return false + } + return protoimpl.X.Present(&(x.XXX_presence[0]), 7) +} + +func (x *PersonalDataDeleted) ClearCommon() { + x.xxx_hidden_Common = nil +} + +func (x *PersonalDataDeleted) ClearTenantId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 1) + x.xxx_hidden_TenantId = nil +} + +func (x *PersonalDataDeleted) ClearDataSubjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 2) + x.xxx_hidden_DataSubjectType = nil +} + +func (x *PersonalDataDeleted) ClearDataSubjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 3) + x.xxx_hidden_DataSubjectId = nil +} + +func (x *PersonalDataDeleted) ClearObjectType() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 4) + x.xxx_hidden_ObjectType = nil +} + +func (x *PersonalDataDeleted) ClearObjectId() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 5) + x.xxx_hidden_ObjectId = nil +} + +func (x *PersonalDataDeleted) ClearAttribute() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 6) + x.xxx_hidden_Attribute = nil +} + +func (x *PersonalDataDeleted) ClearValue() { + protoimpl.X.ClearPresent(&(x.XXX_presence[0]), 7) + x.xxx_hidden_Value = nil +} + +type PersonalDataDeleted_builder struct { + _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. + + Common *Common + TenantId *string + DataSubjectType *string + DataSubjectId *string + ObjectType *string + ObjectId *string + Attribute *string + Value *string +} + +func (b0 PersonalDataDeleted_builder) Build() *PersonalDataDeleted { + m0 := &PersonalDataDeleted{} + b, x := &b0, m0 + _, _ = b, x + x.xxx_hidden_Common = b.Common + if b.TenantId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 1, 8) + x.xxx_hidden_TenantId = b.TenantId + } + if b.DataSubjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 2, 8) + x.xxx_hidden_DataSubjectType = b.DataSubjectType + } + if b.DataSubjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 3, 8) + x.xxx_hidden_DataSubjectId = b.DataSubjectId + } + if b.ObjectType != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 4, 8) + x.xxx_hidden_ObjectType = b.ObjectType + } + if b.ObjectId != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 5, 8) + x.xxx_hidden_ObjectId = b.ObjectId + } + if b.Attribute != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 6, 8) + x.xxx_hidden_Attribute = b.Attribute + } + if b.Value != nil { + protoimpl.X.SetPresentNonAtomic(&(x.XXX_presence[0]), 7, 8) + x.xxx_hidden_Value = b.Value + } + return m0 +} + +var File_kms_api_cmk_auditlog_events_v1_events_proto protoreflect.FileDescriptor + +const file_kms_api_cmk_auditlog_events_v1_events_proto_rawDesc = "" + + "\n" + + "+kms/api/cmk/auditlog/events/v1/events.proto\x12\x1ekms.api.cmk.auditlog.events.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"\xc3\x02\n" + + "\x06Common\x12@\n" + + "\ttimestamp\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampB\x06\xbaH\x03\xc8\x01\x01R\ttimestamp\x12V\n" + + "\n" + + "properties\x18\x02 \x03(\v26.kms.api.cmk.auditlog.events.v1.Common.PropertiesEntryR\n" + + "properties\x120\n" + + "\btrace_id\x18\x03 \x01(\tB\x15\xbaH\x12r\x102\x0e^[0-9a-f]{32}$R\atraceId\x12.\n" + + "\aspan_id\x18\x04 \x01(\tB\x15\xbaH\x12r\x102\x0e^[0-9a-f]{16}$R\x06spanId\x1a=\n" + + "\x0fPropertiesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xc6\x01\n" + + "\x0eLoginSucceeded\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12\x1f\n" + + "\auser_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x06userId\x12K\n" + + "\x06method\x18\x03 \x01(\x0e2+.kms.api.cmk.auditlog.events.v1.LoginMethodB\x06\xbaH\x03\xc8\x01\x01R\x06method\"\x93\x02\n" + + "\vLoginFailed\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12\x1f\n" + + "\auser_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x06userId\x12K\n" + + "\x06method\x18\x03 \x01(\x0e2+.kms.api.cmk.auditlog.events.v1.LoginMethodB\x06\xbaH\x03\xc8\x01\x01R\x06method\x12N\n" + + "\afailure\x18\x04 \x01(\x0e2,.kms.api.cmk.auditlog.events.v1.LoginFailureB\x06\xbaH\x03\xc8\x01\x01R\afailure\"y\n" + + "\x16UnauthenticatedRequest\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12\x17\n" + + "\auser_id\x18\x02 \x01(\tR\x06userId\"~\n" + + "\x13UnauthorizedRequest\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12\x1f\n" + + "\auser_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x06userId\"\x9b\x01\n" + + "\rAccessGranted\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12\"\n" + + "\bresource\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bresource\x12\x1e\n" + + "\x06action\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x06action\"|\n" + + "\rTenantCreated\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\"\xf3\x01\n" + + "\rTenantUpdated\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12+\n" + + "\rproperty_name\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\fpropertyName\x12#\n" + + "\told_value\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\boldValue\x12#\n" + + "\tnew_value\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bnewValue\"|\n" + + "\rTenantDeleted\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\"\x98\x01\n" + + "\n" + + "CMKCreated\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12\x1d\n" + + "\x06cmk_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x05cmkId\"\x98\x01\n" + + "\n" + + "CMKRotated\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12\x1d\n" + + "\x06cmk_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x05cmkId\"\x9c\x01\n" + + "\x0eCMKUnavailable\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12\x1d\n" + + "\x06cmk_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x05cmkId\"\x9a\x01\n" + + "\fCMKAvailable\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12\x1d\n" + + "\x06cmk_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x05cmkId\"\x99\x01\n" + + "\vCMKDisabled\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12\x1d\n" + + "\x06cmk_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x05cmkId\"\x98\x01\n" + + "\n" + + "CMKEnabled\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12\x1d\n" + + "\x06cmk_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x05cmkId\"\x98\x01\n" + + "\n" + + "CMKDeleted\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12\x1d\n" + + "\x06cmk_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x05cmkId\"\xc2\x01\n" + + "\x0fSystemOnboarded\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\tsystem_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bsystemId\x12#\n" + + "\ttenant_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12\x1d\n" + + "\x06cmk_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x05cmkId\"\xee\x01\n" + + "\x0eSystemSwitched\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\tsystem_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bsystemId\x12#\n" + + "\ttenant_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12$\n" + + "\n" + + "cmk_id_old\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bcmkIdOld\x12$\n" + + "\n" + + "cmk_id_new\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bcmkIdNew\"\xc3\x01\n" + + "\x10SystemOffboarded\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\tsystem_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bsystemId\x12#\n" + + "\ttenant_id\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12\x1d\n" + + "\x06cmk_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x05cmkId\"\x84\x02\n" + + "\vDataCreated\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12'\n" + + "\vobject_type\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + + "objectType\x12#\n" + + "\tobject_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bobjectId\x12$\n" + + "\tattribute\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\tattribute\x12\x14\n" + + "\x05value\x18\x06 \x01(\tR\x05value\"\x81\x02\n" + + "\bDataRead\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12'\n" + + "\vobject_type\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + + "objectType\x12#\n" + + "\tobject_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bobjectId\x12$\n" + + "\tattribute\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\tattribute\x12\x14\n" + + "\x05value\x18\x06 \x01(\tR\x05value\"\xa8\x02\n" + + "\vDataUpdated\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12'\n" + + "\vobject_type\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + + "objectType\x12#\n" + + "\tobject_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bobjectId\x12$\n" + + "\tattribute\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\tattribute\x12\x1b\n" + + "\told_value\x18\x06 \x01(\tR\boldValue\x12\x1b\n" + + "\tnew_value\x18\a \x01(\tR\bnewValue\"\x84\x02\n" + + "\vDataDeleted\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x12'\n" + + "\vobject_type\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + + "objectType\x12#\n" + + "\tobject_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bobjectId\x12$\n" + + "\tattribute\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\tattribute\x12\x14\n" + + "\x05value\x18\x06 \x01(\tR\x05value\"\xf0\x02\n" + + "\x13PersonalDataCreated\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x122\n" + + "\x11data_subject_type\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x0fdataSubjectType\x12.\n" + + "\x0fdata_subject_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\rdataSubjectId\x12'\n" + + "\vobject_type\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + + "objectType\x12#\n" + + "\tobject_id\x18\x06 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bobjectId\x12$\n" + + "\tattribute\x18\a \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\tattribute\x12\x14\n" + + "\x05value\x18\b \x01(\tR\x05value\"\xed\x02\n" + + "\x10PersonalDataRead\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x122\n" + + "\x11data_subject_type\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x0fdataSubjectType\x12.\n" + + "\x0fdata_subject_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\rdataSubjectId\x12'\n" + + "\vobject_type\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + + "objectType\x12#\n" + + "\tobject_id\x18\x06 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bobjectId\x12$\n" + + "\tattribute\x18\a \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\tattribute\x12\x14\n" + + "\x05value\x18\b \x01(\tR\x05value\"\x94\x03\n" + + "\x13PersonalDataUpdated\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x122\n" + + "\x11data_subject_type\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x0fdataSubjectType\x12.\n" + + "\x0fdata_subject_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\rdataSubjectId\x12'\n" + + "\vobject_type\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + + "objectType\x12#\n" + + "\tobject_id\x18\x06 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bobjectId\x12$\n" + + "\tattribute\x18\a \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\tattribute\x12\x1b\n" + + "\told_value\x18\b \x01(\tR\boldValue\x12\x1b\n" + + "\tnew_value\x18\t \x01(\tR\bnewValue\"\xf0\x02\n" + + "\x13PersonalDataDeleted\x12F\n" + + "\x06common\x18\x01 \x01(\v2&.kms.api.cmk.auditlog.events.v1.CommonB\x06\xbaH\x03\xc8\x01\x01R\x06common\x12#\n" + + "\ttenant_id\x18\x02 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\btenantId\x122\n" + + "\x11data_subject_type\x18\x03 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\x0fdataSubjectType\x12.\n" + + "\x0fdata_subject_id\x18\x04 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\rdataSubjectId\x12'\n" + + "\vobject_type\x18\x05 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\n" + + "objectType\x12#\n" + + "\tobject_id\x18\x06 \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\bobjectId\x12$\n" + + "\tattribute\x18\a \x01(\tB\x06\xbaH\x03\xc8\x01\x01R\tattribute\x12\x14\n" + + "\x05value\x18\b \x01(\tR\x05value*\x8f\x01\n" + + "\vLoginMethod\x12\x1c\n" + + "\x18LOGIN_METHOD_UNSPECIFIED\x10\x00\x12\x1d\n" + + "\x19LOGIN_METHOD_BEARER_TOKEN\x10\x01\x12 \n" + + "\x1cLOGIN_METHOD_OPEN_ID_CONNECT\x10\x02\x12!\n" + + "\x1dLOGIN_METHOD_X509_CERTIFICATE\x10\x03*\x98\x01\n" + + "\fLoginFailure\x12\x1d\n" + + "\x19LOGIN_FAILURE_UNSPECIFIED\x10\x00\x12\x1f\n" + + "\x1bLOGIN_FAILURE_INVALID_TOKEN\x10\x01\x12!\n" + + "\x1dLOGIN_FAILURE_INVALID_SESSION\x10\x02\x12%\n" + + "!LOGIN_FAILURE_INVALID_CERTIFICATE\x10\x03BRZPgithub.com/openkcm/api-sdk/proto/kms/api/cmk/auditlog/events/v1;auditlogeventsv1b\beditionsp\xe9\az\x1bbuf/validate/validate.proto" + +var file_kms_api_cmk_auditlog_events_v1_events_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes = make([]protoimpl.MessageInfo, 28) +var file_kms_api_cmk_auditlog_events_v1_events_proto_goTypes = []any{ + (LoginMethod)(0), // 0: kms.api.cmk.auditlog.events.v1.LoginMethod + (LoginFailure)(0), // 1: kms.api.cmk.auditlog.events.v1.LoginFailure + (*Common)(nil), // 2: kms.api.cmk.auditlog.events.v1.Common + (*LoginSucceeded)(nil), // 3: kms.api.cmk.auditlog.events.v1.LoginSucceeded + (*LoginFailed)(nil), // 4: kms.api.cmk.auditlog.events.v1.LoginFailed + (*UnauthenticatedRequest)(nil), // 5: kms.api.cmk.auditlog.events.v1.UnauthenticatedRequest + (*UnauthorizedRequest)(nil), // 6: kms.api.cmk.auditlog.events.v1.UnauthorizedRequest + (*AccessGranted)(nil), // 7: kms.api.cmk.auditlog.events.v1.AccessGranted + (*TenantCreated)(nil), // 8: kms.api.cmk.auditlog.events.v1.TenantCreated + (*TenantUpdated)(nil), // 9: kms.api.cmk.auditlog.events.v1.TenantUpdated + (*TenantDeleted)(nil), // 10: kms.api.cmk.auditlog.events.v1.TenantDeleted + (*CMKCreated)(nil), // 11: kms.api.cmk.auditlog.events.v1.CMKCreated + (*CMKRotated)(nil), // 12: kms.api.cmk.auditlog.events.v1.CMKRotated + (*CMKUnavailable)(nil), // 13: kms.api.cmk.auditlog.events.v1.CMKUnavailable + (*CMKAvailable)(nil), // 14: kms.api.cmk.auditlog.events.v1.CMKAvailable + (*CMKDisabled)(nil), // 15: kms.api.cmk.auditlog.events.v1.CMKDisabled + (*CMKEnabled)(nil), // 16: kms.api.cmk.auditlog.events.v1.CMKEnabled + (*CMKDeleted)(nil), // 17: kms.api.cmk.auditlog.events.v1.CMKDeleted + (*SystemOnboarded)(nil), // 18: kms.api.cmk.auditlog.events.v1.SystemOnboarded + (*SystemSwitched)(nil), // 19: kms.api.cmk.auditlog.events.v1.SystemSwitched + (*SystemOffboarded)(nil), // 20: kms.api.cmk.auditlog.events.v1.SystemOffboarded + (*DataCreated)(nil), // 21: kms.api.cmk.auditlog.events.v1.DataCreated + (*DataRead)(nil), // 22: kms.api.cmk.auditlog.events.v1.DataRead + (*DataUpdated)(nil), // 23: kms.api.cmk.auditlog.events.v1.DataUpdated + (*DataDeleted)(nil), // 24: kms.api.cmk.auditlog.events.v1.DataDeleted + (*PersonalDataCreated)(nil), // 25: kms.api.cmk.auditlog.events.v1.PersonalDataCreated + (*PersonalDataRead)(nil), // 26: kms.api.cmk.auditlog.events.v1.PersonalDataRead + (*PersonalDataUpdated)(nil), // 27: kms.api.cmk.auditlog.events.v1.PersonalDataUpdated + (*PersonalDataDeleted)(nil), // 28: kms.api.cmk.auditlog.events.v1.PersonalDataDeleted + nil, // 29: kms.api.cmk.auditlog.events.v1.Common.PropertiesEntry + (*timestamppb.Timestamp)(nil), // 30: google.protobuf.Timestamp +} +var file_kms_api_cmk_auditlog_events_v1_events_proto_depIdxs = []int32{ + 30, // 0: kms.api.cmk.auditlog.events.v1.Common.timestamp:type_name -> google.protobuf.Timestamp + 29, // 1: kms.api.cmk.auditlog.events.v1.Common.properties:type_name -> kms.api.cmk.auditlog.events.v1.Common.PropertiesEntry + 2, // 2: kms.api.cmk.auditlog.events.v1.LoginSucceeded.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 0, // 3: kms.api.cmk.auditlog.events.v1.LoginSucceeded.method:type_name -> kms.api.cmk.auditlog.events.v1.LoginMethod + 2, // 4: kms.api.cmk.auditlog.events.v1.LoginFailed.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 0, // 5: kms.api.cmk.auditlog.events.v1.LoginFailed.method:type_name -> kms.api.cmk.auditlog.events.v1.LoginMethod + 1, // 6: kms.api.cmk.auditlog.events.v1.LoginFailed.failure:type_name -> kms.api.cmk.auditlog.events.v1.LoginFailure + 2, // 7: kms.api.cmk.auditlog.events.v1.UnauthenticatedRequest.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 8: kms.api.cmk.auditlog.events.v1.UnauthorizedRequest.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 9: kms.api.cmk.auditlog.events.v1.AccessGranted.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 10: kms.api.cmk.auditlog.events.v1.TenantCreated.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 11: kms.api.cmk.auditlog.events.v1.TenantUpdated.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 12: kms.api.cmk.auditlog.events.v1.TenantDeleted.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 13: kms.api.cmk.auditlog.events.v1.CMKCreated.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 14: kms.api.cmk.auditlog.events.v1.CMKRotated.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 15: kms.api.cmk.auditlog.events.v1.CMKUnavailable.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 16: kms.api.cmk.auditlog.events.v1.CMKAvailable.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 17: kms.api.cmk.auditlog.events.v1.CMKDisabled.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 18: kms.api.cmk.auditlog.events.v1.CMKEnabled.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 19: kms.api.cmk.auditlog.events.v1.CMKDeleted.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 20: kms.api.cmk.auditlog.events.v1.SystemOnboarded.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 21: kms.api.cmk.auditlog.events.v1.SystemSwitched.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 22: kms.api.cmk.auditlog.events.v1.SystemOffboarded.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 23: kms.api.cmk.auditlog.events.v1.DataCreated.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 24: kms.api.cmk.auditlog.events.v1.DataRead.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 25: kms.api.cmk.auditlog.events.v1.DataUpdated.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 26: kms.api.cmk.auditlog.events.v1.DataDeleted.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 27: kms.api.cmk.auditlog.events.v1.PersonalDataCreated.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 28: kms.api.cmk.auditlog.events.v1.PersonalDataRead.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 29: kms.api.cmk.auditlog.events.v1.PersonalDataUpdated.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 2, // 30: kms.api.cmk.auditlog.events.v1.PersonalDataDeleted.common:type_name -> kms.api.cmk.auditlog.events.v1.Common + 31, // [31:31] is the sub-list for method output_type + 31, // [31:31] is the sub-list for method input_type + 31, // [31:31] is the sub-list for extension type_name + 31, // [31:31] is the sub-list for extension extendee + 0, // [0:31] is the sub-list for field type_name +} + +func init() { file_kms_api_cmk_auditlog_events_v1_events_proto_init() } +func file_kms_api_cmk_auditlog_events_v1_events_proto_init() { + if File_kms_api_cmk_auditlog_events_v1_events_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_kms_api_cmk_auditlog_events_v1_events_proto_rawDesc), len(file_kms_api_cmk_auditlog_events_v1_events_proto_rawDesc)), + NumEnums: 2, + NumMessages: 28, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_kms_api_cmk_auditlog_events_v1_events_proto_goTypes, + DependencyIndexes: file_kms_api_cmk_auditlog_events_v1_events_proto_depIdxs, + EnumInfos: file_kms_api_cmk_auditlog_events_v1_events_proto_enumTypes, + MessageInfos: file_kms_api_cmk_auditlog_events_v1_events_proto_msgTypes, + }.Build() + File_kms_api_cmk_auditlog_events_v1_events_proto = out.File + file_kms_api_cmk_auditlog_events_v1_events_proto_goTypes = nil + file_kms_api_cmk_auditlog_events_v1_events_proto_depIdxs = nil +} diff --git a/proto/kms/api/cmk/auditlog/events/v1/events.proto b/proto/kms/api/cmk/auditlog/events/v1/events.proto new file mode 100644 index 0000000..96105dc --- /dev/null +++ b/proto/kms/api/cmk/auditlog/events/v1/events.proto @@ -0,0 +1,247 @@ +edition = "2024"; + +package kms.api.cmk.auditlog.events.v1; + +import "google/protobuf/timestamp.proto"; +import option "buf/validate/validate.proto"; + +option go_package = "github.com/openkcm/api-sdk/proto/kms/api/cmk/auditlog/events/v1;auditlogeventsv1"; + +// Login Methods +enum LoginMethod { + LOGIN_METHOD_UNSPECIFIED = 0; + LOGIN_METHOD_BEARER_TOKEN = 1; + LOGIN_METHOD_OPEN_ID_CONNECT = 2; + LOGIN_METHOD_X509_CERTIFICATE = 3; +} + +// Login Failures +enum LoginFailure { + LOGIN_FAILURE_UNSPECIFIED = 0; + LOGIN_FAILURE_INVALID_TOKEN = 1; + LOGIN_FAILURE_INVALID_SESSION = 2; + LOGIN_FAILURE_INVALID_CERTIFICATE = 3; +} + +// Common fields for all messages +message Common { + // Timestamp of the event + google.protobuf.Timestamp timestamp = 1 [(buf.validate.field).required = true]; + // Properties map + map properties = 2; + // The trace-id (32 lowercase hex characters, e.g., "4bf92f3577b34da6a3ce929d0e0e4736") + string trace_id = 3 [(buf.validate.field).string.pattern = "^[0-9a-f]{32}$"]; + // The span-id (16 lowercase hex characters, e.g., "00f067aa0ba902b7") + string span_id = 4 [(buf.validate.field).string.pattern = "^[0-9a-f]{16}$"]; +} + +// === Access Management === // + +// Login succeeded +message LoginSucceeded { + Common common = 1 [(buf.validate.field).required = true]; + string user_id = 2 [(buf.validate.field).required = true]; + LoginMethod method = 3 [(buf.validate.field).required = true]; +} +// Login failed +message LoginFailed { + Common common = 1 [(buf.validate.field).required = true]; + string user_id = 2 [(buf.validate.field).required = true]; + LoginMethod method = 3 [(buf.validate.field).required = true]; + LoginFailure failure = 4 [(buf.validate.field).required = true]; +} +// Unauthenticated request (HTTP 401) +message UnauthenticatedRequest { + Common common = 1 [(buf.validate.field).required = true]; + string user_id = 2; +} +// Unauthorized request (HTTP 403) +message UnauthorizedRequest { + Common common = 1 [(buf.validate.field).required = true]; + string user_id = 2 [(buf.validate.field).required = true]; +} +// Access granted +message AccessGranted { + Common common = 1 [(buf.validate.field).required = true]; + string resource = 2 [(buf.validate.field).required = true]; + string action = 3 [(buf.validate.field).required = true]; +} + +// === Tenant Operations === // + +// Tenant created +message TenantCreated { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; +} +// Tenant updated +message TenantUpdated { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string property_name = 3 [(buf.validate.field).required = true]; + string old_value = 4 [(buf.validate.field).required = true]; + string new_value = 5 [(buf.validate.field).required = true]; +} +// Tenant deleted +message TenantDeleted { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; +} + +// === Customer Managed Key (CMK) Operations === // + +// CMK got created +message CMKCreated { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string cmk_id = 3 [(buf.validate.field).required = true]; +} +// CMK got rotated +message CMKRotated { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string cmk_id = 3 [(buf.validate.field).required = true]; +} +// CMK has become unavailable +message CMKUnavailable { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string cmk_id = 3 [(buf.validate.field).required = true]; +} +// CMK has become available +message CMKAvailable { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string cmk_id = 3 [(buf.validate.field).required = true]; +} +// CMK got disabled +message CMKDisabled { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string cmk_id = 3 [(buf.validate.field).required = true]; +} +// CMK got enabled +message CMKEnabled { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string cmk_id = 3 [(buf.validate.field).required = true]; +} +// CMK got deleted +message CMKDeleted { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string cmk_id = 3 [(buf.validate.field).required = true]; +} + +// === System Operations === // + +// System onboarded to CMK +message SystemOnboarded { + Common common = 1 [(buf.validate.field).required = true]; + string system_id = 2 [(buf.validate.field).required = true]; + string tenant_id = 3 [(buf.validate.field).required = true]; + string cmk_id = 4 [(buf.validate.field).required = true]; +} +// System switched CMK +message SystemSwitched { + Common common = 1 [(buf.validate.field).required = true]; + string system_id = 2 [(buf.validate.field).required = true]; + string tenant_id = 3 [(buf.validate.field).required = true]; + string cmk_id_old = 4 [(buf.validate.field).required = true]; + string cmk_id_new = 5 [(buf.validate.field).required = true]; +} +// System offboarded from CMK +message SystemOffboarded { + Common common = 1 [(buf.validate.field).required = true]; + string system_id = 2 [(buf.validate.field).required = true]; + string tenant_id = 3 [(buf.validate.field).required = true]; + string cmk_id = 4 [(buf.validate.field).required = true]; +} + +// === Data Operations (only generic data, no personal data) === // + +// Data created +message DataCreated { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string object_type = 3 [(buf.validate.field).required = true]; + string object_id = 4 [(buf.validate.field).required = true]; + string attribute = 5 [(buf.validate.field).required = true]; + string value = 6; +} +// Data read +message DataRead { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string object_type = 3 [(buf.validate.field).required = true]; + string object_id = 4 [(buf.validate.field).required = true]; + string attribute = 5 [(buf.validate.field).required = true]; + string value = 6; +} +// Data updated +message DataUpdated { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string object_type = 3 [(buf.validate.field).required = true]; + string object_id = 4 [(buf.validate.field).required = true]; + string attribute = 5 [(buf.validate.field).required = true]; + string old_value = 6; + string new_value = 7; +} +// Data deleted +message DataDeleted { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string object_type = 3 [(buf.validate.field).required = true]; + string object_id = 4 [(buf.validate.field).required = true]; + string attribute = 5 [(buf.validate.field).required = true]; + string value = 6; +} + +// === Personal Data Operations === // + +// Personal data created +message PersonalDataCreated { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string data_subject_type = 3 [(buf.validate.field).required = true]; + string data_subject_id = 4 [(buf.validate.field).required = true]; + string object_type = 5 [(buf.validate.field).required = true]; + string object_id = 6 [(buf.validate.field).required = true]; + string attribute = 7 [(buf.validate.field).required = true]; + string value = 8; +} +// Personal data read +message PersonalDataRead { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string data_subject_type = 3 [(buf.validate.field).required = true]; + string data_subject_id = 4 [(buf.validate.field).required = true]; + string object_type = 5 [(buf.validate.field).required = true]; + string object_id = 6 [(buf.validate.field).required = true]; + string attribute = 7 [(buf.validate.field).required = true]; + string value = 8; +} +// Personal data updated +message PersonalDataUpdated { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string data_subject_type = 3 [(buf.validate.field).required = true]; + string data_subject_id = 4 [(buf.validate.field).required = true]; + string object_type = 5 [(buf.validate.field).required = true]; + string object_id = 6 [(buf.validate.field).required = true]; + string attribute = 7 [(buf.validate.field).required = true]; + string old_value = 8; + string new_value = 9; +} +// Personal data deleted +message PersonalDataDeleted { + Common common = 1 [(buf.validate.field).required = true]; + string tenant_id = 2 [(buf.validate.field).required = true]; + string data_subject_type = 3 [(buf.validate.field).required = true]; + string data_subject_id = 4 [(buf.validate.field).required = true]; + string object_type = 5 [(buf.validate.field).required = true]; + string object_id = 6 [(buf.validate.field).required = true]; + string attribute = 7 [(buf.validate.field).required = true]; + string value = 8; +} diff --git a/proto/kms/api/cmk/auditlog/events/v1/events_eventbuilders.pb.go b/proto/kms/api/cmk/auditlog/events/v1/events_eventbuilders.pb.go new file mode 100644 index 0000000..aa0f1b0 --- /dev/null +++ b/proto/kms/api/cmk/auditlog/events/v1/events_eventbuilders.pb.go @@ -0,0 +1,393 @@ +// Code generated by protoc-gen-go-eventbuilders. DO NOT EDIT. + +package auditlogeventsv1 + +// NewLoginSucceededEvent creates a LoginSucceeded with required fields populated. +func NewLoginSucceededEvent( + common *Common, + userId string, + method LoginMethod, +) *LoginSucceeded { + m := &LoginSucceeded{} + m.SetCommon(common) + m.SetUserId(userId) + m.SetMethod(method) + return m +} + +// NewLoginFailedEvent creates a LoginFailed with required fields populated. +func NewLoginFailedEvent( + common *Common, + userId string, + method LoginMethod, + failure LoginFailure, +) *LoginFailed { + m := &LoginFailed{} + m.SetCommon(common) + m.SetUserId(userId) + m.SetMethod(method) + m.SetFailure(failure) + return m +} + +// NewUnauthenticatedRequestEvent creates a UnauthenticatedRequest with required fields populated. +func NewUnauthenticatedRequestEvent( + common *Common, +) *UnauthenticatedRequest { + m := &UnauthenticatedRequest{} + m.SetCommon(common) + return m +} + +// NewUnauthorizedRequestEvent creates a UnauthorizedRequest with required fields populated. +func NewUnauthorizedRequestEvent( + common *Common, + userId string, +) *UnauthorizedRequest { + m := &UnauthorizedRequest{} + m.SetCommon(common) + m.SetUserId(userId) + return m +} + +// NewAccessGrantedEvent creates a AccessGranted with required fields populated. +func NewAccessGrantedEvent( + common *Common, + resource string, + action string, +) *AccessGranted { + m := &AccessGranted{} + m.SetCommon(common) + m.SetResource(resource) + m.SetAction(action) + return m +} + +// NewTenantCreatedEvent creates a TenantCreated with required fields populated. +func NewTenantCreatedEvent( + common *Common, + tenantId string, +) *TenantCreated { + m := &TenantCreated{} + m.SetCommon(common) + m.SetTenantId(tenantId) + return m +} + +// NewTenantUpdatedEvent creates a TenantUpdated with required fields populated. +func NewTenantUpdatedEvent( + common *Common, + tenantId string, + propertyName string, + oldValue string, + newValue string, +) *TenantUpdated { + m := &TenantUpdated{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetPropertyName(propertyName) + m.SetOldValue(oldValue) + m.SetNewValue(newValue) + return m +} + +// NewTenantDeletedEvent creates a TenantDeleted with required fields populated. +func NewTenantDeletedEvent( + common *Common, + tenantId string, +) *TenantDeleted { + m := &TenantDeleted{} + m.SetCommon(common) + m.SetTenantId(tenantId) + return m +} + +// NewCMKCreatedEvent creates a CMKCreated with required fields populated. +func NewCMKCreatedEvent( + common *Common, + tenantId string, + cmkId string, +) *CMKCreated { + m := &CMKCreated{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetCmkId(cmkId) + return m +} + +// NewCMKRotatedEvent creates a CMKRotated with required fields populated. +func NewCMKRotatedEvent( + common *Common, + tenantId string, + cmkId string, +) *CMKRotated { + m := &CMKRotated{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetCmkId(cmkId) + return m +} + +// NewCMKUnavailableEvent creates a CMKUnavailable with required fields populated. +func NewCMKUnavailableEvent( + common *Common, + tenantId string, + cmkId string, +) *CMKUnavailable { + m := &CMKUnavailable{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetCmkId(cmkId) + return m +} + +// NewCMKAvailableEvent creates a CMKAvailable with required fields populated. +func NewCMKAvailableEvent( + common *Common, + tenantId string, + cmkId string, +) *CMKAvailable { + m := &CMKAvailable{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetCmkId(cmkId) + return m +} + +// NewCMKDisabledEvent creates a CMKDisabled with required fields populated. +func NewCMKDisabledEvent( + common *Common, + tenantId string, + cmkId string, +) *CMKDisabled { + m := &CMKDisabled{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetCmkId(cmkId) + return m +} + +// NewCMKEnabledEvent creates a CMKEnabled with required fields populated. +func NewCMKEnabledEvent( + common *Common, + tenantId string, + cmkId string, +) *CMKEnabled { + m := &CMKEnabled{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetCmkId(cmkId) + return m +} + +// NewCMKDeletedEvent creates a CMKDeleted with required fields populated. +func NewCMKDeletedEvent( + common *Common, + tenantId string, + cmkId string, +) *CMKDeleted { + m := &CMKDeleted{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetCmkId(cmkId) + return m +} + +// NewSystemOnboardedEvent creates a SystemOnboarded with required fields populated. +func NewSystemOnboardedEvent( + common *Common, + systemId string, + tenantId string, + cmkId string, +) *SystemOnboarded { + m := &SystemOnboarded{} + m.SetCommon(common) + m.SetSystemId(systemId) + m.SetTenantId(tenantId) + m.SetCmkId(cmkId) + return m +} + +// NewSystemSwitchedEvent creates a SystemSwitched with required fields populated. +func NewSystemSwitchedEvent( + common *Common, + systemId string, + tenantId string, + cmkIdOld string, + cmkIdNew string, +) *SystemSwitched { + m := &SystemSwitched{} + m.SetCommon(common) + m.SetSystemId(systemId) + m.SetTenantId(tenantId) + m.SetCmkIdOld(cmkIdOld) + m.SetCmkIdNew(cmkIdNew) + return m +} + +// NewSystemOffboardedEvent creates a SystemOffboarded with required fields populated. +func NewSystemOffboardedEvent( + common *Common, + systemId string, + tenantId string, + cmkId string, +) *SystemOffboarded { + m := &SystemOffboarded{} + m.SetCommon(common) + m.SetSystemId(systemId) + m.SetTenantId(tenantId) + m.SetCmkId(cmkId) + return m +} + +// NewDataCreatedEvent creates a DataCreated with required fields populated. +func NewDataCreatedEvent( + common *Common, + tenantId string, + objectType string, + objectId string, + attribute string, +) *DataCreated { + m := &DataCreated{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetObjectType(objectType) + m.SetObjectId(objectId) + m.SetAttribute(attribute) + return m +} + +// NewDataReadEvent creates a DataRead with required fields populated. +func NewDataReadEvent( + common *Common, + tenantId string, + objectType string, + objectId string, + attribute string, +) *DataRead { + m := &DataRead{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetObjectType(objectType) + m.SetObjectId(objectId) + m.SetAttribute(attribute) + return m +} + +// NewDataUpdatedEvent creates a DataUpdated with required fields populated. +func NewDataUpdatedEvent( + common *Common, + tenantId string, + objectType string, + objectId string, + attribute string, +) *DataUpdated { + m := &DataUpdated{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetObjectType(objectType) + m.SetObjectId(objectId) + m.SetAttribute(attribute) + return m +} + +// NewDataDeletedEvent creates a DataDeleted with required fields populated. +func NewDataDeletedEvent( + common *Common, + tenantId string, + objectType string, + objectId string, + attribute string, +) *DataDeleted { + m := &DataDeleted{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetObjectType(objectType) + m.SetObjectId(objectId) + m.SetAttribute(attribute) + return m +} + +// NewPersonalDataCreatedEvent creates a PersonalDataCreated with required fields populated. +func NewPersonalDataCreatedEvent( + common *Common, + tenantId string, + dataSubjectType string, + dataSubjectId string, + objectType string, + objectId string, + attribute string, +) *PersonalDataCreated { + m := &PersonalDataCreated{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetDataSubjectType(dataSubjectType) + m.SetDataSubjectId(dataSubjectId) + m.SetObjectType(objectType) + m.SetObjectId(objectId) + m.SetAttribute(attribute) + return m +} + +// NewPersonalDataReadEvent creates a PersonalDataRead with required fields populated. +func NewPersonalDataReadEvent( + common *Common, + tenantId string, + dataSubjectType string, + dataSubjectId string, + objectType string, + objectId string, + attribute string, +) *PersonalDataRead { + m := &PersonalDataRead{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetDataSubjectType(dataSubjectType) + m.SetDataSubjectId(dataSubjectId) + m.SetObjectType(objectType) + m.SetObjectId(objectId) + m.SetAttribute(attribute) + return m +} + +// NewPersonalDataUpdatedEvent creates a PersonalDataUpdated with required fields populated. +func NewPersonalDataUpdatedEvent( + common *Common, + tenantId string, + dataSubjectType string, + dataSubjectId string, + objectType string, + objectId string, + attribute string, +) *PersonalDataUpdated { + m := &PersonalDataUpdated{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetDataSubjectType(dataSubjectType) + m.SetDataSubjectId(dataSubjectId) + m.SetObjectType(objectType) + m.SetObjectId(objectId) + m.SetAttribute(attribute) + return m +} + +// NewPersonalDataDeletedEvent creates a PersonalDataDeleted with required fields populated. +func NewPersonalDataDeletedEvent( + common *Common, + tenantId string, + dataSubjectType string, + dataSubjectId string, + objectType string, + objectId string, + attribute string, +) *PersonalDataDeleted { + m := &PersonalDataDeleted{} + m.SetCommon(common) + m.SetTenantId(tenantId) + m.SetDataSubjectType(dataSubjectType) + m.SetDataSubjectId(dataSubjectId) + m.SetObjectType(objectType) + m.SetObjectId(objectId) + m.SetAttribute(attribute) + return m +} diff --git a/proto/kms/api/cmk/auditlog/events/v1/events_otlpconverters.pb.go b/proto/kms/api/cmk/auditlog/events/v1/events_otlpconverters.pb.go new file mode 100644 index 0000000..bf28dc2 --- /dev/null +++ b/proto/kms/api/cmk/auditlog/events/v1/events_otlpconverters.pb.go @@ -0,0 +1,2182 @@ +// Code generated by protoc-gen-go-otlpconverters. DO NOT EDIT. + +package auditlogeventsv1 + +import ( + "encoding/hex" + "fmt" + "strings" + + "go.opentelemetry.io/collector/pdata/pcommon" + "go.opentelemetry.io/collector/pdata/plog" + "google.golang.org/protobuf/types/known/timestamppb" +) + +// AuditEvent is implemented by all audit log event types. +type AuditEvent interface { + GetCommon() *Common + ToLogRecord() plog.LogRecord + FromLogRecord(lr plog.LogRecord) error +} + +// ParseAuditEvent parses an OTLP LogRecord into the appropriate AuditEvent type. +// It reads the event type from the LogRecord body and dispatches to the correct FromLogRecord method. +func ParseAuditEvent(lr plog.LogRecord) (AuditEvent, error) { + eventType := lr.Body().Str() + switch eventType { + case "LoginSucceeded": + e := &LoginSucceeded{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "LoginFailed": + e := &LoginFailed{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "UnauthenticatedRequest": + e := &UnauthenticatedRequest{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "UnauthorizedRequest": + e := &UnauthorizedRequest{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "AccessGranted": + e := &AccessGranted{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "TenantCreated": + e := &TenantCreated{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "TenantUpdated": + e := &TenantUpdated{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "TenantDeleted": + e := &TenantDeleted{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "CMKCreated": + e := &CMKCreated{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "CMKRotated": + e := &CMKRotated{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "CMKUnavailable": + e := &CMKUnavailable{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "CMKAvailable": + e := &CMKAvailable{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "CMKDisabled": + e := &CMKDisabled{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "CMKEnabled": + e := &CMKEnabled{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "CMKDeleted": + e := &CMKDeleted{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "SystemOnboarded": + e := &SystemOnboarded{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "SystemSwitched": + e := &SystemSwitched{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "SystemOffboarded": + e := &SystemOffboarded{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "DataCreated": + e := &DataCreated{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "DataRead": + e := &DataRead{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "DataUpdated": + e := &DataUpdated{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "DataDeleted": + e := &DataDeleted{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "PersonalDataCreated": + e := &PersonalDataCreated{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "PersonalDataRead": + e := &PersonalDataRead{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "PersonalDataUpdated": + e := &PersonalDataUpdated{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + case "PersonalDataDeleted": + e := &PersonalDataDeleted{} + if err := e.FromLogRecord(lr); err != nil { + return nil, err + } + return e, nil + default: + return nil, fmt.Errorf("unknown audit event type: %s", eventType) + } +} + +// ToLogRecord converts LoginSucceeded to an OTLP plog.LogRecord. +func (x *LoginSucceeded) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("LoginSucceeded") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("user_id", x.GetUserId()) + lr.Attributes().PutStr("method", x.GetMethod().String()) + + return lr +} + +// FromLogRecord populates LoginSucceeded from an OTLP plog.LogRecord. +func (x *LoginSucceeded) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("user_id"); ok { + x.SetUserId(v.Str()) + } + if v, ok := lr.Attributes().Get("method"); ok { + x.SetMethod(parseLoginMethod(v.Str())) + } + + return nil +} + +// ToLogRecord converts LoginFailed to an OTLP plog.LogRecord. +func (x *LoginFailed) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("LoginFailed") + lr.SetSeverityNumber(plog.SeverityNumberWarn) + lr.SetSeverityText("WARN") + + lr.Attributes().PutStr("user_id", x.GetUserId()) + lr.Attributes().PutStr("method", x.GetMethod().String()) + lr.Attributes().PutStr("failure", x.GetFailure().String()) + + return lr +} + +// FromLogRecord populates LoginFailed from an OTLP plog.LogRecord. +func (x *LoginFailed) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("user_id"); ok { + x.SetUserId(v.Str()) + } + if v, ok := lr.Attributes().Get("method"); ok { + x.SetMethod(parseLoginMethod(v.Str())) + } + if v, ok := lr.Attributes().Get("failure"); ok { + x.SetFailure(parseLoginFailure(v.Str())) + } + + return nil +} + +// ToLogRecord converts UnauthenticatedRequest to an OTLP plog.LogRecord. +func (x *UnauthenticatedRequest) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("UnauthenticatedRequest") + lr.SetSeverityNumber(plog.SeverityNumberWarn) + lr.SetSeverityText("WARN") + + lr.Attributes().PutStr("user_id", x.GetUserId()) + + return lr +} + +// FromLogRecord populates UnauthenticatedRequest from an OTLP plog.LogRecord. +func (x *UnauthenticatedRequest) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("user_id"); ok { + x.SetUserId(v.Str()) + } + + return nil +} + +// ToLogRecord converts UnauthorizedRequest to an OTLP plog.LogRecord. +func (x *UnauthorizedRequest) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("UnauthorizedRequest") + lr.SetSeverityNumber(plog.SeverityNumberWarn) + lr.SetSeverityText("WARN") + + lr.Attributes().PutStr("user_id", x.GetUserId()) + + return lr +} + +// FromLogRecord populates UnauthorizedRequest from an OTLP plog.LogRecord. +func (x *UnauthorizedRequest) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("user_id"); ok { + x.SetUserId(v.Str()) + } + + return nil +} + +// ToLogRecord converts AccessGranted to an OTLP plog.LogRecord. +func (x *AccessGranted) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("AccessGranted") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("resource", x.GetResource()) + lr.Attributes().PutStr("action", x.GetAction()) + + return lr +} + +// FromLogRecord populates AccessGranted from an OTLP plog.LogRecord. +func (x *AccessGranted) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("resource"); ok { + x.SetResource(v.Str()) + } + if v, ok := lr.Attributes().Get("action"); ok { + x.SetAction(v.Str()) + } + + return nil +} + +// ToLogRecord converts TenantCreated to an OTLP plog.LogRecord. +func (x *TenantCreated) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("TenantCreated") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + + return lr +} + +// FromLogRecord populates TenantCreated from an OTLP plog.LogRecord. +func (x *TenantCreated) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + + return nil +} + +// ToLogRecord converts TenantUpdated to an OTLP plog.LogRecord. +func (x *TenantUpdated) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("TenantUpdated") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("property_name", x.GetPropertyName()) + lr.Attributes().PutStr("old_value", x.GetOldValue()) + lr.Attributes().PutStr("new_value", x.GetNewValue()) + + return lr +} + +// FromLogRecord populates TenantUpdated from an OTLP plog.LogRecord. +func (x *TenantUpdated) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("property_name"); ok { + x.SetPropertyName(v.Str()) + } + if v, ok := lr.Attributes().Get("old_value"); ok { + x.SetOldValue(v.Str()) + } + if v, ok := lr.Attributes().Get("new_value"); ok { + x.SetNewValue(v.Str()) + } + + return nil +} + +// ToLogRecord converts TenantDeleted to an OTLP plog.LogRecord. +func (x *TenantDeleted) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("TenantDeleted") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + + return lr +} + +// FromLogRecord populates TenantDeleted from an OTLP plog.LogRecord. +func (x *TenantDeleted) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + + return nil +} + +// ToLogRecord converts CMKCreated to an OTLP plog.LogRecord. +func (x *CMKCreated) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("CMKCreated") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id", x.GetCmkId()) + + return lr +} + +// FromLogRecord populates CMKCreated from an OTLP plog.LogRecord. +func (x *CMKCreated) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id"); ok { + x.SetCmkId(v.Str()) + } + + return nil +} + +// ToLogRecord converts CMKRotated to an OTLP plog.LogRecord. +func (x *CMKRotated) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("CMKRotated") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id", x.GetCmkId()) + + return lr +} + +// FromLogRecord populates CMKRotated from an OTLP plog.LogRecord. +func (x *CMKRotated) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id"); ok { + x.SetCmkId(v.Str()) + } + + return nil +} + +// ToLogRecord converts CMKUnavailable to an OTLP plog.LogRecord. +func (x *CMKUnavailable) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("CMKUnavailable") + lr.SetSeverityNumber(plog.SeverityNumberWarn) + lr.SetSeverityText("WARN") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id", x.GetCmkId()) + + return lr +} + +// FromLogRecord populates CMKUnavailable from an OTLP plog.LogRecord. +func (x *CMKUnavailable) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id"); ok { + x.SetCmkId(v.Str()) + } + + return nil +} + +// ToLogRecord converts CMKAvailable to an OTLP plog.LogRecord. +func (x *CMKAvailable) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("CMKAvailable") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id", x.GetCmkId()) + + return lr +} + +// FromLogRecord populates CMKAvailable from an OTLP plog.LogRecord. +func (x *CMKAvailable) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id"); ok { + x.SetCmkId(v.Str()) + } + + return nil +} + +// ToLogRecord converts CMKDisabled to an OTLP plog.LogRecord. +func (x *CMKDisabled) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("CMKDisabled") + lr.SetSeverityNumber(plog.SeverityNumberWarn) + lr.SetSeverityText("WARN") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id", x.GetCmkId()) + + return lr +} + +// FromLogRecord populates CMKDisabled from an OTLP plog.LogRecord. +func (x *CMKDisabled) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id"); ok { + x.SetCmkId(v.Str()) + } + + return nil +} + +// ToLogRecord converts CMKEnabled to an OTLP plog.LogRecord. +func (x *CMKEnabled) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("CMKEnabled") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id", x.GetCmkId()) + + return lr +} + +// FromLogRecord populates CMKEnabled from an OTLP plog.LogRecord. +func (x *CMKEnabled) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id"); ok { + x.SetCmkId(v.Str()) + } + + return nil +} + +// ToLogRecord converts CMKDeleted to an OTLP plog.LogRecord. +func (x *CMKDeleted) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("CMKDeleted") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id", x.GetCmkId()) + + return lr +} + +// FromLogRecord populates CMKDeleted from an OTLP plog.LogRecord. +func (x *CMKDeleted) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id"); ok { + x.SetCmkId(v.Str()) + } + + return nil +} + +// ToLogRecord converts SystemOnboarded to an OTLP plog.LogRecord. +func (x *SystemOnboarded) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("SystemOnboarded") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("system_id", x.GetSystemId()) + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id", x.GetCmkId()) + + return lr +} + +// FromLogRecord populates SystemOnboarded from an OTLP plog.LogRecord. +func (x *SystemOnboarded) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("system_id"); ok { + x.SetSystemId(v.Str()) + } + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id"); ok { + x.SetCmkId(v.Str()) + } + + return nil +} + +// ToLogRecord converts SystemSwitched to an OTLP plog.LogRecord. +func (x *SystemSwitched) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("SystemSwitched") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("system_id", x.GetSystemId()) + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id_old", x.GetCmkIdOld()) + lr.Attributes().PutStr("cmk_id_new", x.GetCmkIdNew()) + + return lr +} + +// FromLogRecord populates SystemSwitched from an OTLP plog.LogRecord. +func (x *SystemSwitched) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("system_id"); ok { + x.SetSystemId(v.Str()) + } + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id_old"); ok { + x.SetCmkIdOld(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id_new"); ok { + x.SetCmkIdNew(v.Str()) + } + + return nil +} + +// ToLogRecord converts SystemOffboarded to an OTLP plog.LogRecord. +func (x *SystemOffboarded) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("SystemOffboarded") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("system_id", x.GetSystemId()) + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("cmk_id", x.GetCmkId()) + + return lr +} + +// FromLogRecord populates SystemOffboarded from an OTLP plog.LogRecord. +func (x *SystemOffboarded) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("system_id"); ok { + x.SetSystemId(v.Str()) + } + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("cmk_id"); ok { + x.SetCmkId(v.Str()) + } + + return nil +} + +// ToLogRecord converts DataCreated to an OTLP plog.LogRecord. +func (x *DataCreated) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("DataCreated") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("object_type", x.GetObjectType()) + lr.Attributes().PutStr("object_id", x.GetObjectId()) + lr.Attributes().PutStr("attribute", x.GetAttribute()) + lr.Attributes().PutStr("value", x.GetValue()) + + return lr +} + +// FromLogRecord populates DataCreated from an OTLP plog.LogRecord. +func (x *DataCreated) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("object_type"); ok { + x.SetObjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("object_id"); ok { + x.SetObjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("attribute"); ok { + x.SetAttribute(v.Str()) + } + if v, ok := lr.Attributes().Get("value"); ok { + x.SetValue(v.Str()) + } + + return nil +} + +// ToLogRecord converts DataRead to an OTLP plog.LogRecord. +func (x *DataRead) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("DataRead") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("object_type", x.GetObjectType()) + lr.Attributes().PutStr("object_id", x.GetObjectId()) + lr.Attributes().PutStr("attribute", x.GetAttribute()) + lr.Attributes().PutStr("value", x.GetValue()) + + return lr +} + +// FromLogRecord populates DataRead from an OTLP plog.LogRecord. +func (x *DataRead) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("object_type"); ok { + x.SetObjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("object_id"); ok { + x.SetObjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("attribute"); ok { + x.SetAttribute(v.Str()) + } + if v, ok := lr.Attributes().Get("value"); ok { + x.SetValue(v.Str()) + } + + return nil +} + +// ToLogRecord converts DataUpdated to an OTLP plog.LogRecord. +func (x *DataUpdated) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("DataUpdated") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("object_type", x.GetObjectType()) + lr.Attributes().PutStr("object_id", x.GetObjectId()) + lr.Attributes().PutStr("attribute", x.GetAttribute()) + lr.Attributes().PutStr("old_value", x.GetOldValue()) + lr.Attributes().PutStr("new_value", x.GetNewValue()) + + return lr +} + +// FromLogRecord populates DataUpdated from an OTLP plog.LogRecord. +func (x *DataUpdated) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("object_type"); ok { + x.SetObjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("object_id"); ok { + x.SetObjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("attribute"); ok { + x.SetAttribute(v.Str()) + } + if v, ok := lr.Attributes().Get("old_value"); ok { + x.SetOldValue(v.Str()) + } + if v, ok := lr.Attributes().Get("new_value"); ok { + x.SetNewValue(v.Str()) + } + + return nil +} + +// ToLogRecord converts DataDeleted to an OTLP plog.LogRecord. +func (x *DataDeleted) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("DataDeleted") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("object_type", x.GetObjectType()) + lr.Attributes().PutStr("object_id", x.GetObjectId()) + lr.Attributes().PutStr("attribute", x.GetAttribute()) + lr.Attributes().PutStr("value", x.GetValue()) + + return lr +} + +// FromLogRecord populates DataDeleted from an OTLP plog.LogRecord. +func (x *DataDeleted) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("object_type"); ok { + x.SetObjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("object_id"); ok { + x.SetObjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("attribute"); ok { + x.SetAttribute(v.Str()) + } + if v, ok := lr.Attributes().Get("value"); ok { + x.SetValue(v.Str()) + } + + return nil +} + +// ToLogRecord converts PersonalDataCreated to an OTLP plog.LogRecord. +func (x *PersonalDataCreated) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("PersonalDataCreated") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("data_subject_type", x.GetDataSubjectType()) + lr.Attributes().PutStr("data_subject_id", x.GetDataSubjectId()) + lr.Attributes().PutStr("object_type", x.GetObjectType()) + lr.Attributes().PutStr("object_id", x.GetObjectId()) + lr.Attributes().PutStr("attribute", x.GetAttribute()) + lr.Attributes().PutStr("value", x.GetValue()) + + return lr +} + +// FromLogRecord populates PersonalDataCreated from an OTLP plog.LogRecord. +func (x *PersonalDataCreated) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("data_subject_type"); ok { + x.SetDataSubjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("data_subject_id"); ok { + x.SetDataSubjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("object_type"); ok { + x.SetObjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("object_id"); ok { + x.SetObjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("attribute"); ok { + x.SetAttribute(v.Str()) + } + if v, ok := lr.Attributes().Get("value"); ok { + x.SetValue(v.Str()) + } + + return nil +} + +// ToLogRecord converts PersonalDataRead to an OTLP plog.LogRecord. +func (x *PersonalDataRead) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("PersonalDataRead") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("data_subject_type", x.GetDataSubjectType()) + lr.Attributes().PutStr("data_subject_id", x.GetDataSubjectId()) + lr.Attributes().PutStr("object_type", x.GetObjectType()) + lr.Attributes().PutStr("object_id", x.GetObjectId()) + lr.Attributes().PutStr("attribute", x.GetAttribute()) + lr.Attributes().PutStr("value", x.GetValue()) + + return lr +} + +// FromLogRecord populates PersonalDataRead from an OTLP plog.LogRecord. +func (x *PersonalDataRead) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("data_subject_type"); ok { + x.SetDataSubjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("data_subject_id"); ok { + x.SetDataSubjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("object_type"); ok { + x.SetObjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("object_id"); ok { + x.SetObjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("attribute"); ok { + x.SetAttribute(v.Str()) + } + if v, ok := lr.Attributes().Get("value"); ok { + x.SetValue(v.Str()) + } + + return nil +} + +// ToLogRecord converts PersonalDataUpdated to an OTLP plog.LogRecord. +func (x *PersonalDataUpdated) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("PersonalDataUpdated") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("data_subject_type", x.GetDataSubjectType()) + lr.Attributes().PutStr("data_subject_id", x.GetDataSubjectId()) + lr.Attributes().PutStr("object_type", x.GetObjectType()) + lr.Attributes().PutStr("object_id", x.GetObjectId()) + lr.Attributes().PutStr("attribute", x.GetAttribute()) + lr.Attributes().PutStr("old_value", x.GetOldValue()) + lr.Attributes().PutStr("new_value", x.GetNewValue()) + + return lr +} + +// FromLogRecord populates PersonalDataUpdated from an OTLP plog.LogRecord. +func (x *PersonalDataUpdated) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("data_subject_type"); ok { + x.SetDataSubjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("data_subject_id"); ok { + x.SetDataSubjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("object_type"); ok { + x.SetObjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("object_id"); ok { + x.SetObjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("attribute"); ok { + x.SetAttribute(v.Str()) + } + if v, ok := lr.Attributes().Get("old_value"); ok { + x.SetOldValue(v.Str()) + } + if v, ok := lr.Attributes().Get("new_value"); ok { + x.SetNewValue(v.Str()) + } + + return nil +} + +// ToLogRecord converts PersonalDataDeleted to an OTLP plog.LogRecord. +func (x *PersonalDataDeleted) ToLogRecord() plog.LogRecord { + lr := plog.NewLogRecord() + + if c := x.GetCommon(); c != nil { + if ts := c.GetTimestamp(); ts != nil { + lr.SetTimestamp(pcommon.Timestamp(ts.AsTime().UnixNano())) + } + if c.HasTraceId() { + if tid, err := parseTraceID(c.GetTraceId()); err == nil { + lr.SetTraceID(tid) + } + } + if c.HasSpanId() { + if sid, err := parseSpanID(c.GetSpanId()); err == nil { + lr.SetSpanID(sid) + } + } + for k, v := range c.GetProperties() { + lr.Attributes().PutStr("common.properties."+k, v) + } + } + + lr.Body().SetStr("PersonalDataDeleted") + lr.SetSeverityNumber(plog.SeverityNumberInfo) + lr.SetSeverityText("INFO") + + lr.Attributes().PutStr("tenant_id", x.GetTenantId()) + lr.Attributes().PutStr("data_subject_type", x.GetDataSubjectType()) + lr.Attributes().PutStr("data_subject_id", x.GetDataSubjectId()) + lr.Attributes().PutStr("object_type", x.GetObjectType()) + lr.Attributes().PutStr("object_id", x.GetObjectId()) + lr.Attributes().PutStr("attribute", x.GetAttribute()) + lr.Attributes().PutStr("value", x.GetValue()) + + return lr +} + +// FromLogRecord populates PersonalDataDeleted from an OTLP plog.LogRecord. +func (x *PersonalDataDeleted) FromLogRecord(lr plog.LogRecord) error { + // Parse common fields + c := &Common{} + c.SetTimestamp(timestamppb.New(lr.Timestamp().AsTime())) + if !lr.TraceID().IsEmpty() { + c.SetTraceId(formatTraceID(lr.TraceID())) + } + if !lr.SpanID().IsEmpty() { + c.SetSpanId(formatSpanID(lr.SpanID())) + } + + // Parse properties from attributes with common.properties. prefix + props := make(map[string]string) + lr.Attributes().Range(func(k string, v pcommon.Value) bool { + if propKey, ok := strings.CutPrefix(k, "common.properties."); ok { + props[propKey] = v.Str() + } + return true + }) + if len(props) > 0 { + c.SetProperties(props) + } + x.SetCommon(c) + + // Parse event-specific fields + if v, ok := lr.Attributes().Get("tenant_id"); ok { + x.SetTenantId(v.Str()) + } + if v, ok := lr.Attributes().Get("data_subject_type"); ok { + x.SetDataSubjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("data_subject_id"); ok { + x.SetDataSubjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("object_type"); ok { + x.SetObjectType(v.Str()) + } + if v, ok := lr.Attributes().Get("object_id"); ok { + x.SetObjectId(v.Str()) + } + if v, ok := lr.Attributes().Get("attribute"); ok { + x.SetAttribute(v.Str()) + } + if v, ok := lr.Attributes().Get("value"); ok { + x.SetValue(v.Str()) + } + + return nil +} + +// parseTraceID converts a 32-character hex string to a pcommon.TraceID. +func parseTraceID(s string) (pcommon.TraceID, error) { + var tid pcommon.TraceID + b, err := hex.DecodeString(s) + if err != nil { + return tid, err + } + if len(b) != 16 { + return tid, hex.ErrLength + } + copy(tid[:], b) + return tid, nil +} + +// parseSpanID converts a 16-character hex string to a pcommon.SpanID. +func parseSpanID(s string) (pcommon.SpanID, error) { + var sid pcommon.SpanID + b, err := hex.DecodeString(s) + if err != nil { + return sid, err + } + if len(b) != 8 { + return sid, hex.ErrLength + } + copy(sid[:], b) + return sid, nil +} + +// formatTraceID converts a pcommon.TraceID to a 32-character hex string. +func formatTraceID(tid pcommon.TraceID) string { + return hex.EncodeToString(tid[:]) +} + +// formatSpanID converts a pcommon.SpanID to a 16-character hex string. +func formatSpanID(sid pcommon.SpanID) string { + return hex.EncodeToString(sid[:]) +} + +// parseLoginMethod converts a string to LoginMethod. +func parseLoginMethod(s string) LoginMethod { + if v, ok := LoginMethod_value[s]; ok { + return LoginMethod(v) + } + return 0 +} + +// parseLoginFailure converts a string to LoginFailure. +func parseLoginFailure(s string) LoginFailure { + if v, ok := LoginFailure_value[s]; ok { + return LoginFailure(v) + } + return 0 +} diff --git a/sonar-project.properties b/sonar-project.properties index 87ef5f5..aa60c77 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,2 +1,2 @@ -sonar.exclusions=proto/** -sonar.cpd.exclusions=proto/** +sonar.exclusions=proto/**,**/*_test.go +sonar.cpd.exclusions=proto/**,**/*_test.go