mirror of
https://dev.azure.com/schwarzit/schwarzit.stackit-public/_git/audit-go
synced 2026-02-08 00:57:24 +00:00
Move http-method converter and schema validation test to api package
This commit is contained in:
parent
3f222fc2be
commit
51cf882c93
3 changed files with 5 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
|||
package utils
|
||||
package api
|
||||
|
||||
import (
|
||||
auditV1 "dev.azure.com/schwarzit/schwarzit.stackit-core-platform/audit-go.git/gen/go/audit/v1"
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"dev.azure.com/schwarzit/schwarzit.stackit-core-platform/audit-go.git/audit/utils"
|
||||
auditV1 "dev.azure.com/schwarzit/schwarzit.stackit-core-platform/audit-go.git/gen/go/audit/v1"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
|
|
@ -511,7 +510,7 @@ func NewRequestAttributes(
|
|||
|
||||
return &auditV1.AttributeContext_Request{
|
||||
Id: requestId,
|
||||
Method: utils.StringToHttpMethod(request.Method),
|
||||
Method: StringToHttpMethod(request.Method),
|
||||
Headers: requestHeaders,
|
||||
Path: request.URL.Path,
|
||||
Host: request.Host,
|
||||
|
|
@ -877,7 +876,7 @@ func OperationNameFromUrlPath(path string, requestMethod string) string {
|
|||
operation = strings.TrimPrefix(operation, ".")
|
||||
operation = strings.ToLower(operation)
|
||||
if len(operation) > 0 {
|
||||
method := utils.StringToHttpMethod(requestMethod)
|
||||
method := StringToHttpMethod(requestMethod)
|
||||
var action string
|
||||
switch method {
|
||||
case auditV1.AttributeContext_HTTP_METHOD_PUT:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package schema
|
||||
package api
|
||||
|
||||
import (
|
||||
"dev.azure.com/schwarzit/schwarzit.stackit-core-platform/audit-go.git/audit/api"
|
||||
auditV1 "dev.azure.com/schwarzit/schwarzit.stackit-core-platform/audit-go.git/gen/go/audit/v1"
|
||||
"github.com/bufbuild/protovalidate-go"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
|
@ -19,7 +18,7 @@ func Test_RoutableAuditEvent(t *testing.T) {
|
|||
Visibility: auditV1.Visibility_VISIBILITY_PUBLIC,
|
||||
ObjectIdentifier: &auditV1.ObjectIdentifier{
|
||||
Identifier: "14f7aa86-77ba-4d77-a091-a2cf3395a221",
|
||||
Type: string(api.SingularTypeProject),
|
||||
Type: string(SingularTypeProject),
|
||||
},
|
||||
Data: &auditV1.RoutableAuditEvent_UnencryptedData{UnencryptedData: &auditV1.UnencryptedData{
|
||||
Data: []byte("data"),
|
||||
Loading…
Reference in a new issue