mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 09:42:25 +00:00
Deprecates current_billing_period (#27426)
* Applied oss patches * Added changelog * Edited upgrade guide
This commit is contained in:
4
changelog/27426.txt
Normal file
4
changelog/27426.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
```release-note:change
|
||||
activity log: Deprecates the current_billing_period field for /sys/internal/counters/activity. The default start time
|
||||
will automatically be set the billing period start date.
|
||||
```
|
||||
@@ -20,6 +20,11 @@ import (
|
||||
// defaultToRetentionMonthsMaxWarning is a warning message for setting the max retention_months value when retention_months value is more than activityLogMaximumRetentionMonths
|
||||
var defaultToRetentionMonthsMaxWarning = fmt.Sprintf("retention_months cannot be greater than %d; capped to %d.", activityLogMaximumRetentionMonths, activityLogMaximumRetentionMonths)
|
||||
|
||||
const (
|
||||
// WarningCurrentBillingPeriodDeprecated is a warning string that is used to indicate that the current_billing_period field, as the default start time will automatically be the billing period start date
|
||||
WarningCurrentBillingPeriodDeprecated = "current_billing_period is deprecated; unless otherwise specified, all requests will default to the current billing period"
|
||||
)
|
||||
|
||||
// activityQueryPath is available in every namespace
|
||||
func (b *SystemBackend) activityQueryPath() *framework.Path {
|
||||
return &framework.Path{
|
||||
@@ -33,6 +38,7 @@ func (b *SystemBackend) activityQueryPath() *framework.Path {
|
||||
|
||||
Fields: map[string]*framework.FieldSchema{
|
||||
"current_billing_period": {
|
||||
Deprecated: true,
|
||||
Type: framework.TypeBool,
|
||||
Description: "Query utilization for configured billing period",
|
||||
},
|
||||
@@ -254,15 +260,16 @@ func (b *SystemBackend) handleClientMetricQuery(ctx context.Context, req *logica
|
||||
return logical.ErrorResponse("no activity log present"), nil
|
||||
}
|
||||
|
||||
if d.Get("current_billing_period").(bool) {
|
||||
startTime = b.Core.BillingStart()
|
||||
endTime = time.Now().UTC()
|
||||
} else {
|
||||
var err error
|
||||
startTime, endTime, err = parseStartEndTimes(a, d, b.Core.BillingStart())
|
||||
if err != nil {
|
||||
return logical.ErrorResponse(err.Error()), nil
|
||||
}
|
||||
warnings := make([]string, 0)
|
||||
|
||||
if _, ok := d.GetOk("current_billing_period"); ok {
|
||||
warnings = append(warnings, WarningCurrentBillingPeriodDeprecated)
|
||||
}
|
||||
|
||||
var err error
|
||||
startTime, endTime, err = parseStartEndTimes(a, d, b.Core.BillingStart())
|
||||
if err != nil {
|
||||
return logical.ErrorResponse(err.Error()), nil
|
||||
}
|
||||
|
||||
var limitNamespaces int
|
||||
@@ -275,12 +282,15 @@ func (b *SystemBackend) handleClientMetricQuery(ctx context.Context, req *logica
|
||||
return nil, err
|
||||
}
|
||||
if results == nil {
|
||||
resp204, err := logical.RespondWithStatusCode(nil, req, http.StatusNoContent)
|
||||
resp204, err := logical.RespondWithStatusCode(&logical.Response{
|
||||
Warnings: warnings,
|
||||
}, req, http.StatusNoContent)
|
||||
return resp204, err
|
||||
}
|
||||
|
||||
return &logical.Response{
|
||||
Data: results,
|
||||
Warnings: warnings,
|
||||
Data: results,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -352,7 +352,7 @@ This endpoint was added in Vault 1.6.
|
||||
- `limit_namespaces` `(int, optional)` - Controls the total number of by_namespace data returned. This can
|
||||
be used to return the client counts for the specified number of namespaces having highest activity.
|
||||
If no `limit_namespaces` parameter is specified, client counts for all namespaces in specified usage period is returned.
|
||||
- `current_billing_period` `(bool, optional)` - Uses the builtin billing start
|
||||
- `current_billing_period` `(bool, optional)` - **DEPRECATED** Uses the builtin billing start
|
||||
timestamp as `start_time` and the current time as the `end_time`, returning a
|
||||
response with the current billing period information without having to
|
||||
explicitly provide a start and end time.
|
||||
|
||||
@@ -16,6 +16,8 @@ Vault 1.17. **Please read carefully**.
|
||||
|
||||
### Activity Log Changes
|
||||
|
||||
#### Default Activity Log Querying Period
|
||||
|
||||
The field `default_report_months` can no longer be configured or read. Any previously set values
|
||||
will be ignored by the system.
|
||||
|
||||
@@ -36,3 +38,22 @@ WARNING! The following warnings were returned from Vault:
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
|
||||
|
||||
The `current_billing_period` toggle for `/sys/internal/counters/activity` is also deprecated, as this will be set
|
||||
true by default.
|
||||
|
||||
Attempts to set `current_billing_period` will result in the following warning from Vault:
|
||||
|
||||
<CodeBlockConfig hideClipboard>
|
||||
|
||||
```shell-session
|
||||
|
||||
WARNING! The following warnings were returned from Vault:
|
||||
|
||||
* current_billing_period is deprecated; unless otherwise specified, all requests will default to the current billing period
|
||||
|
||||
|
||||
```
|
||||
|
||||
</CodeBlockConfig>
|
||||
|
||||
Reference in New Issue
Block a user