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