Skip to content

Commit

Permalink
Add gRPC conversion support for BillingCard events (gravitational#7303)
Browse files Browse the repository at this point in the history
  • Loading branch information
xacrimon authored Jun 15, 2021
1 parent a441275 commit 42beccb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions api/types/events/oneof.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,14 @@ func ToOneOf(in AuditEvent) (*OneOf, error) {
out.Event = &OneOf_MFADeviceDelete{
MFADeviceDelete: e,
}
case *BillingCardCreate:
out.Event = &OneOf_BillingCardCreate{
BillingCardCreate: e,
}
case *BillingCardDelete:
out.Event = &OneOf_BillingCardDelete{
BillingCardDelete: e,
}
default:
return nil, trace.BadParameter("event type %T is not supported", in)
}
Expand Down Expand Up @@ -311,6 +319,10 @@ func FromOneOf(in OneOf) (AuditEvent, error) {
return e, nil
} else if e := in.GetMFADeviceDelete(); e != nil {
return e, nil
} else if e := in.GetBillingCardCreate(); e != nil {
return e, nil
} else if e := in.GetBillingCardDelete(); e != nil {
return e, nil
} else {
if in.Event == nil {
return nil, trace.BadParameter("failed to parse event, session record is corrupted")
Expand Down

0 comments on commit 42beccb

Please sign in to comment.