Skip to content

Commit

Permalink
Add support to event streaming mechanism for WorkloadIdentity
Browse files Browse the repository at this point in the history
  • Loading branch information
strideynet committed Dec 5, 2024
1 parent 35c5bc2 commit 1c132aa
Show file tree
Hide file tree
Showing 3 changed files with 378 additions and 339 deletions.
8 changes: 8 additions & 0 deletions api/client/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
provisioningv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/provisioning/v1"
userprovisioningpb "github.com/gravitational/teleport/api/gen/proto/go/teleport/userprovisioning/v2"
usertasksv1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/usertasks/v1"
workloadidentityv1pb "github.com/gravitational/teleport/api/gen/proto/go/teleport/workloadidentity/v1"
"github.com/gravitational/teleport/api/types"
"github.com/gravitational/teleport/api/types/accesslist"
accesslistv1conv "github.com/gravitational/teleport/api/types/accesslist/convert/v1"
Expand Down Expand Up @@ -135,6 +136,10 @@ func EventToGRPC(in types.Event) (*proto.Event, error) {
out.Resource = &proto.Event_IdentityCenterAccountAssignment{
IdentityCenterAccountAssignment: r,
}
case *workloadidentityv1pb.WorkloadIdentity:
out.Resource = &proto.Event_WorkloadIdentity{
WorkloadIdentity: r,
}
default:
return nil, trace.BadParameter("resource type %T is not supported", r)
}
Expand Down Expand Up @@ -616,6 +621,9 @@ func EventFromGRPC(in *proto.Event) (*types.Event, error) {
} else if r := in.GetPluginStaticCredentials(); r != nil {
out.Resource = r
return &out, nil
} else if r := in.GetWorkloadIdentity(); r != nil {
out.Resource = types.Resource153ToLegacy(r)
return &out, nil
} else {
return nil, trace.BadParameter("received unsupported resource %T", in.Resource)
}
Expand Down
Loading

0 comments on commit 1c132aa

Please sign in to comment.