mirror of
https://dev.azure.com/schwarzit/schwarzit.stackit-public/_git/audit-go
synced 2026-02-16 12:51:44 +00:00
Remove python and java configurations
This commit is contained in:
parent
3d833fe301
commit
07d8183f88
3 changed files with 1 additions and 47 deletions
37
main.py
37
main.py
|
|
@ -1,37 +0,0 @@
|
||||||
# Install protovalidate:
|
|
||||||
# python3 -m venv path/to/venv
|
|
||||||
# source path/to/venv/bin/activate
|
|
||||||
# pip3 install -r requirements.txt
|
|
||||||
import protovalidate
|
|
||||||
|
|
||||||
from audit.v1.audit_event_pb2 import AuditEvent, EventTrigger, RequestDetails
|
|
||||||
from audit.v1.routable_event_pb2 import RoutableAuditEvent, UnencryptedData
|
|
||||||
|
|
||||||
audit_event = AuditEvent()
|
|
||||||
audit_event.event_name = "XXX"
|
|
||||||
audit_event.event_trigger = EventTrigger.EVENT_REQUEST
|
|
||||||
|
|
||||||
audit_event.request.endpoint = "XXX"
|
|
||||||
audit_event.request.source_ip_address = "127.0.0.1"
|
|
||||||
audit_event.request.user_agent = "aaa"
|
|
||||||
|
|
||||||
routable_audit_event = RoutableAuditEvent()
|
|
||||||
routable_audit_event.event_name = "AAA"
|
|
||||||
|
|
||||||
routable_audit_event.unencrypted_data.data = audit_event.SerializeToString()
|
|
||||||
routable_audit_event.unencrypted_data.protobuf_type = audit_event.DESCRIPTOR.full_name
|
|
||||||
|
|
||||||
try:
|
|
||||||
protovalidate.validate(audit_event)
|
|
||||||
except protovalidate.ValidationError as e:
|
|
||||||
print("AuditEvent validation errors:")
|
|
||||||
for error in e.errors():
|
|
||||||
print("field_path: " + error.field_path + ", constraint_id: " + error.constraint_id + ", message: " + error.message)
|
|
||||||
try:
|
|
||||||
protovalidate.validate(routable_audit_event)
|
|
||||||
except protovalidate.ValidationError as e:
|
|
||||||
print("\nRoutableAuditEvent validation errors:")
|
|
||||||
for error in e.errors():
|
|
||||||
print("field_path: " + error.field_path + ", constraint_id: " + error.constraint_id + ", message: " + error.message)
|
|
||||||
|
|
||||||
print(audit_event.SerializeToString())
|
|
||||||
|
|
@ -9,15 +9,7 @@ plugins:
|
||||||
out: ../gen/go
|
out: ../gen/go
|
||||||
opt:
|
opt:
|
||||||
- paths=source_relative
|
- paths=source_relative
|
||||||
- remote: buf.build/protocolbuffers/java:v25.3
|
|
||||||
out: ../gen/java/schema-proto.jar
|
|
||||||
- remote: buf.build/bufbuild/validate-go:v1.0.4
|
- remote: buf.build/bufbuild/validate-go:v1.0.4
|
||||||
out: ../gen/go
|
out: ../gen/go
|
||||||
opt:
|
opt:
|
||||||
- paths=source_relative
|
- paths=source_relative
|
||||||
- remote: buf.build/bufbuild/validate-java:v1.0.4
|
|
||||||
out: ../gen/java
|
|
||||||
opt:
|
|
||||||
- paths=source_relative
|
|
||||||
- remote: buf.build/protocolbuffers/python:v23.4
|
|
||||||
out: ../gen/python
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
protovalidate
|
|
||||||
Loading…
Reference in a new issue