mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Typo and clarity fixes (#14081)
This commit is contained in:
@@ -51,7 +51,7 @@ func ensureTrailingSlash(s string) string {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensureNoTrailingSlash ensures the given string has a trailing slash.
|
// ensureNoTrailingSlash ensures the given string does not have a trailing slash.
|
||||||
func ensureNoTrailingSlash(s string) string {
|
func ensureNoTrailingSlash(s string) string {
|
||||||
s = strings.TrimSpace(s)
|
s = strings.TrimSpace(s)
|
||||||
if s == "" {
|
if s == "" {
|
||||||
@@ -64,7 +64,7 @@ func ensureNoTrailingSlash(s string) string {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensureNoLeadingSlash ensures the given string has a trailing slash.
|
// ensureNoLeadingSlash ensures the given string does not have a leading slash.
|
||||||
func ensureNoLeadingSlash(s string) string {
|
func ensureNoLeadingSlash(s string) string {
|
||||||
s = strings.TrimSpace(s)
|
s = strings.TrimSpace(s)
|
||||||
if s == "" {
|
if s == "" {
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ func (c *KVDeleteCommand) deleteV2(path, mountPath string, client *api.Client) (
|
|||||||
var secret *api.Secret
|
var secret *api.Secret
|
||||||
switch {
|
switch {
|
||||||
case len(c.flagVersions) > 0:
|
case len(c.flagVersions) > 0:
|
||||||
path = addPrefixToVKVPath(path, mountPath, "delete")
|
path = addPrefixToKVPath(path, mountPath, "delete")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ func (c *KVDeleteCommand) deleteV2(path, mountPath string, client *api.Client) (
|
|||||||
secret, err = client.Logical().Write(path, data)
|
secret, err = client.Logical().Write(path, data)
|
||||||
default:
|
default:
|
||||||
|
|
||||||
path = addPrefixToVKVPath(path, mountPath, "data")
|
path = addPrefixToKVPath(path, mountPath, "data")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ func (c *KVDestroyCommand) Run(args []string) int {
|
|||||||
c.UI.Error("Destroy not supported on KV Version 1")
|
c.UI.Error("Destroy not supported on KV Version 1")
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
path = addPrefixToVKVPath(path, mountPath, "destroy")
|
path = addPrefixToKVPath(path, mountPath, "destroy")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(err.Error())
|
c.UI.Error(err.Error())
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ func (c *KVGetCommand) Run(args []string) int {
|
|||||||
var versionParam map[string]string
|
var versionParam map[string]string
|
||||||
|
|
||||||
if v2 {
|
if v2 {
|
||||||
path = addPrefixToVKVPath(path, mountPath, "data")
|
path = addPrefixToKVPath(path, mountPath, "data")
|
||||||
|
|
||||||
if c.flagVersion > 0 {
|
if c.flagVersion > 0 {
|
||||||
versionParam = map[string]string{
|
versionParam = map[string]string{
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ func isKVv2(path string, client *api.Client) (string, bool, error) {
|
|||||||
return mountPath, version == 2, nil
|
return mountPath, version == 2, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func addPrefixToVKVPath(p, mountPath, apiPrefix string) string {
|
func addPrefixToKVPath(p, mountPath, apiPrefix string) string {
|
||||||
if p == mountPath || p == strings.TrimSuffix(mountPath, "/") {
|
if p == mountPath || p == strings.TrimSuffix(mountPath, "/") {
|
||||||
return path.Join(mountPath, apiPrefix)
|
return path.Join(mountPath, apiPrefix)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ func (c *KVListCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if v2 {
|
if v2 {
|
||||||
path = addPrefixToVKVPath(path, mountPath, "metadata")
|
path = addPrefixToKVPath(path, mountPath, "metadata")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(err.Error())
|
c.UI.Error(err.Error())
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ func (c *KVMetadataDeleteCommand) Run(args []string) int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
path = addPrefixToVKVPath(path, mountPath, "metadata")
|
path = addPrefixToKVPath(path, mountPath, "metadata")
|
||||||
if secret, err := client.Logical().Delete(path); err != nil {
|
if secret, err := client.Logical().Delete(path); err != nil {
|
||||||
c.UI.Error(fmt.Sprintf("Error deleting %s: %s", path, err))
|
c.UI.Error(fmt.Sprintf("Error deleting %s: %s", path, err))
|
||||||
if secret != nil {
|
if secret != nil {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ func (c *KVMetadataGetCommand) Run(args []string) int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
path = addPrefixToVKVPath(path, mountPath, "metadata")
|
path = addPrefixToKVPath(path, mountPath, "metadata")
|
||||||
secret, err := client.Logical().Read(path)
|
secret, err := client.Logical().Read(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(fmt.Sprintf("Error reading %s: %s", path, err))
|
c.UI.Error(fmt.Sprintf("Error reading %s: %s", path, err))
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ func (c *KVMetadataPatchCommand) Run(args []string) int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
path = addPrefixToVKVPath(path, mountPath, "metadata")
|
path = addPrefixToKVPath(path, mountPath, "metadata")
|
||||||
|
|
||||||
data := map[string]interface{}{}
|
data := map[string]interface{}{}
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ func (c *KVMetadataPutCommand) Run(args []string) int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
path = addPrefixToVKVPath(path, mountPath, "metadata")
|
path = addPrefixToKVPath(path, mountPath, "metadata")
|
||||||
data := map[string]interface{}{}
|
data := map[string]interface{}{}
|
||||||
|
|
||||||
if c.flagMaxVersions >= 0 {
|
if c.flagMaxVersions >= 0 {
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ func (c *KVPatchCommand) Run(args []string) int {
|
|||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
path = addPrefixToVKVPath(path, mountPath, "data")
|
path = addPrefixToKVPath(path, mountPath, "data")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(err.Error())
|
c.UI.Error(err.Error())
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ func (c *KVPutCommand) Run(args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if v2 {
|
if v2 {
|
||||||
path = addPrefixToVKVPath(path, mountPath, "data")
|
path = addPrefixToKVPath(path, mountPath, "data")
|
||||||
data = map[string]interface{}{
|
data = map[string]interface{}{
|
||||||
"data": data,
|
"data": data,
|
||||||
"options": map[string]interface{}{},
|
"options": map[string]interface{}{},
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ func (c *KVRollbackCommand) Run(args []string) int {
|
|||||||
return 2
|
return 2
|
||||||
}
|
}
|
||||||
|
|
||||||
path = addPrefixToVKVPath(path, mountPath, "data")
|
path = addPrefixToKVPath(path, mountPath, "data")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.UI.Error(err.Error())
|
c.UI.Error(err.Error())
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ func (c *KVUndeleteCommand) Run(args []string) int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
path = addPrefixToVKVPath(path, mountPath, "undelete")
|
path = addPrefixToKVPath(path, mountPath, "undelete")
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
"versions": kvParseVersionsFlags(c.flagVersions),
|
"versions": kvParseVersionsFlags(c.flagVersions),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4298,7 +4298,7 @@ func checkListingVisibility(visibility ListingVisibilityType) error {
|
|||||||
case ListingVisibilityHidden:
|
case ListingVisibilityHidden:
|
||||||
case ListingVisibilityUnauth:
|
case ListingVisibilityUnauth:
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("invalid listing visilibity type")
|
return fmt.Errorf("invalid listing visibility type")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ These metrics represent operational aspects of the running Vault instance.
|
|||||||
| `vault.core.activity.segment_write` | Duration of time taken writing activity log segments to storage. | ms | summary |
|
| `vault.core.activity.segment_write` | Duration of time taken writing activity log segments to storage. | ms | summary |
|
||||||
| `vault.core.check_token` | Duration of time taken by token checks handled by Vault core | ms | summary |
|
| `vault.core.check_token` | Duration of time taken by token checks handled by Vault core | ms | summary |
|
||||||
| `vault.core.fetch_acl_and_token` | Duration of time taken by ACL and corresponding token entry fetches handled by Vault core | ms | summary |
|
| `vault.core.fetch_acl_and_token` | Duration of time taken by ACL and corresponding token entry fetches handled by Vault core | ms | summary |
|
||||||
| `vault.core.handle_request` | Duration of time taken by requests handled by Vault core | ms | summary |
|
| `vault.core.handle_request` | Duration of time taken by non-login requests handled by Vault core | ms | summary |
|
||||||
| `vault.core.handle_login_request` | Duration of time taken by login requests handled by Vault core | ms | summary |
|
| `vault.core.handle_login_request` | Duration of time taken by login requests handled by Vault core | ms | summary |
|
||||||
| `vault.core.in_flight_requests` | Number of in-flight requests. | requests | gauge |
|
| `vault.core.in_flight_requests` | Number of in-flight requests. | requests | gauge |
|
||||||
| `vault.core.leadership_setup_failed` | Duration of time taken by cluster leadership setup failures which have occurred in a highly available Vault cluster. This should be monitored and alerted on for overall cluster leadership status. | ms | summary |
|
| `vault.core.leadership_setup_failed` | Duration of time taken by cluster leadership setup failures which have occurred in a highly available Vault cluster. This should be monitored and alerted on for overall cluster leadership status. | ms | summary |
|
||||||
|
|||||||
Reference in New Issue
Block a user