mirror of
https://dev.azure.com/schwarzit/schwarzit.stackit-public/_git/audit-go
synced 2026-02-16 21:01:45 +00:00
Add http method conversion convenience function
This commit is contained in:
parent
db9440206f
commit
e759ae397a
1 changed files with 30 additions and 0 deletions
30
audit/utils/converter.go
Normal file
30
audit/utils/converter.go
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
auditV1 "dev.azure.com/schwarzit/schwarzit.stackit-core-platform/common-audit.git/gen/go/audit/v1"
|
||||||
|
)
|
||||||
|
|
||||||
|
func StringToHttpMethod(method string) auditV1.AttributeContext_HttpMethod {
|
||||||
|
switch method {
|
||||||
|
case "GET":
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_GET
|
||||||
|
case "HEAD":
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_HEAD
|
||||||
|
case "POST":
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_POST
|
||||||
|
case "PUT":
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_PUT
|
||||||
|
case "DELETE":
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_DELETE
|
||||||
|
case "CONNECT":
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_CONNECT
|
||||||
|
case "OPTIONS":
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_OPTIONS
|
||||||
|
case "TRACE":
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_TRACE
|
||||||
|
case "PATCH":
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_PATCH
|
||||||
|
default:
|
||||||
|
return auditV1.AttributeContext_HTTP_METHOD_UNSPECIFIED
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue