validateWriterClient checks if the client is valid by writing and deleting a secret in the provided mount path.
(kv *vault.KVv2, pathPrefix string)
| 105 | // validateWriterClient checks if the client is valid by writing and deleting a secret |
| 106 | // in the provided mount path. |
| 107 | func validateWriterClient(kv *vault.KVv2, pathPrefix string) error { |
| 108 | ctx := context.Background() |
| 109 | keyPath := strings.Join([]string{pathPrefix, healthCheckSecret}, "/") |
| 110 | if _, err := kv.Put(ctx, keyPath, nil); err != nil { |
| 111 | return err |
| 112 | } |
| 113 | |
| 114 | if err := kv.DeleteMetadata(ctx, keyPath); err != nil { |
| 115 | return fmt.Errorf("deleting health check secret: %w", err) |
| 116 | } |
| 117 | |
| 118 | return nil |
| 119 | } |
| 120 | |
| 121 | func validateReaderClient(kv *vault.KVv2, pathPrefix string) error { |
| 122 | ctx := context.Background() |