## 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](https://developers.stackit.schwarz/domains/core-platform/audit-log/sdk/overview/). ### Supported data types for routing The following data types are currently supported for routing. | ObjectType | Routable to customer | Description | |--------------|----------------------|----------------------| | system | no | The STACKIT system | | project | yes | STACKIT project | | organization | yes | STACKIT organization | | folder | 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](./api_routable.go) and [api_routable_test.go](./api_routable_test.go) files. ### Development #### Schema Generation Go structs are generated from Protobuf schema by using [Buf](https://buf.build). The schema generator also generates code to validate constraints specified in the schema. It may be required to install required plugins manually by running: ```shell go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.35.1 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: ```bash cd proto buf generate ``` #### Build The library can be built by executing the following commands: ```bash 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](https://testcontainers.com/) 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: ```bash git clone https://github.com/bufbuild/protovalidate.git ``` IntelliJ/Goland > Settings > Languages & Frameworks > Protocol Buffers > Import Paths > + (Add Path) > …/protovalidate/proto/protovalidate