Skip to content

Commit

Permalink
CE: Added deleted namespace string (#28080)
Browse files Browse the repository at this point in the history
* Applied oss patch and added docs

* Edited docs issues
  • Loading branch information
divyaac authored Aug 14, 2024
1 parent aff0eae commit 36998a5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
16 changes: 11 additions & 5 deletions vault/activity_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -2792,7 +2792,7 @@ func (a *ActivityLog) calculateByNamespaceResponseForQuery(ctx context.Context,

var displayPath string
if ns == nil {
displayPath = fmt.Sprintf("deleted namespace %q", nsRecord.NamespaceID)
displayPath = fmt.Sprintf(DeletedNamespaceFmt, nsRecord.NamespaceID)
} else {
displayPath = ns.Path
}
Expand Down Expand Up @@ -2873,7 +2873,7 @@ func (a *ActivityLog) prepareNamespaceResponse(ctx context.Context, nsRecords []

var displayPath string
if ns == nil {
displayPath = fmt.Sprintf("deleted namespace %q", nsRecord.NamespaceID)
displayPath = fmt.Sprintf(DeletedNamespaceFmt, nsRecord.NamespaceID)
} else {
displayPath = ns.Path
}
Expand Down Expand Up @@ -3044,6 +3044,12 @@ func (a *ActivityLog) writeExport(ctx context.Context, rw http.ResponseWriter, f
if err != nil {
return err
}
var nsDisplayPath string
if ns == nil {
nsDisplayPath = fmt.Sprintf(DeletedNamespaceFmt, e.NamespaceID)
} else {
nsDisplayPath = ns.Path
}

if !a.includeInResponse(reqNS, ns) {
continue
Expand All @@ -3054,14 +3060,14 @@ func (a *ActivityLog) writeExport(ctx context.Context, rw http.ResponseWriter, f
record := &ActivityLogExportRecord{
ClientID: e.ClientID,
ClientType: e.ClientType,
NamespaceID: ns.ID,
NamespacePath: ns.Path,
NamespaceID: e.NamespaceID,
NamespacePath: nsDisplayPath,
Timestamp: ts.UTC().Format(time.RFC3339),
MountAccessor: e.MountAccessor,
}

if e.MountAccessor != "" {
cacheKey := ns.Path + mountPathIdentity
cacheKey := e.NamespaceID + mountPathIdentity

var identityBackend logical.Backend

Expand Down
5 changes: 3 additions & 2 deletions vault/activity_log_util_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,9 @@ func (a *ActivityLog) sortActivityLogMonthsResponse(months []*ResponseMonth) {
}

const (
noMountAccessor = "no mount accessor (pre-1.10 upgrade?)"
deletedMountFmt = "deleted mount; accessor %q"
noMountAccessor = "no mount accessor (pre-1.10 upgrade?)"
deletedMountFmt = "deleted mount; accessor %q"
DeletedNamespaceFmt = "deleted namespace %q"
)

// mountAccessorToMountPath transforms the mount accessor to the mount path
Expand Down
10 changes: 7 additions & 3 deletions website/content/api-docs/system/internal-counters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1058,10 +1058,10 @@ $ curl \
```

<Note title="Important change to supported versions">
As of 1.16.7, 1.17.3 and later,
the <a href="/vault/docs/concepts/billing-start-date">billing start date</a> automatically
As of 1.16.7, 1.17.3 and later,
the <a href="/vault/docs/concepts/billing-start-date">billing start date</a> automatically
rolls over to the latest billing year at the end of the last cycle.

For more information, refer to the upgrade guide for your Vault version:

[Vault v1.16.x](/vault/docs/upgrading/upgrade-to-1.16.x#auto-rolled-billing-start-date),
Expand Down Expand Up @@ -1105,6 +1105,10 @@ it may be up to 20 minutes delayed.
values are `csv` and `json`. If no format is provided a default of `json`
will be used.

The response will include all child namespaces of the namespace in which the
request was made. If some namespace has subsequently been deleted, its path will
be listed as "deleted namespace :ID:"

### Sample request

```shell-session
Expand Down

0 comments on commit 36998a5

Please sign in to comment.