Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
capif
Manage
Activity
Members
Labels
Plan
Issues
25
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
OCF
capif
Commits
dece008c
Commit
dece008c
authored
7 months ago
by
Jorge Moratinos
Browse files
Options
Downloads
Patches
Plain Diff
Added RedisEvent class to Security Service
parent
62a58201
Branches
Branches containing commit
Tags
Tags containing commit
3 merge requests
!43
Staging to Main for Release 1
,
!26
Draft: Ocf38 logging new events
,
!22
Resolve "Logging CCF use redis to send event service api invocation"
Pipeline
#6220
failed with stages
in 3 minutes and 52 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/TS29222_CAPIF_Security_API/capif_security/core/redis_event.py
+41
-0
41 additions, 0 deletions
...222_CAPIF_Security_API/capif_security/core/redis_event.py
with
41 additions
and
0 deletions
services/TS29222_CAPIF_Security_API/capif_security/core/redis_event.py
0 → 100644
+
41
−
0
View file @
dece008c
from
..encoder
import
JSONEncoder
from
.publisher
import
Publisher
import
json
publisher_ops
=
Publisher
()
class
RedisEvent
():
def
__init__
(
self
,
event
,
event_detail_key
=
None
,
information
=
None
)
->
None
:
self
.
EVENTS_ENUM
=
[
'
SERVICE_API_AVAILABLE
'
,
'
SERVICE_API_UNAVAILABLE
'
,
'
SERVICE_API_UPDATE
'
,
'
API_INVOKER_ONBOARDED
'
,
'
API_INVOKER_OFFBOARDED
'
,
'
SERVICE_API_INVOCATION_SUCCESS
'
,
'
SERVICE_API_INVOCATION_FAILURE
'
,
'
ACCESS_CONTROL_POLICY_UPDATE
'
,
'
ACCESS_CONTROL_POLICY_UNAVAILABLE
'
,
'
API_INVOKER_AUTHORIZATION_REVOKED
'
,
'
API_INVOKER_UPDATED
'
,
'
API_TOPOLOGY_HIDING_CREATED
'
,
'
API_TOPOLOGY_HIDING_REVOKED
'
]
if
event
not
in
self
.
EVENTS_ENUM
:
raise
Exception
(
"
Event (
"
+
event
+
"
) is not on event enum (
"
+
'
,
'
.
join
(
self
.
EVENTS_ENUM
)
+
"
)
"
)
self
.
redis_event
=
{
"
event
"
:
event
}
if
event_detail_key
!=
None
and
information
!=
None
:
self
.
redis_event
[
'
key
'
]
=
event_detail_key
self
.
redis_event
[
'
information
'
]
=
information
def
to_string
(
self
):
return
json
.
dumps
(
self
.
redis_event
,
cls
=
JSONEncoder
)
def
send_event
(
self
):
publisher_ops
.
publish_message
(
"
events-log
"
,
self
.
to_string
())
def
__call__
(
self
):
return
self
.
redis_event
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment