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

Revert "Added LocalMount field to Export API" #29251

Merged
merged 1 commit into from
Dec 20, 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
Revert "Added LocalMount field to Export API (#29145)"
This reverts commit af6d983.
  • Loading branch information
divyaac authored Dec 20, 2024
commit b03bb9dfb41a5a14e40ab10a4cec9e872084b086
4 changes: 0 additions & 4 deletions changelog/29145.txt

This file was deleted.

11 changes: 3 additions & 8 deletions vault/activity_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,6 @@ type ActivityLogExportRecord struct {
// MountPath is the path of the auth mount associated with the token used
MountPath string `json:"mount_path" mapstructure:"mount_path"`

// LocalMount indicates if the mount only belongs to the current cluster
LocalMount bool `json:"local_mount" mapstructure:"local_mount"`

// Timestamp denotes the time at which the activity occurred formatted using RFC3339
Timestamp string `json:"timestamp" mapstructure:"timestamp"`

Expand Down Expand Up @@ -919,7 +916,7 @@ func (a *ActivityLog) getLastSegmentNumberByEntityPath(ctx context.Context, enti
}

// WalkEntitySegments loads each of the entity segments for a particular start time
func (a *ActivityLog) WalkEntitySegments(ctx context.Context, startTime time.Time, hll *hyperloglog.Sketch, walkFn func(*activity.EntityActivityLog, time.Time, bool) error) error {
func (a *ActivityLog) WalkEntitySegments(ctx context.Context, startTime time.Time, hll *hyperloglog.Sketch, walkFn func(*activity.EntityActivityLog, time.Time, *hyperloglog.Sketch) error) error {
baseGlobalPath := activityGlobalPathPrefix + activityEntityBasePath + fmt.Sprint(startTime.Unix()) + "/"
baseLocalPath := activityLocalPathPrefix + activityEntityBasePath + fmt.Sprint(startTime.Unix()) + "/"

Expand All @@ -943,7 +940,7 @@ func (a *ActivityLog) WalkEntitySegments(ctx context.Context, startTime time.Tim
if err != nil {
return fmt.Errorf("unable to parse segment %v%v: %w", basePath, path, err)
}
err = walkFn(out, startTime, basePath == baseLocalPath)
err = walkFn(out, startTime, hll)
if err != nil {
return fmt.Errorf("unable to walk entities: %w", err)
}
Expand Down Expand Up @@ -3837,7 +3834,7 @@ func (a *ActivityLog) writeExport(ctx context.Context, rw http.ResponseWriter, f
return err
}

walkEntities := func(l *activity.EntityActivityLog, startTime time.Time, isLocal bool) error {
walkEntities := func(l *activity.EntityActivityLog, startTime time.Time, hll *hyperloglog.Sketch) error {
for _, e := range l.Clients {
if _, ok := dedupIDs[e.ClientID]; ok {
continue
Expand Down Expand Up @@ -3869,7 +3866,6 @@ func (a *ActivityLog) writeExport(ctx context.Context, rw http.ResponseWriter, f
NamespacePath: nsDisplayPath,
Timestamp: ts.UTC().Format(time.RFC3339),
MountAccessor: e.MountAccessor,
LocalMount: isLocal,

// Default following to empty versus nil, will be overwritten if necessary
Policies: []string{},
Expand Down Expand Up @@ -4271,7 +4267,6 @@ func baseActivityExportCSVHeader() []string {
"client_id",
"client_type",
"local_entity_alias",
"local_mount",
"namespace_id",
"namespace_path",
"mount_accessor",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1

//go:build testonly
////go:build testonly

package activity_testonly

Expand Down Expand Up @@ -549,7 +549,6 @@ func getCSVExport(t *testing.T, client *api.Client, monthsPreviousTo int, now ti

boolFields := map[string]struct{}{
"local_entity_alias": {},
"local_mount": {},
}

mapFields := map[string]struct{}{
Expand Down
Loading