vault/api
Vault Automation 5f77aa78fc
VAULT-42759: Fix logic around setting updated_at field in billing endpoint, enhance tests coverage for the endpoint (#12454) (#12584)
* fix updated_at logic for previous month, add tests

* improvement: separate out metric names into consts

* wholistically cover all metrics in billing api test

* add actual totp data in the ent test

* fix more wording errors

* feedback: remove consts and use metric names directly

* fix a test

* simplify the logic around refreshing data

* simplify the logic by centralizing the atomic tracker interacting inside updateBillingMetrics method, fix the logic inside the endpoint, add tests

* miner fixes

* feedback: set time tracker to zero at set up and at start of month to indicate data has not been updated yet, update test

* attempt to fix deadlock by using statelock free version of update billing metrics method

* remove unnecessary locks inside request handling

* remove duplicate methods - instead create 2 wrappers around the method one with lock and one without

* add a new prefix and methods to store and retrieve last update time

* add comments to explain local prefix behavior for the update method

* replace atomic tracker with storage methods

* add method level tests for the update time storage methods

* add external tests to verify perf replicated cluster independelty track last update time now

* normalize time to utc before storing to storage, fix comments

* code scanql feedback: remove logging of raw error to prevent leakage

* feedback: reorganize and refactor update billing metric method wrappers

* feedback: add go doc to the get method

* feedback: retrieve stored update time for last month, instead of always putting end of month inside computeUpdatedTime

* use equal test instead of within duration inside util tests

* use require equal inside external tests too

* use end of the requested month inside the endpoint for past months

* update tests

* add a new test case for when time is not stored in storage

* fix a bug: add nil check before passing role counts and managed key counts to update method

* feedback: remove update call of of time inside setup billing

* Update vault/consumption_billing_util.go



* Update vault/logical_system_use_case_billing.go



* Update vault/logical_system_use_case_billing.go



* comment fix

* feedback: do not allow refresh on perf standby, add a warning and just retrieve stored data

* add tests

---------

Co-authored-by: Amir Aslamov <amir.aslamov@hashicorp.com>
Co-authored-by: divyaac <divya.chandrasekaran@hashicorp.com>
2026-02-26 21:19:16 +00:00
..
auth Backport go: upgrade go.opentelemetry.io/otel/sdk => 1.40.0 and filippo.io/edwards25519 => v1.1.1 into ce/main (#12496) 2026-02-24 17:49:33 +00:00
cliconfig license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
test-fixtures license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
tokenhelper license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
.copywrite.hcl [DO NOT MERGE UNTIL EOY] update year in LICENSE and copywrite files (#24368) 2024-01-02 13:22:15 -08:00
api_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
auth.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
auth_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
auth_token.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
client.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
client_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
go.mod [VAULT-41179] go: bump golang.org/x/crypto to v0.45.0 (#11056) (#11065) 2025-12-02 21:00:06 +00:00
go.sum [VAULT-41179] go: bump golang.org/x/crypto to v0.45.0 (#11056) (#11065) 2025-12-02 21:00:06 +00:00
hcl_dup_attr_deprecation.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
help.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
kv.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
kv_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
kv_v1.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
kv_v2.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
LICENSE license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
lifetime_watcher.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
logical.go Sync SCIM related files to CE/main (#11037) 2025-12-02 11:44:43 -03:00
logical_requests.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
logical_requests_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
logical_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
output_policy.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
output_policy_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
output_string.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
plugin_helpers.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
plugin_runtime_types.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
plugin_types.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
plugin_types_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
pluginruntimetype_enumer.go Use enumer to generate String() methods for most enums (#25705) 2024-04-17 11:14:14 -07:00
README.md docs: Update outdated vaultproject.io/docs/ links (#22162) 2023-08-15 12:59:34 -04:00
renewbehavior_enumer.go Use enumer to generate String() methods for most enums (#25705) 2024-04-17 11:14:14 -07:00
renewer_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
replication_status.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
request.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
request_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
response.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
secret.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
secret_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
ssh.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
ssh_agent.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
ssh_agent_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sudo_paths.go VAULT-39876 Add sys/reporting/scan to Vault, allowing an output of files with paths and names of Vault secrets (#10068) (#10323) 2025-10-22 21:02:07 +00:00
sudo_paths_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_audit.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_auth.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_billing.go VAULT-41572: hookup billing overview endpoint (#12328) (#12451) 2026-02-20 08:17:23 -05:00
sys_billing_test.go VAULT-42759: Fix logic around setting updated_at field in billing endpoint, enhance tests coverage for the endpoint (#12454) (#12584) 2026-02-26 21:19:16 +00:00
sys_capabilities.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_config_cors.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_generate_root.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_hastatus.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_health.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_init.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_leader.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_leases.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_mfa.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_monitor.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_mounts.go Backport Add override_pinned_version support on tune and enable for secret and auth into ce/main (#10644) 2025-11-06 18:55:42 -08:00
sys_mounts_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_plugins.go Include SHA256 sum field in the list response for external plugins (#10761) (#10805) 2025-11-17 09:58:58 -07:00
sys_plugins_runtimes.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_plugins_runtimes_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_plugins_test.go Include SHA256 sum field in the list response for external plugins (#10761) (#10805) 2025-11-17 09:58:58 -07:00
sys_policy.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_raft.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_rekey.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_reporting_scan.go VAULT-40965 async option for scan API (#11011) (#11751) 2026-01-13 17:40:37 +00:00
sys_rotate.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_seal.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_stepdown.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_ui_custom_message.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_ui_custom_message_test.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00
sys_utilization_report.go license: update headers to IBM Corp. (#10229) (#10233) 2025-10-21 15:20:20 -06:00

Vault API

This provides the github.com/hashicorp/vault/api package which contains code useful for interacting with a Vault server.

For examples of how to use this module, see the vault-examples repo. For a step-by-step walkthrough on using these client libraries, see the developer quickstart.

GoDoc