Skip to content

Commit

Permalink
Consoles: include authorisation rule name
Browse files Browse the repository at this point in the history
Include authorisation rule name in console creation events published to Pub/Sub.
  • Loading branch information
ttamimi committed Nov 21, 2022
1 parent 039113f commit 0ab4780
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis/workloads/v1alpha1/lifecycle_recorder.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ func (l *lifecycleEventRecorderImpl) makeConsoleCommonEvent(eventKind events.Eve

func (l *lifecycleEventRecorderImpl) ConsoleRequest(ctx context.Context, csl *Console, authRule *ConsoleAuthorisationRule) error {
authCount := 0
authRuleName := ""
if authRule != nil {
authCount = authRule.AuthorisationsRequired
authRuleName = authRule.Name
}

event := &events.ConsoleRequestEvent{
Expand All @@ -120,6 +122,7 @@ func (l *lifecycleEventRecorderImpl) ConsoleRequest(ctx context.Context, csl *Co
ConsoleTemplate: csl.Spec.ConsoleTemplateRef.Name,
Console: csl.Name,
RequiredAuthorisations: authCount,
AuthorisationRuleName: authRuleName,
Timestamp: csl.CreationTimestamp.Time,
Labels: csl.Labels,
},
Expand Down
1 change: 1 addition & 0 deletions pkg/workloads/console/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type ConsoleRequestSpec struct {
ConsoleTemplate string `json:"console_template"`
Console string `json:"console"`
RequiredAuthorisations int `json:"required_authorisations"`
AuthorisationRuleName string `json:"authorisation_rule_name"`
Timestamp time.Time `json:"timestamp"`
Labels map[string]string `json:"labels"`
}
Expand Down

0 comments on commit 0ab4780

Please sign in to comment.