Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync IntegrationEnrollKind #47106

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
677 changes: 349 additions & 328 deletions api/gen/proto/go/usageevents/v1/usageevents.pb.go

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions api/proto/teleport/usageevents/v1/usageevents.proto
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,10 @@ message AccessListReviewDelete {

// IntegrationEnrollKind represents the types of integration that
// can be enrolled.
//
// Note: IntegrationEnrollKind enum must be kept in sync with the values defined
// in proto/prehog/v1alpha/teleport.proto. Values 18-25 have become out of sync
// and are manually mapped to each other.
enum IntegrationEnrollKind {
INTEGRATION_ENROLL_KIND_UNSPECIFIED = 0;
INTEGRATION_ENROLL_KIND_SLACK = 1;
Expand All @@ -573,6 +577,11 @@ enum IntegrationEnrollKind {
INTEGRATION_ENROLL_KIND_SERVICENOW = 18;
INTEGRATION_ENROLL_KIND_ENTRA_ID = 19;
INTEGRATION_ENROLL_KIND_DATADOG_INCIDENT_MANAGEMENT = 20;
INTEGRATION_ENROLL_KIND_MACHINE_ID_AWS = 21;
INTEGRATION_ENROLL_KIND_MACHINE_ID_GCP = 22;
INTEGRATION_ENROLL_KIND_MACHINE_ID_AZURE = 23;
INTEGRATION_ENROLL_KIND_MACHINE_ID_SPACELIFT = 24;
INTEGRATION_ENROLL_KIND_MACHINE_ID_KUBERNETES = 25;
}

// IntegrationEnrollMetadata contains common metadata
Expand Down
140 changes: 75 additions & 65 deletions gen/proto/go/prehog/v1alpha/teleport.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion gen/proto/ts/prehog/v1alpha/teleport_pb.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 23 additions & 1 deletion lib/usagereporter/teleport/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,31 @@ func (u *ResourceCreateEvent) Anonymize(a utils.Anonymizer) prehogv1a.SubmitEven
}

func integrationEnrollMetadataToPrehog(u *usageeventsv1.IntegrationEnrollMetadata, userMD UserMetadata) *prehogv1a.IntegrationEnrollMetadata {
// Some enums are out of sync and need to be mapped manually
var prehogKind prehogv1a.IntegrationEnrollKind
switch u.Kind {
case usageeventsv1.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_SERVICENOW:
prehogKind = prehogv1a.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_SERVICENOW
case usageeventsv1.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_ENTRA_ID:
prehogKind = prehogv1a.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_ENTRA_ID
case usageeventsv1.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_DATADOG_INCIDENT_MANAGEMENT:
prehogKind = prehogv1a.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_DATADOG_INCIDENT_MANAGEMENT
case usageeventsv1.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_AWS:
prehogKind = prehogv1a.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_AWS
case usageeventsv1.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_GCP:
prehogKind = prehogv1a.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_GCP
case usageeventsv1.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_AZURE:
prehogKind = prehogv1a.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_AZURE
case usageeventsv1.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_SPACELIFT:
prehogKind = prehogv1a.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_SPACELIFT
case usageeventsv1.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_KUBERNETES:
prehogKind = prehogv1a.IntegrationEnrollKind_INTEGRATION_ENROLL_KIND_MACHINE_ID_KUBERNETES
default:
prehogKind = prehogv1a.IntegrationEnrollKind(u.Kind)
}
return &prehogv1a.IntegrationEnrollMetadata{
Id: u.Id,
Kind: prehogv1a.IntegrationEnrollKind(u.Kind),
Kind: prehogKind,
UserName: userMD.Username,
}
}
Expand Down
5 changes: 5 additions & 0 deletions proto/prehog/v1alpha/teleport.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,10 @@ message AccessListReviewComplianceEvent {

// IntegrationEnrollKind represents the types of integration that
// can be enrolled.
//
// Note: IntegrationEnrollKind enum must be kept in sync with the values defined
// in api/proto/teleport/usageevents/v1/usageevents.proto. Values 18-25 have
// become out of sync and are manually mapped to each other.
enum IntegrationEnrollKind {
INTEGRATION_ENROLL_KIND_UNSPECIFIED = 0;
INTEGRATION_ENROLL_KIND_SLACK = 1;
Expand All @@ -1034,6 +1038,7 @@ enum IntegrationEnrollKind {
INTEGRATION_ENROLL_KIND_MACHINE_ID_KUBERNETES = 22;
INTEGRATION_ENROLL_KIND_ENTRA_ID = 23;
INTEGRATION_ENROLL_KIND_DATADOG_INCIDENT_MANAGEMENT = 24;
INTEGRATION_ENROLL_KIND_SERVICENOW = 25;
}

// IntegrationEnrollMetadata contains common metadata
Expand Down
Loading