No description
Find a file
2024-09-09 13:29:37 +02:00
audit Allow nil as query string in convenience code 2024-09-09 13:29:37 +02:00
gen/go/audit/v1 Update schema description to reflect gRPC as communication protocol 2024-09-09 13:28:51 +02:00
proto Update schema description to reflect gRPC as communication protocol 2024-09-09 13:28:51 +02:00
.gitignore Add generated go files to git 2024-07-15 11:13:35 +02:00
audit-go.iml Rename module 2024-08-23 07:28:15 +02:00
buf.lock Add Schema and API draft 2024-07-05 10:38:18 +02:00
go.mod Add reusable code to create audit events 2024-09-04 15:01:27 +02:00
go.sum Update go to 1.23 and the dependencies versions 2024-08-23 07:44:13 +02:00
README.md Add max length constraints to the AuditLogEntry 2024-08-29 15:02:09 +02:00

audit-go

The audit-go library is the core library for validation and sending of audit events.

API Documentation

The api documentation can be found here.

Supported data types for routing

The following data types are currently supported for routing.
There are SingularType and PluralType representations in the code for them.

Singular-Type Plural-Type Routable to customer Description
system system no The STACKIT system
project projects yes STACKIT project
organization organizations yes STACKIT organization
folder folders yes STACKIT folder

Additional API implementations

There's already an implementation draft of the api for the new dynamically routing audit log solution. As the implementation of the system has not officially been started yet, it's only a draft with integration tests. The API code is private to not confuse users or loose data until the new system is ready to be used.

The code can be found in the api_routable.go and api_routable_test.go files.

Development

Schema Generation

Go structs are generated from Protobuf schema by using Buf.
The schema generator also generates code to validate constraints specified in the schema.

It may be required to install required plugins manually by running:

go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2
go install github.com/envoyproxy/protoc-gen-validate@v1.1.0

Please check that the version matches the version in the go.mod file.

Then the schema can be generated:

cd proto
buf generate

Build

The library can be built by executing the following commands:

go mod download && go mod tidy && go get ./... && go fmt ./... && go vet ./... && golangci-lint run && go build ./... && go test ./...
Testcontainers

To run the tests Docker is needed as Testcontainers is used to run integration tests using a solace docker container.

Register buf validation schema in IntelliJ / Goland

The schema files use Buf protobuf extensions for validation of constraints.

To register the schema in IntelliJ / Goland clone the repo and add the import path:

git clone https://github.com/bufbuild/protovalidate.git

IntelliJ/Goland > Settings > Languages & Frameworks > Protocol Buffers > Import Paths > + (Add Path) > …/protovalidate/proto/protovalidate